Commit Graph

18 Commits

Author SHA1 Message Date
Jakub Jelinek b3502aa8d4 re PR libgcj/17002 (java.util.TimeZone.getDefault() is broken)
libjava/
	PR libgcj/17002
	PR classpath/28550
	* java/util/VMTimeZone.java (getDefaultTimeZoneId): To read
	/etc/localtime, use ZoneInfo.readTZFile instead of
	VMTimeZone.readtzFile.  Get better timezone name for /etc/localtime,
	either if it is a symlink or through /etc/sysconfig/clock.
	(readSysconfigClockFile): New static method.
	(readtzFile): Removed.
	* java/lang/System.java: Add gnu.java.util.zoneinfo.dir to comments.
	* posix.cc (_Jv_platform_initProperties): Set
	gnu.java.util.zoneinfo.dir.
	* sources.am (gnu_java_util_source_files): Add
	classpath/gnu/java/util/ZoneInfo.java.
	* Makefile.in: Regenerated.
	* java/util/VMTimeZone.h: Regenerated.
	* java/util/TimeZone.h: Regenerated.
	* gnu/java/util/ZoneInfo.h: Generated.
libjava/classpath/
	* java/util/Date.java (parse): Properly parse 09:01:02 as
	hours/minutes/seconds, not as hours/minutes/year.
	* java/util/SimpleTimeZone.java (SimpleTimeZone): Simplify
	{start,end}TimeMode constructor by calling shorter constructor,
	set {start,end}TimeMode fields after it returns.
	(setStartRule): Don't adjust startTime into WALL_TIME.  Set
	startTimeMode to WALL_TIME.
	(endStartRule): Similarly.
	(getOffset): Handle properly millis + dstOffset overflowing into the
	next day.  Adjust startTime resp. endTime based on startTimeMode
	resp. endTimeMode.
	* java/util/TimeZone.java (zoneinfo_dir, availableIDs, aliases0): New
	static fields.
	(timezones): Remove synchronized keyword.  Set zoneinfo_dir.
	If non-null, set up aliases0 and don't put anything into
	timezones0.
	(defaultZone): Call getTimeZone instead of timezones().get.
	(getDefaultTimeZone): Fix parsing of EST5 or EST5EDT6.  Use
	getTimeZoneInternal instead of timezones().get.
	(parseTime): Parse correctly hour:minute.
	(getTimeZoneInternal): New private method.
	(getTimeZone): Do the custom ID checking first, canonicalize
	ID for custom IDs as required by documentation.  Call
	getTimeZoneInternal to handle the rest.
	(getAvailableIDs(int)): Add locking.  Handle zoneinfo_dir != null.
	(getAvailableIDs(File,String,ArrayList)): New private method.
	(getAvailableIDs()): Add locking.  Handle zoneinfo_dir != null.
	* gnu/java/util/ZoneInfo.java: New file.

From-SVN: r122229
2007-02-22 17:04:55 +01:00
Geoffrey Keating 06fcf75439 posix.cc (_Jv_platform_nanotime): Return nanoseconds, not microseconds; use gettimeofday when available.
* posix.cc (_Jv_platform_nanotime): Return nanoseconds, not
	microseconds; use gettimeofday when available.
	* posix-threads.cc (_Jv_CondWait): Improve accuracy and range of
	timeout calculation.
	* testsuite/libjava.lang/Thread_Sleep_2.java: New.
	* testsuite/libjava.lang/Thread_Sleep_2.out: New.
	* testsuite/libjava.lang/Thread_Sleep_2.xfail: New.

From-SVN: r116941
2006-09-14 01:17:31 +00:00
Andreas Tobler d25f0ebc38 re PR libgcj/28226 (posix.cc:222: error: invalid conversion from 'const void*' to 'void*')
2006-07-04  Andreas Tobler  <a.tobler@schweiz.ch>

	PR libgcj/28226:
	* include/posix.h (_Jv_platform_dladdr): Remove const qualifier.
	* include/win32.h (_Jv_platform_dladdr): Likewise.
	* posix.cc (_Jv_platform_dladdr): Likewise.
	* win32.cc (_Jv_platform_dladdr): Likewise.

From-SVN: r115184
2006-07-04 22:21:40 +02:00
Ranjit Mathew 3379268423 javaprims.h (_Jv_uintptr_t): New typedef similar to uintptr_t in C99.
* gcj/javaprims.h (_Jv_uintptr_t): New typedef similar to uintptr_t in
	C99.
	* include/java-stack.h: Include stdlib.h.
	(_Jv_AddrInfo): New structure to hold address information.
	* include/posix.h (_Jv_platform_dladdr): Declare.
	* include/win32.h (_Jv_platform_dladdr): Declare.
	(backtrace): Remove declaration.
	* posix.cc: Include dlfcn.h if available.  Include java-stack.h.
	(_Jv_platform_dladdr): Define.
	* win32.cc: Include string.h.  Include java-stack.h.
	(backtrace): Remove.
	(_Jv_platform_dladdr): Define.
	* sysdep/i386/backtrace.h (fallback_backtrace): Check that a potential
	frame pointer value is 32-bit word-aligned.  Use operand of the CALL
	instruction calling the current function to find its starting address.
	* stacktrace.cc: Do not include dlfcn.h.  Include platform.h.
	(_Jv_StackTrace::getLineNumberForFrame): Use _Jv_platform_dladdr()
	instead of dladdr().
	(_Jv_StackTrace::GetStackTraceElements): Use nCodeMap even for Windows.
	(_Jv_StackTrace::GetClassContext): Use fallback_backtrace() for
	targets with SJLJ exceptions instead of using _Unwind_Backtrace().
	(_Jv_StackTrace::GetFirstNonSystemClassLoader): Likewise.

From-SVN: r115069
2006-06-29 14:57:39 +00:00
Andreas Tobler 6b04402b92 posix.cc (_Jv_platform_nanotime): Declare id with clockid_t.
2006-03-31  Andreas Tobler  <a.tobler@schweiz.ch>

	* posix.cc (_Jv_platform_nanotime): Declare id with clockid_t.

From-SVN: r112587
2006-03-31 22:38:55 +02:00
Tom Tromey bd4ca42499 posix.cc (_Jv_platform_nanotime): Look for CLOCK_MONOTONIC and CLOCK_HIGHRES.
* posix.cc (_Jv_platform_nanotime): Look for CLOCK_MONOTONIC and
	CLOCK_HIGHRES.

From-SVN: r112494
2006-03-29 15:22:30 +00:00
Tom Tromey e59a1e40f3 win32.cc (_Jv_platform_nanotime): New function.
* win32.cc (_Jv_platform_nanotime): New function.
	* include/win32.h (_Jv_platform_nanotime): Declare.
	* posix.cc (_Jv_platform_nanotime): New function.
	* include/posix.h (_Jv_platform_nanotime): Declare.
	* java/lang/natSystem.cc (nanoTime): New method.
	* java/lang/System.java (nanoTime): Declare.
	* include/config.h.in, configure: Rebuilt.
	* configure.ac: Check for clock_gettime.

From-SVN: r111869
2006-03-09 18:47:54 +00:00
Bryce McKinlay 1349c68851 re PR libgcj/25187 (dereferencing type-punned pointer warnings while building libgcj)
2006-02-08  Bryce McKinlay  <mckinlay@redhat.com>

        PR libgcj/25187:
        * gnu/gcj/io/natSimpleSHSStream.cc
        (gnu::gcj::io::SimpleSHSStream::shsFinal): Remove bogus cast.
        * interpret.cc (_Jv_InterpMethod::run): Simplify arguments to
        _Jv_InterpFrame().
        * boehm.cc: #undef some autoconf macros before including gc-config.h.
        (_Jv_MarkObject): Don't mark the class, it is reachable via the vtable.
        (_Jv_MarkArray): Likewise.
        * java/lang/ref/natReference.cc (java::lang::ref::Reference::create):
        Simplify _Jv_GCRegisterDisappearingLink() call.
        * java/lang/Class.h (getComponentType): Use element_type.
        (element_type): New field declaration, as a union with "methods".
        * java/lang/natClassLoader.cc (_Jv_NewArrayClass): Use "element_type".
        * java/net/natVMNetworkInterfacePosix.cc
        (java::net::VMNetworkInterface::getInterfaces): Add "int" cast to
        avoid sign comparison warning.
        * include/java-interp.h (_Jv_InterpFrame): Take thread as second
        argument, not parent call frame.
        * include/x86_64-signal.h (MAKE_THROW_FRAME): Use "gregs" directly,
        without a cast.
        (restore_rt): Declare with hidden visibility, not "static".
        * posix.cc (_Jv_platform_initProperties): Make "tmpdir" a string
        constant.
        * jni.cc (_Jv_JNI_DestroyJavaVM): Use a union to avoid strict alias
        warning

From-SVN: r110783
2006-02-09 01:35:33 +00:00
Adam Megacz 690e3ffd33 posix.cc: added #include<stdio.h>
2003-07-07  Adam Megacz <adam@xwt.org>

        * posix.cc: added #include<stdio.h>

From-SVN: r69066
2003-07-08 04:49:16 +00:00
Mohan Embar c4519773ca jvm.h: (_Jv_GetNbArgs) added (_Jv_GetSafeArg) added (_Jv_SetArgs) added
2003-03-29  Mohan Embar  <gnustuff@thisiscool.com>

        * include/jvm.h: (_Jv_GetNbArgs) added
        (_Jv_GetSafeArg) added
        (_Jv_SetArgs) added
        * prims.cc: (_Jv_GetNbArgs) implemented
        (_Jv_GetSafeArg) implemented
        (_Jv_SetArgs) implemented
        (_Jv_RunMain) use _Jv_SetArgs() instead of explicitly
        setting _Jv_argc and _Jv_argv
        * posix.cc: (_Jv_ThisExecutable) use _Jv_GetSafeArg()
        instead of _Jv_argv
        * java/lang/natRuntime.cc: (insertSystemProperties) use
        _Jv_GetSafeArg() instead of _Jv_argv

From-SVN: r66067
2003-04-25 16:48:13 +00:00
Andrew Haley c068c63834 [multiple changes]
2003-03-10  2003-02-27  Mohan Embar  <gnustuff@thisiscool.com>

        * include/jvm.h: removed declaration of _Jv_ThisExecutable()
        setter; made return value of getter const char* instead of char*
        * prims.cc: removed all references to _Jv_ThisExecutable().
        These are in the platform-specific sections now.
        * posix.cc: define platform-specific _Jv_ThisExecutable().
        Handle DISABLE_MAIN_ARGS and HAVE_PROC_SELF_EXE cases
        * win32.cc: define platform-specific _Jv_ThisExecutable()
        using GetModuleFilename()
        * java/lang/natRuntime.cc: set gnu.gcj.progname property
        to argv[0] instead of _Jv_ThisExecutable()

2003-03-10  Ranjit Mathew  <rmathew@hotmail.com>

        * gnu/gcj/runtime/NameFinder.java (usingAddr2name): New flag
        that is set if we are using addr2name.awk instead of addr2line.
        (NameFinder): Set usingAddr2name if using addr2name.awk.
        (getExternalLabel): New native method to convert a method
        name to an external label.
        (lookup): Convert name given by addr2line to an external label
        before demangling.

        * gnu/gcj/runtime/natNameFinder.cc (LABEL_PREFIX): New string
        constant representing the prefix attached to method names to
        convert them to an external label.
        (gnu::gcj::runtime::NameFinder::getExternalLabel): Define
        using LABEL_PREFIX.

From-SVN: r64111
2003-03-10 19:45:30 +00:00
Adam King 455cd615c2 natSystem.cc (init_properties): Call new function _Jv_platform_initProperties.
2002-04-07  Adam King <aking@dreammechanics.com>

	* java/lang/natSystem.cc (init_properties): Call new function
	_Jv_platform_initProperties.
	* win32 (_Jv_platform_initProperties): New function that adds Win32
	support for the System properties os.name, os.arch, os.version,
	user.name, user.home, and user.dir.
	* include/posix.h, include/win32.h, posix.cc: New function
	_Jv_platform_initProperties.

From-SVN: r51989
2002-04-07 12:27:00 +01:00
Bryce McKinlay f1148658f1 posix.cc (_Jv_platform_gettimeofday): Make sure result doesn't get truncated to int.
* posix.cc (_Jv_platform_gettimeofday): Make sure result doesn't get
        truncated to int.

From-SVN: r50479
2002-03-09 05:48:38 +00:00
Tom Tromey 7258310ad8 posix.cc (internal_gettimeofday): New function.
* posix.cc (internal_gettimeofday): New function.
	(_Jv_select): Use it.

From-SVN: r50442
2002-03-08 16:31:28 +00:00
Adam Megacz 8eeda6e0e7 win32.cc (_Jv_platform_gettimeofday): Now takes no args, returns jlong.
2002-03-07  Adam Megacz  <adam@xwt.org>

        * win32.cc (_Jv_platform_gettimeofday): Now takes no args,
        returns jlong. Added implementation
        * posix.cc (_Jv_platform_gettimeofday): Now takes no args,
        returns jlong.
        * win32.h (_Jv_platform_gettimeofday): Now takes no args,
        returns jlong.
        * posix.h (_Jv_platform_gettimeofday): Now takes no args,
        returns jlong.
        * java/lang/natSystem.cc (currentTimeMillis): Now uses updated
        _Jv_platform_gettimeofday signature.

From-SVN: r50416
2002-03-08 01:03:56 +00:00
Tom Tromey 73272ce608 prims.cc (_Jv_CreateJavaVM): Call _Jv_platform_initialize.
* prims.cc (_Jv_CreateJavaVM): Call _Jv_platform_initialize.
	* win32.cc (win32_exception_handler): Now static.
	* include/win32.h (_Jv_platform_initialize): Declare.
	(win32_exception_handler): Don't declare.
	* java/lang/natSystem.cc (currentTimeMillis): Use
	_Jv_platform_gettimeofday.
	* posix.cc (_Jv_platform_gettimeofday): Renamed.
	(_Jv_select): Use new name.
	(_Jv_platform_initialize): New function.
	* include/posix.h (_Jv_platform_gettimeofday): Renamed from
	_Jv_gettimeofday.
	(_Jv_platform_initialize): Declare.

From-SVN: r49583
2002-02-07 18:59:52 +00:00
Tom Tromey 1eba9d1f8f re PR libgcj/1351 (_Jv_select -vs- Thread.interrupt)
Fix for PR libgcj/1351:
	* posix.cc (_Jv_select): Throw InterruptedIOException if thread is
	interrupted.
	Include Thread.h and InterruptedIOException.h.

From-SVN: r39639
2001-02-13 18:44:51 +00:00
Tom Tromey f536cd95fb Makefile.in: Rebuilt.
* Makefile.in: Rebuilt.
	* Makefile.am (libgcj_la_SOURCES): Added posix.cc.
	* java/net/natPlainSocketImpl.cc: Include posix.h.
	(accept): Use _Jv_select.
	* java/net/natPlainDatagramSocketImpl.cc: Include posix.h.
	(receive): Use _Jv_select.
	* java/io/natFileDescriptorPosix.cc: Include posix.h.
	(available): Use _Jv_select.
	* java/lang/natSystem.cc: Include posix.h.
	(currentTimeMillis): Use _Jv_gettimeofday.
	* include/posix.h: New file.
	* posix.cc: New file.

From-SVN: r35435
2000-08-02 21:54:04 +00:00