aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang/natClass.cc
AgeCommit message (Collapse)AuthorFilesLines
2003-01-30natClass.cc (initializeClass): Check tables when (state == ↵Jeff Sturm1-1/+17
JV_STATE_IN_PROGRESS). * java/lang/natClass.cc (initializeClass): Check tables when (state == JV_STATE_IN_PROGRESS). (_Jv_GetInterfaces): Use _Jv_WaitForState to link interface. * java/lang/natClassLoader.cc (_Jv_WaitForState): Handle interpreted classes. (linkClass0): Use _Jv_WaitForState. From-SVN: r62161
2002-12-23exception.cc (PERSONALITY_FUNCTION): Clear least-significant-bit of catch_type.Jeff Sturm1-3/+8
* exception.cc (PERSONALITY_FUNCTION): Clear least-significant-bit of catch_type. * java/lang/natClass.cc (initializeClass): Link vtable, otable, idt tables after initializing superclass. * java/lang/natClassLoader.cc (uaddr): New typedef. (_Jv_PrepareCompiledClass): Resolve superclass, interfaces if they are constant pool indicies. Don't link vtable, otable yet. From-SVN: r60450
2002-12-19natClassLoader.cc (defineClass0): Removed erroneous comment.Tom Tromey1-11/+30
* 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-05Class.h (_Jv_SetVTableEntries): Updated declaration.Tom Tromey1-22/+49
* 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-03natClassLoader.cc (_Jv_PrepareCompiledClass): Call _Jv_PushClass.Andrew Haley1-3/+23
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-11-10natClass.cc (initializeClass): Throw NoClassDefFoundError with getName() as ↵Mark Wielaard1-2/+7
message. * java/lang/natClass.cc (initializeClass): Throw NoClassDefFoundError with getName() as message. (_Jv_CheckArrayStore): Throw ArrayStoreException with object and array type as message. * java/lang/natVMThrowable.cc: Don't declare parameter t, it is unused. From-SVN: r58991
2002-11-02Class.h: Move JV_STATE_ERROR before JV_STATE_DONE.Tom Tromey1-3/+1
* 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-09-03Class.h (_getDeclaredMethod): Declare.Tom Tromey1-4/+3
* 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-07-05re PR libgcj/7060 (getMethod() doesn't search super interface)Tom Tromey1-2/+16
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-06-25natPlainDatagramSocketImpl.cc (BooleanClass): Removed.Tom Tromey1-26/+22
* java/net/natPlainDatagramSocketImpl.cc (BooleanClass): Removed. (IntegerClass): Likewise. * java/lang/natClass.cc (CloneableClass): Removed. (ObjectClass, ErrorClass, ClassClass, MethodClass, FieldClass, ConstructorClass): Likewise. * java/lang/natClassLoader.cc (CloneableClass): Removed. (ObjectClass, ClassClass, VMClassLoaderClass, ClassLoaderClass, SerializableClass): Likewise. * java/lang/reflect/natMethod.cc (BooleanClass): Removed. (VoidClass, ByteClass, ShortClass, CharacterClass, IntegerClass, LongClass, FloatClass, DoubleClass): Likewise. From-SVN: r54977
2001-12-21re PR libgcj/2428 (Classloader is not set)Tom Tromey1-0/+28
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-15java-tree.h (otable_methods, [...]): New field/global tree definitions.Bryce McKinlay1-1/+192
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-09Makefile.in: Rebuilt.Tom Tromey1-2/+1
* Makefile.in: Rebuilt. * Makefile.am (java/lang/reflect/Method.h): ObjectInputStream now a friend. * java/lang/natClass.cc (getSignature): Only look at elements of non-null parameters. (getPrivateMethod): Removed old FIXME comment. * java/io/natObjectInputStream.cc (allocateObject): Removed old FIXME comment. (callConstructor): Simply use `NULL' for value of parameters. (ObjectClass): Removed. (ClassClass): Likewise. * java/io/ObjectInputStream.java (readObject): Fixed typo. From-SVN: r47800
2001-11-26Fix for PR libgcj/2024, plus other class name cleanups:Tom Tromey1-2/+4
* include/jvm.h (_Jv_VerifyFieldSignature, _Jv_VerifyMethodSignature, _Jv_VerifyClassName, _Jv_VerifyIdentifier, _Jv_ClassNameSamePackage): Moved from ... * include/java-interp.h: ... here. * defineclass.cc (UTF8_PEEK): No longer conditional on interpreter. (_Jv_VerifyOne): Likewise. (_Jv_VerifyFieldSignature): Likewise. (_Jv_VerifyMethodSignature): Likewise. (is_identifier_start): Likewise. (is_identifier_part): Likewise. (_Jv_VerifyIdentifier): Likewise. (_Jv_VerifyClassName): Likewise. (_Jv_VerifyClassName): Likewise. (_Jv_ClassNameSamePackage): Likewise. (_Jv_VerifyClassName): Fail if class name is too long. * java/lang/natClassLoader.cc (_Jv_NewArrayClass): Disallow array of void. * java/lang/natClass.cc (forName): Check syntax of class name. Include IllegalArgumentException.h. From-SVN: r47334
2001-10-16Eliminate use of C++ static constructors.Bryce McKinlay1-18/+5
* 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-09-30natClass.cc (_Jv_IsAssignableFrom): Handle the case of an uninitialized ↵Bryce McKinlay1-2/+3
target class. * java/lang/natClass.cc (_Jv_IsAssignableFrom): Handle the case of an uninitialized target class. From-SVN: r45893
2001-06-05natClass.cc (_Jv_IsAssignableFrom): Ensure that ancestors table index is ↵Martin Kahlert1-6/+16
within allowed bounds. 2001-06-05 Martin Kahlert <martin.kahlert@infineon.com> Bryce McKinlay <bryce@waitaki.otago.ac.nz> * java/lang/natClass.cc (_Jv_IsAssignableFrom): Ensure that ancestors table index is within allowed bounds. Ensure that we dont try to access class itable at a negative offset. Avoid an ancestor table lookup if source is a primitive type class. (isInstance): Remove redundant isPrimitive() check. Co-Authored-By: Bryce McKinlay <bryce@waitaki.otago.ac.nz> From-SVN: r42898
2001-05-18[multiple changes]Bryce McKinlay1-4/+3
2001-05-18 Bryce McKinlay <bryce@waitaki.otago.ac.nz> * include/jvm.h: Move "#pragma GCC java_exceptions" to ... * gcj/javaprims.h: ... here. * gnu/gcj/io/shs.cc: Add "#pragma GCC java_exceptions". 2001-05-17 Martin Kahlert <martin.kahlert@infineon.com> * java/lang/natClass.cc (_Jv_FindIIndex): Fix an off by one error with length of ioffset table. (_Jv_IsAssignableFrom): Likewise. From-SVN: r42248
2001-04-25decl.c (init_decl_processing): Add new class "protectionDomain" field.Bryce McKinlay1-5/+14
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-03-25exception.cc (java_eh_info): Make value type jthrowable.Richard Henderson1-34/+33
* exception.cc (java_eh_info): Make value type jthrowable. (_Jv_type_matcher): Remove now unneeded cast. (_Jv_Throw): Make argument type jthrowable. Munge name for SJLJ_EXCEPTIONS here ... * gcj/cni.h: ... not here. (JvThrow): Remove. * gcj/javaprims.h (_Jv_Throw, _Jv_Sjlj_Throw): Update declarations. * defineclass.cc, interpret.cc, jni.cc, posix-threads.cc, prims.cc, resolve.cc, gnu/gcj/runtime/natFirstThread.cc, gnu/gcj/xlib/natDrawable.cc, gnu/gcj/xlib/natFont.cc, gnu/gcj/xlib/natWMSizeHints.cc, gnu/gcj/xlib/natWindowAttributes.cc, gnu/gcj/xlib/natXImage.cc, java/io/natFile.cc, java/io/natFileDescriptorEcos.cc, java/io/natFileDescriptorPosix.cc, java/io/natFileDescriptorWin32.cc, java/io/natFileWin32.cc, java/lang/natClass.cc, java/lang/natClassLoader.cc, java/lang/natDouble.cc, java/lang/natObject.cc, java/lang/natPosixProcess.cc, java/lang/natRuntime.cc, java/lang/natString.cc, java/lang/natSystem.cc, java/lang/natThread.cc, java/lang/reflect/natArray.cc, java/lang/reflect/natConstructor.cc, java/lang/reflect/natField.cc, java/lang/reflect/natMethod.cc, java/util/zip/natDeflater.cc, java/util/zip/natInflater.cc: Use throw, not JvThrow or _Jv_Throw. From-SVN: r40838
2001-03-23natClass.cc (_Jv_IsAssignableFrom): Checking the ancestors array is invalid ↵Per Bothner1-7/+10
for interfaces... * java/lang/natClass.cc (_Jv_IsAssignableFrom): Checking the ancestors array is invalid for interfaces, so do that *after* check that the target type is not an interface. From-SVN: r40797
2001-03-23jni.cc (_Jv_JNI_GetAnyFieldID): Handle unresolved fields.Tom Tromey1-2/+4
* jni.cc (_Jv_JNI_GetAnyFieldID): Handle unresolved fields. * java/lang/reflect/natField.cc (getType): Use _Jv_ResolveField unconditionally. * include/jvm.h (_Jv_ResolveField): Declare. * include/java-interp.h (_Jv_ResolveField): Don't declare. * resolve.cc (_Jv_ResolveField): No longer conditional on INTERPRETER. From-SVN: r40785
2001-03-18natClass.cc (_Jv_CheckCast): add class names to exceptionMark Wielaard1-1/+6
* java/lang/natClass.cc (_Jv_CheckCast): add class names to exception * gnu/gcj/runtime/FirstThread.java (main): replace / with . in jarMainClassName From-SVN: r40604
2001-02-14natClass.cc (getSignature): Don't try to dereference param_types if it is null.Bryce McKinlay1-2/+6
* java/lang/natClass.cc (getSignature): Don't try to dereference param_types if it is null. Instead, take this to mean "no parameters". * java/lang/TreeMap.java (TreeIterator.next): Throw NoSuchElementException in preference to ConcurrentModificationException. (TreeIterator.remove): Throw IllegalStateException in preference to ConcurrentModificationException. (SubMap.firstKey): Do a better check for empty SubMap, and if it is, throw a NoSuchElementException. (SubMap.lastKey): Likewise. From-SVN: r39658
2001-02-08gcj.texi: Change sources.redhat.com reference to gcc.gnu.org.Joseph Myers1-1/+1
gcc/java/: * gcj.texi: Change sources.redhat.com reference to gcc.gnu.org. libffi/: * include/ffi.h.in: Change sourceware.cygnus.com references to gcc.gnu.org. libjava/: * README, gij.cc, java/lang/natClass.cc, java/lang/natSystem.cc: Change sources.redhat.com and sourceware.cygnus.com references to gcc.gnu.org. From-SVN: r39531
2001-01-17Class.h (isInterface): Move implementation from natClass.cc.Bryce McKinlay1-1/+1
* 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-17prims.cc (init_prim_class): Deleted.Alexandre Petit-Bianco1-23/+0
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-15All files with updated copyright.Alexandre Petit-Bianco1-5/+21
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-08In gcc/java:Bryce McKinlay1-4/+15
* 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
2000-12-28natClass.cc (_Jv_IsAssignableFrom): Primitive TYPEs can not be assigned to ↵Bryce McKinlay1-2/+2
Object. * java/lang/natClass.cc (_Jv_IsAssignableFrom): Primitive TYPEs can not be assigned to Object. From-SVN: r38505
2000-11-26prims.cc (_Jv_NewObjectArray): Undo placement change.Anthony Green1-6/+13
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-10-06natField.cc (BooleanClass): Don't define.Tom Tromey1-14/+8
* 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-08-17natClass.cc (finit_name): Initialized with `finit$'.Alexandre Petit-Bianco1-4/+13
2000-08-15 Alexandre Petit-Bianco <apbianco@cygnus.com> * java/lang/natClass.cc (finit_name): Initialized with `finit$'. (finit_leg_name): New global. (java::lang::Class::getDeclaredMethods): Test for `finit$' or `$finit$'. This is a backward compatibility hack. (java::lang::Class::_getMethods): Likewise. (http://sources.redhat.com/ml/java-discuss/2000-08/msg00031.html See also the matching compiler patch: http://gcc.gnu.org/ml/gcc-patches/2000-08/msg00664.html) From-SVN: r35769
2000-06-18re GNATS gcj/260 ("Klass.class" expression should cause Klass to be initialized)Tom Tromey1-9/+4
* java/lang/natClass.cc (forName): Removed dead code. Initialize returned class. For PR gcj/260. From-SVN: r34590
2000-06-152000-06-15 Bryce McKinlay <bryce@albatross.co.nz>Bryce McKinlay1-15/+29
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. * java/lang/Class.h (_Jv_InterfaceAssignableFrom): New function. From-SVN: r34562
2000-05-19Jumbo patch:Tom Tromey1-1/+75
* Imported beans and serialization * Updated IA-64 port * Miscellaneous bug fixes From-SVN: r34028
2000-05-05natClass.cc (isInstance): Use __builtin_expect.Bryce McKinlay1-5/+9
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-03-21* java/lang/natClass.cc (isInstance): Use JV_CLASS, not getClass().Bryce McKinlay1-1/+1
From-SVN: r32665
2000-03-21natClass.cc (isInstance): Use _Jv_IsAssignableFrom(), not ↵Bryce McKinlay1-1/+1
Class.isAssignableFrom(). * java/lang/natClass.cc (isInstance): Use _Jv_IsAssignableFrom(), not Class.isAssignableFrom(). From-SVN: r32664
2000-03-21natClass.cc (isInstance): Initialize `this'.Bryce McKinlay1-1/+6
2000-03-21 Bryce McKinlay <bryce@albatross.co.nz> * java/lang/natClass.cc (isInstance): Initialize `this'. (isAssignableFrom): Initialize `this' and `klass'. (_Jv_IsAssignableFrom): If an interface has no idt, it is not implemented by any loaded class, so return false. From-SVN: r32663
2000-03-09natClassLoader.cc (_Jv_FindArrayClass): Call _Jv_PrepareConstantTimeTables.Bryce McKinlay1-2/+1
2000-03-09 Bryce McKinlay <bryce@albatross.co.nz> * java/lang/natClassLoader.cc (_Jv_FindArrayClass): Call _Jv_PrepareConstantTimeTables. * java/lang/natClass.cc (_Jv_PrepareConstantTimeTables): Array classes should have an IDT, so don't return if klass is an array class. From-SVN: r32445
2000-03-07All files: Updated copyright information.Tom Tromey1-1/+1
* All files: Updated copyright information. * COPYING: New file. * COPYING.LIB: Removed. * LIBGCJ_LICENSE: We now use GPL + special exception. From-SVN: r32387
2000-03-07resolve.cc (_Jv_SearchMethodInClass): New function.Bryce McKinlay1-68/+442
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-02java-interp.h: Don't include MethodInvocation.h.Tom Tromey1-29/+28
* 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-01-19* All files: Updated copyright to reflect Cygnus purchase.Tom Tromey1-1/+1
From-SVN: r31504
2000-01-07* java/lang/natClass.cc (getClasses): Wrote.Tom Tromey1-2/+5
From-SVN: r31276
2000-01-06natClass.cc (_getConstructors): Correctly check whether method name is the ↵Tom Tromey1-3/+3
init name. * java/lang/natClass.cc (_getConstructors): Correctly check whether method name is the init name. (getMethod): Look at accflags on method in `klass', not `this'. From-SVN: r31258
2000-01-06natClass.cc (getMethod): Compute offset relative to `klass's methods table, ↵Tom Tromey1-1/+2
not `this's table. * java/lang/natClass.cc (getMethod): Compute offset relative to `klass's methods table, not `this's table. * java/lang/reflect/natMethod.cc (_Jv_CallNonvirtualMethodA): In unwrapping/widening case, check whether `k' is null, not whether it is primitive. Initialize `num' from `argelts', not `paramelts'. Correct create and pass arguments to ffi_call. Don't let presence of `this' argument affect index used to look in argument arrays. (COPY): Set appropriate element in `values' vector. From-SVN: r31253
2000-01-05* java/lang/natClass.cc: Include <gcj/method.h>.Tom Tromey1-0/+1
From-SVN: r31249
2000-01-05Class.h (_getMethods): Declare.Tom Tromey1-8/+128
* 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