Commit Graph

99 Commits

Author SHA1 Message Date
Keith Seitz 3056423a31 Class.h (_Jv_FindInterpreterMethod): Change return type to _Jv_MethodBase instead of _Jv_InterpMethod.
* java/lang/Class.h (_Jv_FindInterpreterMethod): Change return type
        to _Jv_MethodBase instead of _Jv_InterpMethod.
        * java/lang/natClass.cc (_Jv_FindInterpreterMethod): Likewise.
        Do not check access flags.
        Fix some minor style anomalies.

From-SVN: r116730
2006-09-06 22:16:59 +00:00
Andreas Tobler 3bed5c6bae natClass.cc (_Jv_FindMethodInCache): Mark klass, name and signature as MAYBE_UNUSED for HAVE_TLS == 0.
2006-05-21  Andreas Tobler  <a.tobler@schweiz.ch>

	* java/lang/natClass.cc (_Jv_FindMethodInCache): Mark klass, name and
	signature as MAYBE_UNUSED for HAVE_TLS == 0.
	(_Jv_AddMethodToCache): Mark klass and method as MAYBE_UNUSED for
	HAVE_TLS == 0.

From-SVN: r113939
2006-05-21 00:03:19 +02:00
Andrew Haley b2ed63b4aa [multiple changes]
2006-05-04  Andrew Haley  <aph@redhat.com>

        * class.c (make_field_value): Always build_address_of fdecl if
        there is an initializer.

2006-05-03  Andrew Haley  <aph@redhat.com>

        PR libgcj/27352
        * expr.c (maybe_rewrite_invocation): New function.
        (rewrite_arglist_getclass): Likewise.
        (rules): New.
        (expand_invoke): Call maybe_rewrite_invocation.
        * parse.y (patch_invoke): Likewise.
        * java-tree.h: (maybe_rewrite_invocation): New function.

2006-05-03  Andrew Haley  <aph@redhat.com>

        PR libgcj/27352
        * java/lang/Class.java (getClassLoader(Class)): New.
        forName(String, Class): New.
        * java/lang/natClass.cc (getClassLoader(Class)): New.

2006-05-02  Andrew Haley  <aph@redhat.com>

        * prims.cc (_Jv_NewMultiArray): Check for phantom class.

From-SVN: r113532
2006-05-04 18:44:53 +00:00
Tom Tromey 0623a8c0c2 * java/lang/natClass.cc (_Jv_getInterfaceMethod): Skip <clinit>.
From-SVN: r113229
2006-04-24 21:28:36 +00:00
Tom Tromey 2bb6e0cefe re PR libgcj/24321 (instanceof erroneously causes class initialization)
PR java/24321:
	* testsuite/libjava.lang/pr24321.java: New file.
	* testsuite/libjava.lang/pr24321.out: New file.
	* java/lang/natClass.cc (isInstance): Don't initialize class.
	(isAssignableFrom): Likewise.

From-SVN: r111603
2006-03-01 16:01:34 +00:00
Bryce McKinlay a286e145de Class.h (_Jv_IDispatchTable): Make it a struct.
2006-02-09  Bryce McKinlay  <mckinlay@redhat.com>

	* java/lang/Class.h (_Jv_IDispatchTable): Make it a struct. Put 
	'itable' inline, instead of as a pointer.
	(java::lang::Class): Put 'idt' in anonymous union with 'ioffsets'.
	* link.cc (null_idt): Update definition.
	(_Jv_Linker::prepare_constant_time_tables): Allocate klass->idt
	as a single struct. Use _Jv_AllocBytes, not _Jv_AllocRawObj.
	(_Jv_Linker::generate_itable): Update to use 'ioffsets'.
	(_Jv_Linker::find_iindex): Likewise. Update comment.
	* java/lang/natClass.cc	(_Jv_LookupInterfaceMethodIdx): Update for
	_Jv_IDispatchTable change.
	(_Jv_IsAssignableFrom): Likewise.

From-SVN: r110818
2006-02-09 23:59:30 +00:00
Robert Schuster c1a9321f29 2006-02-01 Robert Schuster <robertschuster@fsfe.org>
* link.cc:
	(_Jv_Linker::find_field_helper): Added checks.
	(_Jv_Linker::find_field): Use exception swallowing class resolution
	and added early return.
	(_Jv_ThrowNoClassDefFoundErrorTrampoline): New function.
	(_Jv_Linker::link_symbol_table):  Use exception swallowing class
	resolution, added ffi_closure installation routine, use
	_Jv_ThrowNoClassDefFoundError for missing static method.
	(_Jv_Linker::ensure_class_linked): Added string check which does
	not trigger class resolution.
	* java/lang/natClassLoader.cc:
	(_Jv_FindClassNoException): New method.
	* java/lang/Class.h:
	(_Jv_FindClassNoException): New method declaration.
	* include/jvm.h:
	(_Jv_FindClassNoException): New method declaration.
	(_Jv_FindClassFromSignatureNoException): New method declaration.
	* prims.cc:
	(_Jv_FindClassFromSignatureNoException): New method.
        * gcj/javaprims.h:
        (_Jv_equalsUtf8Classname): New method declaration.
        (_Jv_isPrimitiveOrDerived): Dito.
        * prims.cc:
	(_Jv_equalsUtf8Classnames): New method.
        (_Jv_isPrimitiveOrDerived): New method.
        * verify.cc:
        (ref_intersection::equals): Use new classname comparison method.
        (type::compatible): Use new classname comparison method. Added
        check whether LHS' type is java.lang.Object .
        (type::resolve): Added new optional debug message and simplified
        if-expression.
        (type::to_array): Added codepath that generates an array type
        without resolving the element type.

From-SVN: r110474
2006-02-01 13:40:05 +00:00
Keith Seitz 8a0092c834 Class.h (_Jv_FindInterpreterMethod): Add new declaration.
* java/lang/Class.h (_Jv_FindInterpreterMethod): Add new declaration.
        * java/lang/natClass.cc (_Jv_FindInterpreterMethod): New function.

From-SVN: r110142
2006-01-23 18:44:43 +00:00
Tom Tromey b9e6a2e5de re PR libgcj/23367 (_Jv_FindMethodInCache is not thread-safe)
PR libgcj/23367:
	* include/jvm.h (_Jv_FreeMethodCache): Declare.
	* java/lang/natClass.cc (MCACHE_SIZE): Conditional on HAVE_TLS.
	(struct _Jv_mcache): Likewise.
	(method_cache): Likewise.
	(_Jv_FindMethodInCache): Do nothing unless TLS is available.
	(_Jv_AddMethodToCache): Likewise.
	(_Jv_FreeMethodCache): New function.
	* java/lang/natThread.cc (finish_): Call _Jv_FreeMethodCache.
	* aclocal.m4, configure, include/config.h.in: Rebuilt.
	* configure.ac: Invoke GCC_CHECK_TLS.

From-SVN: r104707
2005-09-27 20:03:09 +00:00
Tom Tromey 852993e381 re PR libgcj/23739 (JNI: IsAssignableFrom reverses arguments)
PR libgcj/23739:
	* testsuite/libjava.jni/pr23739.c: New file.
	* testsuite/libjava.jni/pr23739.java: New file.
	* testsuite/libjava.jni/pr23739.out: New file.
	* jni.cc (_Jv_JNI_IsAssignableFrom): Reversed arguments.
	* java/lang/reflect/natMethod.cc (invoke): Updated.
	* java/lang/natClass.cc (isAssignableFrom): Updated.
	(isInstance): Likewise.
	(_Jv_IsAssignableFrom): Reversed arguments.
	(_Jv_IsInstanceOf): Updated.
	(_Jv_CheckCast): Likewise.
	(_Jv_CheckArrayStore): Likewise.
	(_Jv_IsAssignableFromSlow): Reversed arguments.
	(_Jv_InterfaceAssignableFrom): Likewise.
	* link.cc (verify_type_assertions): Updated.
	* prims.cc (_Jv_CheckAccess): Updated.

From-SVN: r103953
2005-09-06 16:01:31 +00:00
Tom Tromey 7666af8941 Class.java (getClasses): New method.
* java/lang/Class.java (getClasses): New method.
	(internalGetClasses): Likewise.
	(getClassLoader): Updated documentation.
	(getDeclaredClasses): New overload; old overload no longer
	native.
	(_getConstructors): Removed.
	(resourcePath): Updated.
	* java/lang/natClass.cc (getClasses): Removed.
	* java/lang/Class.h (getDeclaredClasses, getDeclaredConstructors):
	Updated.
	(_getConstructors): Removed.

From-SVN: r100948
2005-06-14 18:51:54 +00:00
Tom Tromey 36a0d3d264 * java/lang/natClass.cc (initializeClass): Link class.
From-SVN: r98540
2005-04-22 02:33:31 +00:00
Tom Tromey aa893047e8 Makefile.in: Rebuilt.
* Makefile.in: Rebuilt.
	* Makefile.am (AM_CXXFLAGS): Define TOOLEXECLIBDIR.
	(libgcj0_convenience_la_SOURCES): Don't include
	gnu_xml_source_files.
	(libgcj0_convenience_la_LIBADD): New variable.
	(libgcj_la_LIBADD): Don't include sax or w3c_dom.
	(all_java_source_files): javax_imageio_source_files,
	javax_xml_source_files, and gnu_java_beans_source_files.
	($(gnu_xml_source_files:.java=.lo)): Removed target.
	(gnu-xml.lo): New target.
	(javax-imageio.lo): Likewise.
	(javax-xml.lo): Likewise.
	(gnu-java-beans.lo): Likewise.
	(gnu_java_beans_source_files): New variable.
	(javax_imageio_source_files): Likewise.
	(javax_xml_source_files): Likewise.
	(javax_source_files): Moved files to other variable.
	(awt_java_source_files): Likewise.
	(ordinary_java_source_files): Added BootClassLoader.java.
	* java/lang/natVMClassLoader.cc (defineClass): Use boot loader,
	not system class loader.
	(initBootLoader): New method.
	(loadClass): Search bootLoader.
	* java/lang/natClassLoader.cc (_Jv_RegisterInitiatingLoader): Use
	boot loader, not system class loader.
	(_Jv_UnregisterInitiatingLoader): Likewise.
	(_Jv_FindClass): Likewise.  Ensure entries in
	bootstrap_class_list are unique.
	* java/lang/natClass.cc (getClassLoader): Don't special case
	system class loader.
	* java/lang/VMClassLoader.java (bootLoader): New field.
	(getResource): Use bootLoader.
	(getResources): Likewise.
	(initBootLoader): Declare.
	* gnu/gcj/runtime/BootClassLoader.java: New file.
	* external/sax/org/xml/sax/helpers/NamespaceSupport.java
	(EMPTY_ENUMERATION): Now package-private.
	* external/w3c_com/Makefile.in: Rebuilt.
	* external/w3c_com/Makefile.am (MULTIBUILDTOP): New variable.
	(w3c.jar): New target.
	(classes.stamp): Updated.
	(toolexeclib_LTLIBRARIES): Renamed from noinst_LTLIBRARIES.
	Changed name of library.
	(libw3c_gcj_la_SOURCES): New variable.
	(libw3c_gcj_la_GCJFLAGS): Likewise.
	(source_files): Renamed from lib3c_convenience_la_SOURCES.
	* external/sax/Makefile.in: Rebuilt.
	* external/sax/Makefile.am (MULTIBUILDTOP): New variable.
	(sax.jar): New target.
	(classes.stamp): Updated.
	(toolexeclib_LTLIBRARIES): Renamed from noinst_LTLIBRARIES.
	Changed name of library.
	(libsax_gcj_la_SOURCES): New variable.
	(libsax_gcj_la_GCJFLAGS): Likewise.
	(source_files): Renamed from libsax_convenience_la_SOURCES.
	* stacktrace.cc (non_system_trace_fn): Don't look at system class
	loader.
	* prims.cc (_Jv_CreateJavaVM): Initialize the bootstrap class
	loader.
	(_Jv_RunMain): Handle case where 'runtime' is NULL at exit.

From-SVN: r96960
2005-03-24 00:04:22 +00:00
Bryce McKinlay c0cbd60130 exception.cc: Remove stray MethodRef.h include.
2005-03-10  Bryce McKinlay  <mckinlay@redhat.com>

        * exception.cc: Remove stray MethodRef.h include.
        * java/lang/natClass.cc: Likewise.
        * gnu/gcj/runtime/MethodRef.java: Removed.
        * gnu/gcj/runtime/StackTrace.java, gnu/gcj/runtime/natNameFinder.cc,
        gnu/gcj/runtime/natStackTrace.cc: Really removed.
        * java/lang/natRuntime.cc (_load): Remove unsed variable.
        * Makefile.am (ordinary_java_source_files): Remove MethodRef.java.
        * Makefile.in: Rebuilt.

From-SVN: r96288
2005-03-11 04:30:20 +00:00
Bryce McKinlay 18744d9b72 New Stack Trace infrastructure.
2005-03-10  Bryce McKinlay  <mckinlay@redhat.com>

	New Stack Trace infrastructure.
	* Makefile.am (libgcj0_convenience_la_SOURCES): Add stacktrace.cc.
	(gnu/gcj/runtime/StackTrace.lo): Removed.
	(ordinary_java_source_files): Remove obsolete files.
	(nat_source_files): Remove obsolete files. Add natVMThrowable.cc.
	* configure.host (fallback_backtrace_h): Set backtrace header
	for mingw and cygwin targets.
	* configure.ac: Make symlink for fallback backtrace headers.
	* Makefile.in, configure: Rebuilt.
	* defineclass.cc (_Jv_ClassReader::read_one_code_attribute):
	Read 'LineNumberTable' attribute.
	(_Jv_ClassReader::read_one_class_attribute): Read 'SourceFile'
	attribute.
	(_Jv_ClassReader::handleCodeAttribute): Initialize method line
	table fields.
	* exception.cc: Remove unused include.
	* interpret.cc (DIRECT_THREADED, insn_slot): Moved to java-interp.h.
	(SAVE_PC): New macro. Save current PC in the interpreter frame.
	(NULLCHECK, NULLARRAYCHECK): Use SAVE_PC.
	(_Jv_InterpMethod::compile): Translate bytecode PC values in the line
	table to direct threaded instruction values.
	(_Jv_StartOfInterpreter, _Jv_EndOfInterpreter): Removed.
	(_Jv_InterpMethod::run): No longer member function. All
	callers updated. Remove _Unwind calls. Call SAVE_PC whenever a call
	is made or where an instruction could throw.
	(_Jv_InterpMethod::get_source_line): New. Look up source line numbers
	in line_table.
	* prims.cc (catch_segv): Construct exception after MAKE_THROW_FRAME.
	(catch_fpe): Likewise.
	* stacktrace.cc: New file. Stack trace code now here.
	* gnu/gcj/runtime/MethodRef.java:
	* gnu/gcj/runtime/NameFinder.java: Mostly reimplemented. Now simply
	calls addr2line to look up PC addresses in a given binary or shared
	library.
	* gnu/gcj/runtime/StackTrace.java, gnu/gcj/runtime/natNameFinder.cc,
	gnu/gcj/runtime/natStackTrace.cc: Removed.
	* gnu/java/lang/MainThread.java (call_main): Add comment warning that
	this function name is specially recognised by the stack trace code
	and shouldn't be changed.
	* include/java-interp.h (DIRECT_THREADED, insn_slot): Moved here.
	(struct  _Jv_LineTableEntry, line_table, line_table_len): New.
	(_Jv_InterpMethod::run): Update declaration.
	(_Jv_StackTrace_): New friend. NameFinder and StackTrace no longer
	friends.
	(_Jv_InterpFrame): Renamed from _Jv_MethodChain. Add PC field.
	* include/java-stack.h: New file. Declarations for stack tracing.
	* include/jvm.h (_Jv_Frame_info): Removed.
	* java/lang/Class.h: Update friend declarations.
	* java/lang/VMClassLoader.java (getSystemClassLoader): Simplify
	exception message.
	* java/lang/VMThrowable.java (fillInStackTrace): Now native.
	(getStackTrace): Now native.
	(data): New RawDataManaged field.
	* java/lang/natClass.cc: Update includes.
	(forName): Use _Jv_StackTrace::GetCallingClass for
	calling-classloader check.
	(getClassLoader): Likewise.
	* java/lang/natRuntime.cc: Update includes.
	(_load): Use _Jv_StackTrace::GetFirstNonSystemClassLoader.
	* java/lang/natVMSecurityManager.cc: Update includes.
	(getClassContext): Use _Jv_StackTrace::GetClassContext.
	* java/lang/natVMThrowable.cc: New file. Native methods for
	VMThrowable.
	* java/lang/reflect/natArray.cc: Update includes.
	(newInstance): Use _Jv_StackTrace::GetCallingClass to implement
	accessibility check.
	* java/lang/reflect/natConstructor.cc: Update includes.
	(newInstance): Use _Jv_StackTrace::GetCallingClass to implement
	accessibility check.
	* java/lang/reflect/natField.cc: Update includes.
	(getAddr): Use _Jv_StackTrace::GetCallingClass to implement
	accessibility check.
	* java/lang/reflect/natMethod.cc: Update includes.
	(invoke): Use _Jv_StackTrace::GetCallingClass to implement
	accessibility check.
	* java/util/natResourceBundle.cc: Update includes.
	(getCallingClassLoader): Use _Jv_StackTrace::GetCallingClass.
	* java/util/logging/natLogger.cc: Update includes. Use
	_Jv_StackTrace::GetCallerInfo to get call-site info.
	* sysdep/generic/backtrace.h: Fallback backtrace code. Stub
	implementation.
	* sysdep/i386/backtrace.h: New. Fallback backtrace code. i386
	implementation.

From-SVN: r96253
2005-03-10 19:02:21 +00:00
Tom Tromey 2a2c6e55e7 Class.h (_Jv_GetMethodString): Updated declaration.
* java/lang/Class.h (_Jv_GetMethodString): Updated declaration.
	* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Updated.
	* java/lang/natClass.cc (_Jv_LookupInterfaceMethod): Updated.
	* link.cc (_Jv_GetMethodString): Added 'derived' argument.
	Changed type of second argument.  Rewrote.
	(make_vtable): Use it.
	(append_partial_itable): Updated.
	(layout_vtable_methods): Updated.

From-SVN: r95181
2005-02-17 19:17:08 +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
Andreas Schwab b3a450236a natClass.cc (_Jv_LayoutVTableMethods): Cast pointers to uaddr, not int.
* java/lang/natClass.cc (_Jv_LayoutVTableMethods): Cast pointers
	to uaddr, not int.
	* java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass):
	Likewise.

From-SVN: r89346
2004-10-20 21:42:33 +00: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
Per Bothner 963ddbd50f Print -verbose:message on "loading", not initialization.
* java/lang/Class.h (JV_STATE_LOADED, JV_STATE_COMPILED):  Swap order.
	* defineclass.cc (_Jv_ClassReader::parse):  Print message if
	gcj::verbose_class_flag.
	* java/lang/natClass.cc (initializeClass):  Don't print message here.
	* java/lang/natClassLoader.cc (_Jv_WaitForState):  If state was
	_JV_STATE_COMPILED, set to JV_STATE_LOADED and may print message.
	(_Jv_PrepareCompiledClass):  Likewise.

From-SVN: r84926
2004-07-19 11:29:31 -07:00
Per Bothner 0bd241538e jvm.h (namespace jcj): Declare verbose_class_flag
* include/jvm.h (namespace jcj):  Declare verbose_class_flag
	* java/lang/natClass.cc (gcj::verbose_class_flag):  New variable.
	(initializeClass):  If verbose_class_flag, print message.
	* gij.cc (main):  Handle -verbose:class flag.

From-SVN: r84242
2004-07-07 16:44:12 -07:00
Bryce McKinlay 17abdabcf3 Layout interfaces during preparation, not initialization.
* java/lang/natClass.cc (initializeClass): Move
	_Jv_LayoutInterfaceMethods call...
	* java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): to here.

From-SVN: r82101
2004-05-21 17:08:50 +01:00
Bryce McKinlay 746ecc7813 natClass.cc (_Jv_LayoutInterfaceMethods): New method.
2004-04-21  Bryce McKinlay  <mckinlay@redhat.com>

        * java/lang/natClass.cc (_Jv_LayoutInterfaceMethods): New method.
        Set method->index values for interface methods to their itable
	index.
        (initializeClass): Call _Jv_LayoutInterfaceMethods.

From-SVN: r80978
2004-04-21 20:26:22 +01:00
Bryce McKinlay f531010820 class.c (make_class_data): Add new field aux_info.
2004-04-19  Bryce McKinlay  <mckinlay@redhat.com>

	* class.c (make_class_data): Add new field aux_info.
	* decl.c (java_init_decl_processing): Push type and decl for
	`aux_info'.

2004-04-19  Bryce McKinlay  <mckinlay@redhat.com>

	* gcj/cni.h (JvAllocObject): Remove these obsolete,
	undocumented CNI calls.
	* include/java-interp.h (_Jv_InterpClass): No longer
	extends java.lang.Class.
	* java/lang/Class.h (Class): Add new field `aux_info'.
	* boehm.cc (_Jv_MarkObj): Update java.lang.Class marking.
	* defineclass.cc: Remove Class<->_Jv_InterpClass casts.
	Use Class->aux_info instead.
	* jni.cc (_Jv_JNI_AllocObject): Use _Jv_AllocObject.
	* resolve.cc: Remove Class<->_Jv_InterpClass casts.
	Use Class->aux_info instead.
	* java/io/natObjectInputStream.cc (allocateObject): Use
	_Jv_AllocObject.
	* java/lang/natClass.cc (newInstance): Likewise.
	* java/lang/natClassLoader.cc (_Jv_NewClass): Likewise.
	* java/lang/natObject.cc (clone): Likewise.
	* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Likewise.
	* java/lang/natVMClassLoader.cc (defineClass): Don't use
	JvAllocObject. Allocate klass->aux_info here for interpreted
	class.

From-SVN: r80875
2004-04-20 02:38:46 +01:00
Anthony Green 95e59f1ada natClass.cc (getClassLoader): Circumvent infinite recursion when searching for the system ClassLoader.
2004-03-21  Anthony Green  <green@redhat.com>

        * java/lang/natClass.cc (getClassLoader): Circumvent infinite
        recursion when searching for the system ClassLoader.

From-SVN: r79871
2004-03-23 19:24:07 +00:00
Michael Koch b7e0ff4538 Class.h (hack_signers): Renamed signers to hack_signers.
2003-12-03  Michael Koch  <konqueror@gmx.de>

	* java/lang/Class.h (hack_signers): Renamed signers to hack_signers.
	* java/lang/natClass.cc (getSigners): Likewise.
	(setSigners): Likewise.

From-SVN: r74247
2003-12-03 21:26:59 +00:00
Tom Tromey b86ca9a2dc jni.cc (_Jv_JNI_GetStringUTFChars): Pass length of string to JvGetStringUTFRegion.
* jni.cc (_Jv_JNI_GetStringUTFChars): Pass length of string to
	JvGetStringUTFRegion.
	* java/lang/natPosixProcess.cc (new_string): Pass length of string
	to JvGetStringUTFRegion.
	* java/lang/natDouble.cc (parseDouble): Pass length of string to
	JvGetStringUTFRegion.
	* java/lang/natWin32Process.cc (startProcess): Pass length of
	string to JvGetStringUTFRegion.
	* java/lang/natClass.cc (forName): Pass length of string to
	JvGetStringUTFRegion.
	* gnu/gcj/runtime/natNameFinder.cc (getExternalLabel): Pass length
	of string to JvGetStringUTFRegion.
	* gnu/gcj/convert/natIconv.cc (init): Pass length of string to
	JvGetStringUTFRegion.
	* gnu/awt/gtk/natGtkLabelPeer.cc (setText): Pass length of string
	to JvGetStringUTFRegion.
	* gnu/awt/gtk/natGtkButtonPeer.cc (setLabel): Pass length of
	string to JvGetStringUTFRegion.

From-SVN: r73571
2003-11-14 01:48:30 +00:00
Bryce McKinlay 99f8b2501d natClass.cc (newInstance): Throw InstantiationException if class has no null-argument constructor.
* java/lang/natClass.cc (newInstance): Throw InstantiationException
        if class has no null-argument constructor.

From-SVN: r73244
2003-11-04 05:27:10 +00:00
Bryce McKinlay 6ac8b2b187 natClass.cc (_Jv_LayoutVTableMethods): Always assign a vtable slot for final methods.
* java/lang/natClass.cc (_Jv_LayoutVTableMethods): Always assign a
	vtable slot for final methods. Add FIXME comment.

From-SVN: r73023
2003-10-28 22:45:57 +00:00
Bryce McKinlay b9b5672b49 Constructor.java (toString): Avoid extra whitespace on constructor with no modifiers.
2003-10-26  Bryce McKinlay  <bryce@mckinlay.net.nz>

	* java/lang/reflect/Constructor.java (toString): Avoid extra
	whitespace on constructor with no modifiers.
	* java/lang/reflect/natConstructor.java (newInstance): Look up
	caller and perform accessibility check only if constructor is
	non-public and accessible flag is not set.

2003-10-26  Bryce McKinlay  <bryce@mckinlay.net.nz>

	* jni.cc (_Jv_JNI_CallAnyMethodV, _Jv_JNI_CallAnyMethodA,
	_Jv_JNI_CallAnyVoidMethodV, _Jv_JNI_CallAnyVoidMethodA): Don't
	use _Jv_LookupDeclaredMethod(). Call _Jv_CallAnyMethodA with
	is_virtual_call argument.
	* include/jvm.h (_Jv_isVirtualMethod): Moved and renamed from
	natClass.cc.
	* java/lang/natClass.cc (_Jv_LayoutVTableMethods): Use
	_Jv_isVirtualMethod.
	* java/lang/reflect/natMethod.cc (invoke): Don't use
	_Jv_LookupDeclaredMethod.
	(_Jv_CallAnyMethodA): New is_virtual_call argument. If specified,
	look up method in target object's vtable.

From-SVN: r72942
2003-10-26 02:25:42 +00:00
Anthony Green fe8738988d Obvious fix for systems with no interpreter.
From-SVN: r72903
2003-10-24 18:27:29 +00:00
Andrew Haley 904715853c lang.c (LANG_HOOKS_GET_CALLEE_FNDECL): New.
2003-10-22  Andrew Haley  <aph@redhat.com>

        * lang.c (LANG_HOOKS_GET_CALLEE_FNDECL): New.
        (java_get_callee_fndecl): New.

        * jcf-parse.c (java_parse_file): Call emit_catch_table().

        * java-tree.h (ctable_decl): New.
        (catch_classes):  New.
        (java_tree_index): Add JTI_CTABLE_DECL, JTI_CATCH_CLASSES.

        * decl.c (java_init_decl_processing): Add catch_class_type.
        Add ctable_decl.
        Add catch_classes field.

        * class.c (build_indirect_class_ref): Break out from
        build_class_ref.
        (make_field_value): Check flag_indirect_dispatch.
        (make_class_data): Ditto.
        Tidy uses of PUSH_FIELD_VALUE.
        Add field catch_classes.
        (make_catch_class_record): New.

        * java-tree.h (PUSH_FIELD_VALUE): Tidy.

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

        * java/lang/natClass.cc (initializeClass): Call
        _Jv_linkExceptionClassTable.
        (_Jv_LinkSymbolTable): Call )_Jv_ThrowNoSuchMethodError.  Call
        _Jv_Defer_Resolution on a method whose ncode is NULL.
        (_Jv_linkExceptionClassTable): New function.
        (_Jv_LayoutVTableMethods): If superclass looks like a constant pool
        entry, look it up.
        * java/lang/Class.h (struct _Jv_CatchClass): New.
        (_Jv_linkExceptionClassTable): New friend.
        (_Jv_Defer_Resolution): New friend.
        (class Class.catch_classes): New field.
        * include/java-interp.h (Jv_Defer_Resolution): New method.
        (_Jv_PrepareClass): Make a friend of _Jv_MethodBase.
        (_Jv_MethodBase.deferred): New field.
        (_Jv_Defer_Resolution): New function.
        * resolve.cc (_Jv_PrepareClass): Resolve deferred handlers.
        * exception.cc (get_ttype_entry): Change return type to void**.
        (PERSONALITY_FUNCTION): Remove all code related to using a
        Utf8Const* for a match type.  Change match type to be a pointer to
        a pointer, rather than a pointer to a Class.
        * defineclass.cc (handleCodeAttribute): Initialize
        method->deferred.
        (handleMethodsEnd): Likewise.

From-SVN: r72886
2003-10-24 09:29:43 +00:00
Tom Tromey eab09cdf1a re PR libgcj/12416 (java.lang.Class.getFields returns duplicate entries.)
PR libgcj/12416:
	* java/lang/Class.h: Updated.
	* java/lang/natClass.cc (_getFields): Removed.
	(getFields): Likewise.
	(getDeclaredFields): Added `public_only' parameter.
	* java/lang/Class.java (getFields): Now implemented in java; from
	Classpath.
	(getDeclaredFields): Likewise.
	(getDeclaredFields(boolean)): Declare.
	(_getFields): Removed.
	(internalGetFields): New method, from Classpath.

From-SVN: r72818
2003-10-22 19:29:27 +00:00
Tom Tromey b379e7b0e9 ClassLoader.java (setSigners): Implemented.
* java/lang/ClassLoader.java (setSigners): Implemented.
	* boehm.cc (_Jv_MarkObj): Mark `signers' field.
	* java/lang/natClassLoader.cc (_Jv_InitNewClassFields):
	Initialize new fields.
	* java/lang/Class.java (getSigners): Now native.
	(setSigners): Declare.
	* java/lang/natClass.cc (getSigners): New method.
	(getSigners): Likewise.
	* java/lang/Class.h (Class::signers): New field.
	(Class::setSigners): New method.

From-SVN: r72271
2003-10-09 16:24:55 +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
Tom Tromey b9f42bb060 Proxy.java (generate): Uncomment protection domain code.
* java/lang/reflect/Proxy.java (generate): Uncomment protection
	domain code.
	* java/lang/natClassLoader.cc (defineClass): Added `loader'
	argument.
	(linkClass0): Now in VMClassLoader.
	(markClassErrorState0): Likewise.
	(getSystemClassLoaderInternal): New method.
	* java/lang/natClass.cc (initializeClass): Use
	VMClassLoader::resolveClass.
	* java/lang/ClassLoader.java: New version, from Classpath.
	* java/lang/Class.java (getProtectionDomain):
	protectionDomainPermission and unknownProtectionDomain now in
	VMClassLoader.
	* java/lang/Class.h: VMClassLoader now a friend class.
	* gnu/gcj/runtime/VMClassLoader.java (instance): Now
	package-private.
	* gcj/javaprims.h: Regenerated class list.
	* resolve.cc (_Jv_PrepareClass): Use VMClassLoader::resolveClass.
	* java/lang/VMClassLoader.java: New version from Classpath;
	modified for libgcj use.

From-SVN: r71765
2003-09-25 07:46:19 +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
Tom Tromey 06b021af7b re PR libgcj/10582 (array assignment fails in some situations)
PR libgcj/10582:
	* verify.cc (_Jv_BytecodeVerifier::is_assignable_from_slow):
	Removed.
	(type::compatible): Use _Jv_IsAssignableFrom.
	* java/lang/natClass.cc (iindex_mutex_initialized): Now static.
	(_Jv_IsAssignableFrom): Work even when source or target class is
	not prepared.

From-SVN: r66348
2003-05-01 21:36:18 +00:00
Tom Tromey 44fc3a6f54 natClass.cc (newInstance): Put method name in exception.
* java/lang/natClass.cc (newInstance): Put method name in
	exception.
	(getConstructor): Likewise.
	(getDeclaredConstructor): Likewise.
	(getPrivateMethod): Likewise.

From-SVN: r65021
2003-03-29 20:17:02 +00:00
Jeff Sturm ae724017fd natClass.cc (initializeClass): Check tables when (state == 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
2003-01-30 23:20:45 +00:00
Jeff Sturm 4017ae6e8b exception.cc (PERSONALITY_FUNCTION): Clear least-significant-bit of catch_type.
* 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-23 19:59:31 +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
Mark Wielaard c0cd8f67f1 natClass.cc (initializeClass): Throw NoClassDefFoundError with getName() as 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-10 21:07:27 +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 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 d74bba04e8 natPlainDatagramSocketImpl.cc (BooleanClass): Removed.
* 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
2002-06-25 05:29: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