summaryrefslogtreecommitdiff
path: root/libjava/prims.cc
Commit message (Collapse)AuthorAgeFilesLines
* * prims.cc (_Jv_CreateJavaVM): Install SEGV and FPE handlers,rmathew2004-06-181-5/+9
| | | | | | | | if desired, before the default class loader is initialised. Call INIT_SEGV only if HANDLE_SEGV is defined. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@83348 138bc75d-0d04-0410-961f-82ee72b054a4
* libjava:bryce2004-04-161-9/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2004-04-15 Bryce McKinlay <mckinlay@redhat.com> * prims.cc (_Jv_AllocObject): Remove `size' argument. (_Jv_AllocObjectNoFinalizer): Likewise. (_Jv_AllocObjectNoInitNoFinalizer): Likewise. (_Jv_AllocPtrFreeObject): Likewise. (_Jv_AllocString): Moved from natString.cc. Call collector interface directly even in the JVMPI case. * gcj/cni.h (JvAllocObject): Remove `size' argument from _Jv_AllocObject calls. * gcj/javaprims.h: Update prototypes. * gnu/gcj/natCore.cc (_Jv_create_core): Use `new', not _Jv_AllocObject. * java/lang/Class.h: Update _Jv_AllocObject friend prototype. * java/lang/natString.cc (_Jv_AllocString): Move to prims.cc. gcc/cp: 2004-04-15 Bryce McKinlay <mckinlay@redhat.com> * init.c (build_new_1): Don't use type size argument for Java _Jv_AllocObject call. gcc/java: 2004-04-15 Bryce McKinlay <mckinlay@redhat.com> * expr.c (expand_java_NEW): Don't use size argument for _Jv_AllocObject calls. * parse.y (patch_invoke): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@80754 138bc75d-0d04-0410-961f-82ee72b054a4
* PR libgcj/12001:tromey2004-01-141-9/+12
| | | | | | | | | | | | * gnu/gcj/runtime/VMClassLoader.java (VMClassLoader): Pass empty array to superclass. (init): Changed interface; add URLs here. (initialize): New static method. * prims.cc (_Jv_CreateJavaVM): Initialize ClassLoader here... (_Jv_RunMain): ... not here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@75889 138bc75d-0d04-0410-961f-82ee72b054a4
* * prims.cc (_Jv_NewObjectArray): Make sure byte size doesn'tralph2003-10-161-3/+10
| | | | | | | | | | | | overflow a jint. (_Jv_NewPrimArray): Check for overflowing a jint, replacing a check for overflowing size_t, since the lower level functions take a jint. * testsuite/libjava.lang/newarray_overflow.java: New file. * testsuite/libjava.lang/newarray_overflow.out: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72577 138bc75d-0d04-0410-961f-82ee72b054a4
* * java/lang/natClassLoader.cc (_Jv_InitNewClassFields): Removed.tromey2003-10-131-2/+0
| | | | | | | | | | (defineClass): Updated. (_Jv_NewClass): Likewise. * prims.cc (_Jv_InitPrimClass): Don't call _Jv_InitNewClassFields. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72444 138bc75d-0d04-0410-961f-82ee72b054a4
* * java/lang/VMClassLoader.java (loadClass): Now native.tromey2003-10-021-0/+6
| | | | | | | | * java/lang/natClassLoader.cc (loadClass): Implement. * prims.cc (_Jv_RunMain): Initialize ClassLoader. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72038 138bc75d-0d04-0410-961f-82ee72b054a4
* 2003-10-01 Andrew Haley <aph@redhat.com>aph2003-10-011-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71979 138bc75d-0d04-0410-961f-82ee72b054a4
* 2003-08-19 Andrew Haley <aph@redhat.com>aph2003-08-201-0/+16
| | | | | | | | | * prims.cc (unblock_signal): New function. (SIGNAL_HANDLER): Use it. (SIGNAL_HANDLER): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@70598 138bc75d-0d04-0410-961f-82ee72b054a4
* * java/lang/Runtime.java: Comment fix.tromey2003-07-211-1/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69621 138bc75d-0d04-0410-961f-82ee72b054a4
* 2003-06-12 Andrew Haley <aph@redhat.com>aph2003-06-131-28/+29
| | | | | | | | | | | | | | | | | | | * prims.cc (catch_segv): Create exception in handler. (catch_fpe): Likewise. (_Jv_divI, _Jv_remI, _Jv_divJ, _Jv_remJ): Likewise. (_Jv_ThrowSignal): Remove. * include/x86_64-signal.h (INIT_SEGV): Delete reference to nullp. * include/default-signal.h (INIT_SEGV, INIT_FPE): Delete reference to nullp and arithexception. * include/dwarf2-signal.h (INIT_SEGV, INIT_FPE): Likewise. * include/i386-signal.h (INIT_SEGV, INIT_FPE): Likewise. * include/s390-signal.h (INIT_SEGV, INIT_FPE): Likewise. * include/sparc-signal.h (INIT_SEGV, INIT_FPE): Likewise. * include/win32-signal.h (INIT_SEGV, INIT_FPE): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67892 138bc75d-0d04-0410-961f-82ee72b054a4
* 2003-03-29 Mohan Embar <gnustuff@thisiscool.com>aph2003-04-251-2/+25
| | | | | | | | | | | | | | | | | | * include/jvm.h: (_Jv_GetNbArgs) added (_Jv_GetSafeArg) added (_Jv_SetArgs) added * prims.cc: (_Jv_GetNbArgs) implemented (_Jv_GetSafeArg) implemented (_Jv_SetArgs) implemented (_Jv_RunMain) use _Jv_SetArgs() instead of explicitly setting _Jv_argc and _Jv_argv * posix.cc: (_Jv_ThisExecutable) use _Jv_GetSafeArg() instead of _Jv_argv * java/lang/natRuntime.cc: (insertSystemProperties) use _Jv_GetSafeArg() instead of _Jv_argv git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66067 138bc75d-0d04-0410-961f-82ee72b054a4
* 2003-03-10 2003-02-27 Mohan Embar <gnustuff@thisiscool.com>aph2003-03-101-32/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * include/jvm.h: removed declaration of _Jv_ThisExecutable() setter; made return value of getter const char* instead of char* * prims.cc: removed all references to _Jv_ThisExecutable(). These are in the platform-specific sections now. * posix.cc: define platform-specific _Jv_ThisExecutable(). Handle DISABLE_MAIN_ARGS and HAVE_PROC_SELF_EXE cases * win32.cc: define platform-specific _Jv_ThisExecutable() using GetModuleFilename() * java/lang/natRuntime.cc: set gnu.gcj.progname property to argv[0] instead of _Jv_ThisExecutable() 2003-03-10 Ranjit Mathew <rmathew@hotmail.com> * gnu/gcj/runtime/NameFinder.java (usingAddr2name): New flag that is set if we are using addr2name.awk instead of addr2line. (NameFinder): Set usingAddr2name if using addr2name.awk. (getExternalLabel): New native method to convert a method name to an external label. (lookup): Convert name given by addr2line to an external label before demangling. * gnu/gcj/runtime/natNameFinder.cc (LABEL_PREFIX): New string constant representing the prefix attached to method names to convert them to an external label. (gnu::gcj::runtime::NameFinder::getExternalLabel): Define using LABEL_PREFIX. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@64111 138bc75d-0d04-0410-961f-82ee72b054a4
* * boehm.cc: Remove stray semicolon.mmitchel2002-12-281-9/+9
| | | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@60556 138bc75d-0d04-0410-961f-82ee72b054a4
* * Makefile.in: Rebuilt.tromey2002-12-051-1/+1
| | | | | | | | | | | | | * Makefile.am (nat_source_files): Added natVMSecurityManager, natResourceBundle. * java/util/ResourceBundle.java (Security): Removed. (getCallingClassLoader): Now native. * java/util/natResourceBundle.cc: New file. * java/lang/natVMSecurityManager.cc: New file. * java/lang/VMSecurityManager.java (getClassContext): Now native. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59840 138bc75d-0d04-0410-961f-82ee72b054a4
* 2002-12-03 Andrew Haley <aph@redhat.com>aph2002-12-031-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@59769 138bc75d-0d04-0410-961f-82ee72b054a4
* For PR java/8415:tromey2002-11-021-1/+0
| | | | | | | | * java/lang/reflect/natMethod.cc (getType): Use _Jv_FindClass. * prims.cc (_Jv_FindClassFromSignature): Indentation fix. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@58757 138bc75d-0d04-0410-961f-82ee72b054a4
* * Makefile.am (libgcj_la_SOURCES): Remove name-finder.cc.mark2002-08-241-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (core_java_source_files): Add VMThrowable.java and NameFinder.java (nat_source_files): Remove natThrowable.cc, add natVMThrowable.cc and natNameFinder.cc. * Makefile.in: Regenerate. * prims.cc: Use trace_enabled from VMThrowable. * name-finder.cc: Removed. * gcj/javaprims.h: Add class VMThrowable. * gnu/gcj/runtime/NameFinder.java: New file. * gnu/gcj/runtime/natNameFinder.cc: Likewise. * include/name-finder.h: Removed. * java/lang/Throwable.java (printStackTrace (PrintStream)): Use new method stackTraceString(). (printStackTrace (PrintWriter)): Likewise. (stackTraceString): Complete rewrite of old printStackTrace using StringBuffer. (stackTraceStringBuffer): New helper method for stackTraceString(). (fillInStackTrace): Delegate to VMTrowable. (getStackTrace): Likewise. (getStackTrace0): Removed. (trace_enabled, stackTraceBytes): Moved to new VMThrowable.java. (setStackTrace): Copy given array. * java/lang/natThrowable.cc: Removed (replaced by natVMThrowable). * java/lang/VMThrowable.java: New class. * java/lang/natVMThrowable.cc: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56556 138bc75d-0d04-0410-961f-82ee72b054a4
* libjava:bryce2002-03-101-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Hashtable synchronization for PowerPC. * configure.in: Define SLOW_PTHREAD_SELF if configure.host set slow_pthread_self. Set up symlink for sysdeps directory. * configure: Rebuild. * configure.host: Document more shell variables. Set sysdeps_dir for most platforms. Set slow_pthread_self for i686. Set enable_hash_synchronization_default and slow_pthread_self for PowerPC. * posix-threads.cc (_Jv_ThreadSelf_out_of_line): Use release_set so that memory barrier is emitted where required. * prims.cc: 64-bit align static primitive class instances. * include/posix-threads.h (_Jv_ThreadSelf for SLOW_PTHREAD_SELF): Add read_barrier() to enforce ordering of reads. * sysdep/powerpc/locks.h: New file. Implementation of synchronization primitives for PowerPC. * sysdep/i386/locks.h: New file. Synchronization primitives for i386 moved from natObject.cc. * sysdep/alpha/locks.h: Likewise. * sysdep/ia64/locks.h: Likewise. * sysdep/generic/locks.h: Likewise. * java/lang/natObject.cc: Move thread synchronization primitives to system-dependent headers. gcc/java: * decl.c (java_init_decl_processing): Make sure class_type_node alignment is not less than 64 bits if hash synchronization isenabled. boehm-gc: * include/gc_priv.h: Define ALIGN_DOUBLE on 32 bit targets if GCJ support is enabled, for hash synchronization. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@50523 138bc75d-0d04-0410-961f-82ee72b054a4
* * prims.cc (_Jv_CreateJavaVM): Call _Jv_platform_initialize.tromey2002-02-071-18/+2
| | | | | | | | | | | | | | | | | * win32.cc (win32_exception_handler): Now static. * include/win32.h (_Jv_platform_initialize): Declare. (win32_exception_handler): Don't declare. * java/lang/natSystem.cc (currentTimeMillis): Use _Jv_platform_gettimeofday. * posix.cc (_Jv_platform_gettimeofday): Renamed. (_Jv_select): Use new name. (_Jv_platform_initialize): New function. * include/posix.h (_Jv_platform_gettimeofday): Renamed from _Jv_gettimeofday. (_Jv_platform_initialize): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49583 138bc75d-0d04-0410-961f-82ee72b054a4
* 2002-02-06 Adam Megacz <adam@xwt.org>megacz2002-02-071-27/+1
| | | | | | | | | | | | | | * configure.in: Changed mingw) to *mingw*). * win32.cc: Created this file. * win32.h: Created this file. * win32.cc, prims.cc, win32.h (win32_exception_handler): Moved win32_exception_handler from prims.cc to win32.cc, added header in win32.h. * prims.cc: removed some #ifdef-WIN32'd headers which are no longer needed now that we have platform.h git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49566 138bc75d-0d04-0410-961f-82ee72b054a4
* embedded updatesgreen2002-02-071-1/+10
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49562 138bc75d-0d04-0410-961f-82ee72b054a4
* 2002-02-01 Adam Megacz <adam@xwt.org>megacz2002-02-021-0/+1
| | | | | | | * prims.cc: Added #undef STRICT after #include<windows.h>. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49430 138bc75d-0d04-0410-961f-82ee72b054a4
* 2002-02-01 Adam Megacz <adam@xwt.org>megacz2002-02-021-21/+9
| | | | | | | | | | | * prims.cc (_Jv_CreateJavaVM): We now use WIN32 instead of USE_WIN32_SIGNALLING and USE_WINSOCK. (win32_exception_handler): Now throws an exception out of the signal handler; assumes SJLJ git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@49429 138bc75d-0d04-0410-961f-82ee72b054a4
* For PR java/5088:tromey2001-12-161-5/+11
| | | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48081 138bc75d-0d04-0410-961f-82ee72b054a4
* * libjava/prims.cc: Some old cleanups. The collector nowhboehm2001-12-141-26/+48
| | | | | | | | | | | | | | handles test for out of memory. * libjava/prims.cc, libjava/gcj/javaprims.h: (_Jv_AllocObjectNoInitNoFinalizer, _Jv_AllocObjectNoFinalizer): New functions for finalizer-free allocation. (jvmpi_notify_alloc): Became separate function. * libjava/java/lang/Object.h, libjava/include/jvm.h: Adjust for revised vtable layout on IA64. With TARGET_VTABLE_USES_DESCRIPTORS, there is only one extra descriptor. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@48002 138bc75d-0d04-0410-961f-82ee72b054a4
* * prims.cc (_Jv_RunMain): Use `using' to simplify code. Settromey2001-12-131-12/+8
| | | | | | | _Jv_Jar_Class_Path early. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47965 138bc75d-0d04-0410-961f-82ee72b054a4
* For PR libgcj/1147:tromey2001-12-111-4/+12
| | | | | | | | * prims.cc (JvConvertArgv): Convert using current locale's encoding. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@47862 138bc75d-0d04-0410-961f-82ee72b054a4
* * prims.cc (_Jv_Abort): Always print error message using fprintf,bryce2001-10-231-8/+5
| | | | | | | | | | | | don't try to allocate. (_Jv_CreateJavaVM): Set gcj::runTimeInitialized. * include/jvm.h (gcj::runTimeInitialized): New variable declaration. * java/lang/natClassLoader.cc (_Jv_RegisterClassHookDefault): Handle duplicate class registration with JvFail if the runtime hasn't been initialized yet. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46424 138bc75d-0d04-0410-961f-82ee72b054a4
* Eliminate use of C++ static constructors.bryce2001-10-161-15/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46282 138bc75d-0d04-0410-961f-82ee72b054a4
* * gnu/gcj/runtime/natFinalizerThread.cc: New file.tromey2001-10-101-1/+18
| | | | | | | | | | | | | | | | | | | | | | | * java/lang/natRuntime.cc: Include FinalizerThread.h. (runFinalization): Call finalizerReady. * nogc.cc (_Jv_GCInitializeFinalizers): New function. * prims.cc: Include VirtualMachineError.h, FinalizerThread.h. (_Jv_CreateJavaVM): Start the finalizer thread. * no-threads.cc: Include InternalError.h. (_Jv_ThreadStart): Throw InternalError. (_Jv_ThreadInitData): Don't throw error if this is not the first thread. * Makefile.in: Rebuilt. * Makefile.am (ordinary_java_source_files): Added FinalizerThread.java. (nat_source_files): Added natFinalizerThread.cc. * include/jvm.h (_Jv_GCInitializeFinalizers): Declare. * boehm.cc (_Jv_GCInitializeFinalizers): New function. * gnu/gcj/runtime/FirstThread.java (run): Start finalizer thread. * gnu/gcj/runtime/FinalizerThread.java: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46163 138bc75d-0d04-0410-961f-82ee72b054a4
* * prims.cc (_Jv_NewMultiArrayUnchecked): New method.tromey2001-10-021-5/+19
| | | | | | | | | | | | (_Jv_NewMultiArray): Use it. Check each array dimension. (_Jv_NewMultiArray): Likewise. * java/lang/reflect/natMethod.cc (can_widen): Nothing promotes to `char'. * java/lang/reflect/natArray.cc (newInstance): Throw IllegalArgumentException if there are no dimensions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45951 138bc75d-0d04-0410-961f-82ee72b054a4
* * java/lang/ClassLoader.java (system): Remove static field.bothner2001-09-011-1/+2
| | | | | | | | | | | | | (getSystemClassLoader): Get gnu.gcj.runtime.VMClassLoader.instance directly instead of using it to set the system field. (loadClass): Use VMClassLoader.instance instead of system field. (findSystemClass): Similar. * prims.cc (_Jv_RunMain): Clear VMClassLoader::instance rather than ClassLoader::system which no longer exists. * java/lang/natClassLoader.java (_Jv_FindClass): Simplify. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45343 138bc75d-0d04-0410-961f-82ee72b054a4
* * Makefile.am: New friends for java/lang/Thread.h.bryce2001-08-261-140/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * prims.cc (runFirst): Removed. (JvRunMain): Merged into _Jv_RunMain. Now just calls that. (_Jv_RunMain): Now takes either a klass or class name parameter. Create a gnu.gcj.runtime.FirstThread and attach the native thread to that, then run it using _Jv_ThreadRun. Remove special handling of jar files, instead pass is_jar parameter through to FirstThread. * gcj/javaprims.h: Add prototypes for _Jv_ThreadRun and new variant of _Jv_AttachCurrentThread. * gnu/gcj/runtime/FirstThread.java (FirstThread): Now extends Thread. (run): New method. Take care of looking up main class manifest attribute and calling forName if neccessary. Then call call_main. (call_main): New native method. * gnu/gcj/runtime/natFirstThread.cc (call_main): New function, code relocated from prims.cc. Look up and call main method. * java/lang/Thread.java (run_): Removed. * java/lang/natThread.cc (run_): Renamed to... (_Jv_ThreadRun): this. JVMPI notification code moved to ... (_Jv_NotifyThreadStart): here. New function. (countStackFrames, destroy, resume, suspend, stop): Throw UnsupportedOperationExceptions rather than JvFail'ing. (_Jv_AttachCurrentThread): New variant takes a Thread argument. Existing version wraps new variant. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@45182 138bc75d-0d04-0410-961f-82ee72b054a4
* * prims.cc (JNI_OnLoad): Don't declare.tromey2001-08-031-35/+0
| | | | | | | | (_JNI_OnLoad): Don't define. (_Jv_CreateJavaVM): Don't handle JNI_OnLoad. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44590 138bc75d-0d04-0410-961f-82ee72b054a4
* * prims.cc (_JNI_OnLoad): New function.ro2001-07-241-4/+11
| | | | | | | | (JNI_OnLoad): Use it. (_Jv_CreateJavaVM): Check for _JNI_OnLoad, not NULL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@44316 138bc75d-0d04-0410-961f-82ee72b054a4
* * java/lang/natRuntime.cc (_Jv_FindSymbolInExecutable): Returntromey2001-06-151-2/+10
| | | | | | | | | | | NULL if no library on the list has the symbol. (init): Call add_library on the program itself. * prims.cc (JvRunMain): Initialize Runtime before searching for `main'. (_Jv_RunMain): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@43413 138bc75d-0d04-0410-961f-82ee72b054a4
* Check for sigaction.green2001-06-021-2/+4
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42790 138bc75d-0d04-0410-961f-82ee72b054a4
* 2001-05-23 Tom Tromey <tromey@redhat.com>tromey2001-05-241-19/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42519 138bc75d-0d04-0410-961f-82ee72b054a4
* Implement invocation interface; don't create new thread for main.bothner2001-05-221-66/+174
| | | | git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@42428 138bc75d-0d04-0410-961f-82ee72b054a4
* * prims.cc (_Jv_ThisExecutable): Use _Jv_Malloc.zack2001-04-281-1/+1
| | | | | | | | * posix-threads.cc (_Jv_ThreadInitData): Use _Jv_Malloc. (_Jv_ThreadDestroyData): Use _Jv_Free. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41650 138bc75d-0d04-0410-961f-82ee72b054a4
* * exception.cc (java_eh_info): Make value type jthrowable.rth2001-03-261-17/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (_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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40838 138bc75d-0d04-0410-961f-82ee72b054a4
* 2000-03-23 Jeff Sturm <jsturm@one-point.com>tromey2001-03-231-3/+7
| | | | | | | | | * prims.cc (_Jv_FindClassFromSignature): Check return of recursive call. Do not abort on invalid signature; return NULL instead. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40787 138bc75d-0d04-0410-961f-82ee72b054a4
* 2001-03-12 Bryce McKinlay <bryce@albatross.co.nz>bryce2001-03-121-1/+1
| | | | | | | | | | | | | | | | | | | * java/lang/Runtime.java (_exit): Declare new package-private native. * java/lang/natRuntime.cc (_exit): Implemented. Same as exit() but without a security manager check. (exit): Call _exit after security check. * prims.cc (JvRunMain): Call Runtime._exit to shutdown the runtime "naturally". * java/lang/System.java (setSecurityManager): If a security manager is already in place, call checkPermission. * java/lang/ThreadGroup.java (uncaughtException): If printStackTrace() throws an exception, try to deal with it gracefully. * java/lang/ExceptionInInitializerError.java (printStackTrace): Only try to print the subordinate stack trace if "exception" is set. Print our class name first. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@40401 138bc75d-0d04-0410-961f-82ee72b054a4
* 2001-01-16 Alexandre Petit-Bianco <apbianco@cygnus.com>apbianco2001-01-171-13/+3
| | | | | | | | | | | | | | | | * 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) git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39088 138bc75d-0d04-0410-961f-82ee72b054a4
* 2001-01-07 Alexandre Petit-Bianco <apbianco@cygnus.com>apbianco2001-01-151-51/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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) git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@39032 138bc75d-0d04-0410-961f-82ee72b054a4
* In gcc/java:bryce2001-01-081-16/+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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38808 138bc75d-0d04-0410-961f-82ee72b054a4
* * java/lang/Throwable.java (trace_enabled): New static field.bryce2000-12-221-0/+6
| | | | | | | | | | * java/lang/natThrowable.cc (fillInStackTrace): Do nothing if trace_enabled not set. * prims.cc (main_init): Turn off trace_enabled while creating default exception objects. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@38442 138bc75d-0d04-0410-961f-82ee72b054a4
* * prims.cc (_Jv_NewObjectArray): Use const_cast to initializetromey2000-11-271-3/+7
| | | | | | | | | | length field of array. (_Jv_NewPrimArray): Likewise. * gcj/array.h (__JArray): `length' field now const. Added constructor. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37771 138bc75d-0d04-0410-961f-82ee72b054a4
* 2000-11-25 Anthony Green <green@redhat.com>green2000-11-261-8/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37751 138bc75d-0d04-0410-961f-82ee72b054a4
* * prims.cc (_Jv_NewObjectArray): Use palcement new to createtromey2000-11-241-3/+8
| | | | | | | | | | | | array. (_Jv_NewPrimArray): Likewise. Include <new>. * gcj/array.h (__JArray): `length' field now const. Added constructor. (class JArray): Added constructor. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37718 138bc75d-0d04-0410-961f-82ee72b054a4