Commit Graph

101 Commits

Author SHA1 Message Date
Tom Tromey 3fd8010046 PR libgcj/12016, PR libgcj/18405, PR libgcj/17738:
* java/lang/Package.java (getPackages): Use VMClassLoader when
	appropriate.
	(getPackage): Likewise.
	* prims.cc (_Jv_CreateJavaVM): Call
	_Jv_RegisterBootstrapPackages.
	* include/jvm.h (_Jv_RegisterBootstrapPackages): Declare.
	* java/lang/VMClassLoader.java (getPackage): Rewrote.
	(getPackages): Likewise.
	(definedPackages): New field.
	(definePackageForNative): New method.
	* java/lang/Class.h (_Jv_FindClassInCache): Updated.
	* java/lang/natVMClassLoader.cc (loadClass): Updated.
	* defineclass.cc (handleClassBegin): Use
	ClassLoader.findLoadedClass.
	* java/lang/natClassLoader.cc (_Jv_RegisterInitiatingLoader):
	Rewrote.
	(struct _Jv_LoaderInfo): Removed.
	(initiated_classes): Likewise.
	(_Jv_UnregisterClass): Don't use initiated_classes.
	(_Jv_FindClassInCache): Likewise.  Removed 'loader' argument.
	(_Jv_FindClass): Register classes found during boostrap.
	(BOOTSTRAP_CLASS_LIST_SIZE): New define.
	(bootstrap_class_list): New global.
	(bootstrap_index): Likewise.
	(_Jv_RegisterBootstrapPackages): New function.
	* gnu/gcj/runtime/natVMClassLoader.cc (findClass): Call
	definePackageForNative.
	(findClass): Updated.
	* gnu/gcj/runtime/VMClassLoader.java (definePackageForNative):
	New method.

From-SVN: r93155
2005-01-10 19:39:26 +00:00
Tom Tromey 367390404d * Merged gcj-abi-2-dev-branch to trunk.
(Actual changes too large to list in the commit message;
see ChangeLog.)

From-SVN: r91270
2004-11-25 03:47:08 +00:00
Per Bothner c5fe8107bc prims.cc (unblock_signal): Annotate signum with __unused__ to avoid warnings in the non-POSIX_VERSION case.
* prims.cc (unblock_signal): Annotate signum with __unused__ to
	avoid warnings in the non-POSIX_VERSION case.
	Also, we only need this function if either HANDLE_SEGV or HANDLE_FPE,
	so place it inside an #if block.
	* include/default-signal.h (SIGNAL_HANDLER): Parameters are __unused__.
	* include/i386-signal.h (SIGNAL_HANDLER):  Likewise
	* include/mips-signal.h (SIGNAL_HANDLER):  Likewise
	* include/sparc-signal.h (SIGNAL_HANDLER):  Likewise

From-SVN: r88148
2004-09-26 13:38:49 -07:00
Per Bothner 08bc8777ef * prims.cc (process_gcj_properties): Optimization.
From-SVN: r88147
2004-09-26 13:24:32 -07:00
Bryce McKinlay 8ba141520c prims.cc (JVMPI_NOTIFY_ALLOC): New macro.
2004-08-23  Bryce McKinlay  <mckinlay@redhat.com>

	* prims.cc (JVMPI_NOTIFY_ALLOC): New macro. Call jvmpi_notify_alloc
	only if jvmpi is enabled.
	(jvmpi_notify_alloc): Don't check if jvmpi is enabled here.
	(_Jv_AllocObjectNoFinalizer): Use JVMPI_NOTIFY_ALLOC.
	(_Jv_AllocString): Likewise.
	(_Jv_AllocPtrFreeObject): Likewise.

From-SVN: r86441
2004-08-23 22:31:53 +01:00
Per Bothner b4d49f49bf javaprims.h (_Jv_Utf8Const): Change struct to a class, with private fields and access methods.
* gcj/javaprims.h (_Jv_Utf8Const): Change struct to a class,
	with private fields and access methods.
	(_Jv_NewStringUTF, _Jv_hashUtf8String): New function declarations.
	* gcj/cni.h (_Jv_NewStringUTF): Move to javaprims.h.
	* prims.cc (_Jv_Utf8COnst::init): New method implementation.
	( _Jv_makeUtf8Const): Rewrite using new constructors.
	(hashUtf8String): Rename to +_Jv_hashUtf8String and make non-static.
	* defineclass.cc: Use new _Utf8Const access/convenience methods.
	* jni.cc: Likewise.
	* resolve.cc: Likewise.
	* gcj/field.h: Likewise.
	* include/jvm.h: Likewise.
	* java/lang/Class.h: Likewise.
	* java/lang/natClass.cc: Likwise.
	* java/lang/natClassLoader.cc: Likewise
	* java/lang/reflect/natMethod.cc: Likewise
	* verify.cc: Likewise.
	(_Jv_BytecodeVerifier::make_utf8_const):  Optimize.
	(~_Jv_BytecodeVerifier):  Don't need second _Jv_Free call.

From-SVN: r85854
2004-08-11 23:53:42 -07:00
Bryce McKinlay ffe4e0376f prims.cc (_Jv_InitPrimClass): Don't create an array class.
2004-07-23  Bryce McKinlay  <mckinlay@redhat.com>

	* prims.cc (_Jv_InitPrimClass): Don't create an array class.
	(_Jv_CreateJavaVM): Don't pass array vtable parameter to
	_Jv_InitPrimClass.
	(DECLARE_PRIM_TYPE): Don't declare array vtables.
	* include/jvm.h (struct _Jv_ArrayVTable): Removed.
	* java/lang/Class.h (_Jv_InitPrimClass): Update friend declaration.

From-SVN: r85109
2004-07-24 02:17:29 +01:00
Bryce McKinlay f82bb1bed3 re PR libgcj/16591 (Missing '#ifndef DISABLE_MAIN_ARGS' in _Jv_RunMain (libjava/prims.cc))
2004-07-20  Bryce McKinlay  <mckinlay@redhat.com>

	PR libgcj/16591
	* prims.cc (_Jv_RunMain): Don't call _Jv_SetArgs if
	DISABLE_MAIN_ARGS is defined.

From-SVN: r84964
2004-07-20 18:57:58 +01:00
Bryce McKinlay b4ffdef7aa prims.cc (process_gcj_properties): Don't increment i within LHS of assignment.
2004-07-19  Bryce McKinlay  <mckinlay@redhat.com>

	* prims.cc (process_gcj_properties): Don't increment i within LHS
	of assignment.

From-SVN: r84957
2004-07-20 16:36:56 +01:00
Bryce McKinlay 6187fd28ad re PR libgcj/7587 (direct threaded interpreter not thread-safe)
2004-07-13  Bryce McKinlay  <mckinlay@redhat.com>

	PR libgcj/7587
	* interpret.cc (compile_mutex): New.
	(_Jv_InitInterpreter): New. Initialize compile_mutex.
	(run): Lock compile_mutex before calling compile() if compilation is
	required.
	* prims.cc (_Jv_CreateJavaVM): Call _Jv_InitInterpreter().
	* include/java-interp.h (_Jv_InitInterpreter): Declare.

From-SVN: r84644
2004-07-13 22:03:03 +01:00
Bryce McKinlay 31a7b75558 re PR awt/16748 (IAA.ImageComponentsTest: Freezes When Window Is Resized)
2004-07-11  Bryce McKinlay  <mckinlay@redhat.com>

	PR libgcj/16748
	* prims.cc (_Jv_CreateJavaVM): Fix comment.
	* gnu/gcj/runtime/FinalizerThread.java (init): New. Native.
	(finalizerReady): Now native.
	(run): Likewise.
	(runFinalizers): Removed.
	* gnu/gcj/runtime/natFinalizerThread.cc (run): Implement here. Use
	a primitive lock, and don't hold it while running the finalizers.
	(runFinalizers): Implement. Don't aquire any Java lock.
	(finalizerReady): Use lock primitives to signal finalizer thread.

From-SVN: r84531
2004-07-11 22:19:47 +01:00
Michael Koch 74fa958ec7 FirstThread.java, [...]: Removed.
2004-07-04  Michael Koch  <konqueror@gmx.de>

	* gnu/gcj/runtime/FirstThread.java,
	gnu/gcj/runtime/natFirstThread.cc: Removed.
	* gnu/java/lang/MainThread.java,
	gnu/java/lang/natMainThread.cc: New files.
	* prims.cc (_Jv_RunMain): Use MainThread instead of FirstThread.
	* Makefile.am: Added new files and removed deleted ones.
	* Makefile.in: Regenerated.

From-SVN: r84085
2004-07-04 15:27:05 +00:00
Ranjit Mathew bd760894e6 prims.cc (_Jv_CreateJavaVM): Install SEGV and FPE handlers...
* prims.cc (_Jv_CreateJavaVM): Install SEGV and FPE handlers,
	if desired, before the default class loader is initialised.
	Call INIT_SEGV only if HANDLE_SEGV is defined.

From-SVN: r83348
2004-06-18 13:59:04 +00:00
Bryce McKinlay 245c3c04af prims.cc (_Jv_AllocObject): Remove `size' argument.
libjava:
2004-04-15  Bryce McKinlay  <mckinlay@redhat.com>

	* prims.cc (_Jv_AllocObject): Remove `size' argument.
	(_Jv_AllocObjectNoFinalizer): Likewise.
	(_Jv_AllocObjectNoInitNoFinalizer): Likewise.
	(_Jv_AllocPtrFreeObject): Likewise.
	(_Jv_AllocString): Moved from natString.cc. Call collector interface
	directly even in the JVMPI case.
	* gcj/cni.h (JvAllocObject): Remove `size' argument from
	_Jv_AllocObject calls.
	* gcj/javaprims.h: Update prototypes.
	* gnu/gcj/natCore.cc (_Jv_create_core): Use `new', not
	_Jv_AllocObject.
	* java/lang/Class.h: Update _Jv_AllocObject friend prototype.
	* java/lang/natString.cc (_Jv_AllocString): Move to prims.cc.

gcc/cp:
2004-04-15  Bryce McKinlay  <mckinlay@redhat.com>

	* init.c (build_new_1): Don't use type size argument for Java
	_Jv_AllocObject call.

gcc/java:
2004-04-15  Bryce McKinlay  <mckinlay@redhat.com>

	* expr.c (expand_java_NEW): Don't use size argument for
	_Jv_AllocObject calls.
	* parse.y (patch_invoke): Likewise.

From-SVN: r80754
2004-04-16 17:27:19 +01:00
Nathan Bryant 092b50e2d7 re PR libgcj/12001 (_Jv_FindClass dumps core when Oracle's classes12.zip in $CLASSPATH)
PR libgcj/12001:
	* gnu/gcj/runtime/VMClassLoader.java (VMClassLoader): Pass empty
	array to superclass.
	(init): Changed interface; add URLs here.
	(initialize): New static method.
	* prims.cc (_Jv_CreateJavaVM): Initialize ClassLoader here...
	(_Jv_RunMain): ... not here.

Co-Authored-By: Tom Tromey <tromey@redhat.com>

From-SVN: r75889
2004-01-14 22:49:58 +00:00
Ralph Loader bf1b388d0e prims.cc (_Jv_NewObjectArray): Make sure byte size doesn't overflow a jint.
* prims.cc (_Jv_NewObjectArray): Make sure byte size doesn't
	overflow a jint.
	(_Jv_NewPrimArray): Check for overflowing a jint, replacing a
	check for overflowing size_t, since the lower level functions
	take a jint.
	* testsuite/libjava.lang/newarray_overflow.java:  New file.
	* testsuite/libjava.lang/newarray_overflow.out:  New file.

From-SVN: r72577
2003-10-16 21:19:53 +00:00
Tom Tromey b71d486c40 natClassLoader.cc (_Jv_InitNewClassFields): Removed.
* java/lang/natClassLoader.cc (_Jv_InitNewClassFields): Removed.
	(defineClass): Updated.
	(_Jv_NewClass): Likewise.
	* prims.cc (_Jv_InitPrimClass): Don't call
	_Jv_InitNewClassFields.

From-SVN: r72444
2003-10-13 22:08:51 +00:00
Tom Tromey d801e245eb VMClassLoader.java (loadClass): Now native.
* java/lang/VMClassLoader.java (loadClass): Now native.
	* java/lang/natClassLoader.cc (loadClass): Implement.
	* prims.cc (_Jv_RunMain): Initialize ClassLoader.

From-SVN: r72038
2003-10-02 15:34:28 +00:00
Andrew Haley 9dfc2ec225 jcf-parse.c (java_parse_file): Write otable and atable.
2003-10-01  Andrew Haley  <aph@redhat.com>

        * jcf-parse.c (java_parse_file): Write otable and atable.
        * java-tree.h (atable_methods): New.
        (atable_decl): New.
        (atable_syms_decl): New.
        (enum java_tree_index): Add JTI_ATABLE_METHODS, JTI_ATABLE_DECL,
        JTI_ATABLE_SYMS_DECL.  Rename JTI_METHOD_SYMBOL* to JTI_SYMBOL*.
        (symbol_*type): Rename method_symbol* to symbol*type.
        (emit_offset_symbol_table): Delete.
        (emit_symbol_table): New.
        (get_symbol_table_index): New.
        (atable_type): New.
        * expr.c (build_field_ref): Handle flag_indirect_dispatch.
        (build_known_method_ref): Likewise.
        (get_symbol_table_index): Rename from get_offset_table_index.
        Parameterize to allow re-use by differing types of symbol table.
        (build_invokevirtual): Pass table to get_offset_table_index.
        * decl.c (java_init_decl_processing): Push types and decls for
        atable and atable_syyms.
        * class.c (build_static_field_ref): Handle flag_indirect_dispatch.
        (make_class_data): Add new fields atable and atable_syms.
        (emit_symbol_table): Rename from emit_offset_symbol_table.
        Parameterize to allow re-use by different types of symbol table.
        (build_symbol_entry): Renamed from build_method_symbols_entry.

2003-10-01  Andrew Haley  <aph@redhat.com>

        * java/lang/natClass.cc (initializeClass): Check for otable and
        atable.
        (_Jv_LinkOffsetTable): Check for existence of atable.  Rewrite
        loops using for().  Search superinterfaces.  Check for fields as
        well as methods.  Initialize atable as well as otable: check for
        static methods as well as virtual methods.
        * java/lang/Class.h (struct _Jv_AddressTable): New.
        (atable): New.
        (atable_syms): New.
        * include/jvm.h (_Jv_equalUtf8Consts): constify.
        * prims.cc (_Jv_equalUtf8Consts): constify.

From-SVN: r71979
2003-10-01 16:22:13 +00:00
Andrew Haley 2510de8d0b prims.cc (unblock_signal): New function.
2003-08-19  Andrew Haley  <aph@redhat.com>

	* prims.cc (unblock_signal): New function.
	(SIGNAL_HANDLER): Use it.
	(SIGNAL_HANDLER): Likewise.

From-SVN: r70598
2003-08-20 14:32:16 +00:00
Tom Tromey ffd94572f4 Runtime.java: Comment fix.
* java/lang/Runtime.java: Comment fix.
	* java/lang/ClassLoader.java (isAncestorOf): New method.
	(getParent): Uncommented security check.  Use isAncestorOf.
	* include/jvm.h (_Jv_CheckAccess): Declare.
	* java/lang/reflect/natConstructor.cc (newInstance): Perform
	access check.
	Include IllegalAccessException.h, ArrayIndexOutOfBoundsException.h.
	* java/lang/reflect/natArray.cc (newInstance): Pass caller's
	class loader to _Jv_GetArrayClass.
	Include ArrayIndexOutOfBoundsException.h.
	* java/lang/reflect/Field.java: Update comment to reflect status.
	(equals): Fixed indentation.
	* java/lang/Class.h (Class): Declare memberAccessCheck, not
	checkMemberAccess.  Make _Jv_CheckAccess a friend.
	* java/lang/Class.java (memberAccessCheck): New method from
	Classpath.
	(checkMemberAccess): Removed.
	(getDeclaredMethod): Use memberAccessCheck.
	(getField): Likewise.
	(getMethod): Likewise.
	* resolve.cc (_Jv_ResolvePoolEntry): Use _Jv_CheckAccess.
	(_Jv_SearchMethodInClass): Likewise.
	* prims.cc (_Jv_CheckAccess): New function.
	* jni.cc (_Jv_JNI_FindClass): Use getClassLoaderInternal.
	(_Jv_JNI_GetAnyFieldID): Likewise.
	* java/lang/natClass.cc (forName): Use getClassLoaderInternal.
	(getClassLoader): Added security check.
	(getConstructor): Call memberAccessCheck.
	(getDeclaredClasses): Likewise.
	(getDeclaredField): Likewise.
	(getDeclaredFields): Likewise.
	(_getConstructors): Likewise.
	(getDeclaredConstructor): Likewise.
	(getDeclaredMethods): Likewise.
	(getFields): Likewise.
	(getMethods): Likewise.
	(newInstance): Likewise.
	(_Jv_MakeVTable): Put method name in exception.
	* java/lang/reflect/natMethod.cc (getType): Use
	getClassLoaderInternal.
	(_Jv_GetTypesFromSignature): Likewise.
	(invoke): Perform access check.
	(_Jv_CallAnyMethodA): Removed old FIXME comments.
	Include ArrayIndexOutOfBoundsException.h.
	* java/lang/reflect/natField.cc (getType): Use
	getClassLoaderInternal.
	(_Jv_CheckFieldAccessibility): Removed.
	(getAddr): Use _Jv_CheckAccess; find caller.
	Include ArrayIndexOutOfBoundsException.h.

From-SVN: r69621
2003-07-21 01:54:06 +00:00
Andrew Haley bec3e66d1a prims.cc (catch_segv): Create exception in handler.
2003-06-12  Andrew Haley  <aph@redhat.com>

        * prims.cc (catch_segv): Create exception in handler.
        (catch_fpe): Likewise.
        (_Jv_divI, _Jv_remI, _Jv_divJ, _Jv_remJ): Likewise.
        (_Jv_ThrowSignal): Remove.

        * include/x86_64-signal.h (INIT_SEGV): Delete reference to nullp.
        * include/default-signal.h (INIT_SEGV, INIT_FPE): Delete reference
        to nullp and arithexception.
        * include/dwarf2-signal.h (INIT_SEGV, INIT_FPE): Likewise.
        * include/i386-signal.h (INIT_SEGV, INIT_FPE): Likewise.
        * include/s390-signal.h (INIT_SEGV, INIT_FPE): Likewise.
        * include/sparc-signal.h (INIT_SEGV, INIT_FPE): Likewise.
        * include/win32-signal.h (INIT_SEGV, INIT_FPE): Likewise.

From-SVN: r67892
2003-06-13 12:20:45 +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
Mark Mitchell dfe5a36e95 boehm.cc: Remove stray semicolon.
* boehm.cc: Remove stray semicolon.
	* interpret.cc: Likewise.
	* prims.cc: Likewise.
	* verify.cc (_Jv_BytecodeVerifier::verify_fail): Move definition
	earlier to ensure default arguments are processed.
	* gcj/array.h (JArray): Add forward declaration.
	(elements): Likewise.
	* gcj/javaprim.h: Remove stray semicolons.
	* include/bohm-gc.h: Likewise.
	* include/jni.h: Likewise.
	* include/jvm.h: Likewise.
	* java/lang/Class.h (_Jv_GetArrayClass): Declare _Jv_NewArrayClass.

From-SVN: r60556
2002-12-28 06:38:52 +00:00
Tom Tromey 76508852a0 Makefile.in: Rebuilt.
* Makefile.in: Rebuilt.
	* Makefile.am (nat_source_files): Added natVMSecurityManager,
	natResourceBundle.
	* java/util/ResourceBundle.java (Security): Removed.
	(getCallingClassLoader): Now native.
	* java/util/natResourceBundle.cc: New file.
	* java/lang/natVMSecurityManager.cc: New file.
	* java/lang/VMSecurityManager.java (getClassContext): Now native.

From-SVN: r59840
2002-12-05 00:49:30 +00:00
Andrew Haley 421f9e6091 natClassLoader.cc (_Jv_PrepareCompiledClass): Call _Jv_PushClass.
2002-12-03  Andrew Haley  <aph@redhat.com>

        * java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): Call
	_Jv_PushClass.
        (_Jv_InitNewClassFields): Set protectionDomain and chain = NULL.
        (_Jv_PopClass): New.
        (_Jv_PushClass): New.
        * java/lang/natClass.cc (forName (jstring)): Use a StackTrace to
        discover the ClassLoader of our caller.
        (_Jv_CheckArrayStore): Don't check that a class is assignment
        compatible with Object.
        * java/lang/natVMTHrowable.cc: Delete.
        * gnu/gcj/runtime/StackTrace.java: New, partly copied from
	java.lang.VMThrowable.
        (StackTrace(), StackTrace(int)): New constructors.
        (classAt, methodAt, update, methodAtAddress): New methods.
        (map): New field.
	* java/lang/VMThrowable.java: Use StackTrace instead of
	natVMTHrowable.
	* java/lang/Class.h (getClassLoaderInternal): New.
        (class Class): Be friendly with _Jv_PopClass and _Jv_PushClass.
        Be friendly with gnu::gcj::runtime::StackTrace.
        (Object.chain): New field.
        * include/java-interp.h (class _Jv_InterpMethod): Be friendly with
        gnu::gcj::runtime::StackTrace.
        * prims.cc (_Jv_NewObjectArray): Use getClassLoaderInternal()
        instead of getClassLoader().
        * verify.cc (class _Jv_BytecodeVerifier): Likewise.
        java::lang::VMThrowable.
        * Makefile.am (core_java_source_files): Add MethodRef.java,
	StackTrace.java.
        (nat_source_files): Remove natVMThrowable.cc; add natStackTrace.cc.
        * Makefile.in: Rebuild.

2002-12-03  Andrew Haley  <aph@redhat.com>

	* class.c (make_class_data): New field, "chain".
	* decl.c (java_init_decl_processing): Likewise.

From-SVN: r59769
2002-12-03 13:50:05 +00:00
Tom Tromey fead5eb589 For PR java/8415:
* java/lang/reflect/natMethod.cc (getType): Use _Jv_FindClass.
	* prims.cc (_Jv_FindClassFromSignature): Indentation fix.

From-SVN: r58757
2002-11-02 21:33:30 +00:00
Mark Wielaard 6e0532cdf6 Makefile.am (libgcj_la_SOURCES): Remove name-finder.cc.
* Makefile.am (libgcj_la_SOURCES): Remove name-finder.cc.
        (core_java_source_files): Add VMThrowable.java and NameFinder.java
        (nat_source_files): Remove natThrowable.cc, add natVMThrowable.cc
        and natNameFinder.cc.
        * Makefile.in: Regenerate.
        * prims.cc: Use trace_enabled from VMThrowable.
        * name-finder.cc: Removed.
        * gcj/javaprims.h: Add class VMThrowable.
        * gnu/gcj/runtime/NameFinder.java: New file.
        * gnu/gcj/runtime/natNameFinder.cc: Likewise.
        * include/name-finder.h: Removed.
        * java/lang/Throwable.java (printStackTrace (PrintStream)): Use new
        method stackTraceString().
        (printStackTrace (PrintWriter)): Likewise.
        (stackTraceString): Complete rewrite of old printStackTrace using
        StringBuffer.
        (stackTraceStringBuffer): New helper method for stackTraceString().
        (fillInStackTrace): Delegate to VMTrowable.
        (getStackTrace): Likewise.
        (getStackTrace0): Removed.
        (trace_enabled, stackTraceBytes): Moved to new VMThrowable.java.
        (setStackTrace): Copy given array.
        * java/lang/natThrowable.cc: Removed (replaced by natVMThrowable).
        * java/lang/VMThrowable.java: New class.
        * java/lang/natVMThrowable.cc: New file.

From-SVN: r56556
2002-08-24 22:46:19 +00:00
Bryce McKinlay 4559716751 Hashtable synchronization for PowerPC.
libjava:
	Hashtable synchronization for PowerPC.
	* configure.in: Define SLOW_PTHREAD_SELF if configure.host set
	slow_pthread_self. Set up symlink for sysdeps directory.
	* configure: Rebuild.
	* configure.host: Document more shell variables. Set sysdeps_dir
	for most platforms. Set slow_pthread_self for i686. Set
	enable_hash_synchronization_default and slow_pthread_self for PowerPC.
	* posix-threads.cc (_Jv_ThreadSelf_out_of_line): Use release_set so
	that memory barrier is emitted where required.
	* prims.cc: 64-bit align static primitive class instances.
	* include/posix-threads.h (_Jv_ThreadSelf for SLOW_PTHREAD_SELF): Add
	read_barrier() to enforce ordering of reads.
	* sysdep/powerpc/locks.h: New file. Implementation of synchronization
	primitives for PowerPC.
	* sysdep/i386/locks.h: New file. Synchronization primitives for i386
	moved from natObject.cc.
	* sysdep/alpha/locks.h: Likewise.
	* sysdep/ia64/locks.h: Likewise.
	* sysdep/generic/locks.h: Likewise.
	* java/lang/natObject.cc: Move thread synchronization primitives to
	system-dependent headers.
gcc/java:
	* decl.c (java_init_decl_processing): Make sure class_type_node
	alignment is not less than 64 bits if hash synchronization isenabled.

boehm-gc:
	* include/gc_priv.h: Define ALIGN_DOUBLE on 32 bit targets if GCJ
	support is enabled, for hash synchronization.

From-SVN: r50523
2002-03-10 03:53:16 +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
Adam Megacz b8fe3c1e06 configure.in: Changed mingw) to *mingw*).
2002-02-06  Adam Megacz <adam@xwt.org>

        * configure.in: Changed mingw) to *mingw*).
        * win32.cc: Created this file.
        * win32.h: Created this file.
        * win32.cc, prims.cc, win32.h (win32_exception_handler): Moved
        win32_exception_handler from prims.cc to win32.cc, added
        header in win32.h.
        * prims.cc: removed some #ifdef-WIN32'd headers which are no
        longer needed now that we have platform.h

From-SVN: r49566
2002-02-07 05:26:42 +00:00
Anthony Green b5ee195f1e embedded updates
From-SVN: r49562
2002-02-07 03:24:12 +00:00
Adam Megacz 6d829370c0 prims.cc: Added #undef STRICT after #include<windows.h>.
2002-02-01  Adam Megacz <adam@xwt.org>

	* prims.cc: Added #undef STRICT after #include<windows.h>.

From-SVN: r49430
2002-02-02 04:37:54 +00:00
Adam Megacz a7006428b6 2002-02-01 Adam Megacz <adam@xwt.org>
* prims.cc
        (_Jv_CreateJavaVM): We now use WIN32 instead of
        USE_WIN32_SIGNALLING and USE_WINSOCK.
        (win32_exception_handler): Now throws an exception out of
        the signal handler; assumes SJLJ

From-SVN: r49429
2002-02-02 04:34:15 +00:00
Tom Tromey 68940f3f3c For PR java/5088:
* java/lang/natClassLoader.cc (_Jv_InitNewClassFields): New
	function.
	(_Jv_NewClass): Use it.
	(defineClass0): Use it.
	* prims.cc (_Jv_InitPrimClass): Adjust vtable here.
	(_Jv_InitPrimClass): Use _Jv_InitNewClassFields.
	(_Jv_NewArray): Don't abort; just throw exception.
	Include InternalError.h.
	* java/lang/Class.h (Class::Class): Declare, don't define.
	(Class): Declare _Jv_InitNewClassFields as a friend.
	(union _Jv_Self): Removed.

From-SVN: r48081
2001-12-16 22:28:35 +00:00
Hans Boehm 938f37772e prims.cc: Some old cleanups.
* libjava/prims.cc: Some old cleanups.  The collector now
	handles test for out of memory.
	* libjava/prims.cc, libjava/gcj/javaprims.h:
	(_Jv_AllocObjectNoInitNoFinalizer, _Jv_AllocObjectNoFinalizer):
	New functions for finalizer-free allocation.
	(jvmpi_notify_alloc): Became separate function.
	* libjava/java/lang/Object.h, libjava/include/jvm.h: Adjust for
	revised vtable layout on IA64.  With TARGET_VTABLE_USES_DESCRIPTORS,
	there is only one extra descriptor.

From-SVN: r48002
2001-12-14 18:43:55 +00:00
Tom Tromey 4e41d14893 prims.cc (_Jv_RunMain): Use `using' to simplify code.
* prims.cc (_Jv_RunMain): Use `using' to simplify code.  Set
	_Jv_Jar_Class_Path early.

From-SVN: r47965
2001-12-13 04:19:36 +00:00
Tom Tromey 1ca1c91bd9 For PR libgcj/1147:
* prims.cc (JvConvertArgv): Convert using current locale's
	encoding.

From-SVN: r47862
2001-12-11 04:03:57 +00:00
Bryce McKinlay afb2dec526 prims.cc (_Jv_Abort): Always print error message using fprintf, don't try to allocate.
* prims.cc (_Jv_Abort): Always print error message using fprintf,
        don't try to allocate.
        (_Jv_CreateJavaVM): Set gcj::runTimeInitialized.
        * include/jvm.h (gcj::runTimeInitialized): New variable declaration.
        * java/lang/natClassLoader.cc (_Jv_RegisterClassHookDefault): Handle
        duplicate class registration with JvFail if the runtime hasn't been
        initialized yet.

From-SVN: r46424
2001-10-23 06:42:03 +01:00
Bryce McKinlay 107abb2f61 Eliminate use of C++ static constructors.
* interpret.cc: Remove static Utf8Consts. Use namespace gcj.
	* jni.cc: Likewise.
	* resolve.cc: Likewise.
	* defineclass.cc: Likewise.
	(_Jv_ClassReader::handleClassBegin): Synchronize call to
	_Jv_RegisterClass.
	* include/jvm.h (void_signature, clinit_name, init_name, finit_name):
	Declare in namespace gcj.
	* java/lang/Class.h (Class): Remove initialization for primitive
	types.
	(friend void _Jv_InitPrimClass): This is in prims.cc.
	* prims.cc (_Jv_InitPrimClass): Do primitive type initialization
	here instead.
	(void_signature, clinit_name, init_name, finit_name): Define in
	namespace gcj.
	(_Jv_CreateJavaVM): Call _Jv_InitThreads, _Jv_InitGC, and
	_Jv_InitializeSyncMutex from here. Initialize Utf8 constants.
	Initialize primitive types.
	* java/lang/natClassLoader.cc (_Jv_RegisterClasses): Don't call
	initialization routines. Don't synchronize.
	* java/lang/natRuntime.cc (_load): Synchronize on java.lang.Class
	across dlopen call.

From-SVN: r46282
2001-10-16 09:35:17 +01:00
Tom Tromey eeedeb5a17 natFinalizerThread.cc: New file.
* gnu/gcj/runtime/natFinalizerThread.cc: New file.
	* java/lang/natRuntime.cc: Include FinalizerThread.h.
	(runFinalization): Call finalizerReady.
	* nogc.cc (_Jv_GCInitializeFinalizers): New function.
	* prims.cc: Include VirtualMachineError.h, FinalizerThread.h.
	(_Jv_CreateJavaVM): Start the finalizer thread.
	* no-threads.cc: Include InternalError.h.
	(_Jv_ThreadStart): Throw InternalError.
	(_Jv_ThreadInitData): Don't throw error if this is not the first
	thread.
	* Makefile.in: Rebuilt.
	* Makefile.am (ordinary_java_source_files): Added
	FinalizerThread.java.
	(nat_source_files): Added natFinalizerThread.cc.
	* include/jvm.h (_Jv_GCInitializeFinalizers): Declare.
	* boehm.cc (_Jv_GCInitializeFinalizers): New function.
	* gnu/gcj/runtime/FirstThread.java (run): Start finalizer thread.
	* gnu/gcj/runtime/FinalizerThread.java: New file.

From-SVN: r46163
2001-10-10 22:25:43 +00:00
Tom Tromey 62a040818a prims.cc (_Jv_NewMultiArrayUnchecked): New method.
* prims.cc (_Jv_NewMultiArrayUnchecked): New method.
	(_Jv_NewMultiArray): Use it.  Check each array dimension.
	(_Jv_NewMultiArray): Likewise.
	* java/lang/reflect/natMethod.cc (can_widen): Nothing promotes to
	`char'.
	* java/lang/reflect/natArray.cc (newInstance): Throw
	IllegalArgumentException if there are no dimensions.

From-SVN: r45951
2001-10-02 13:44:32 +00:00
Per Bothner 8635bb79f2 ClassLoader.java (system): Remove static field.
* java/lang/ClassLoader.java (system):  Remove static field.
	(getSystemClassLoader):  Get gnu.gcj.runtime.VMClassLoader.instance
	directly instead of using it to set the system field.
	(loadClass):  Use VMClassLoader.instance instead of system field.
	(findSystemClass):   Similar.
	* prims.cc (_Jv_RunMain):  Clear VMClassLoader::instance rather
	than ClassLoader::system which no longer exists.
	* java/lang/natClassLoader.java (_Jv_FindClass):  Simplify.

From-SVN: r45343
2001-08-31 18:17:24 -07:00
Bryce McKinlay 2dc55bc99f Makefile.am: New friends for java/lang/Thread.h.
* Makefile.am: New friends for java/lang/Thread.h.
	* prims.cc (runFirst): Removed.
	(JvRunMain): Merged into _Jv_RunMain. Now just calls that.
	(_Jv_RunMain): Now takes either a klass or class name parameter.
	Create a gnu.gcj.runtime.FirstThread and attach the native thread
	to that, then run it using _Jv_ThreadRun. Remove special handling of
	jar files, instead pass is_jar parameter through to FirstThread.
	* gcj/javaprims.h: Add prototypes for _Jv_ThreadRun and new variant
	of _Jv_AttachCurrentThread.
	* gnu/gcj/runtime/FirstThread.java (FirstThread): Now extends Thread.
	(run): New method. Take care of looking up main class manifest
	attribute and calling forName if neccessary. Then call call_main.
	(call_main): New native method.
	* gnu/gcj/runtime/natFirstThread.cc (call_main): New function, code
	relocated from prims.cc. Look up and call main method.
	* java/lang/Thread.java (run_): Removed.
	* java/lang/natThread.cc (run_): Renamed to...
	(_Jv_ThreadRun): this. JVMPI notification code moved to ...
	(_Jv_NotifyThreadStart): here. New function.
	(countStackFrames, destroy, resume, suspend, stop): Throw
	UnsupportedOperationExceptions rather than JvFail'ing.
	(_Jv_AttachCurrentThread): New variant takes a Thread argument.
	Existing version wraps new variant.

From-SVN: r45182
2001-08-26 12:30:09 +01:00
Tom Tromey 870f3799af prims.cc (JNI_OnLoad): Don't declare.
* prims.cc (JNI_OnLoad): Don't declare.
	(_JNI_OnLoad): Don't define.
	(_Jv_CreateJavaVM): Don't handle JNI_OnLoad.

From-SVN: r44590
2001-08-03 01:25:17 +00:00
Rainer Orth edd60b15d1 prims.cc (_JNI_OnLoad): New function.
* prims.cc (_JNI_OnLoad): New function.
	(JNI_OnLoad): Use it.
	(_Jv_CreateJavaVM): Check for _JNI_OnLoad, not NULL.

From-SVN: r44316
2001-07-24 20:08:58 +00:00
Tom Tromey 6728a61d1f natRuntime.cc (_Jv_FindSymbolInExecutable): Return NULL if no library on the list has the symbol.
* java/lang/natRuntime.cc (_Jv_FindSymbolInExecutable): Return
	NULL if no library on the list has the symbol.
	(init): Call add_library on the program itself.
	* prims.cc (JvRunMain): Initialize Runtime before searching for
	`main'.
	(_Jv_RunMain): Likewise.

From-SVN: r43413
2001-06-15 23:22:02 +00:00
Anthony Green 6a6a4abb1a Check for sigaction.
From-SVN: r42790
2001-06-02 08:34:33 +00:00
Tom Tromey 3610e0d548 [multiple changes]
2001-05-23  Tom Tromey  <tromey@redhat.com>

	* posix-threads.cc (_Jv_self_cache): Renamed from self_cache.
	* gcj/Makefile.in: Rebuilt.
	* gcj/Makefile.am (gcj_HEADERS): Added libgcj-config.h.
	* gcj/javaprims.h: Include gcj/libgcj-config.h.
	* gcj/libgcj-config.h.in: New file.
	* libgcj.spec.in (*jc1): Added @HASH_SYNC_SPEC@.
	* configure: Rebuilt.
	* configure.in: Enable hash synchronization by default on some
	platforms.
	(HASH_SYNC_SPEC): New subst.
	(AC_CONFIG_HEADER): Added gcj/libgcj-config.h.
	Correctly use `test -z' instead of `test -n' in a couple places.
	(JV_HASH_SYNCHRONIZATION): Use AC_DEFINE; don't add to
	LIBGCJ_CXXFLAGS.
	* configure.host (enable_java_net_default): Initialize.
	(enable_hash_synchronization_default): New variable.

2001-05-23  Hans Boehm <Hans_Boehm@hp.com>

	* boehm.cc (_Jv_MarkObj): Don't mark sync_info when hash
	synchronization in use.
	(_Jv_MarkArray): Likewise.
	(_Jv_AllocBytes): Don't check return result.
	(handle_out_of_memory): New function.
	(_Jv_InitGC): Set GC_oom_fn.
	(trace_one_vtable): New global.
	(_Jv_AllocTraceOne): New function.
	* configure.in: Added --enable-hash-synchronization.
	* defineclass.cc, prims.cc, resolve.cc, java/lang/natString.cc,
	java/net/natInetAddress.cc: Remove _Jv_AllocBytesChecked.
	* nogc.cc (_Jv_AllocObj): Throw out-of-memory.
	(_Jv_AllocArray): Likewise.
	(_Jv_AllocBytes): Likewise.
	(_Jv_AllocPtrFreeObject): New function.
	(_Jv_AllocTraceOne): Likewise.
	* posix-threads.cc (_Jv_ThreadRegister): Handle slow
	pthread_self().
	(self_cache): New global.
	(_Jv_ThreadSelf_out_of_line): New function.
	* prims.cc (_Jv_AllocBytesChecked): Removed.
	(_Jv_ThrowNoMemory): New function.
	(_Jv_AllocObject): Don't check for null return from allocator.
	(_Jv_NewObjectArray): Likewise.
	(_Jv_AllocPtrFreeObject): New function.
	(_Jv_NewPrimArray): Allocate pointer-free object if possible.
	* include/javaprims.h (_Jv_AllocPtrFreeObject): Declare.
	(_Jv_MonitorEnter, _Jv_MonitorExit): Don't return value.
	* include/boehm-gc.h (_Jv_AllocObj): Define.
	(_Jv_AllocPtrFreeObj): Define.
	* include/jvm.h (_Jv_AllocPtrFreeObj): Declare.
	(_Jv_ThrowNoMemory): Declare.
	(_Jv_AllocTraceOne): Declare.
	(_Jv_AllocBytesChecked): Removed.
	* include/posix-threads.h (_Jv_MutexInit, _Jv_MutexLock,
	_Jv_MutexUnlock): Handle LOCK_DEBUG.
	(_Jv_ThreadSelf): Handle case where system pthread_self() is
	slow.
	* java/lang/Class.h (Class): Declare _Jv_AllocPtrFreeObj as
	friend.
	* java/lang/Object.h (sync_info): Conditional upon presence of
	hash synchronization.
	* java/lang/natObject.cc: Much new code to handle thin locks and
	hash synchronization.
	* java/lang/natString.cc (_Jv_AllocString): Allocate pointer-free
	object if possible.

From-SVN: r42519
2001-05-24 05:40:37 +00:00