* libjava/prims.cc: Some old cleanups. The collector now
handles test for out of memory.
* libjava/prims.cc, libjava/gcj/javaprims.h:
(_Jv_AllocObjectNoInitNoFinalizer, _Jv_AllocObjectNoFinalizer):
New functions for finalizer-free allocation.
(jvmpi_notify_alloc): Became separate function.
* libjava/java/lang/Object.h, libjava/include/jvm.h: Adjust for
revised vtable layout on IA64. With TARGET_VTABLE_USES_DESCRIPTORS,
there is only one extra descriptor.
From-SVN: r48002
* Makefile.am: New friends for java/lang/Thread.h.
* prims.cc (runFirst): Removed.
(JvRunMain): Merged into _Jv_RunMain. Now just calls that.
(_Jv_RunMain): Now takes either a klass or class name parameter.
Create a gnu.gcj.runtime.FirstThread and attach the native thread
to that, then run it using _Jv_ThreadRun. Remove special handling of
jar files, instead pass is_jar parameter through to FirstThread.
* gcj/javaprims.h: Add prototypes for _Jv_ThreadRun and new variant
of _Jv_AttachCurrentThread.
* gnu/gcj/runtime/FirstThread.java (FirstThread): Now extends Thread.
(run): New method. Take care of looking up main class manifest
attribute and calling forName if neccessary. Then call call_main.
(call_main): New native method.
* gnu/gcj/runtime/natFirstThread.cc (call_main): New function, code
relocated from prims.cc. Look up and call main method.
* java/lang/Thread.java (run_): Removed.
* java/lang/natThread.cc (run_): Renamed to...
(_Jv_ThreadRun): this. JVMPI notification code moved to ...
(_Jv_NotifyThreadStart): here. New function.
(countStackFrames, destroy, resume, suspend, stop): Throw
UnsupportedOperationExceptions rather than JvFail'ing.
(_Jv_AttachCurrentThread): New variant takes a Thread argument.
Existing version wraps new variant.
From-SVN: r45182
* jni.cc: Include IdentityHashMap.h, not Hashtable.h.
(local_ref_table, global_ref_table): Now IdentityHashMap.
(_Jv_JNI_Init): Updated for new types.
(mark_for_gc): Likewise.
(unmark_for_gc): Likewise.
* gcj/javaprims.h: Rebuilt class list.
* Makefile.in: Rebuilt.
* Makefile.am (core_java_source_files): Added new file.
* java/util/IdentityHashMap.java: New file.
From-SVN: r44929
* gcj/javaprims.h (_Jv_FormatInt): New declaration.
* java/lang/natString.cc (_JvFormatInt): New primitive, with logic
taken from old Integer.toString code.
(Integer::valueOf): Use _Jv_FormatInt.
* java/lang/Integer.java (toString): Just use call String.valueOf.
* java/lang/Long.java (toString): Fix typo in comment.
* java/lang/String.java (valueOf(int)): Make native.
* java/lang/StringBuffer.java (append(int)): Make native.
* java/lang/natStringBuffer.cc: New file, for append(jint).
* Makefile.am (ant_source_files): Add java/lang/natStringBuffer.cc.
From-SVN: r42419
2001-01-07 Alexandre Petit-Bianco <apbianco@cygnus.com>
All files with updated copyright.
* prims.cc (class _Jv_PrimClass): Removed.
(init_prim_class): New function.
(DECLARE_PRIM_TYPE): Rewritten. `java::lang::Class' replaces
`_Jv_PrimClass' in primitive type declarations. Assign to the
value returned by `init_prim_class.'
* gcj/array.h: `java::lang::Class' replaces `_Jv_PrimClass' in
primitive type declarations.
(JvPrimClass): Cast to `jclass' removed.
* java/lang/Class.h (Class): New constructor.
(Class): New copy constructor.
(initializePrim): New prototype.
(_Jv_PrimClass): Field removed.
* java/lang/Object.h (struct _JvObjectPrefix): New virtuals
nacd_1 and nacd_2 (for compatibility with the new C++ ABI.)
(class java::lang::Object): `finalize' moved up front.
* java/lang/natClass.cc
(isAssignableFrom): Turned outline.
(isInstance): Likewise.
(isInterface): Likewise, fixed indentation.
(initializePrim): New function.
(New C++ ABI compatibility patch:
http://sources.redhat.com/ml/java-patches/2001-q1/msg00065.html)
From-SVN: r39032
* prims.cc (_Jv_NewObjectArray): Use const_cast to initialize
length field of array.
(_Jv_NewPrimArray): Likewise.
* gcj/array.h (__JArray): `length' field now const. Added
constructor.
From-SVN: r37771
2000-11-25 Anthony Green <green@redhat.com>
* prims.cc (_Jv_NewObjectArray): Undo placement change.
(_Jv_NewPrimArray): Likewise.
* gcj/array.h (__JArray): Undo const change. Removed constructor.
(class JArray): Removed constructor.
* java/lang/Thread.java (context_class_loader): New private data.
(getContextClassLoader): New method.
(setContextClassLoader): New method.
(Thread): Initialize context_class_loader.
* java/net/URLClassLoader.java: Import java.util.Enumeration.
(getResource): Rename to findResource.
(findResource): New method. Used to be getResource.
(getResourceAsStream): Deleted.
(jarFileize): Extracted logic from URLClassLoader constructor into
this new private method.
(addURL): New protected method.
(URLClassLoader): Call jarFileize. Use addElement instead of
insertElementAt.
(findResources): New method.
* java/lang/ClassLoader.java: Import java.util.Enumeration.
(getResource): Implement correct logic.
(findResource): New method.
(getResources): New method.
(findClass): Create a ClassNotFoundException with the name of the
class rather than nothing at all.
(defineClass) Only throw ClassFormatError.
* java/lang/Class.java (forName): New method.
* java/lang/Class.h (forName): New method.
* java/lang/natClass.cc (forName): New method.
From-SVN: r37751
* prims.cc (_Jv_NewObjectArray): Use palcement new to create
array.
(_Jv_NewPrimArray): Likewise.
Include <new>.
* gcj/array.h (__JArray): `length' field now const. Added
constructor.
(class JArray): Added constructor.
From-SVN: r37718
* jni.cc: Added include of java/lang/ThreadGroup.h.
* gcj/javaprims.h: Removed Replaceable and Resolvable from namespace
per change of 2000-10-05.
From-SVN: r37173
* Makefile.am: Removed java/io/Replaceable.java and
java/io/Resolvable.java.
* Makefile.in: Rebuilt.
* gcj/javaprims.h: Removed Replaceable and Resolvable from java.io
namespace.
* java/io/ObjectInputStream.java (processResolution): Fixed typo
in method name.
(processResolution): Handle readResolve method via reflection with
removal of Resolvable interface.
* java/io/ObjectOutputStream.java (writeObject): Handle writeReplace
method via reflection with removal of Replaceable interface.
* java/io/Replaceable.java: Removed.
* java/io/Resolvable.java: Removed.
* java/security/Key.java (serialVersionUID): New field.
* java/security/Provider.java (serialVersionUID): New field.
* java/security/interfaces/DSAPrivateKey.java (serialVersionUID):
New field.
* java/security/interfaces/DSAPublicKey.java (serialVersionUID):
New field.
* java/sql/DataTruncation.java (serialVersionUID): New field.
* java/sql/SQLException.java (serialVersionUID): New field.
* java/sql/SQLWarning.java (serialVersionUID): New field.
* java/util/Date.java (serialVersionUID): New field.
(millis): Made transient.
(readObject): New method.
(writeObject): New method.
Serialization mods.
Note: The interfaces java.io.Replaceable and java.io.Resolvable were only
temporary additions to JDK 1.2 beta versions and were not included
in the JDK 1.2 final. The Serialization spec instructs how to deal
with their methods (via reflection).
From-SVN: r36736
2000-08-26 Anthony Green <green@redhat.com>
* Makefile.in: Rebuilt.
* Makefile.am (java/lang/ClassLoader.h): Make _Jv_RunMain a
friend.
* prims.cc: Include ClassLoader.h.
(_Jv_RunMain): When executing jar files, classpath must be the jar
file only. Lose our reference to the system ClassLoader in order
to get a new one with the correct classpath.
* java/lang/natSystem.cc (init_properties): When executing a jar
file, only use the jar file for java.class.path.
* gnu/gcj/runtime/VMClassLoader.java: Use the canonical file name
for bytecode archives.
* gnu/gcj/runtime/FirstThread.java: Handle case where manifest
exists, but not Main-Class.
From-SVN: r35999
2000-08-21 Mark Wielaard <mark@klomp.org>
* Makefile.in: Rebuilt.
* Makefile.am (java/lang/reflect/Constructor.h): Declare Class as
a `friend class'.
(java/lang/reflect/Field.h): Likewise.
(java/lang/reflect/Method.h): Likewise.
(gnu/gcj/runtime/VMClassLoader.h): Declare ClassLoader as a
`friend class'.
From-SVN: r35863
* gcj/field.h (JvFieldIsRef): Return false for gnu.gcj.RawData
field.
* boehm.cc (_Jv_MarkObj): Removed dead code. Use `STATIC', not
`0x0008'.
Include Modifier.h.
From-SVN: r33702
2000-04-08 Anthony Green <green@redhat.com>
* java/lang/natObject.cc (_Jv_MonitorEnter): Only perform null
check when we have to.
* gcj/array.h: Mark elements(JArray<T>& x) and elements(JArray<T>*
x) as `inline'.
* java/util/StringTokenizer.java: Minor optimization. Eliminates
one method call.
* java/util/Vector.java (VectorEnumeration.nextElement): Manually
inline hasMoreElements.
From-SVN: r33033
2000-03-26 Tom Tromey <tromey@cygnus.com>
* java/lang/mprec.h: Use SIZEOF_VOID_P.
* interpret.cc: Use SIZEOF_VOID_P.
* include/java-cpool.h (_Jv_storeLong): Use SIZEOF_VOID_P.
(_Jv_loadLong): Likewise.
(_Jv_storeDouble): Likewise.
* configure: Rebuilt.
* configure.in: Check size of void*.
* resolve.cc (ncode): Use FFI_PREP_RAW_CLOSURE and FFI_RAW_SIZE.
2000-03-26 Hans Boehm <boehm@acm.org>
* include/java-cpool.h (_Jv_storeLong, _Jv_loadLong,
_Jv_storeDouble, _Jv_loadDouble): Define differently on 64 bit
machine.
* java/lang/ieeefp.h: Define __IEEE_BIG_ENDIAN or
__IEEE_LITTLE_ENDIAN appropriately on IA64.
* java/lang/mprec.h: Don't define Pack_32 on 64 bit machine.
* javaprims.h (_Jv_word): Added `l' and `d' entries in 64 bit
case.
* resolve.cc (FFI_PREP_RAW_CLOSURE): New define.
(FFI_RAW_SIZE): Likewise.
(_Jv_InterpMethod::ncode): Use them.
* interpret.cc (PUSHL, PUSHD, POPL, POPD, LOADL, LOADD, STOREL,
STORED): Define differently on a 64 bit machine.
(continue1): Use ffi_java_raw_call when appropriate.
From-SVN: r32754
* All files: Updated copyright information.
* COPYING: New file.
* COPYING.LIB: Removed.
* LIBGCJ_LICENSE: We now use GPL + special exception.
From-SVN: r32387
2000-03-07 Bryce McKinlay <bryce@albatross.co.nz>
* resolve.cc (_Jv_SearchMethodInClass): New function.
(_Jv_ResolvePoolEntry): Search superinterfaces for interface
methods.
* java/lang/Class.h (_Jv_SearchMethodInClass): New prototype.
2000-03-07 Bryce McKinlay <bryce@albatross.co.nz>
* java/lang/Class.h (union _Jv_IDispatchTable): New declaration.
(struct _Jv_ifaces): New declaration.
JV_CLASS: New macro definition.
(getComponentType): Relocate below isArray() for inlining.
(getModifiers): Declare `inline'.
(getSuperclass): Ditto.
(isArray): Ditto.
(isPrimitive): Ditto.
(_Jv_IsAssignableFrom): New prototype.
(_Jv_LookupInterfaceMethodIdx): New prototype. Predeclare with "C"
linkage.
(_Jv_InitClass): Move from natClass.cc. Declare `inline'.
Check for JV_STATE_DONE before invoking initializeClass().
(_Jv_PrepareConstantTimeTables): New prototype.
(_Jv_GetInterfaces): Ditto.
(_Jv_GenerateITable): Ditto.
(_Jv_GetMethodString): Ditto.
(_Jv_AppendPartialITable): Ditto.
(_Jv_FindIIndex): Ditto.
depth, ancestors, idt: New class fields.
* java/lang/natClass.cc (isAssignableFrom): Move functionality to
inline function `_Jv_IsAssignableFrom'. Use that function.
(isInstance): Declare `inline'.
(initializeClass): Get lock on class before checking `state'. Unlock
before calling resolveClass0. Call _Jv_PrepareConstantTimeTables
with the lock held.
(_Jv_LookupInterfaceMethod): Use _Jv_GetMessageString.
(_Jv_IsAssignableFrom): New inline function. Test assignability
using class->depth and ancestor table.
(_Jv_IsInstanceOf): Use _Jv_IsAssignableFrom.
(_Jv_CheckCast): Move from prims.cc. Use JV_CLASS and
_Jv_IsAssignableFrom.
(_Jv_CheckArrayStore): Ditto.
(_Jv_LookupInterfaceMethodIdx): New function.
INITIAL_IOFFSETS_LEN, INITIAL_IFACES_LEN: New #defines.
(_Jv_PrepareConstantTimeTables): New function.
(_Jv_IndexOf): Ditto.
(_Jv_GetInterfaces): Ditto.
(_Jv_GenerateITable): Ditto.
(_Jv_GetMethodString): Ditto.
(_Jv_AppendPartialITable): Ditto.
iindex_mutex, iindex_mutex_initialized: New static fields.
(_Jv_FindIIndex): New function.
* java/lang/natClassLoader.cc (_Jv_NewClass): Set new jclass fields.
* prims.cc (_Jv_CheckCast): Moved to natClass.cc.
(_Jv_CheckArrayStore): Ditto.
(JvNewCharArray, JvNewBooleanArray, JvNewByteArray, JvNewShortArray,
JvNewIntArray, JvNewLongArray, JvNewFloatArray, JvNewDoubleArray):
Moved to gcj/array.h.
(_Jv_Realloc): New function.
* gcj/cni.h: Move _Jv_PrimClass definitions to gcj/array.h.
* gcj/array.h: _Jv_PrimClass definitions moved from gcj/cni.h.
(JvNewCharArray, JvNewBooleanArray, JvNewByteArray,
JvNewShortArray, JvNewIntArray, JvNewLongArray, JvNewFloatArray,
JvNewDoubleArray): Implementations moved from prims.cc and
declared `inline'.
* gcj/javaprims.h (_Jv_Realloc): Prototype.
* include/jvm.h (_Jv_LookupInterfaceMethodIdx): Prototype.
From-SVN: r32382
* gcj/method.h (JvNumMethods): Moved from Class.h.
(JvGetFirstMethod): Likewise.
* java/lang/Class.h (Object): Updated decl of
_Jv_JNI_ToReflectedField.
(Object): Added _Jv_JNI_ToReflectedMethod as a friend.
* Makefile.in: Rebuilt.
* Makefile.am (java/lang/reflect/Field.h): Added `jboolean'
argument of _Jv_JNI_ToReflectedField.
(java/lang/reflect/Constructor.h): Added _Jv_JNI_ToReflectedMethod
as a friend.
(java/lang/reflect/Method.h): Likewise.
* include/jni.h (class _Jv_JNIEnv): Added `klass' member. Use
__GCJ_JNI_IMPL__.
(jweak): New typedef.
(struct JNINativeInterface): Correctly declare remaining entries.
* jni.cc: Include Class.h, ClassLoader.h.
(_Jv_JNI_FindClass): New function.
(_Jv_JNI_DefineClass): New function.
(_Jv_JNI_conversion_call): New function.
(_Jv_JNI_FindClass): Use current class loader to find class.
(_Jv_JNI_ExceptionCheck): New function.
(_Jv_JNI_FromReflectedField): Now static.
(MethodClass): New define.
(_Jv_JNI_FromReflectedMethod): New function.
(_Jv_JNI_ToReflectedMethod): Likewise.
Include Method.h.
(_Jv_JNI_IsAssignableFrom): Renamed.
(_Jv_JNI_GetStringRegion): New function.
Include StringIndexOutOfBoundsException.h.
(_Jv_JNI_GetStringUTFRegion): New function.
(_Jv_JNIFunctions): Updated for new functions.
(_Jv_JNI_GetPrimitiveArrayCritical): New function
(_Jv_JNI_ReleasePrimitiveArrayCritical): Likewise.
(_Jv_JNI_GetStringCritical): New function.
(_Jv_JNI_ReleaseStringCritical): Likewise.
(get_throwable): Removed.
(GCJ_JV_JNIENV_FRIEND): Removed.
(__GCJ_JNI_IMPL__): Define.
Include method.h.
From-SVN: r31638
* gcj/field.h (struct _Jv_Field): Use "jshort" as type for
nameIndex. Use "jint" as type for boffset.
* java/lang/Class.h (struct _Jv_Method): Made accflags a
_Jv_ushort.
(Class): Likewise. Also changed type of method_count,
vtable_method_count, size_in_bytes, field_count,
static_field_count, interface_count.
* gcj/array.h (__JArray): Made `length' a const jsize, not an
int.
From-SVN: r31621
2000-01-04 Tom Tromey <tromey@cygnus.com>
* java/lang/reflect/natConstructor.cc (newInstance): Pass
declaring class as return_type argument to
_Jv_CallNonvirtualMethodA.
* java/lang/reflect/natMethod.cc (_Jv_CallNonvirtualMethodA): In
constructor case, create object and use it as `this' argument.
* java/lang/Class.h (_getConstructors): Declare.
(_getFields): Declare.
* java/lang/Class.java (getConstructors): Wrote.
(_getConstructors): New native method.
(getDeclaredConstructors): Wrote.
(_getFields): Declare new native method.
* java/lang/natClass.cc (_Jv_LookupInterfaceMethod): Removed
incorrect comment.
(getMethod): Work correctly when class is primitive.
(getDeclaredMethods): Likewise. Compute offset using `method',
not `mptr'.
(getDeclaredMethod): Likewise.
(getConstructor): Wrote.
(ConstructorClass): New define.
(getDeclaredConstructor): Wrote.
(_getConstructors): New method.
(_getFields): New method.
(getFields): Wrote.
* Makefile.in: Rebuilt.
* Makefile.am (AM_CXXFLAGS): Added -D_GNU_SOURCE.
* prims.cc: Remove `#pragma implementation'.
* gcj/array.h: Remove `#pragma interface'.
* prims.cc (_Jv_equaln): New function.
* java/lang/Class.java (getSignature): Declare.
* resolve.cc (_Jv_LookupDeclaredMethod): Moved to natClass.cc.
* java/lang/natClass.cc (_Jv_LookupDeclaredMethod): Moved from
resolve.cc.
(getSignature): New method.
(getDeclaredMethod): Wrote.
(getMethod): Wrote.
Include StringBuffer.h.
* java/lang/Class.h (Class): Added _Jv_FromReflectedConstructor
as a friend. Unconditionally declare _Jv_LookupDeclaredMethod as
a friend.
(getSignature): Declare.
* include/jvm.h (_Jv_GetTypesFromSignature): Declare.
(_Jv_equaln): Declare.
(_Jv_CallNonvirtualMethodA): Declare.
* Makefile.in: Rebuilt.
* Makefile.am (nat_source_files): Added natConstructor.cc.
(java/lang/reflect/Constructor.h): New target.
* java/lang/reflect/natConstructor.cc: New file.
* java/lang/reflect/Constructor.java (newInstance): Now native.
(declaringClass): Renamed from decl_class.
(offset): Renamed from index.
(getType): New native method.
(getModifiers): Now native.
(getParameterTypes): Call getType if required.
(hashCode): Include hash code from declaring class.
(modifiers): Removed.
(toString): Call getType if required.
* gcj/method.h (_Jv_FromReflectedConstructor): New function.
* java/lang/reflect/natMethod.cc (hack_call): New method.
Removed `#if 0' around FFI code.
Include <gnu/gcj/RawData.h>.
(invoke): Use _Jv_CallNonvirtualMethodA. Throw
IllegalArgumentException when argument object and class disagree.
(_Jv_GetTypesFromSignature): New function.
(getType): Use it.
(ObjectClass): New define.
(_Jv_CallNonvirtualMethodA): New function.
* java/lang/reflect/Method.java (hack_trampoline): New method.
(hack_call): New native method.
1999-12-21 Per Bothner <per@bothner.com>
* java/lang/natClass.cc (getDeclaredMethods): Correctly compute
offset in new Method.
From-SVN: r31199
* configure: Rebuilt.
* configure.in: Build include/Makefile.
* Makefile.in: Rebuilt.
* Makefile.am (SUBDIRS): Added gcj and include.
(install-data-local): New target.
(extra_headers): New macro.
* include/Makefile.in: New file.
* include/Makefile.am: New file.
* interpret.cc: Don't include gcj/field.h or gcj/cni.h.
* java/lang/reflect/natField.cc: Don't include gcj/field.h or
gcj/cni.h.
* boehm.cc: Don't include java-threads.h or gcj/field.h.
* resolve.cc: Include config.h.
* defineclass.cc: Include config.h.
* include/java-interp.h: Don't include config.h.
* include/jvm.h: Include java-threads.h, Object.h, java-gc.h,
cni.h.
* gcj/javaprims.h: Regenerated namespace decls.
* classes.pl (scan): Don't put `;' after closing brace.
* Makefile.in: Rebuilt.
* Makefile.am (INCLUDES): Added -I for top_srcdir.
* configure.in: Create gcj/Makefile.
* gcj/Makefile.in: New file.
* gcj/Makefile.am: New file.
* java/lang/Object.h: Don't include any other headers.
* gcj/array.h: Renamed from include/java-array.h.
* gcj/field.h: Renamed from include/java-field.h.
* gcj/method.h: Renamed from include/java-method.h.
* gcj/cni.h, gcj/javaprims.h: Moved from include/.
Updated all files to reflect new include structure.
From-SVN: r29278