Commit Graph

57 Commits

Author SHA1 Message Date
Tom Tromey 91edd042ff Makefile.in: Rebuilt.
* Makefile.in: Rebuilt.
	* Makefile.am (ordinary_java_source_files): Added new files.
	* java/lang/Class.h (_Jv_sharedlib_register_hook): Declare as
	friend.
	* java/net/URLClassLoader.java (findClass): Don't use
	findURLResource.  Use loader's getClass method.
	(URLLoader.getClass): New method.
	(addURL): Handle `gcjlib' URLs.
	(SoURLLoader): New class.
	(SoResource): Likewise.
	* gnu/gcj/protocol/gcjlib/Connection.java: New file.
	* gnu/gcj/protocol/gcjlib/Handler.java: New file.
	* include/jvm.h (struct _Jv_core_chain): Moved from natCore.cc.
	(_Jv_RegisterCoreHook): Declare.
	(_Jv_FindCore): Declare.
	* gnu/gcj/runtime/SharedLibHelper.java: New file.
	* gnu/gcj/runtime/natSharedLibLoader.cc (CoreHookFunc): New
	typedef.
	(core_hook): New function.
	(struct SharedLibDummy) [saved_core]: New field.
	(init): Set _Jv_RegisterCoreHook.  Throw exception on failure.
	(register_hook): Set protection domain and class loader on new
	class.
	(finalize): Free core chain.
	* gnu/gcj/Core.java (Core): New constructor.
	* gnu/gcj/runtime/SharedLibLoader.java: Rewrote to use
	SharedLibHelper.
	* gnu/gcj/natCore.cc (_Jv_RegisterResource): Indentation fixlet.
	(_Jv_create_core): New function.
	(create): Use it.
	(default_register_resource): New function.
	(_Jv_RegisterCoreHook): New global.
	(_Jv_RegisterResource): Use it.
	(core_chain_struct): Removed.
	(_Jv_FindCore): New function.
	(_Jv_FreeCoreChain): New function.

From-SVN: r70892
2003-08-28 22:17:37 +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
Mark Wielaard 827452ae5c Makefile.am (core_java_source_files): Add VMObjectStreamClass.java.
* Makefile.am (core_java_source_files): Add VMObjectStreamClass.java.
       (nat_source_files): Add natVMObjectStreamClass.cc.
       * Makefile.in: Regenerated.
       * gcj/javaprims.h (namespace java): Regenerated.
       * java/io/ObjectStreamClass.java (getClassUID): Call
       VMObjectStreamClass.hasClassInitializer().
       (hasClassInitializer): Removed.
       * java/io/VMObjectStreamClass.java: New class.
       * java/io/natVMObjectStreamClass.cc: New file.
       * java/lang/Class.h: Make java::io::VMObjectStreamClass friend class.

From-SVN: r61501
2003-01-20 06:46:28 +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 a1aba4f9a5 natClassLoader.cc (defineClass0): Removed erroneous comment.
* java/lang/natClassLoader.cc (defineClass0): Removed erroneous
	comment.
	* java/lang/ClassLoader.java (defineClass): Use chained
	exception when rethrowing.
	* defineclass.cc (handleClassBegin): Mark class as interpreted.
	* java/lang/reflect/Modifier.java (INVISIBLE, INTERPRETED): New
	constants.
	* resolve.cc (_Jv_PrepareMissingMethods): New function.
	(_Jv_PrepareClass): Use it.
	* include/java-interp.h (_Jv_IsInterpretedClass): Rewrote.
	(_Jv_InterpClass): _Jv_PrepareMissingMethods now friend.
	* java/lang/Class.h (Class::getModifiers): Mask with ALL_FLAGS.
	(Class): _Jv_PrepareMissingMethods now friend.
	* java/lang/natClassLoader.cc (defineClass0): Use JvSynchronize.
	Record `NULL' for system class loader.
	(_Jv_RegisterInitiatingLoader): Use JvSynchronize.  Special case
	system class loader.
	(_Jv_FindClassInCache): Likewise.
	(_Jv_UnregisterClass): Use JvSynchronize.  Free old loader info.
	(_Jv_FindClass): Special case system class loader.
	* java/lang/natClass.cc (_Jv_abstractMethodError): New function.
	(_Jv_SetVTableEntries): Put _Jv_abstractMethodError into empty
	vtable slots.
	(_Jv_LayoutVTableMethods): Don't generate vtable slot for a method
	in a final class.
	(_getDeclaredMethod): Don't return synthetic methods.
	(getDeclaredMethods): Likewise.
	(_getMethod): Likewise.
	(_getMethods): Likewise.

From-SVN: r60319
2002-12-19 19:31:55 +00:00
Tom Tromey eaa2834f9f Class.h (_Jv_SetVTableEntries): Updated declaration.
* java/lang/Class.h (_Jv_SetVTableEntries): Updated declaration.
	* resolve.cc: Don't include AbstractMethodError.h.
	(_Jv_abstractMethodError): Removed.
	* defineclass.cc (handleMethodsBegin): Initialize method index to
	-1.
	* java/lang/natClass.cc (_Jv_LayoutVTableMethods): Don't set
	method index for "new" final method.
	(_Jv_SetVTableEntries): Compare index against -1 instead of using
	isVirtualMethod.  Added `flags' argument.
	(_Jv_MakeVTable): Throw exception for abstract method in concrete
	class.

From-SVN: r59847
2002-12-05 07:43:45 +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
Jeff Sturm a5db0683cb resolve.cc (METHOD_NOT_THERE, [...]): Remove.
* resolve.cc (METHOD_NOT_THERE, METHOD_INACCESSIBLE): Remove.
	(_Jv_ResolvePoolEntry): Use _Jv_Method.index, not
	_Jv_DetermineVTableIndex, to determine vtable offset.
	(_Jv_DetermineVTableIndex): Remove.
	(_Jv_PrepareClass): Don't layout vtable.  Use _Jv_MakeVTable instead.

	* java/lang/Class.h (friend int _Jv_DetermineVTableIndex): Remove.

From-SVN: r58780
2002-11-04 02:45:31 +00:00
Tom Tromey afa54b4c09 Class.h: Move JV_STATE_ERROR before JV_STATE_DONE.
* java/lang/Class.h: Move JV_STATE_ERROR before JV_STATE_DONE.
	* java/lang/natClass.cc (initializeClass): Don't return just
	because self==thread.

From-SVN: r58763
2002-11-02 23:52:56 +00:00
Tom Tromey f470196114 Class.h (_getDeclaredMethod): Declare.
* java/lang/Class.h (_getDeclaredMethod): Declare.
	(_getMethod): Now private.
	* java/lang/natClass.cc (_getDeclaredMethod): Renamed from
	getDeclaredMethod.  Now returns NULL on failure.
	* java/lang/Class.java (_getDeclaredMethod): Declare.
	(getDeclaredMethod): No longer native; implements access checks.

From-SVN: r56772
2002-09-03 21:33:46 +00:00
Tom Tromey 97d8f7e7e7 Class.h: Include Package.h.
* java/lang/Class.h: Include Package.h.
	(Class::getProtectionDomain): Declare.
	(Class::getPackage): Declare.

From-SVN: r56640
2002-08-28 20:05:34 +00:00
Tom Tromey 0d49ec1158 re PR libgcj/7060 (getMethod() doesn't search super interface)
2002-07-04  Tom Tromey  <tromey@redhat.com>
            Jeff Sturm  <jsturm@one-point.com>

	Fix for PR libgcj/7060:
	* java/lang/Class.h (_getMethod): Renamed from getMethod.
	* java/lang/natClass.cc (_getMethod): Renamed from getMethod.
	Recurse into superinterfaces.  Don't throw NoSuchMethodException.
	* java/lang/Class.java (getMethod): New Java implementation;
	complies with spec.
	(_getMethod): New native method.

Co-Authored-By: Jeff Sturm <jsturm@one-point.com>

From-SVN: r55266
2002-07-05 20:40:11 +00:00
Tom Tromey fdae83abe7 verify.cc (branch_prepass): Updated for change to exception handler type.
* verify.cc (branch_prepass): Updated for change to exception
	handler type.
	(verify_instructions_0): Likewise.
	* defineclass.cc (handleCodeAttribute): Initialize `prepared'.
	(handleExceptionTableEntry): Updated for change to exception
	handler type.
	* java/lang/Class.h (Class): Removed _Jv_InterpMethodInvocation.
	* include/java-interp.h (_Jv_InterpMethodInvocation): Removed.
	(union _Jv_InterpPC): New.
	(class _Jv_InterpException): Changed types to _Jv_InterpPC.
	(class _Jv_InterpMethod): Added new `prepared' field.
	(class _Jv_InterpMethod): Added `compile' method.  Removed
	`continue1' and `find_exception'.  Changed arguments to `run'.
	* interpret.cc (union insn_slot): New.
	(find_exception): Removed.
	(run_normal): Removed most logic.
	(run_synch_object): Likewise; also, use JvSynchronize.
	(run_synch_class): Likewise.
	(run): Removed.
	(continue1): Renamed as `run'.  Compile bytecode if required.
	Add new code to allow refinement of direct-threaded code at
	runtime.  Handle exceptions.
	(SAVE_PC): Removed.
	(compile): New method.
	(SET_ONE, SET_INSN, SET_INT, SET_DATUM): New defines.
	(NULLARRAYCHECK): Don't use SAVE_PC.
	(pc_t): New typedef.
	(TAKE_GOTO, GET1S, GET1U, GET2U, AVAL1U, AVAL2U, AVAL2UP,
	SKIP_GOTO, GOTO_VAL, PCVAL, AMPAMP): New macros.

From-SVN: r54968
2002-06-24 20:38:47 +00:00
Tom Tromey 419831367f Class.h (Class::desiredAssertionStatus): Declare.
* java/lang/Class.h (Class::desiredAssertionStatus): Declare.
	(Class::getPackagePortion): Likewise.
	* java/lang/Class.java (desiredAssertionStatus): New method from
	Classpath.
	(getPackagePortion): Likewise.
	* java/lang/VMClassLoader.java (defaultAssertionStatus,
	packageAssertionStatus, classAssertionStatus): New methods from
	Classpath.
	* java/lang/ClassLoader.java (defaultAssertionStatus,
	systemPackageAssertionStatus, packageAssertionStatus,
	systemClassAssertionStatus, classAssertionStatus): New fields from
	Classpath.
	(setDefaultAssertionStatus, setPackageAssertionStatus,
	setClassAssertionStatus, clearAssertionStatus): New methods from
	Classpath.
	* Makefile.in: Rebuilt.
	* Makefile.am (core_java_source_files): Added AssertionError.java.
	* java/lang/AssertionError.java: New from Classpath.

From-SVN: r54517
2002-06-11 17:33:22 +00:00
Tom Tromey 83d9978859 re PR libgcj/2428 (Classloader is not set)
Fix for PR libgcj/2428:
	* java/lang/natClass.cc: Include RuntimePermission.h.
	(getClassLoader): Define.
	* java/lang/Class.h (Class.getClassLoader): Only declare.

From-SVN: r48253
2001-12-21 19:47:50 +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
Bryce McKinlay 861ef92859 java-tree.h (otable_methods, [...]): New field/global tree definitions.
gcc/java:

	* java-tree.h (otable_methods, otable_decl, otable_syms_decl,
	otable_type, otable_ptr_type, method_symbol_type,
	method_symbols_array_type, method_symbols_array_ptr_type): New
	field/global tree definitions.
	(flag_indirect_dispatch): New flag.
	* decl.c (java_init_decl_processing): Initialize new otable and
	otable_syms type nodes and decls. Add new field "index" to
	method_type_node.
	* class.c (build_method_symbols_entry): New function.
	(make_method_value): Set "index" to to method's vtable index for
	virtual methods when indirect-dispatch is not used.
	(make_class_data): For indirect-dispatch, dont emit the dtable_decl,
	and set vtable_method_count to -1. Set otable and otable_syms field
	if indirect-dispatch is used and there was something to put in them.
	(build_method_symbols_entry): New function.
	(emit_offset_symbol_table): New function.
	* expr.c (get_offset_table_index): New function.
	(build_invokevirtual): Build array reference to otable at the index
	returned by get_offset_table_index, and use the result as the vtable
	offset.
	(build_invokeinterface): Similar.
	* jcf-parse.c (yyparse): If indirect-dispatch, call
	emit_offset_symbol_table at the end of compilation, after all classes
	have been generated.
	* jvspec.c: Don't pass findirect-dispatch to jvgenmain.
	* lang.c (flag_indirect_dispatch): Define.
	(lang_f_options): Add indirect-dispatch flag.

libjava:

	* include/jvm.h (_Jv_VTable::idx_to_offset): New method.
	* java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): Call
	_Jv_MakeVTable and _Jv_LinkOffsetTable if needed.
	* java/lang/Class.h (_Jv_Method): Add "index" field.
	(_Jv_MethodSymbol): New struct type.
	(_Jv_LinkOffsetTable, _Jv_LayoutVTableMethods, _Jv_SetVTableEntries,
	_Jv_MakeVTable): Friends.
	(otable, otable_syms): New Class fields.
	* java/lang/natClass.cc (_Jv_LinkOffsetTable): New function.
	(isVirtualMethod): New static function.
	(_Jv_LayoutVTableMethods): New function.
	(_Jv_SetVTableEntries): New function.
	(_Jv_MakeVTable): New function.

From-SVN: r48038
2001-12-15 08:31:49 +00:00
Tom Tromey a12fe13ddb Class.h (Class): Made _Jv_BytecodeVerifier a friend.
* java/lang/Class.h (Class): Made _Jv_BytecodeVerifier a friend.
	* Makefile.in: Rebuilt.
	* Makefile.am (libgcj_la_SOURCES): Added verify.cc.
	* verify.cc: New file.
	* include/java-interp.h (_Jv_count_arguments): Declare.
	(_Jv_VerifyMethod): Likewise.
	(class _Jv_InterpMethod): Made _Jv_BytecodeVerifier a friend.
	(class _Jv_InterpException): Likewise.
	* resolve.cc (_Jv_count_arguments): Renamed from count_arguments.
	No longer static.  Updated callers.
	* defineclass.cc (int_bits_to_float): Removed.
	(long_bits_to_double): Likewise.
	(prepare_pool_entry): Updated.
	(handleCodeAttribute): Verify method (commented out for now).

From-SVN: r46796
2001-11-05 23:39:54 +00:00
Joseph Myers 18e1f2bd67 HACKING, [...]: Fix spelling errors.
* HACKING, gnu/gcj/xlib/Pixmap.java, gnu/gcj/xlib/XException.java,
	gnu/java/rmi/rmic/RMIC.java, java/awt/Window.java,
	java/awt/AWTEvent.java, java/io/ByteArrayOutputStream.java,
	java/io/CharConversionException.java,
	java/io/PipedInputStream.java, java/io/PipedReader.java,
	java/io/PrintWriter.java, java/io/WriteAbortedException.java,
	java/io/natFileWin32.cc, java/lang/Class.h,
	java/lang/natClassLoader.cc, java/lang/natObject.cc,
	java/lang/Package.java, java/net/BindException.java,
	java/net/ConnectException.java, java/net/ProtocolException.java,
	java/net/SocketException.java,
	java/net/UnknownServiceException.java,
	java/security/cert/X509Certificate.java,
	java/security/interfaces/DSAKey.java,
	java/security/SecureRandom.java, java/security/SignedObject.java,
	java/sql/DatabaseMetaData.java,
	java/text/DecimalFormatSymbols.java,
	java/util/jar/Attributes.java, java/util/jar/JarEntry.java,
	java/util/jar/JarInputStream.java,
	java/util/jar/JarOutputStream.java, java/util/Calendar.java,
	java/util/Collections.java, java/util/GregorianCalendar.java,
	java/util/HashMap.java, java/util/List.java,
	java/util/Properties.java, java/util/Timer.java,
	java/util/Vector.java, java/util/WeakHashMap.java,
	javax/naming/NamingException.java,
	testsuite/libjava.lang/Thread_Wait.java,
	org/xml/sax/helpers/DefaultHandler.java,
	org/xml/sax/HandlerBase.java, org/xml/sax/SAXParseException.java,
	ChangeLog, acinclude.m4, aclocal.m4, posix-threads.cc: Fix
	spelling errors.
	* configure: Regenerate.

From-SVN: r46665
2001-10-31 00:48:17 +00:00
Bryce McKinlay 5b0b42ed61 Forgot this file in last commit.
From-SVN: r46284
2001-10-16 12:18:03 +01:00
Per Bothner dee45a7f96 javaprims.h (_Jv_RegisterClassHook): New extern declaration.
* gcj/javaprims.h (_Jv_RegisterClassHook):  New extern declaration.
	(_Jv_RegisterClassHookDefault):  Likewise.
	* java/lang/Class.h (_Jv_RegisterClassHookDefault):  Declare as friend.
	* java/lang/natClassLoader.cc (_Jv_RegisterClassHook):  New variable.
	(_Jv_RegisterClassHookDefault):  New.function.
	(_Jv_RegisterClasses):  Call _Jv_RegisterClassHook.

From-SVN: r45344
2001-08-31 18:26:14 -07:00
Tom Tromey 224b7b7b0c Field.java (toString): Use Method.appendClassName.
* java/lang/reflect/Field.java (toString): Use
	Method.appendClassName.
	* java/lang/reflect/Constructor.java (toString): Use
	Method.appendClassName.
	* java/lang/reflect/Method.java: Reindented.
	(appendClassName): New method.
	(toString): Use it.
	* defineclass.cc (handleMethod ): Initialize `throws' field of
	method.
	(read_one_method_attribute): Handle Exceptions attribute.
	* java/lang/reflect/natMethod.cc (ClassClass): Removed.
	(ObjectClass): Removed.
	(getType): Compute `exception_types'.
	* java/lang/Class.h (struct _Jv_Method): Added `throws' field.

From-SVN: r45153
2001-08-24 17:24:44 +00:00
Tom Tromey 0bedbbdf1b For PR java/3562:
* java/lang/Class.h (Class(void)): Now private.  Removed
	implementation.  From dmorsberger@sensysdl.com.

From-SVN: r43781
2001-07-05 15:57:09 +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
Bryce McKinlay 7026707d15 Class.h (_Jv_Self): New union type.
* java/lang/Class.h (_Jv_Self): New union type.
	(Class): Manipulate vtable pointer via _Jv_Self union. Thanks to
	Jeff Sturm and Fergus Henderson.

	* java/lang/ClassLoader.java: Remove dead code fragment.

From-SVN: r41876
2001-05-06 14:42:11 +01:00
Bryce McKinlay 28f7d9d05a decl.c (init_decl_processing): Add new class "protectionDomain" field.
gcc/java:

2001-04-25  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>

	* decl.c (init_decl_processing): Add new class "protectionDomain"
	field.
	* class.c (make_class_data): Set initial value for "protectionDomain".

libjava:

2001-04-25  Bryce McKinlay  <bryce@albatross.co.nz>

	java.security merge and ClassLoader compliance fixes.

	* java/lang/Class.h (Class): Include ProtectionDomain.h.
	New protectionDomain field.
	(forName): Add initialize parameter. Fixes declaration to comply with
	JDK spec.
	* java/lang/natClass.cc (forName): Correct declaration of the three-arg
	variant. Honour	"initialize" flag.
	(getProtectionDomain0): New method.
	* java/lang/Class.java: Fix forName() declaration.
	(getPackage): New method based on Classpath implementation.
	(getProtectionDomain0): New native method decl.
	(getProtectionDomain): New method.
	* java/lang/ClassLoader.java (getParent): Now final.
	(definedPackages): New field.
	(getPackage): New.
	(defineClass): New variant with protectionDomain argument.
	(definePackage): New.
	(getPackages): New.
	(findSystemClass): Now final.
	(getSystemResourceAsStream): Remove redundant "final" modifier.
	(getSystemResource): Remove redundant "final" modifier.
	(getResources): Now final.
	(protectionDomainPermission): New static field.
	(unknownProtectionDomain): Ditto.
	(defaultProtectionDomain): Ditto.
	(getSystemClassLoader): Now non-native.
	* java/util/ResourceBundle.java (tryGetSomeBundle): Use the correct
	arguments for Class.forName().
	* java/lang/Package.java: New file.
	* gnu/gcj/runtime/VMClassLoader.java (getVMClassLoader): Removed.
	(instance): Static initialize singleton.
	(findClass): Override this, not findSystemClass.
	* java/lang/natClassLoader.cc (defineClass0): Set class's
	protectionDomain field as specified.
	(getSystemClassLoader): Removed.
	(findClass): Renamed from findSystemClass. Call the interpreter via
	URLClassLoader.findClass if loading class via dlopen fails.

	* java/security/*.java: java.security import/merge with Classpath.
	* java/security/acl/*.java: Likewise.
	* java/security/interfaces/*.java: Likewise.
	* java/security/spec/*.java: Likewise.
	* java/net/NetPermission.java: Likewise.
	* java/net/SocketPermission.java: Likewise.
	* gnu/java/security/provider/DefaultPolicy.java: Likewise.

	* Makefile.am: Add new classes.
	* Makefile.in: Rebuilt.
	* gcj/javaprims.h: CNI namespace rebuild.

From-SVN: r41543
2001-04-25 16:45:15 +01:00
Bryce McKinlay 607adf67a0 Class.h (isInterface): Move implementation from natClass.cc.
* java/lang/Class.h (isInterface): Move implementation from
	natClass.cc. Declare inline.
	(Class): Add default constructor.
	* java/lang/Object.h: Update comments.
	* java/lang/natClass.cc (initializeClass): Use _Jv_InitClass to
	initialize superclass, saving a call if super is already initialized.

From-SVN: r39091
2001-01-17 10:22:33 +00:00
Alexandre Petit-Bianco ed8cc5fdf8 prims.cc (init_prim_class): Deleted.
2001-01-16  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	* prims.cc (init_prim_class): Deleted.
	(DECLARE_PRIM_TYPE): Rewritten.
	* java/lang/Class.h (stdio.h): Include removed.
	(stddef.h): Included.
	(java/lang/reflect/Modifier.h): Likewise.
	(Class): Contructor now takes arguments, initializes fields.
	(initializePrim): Prototype deleted.
	* java/lang/natClass.cc (initializePrim): Deleted.

(http://sources.redhat.com/ml/java-patches/2001-q1/msg00081.html)

From-SVN: r39088
2001-01-17 00:13:06 -08:00
Alexandre Petit-Bianco 2feccc205e All files with updated copyright.
2001-01-07  Alexandre Petit-Bianco  <apbianco@cygnus.com>

	All files with updated copyright.
	* prims.cc (class _Jv_PrimClass): Removed.
	(init_prim_class): New function.
	(DECLARE_PRIM_TYPE): Rewritten. `java::lang::Class' replaces
	`_Jv_PrimClass' in primitive type declarations. Assign to the
	value returned by `init_prim_class.'
	* gcj/array.h: `java::lang::Class' replaces `_Jv_PrimClass' in
	primitive type declarations.
	(JvPrimClass): Cast to `jclass' removed.
	* java/lang/Class.h (Class): New constructor.
	(Class): New copy constructor.
	(initializePrim): New prototype.
	(_Jv_PrimClass): Field removed.
	* java/lang/Object.h (struct _JvObjectPrefix): New virtuals
	nacd_1 and nacd_2 (for compatibility with the new C++ ABI.)
	(class java::lang::Object): `finalize' moved up front.
	* java/lang/natClass.cc
	(isAssignableFrom): Turned outline.
	(isInstance): Likewise.
	(isInterface): Likewise, fixed indentation.
	(initializePrim): New function.

(New C++ ABI compatibility patch:
 http://sources.redhat.com/ml/java-patches/2001-q1/msg00065.html)

From-SVN: r39032
2001-01-15 00:11:40 -08:00
Bryce McKinlay 5bb11b2e20 In gcc/java:
* class.c (make_class_data): Push initial value for "arrayclass".
	* decl.c (init_decl_processing): Add new class field "arrayclass".

In libjava:
	* java/lang/Class.h (_Jv_InitClass): Use __builtin_expect.
	(_Jv_NewArrayClass): Renamed from _Jv_FindArrayClass.
	(_Jv_GetArrayClass): New inline function.
	(arrayclass): New field.
	* prims.cc (_Jv_NewObjectArray): Use _Jv_GetArrayClass. Don't use
	_Jv_GetArrayElementFromElementType.
	(_Jv_NewPrimArray): Ditto.
	(_Jv_PrimClass constructor): Initialize "depth", "ancestors", and
	"idt" for completeness. Initialze "arrayclass" using _Jv_NewArrayClass.
	Set Modifier::ABSTRACT.
	* java/lang/natClassLoader.cc (_Jv_NewClass): Initialize "arrayclass".
	(_Jv_NewArrayClass): Renamed from _Jv_FindArrayClass. Now void.
	Now synchronized. Array classes are now referenced from
	elementClass->arrayclass. Don't use _Jv_FindClassInCache.
	Set array classes' accessibility flags correctly. Optimize so that
	all array classes share the same IDT.
	* java/lang/reflect/natArray.cc (newInstance): Use _Jv_GetArrayClass.
	* java/lang/reflect/natMethod.cc (_Jv_GetTypesFromSignature): Ditto.
	* java/lang/natClass.cc (_getFields): Increment offset. Prevent fields
	in superclasses from overwriting classes own fields.
	(_Jv_IsAssignableFrom): Check for NULL source idt instead of calling
	Modifier::isAbstract().
	(null_idt): New static field.
	(_Jv_PrepareConstantTimeTables): Optimize case where class implements
	no interfaces.
	(_Jv_IndexOf): Made inline.
	* boehm.cc (_Jv_MarkObj): Mark "arrayclass" field.

From-SVN: r38808
2001-01-08 23:28:56 +00:00
Anthony Green 31280fb7c4 prims.cc (_Jv_NewObjectArray): Undo placement change.
2000-11-25  Anthony Green  <green@redhat.com>

	* prims.cc (_Jv_NewObjectArray): Undo placement change.
	(_Jv_NewPrimArray): Likewise.
	* gcj/array.h (__JArray): Undo const change.  Removed constructor.
	(class JArray): Removed constructor.

	* java/lang/Thread.java (context_class_loader): New private data.
	(getContextClassLoader): New method.
	(setContextClassLoader): New method.
	(Thread): Initialize context_class_loader.

	* java/net/URLClassLoader.java: Import java.util.Enumeration.
	(getResource): Rename to findResource.
	(findResource): New method.  Used to be getResource.
	(getResourceAsStream): Deleted.
	(jarFileize): Extracted logic from URLClassLoader constructor into
	this new private method.
	(addURL): New protected method.
	(URLClassLoader): Call jarFileize.  Use addElement instead of
	insertElementAt.
	(findResources): New method.

	* java/lang/ClassLoader.java: Import java.util.Enumeration.
	(getResource): Implement correct logic.
	(findResource): New method.
	(getResources): New method.
	(findClass): Create a ClassNotFoundException with the name of the
	class rather than nothing at all.
	(defineClass) Only throw ClassFormatError.

	* java/lang/Class.java (forName): New method.
	* java/lang/Class.h (forName): New method.
	* java/lang/natClass.cc (forName): New method.

From-SVN: r37751
2000-11-26 03:58:56 +00:00
Tom Tromey 1d336a099d natField.cc (BooleanClass): Don't define.
* java/lang/reflect/natField.cc (BooleanClass): Don't define.
	* java/lang/reflect/natArray.cc (BooleanClass): Don't define.
	* java/lang/Class.h (Object): Added `class$' field.
	* java/lang/Object.h (Object): Added `class$' field.
	* defineclass.cc (ClassClass): Use `class$' form.
	(ClassObject): Likewise.
	* resolve.cc (ClassObject): Use `class$' form.
	(ObjectClass): Likewise.
	* interpret.cc (ClassError): Removed.
	* java/net/natPlainDatagramSocketImpl.cc (BooleanClass): Use
	`class$' form.
	(IntegerClass): Likewise.
	* java/net/natPlainSocketImpl.cc (BooleanClass): Use `class$'
	form.
	* java/lang/natClassLoader.cc (CloneableClass): Use `class$' form.
	(ObjectClass, ClassClass, VMClassLoaderClass, ClassLoaderClass,
	SerializableClass): Likewise.
	Include Serializable.h, Cloneable.h.
	* java/lang/natSystem.cc (SystemClass): Removed.
	(init_properties): Use `class$' form.
	* java/lang/natObject.cc (CloneableClass): Removed.
	(clone): Use `class$' form.
	* java/lang/natClass.cc (CloneableClass): Use `class$' form.
	(ObjectClass, ErrorClass, ClassClass, MethodClass, FieldClass,
	ConstructorClass): Likewise.
	* java/lang/reflect/natMethod.cc (ObjectClass): Use `class$' form.
	(ClassClass, VoidClass, ByteClass, ShortClass, CharacterClass,
	IntegerClass, LongClass, FloatClass, DoubleClass): Likewise.
	* java/io/natObjectInputStream.cc (ObjectClass): Use `class$'
	form.
	(ClassClass): Likewise.
	* include/jvm.h (StringClass): Use `class$' form.
	* prims.cc (ObjectClass): Removed.
	(_Jv_RunMain): Use `class$' form.
	(_Jv_AllocObject): Likewise.
	* jni.cc (ClassClass): Use `class$' form.
	(ThrowableClass): Likewise.
	(ObjectClass): Likewise.
	(MethodClass): Likewise.
	(ThreadGroupClass): Likewise.
	(NativeThreadClass): Likewise.
	* boehm.cc (ObjectClass): Removed.
	(ClassClass): Removed.
	(_Jv_MarkObj): Use `class$' form.
	* gcj/field.h (JvFieldIsRef): Use `class$' form.
	Include RawData.h.

From-SVN: r36740
2000-10-06 01:49:32 +00:00
Hans Boehm bf3b8e42e2 Implement bitmap descriptor based marking for Boehm GC.
2000-09-30  Hans Boehm  <boehm@acm.org>
	    Bryce McKinlay  <bryce@albatross.co.nz>

	Implement bitmap descriptor based marking for Boehm GC.

	* configure.in: Define JC1GCSPEC. Set it if boehm-gc is used.
	* configure: Rebuilt.
	* libgcj.spec.in: Pass JC1GCSPEC to jc1.
	* include/jvm.h (struct _Jv_VTable): New field `gc_descr'. New inline
	method get_finalizer().
	(struct _Jv_ArrayVTable): Ditto. Declare method array with
	NUM_OBJECT_METHODS elements instead of NUM_OBJECT_METHODS + 1.
	(_Jv_AllocObj): Add new jclass parameter.
	(_Jv_AllocArray): Ditto.
	(_Jv_BuildGCDescr): New prototype.
	* prims.cc (_Jv_AllocObject): Rename parameter `c' to `klass'. Pass
	`klass' to _Jv_AllocObj. Don't set the new object's vtable. Use
	get_finalizer() instead of direct finalizer vtable offset.
	(_Jv_NewObjectArray): Rename parameter `clas' to `klass'. Pass
	`klass' to _Jv_AllocArray. Don't set the new array's vtable.
	(_Jv_NewPrimArray): Call _Jv_FindArrayClass before _Jv_AllocObj.
	Pass `klass' to _Jv_AllocObj. Don't set the new array's vtable.
	* resolve.cc (METHOD_NOT_THERE, METHOD_INACCESSIBLE): New #defines.
	(_Jv_ResolvePoolEntry): Use METHOD_NOT_THERE and METHOD_INACCESSIBLE.
	(_Jv_DetermineVTableIndex): Ditto.
	(_Jv_PrepareClass): Ditto. Remove offset-by-one adjustments from vtable
	calculations to account for new gc_descr field.
	* boehm.cc: #include gc_gcj.h.
	(obj_kind_x, obj_free_list): `#if 0'-ed away.
	(_Jv_MarkObj): Check that vtable doesn't point to a cleared object.
	New commentary from HB. Mark the classes vtable.
	(_Jv_MarkArray): Check that vtable doesn't point to a cleared object.
	(GC_DEFAULT_DESCR): New #define.
	(_Jv_BuildGCDescr): New function. Use GC_DEFAULT_DESCR, for now.
	(_Jv_AllocObj): New parameter `klass'. Use GC_GCJ_MALLOC ().
	(_Jv_AllocArray): New parameter `klass'. Allocate with GC_MALLOC and
	scan conservativly if size is less than min_heap_addr. Set vtable
	pointer of new object before returning.
	(_Jv_AllocBytes): Use GC_MALLOC_ATOMIC, not GC_GENERIC_MALLOC.
	(_Jv_InitGC): Call GC_init_gcj_malloc(). Don't set up marking and
	allocation for obj_kind_x.
	* nogc.cc (_Jv_BuildGCDescr): New function. Return 0.
	(_Jv_AllocObj): Set vtable on returned object.
	(_Jv_AllocArray): Ditto.
	* java/lang/Class.h (_Jv_NewObjectArray): No longer a friend.
	(_Jv_NewPrimArray): Ditto.
	(_Jv_AllocObj): Declare as a friend.
	(_Jv_AllocArray): Ditto.
	* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Copy gc_descr
	from &ObjectClass into new array class. Remove offset-by-one
	adjustments from `method' size calculations to account for gc_descr
	field.

Co-Authored-By: Bryce McKinlay <bryce@albatross.co.nz>

From-SVN: r36679
2000-09-30 10:56:58 +01:00
Bryce McKinlay 1bf8972740 2000-06-15 Bryce McKinlay <bryce@albatross.co.nz>
Fix for PR java.lang/258:
	* prims.cc (_Jv_PrimClass): Set state of primitive class to
	JV_STATE_DONE, to prevent accidental initialization.
	* java/lang/natClass.cc (_Jv_IsAssignableFrom): Call
	_Jv_InterfaceAssignableFrom if target is an interface and source is
	an interface or an abstract class. Remove redundant initializeClass
	calls. Remove duplicate if_idt test.
	(_Jv_InterfaceAssignableFrom): New function.
	* java/lang/Class.h (_Jv_InterfaceAssignableFrom): Prototype.

From-SVN: r34563
2000-06-15 13:04:50 +01:00
Tom Tromey c74e221410 prims.cc (DECLARE_PRIM_TYPE): Define a vtable as well.
* prims.cc (DECLARE_PRIM_TYPE): Define a vtable as well.
	(_Jv_PrimClass): Set `methods' by calling _Jv_FindArrayClass.
	* include/jvm.h (struct _Jv_ArrayVTable): Declare.
	(NUM_OBJECT_METHODS): New define.
	* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
	`array_vtable' parameter.  Added assertion.
	* java/lang/Class.h (_Jv_FindArrayClass): Added `array_vtable'
	parameter.

From-SVN: r34312
2000-05-31 23:50:37 +00:00
Bryce McKinlay 1c02a3d964 re GNATS libgcj/226 (implicit __builtin_expect) and GNATS gcj/228 (compressed JAR files)
2000-05-20  Bryce McKinlay  <bryce@albatross.co.nz>

	Fix for PR libgcj/226:
	* java/lang/Class.h (_Jv_InitClass): Don't call __builtin_expect,
	since this is an installed header.

	Fix for PR libgcj/228:
	* java/util/zip/ZipFile (getInputStream): Create inflater with
	nowrapper option.

	* java/util/zip/natInflater.cc (inflate): Throw zlib's error message
	with DataFormatException.

From-SVN: r34064
2000-05-21 00:30:46 +01:00
Tom Tromey 6c80c45e30 Jumbo patch:
* Imported beans and serialization
* Updated IA-64 port
* Miscellaneous bug fixes

From-SVN: r34028
2000-05-19 17:55:34 +00:00
Bryce McKinlay 9d4c21486c natClass.cc (isInstance): Use __builtin_expect.
2000-05-05  Bryce McKinlay  <bryce@albatross.co.nz>

	* java/lang/natClass.cc (isInstance): Use __builtin_expect.
	(_Jv_IsAssignableFrom): Ditto.
	(_Jv_IsInstanceOf): Ditto.
	(_Jv_CheckCast): Ditto.
	(_Jv_CheckArrayStore): Ditto.
	* java/lang/Class.h (_Jv_InitClass): Ditto.
	* java/lang/natObject.cc (_Jv_MonitorEnter): __builtin_expect `false',
	not `0'.
	(notify): Ditto.
	(notifyAll): Ditto.
	(wait): Ditto.
	(_Jv_MonitorExit): Ditto.
	* boehm.cc (_Jv_MarkObj): Ditto.
	(_Jv_MarkObj): Ditto.
	(_Jv_MarkArray): Ditto.
	* prims.cc (_Jv_AllocObject): Ditto.
	(_Jv_NewObjectArray): Ditto.
	(_Jv_NewPrimArray): Ditto.
	(_Jv_Malloc): Ditto.
	(_Jv_Realloc): Ditto.
	(_Jv_MallocUnchecked): Ditto.
	(_Jv_divI): Ditto.
	(_Jv_remI): Ditto.
	(_Jv_divJ): Ditto.
	(_Jv_remJ): Ditto.

From-SVN: r33698
2000-05-05 03:56:14 +01:00
Tom Tromey 18fcc4961b re GNATS libgcj/212 (build is broken on Linux/Alpha)
Fix for PR libgcj/212:
	* gcj/javaprims.h (_Jv_word, _Jv_word2): Removed definitions.
	* include/jvm.h (_Jv_word, _Jv_word2): Define.
	* java/lang/Class.h (_Jv_word): Declare.

From-SVN: r33292
2000-04-20 22:24:33 +00:00
Tom Tromey 2ba5f77454 All files: Updated copyright information.
* All files: Updated copyright information.
	* COPYING: New file.
	* COPYING.LIB: Removed.
	* LIBGCJ_LICENSE: We now use GPL + special exception.

From-SVN: r32387
2000-03-07 19:55:28 +00:00
Bryce McKinlay ddf0fc6c9f resolve.cc (_Jv_SearchMethodInClass): New function.
2000-03-07  Bryce McKinlay  <bryce@albatross.co.nz>

        * resolve.cc (_Jv_SearchMethodInClass): New function.
        (_Jv_ResolvePoolEntry): Search superinterfaces for interface
        methods.
        * java/lang/Class.h (_Jv_SearchMethodInClass): New prototype.

2000-03-07  Bryce McKinlay  <bryce@albatross.co.nz>

        * java/lang/Class.h (union _Jv_IDispatchTable): New declaration.
        (struct _Jv_ifaces): New declaration.
        JV_CLASS: New macro definition.
        (getComponentType): Relocate below isArray() for inlining.
        (getModifiers): Declare `inline'.
        (getSuperclass): Ditto.
        (isArray): Ditto.
        (isPrimitive): Ditto.
        (_Jv_IsAssignableFrom): New prototype.
        (_Jv_LookupInterfaceMethodIdx): New prototype. Predeclare with "C"
        linkage.
        (_Jv_InitClass): Move from natClass.cc. Declare `inline'.
        Check for JV_STATE_DONE before invoking initializeClass().
        (_Jv_PrepareConstantTimeTables): New prototype.
        (_Jv_GetInterfaces): Ditto.
        (_Jv_GenerateITable): Ditto.
        (_Jv_GetMethodString): Ditto.
        (_Jv_AppendPartialITable): Ditto.
        (_Jv_FindIIndex): Ditto.
        depth, ancestors, idt: New class fields.

        * java/lang/natClass.cc (isAssignableFrom): Move functionality to
        inline function `_Jv_IsAssignableFrom'. Use that function.
        (isInstance): Declare `inline'.
        (initializeClass): Get lock on class before checking `state'. Unlock
        before calling resolveClass0. Call _Jv_PrepareConstantTimeTables
	with the lock held.
        (_Jv_LookupInterfaceMethod): Use _Jv_GetMessageString.
        (_Jv_IsAssignableFrom): New inline function. Test assignability
	using class->depth and ancestor table.
        (_Jv_IsInstanceOf): Use _Jv_IsAssignableFrom.
        (_Jv_CheckCast): Move from prims.cc. Use JV_CLASS and
        _Jv_IsAssignableFrom.
        (_Jv_CheckArrayStore): Ditto.
        (_Jv_LookupInterfaceMethodIdx): New function.
        INITIAL_IOFFSETS_LEN, INITIAL_IFACES_LEN: New #defines.
        (_Jv_PrepareConstantTimeTables): New function.
        (_Jv_IndexOf): Ditto.
        (_Jv_GetInterfaces): Ditto.
        (_Jv_GenerateITable): Ditto.
        (_Jv_GetMethodString): Ditto.
        (_Jv_AppendPartialITable): Ditto.
        iindex_mutex, iindex_mutex_initialized: New static fields.
        (_Jv_FindIIndex): New function.

        * java/lang/natClassLoader.cc (_Jv_NewClass): Set new jclass fields.

        * prims.cc (_Jv_CheckCast): Moved to natClass.cc.
        (_Jv_CheckArrayStore): Ditto.
        (JvNewCharArray, JvNewBooleanArray, JvNewByteArray, JvNewShortArray,
        JvNewIntArray, JvNewLongArray, JvNewFloatArray, JvNewDoubleArray):
        Moved to gcj/array.h.
        (_Jv_Realloc): New function.

        * gcj/cni.h: Move _Jv_PrimClass definitions to gcj/array.h.

        * gcj/array.h: _Jv_PrimClass definitions moved from gcj/cni.h.
        (JvNewCharArray, JvNewBooleanArray, JvNewByteArray,
        JvNewShortArray, JvNewIntArray, JvNewLongArray, JvNewFloatArray,
        JvNewDoubleArray): Implementations moved from prims.cc and
        declared `inline'.

        * gcj/javaprims.h (_Jv_Realloc): Prototype.

        * include/jvm.h (_Jv_LookupInterfaceMethodIdx): Prototype.

From-SVN: r32382
2000-03-07 09:52:56 +00:00
Tom Tromey b099f07de9 java-interp.h: Don't include MethodInvocation.h.
* include/java-interp.h: Don't include MethodInvocation.h.
	(class _Jv_InterpMethod): Don't make MethodInvocation a friend.
	* Makefile.in: Rebuilt.
	* Makefile.am (gnu/gcj/runtime/MethodInvocation.h): Removed.
	(ordinary_java_source_files): Don't mention
	MethodInvocation.java.
	* gnu/gcj/runtime/MethodInvocation.java: Removed.
	* interpret.cc (MethodInvocation::continue1): Removed.
	(run): Handle exceptions here.
	* java/lang/ClassLoader.java (defineClass1, defineClass2):
	Removed.
	* java/lang/natClassLoader.cc (defineClass0): Catch exceptions
	here.
	(defineClass2): Removed.

	* java/lang/reflect/Method.java (hack_trampoline, hack_call):
	Removed.
	* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Catch
	exceptions here.
	(hack_call): Removed.

	* java/lang/Class.h (Class): Removed hackRunInitializers,
	hackTrampoline.
	* java/lang/natClass.cc (hackRunInitializers): Removed.
	(initializeClass): Catch exceptions here.
	Include ExceptionInInitializerError.h.
	* java/lang/Class.java (hackTrampoline, hackRunInitializers):
	Removed.

	* java/lang/Object.h (Object): Don't mention hack12_6.
	* java/lang/natObject.cc (_Jv_FinalizeObject): Catch exceptions
	here.
	* java/lang/Object.java (hack12_6): Removed.

	* java/lang/natThread.cc (run_): Renamed.  Catch exceptions here.
	(start): Use run_, not run__.
	* java/lang/Thread.java (run_): Renamed from run__; old run_
	removed.

	* jni.cc (_Jv_JNI_FindClass): Handle exceptions.
	(_Jv_JNI_EnsureLocalCapacity): Likewise.
	(_Jv_JNI_DefineClass): Likewise.
	(_Jv_JNI_ThrowNew): Likewise.
	(_Jv_JNI_AllocObject): Likewise.
	(_Jv_JNI_GetAnyMethodID): Likewise.
	(_Jv_JNI_CallAnyMethodV): Likewise.
	(_Jv_JNI_CallAnyMethodA): Likewise.
	(_Jv_JNI_CallAnyVoidMethodV): Likewise.
	(_Jv_JNI_CallAnyVoidMethodA): Likewise.
	(_Jv_JNI_GetAnyFieldID): Likewise.
	(_Jv_JNI_NewString): Likewise.
	(_Jv_JNI_NewStringUTF): Likewise.
	(_Jv_JNI_GetStringUTFChars): Likewise.
	(_Jv_JNI_NewObjectArray): Likewise.
	(_Jv_JNI_NewPrimitiveArray): Likewise.
	(_Jv_JNI_GetPrimitiveArrayRegion): Likewise.
	(_Jv_JNI_GetStringRegion): Likewise.
	(_Jv_JNI_GetStringUTFRegion): Likewise.
	(_Jv_JNI_SetPrimitiveArrayRegion): Likewise.
	(_Jv_JNI_MonitorEnter): Likewise.
	(_Jv_JNI_MonitorExit): Likewise.
	(_Jv_JNI_ToReflectedField): Likewise.
	(_Jv_JNI_ToReflectedMethod): Likewise.
	(_Jv_JNI_RegisterNatives): Likewise.
	(_Jv_JNI_AttachCurrentThread): Likewise.
	(_Jv_JNI_DestroyJavaVM): Likewise.

From-SVN: r32294
2000-03-02 20:25:20 +00:00
Tom Tromey 355dff4cef method.h (JvNumMethods): Moved from Class.h.
* gcj/method.h (JvNumMethods): Moved from Class.h.
	(JvGetFirstMethod): Likewise.
	* java/lang/Class.h (Object): Updated decl of
	_Jv_JNI_ToReflectedField.
	(Object): Added _Jv_JNI_ToReflectedMethod as a friend.
	* Makefile.in: Rebuilt.
	* Makefile.am (java/lang/reflect/Field.h): Added `jboolean'
	argument of _Jv_JNI_ToReflectedField.
	(java/lang/reflect/Constructor.h): Added _Jv_JNI_ToReflectedMethod
	as a friend.
	(java/lang/reflect/Method.h): Likewise.
	* include/jni.h (class _Jv_JNIEnv): Added `klass' member.  Use
	__GCJ_JNI_IMPL__.
	(jweak): New typedef.
	(struct JNINativeInterface): Correctly declare remaining entries.
	* jni.cc: Include Class.h, ClassLoader.h.
	(_Jv_JNI_FindClass): New function.
	(_Jv_JNI_DefineClass): New function.
	(_Jv_JNI_conversion_call): New function.
	(_Jv_JNI_FindClass): Use current class loader to find class.
	(_Jv_JNI_ExceptionCheck): New function.
	(_Jv_JNI_FromReflectedField): Now static.
	(MethodClass): New define.
	(_Jv_JNI_FromReflectedMethod): New function.
	(_Jv_JNI_ToReflectedMethod): Likewise.
	Include Method.h.
	(_Jv_JNI_IsAssignableFrom): Renamed.
	(_Jv_JNI_GetStringRegion): New function.
	Include StringIndexOutOfBoundsException.h.
	(_Jv_JNI_GetStringUTFRegion): New function.
	(_Jv_JNIFunctions): Updated for new functions.
	(_Jv_JNI_GetPrimitiveArrayCritical): New function
	(_Jv_JNI_ReleasePrimitiveArrayCritical): Likewise.
	(_Jv_JNI_GetStringCritical): New function.
	(_Jv_JNI_ReleaseStringCritical): Likewise.
	(get_throwable): Removed.
	(GCJ_JV_JNIENV_FRIEND): Removed.
	(__GCJ_JNI_IMPL__): Define.
	Include method.h.

From-SVN: r31638
2000-01-26 23:56:36 +00:00
Tom Tromey 0507a9b19f field.h (struct _Jv_Field): Use "jshort" as type for nameIndex.
* gcj/field.h (struct _Jv_Field): Use "jshort" as type for
	nameIndex.  Use "jint" as type for boffset.
	* java/lang/Class.h (struct _Jv_Method): Made accflags a
	_Jv_ushort.
	(Class): Likewise.  Also changed type of method_count,
	vtable_method_count, size_in_bytes, field_count,
	static_field_count, interface_count.
	* gcj/array.h (__JArray): Made `length' a const jsize, not an
	int.

From-SVN: r31621
2000-01-26 00:55:50 +00:00
Tom Tromey 8a9220959f natConstructor.cc (newInstance): Use _Jv_CallAnyMethodA.
* java/lang/reflect/natConstructor.cc (newInstance): Use
	_Jv_CallAnyMethodA.
	* include/jvm.h: Declare _Jv_CallAnyMethodA.
	* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Renamed
	from _Jv_CallNonvirtualMethodA.  Changed interface; overloaded.
	Include <jni.h>.
	(COPY): Removed.
	(invoke): Use _Jv_CallAnyMethodA.
	(VAL): Redefined.
	* java/lang/Class.h (Class): Declare JvGetFirstStaticField,
	JvNumStaticFields, JvNumMethods, and JvGetFirstMethod as friend
	functions.
	(struct _Jv_Method): Added getNextMethod method.
	(JvNumMethods): New function.
	(JvGetFirstMethod): Likewise.
	* gcj/field.h (JvGetFirstStaticField): New function.
	(JvNumStaticFields): Likewise.
	(getNextField): Renamed from getNextInstanceField.
	(struct _Jv_Field): New method getClass.
	* jni.cc: Wrote many new functions.
	* include/jni.h (JNI_TRUE): Define.
	(JNI_FALSE): Likewise.
	(jobject, jclass, jstring, jarray, jthrowable, jobjectArray,
	jbyteArray, jshortArray, jintArray, jlongArray, jbooleanArray,
	jcharArray, jfloatArray, jdoubleArray): New typedefs.
	(jfieldID, jmethodID): Likewise.
	(JNI_COMMIT, JNI_ABORT): New defines.
	(JNINativeMethod): New struct.
	(struct JNINativeInterface): Correctly declared more entries.
	(class _Jv_JNIEnv): Added `ex' member.
	(JNI_VERSION_1_1): New define.
	(JNI_VERSION_1_2): Likewise.

	* boehm.cc (_Jv_MarkObj): Use getNextField, not
	getNextInstanceField.

From-SVN: r31553
2000-01-21 23:50:31 +00:00
Tom Tromey 7c734b1758 * All files: Updated copyright to reflect Cygnus purchase.
From-SVN: r31504
2000-01-19 18:39:27 +00:00
Tom Tromey 1258cadadc Class.h (_getMethods): Correctly declare as private, not public.
* java/lang/Class.h (_getMethods): Correctly declare as private,
	not public.

From-SVN: r31246
2000-01-05 22:29:27 +00:00
Tom Tromey 6f2b93eb2f Class.h (_getMethods): Declare.
* java/lang/Class.h (_getMethods): Declare.
	* java/lang/Class.java (_getMethods): Declare.
	* java/lang/natClass.cc (getDeclaringClass): Always return NULL.
	(getDeclaredClasses): Always return empty array.
	(_getMethods): New method.
	(getMethods): Wrote.
	(getDeclaredMethod): Return `rmethod'.
	(finit_name): New global.
	(getDeclaredMethods): Check for finit_name.
	(_getMethods): Likewise.
	(getMethod): Only return public methods.

From-SVN: r31245
2000-01-05 22:22:10 +00:00
Tom Tromey 95c6cc0ab5 Class.h (getSignature): Updated.
* java/lang/Class.h (getSignature): Updated.
	* java/lang/Class.java (getSignature): Updated.
	* java/lang/natClass.cc (getSignature): Added `is_constructor'
	argument.
	(getConstructor): Ensure constructor is public.
	(_getConstructors): Check for public-ness of constructor when
	`declared' is false, not when it is true.

From-SVN: r31241
2000-01-05 16:35:20 +00:00
Tom Tromey 0f918fea8b [multiple changes]
2000-01-04  Tom Tromey  <tromey@cygnus.com>

	* java/lang/reflect/natConstructor.cc (newInstance): Pass
	declaring class as return_type argument to
	_Jv_CallNonvirtualMethodA.
	* java/lang/reflect/natMethod.cc (_Jv_CallNonvirtualMethodA): In
	constructor case, create object and use it as `this' argument.
	* java/lang/Class.h (_getConstructors): Declare.
	(_getFields): Declare.
	* java/lang/Class.java (getConstructors): Wrote.
	(_getConstructors): New native method.
	(getDeclaredConstructors): Wrote.
	(_getFields): Declare new native method.
	* java/lang/natClass.cc (_Jv_LookupInterfaceMethod): Removed
	incorrect comment.
	(getMethod): Work correctly when class is primitive.
	(getDeclaredMethods): Likewise.  Compute offset using `method',
	not `mptr'.
	(getDeclaredMethod): Likewise.
	(getConstructor): Wrote.
	(ConstructorClass): New define.
	(getDeclaredConstructor): Wrote.
	(_getConstructors): New method.
	(_getFields): New method.
	(getFields): Wrote.

	* Makefile.in: Rebuilt.
	* Makefile.am (AM_CXXFLAGS): Added -D_GNU_SOURCE.

	* prims.cc: Remove `#pragma implementation'.
	* gcj/array.h: Remove `#pragma interface'.

	* prims.cc (_Jv_equaln): New function.
	* java/lang/Class.java (getSignature): Declare.
	* resolve.cc (_Jv_LookupDeclaredMethod): Moved to natClass.cc.
	* java/lang/natClass.cc (_Jv_LookupDeclaredMethod): Moved from
	resolve.cc.
	(getSignature): New method.
	(getDeclaredMethod): Wrote.
	(getMethod): Wrote.
	Include StringBuffer.h.
	* java/lang/Class.h (Class): Added _Jv_FromReflectedConstructor
	as a friend.  Unconditionally declare _Jv_LookupDeclaredMethod as
	a friend.
	(getSignature): Declare.
	* include/jvm.h (_Jv_GetTypesFromSignature): Declare.
	(_Jv_equaln): Declare.
	(_Jv_CallNonvirtualMethodA): Declare.
	* Makefile.in: Rebuilt.
	* Makefile.am (nat_source_files): Added natConstructor.cc.
	(java/lang/reflect/Constructor.h): New target.
	* java/lang/reflect/natConstructor.cc: New file.
	* java/lang/reflect/Constructor.java (newInstance): Now native.
	(declaringClass): Renamed from decl_class.
	(offset): Renamed from index.
	(getType): New native method.
	(getModifiers): Now native.
	(getParameterTypes): Call getType if required.
	(hashCode): Include hash code from declaring class.
	(modifiers): Removed.
	(toString): Call getType if required.
	* gcj/method.h (_Jv_FromReflectedConstructor): New function.
	* java/lang/reflect/natMethod.cc (hack_call): New method.
	Removed `#if 0' around FFI code.
	Include <gnu/gcj/RawData.h>.
	(invoke): Use _Jv_CallNonvirtualMethodA.  Throw
	IllegalArgumentException when argument object and class disagree.
	(_Jv_GetTypesFromSignature): New function.
	(getType): Use it.
	(ObjectClass): New define.
	(_Jv_CallNonvirtualMethodA): New function.
	* java/lang/reflect/Method.java (hack_trampoline): New method.
	(hack_call): New native method.

1999-12-21  Per Bothner  <per@bothner.com>

	* java/lang/natClass.cc (getDeclaredMethods): Correctly compute
	offset in new Method.

From-SVN: r31199
2000-01-04 08:46:52 +00:00