1999-04-07 16:42:40 +02:00
|
|
|
|
// boehm.cc - interface between libjava and Boehm GC.
|
|
|
|
|
|
2003-07-23 11:53:53 +02:00
|
|
|
|
/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
|
|
This file is part of libgcj.
|
|
|
|
|
|
|
|
|
|
This software is copyrighted work licensed under the terms of the
|
|
|
|
|
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
|
|
|
|
details. */
|
|
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2003-07-23 11:53:53 +02:00
|
|
|
|
#include <limits.h>
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
|
|
#include <jvm.h>
|
1999-09-11 00:03:10 +02:00
|
|
|
|
#include <gcj/cni.h>
|
|
|
|
|
|
|
|
|
|
#include <java/lang/Class.h>
|
2000-05-05 06:46:26 +02:00
|
|
|
|
#include <java/lang/reflect/Modifier.h>
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
#include <java-interp.h>
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
1999-08-24 06:01:06 +02:00
|
|
|
|
// More nastiness: the GC wants to define TRUE and FALSE. We don't
|
|
|
|
|
// need the Java definitions (themselves a hack), so we undefine them.
|
|
|
|
|
#undef TRUE
|
|
|
|
|
#undef FALSE
|
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
|
extern "C"
|
|
|
|
|
{
|
2001-05-21 10:37:04 +02:00
|
|
|
|
#include <private/gc_pmark.h>
|
|
|
|
|
#include <gc_gcj.h>
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
2001-08-18 03:01:51 +02:00
|
|
|
|
#ifdef THREAD_LOCAL_ALLOC
|
|
|
|
|
# define GC_REDIRECT_TO_LOCAL
|
|
|
|
|
# include <gc_local_alloc.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
|
// These aren't declared in any Boehm GC header.
|
|
|
|
|
void GC_finalize_all (void);
|
|
|
|
|
ptr_t GC_debug_generic_malloc (size_t size, int k, GC_EXTRA_PARAMS);
|
2003-01-03 17:34:37 +01:00
|
|
|
|
};
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
|
|
#define MAYBE_MARK(Obj, Top, Limit, Source, Exit) \
|
2001-08-18 03:01:51 +02:00
|
|
|
|
Top=GC_MARK_AND_PUSH((GC_PTR)Obj, Top, Limit, (GC_PTR *)Source)
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
2000-09-30 11:56:58 +02:00
|
|
|
|
// `kind' index used when allocating Java arrays.
|
|
|
|
|
static int array_kind_x;
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
|
|
// Freelist used for Java arrays.
|
|
|
|
|
static ptr_t *array_free_list;
|
|
|
|
|
|
2000-04-02 17:34:17 +02:00
|
|
|
|
// Lock used to protect access to Boehm's GC_enable/GC_disable functions.
|
|
|
|
|
static _Jv_Mutex_t disable_gc_mutex;
|
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// This is called by the GC during the mark phase. It marks a Java
|
|
|
|
|
// object. We use `void *' arguments and return, and not what the
|
|
|
|
|
// Boehm GC wants, to avoid pollution in our headers.
|
|
|
|
|
void *
|
2000-09-30 11:56:58 +02:00
|
|
|
|
_Jv_MarkObj (void *addr, void *msp, void *msl, void * /* env */)
|
1999-04-07 16:42:40 +02:00
|
|
|
|
{
|
|
|
|
|
mse *mark_stack_ptr = (mse *) msp;
|
|
|
|
|
mse *mark_stack_limit = (mse *) msl;
|
|
|
|
|
jobject obj = (jobject) addr;
|
|
|
|
|
|
2000-09-30 11:56:58 +02:00
|
|
|
|
// FIXME: if env is 1, this object was allocated through the debug
|
|
|
|
|
// interface, and addr points to the beginning of the debug header.
|
|
|
|
|
// In that case, we should really add the size of the header to addr.
|
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
|
_Jv_VTable *dt = *(_Jv_VTable **) addr;
|
2000-09-30 11:56:58 +02:00
|
|
|
|
// The object might not yet have its vtable set, or it might
|
|
|
|
|
// really be an object on the freelist. In either case, the vtable slot
|
|
|
|
|
// will either be 0, or it will point to a cleared object.
|
|
|
|
|
// This assumes Java objects have size at least 3 words,
|
|
|
|
|
// including the header. But this should remain true, since this
|
|
|
|
|
// should only be used with debugging allocation or with large objects.
|
|
|
|
|
if (__builtin_expect (! dt || !(dt -> get_finalizer()), false))
|
1999-04-07 16:42:40 +02:00
|
|
|
|
return mark_stack_ptr;
|
|
|
|
|
jclass klass = dt->clas;
|
2001-05-24 07:40:37 +02:00
|
|
|
|
ptr_t p;
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
2001-05-24 07:40:37 +02:00
|
|
|
|
# ifndef JV_HASH_SYNCHRONIZATION
|
|
|
|
|
// Every object has a sync_info pointer.
|
|
|
|
|
p = (ptr_t) obj->sync_info;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, obj, o1label);
|
|
|
|
|
# endif
|
1999-04-07 16:42:40 +02:00
|
|
|
|
// Mark the object's class.
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) klass;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, obj, o2label);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
natField.cc (BooleanClass): Don't define.
* java/lang/reflect/natField.cc (BooleanClass): Don't define.
* java/lang/reflect/natArray.cc (BooleanClass): Don't define.
* java/lang/Class.h (Object): Added `class$' field.
* java/lang/Object.h (Object): Added `class$' field.
* defineclass.cc (ClassClass): Use `class$' form.
(ClassObject): Likewise.
* resolve.cc (ClassObject): Use `class$' form.
(ObjectClass): Likewise.
* interpret.cc (ClassError): Removed.
* java/net/natPlainDatagramSocketImpl.cc (BooleanClass): Use
`class$' form.
(IntegerClass): Likewise.
* java/net/natPlainSocketImpl.cc (BooleanClass): Use `class$'
form.
* java/lang/natClassLoader.cc (CloneableClass): Use `class$' form.
(ObjectClass, ClassClass, VMClassLoaderClass, ClassLoaderClass,
SerializableClass): Likewise.
Include Serializable.h, Cloneable.h.
* java/lang/natSystem.cc (SystemClass): Removed.
(init_properties): Use `class$' form.
* java/lang/natObject.cc (CloneableClass): Removed.
(clone): Use `class$' form.
* java/lang/natClass.cc (CloneableClass): Use `class$' form.
(ObjectClass, ErrorClass, ClassClass, MethodClass, FieldClass,
ConstructorClass): Likewise.
* java/lang/reflect/natMethod.cc (ObjectClass): Use `class$' form.
(ClassClass, VoidClass, ByteClass, ShortClass, CharacterClass,
IntegerClass, LongClass, FloatClass, DoubleClass): Likewise.
* java/io/natObjectInputStream.cc (ObjectClass): Use `class$'
form.
(ClassClass): Likewise.
* include/jvm.h (StringClass): Use `class$' form.
* prims.cc (ObjectClass): Removed.
(_Jv_RunMain): Use `class$' form.
(_Jv_AllocObject): Likewise.
* jni.cc (ClassClass): Use `class$' form.
(ThrowableClass): Likewise.
(ObjectClass): Likewise.
(MethodClass): Likewise.
(ThreadGroupClass): Likewise.
(NativeThreadClass): Likewise.
* boehm.cc (ObjectClass): Removed.
(ClassClass): Removed.
(_Jv_MarkObj): Use `class$' form.
* gcj/field.h (JvFieldIsRef): Use `class$' form.
Include RawData.h.
From-SVN: r36740
2000-10-06 03:49:32 +02:00
|
|
|
|
if (__builtin_expect (klass == &java::lang::Class::class$, false))
|
1999-04-07 16:42:40 +02:00
|
|
|
|
{
|
2000-09-30 11:56:58 +02:00
|
|
|
|
// Currently we allocate some of the memory referenced from class objects
|
|
|
|
|
// as pointerfree memory, and then mark it more intelligently here.
|
|
|
|
|
// We ensure that the ClassClass mark descriptor forces invocation of
|
|
|
|
|
// this procedure.
|
|
|
|
|
// Correctness of this is subtle, but it looks OK to me for now. For the incremental
|
|
|
|
|
// collector, we need to make sure that the class object is written whenever
|
|
|
|
|
// any of the subobjects are altered and may need rescanning. This may be tricky
|
|
|
|
|
// during construction, and this may not be the right way to do this with
|
|
|
|
|
// incremental collection.
|
|
|
|
|
// If we overflow the mark stack, we will rescan the class object, so we should
|
|
|
|
|
// be OK. The same applies if we redo the mark phase because win32 unmapped part
|
|
|
|
|
// of our root set. - HB
|
1999-04-07 16:42:40 +02:00
|
|
|
|
jclass c = (jclass) addr;
|
|
|
|
|
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) c->name;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c3label);
|
|
|
|
|
p = (ptr_t) c->superclass;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c4label);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
for (int i = 0; i < c->constants.size; ++i)
|
|
|
|
|
{
|
[multiple changes]
Mon Aug 9 18:33:38 1999 Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
* Makefile: Rebuilt.
* Makefile.am (toolexeclibdir): Add $(MULTISUBDIR) even for native
builds.
* java/net/natPlainSocketImpl.cc: Include <sys/select.h> only if
present.
* configure: Rebuilt.
* configure.in: Properly align --help output, fix capitalization
and punctuation.
* acinclude.m4: Likewise.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* include/javaprims.h (_Jv_word, _Jv_word2): New types.
* include/java-interp.h (_Jv_InterpMethodInvocation): Use _Jv_word.
(_Jv_callInterpretedMethod): Unused. Remove.
(_Jv_InterpMethod::run,run_normal,run_synch_object,run_synch_class):
Use ffi_raw.
* include/java-cpool.h (_Jv_get, _Jv_put): Remove.
(_Jv_{store,load}{Indexes,Int,Float,Long,Double}): Use _Jv_word.
* boehm.cc (_Jv_MarkObj): Use _Jv_word.
* interpret.cc: use _Jv_word.
* defineclass.cc: use_Jv_word.
* resolve.cc: Use _Jv_word.
(_Jv_ResolvePoolEntry): Return _Jv_word.
* java/lang/Class.h (_Jv_Constants): Use _Jv_word for cpool.
* java/lang/natClassLoader.cc (_Jv_InternClassStrings): Use _Jv_word.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Change comment.
From-SVN: r28641
1999-08-10 07:32:23 +02:00
|
|
|
|
/* FIXME: We could make this more precise by using the tags -KKT */
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) c->constants.data[i].p;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c5label);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
#ifdef INTERPRETER
|
|
|
|
|
if (_Jv_IsInterpretedClass (c))
|
|
|
|
|
{
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) c->constants.tags;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c5alabel);
|
|
|
|
|
p = (ptr_t) c->constants.data;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c5blabel);
|
2000-09-30 11:56:58 +02:00
|
|
|
|
p = (ptr_t) c->vtable;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c5clabel);
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
|
// If the class is an array, then the methods field holds a
|
|
|
|
|
// pointer to the element class. If the class is primitive,
|
|
|
|
|
// then the methods field holds a pointer to the array class.
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) c->methods;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c6label);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
2002-09-25 22:14:37 +02:00
|
|
|
|
// The vtable might have been set, but the rest of the class
|
|
|
|
|
// could still be uninitialized. If this is the case, then
|
|
|
|
|
// c.isArray will SEGV. We check for this, and if it is the
|
|
|
|
|
// case we just return.
|
|
|
|
|
if (__builtin_expect (c->name == NULL, false))
|
|
|
|
|
return mark_stack_ptr;
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
|
if (! c->isArray() && ! c->isPrimitive())
|
|
|
|
|
{
|
|
|
|
|
// Scan each method in the cases where `methods' really
|
|
|
|
|
// points to a methods structure.
|
|
|
|
|
for (int i = 0; i < c->method_count; ++i)
|
|
|
|
|
{
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) c->methods[i].name;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c,
|
1999-04-07 16:42:40 +02:00
|
|
|
|
cm1label);
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) c->methods[i].signature;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c,
|
1999-04-07 16:42:40 +02:00
|
|
|
|
cm2label);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Mark all the fields.
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) c->fields;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c8label);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
for (int i = 0; i < c->field_count; ++i)
|
|
|
|
|
{
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
_Jv_Field* field = &c->fields[i];
|
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
|
#ifndef COMPACT_FIELDS
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) field->name;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c8alabel);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
#endif
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) field->type;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c8blabel);
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
|
|
|
|
|
// For the interpreter, we also need to mark the memory
|
|
|
|
|
// containing static members
|
2000-05-05 06:46:26 +02:00
|
|
|
|
if ((field->flags & java::lang::reflect::Modifier::STATIC))
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
{
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) field->u.addr;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c8clabel);
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
|
|
|
|
|
// also, if the static member is a reference,
|
|
|
|
|
// mark also the value pointed to. We check for isResolved
|
|
|
|
|
// since marking can happen before memory is allocated for
|
|
|
|
|
// static members.
|
|
|
|
|
if (JvFieldIsRef (field) && field->isResolved())
|
|
|
|
|
{
|
|
|
|
|
jobject val = *(jobject*) field->u.addr;
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) val;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit,
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
c, c8elabel);
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-04-07 16:42:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) c->vtable;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, c9label);
|
|
|
|
|
p = (ptr_t) c->interfaces;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cAlabel);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
for (int i = 0; i < c->interface_count; ++i)
|
|
|
|
|
{
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) c->interfaces[i];
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cClabel);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
}
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) c->loader;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cBlabel);
|
2001-01-09 00:28:56 +01:00
|
|
|
|
p = (ptr_t) c->arrayclass;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cDlabel);
|
2003-01-03 17:34:37 +01:00
|
|
|
|
p = (ptr_t) c->protectionDomain;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cPlabel);
|
2003-10-09 18:24:55 +02:00
|
|
|
|
p = (ptr_t) c->signers;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c, cSlabel);
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
|
|
|
|
|
#ifdef INTERPRETER
|
|
|
|
|
if (_Jv_IsInterpretedClass (c))
|
|
|
|
|
{
|
2002-12-07 00:41:38 +01:00
|
|
|
|
_Jv_InterpClass* ic = (_Jv_InterpClass*) c;
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) ic->interpreted_methods;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic, cElabel);
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
|
|
|
|
|
for (int i = 0; i < c->method_count; i++)
|
|
|
|
|
{
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) ic->interpreted_methods[i];
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic, \
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
cFlabel);
|
2002-12-07 00:41:38 +01:00
|
|
|
|
|
|
|
|
|
// Mark the direct-threaded code.
|
|
|
|
|
if ((c->methods[i].accflags
|
|
|
|
|
& java::lang::reflect::Modifier::NATIVE) == 0)
|
|
|
|
|
{
|
|
|
|
|
_Jv_InterpMethod *im
|
|
|
|
|
= (_Jv_InterpMethod *) ic->interpreted_methods[i];
|
|
|
|
|
if (im)
|
|
|
|
|
{
|
|
|
|
|
p = (ptr_t) im->prepared;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic, \
|
|
|
|
|
cFlabel);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// The interpreter installs a heap-allocated trampoline
|
|
|
|
|
// here, so we'll mark it.
|
|
|
|
|
p = (ptr_t) c->methods[i].ncode;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, c,
|
|
|
|
|
cm3label);
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) ic->field_initializers;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, ic, cGlabel);
|
[multiple changes]
1999-08-09 Anthony Green <green@cygnus.com>
* gij.cc: New file.
* include/config.h.in: Rebuilt.
* acconfig.h: Add INTERPRETER.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
* Makefile.am (libffi_files): Identify the libffi object files for
inclusion in libgcj.
(LIBFFIINCS): Define.
* interpret.cc (gnu::gcj::runtime::MethodInvocation::continue1):
Dummy definition for configurations without an interpreter.
* java/net/natPlainSocketImpl.cc (getOption): Disamiguate call to
java::lang::Boolean constructor.
* include/java-interp.h: Always include java-cpool.h.
* java/lang/natClassLoader.cc (getVMClassLoader0): Always return 0
when INTERPRETER not defined.
* java/lang/Class.h (finalize): Define.
* gnu/gcj/util/path/DirectoryPathEntry.java (getURL): Catch
IOException from File.getCanonicalPath.
(getStream): Likewise.
* NEWS: More news.
* THANKS: More thanks.
1999-08-09 Kresten Krab Thorup <krab@gnu.org>
* resolve.cc (get_ffi_type_from_signature): Generate uint16 for
jchar type.
(_Jv_PrepareClass): Allow non-abstract classes to
have abstract subclasses.
(_Jv_ResolvePoolEntry): Revert subclass check for protected
fields and methods.
* interpret.cc (continue1/perform_invoke): Don't sign extend
uint16 return val.
(continue1/lshl,lshr): Push long, not int.
(continue1/ulshr): Use UINT64, not long long.
* defineclass.cc (handleFieldsEnd): Handle case when all fields
are static.
* java/lang/natClass.cc (forName): Add call to _Jv_InitClass.
* java/lang/FirstThread.java (run): Add top-level exception
handler.
(run0): Renamed from run.
1999-08-08 Kresten Krab Thorup <krab@gnu.org>
* configure.in (--with-interpreter): Added.
* include/config.h.in (INTERPRETER): Added.
* java/lang/ClassLoader.java: File replaced.
* java/lang/VMClassLoader.java: New file.
* java/lang/natClassLoader.cc: New file.
* gnu/gcj/runtime/MethodInvocation.java: New file.
* gnu/gcj/util/path/SearchPath.java: New file.
* gnu/gcj/util/path/PathEntry.java: New file.
* gnu/gcj/util/path/DirectoryPathEntry.java: New file.
* gnu/gcj/util/path/ZipPathEntry.java: New file.
* gnu/gcj/util/path/URLPathEntry.java: New file.
* gnu/gcj/util/path/CacheEntry.java: New file.
* include/java-interp.h: New file.
* include/java-cpool.h: New file.
* include/java-insns.h: New file.
* defineclass.cc: New file.
* interpret.cc: New file.
* resolve.cc: New file.
* java/lang/natClass.cc (loaded_classes, _Jv_RegisterClass,
_Jv_RegisterClasses, _Jv_FindClassInCache, _Jv_FindClass,
_Jv_NewClass, _Jv_FindArrayClass): Moved to natClassLoader.cc.
(finalize): New.
(STATE_NOTHING, STATE_RESOLVED, STATE_IN_PROGRESS, STATE_DONE,
STATE_ERROR): Moved to java/lang/Class.h and renamed with JV_
prefix.
(initializeClass): Use new JV_ prefixed names. Also, call
ClassLoader::resolveClass instead of _Jv_ResolveClass.
* java/lang/Class.h (JV_STATE_PRELOADING, JV_STATE_LOADING,
JV_STATE_LOADED, JV_STATE_COMPILED, JV_STATE_PREPARED,
JV_STATE_LINKED): New.
(_Jv_WaitForState, _Jv_RegisterInitiatingLoader,
_Jv_UnregisterClass, _Jv_InternClassStrings): New friends.
(_Jv_IsInterpretedClass, _Jv_InitField, _Jv_LookupDeclaredMethod,
_Jv_DetermineVTableIndex, _Jv_ResolvePoolEntry, _Jv_PrepareClass,
_Jv_ClassReader, _Jv_InterpClass, _Jv_InterpMethod,
_Jv_InterpMethodInvocation): New friends for interpreter.
(finalize): New.
(CONSTANT_Class, CONSTANT_String, etc.): Moved to
include/java-cpool.h and renamed with JV_ prefix.
* include/jvm.h (_Jv_makeUtf8Const, _Jv_makeUtf8TypeConst): New
decls.
(_Jv_UnregisterClass): New decl.
* java/lang/natClassLoader.cc (_Jv_FindArrayClass): Added
class loader argument.
(_Jv_FindClass): Use class loader.
* prims.cc (_Jv_makeUtf8Const): New function.
(_Jv_NewObjectArray): Change use of _Jv_FindArrayClass.
(_Jv_NewPrimArray): Ditto.
(_Jv_FindClassFromSignature): Ditto.
* java/lang/reflect/natArray.cc (newInstance): Ditto.
* java/lang/reflect/natMethod.cc (getType): Ditto.
* include/java-field.h (_Jv_Field::isRef): Make robust for
non-resolved contexts.
* boehm.cc (_Jv_MarkObj): Mark interpreter-related fields.
Also, don't mark class->next field.
* java/lang/VirtualMachineError.java: Added FIXME note.
* configure.in (INTERPSPEC): New spec.
* libgcj.spec.in: Added INTERPSPEC.
* Makefile.am: Added gcjh friends for java/lang/VMClassLoader and
gnu/gcj/runtime/MethodInvocation.
(libgcj_la_SOURCES): Added resolve.cc defineclass.cc interpret.cc.
(ordinary_java_source_files): Added above mentioned java classes.
* configure: Rebuilt.
* Makefile.in: Rebuilt.
From-SVN: r28597
1999-08-08 16:06:23 +02:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
// NOTE: each class only holds information about the class
|
|
|
|
|
// itself. So we must do the marking for the entire inheritance
|
|
|
|
|
// tree in order to mark all fields. FIXME: what about
|
|
|
|
|
// interfaces? We skip Object here, because Object only has a
|
|
|
|
|
// sync_info, and we handled that earlier.
|
|
|
|
|
// Note: occasionally `klass' can be null. For instance, this
|
|
|
|
|
// can happen if a GC occurs between the point where an object
|
|
|
|
|
// is allocated and where the vtbl slot is set.
|
natField.cc (BooleanClass): Don't define.
* java/lang/reflect/natField.cc (BooleanClass): Don't define.
* java/lang/reflect/natArray.cc (BooleanClass): Don't define.
* java/lang/Class.h (Object): Added `class$' field.
* java/lang/Object.h (Object): Added `class$' field.
* defineclass.cc (ClassClass): Use `class$' form.
(ClassObject): Likewise.
* resolve.cc (ClassObject): Use `class$' form.
(ObjectClass): Likewise.
* interpret.cc (ClassError): Removed.
* java/net/natPlainDatagramSocketImpl.cc (BooleanClass): Use
`class$' form.
(IntegerClass): Likewise.
* java/net/natPlainSocketImpl.cc (BooleanClass): Use `class$'
form.
* java/lang/natClassLoader.cc (CloneableClass): Use `class$' form.
(ObjectClass, ClassClass, VMClassLoaderClass, ClassLoaderClass,
SerializableClass): Likewise.
Include Serializable.h, Cloneable.h.
* java/lang/natSystem.cc (SystemClass): Removed.
(init_properties): Use `class$' form.
* java/lang/natObject.cc (CloneableClass): Removed.
(clone): Use `class$' form.
* java/lang/natClass.cc (CloneableClass): Use `class$' form.
(ObjectClass, ErrorClass, ClassClass, MethodClass, FieldClass,
ConstructorClass): Likewise.
* java/lang/reflect/natMethod.cc (ObjectClass): Use `class$' form.
(ClassClass, VoidClass, ByteClass, ShortClass, CharacterClass,
IntegerClass, LongClass, FloatClass, DoubleClass): Likewise.
* java/io/natObjectInputStream.cc (ObjectClass): Use `class$'
form.
(ClassClass): Likewise.
* include/jvm.h (StringClass): Use `class$' form.
* prims.cc (ObjectClass): Removed.
(_Jv_RunMain): Use `class$' form.
(_Jv_AllocObject): Likewise.
* jni.cc (ClassClass): Use `class$' form.
(ThrowableClass): Likewise.
(ObjectClass): Likewise.
(MethodClass): Likewise.
(ThreadGroupClass): Likewise.
(NativeThreadClass): Likewise.
* boehm.cc (ObjectClass): Removed.
(ClassClass): Removed.
(_Jv_MarkObj): Use `class$' form.
* gcj/field.h (JvFieldIsRef): Use `class$' form.
Include RawData.h.
From-SVN: r36740
2000-10-06 03:49:32 +02:00
|
|
|
|
while (klass && klass != &java::lang::Object::class$)
|
1999-04-07 16:42:40 +02:00
|
|
|
|
{
|
|
|
|
|
jfieldID field = JvGetFirstInstanceField (klass);
|
|
|
|
|
jint max = JvNumInstanceFields (klass);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < max; ++i)
|
|
|
|
|
{
|
|
|
|
|
if (JvFieldIsRef (field))
|
|
|
|
|
{
|
|
|
|
|
jobject val = JvGetObjectField (obj, field);
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) val;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit,
|
1999-04-07 16:42:40 +02:00
|
|
|
|
obj, elabel);
|
|
|
|
|
}
|
natConstructor.cc (newInstance): Use _Jv_CallAnyMethodA.
* java/lang/reflect/natConstructor.cc (newInstance): Use
_Jv_CallAnyMethodA.
* include/jvm.h: Declare _Jv_CallAnyMethodA.
* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Renamed
from _Jv_CallNonvirtualMethodA. Changed interface; overloaded.
Include <jni.h>.
(COPY): Removed.
(invoke): Use _Jv_CallAnyMethodA.
(VAL): Redefined.
* java/lang/Class.h (Class): Declare JvGetFirstStaticField,
JvNumStaticFields, JvNumMethods, and JvGetFirstMethod as friend
functions.
(struct _Jv_Method): Added getNextMethod method.
(JvNumMethods): New function.
(JvGetFirstMethod): Likewise.
* gcj/field.h (JvGetFirstStaticField): New function.
(JvNumStaticFields): Likewise.
(getNextField): Renamed from getNextInstanceField.
(struct _Jv_Field): New method getClass.
* jni.cc: Wrote many new functions.
* include/jni.h (JNI_TRUE): Define.
(JNI_FALSE): Likewise.
(jobject, jclass, jstring, jarray, jthrowable, jobjectArray,
jbyteArray, jshortArray, jintArray, jlongArray, jbooleanArray,
jcharArray, jfloatArray, jdoubleArray): New typedefs.
(jfieldID, jmethodID): Likewise.
(JNI_COMMIT, JNI_ABORT): New defines.
(JNINativeMethod): New struct.
(struct JNINativeInterface): Correctly declared more entries.
(class _Jv_JNIEnv): Added `ex' member.
(JNI_VERSION_1_1): New define.
(JNI_VERSION_1_2): Likewise.
* boehm.cc (_Jv_MarkObj): Use getNextField, not
getNextInstanceField.
From-SVN: r31553
2000-01-22 00:50:31 +01:00
|
|
|
|
field = field->getNextField ();
|
1999-04-07 16:42:40 +02:00
|
|
|
|
}
|
|
|
|
|
klass = klass->getSuperclass();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return mark_stack_ptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This is called by the GC during the mark phase. It marks a Java
|
|
|
|
|
// array (of objects). We use `void *' arguments and return, and not
|
|
|
|
|
// what the Boehm GC wants, to avoid pollution in our headers.
|
|
|
|
|
void *
|
|
|
|
|
_Jv_MarkArray (void *addr, void *msp, void *msl, void * /*env*/)
|
|
|
|
|
{
|
|
|
|
|
mse *mark_stack_ptr = (mse *) msp;
|
|
|
|
|
mse *mark_stack_limit = (mse *) msl;
|
|
|
|
|
jobjectArray array = (jobjectArray) addr;
|
|
|
|
|
|
|
|
|
|
_Jv_VTable *dt = *(_Jv_VTable **) addr;
|
2000-09-30 11:56:58 +02:00
|
|
|
|
// Assumes size >= 3 words. That's currently true since arrays have
|
|
|
|
|
// a vtable, sync pointer, and size. If the sync pointer goes away,
|
|
|
|
|
// we may need to round up the size.
|
|
|
|
|
if (__builtin_expect (! dt || !(dt -> get_finalizer()), false))
|
1999-04-07 16:42:40 +02:00
|
|
|
|
return mark_stack_ptr;
|
|
|
|
|
jclass klass = dt->clas;
|
2001-05-24 07:40:37 +02:00
|
|
|
|
ptr_t p;
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
2001-05-24 07:40:37 +02:00
|
|
|
|
# ifndef JV_HASH_SYNCHRONIZATION
|
|
|
|
|
// Every object has a sync_info pointer.
|
|
|
|
|
p = (ptr_t) array->sync_info;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, array, e1label);
|
|
|
|
|
# endif
|
1999-04-07 16:42:40 +02:00
|
|
|
|
// Mark the object's class.
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) klass;
|
2001-08-18 03:01:51 +02:00
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, &(dt -> clas), o2label);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
|
|
|
|
|
for (int i = 0; i < JvGetArrayLength (array); ++i)
|
|
|
|
|
{
|
|
|
|
|
jobject obj = elements (array)[i];
|
2000-04-19 12:10:39 +02:00
|
|
|
|
p = (ptr_t) obj;
|
|
|
|
|
MAYBE_MARK (p, mark_stack_ptr, mark_stack_limit, array, e2label);
|
1999-04-07 16:42:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return mark_stack_ptr;
|
|
|
|
|
}
|
|
|
|
|
|
2001-12-19 03:45:20 +01:00
|
|
|
|
// Generate a GC marking descriptor for a class.
|
|
|
|
|
//
|
2000-09-30 11:56:58 +02:00
|
|
|
|
// We assume that the gcj mark proc has index 0. This is a dubious assumption,
|
|
|
|
|
// since another one could be registered first. But the compiler also
|
|
|
|
|
// knows this, so in that case everything else will break, too.
|
2001-05-21 10:37:04 +02:00
|
|
|
|
#define GCJ_DEFAULT_DESCR GC_MAKE_PROC(GC_GCJ_RESERVED_MARK_PROC_INDEX,0)
|
2003-07-23 11:53:53 +02:00
|
|
|
|
|
2000-09-30 11:56:58 +02:00
|
|
|
|
void *
|
2003-07-23 11:53:53 +02:00
|
|
|
|
_Jv_BuildGCDescr(jclass self)
|
2000-09-30 11:56:58 +02:00
|
|
|
|
{
|
2003-07-23 11:53:53 +02:00
|
|
|
|
jlong desc = 0;
|
2003-09-29 09:13:40 +02:00
|
|
|
|
jint bits_per_word = CHAR_BIT * sizeof (void *);
|
2003-07-23 11:53:53 +02:00
|
|
|
|
|
|
|
|
|
// Note: for now we only consider a bitmap mark descriptor. We
|
|
|
|
|
// could also handle the case where the first N fields of a type are
|
|
|
|
|
// references. However, this is not very likely to be used by many
|
|
|
|
|
// classes, and it is easier to compute things this way.
|
|
|
|
|
|
2003-09-29 09:13:40 +02:00
|
|
|
|
// The vtable pointer.
|
|
|
|
|
desc |= 1ULL << (bits_per_word - 1);
|
|
|
|
|
#ifndef JV_HASH_SYNCHRONIZATION
|
|
|
|
|
// The sync_info field.
|
|
|
|
|
desc |= 1ULL << (bits_per_word - 2);
|
|
|
|
|
#endif
|
|
|
|
|
|
2003-07-23 11:53:53 +02:00
|
|
|
|
for (jclass klass = self; klass != NULL; klass = klass->getSuperclass())
|
|
|
|
|
{
|
|
|
|
|
jfieldID field = JvGetFirstInstanceField(klass);
|
|
|
|
|
int count = JvNumInstanceFields(klass);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < count; ++i)
|
|
|
|
|
{
|
|
|
|
|
if (field->isRef())
|
|
|
|
|
{
|
|
|
|
|
unsigned int off = field->getOffset();
|
|
|
|
|
// If we run into a weird situation, we bail.
|
|
|
|
|
if (off % sizeof (void *) != 0)
|
|
|
|
|
return (void *) (GCJ_DEFAULT_DESCR);
|
|
|
|
|
off /= sizeof (void *);
|
|
|
|
|
// If we find a field outside the range of our bitmap,
|
2003-09-29 09:13:40 +02:00
|
|
|
|
// fall back to procedure marker. The bottom 2 bits are
|
|
|
|
|
// reserved.
|
|
|
|
|
if (off >= bits_per_word - 2)
|
2003-07-23 11:53:53 +02:00
|
|
|
|
return (void *) (GCJ_DEFAULT_DESCR);
|
2003-09-29 09:13:40 +02:00
|
|
|
|
desc |= 1ULL << (bits_per_word - off - 1);
|
2003-07-23 11:53:53 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
field = field->getNextField();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// For bitmap mark type, bottom bits are 01.
|
|
|
|
|
desc |= 1;
|
|
|
|
|
// Bogus warning avoidance (on many platforms).
|
|
|
|
|
return (void *) (unsigned long) desc;
|
2000-09-30 11:56:58 +02:00
|
|
|
|
}
|
|
|
|
|
|
2001-05-24 07:40:37 +02:00
|
|
|
|
// Allocate some space that is known to be pointer-free.
|
1999-04-07 16:42:40 +02:00
|
|
|
|
void *
|
2001-05-24 07:40:37 +02:00
|
|
|
|
_Jv_AllocBytes (jsize size)
|
1999-04-07 16:42:40 +02:00
|
|
|
|
{
|
2001-05-24 07:40:37 +02:00
|
|
|
|
void *r = GC_MALLOC_ATOMIC (size);
|
|
|
|
|
// We have to explicitly zero memory here, as the GC doesn't
|
|
|
|
|
// guarantee that PTRFREE allocations are zeroed. Note that we
|
|
|
|
|
// don't have to do this for other allocation types because we set
|
|
|
|
|
// the `ok_init' flag in the type descriptor.
|
|
|
|
|
memset (r, 0, size);
|
|
|
|
|
return r;
|
1999-04-07 16:42:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
2000-09-30 11:56:58 +02:00
|
|
|
|
// Allocate space for a new Java array.
|
|
|
|
|
// Used only for arrays of objects.
|
1999-04-07 16:42:40 +02:00
|
|
|
|
void *
|
2000-09-30 11:56:58 +02:00
|
|
|
|
_Jv_AllocArray (jsize size, jclass klass)
|
1999-04-07 16:42:40 +02:00
|
|
|
|
{
|
2000-09-30 11:56:58 +02:00
|
|
|
|
void *obj;
|
|
|
|
|
const jsize min_heap_addr = 16*1024;
|
|
|
|
|
// A heuristic. If size is less than this value, the size
|
|
|
|
|
// stored in the array can't possibly be misinterpreted as
|
|
|
|
|
// a pointer. Thus we lose nothing by scanning the object
|
|
|
|
|
// completely conservatively, since no misidentification can
|
|
|
|
|
// take place.
|
|
|
|
|
|
|
|
|
|
#ifdef GC_DEBUG
|
|
|
|
|
// There isn't much to lose by scanning this conservatively.
|
|
|
|
|
// If we didn't, the mark proc would have to understand that
|
|
|
|
|
// it needed to skip the header.
|
|
|
|
|
obj = GC_MALLOC(size);
|
|
|
|
|
#else
|
|
|
|
|
if (size < min_heap_addr)
|
|
|
|
|
obj = GC_MALLOC(size);
|
|
|
|
|
else
|
2001-08-18 03:01:51 +02:00
|
|
|
|
obj = GC_generic_malloc (size, array_kind_x);
|
2000-09-30 11:56:58 +02:00
|
|
|
|
#endif
|
|
|
|
|
*((_Jv_VTable **) obj) = klass->vtable;
|
|
|
|
|
return obj;
|
1999-04-07 16:42:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
2001-09-10 03:21:08 +02:00
|
|
|
|
/* Allocate space for a new non-Java object, which does not have the usual
|
|
|
|
|
Java object header but may contain pointers to other GC'ed objects. */
|
|
|
|
|
void *
|
|
|
|
|
_Jv_AllocRawObj (jsize size)
|
|
|
|
|
{
|
|
|
|
|
return (void *) GC_MALLOC (size);
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
|
static void
|
|
|
|
|
call_finalizer (GC_PTR obj, GC_PTR client_data)
|
|
|
|
|
{
|
|
|
|
|
_Jv_FinalizerFunc *fn = (_Jv_FinalizerFunc *) client_data;
|
|
|
|
|
jobject jobj = (jobject) obj;
|
|
|
|
|
|
|
|
|
|
(*fn) (jobj);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_Jv_RegisterFinalizer (void *object, _Jv_FinalizerFunc *meth)
|
|
|
|
|
{
|
1999-08-03 02:30:53 +02:00
|
|
|
|
GC_REGISTER_FINALIZER_NO_ORDER (object, call_finalizer, (GC_PTR) meth,
|
1999-04-07 16:42:40 +02:00
|
|
|
|
NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_Jv_RunFinalizers (void)
|
|
|
|
|
{
|
|
|
|
|
GC_invoke_finalizers ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_Jv_RunAllFinalizers (void)
|
|
|
|
|
{
|
|
|
|
|
GC_finalize_all ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_Jv_RunGC (void)
|
|
|
|
|
{
|
|
|
|
|
GC_gcollect ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long
|
|
|
|
|
_Jv_GCTotalMemory (void)
|
|
|
|
|
{
|
|
|
|
|
return GC_get_heap_size ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long
|
|
|
|
|
_Jv_GCFreeMemory (void)
|
|
|
|
|
{
|
1999-11-02 01:12:10 +01:00
|
|
|
|
return GC_get_free_bytes ();
|
1999-04-07 16:42:40 +02:00
|
|
|
|
}
|
|
|
|
|
|
1999-10-22 21:43:41 +02:00
|
|
|
|
void
|
|
|
|
|
_Jv_GCSetInitialHeapSize (size_t size)
|
|
|
|
|
{
|
|
|
|
|
size_t current = GC_get_heap_size ();
|
|
|
|
|
if (size > current)
|
1999-11-05 18:34:32 +01:00
|
|
|
|
GC_expand_hp (size - current);
|
1999-10-22 21:43:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_Jv_GCSetMaximumHeapSize (size_t size)
|
|
|
|
|
{
|
|
|
|
|
GC_set_max_heap_size ((GC_word) size);
|
|
|
|
|
}
|
|
|
|
|
|
2000-04-02 17:34:17 +02:00
|
|
|
|
// From boehm's misc.c
|
|
|
|
|
extern "C" void GC_enable();
|
|
|
|
|
extern "C" void GC_disable();
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_Jv_DisableGC (void)
|
|
|
|
|
{
|
|
|
|
|
_Jv_MutexLock (&disable_gc_mutex);
|
|
|
|
|
GC_disable();
|
|
|
|
|
_Jv_MutexUnlock (&disable_gc_mutex);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
_Jv_EnableGC (void)
|
|
|
|
|
{
|
|
|
|
|
_Jv_MutexLock (&disable_gc_mutex);
|
|
|
|
|
GC_enable();
|
|
|
|
|
_Jv_MutexUnlock (&disable_gc_mutex);
|
|
|
|
|
}
|
|
|
|
|
|
2001-05-24 07:40:37 +02:00
|
|
|
|
static void * handle_out_of_memory(size_t)
|
|
|
|
|
{
|
|
|
|
|
_Jv_ThrowNoMemory();
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-07 16:42:40 +02:00
|
|
|
|
void
|
|
|
|
|
_Jv_InitGC (void)
|
|
|
|
|
{
|
|
|
|
|
int proc;
|
|
|
|
|
|
2002-02-12 05:14:52 +01:00
|
|
|
|
// Ignore pointers that do not point to the start of an object.
|
|
|
|
|
GC_all_interior_pointers = 0;
|
2000-09-30 11:56:58 +02:00
|
|
|
|
|
|
|
|
|
// Configure the collector to use the bitmap marking descriptors that we
|
|
|
|
|
// stash in the class vtable.
|
|
|
|
|
GC_init_gcj_malloc (0, (void *) _Jv_MarkObj);
|
|
|
|
|
|
2001-05-24 07:40:37 +02:00
|
|
|
|
// Cause an out of memory error to be thrown from the allocators,
|
|
|
|
|
// instead of returning 0. This is cheaper than checking on allocation.
|
|
|
|
|
GC_oom_fn = handle_out_of_memory;
|
|
|
|
|
|
2000-09-30 11:56:58 +02:00
|
|
|
|
GC_java_finalization = 1;
|
|
|
|
|
|
|
|
|
|
// We use a different mark procedure for object arrays. This code
|
|
|
|
|
// configures a different object `kind' for object array allocation and
|
|
|
|
|
// marking. FIXME: see above.
|
|
|
|
|
array_free_list = (ptr_t *) GC_generic_malloc_inner ((MAXOBJSZ + 1)
|
|
|
|
|
* sizeof (ptr_t),
|
|
|
|
|
PTRFREE);
|
|
|
|
|
memset (array_free_list, 0, (MAXOBJSZ + 1) * sizeof (ptr_t));
|
|
|
|
|
|
|
|
|
|
proc = GC_n_mark_procs++;
|
2001-05-21 10:37:04 +02:00
|
|
|
|
GC_mark_procs[proc] = (GC_mark_proc) _Jv_MarkArray;
|
2000-09-30 11:56:58 +02:00
|
|
|
|
|
|
|
|
|
array_kind_x = GC_n_kinds++;
|
|
|
|
|
GC_obj_kinds[array_kind_x].ok_freelist = array_free_list;
|
|
|
|
|
GC_obj_kinds[array_kind_x].ok_reclaim_list = 0;
|
2001-05-21 10:37:04 +02:00
|
|
|
|
GC_obj_kinds[array_kind_x].ok_descriptor = GC_MAKE_PROC (proc, 0);
|
2000-09-30 11:56:58 +02:00
|
|
|
|
GC_obj_kinds[array_kind_x].ok_relocate_descr = FALSE;
|
|
|
|
|
GC_obj_kinds[array_kind_x].ok_init = TRUE;
|
|
|
|
|
|
|
|
|
|
_Jv_MutexInit (&disable_gc_mutex);
|
|
|
|
|
}
|
|
|
|
|
|
2001-05-24 07:40:37 +02:00
|
|
|
|
#ifdef JV_HASH_SYNCHRONIZATION
|
|
|
|
|
// Allocate an object with a fake vtable pointer, which causes only
|
|
|
|
|
// the first field (beyond the fake vtable pointer) to be traced.
|
|
|
|
|
// Eventually this should probably be generalized.
|
|
|
|
|
|
|
|
|
|
static _Jv_VTable trace_one_vtable = {
|
|
|
|
|
0, // class pointer
|
|
|
|
|
(void *)(2 * sizeof(void *)),
|
|
|
|
|
// descriptor; scan 2 words incl. vtable ptr.
|
|
|
|
|
// Least significant bits must be zero to
|
2001-10-16 00:42:42 +02:00
|
|
|
|
// identify this as a length descriptor
|
2001-05-24 07:40:37 +02:00
|
|
|
|
{0} // First method
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void *
|
|
|
|
|
_Jv_AllocTraceOne (jsize size /* includes vtable slot */)
|
|
|
|
|
{
|
|
|
|
|
return GC_GCJ_MALLOC (size, &trace_one_vtable);
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-16 00:42:42 +02:00
|
|
|
|
// Ditto for two words.
|
|
|
|
|
// the first field (beyond the fake vtable pointer) to be traced.
|
|
|
|
|
// Eventually this should probably be generalized.
|
|
|
|
|
|
|
|
|
|
static _Jv_VTable trace_two_vtable =
|
|
|
|
|
{
|
|
|
|
|
0, // class pointer
|
|
|
|
|
(void *)(3 * sizeof(void *)),
|
|
|
|
|
// descriptor; scan 3 words incl. vtable ptr.
|
|
|
|
|
{0} // First method
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void *
|
|
|
|
|
_Jv_AllocTraceTwo (jsize size /* includes vtable slot */)
|
|
|
|
|
{
|
|
|
|
|
return GC_GCJ_MALLOC (size, &trace_two_vtable);
|
|
|
|
|
}
|
|
|
|
|
|
2001-05-24 07:40:37 +02:00
|
|
|
|
#endif /* JV_HASH_SYNCHRONIZATION */
|
|
|
|
|
|
2001-10-11 00:25:43 +02:00
|
|
|
|
void
|
|
|
|
|
_Jv_GCInitializeFinalizers (void (*notifier) (void))
|
|
|
|
|
{
|
|
|
|
|
GC_finalize_on_demand = 1;
|
|
|
|
|
GC_finalizer_notifier = notifier;
|
|
|
|
|
}
|
|
|
|
|
|
2001-10-02 16:31:47 +02:00
|
|
|
|
void
|
|
|
|
|
_Jv_GCRegisterDisappearingLink (jobject *objp)
|
|
|
|
|
{
|
|
|
|
|
GC_general_register_disappearing_link ((GC_PTR *) objp, (GC_PTR) *objp);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
jboolean
|
2001-11-12 11:42:45 +01:00
|
|
|
|
_Jv_GCCanReclaimSoftReference (jobject)
|
2001-10-02 16:31:47 +02:00
|
|
|
|
{
|
|
|
|
|
// For now, always reclaim soft references. FIXME.
|
|
|
|
|
return true;
|
|
|
|
|
}
|