dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
dnl 02110-1301, USA.
dnl
-dnl $Id: configure.ac 8123 2007-06-20 23:50:55Z michi $
+dnl $Id: configure.ac 8132 2007-06-22 11:15:47Z twisti $
dnl Process this file with autoconf to produce a configure script.
AC_CHECK_HEADERS([sys/mman.h])
AC_CHECK_HEADERS([sys/resource.h])
AC_CHECK_HEADERS([sys/select.h])
+AC_CHECK_HEADERS([sys/socket.h])
AC_CHECK_HEADERS([sys/stat.h])
AC_CHECK_HEADERS([sys/time.h])
AC_CHECK_HEADERS([sys/types.h])
AC_FUNC_MMAP
dnl keep them alpha-sorted!
+AC_CHECK_FUNCS([accept])
AC_CHECK_FUNCS([atoi])
AC_CHECK_FUNCS([atol])
AC_CHECK_FUNCS([calloc])
+AC_CHECK_FUNCS([close])
AC_CHECK_FUNCS([confstr])
+AC_CHECK_FUNCS([connect])
AC_CHECK_FUNCS([fflush])
AC_CHECK_FUNCS([fopen])
AC_CHECK_FUNCS([fprintf])
AC_CHECK_FUNCS([free])
AC_CHECK_FUNCS([fstat])
AC_CHECK_FUNCS([getcwd])
+AC_CHECK_FUNCS([gethostname])
AC_CHECK_FUNCS([getpagesize])
AC_CHECK_FUNCS([getrusage])
+AC_CHECK_FUNCS([getsockname])
AC_CHECK_FUNCS([gettimeofday])
AC_CHECK_FUNCS([ioctl])
AC_CHECK_FUNCS([isnan])
+AC_CHECK_FUNCS([listen])
AC_CHECK_FUNCS([localtime])
AC_CHECK_FUNCS([localtime_r])
AC_CHECK_FUNCS([lseek])
AC_CHECK_FUNCS([open])
AC_CHECK_FUNCS([scandir])
AC_CHECK_FUNCS([select])
+AC_CHECK_FUNCS([setsockopt])
+AC_CHECK_FUNCS([shutdown])
+AC_CHECK_FUNCS([socket])
AC_CHECK_FUNCS([strchr])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([strerror])
[src/native/vm/Makefile]
[src/native/vm/cldc1.1/Makefile]
[src/native/vm/gnu/Makefile]
+ [src/native/vm/sun/Makefile]
[src/scripts/Makefile]
[src/scripts/java]
[src/threads/Makefile]
dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
dnl 02110-1301, USA.
dnl
-dnl $Id: configure.ac 7228 2007-01-19 01:13:48Z edwin $
+dnl $Id: classpath.m4 8133 2007-06-22 13:29:38Z twisti $
dnl which Java core library should we use
AC_DEFUN([AC_CHECK_WITH_CLASSPATH],[
AC_MSG_CHECKING(which Java core library to use)
AC_ARG_WITH([classpath],
- [AS_HELP_STRING(--with-classpath=<type>,specifies which type of classpath to use as Java core library (cldc1.1,gnu) [[default=gnu]])],
+ [AS_HELP_STRING(--with-classpath=<type>,specifies which type of classpath to use as Java core library (cldc1.1,gnu,sun) [[default=gnu]])],
[case "${withval}" in
cldc1.1)
WITH_CLASSPATH=cldc1.1
AC_DEFINE([WITH_CLASSPATH_GNU], 1, [use GNU Classpath])
AC_SUBST(WITH_CLASSPATH_GNU)
;;
+ sun)
+ WITH_CLASSPATH=sun
+ AC_DEFINE([WITH_CLASSPATH_SUN], 1, [use Sun's Java SE classes])
+ AC_SUBST(WITH_CLASSPATH_SUN)
+ ;;
*)
AC_MSG_ERROR(unknown classpath ${withval})
;;
AC_MSG_RESULT(${WITH_CLASSPATH})
AM_CONDITIONAL([WITH_CLASSPATH_CLDC1_1], test x"${WITH_CLASSPATH}" = "xcldc1.1")
AM_CONDITIONAL([WITH_CLASSPATH_GNU], test x"${WITH_CLASSPATH}" = "xgnu")
+AM_CONDITIONAL([WITH_CLASSPATH_SUN], test x"${WITH_CLASSPATH}" = "xsun")
])
[CLASSPATH_INCLUDEDIR=${CLASSPATH_PREFIX}/include])
AC_MSG_RESULT(${CLASSPATH_INCLUDEDIR})
+if test x"${WITH_CLASSPATH}" = "xsun"; then
+ AC_CHECK_HEADER([${CLASSPATH_INCLUDEDIR}/${OS_DIR}/jni_md.h],
+ [AC_DEFINE_UNQUOTED([CLASSPATH_JNI_MD_H], "${CLASSPATH_INCLUDEDIR}/${OS_DIR}/jni_md.h", [Java core library jni_md.h header])],
+ [AC_MSG_ERROR(cannot find jni_md.h)])
+else
+ AC_CHECK_HEADER([${CLASSPATH_INCLUDEDIR}/jni_md.h],
+ [AC_DEFINE_UNQUOTED([CLASSPATH_JNI_MD_H], "${CLASSPATH_INCLUDEDIR}/jni_md.h", [Java core library jni_md.h header])],
+ [AC_MSG_ERROR(cannot find jni_md.h)])
+fi
+
AC_CHECK_HEADER([${CLASSPATH_INCLUDEDIR}/jni.h],
[AC_DEFINE_UNQUOTED([CLASSPATH_JNI_H], "${CLASSPATH_INCLUDEDIR}/jni.h", [Java core library jni.h header])],
- [AC_MSG_ERROR(cannot find jni.h)])
-
-AC_CHECK_HEADER([${CLASSPATH_INCLUDEDIR}/jni_md.h],
- [AC_DEFINE_UNQUOTED([CLASSPATH_JNI_MD_H], "${CLASSPATH_INCLUDEDIR}/jni_md.h", [Java core library jni_md.h header])],
- [AC_MSG_ERROR(cannot find jni_md.h)])
+ [AC_MSG_ERROR(cannot find jni.h)],
+ [#define __GCJ_JNI_MD_H__
+ #include CLASSPATH_JNI_MD_H])
])
##
## Contact: cacao@cacaojvm.org
##
-## $Id: Makefile.am 7338 2007-02-13 00:17:22Z twisti $
+## $Id: Makefile.am 8132 2007-06-22 11:15:47Z twisti $
## Process this file with automake to produce Makefile.in
libjvm_la_LDFLAGS = \
-release $(PACKAGE_VERSION)
+if WITH_CLASSPATH_SUN
+libjvm_la_LDFLAGS += \
+ -Xlinker --version-script=$(top_srcdir)/contrib/mapfile-vers-product
+endif
+
cacao_LDFLAGS += \
-export-dynamic
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301, USA.
##
-## $Id: Makefile.am 7890 2007-05-09 16:05:58Z twisti $
+## $Id: Makefile.am 8132 2007-06-22 11:15:47Z twisti $
## Process this file with automake to produce Makefile.in
$(top_srcdir)/src/lib/gnu/java/lang/VMString.java \
$(top_srcdir)/src/lib/gnu/java/lang/VMThread.java \
$(top_srcdir)/src/lib/gnu/java/lang/VMThrowable.java \
- $(top_srcdir)/src/lib/gnu/java/security/VMAccessController.java
+ $(top_srcdir)/src/lib/gnu/java/lang/reflect/Field.java \
+ $(top_srcdir)/src/lib/gnu/java/lang/reflect/Method.java \
+ $(top_srcdir)/src/lib/gnu/java/security/VMAccessController.java \
+ $(top_srcdir)/src/lib/gnu/sun/misc/Unsafe.java
VM_CLASS_FILES = \
classes/gnu/classpath/VMStackWalker.class \
classes/java/lang/VMString.class \
classes/java/lang/VMThread.class \
classes/java/lang/VMThrowable.class \
- classes/java/security/VMAccessController.class
+ classes/java/lang/reflect/Field.class \
+ classes/java/lang/reflect/Method.class \
+ classes/java/security/VMAccessController.class \
+ classes/sun/misc/Unsafe.class
if ENABLE_ZLIB
pkgdata_DATA = vm.zip
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
## 02110-1301, USA.
##
-## $Id: Makefile.am 8123 2007-06-20 23:50:55Z michi $
+## $Id: Makefile.am 8132 2007-06-22 11:15:47Z twisti $
## Process this file with automake to produce Makefile.in
java_lang_ClassLoader.h \
java_lang_Cloneable.h \
java_lang_ThreadGroup.h \
- java_lang_VMThread.h \
- java_lang_VMThrowable.h \
java_util_Properties.h \
\
- gnu_classpath_Pointer.h \
- gnu_classpath_Pointer32.h \
- gnu_classpath_Pointer64.h \
java_io_File.h \
java_lang_Process.h \
java_lang_StackTraceElement.h \
- java_lang_VMObject.h \
java_lang_reflect_Constructor.h \
java_lang_reflect_Field.h \
java_lang_reflect_Method.h \
java_nio_Buffer.h \
- java_nio_DirectByteBufferImpl.h \
java_security_ProtectionDomain.h \
java_util_concurrent_atomic_AtomicLong.h \
sun_misc_Unsafe.h
+if WITH_CLASSPATH_GNU
+JAVASE_HEADER_FILES += \
+ java_lang_VMThread.h \
+ java_lang_VMThrowable.h \
+ \
+ gnu_classpath_Pointer.h \
+ gnu_classpath_Pointer32.h \
+ gnu_classpath_Pointer64.h \
+ java_lang_VMObject.h \
+ java_nio_DirectByteBufferImpl.h
+endif
+
+if WITH_CLASSPATH_SUN
+JAVASE_HEADER_FILES += \
+ java_lang_AssertionStatusDirectives.h \
+ java_nio_ByteBuffer.h
+endif
+
JAVAME_CLDC1_1_HEADER_FILES = \
com_sun_cldc_io_ResourceInputStream.h \
com_sun_cldc_io_j2me_socket_Protocol.h \
gnu_classpath_jdwp_VMMethod.h \
gnu_classpath_jdwp_VMVirtualMachine.h \
gnu_classpath_jdwp_event_EventRequest.h \
- gnu_classpath_jdwp_util_VariableTable.h \
- java_nio_ByteBuffer.h
+ gnu_classpath_jdwp_util_VariableTable.h
+if WITH_CLASSPATH_GNU
ADDITIONAL_IMPLEMENTED_VM_CLASSES_HEADER_FILES = \
gnu_classpath_VMStackWalker.h \
gnu_classpath_VMSystemProperties.h \
java_lang_VMRuntime.h \
java_lang_VMString.h \
java_lang_VMSystem.h \
- java_lang_management_VMManagementFactory.h \
java_lang_management_MemoryUsage.h \
java_lang_management_ThreadInfo.h \
+ java_lang_management_VMManagementFactory.h \
java_lang_reflect_VMProxy.h \
java_security_VMAccessController.h
+endif
ADDITIONAL_STATIC_CLASSPATH_HEADER_FILES = \
java_net_DatagramPacket.h \
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: jni.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: jni.c 8137 2007-06-22 16:41:36Z michi $
*/
#include "native/include/java_lang_Throwable.h"
#if defined(ENABLE_JAVASE)
+# if defined(WITH_CLASSPATH_SUN)
+# include "native/include/java_nio_ByteBuffer.h" /* required by j.l.CL */
+# endif
+
# include "native/include/java_lang_ClassLoader.h"
# include "native/include/java_lang_reflect_Constructor.h"
# include "native/include/java_lang_reflect_Method.h"
# include "native/include/java_nio_Buffer.h"
-# include "native/include/java_nio_DirectByteBufferImpl.h"
+
+# if defined(WITH_CLASSPATH_GNU)
+# include "native/include/java_nio_DirectByteBufferImpl.h"
+# endif
#endif
#if defined(ENABLE_JVMTI)
!link_class(class_java_nio_Buffer))
return false;
+# if defined(WITH_CLASSPATH_GNU)
if (!(class_java_nio_DirectByteBufferImpl =
load_class_bootstrap(utf_new_char("java/nio/DirectByteBufferImpl"))) ||
!link_class(class_java_nio_DirectByteBufferImpl))
utf_new_char("(Ljava/lang/Object;Lgnu/classpath/Pointer;III)V"))))
return false;
-# if defined(WITH_CLASSPATH_GNU)
# if SIZEOF_VOID_P == 8
if (!(class_gnu_classpath_Pointer64 =
load_class_bootstrap(utf_new_char("gnu/classpath/Pointer64"))) ||
static java_objectheader *_Jv_jni_CallObjectMethodA(java_objectheader *o,
vftbl_t *vftbl,
- methodinfo *m, jvalue *args)
+ methodinfo *m,
+ const jvalue *args)
{
methodinfo *resm;
java_objectheader *ro;
*******************************************************************************/
static jint _Jv_jni_CallIntMethodA(java_objectheader *o, vftbl_t *vftbl,
- methodinfo *m, jvalue *args)
+ methodinfo *m, const jvalue *args)
{
methodinfo *resm;
jint i;
*******************************************************************************/
static jlong _Jv_jni_CallLongMethodA(java_objectheader *o, vftbl_t *vftbl,
- methodinfo *m, jvalue *args)
+ methodinfo *m, const jvalue *args)
{
methodinfo *resm;
jlong l;
*******************************************************************************/
static jfloat _Jv_jni_CallFloatMethodA(java_objectheader *o, vftbl_t *vftbl,
- methodinfo *m, jvalue *args)
+ methodinfo *m, const jvalue *args)
{
methodinfo *resm;
jfloat f;
*******************************************************************************/
static jdouble _Jv_jni_CallDoubleMethodA(java_objectheader *o, vftbl_t *vftbl,
- methodinfo *m, jvalue *args)
+ methodinfo *m, const jvalue *args)
{
methodinfo *resm;
jdouble d;
*******************************************************************************/
static void _Jv_jni_CallVoidMethodA(java_objectheader *o, vftbl_t *vftbl,
- methodinfo *m, jvalue *args)
+ methodinfo *m, const jvalue *args)
{
methodinfo *resm;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__M68K__) & !defined(__ARM__)
java_objectheader *_Jv_jni_invokeNative(methodinfo *m, java_objectheader *o,
java_objectarray *params)
{
STATISTICS(jniinvokation());
c = (classinfo *) clazz;
+ if (msg == NULL)
+ msg = "";
s = javastring_new_from_utf_string(msg);
/* instantiate exception object */
o = builtin_new(c);
- return _Jv_JNI_NewLocalRef(env, o);
+ return _Jv_JNI_NewLocalRef(env, (jobject) o);
}
jobject _Jv_JNI_NewObject(JNIEnv *env, jclass clazz, jmethodID methodID, ...)
{
java_objectheader *o;
+ classinfo *c;
methodinfo *m;
va_list ap;
STATISTICS(jniinvokation());
+ c = (classinfo *) clazz;
m = (methodinfo *) methodID;
/* create object */
- o = builtin_new(clazz);
+ o = builtin_new(c);
if (o == NULL)
return NULL;
_Jv_jni_CallVoidMethod(o, o->vftbl, m, ap);
va_end(ap);
- return _Jv_JNI_NewLocalRef(env, o);
+ return _Jv_JNI_NewLocalRef(env, (jobject) o);
}
va_list args)
{
java_objectheader *o;
+ classinfo *c;
methodinfo *m;
STATISTICS(jniinvokation());
+ c = (classinfo *) clazz;
m = (methodinfo *) methodID;
/* create object */
- o = builtin_new(clazz);
+ o = builtin_new(c);
if (o == NULL)
return NULL;
_Jv_jni_CallVoidMethod(o, o->vftbl, m, args);
- return _Jv_JNI_NewLocalRef(env, o);
+ return _Jv_JNI_NewLocalRef(env, (jobject) o);
}
*******************************************************************************/
jobject _Jv_JNI_NewObjectA(JNIEnv* env, jclass clazz, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
java_objectheader *o;
+ classinfo *c;
methodinfo *m;
STATISTICS(jniinvokation());
+ c = (classinfo *) clazz;
m = (methodinfo *) methodID;
/* create object */
- o = builtin_new(clazz);
+ o = builtin_new(c);
if (o == NULL)
return NULL;
_Jv_jni_CallVoidMethodA(o, o->vftbl, m, args);
- return _Jv_JNI_NewLocalRef(env, o);
+ return _Jv_JNI_NewLocalRef(env, (jobject) o);
}
jmethodID _Jv_JNI_FromReflectedMethod(JNIEnv *env, jobject method)
{
#if defined(ENABLE_JAVASE)
- methodinfo *mi;
- classinfo *c;
- s4 slot;
+ java_objectheader *o;
+ classinfo *c;
+ methodinfo *m;
+ s4 slot;
STATISTICS(jniinvokation());
- if (method == NULL)
+ o = (java_objectheader *) method;
+
+ if (o == NULL)
return NULL;
- if (builtin_instanceof(method, class_java_lang_reflect_Method)) {
+ if (builtin_instanceof(o, class_java_lang_reflect_Method)) {
java_lang_reflect_Method *rm;
- rm = (java_lang_reflect_Method *) method;
- c = (classinfo *) (rm->declaringClass);
+ rm = (java_lang_reflect_Method *) method;
+ c = (classinfo *) (rm->clazz);
slot = rm->slot;
}
- else if (builtin_instanceof(method, class_java_lang_reflect_Constructor)) {
+ else if (builtin_instanceof(o, class_java_lang_reflect_Constructor)) {
java_lang_reflect_Constructor *rc;
- rc = (java_lang_reflect_Constructor *) method;
- c = (classinfo *) (rc->clazz);
+ rc = (java_lang_reflect_Constructor *) method;
+ c = (classinfo *) (rc->clazz);
slot = rc->slot;
}
else
return NULL;
- mi = &(c->methods[slot]);
+ m = &(c->methods[slot]);
- return (jmethodID) mi;
+ return (jmethodID) m;
#else
vm_abort("_Jv_JNI_FromReflectedMethod: not implemented in this configuration");
if (rf == NULL)
return NULL;
- c = (classinfo *) rf->declaringClass;
-
+ c = (classinfo *) rf->clazz;
f = &(c->fields[rf->slot]);
return (jfieldID) f;
c = (classinfo *) clazz;
- if (!c)
+ if (c == NULL)
return NULL;
if (!(c->state & CLASS_INITIALIZED))
uname = utf_new_char((char *) name);
udesc = utf_new_char((char *) sig);
- m = class_resolvemethod(clazz, uname, udesc);
+ m = class_resolvemethod(c, uname, udesc);
if ((m == NULL) || (m->flags & ACC_STATIC)) {
exceptions_throw_nosuchmethoderror(c, uname, udesc);
ret = _Jv_jni_CallObjectMethod(o, o->vftbl, m, ap);
va_end(ap);
- return _Jv_JNI_NewLocalRef(env, ret);
+ return _Jv_JNI_NewLocalRef(env, (jobject) ret);
}
ret = _Jv_jni_CallObjectMethod(o, o->vftbl, m, args);
- return _Jv_JNI_NewLocalRef(env, ret);
+ return _Jv_JNI_NewLocalRef(env, (jobject) ret);
}
jobject _Jv_JNI_CallObjectMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
java_objectheader *o;
methodinfo *m;
ret = _Jv_jni_CallObjectMethodA(o, o->vftbl, m, args);
- return _Jv_JNI_NewLocalRef(env, ret);
+ return _Jv_JNI_NewLocalRef(env, (jobject) ret);
}
jboolean _Jv_JNI_CallBooleanMethodA(JNIEnv *env, jobject obj,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
java_objectheader *o;
methodinfo *m;
jbyte _Jv_JNI_CallByteMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
log_text("JNI-Call: CallByteMethodA: IMPLEMENT ME!");
jchar _Jv_JNI_CallCharMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
log_text("JNI-Call: CallCharMethodA: IMPLEMENT ME!");
jshort _Jv_JNI_CallShortMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
log_text("JNI-Call: CallShortMethodA: IMPLEMENT ME!");
jint _Jv_JNI_CallIntMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
log_text("JNI-Call: CallIntMethodA: IMPLEMENT ME!");
jlong _Jv_JNI_CallLongMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
log_text("JNI-Call: CallLongMethodA: IMPLEMENT ME!");
jfloat _Jv_JNI_CallFloatMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
log_text("JNI-Call: CallFloatMethodA: IMPLEMENT ME!");
jdouble _Jv_JNI_CallDoubleMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
log_text("JNI-Call: CallDoubleMethodA: IMPLEMENT ME!");
void _Jv_JNI_CallVoidMethodA(JNIEnv *env, jobject obj, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
java_objectheader *o;
methodinfo *m;
r = _Jv_jni_CallObjectMethod(o, c->vftbl, m, ap);
va_end(ap);
- return _Jv_JNI_NewLocalRef(env, r);
+ return _Jv_JNI_NewLocalRef(env, (jobject) r);
}
r = _Jv_jni_CallObjectMethod(o, c->vftbl, m, args);
- return _Jv_JNI_NewLocalRef(env, r);
+ return _Jv_JNI_NewLocalRef(env, (jobject) r);
}
jobject _Jv_JNI_CallNonvirtualObjectMethodA(JNIEnv *env, jobject obj,
jclass clazz, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
log_text("JNI-Call: CallNonvirtualObjectMethodA: IMPLEMENT ME!");
jboolean _Jv_JNI_CallNonvirtualBooleanMethodA(JNIEnv *env, jobject obj,
jclass clazz, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
log_text("JNI-Call: CallNonvirtualBooleanMethodA: IMPLEMENT ME!");
jbyte _Jv_JNI_CallNonvirtualByteMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
log_text("JNI-Call: CallNonvirtualByteMethodA: IMPLEMENT ME!");
jchar _Jv_JNI_CallNonvirtualCharMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
log_text("JNI-Call: CallNonvirtualCharMethodA: IMPLEMENT ME!");
jshort _Jv_JNI_CallNonvirtualShortMethodA(JNIEnv *env, jobject obj,
jclass clazz, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
log_text("JNI-Call: CallNonvirtualShortMethodA: IMPLEMENT ME!");
jint _Jv_JNI_CallNonvirtualIntMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
log_text("JNI-Call: CallNonvirtualIntMethodA: IMPLEMENT ME!");
jlong _Jv_JNI_CallNonvirtualLongMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
log_text("JNI-Call: CallNonvirtualLongMethodA: IMPLEMENT ME!");
jfloat _Jv_JNI_CallNonvirtualFloatMethodA(JNIEnv *env, jobject obj,
jclass clazz, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
log_text("JNI-Call: CallNonvirtualFloatMethodA: IMPLEMENT ME!");
jdouble _Jv_JNI_CallNonvirtualDoubleMethodA(JNIEnv *env, jobject obj,
jclass clazz, jmethodID methodID,
- jvalue *args)
+ const jvalue *args)
{
log_text("JNI-Call: CallNonvirtualDoubleMethodA: IMPLEMENT ME!");
void _Jv_JNI_CallNonvirtualVoidMethodA(JNIEnv *env, jobject obj, jclass clazz,
- jmethodID methodID, jvalue * args)
+ jmethodID methodID, const jvalue * args)
{
java_objectheader *o;
classinfo *c;
*******************************************************************************/
jfieldID _Jv_JNI_GetFieldID(JNIEnv *env, jclass clazz, const char *name,
- const char *sig)
+ const char *sig)
{
classinfo *c;
fieldinfo *f;
c = (classinfo *) clazz;
+ /* XXX NPE check? */
+
uname = utf_new_char((char *) name);
udesc = utf_new_char((char *) sig);
- f = class_findfield(clazz, uname, udesc);
+ f = class_findfield(c, uname, udesc);
if (f == NULL)
exceptions_throw_nosuchfielderror(c, uname);
o = GET_FIELD(obj, java_objectheader*, fieldID);
- return _Jv_JNI_NewLocalRef(env, o);
+ return _Jv_JNI_NewLocalRef(env, (jobject) o);
}
o = _Jv_jni_CallObjectMethod(NULL, NULL, m, ap);
va_end(ap);
- return _Jv_JNI_NewLocalRef(env, o);
+ return _Jv_JNI_NewLocalRef(env, (jobject) o);
}
o = _Jv_jni_CallObjectMethod(NULL, NULL, m, args);
- return _Jv_JNI_NewLocalRef(env, o);
+ return _Jv_JNI_NewLocalRef(env, (jobject) o);
}
jobject _Jv_JNI_CallStaticObjectMethodA(JNIEnv *env, jclass clazz,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
methodinfo *m;
java_objectheader *o;
o = _Jv_jni_CallObjectMethodA(NULL, NULL, m, args);
- return _Jv_JNI_NewLocalRef(env, o);
+ return _Jv_JNI_NewLocalRef(env, (jobject) o);
}
jboolean _Jv_JNI_CallStaticBooleanMethodA(JNIEnv *env, jclass clazz,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
methodinfo *m;
jboolean b;
jbyte _Jv_JNI_CallStaticByteMethodA(JNIEnv *env, jclass clazz,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
methodinfo *m;
jbyte b;
jchar _Jv_JNI_CallStaticCharMethodA(JNIEnv *env, jclass clazz,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
methodinfo *m;
jchar c;
jshort _Jv_JNI_CallStaticShortMethodA(JNIEnv *env, jclass clazz,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
methodinfo *m;
jshort s;
jint _Jv_JNI_CallStaticIntMethodA(JNIEnv *env, jclass clazz,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
methodinfo *m;
jint i;
jlong _Jv_JNI_CallStaticLongMethodA(JNIEnv *env, jclass clazz,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
methodinfo *m;
jlong l;
jfloat _Jv_JNI_CallStaticFloatMethodA(JNIEnv *env, jclass clazz,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
methodinfo *m;
jfloat f;
jdouble _Jv_JNI_CallStaticDoubleMethodA(JNIEnv *env, jclass clazz,
- jmethodID methodID, jvalue *args)
+ jmethodID methodID, const jvalue *args)
{
methodinfo *m;
jdouble d;
void _Jv_JNI_CallStaticVoidMethodA(JNIEnv *env, jclass clazz,
- jmethodID methodID, jvalue * args)
+ jmethodID methodID, const jvalue * args)
{
methodinfo *m;
uname = utf_new_char((char *) name);
usig = utf_new_char((char *) sig);
- f = class_findfield(clazz, uname, usig);
+ f = class_findfield(c, uname, usig);
if (f == NULL)
exceptions_throw_nosuchfielderror(c, uname);
jsize _Jv_JNI_GetStringLength(JNIEnv *env, jstring str)
{
- return ((java_lang_String *) str)->count;
+ java_lang_String *s;
+
+ s = (java_lang_String *) str;
+
+ return s->count;
}
/****************** returns the utf8 length in bytes of a string *******************/
-jsize _Jv_JNI_GetStringUTFLength (JNIEnv *env, jstring string)
+jsize _Jv_JNI_GetStringUTFLength(JNIEnv *env, jstring string)
{
- java_lang_String *s = (java_lang_String*) string;
+ java_lang_String *s;
+ s4 length;
STATISTICS(jniinvokation());
- return (jsize) u2_utflength(s->value->data, s->count);
+ s = (java_lang_String *) string;
+
+ length = u2_utflength(s->value->data, s->count);
+
+ return length;
}
jobjectArray _Jv_JNI_NewObjectArray(JNIEnv *env, jsize length,
jclass elementClass, jobject initialElement)
{
- java_objectarray *oa;
- s4 i;
+ classinfo *c;
+ java_objectheader *o;
+ java_objectarray *oa;
+ s4 i;
STATISTICS(jniinvokation());
+ c = (classinfo *) elementClass;
+ o = (java_objectheader *) initialElement;
+
if (length < 0) {
exceptions_throw_negativearraysizeexception();
return NULL;
}
- oa = builtin_anewarray(length, elementClass);
+ oa = builtin_anewarray(length, c);
if (oa == NULL)
return NULL;
/* set all elements to initialElement */
for (i = 0; i < length; i++)
- oa->data[i] = initialElement;
+ oa->data[i] = o;
return (jobjectArray) _Jv_JNI_NewLocalRef(env, (jobject) oa);
}
jobject _Jv_JNI_GetObjectArrayElement(JNIEnv *env, jobjectArray array,
jsize index)
{
- java_objectarray *oa;
- jobject o;
+ java_objectarray *oa;
+ java_objectheader *o;
STATISTICS(jniinvokation());
o = oa->data[index];
- return _Jv_JNI_NewLocalRef(env, o);
+ return _Jv_JNI_NewLocalRef(env, (jobject) o);
}
if (!builtin_canstore(oa, o))
return;
- oa->data[index] = val;
+ oa->data[index] = o;
}
*******************************************************************************/
void _Jv_JNI_SetBooleanArrayRegion(JNIEnv *env, jbooleanArray array,
- jsize start, jsize len, jboolean *buf)
+ jsize start, jsize len, const jboolean *buf)
{
java_booleanarray *ba;
void _Jv_JNI_SetByteArrayRegion(JNIEnv *env, jbyteArray array, jsize start,
- jsize len, jbyte *buf)
+ jsize len, const jbyte *buf)
{
java_bytearray *ba;
void _Jv_JNI_SetCharArrayRegion(JNIEnv *env, jcharArray array, jsize start,
- jsize len, jchar *buf)
+ jsize len, const jchar *buf)
{
java_chararray *ca;
void _Jv_JNI_SetShortArrayRegion(JNIEnv *env, jshortArray array, jsize start,
- jsize len, jshort *buf)
+ jsize len, const jshort *buf)
{
java_shortarray *sa;
void _Jv_JNI_SetIntArrayRegion(JNIEnv *env, jintArray array, jsize start,
- jsize len, jint *buf)
+ jsize len, const jint *buf)
{
java_intarray *ia;
void _Jv_JNI_SetLongArrayRegion(JNIEnv* env, jlongArray array, jsize start,
- jsize len, jlong *buf)
+ jsize len, const jlong *buf)
{
java_longarray *la;
void _Jv_JNI_SetFloatArrayRegion(JNIEnv *env, jfloatArray array, jsize start,
- jsize len, jfloat *buf)
+ jsize len, const jfloat *buf)
{
java_floatarray *fa;
void _Jv_JNI_SetDoubleArrayRegion(JNIEnv *env, jdoubleArray array, jsize start,
- jsize len, jdouble *buf)
+ jsize len, const jdouble *buf)
{
java_doublearray *da;
jint _Jv_JNI_RegisterNatives(JNIEnv *env, jclass clazz,
const JNINativeMethod *methods, jint nMethods)
{
+ classinfo *c;
+
STATISTICS(jniinvokation());
- log_text("JNI-Call: RegisterNatives: IMPLEMENT ME!!!");
+ c = (classinfo *) clazz;
+
/* XXX: if implemented this needs a call to jvmti_NativeMethodBind
if (jvmti) jvmti_NativeMethodBind(method, address, new_address_ptr);
*/
+ native_method_register(c->name, methods, nMethods);
+
return 0;
}
}
+/* GetStringUTFRegion **********************************************************
+
+ Translates len number of Unicode characters beginning at offset
+ start into UTF-8 format and place the result in the given buffer
+ buf.
+
+ Throws StringIndexOutOfBoundsException on index overflow.
+
+*******************************************************************************/
+
void _Jv_JNI_GetStringUTFRegion(JNIEnv* env, jstring str, jsize start,
jsize len, char *buf)
{
+ java_lang_String *s;
+ java_chararray *ca;
+ s4 i;
+
STATISTICS(jniinvokation());
- log_text("JNI-Call: GetStringUTFRegion: IMPLEMENT ME!");
+ s = (java_lang_String *) str;
+ ca = s->value;
+
+ if ((start < 0) || (len < 0) || (start > s->count) ||
+ (start + len > s->count)) {
+ exceptions_throw_stringindexoutofboundsexception();
+ return;
+ }
+
+ /* XXX not sure if this is correct */
+
+ for (i = 0; i < len; i++)
+ buf[i] = ca->data[start + i];
+
+ buf[i] = '\0';
}
/* do the same as Kaffe does */
- bp = _Jv_JNI_GetByteArrayElements(env, ba, isCopy);
+ bp = _Jv_JNI_GetByteArrayElements(env, (jbyteArray) ba, isCopy);
return (void *) bp;
}
hashtable_global_ref_entry *gre;
u4 key; /* hashkey */
u4 slot; /* slot in hashtable */
+ java_objectheader *o;
STATISTICS(jniinvokation());
+ o = (java_objectheader *) obj;
+
LOCK_MONITOR_ENTER(hashtable_global_ref->header);
/* normally addresses are aligned to 4, 8 or 16 bytes */
/* search external hash chain for the entry */
while (gre) {
- if (gre->o == obj) {
+ if (gre->o == o) {
/* global object found, increment the reference */
gre->refs++;
gc_reference_register(&(gre->o));
#endif
- gre->o = obj;
+ gre->o = o;
gre->refs = 1;
/* insert entry into hashtable */
hashtable_global_ref_entry *prevgre;
u4 key; /* hashkey */
u4 slot; /* slot in hashtable */
+ java_objectheader *o;
STATISTICS(jniinvokation());
+ o = (java_objectheader *) globalRef;
+
LOCK_MONITOR_ENTER(hashtable_global_ref->header);
/* normally addresses are aligned to 4, 8 or 16 bytes */
/* search external hash chain for the entry */
while (gre) {
- if (gre->o == globalRef) {
+ if (gre->o == o) {
/* global object found, decrement the reference count */
gre->refs--;
jobject _Jv_JNI_NewDirectByteBuffer(JNIEnv *env, void *address, jlong capacity)
{
-#if defined(ENABLE_JAVASE)
+#if defined(ENABLE_JAVASE) && defined(WITH_CLASSPATH_GNU)
java_objectheader *nbuf;
+
# if SIZEOF_VOID_P == 8
gnu_classpath_Pointer64 *paddress;
# else
void *_Jv_JNI_GetDirectBufferAddress(JNIEnv *env, jobject buf)
{
-#if defined(ENABLE_JAVASE)
+#if defined(ENABLE_JAVASE) && defined(WITH_CLASSPATH_GNU)
java_nio_DirectByteBufferImpl *nbuf;
# if SIZEOF_VOID_P == 8
gnu_classpath_Pointer64 *address;
jlong _Jv_JNI_GetDirectBufferCapacity(JNIEnv* env, jobject buf)
{
-#if defined(ENABLE_JAVASE)
- java_nio_Buffer *nbuf;
+#if defined(ENABLE_JAVASE) && defined(WITH_CLASSPATH_GNU)
+ java_objectheader *o;
+ java_nio_Buffer *nbuf;
STATISTICS(jniinvokation());
- if (!builtin_instanceof(buf, class_java_nio_DirectByteBufferImpl))
+ o = (java_objectheader *) buf;
+
+ if (!builtin_instanceof(o, class_java_nio_DirectByteBufferImpl))
return -1;
- nbuf = (java_nio_Buffer *) buf;
+ nbuf = (java_nio_Buffer *) o;
return (jlong) nbuf->cap;
#else
/* JNI invocation table *******************************************************/
-const struct JNIInvokeInterface _Jv_JNIInvokeInterface = {
+const struct JNIInvokeInterface_ _Jv_JNIInvokeInterface = {
NULL,
NULL,
NULL,
/* JNI function table *********************************************************/
-struct JNINativeInterface _Jv_JNINativeInterface = {
+struct JNINativeInterface_ _Jv_JNINativeInterface = {
NULL,
NULL,
NULL,
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: jni.h 7921 2007-05-20 23:14:11Z michi $
+ $Id: jni.h 8132 2007-06-22 11:15:47Z twisti $
*/
#include "config.h"
-#include CLASSPATH_JNI_H
+/* XXX quick hack to not include GCJ's jni_md.h */
+#define __GCJ_JNI_MD_H__
+#include CLASSPATH_JNI_MD_H
+#include CLASSPATH_JNI_H
#ifndef _JNI_H
#define _JNI_H
typedef struct _Jv_JNIEnv _Jv_JNIEnv;
struct _Jv_JNIEnv {
- const struct JNINativeInterface *env; /* This MUST be the first entry */
+ const struct JNINativeInterface_ *env; /* This MUST be the first entry */
};
typedef struct _Jv_JavaVM _Jv_JavaVM;
struct _Jv_JavaVM {
- const struct JNIInvokeInterface *functions;/* This MUST be the first entry*/
+ const struct JNIInvokeInterface_ *functions;/*This MUST be the first entry*/
/* JVM instance-specific variables */
/* CACAO related stuff ********************************************************/
-extern const struct JNIInvokeInterface _Jv_JNIInvokeInterface;
-extern struct JNINativeInterface _Jv_JNINativeInterface;
+extern const struct JNIInvokeInterface_ _Jv_JNIInvokeInterface;
+extern struct JNINativeInterface_ _Jv_JNINativeInterface;
/* local reference table ******************************************************/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: native.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: native.c 8137 2007-06-22 16:41:36Z michi $
*/
# include <ltdl.h>
#endif
+#include <stdint.h>
+
#include "vm/types.h"
#include "mm/memory.h"
tree_native_methods = avl_create(&native_tree_native_methods_comparator);
- /* register the intern native functions */
-
- if (!nativevm_init())
- return false;
-
/* everything's ok */
return true;
*******************************************************************************/
-void native_method_register(utf *classname, JNINativeMethod *methods, s4 count)
+void native_method_register(utf *classname, const JNINativeMethod *methods,
+ int32_t count)
{
native_methods_node_t *nmn;
utf *name;
utf *descriptor;
- s4 i;
+ int32_t i;
/* insert all methods passed */
{
lt_dlhandle handle;
+ if (opt_verbosejni) {
+ printf("[Loading native library ");
+ utf_display_printable_ascii(filename);
+ printf(" ... ");
+ }
+
/* try to open the library */
handle = lt_dlopen(filename->text);
functionptr native_resolve_function(methodinfo *m)
{
+ java_objectheader *cl;
utf *name;
utf *newname;
functionptr f;
hashtable_library_name_entry *ne;
u4 key; /* hashkey */
u4 slot; /* slot in hashtable */
+#if defined(WITH_CLASSPATH_SUN)
+ methodinfo *method_findNative;
+ java_objectheader *s;
+#endif
+
+ cl = m->class->classloader;
/* verbose output */
/* normally addresses are aligned to 4, 8 or 16 bytes */
- key = ((u4) (ptrint) m->class->classloader) >> 4; /* align to 16-byte */
+ key = ((u4) (ptrint) cl) >> 4; /* align to 16-byte */
slot = key & (hashtable_library->size - 1);
le = hashtable_library->ptr[slot];
le = le->hashlink;
}
+#if defined(WITH_CLASSPATH_SUN)
+ if (f == NULL) {
+ /* We can resolve the function directly from
+ java.lang.ClassLoader as it's a static function. */
+ /* XXX should be done in native_init */
+
+ method_findNative =
+ class_resolveclassmethod(class_java_lang_ClassLoader,
+ utf_findNative,
+ utf_java_lang_ClassLoader_java_lang_String__J,
+ class_java_lang_ClassLoader,
+ true);
+
+ if (method_findNative == NULL)
+ return NULL;
+
+ /* try the normal name */
+
+ s = javastring_new(name);
+
+ f = (functionptr) (intptr_t) vm_call_method_long(method_findNative,
+ NULL, cl, s);
+
+ /* if not found, try the mangled name */
+
+ if (f == NULL) {
+ s = javastring_new(newname);
+
+ f = (functionptr) (intptr_t) vm_call_method_long(method_findNative,
+ NULL, cl, s);
+ }
+ }
+#endif
+
if (f != NULL)
if (opt_verbosejni)
printf("JNI ]\n");
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: native.h 8123 2007-06-20 23:50:55Z michi $
+ $Id: native.h 8137 2007-06-22 16:41:36Z michi $
*/
# include <ltdl.h>
#endif
+#include <stdint.h>
+
#include "native/jni.h"
#include "vm/global.h"
bool native_init(void);
-void native_method_register(utf *classname, JNINativeMethod *methods, s4 count);
+void native_method_register(utf *classname, const JNINativeMethod *methods,
+ int32_t count);
#if defined(WITH_STATIC_CLASSPATH)
DIST_SUBDIRS = \
cldc1.1 \
- gnu
+ gnu \
+ sun
if WITH_CLASSPATH_CLDC1_1
SUBDIRS = \
gnu/libnativevmcore.la
endif
+if WITH_CLASSPATH_SUN
+SUBDIRS = \
+ sun
+
+NATIVEVM_LIB = \
+ sun/libnativevmcore.la
+endif
+
if ENABLE_JAVASE
CLASSLOADER_SOURCES = \
java_lang_ClassLoader.c \
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_reflect_Field.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: java_lang_reflect_Field.c 8132 2007-06-22 11:15:47Z twisti $
*/
classinfo *c;
fieldinfo *f;
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* check field access */
classinfo *c;
fieldinfo *f;
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &(c->fields[this->slot]);
return f->flags;
typedesc *desc;
classinfo *ret;
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
desc = c->fields[this->slot].parseddesc;
if (desc == NULL)
fieldinfo *f;
void *addr;
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get address of the source field value */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- dc = (classinfo *) this->declaringClass;
+ dc = (classinfo *) this->clazz;
df = &dc->fields[this->slot];
/* get the address of the destination field */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
/* get the address of the field with an internal helper */
/* get the class and the field */
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
f = &c->fields[this->slot];
if (f->signature == NULL)
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_reflect_Method.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: java_lang_reflect_Method.c 8132 2007-06-22 11:15:47Z twisti $
*/
classinfo *c;
methodinfo *m;
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
m = &(c->methods[this->slot]);
return m->flags;
methodinfo *m;
classinfo *result;
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
m = &(c->methods[this->slot]);
result = method_returntype_get(m);
classinfo *c;
methodinfo *m;
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
m = &(c->methods[this->slot]);
return method_get_parametertypearray(m);
classinfo *c;
methodinfo *m;
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
m = &(c->methods[this->slot]);
return method_get_exceptionarray(m);
* Method: invokeNative
* Signature: (Ljava/lang/Object;[Ljava/lang/Object;Ljava/lang/Class;I)Ljava/lang/Object;
*/
-JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Method_invokeNative(JNIEnv *env, java_lang_reflect_Method *this, java_lang_Object *o, java_objectarray *args, java_lang_Class *declaringClass, s4 slot)
+JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Method_invokeNative(JNIEnv *env, java_lang_reflect_Method *this, java_lang_Object *o, java_objectarray *args, java_lang_Class *clazz, s4 slot)
{
/* just to be sure */
- assert(this->declaringClass == declaringClass);
+ assert(this->clazz == clazz);
assert(this->slot == slot);
return _Jv_java_lang_reflect_Method_invoke(this, o, args);
methodinfo *m;
java_objectheader *o;
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
m = &(c->methods[this->slot]);
if (m->signature == NULL)
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_Class.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: java_lang_Class.c 8137 2007-06-22 16:41:36Z michi $
*/
#include "native/jni.h"
#include "native/native.h"
-#if defined(ENABLE_JAVAME_CLDC1_1)
-# include "native/include/java_lang_String.h"/* required by java_lang_Class.h */
+/* keep this order of the native includes */
+
+#include "native/include/java_lang_String.h"
+
+#if defined(ENABLE_JAVASE)
+# if defined(WITH_CLASSPATH_SUN)
+# include "native/include/java_nio_ByteBuffer.h" /* required by j.l.CL */
+# endif
+# include "native/include/java_lang_ClassLoader.h"
#endif
-#include "native/include/java_lang_Class.h"
#include "native/include/java_lang_Object.h"
+#include "native/include/java_lang_Class.h"
#if defined(ENABLE_JAVASE)
-# include "native/include/java_lang_ClassLoader.h"
# include "native/include/java_lang_reflect_Constructor.h"
# include "native/include/java_lang_reflect_Field.h"
# include "native/include/java_lang_reflect_Method.h"
#endif
#include "native/vm/java_lang_Class.h"
+#include "native/vm/java_lang_String.h"
#include "toolbox/logging.h"
rf = (java_lang_reflect_Field *) o;
- rf->declaringClass = (java_lang_Class *) c;
- rf->name = (java_lang_String *) javastring_new(f->name);
+#if defined(WITH_CLASSPATH_GNU)
+
+ rf->clazz = (java_lang_Class *) c;
+
+ /* The name needs to be interned */
+ /* XXX implement me better! */
+
+ rf->name = _Jv_java_lang_String_intern((java_lang_String *) javastring_new(f->name));
+ rf->slot = i;
+
+#elif defined(WITH_CLASSPATH_SUN)
+
+ rf->clazz = (java_lang_Class *) c;
+
+ /* The name needs to be interned */
+ /* XXX implement me better! */
+
+ rf->name = _Jv_java_lang_String_intern((java_lang_String *) javastring_new(f->name));
+ rf->type = (java_lang_Class *) field_get_type(f);
+ rf->modifiers = f->flags;
rf->slot = i;
+ rf->signature = f->signature ? (java_lang_String *) javastring_new(f->signature) : NULL;
+ rf->annotations = NULL;
+#else
+# error unknown classpath configuration
+#endif
/* store object into array */
rm = (java_lang_reflect_Method *) o;
- rm->declaringClass = (java_lang_Class *) m->class;
- rm->name = (java_lang_String *) javastring_new(m->name);
- rm->slot = i;
+#if defined(WITH_CLASSPATH_GNU)
+
+ rm->clazz = (java_lang_Class *) m->class;
+
+ /* The name needs to be interned */
+ /* XXX implement me better! */
+
+ rm->name = _Jv_java_lang_String_intern((java_lang_String *) javastring_new(m->name));
+ rm->slot = i;
+
+#elif defined(WITH_CLASSPATH_SUN)
+
+ rm->clazz = (java_lang_Class *) m->class;
+
+ /* The name needs to be interned */
+ /* XXX implement me better! */
+
+ rm->name = _Jv_java_lang_String_intern((java_lang_String *) javastring_new(m->name));
+ rm->parameterTypes = method_get_parametertypearray(m);
+ rm->returnType = (java_lang_Class *) method_returntype_get(m);
+ rm->exceptionTypes = method_get_exceptionarray(m);
+ rm->modifiers = m->flags & ACC_CLASS_REFLECT_MASK;
+ rm->slot = i;
+ rm->signature = m->signature ? (java_lang_String *) javastring_new(m->signature) : NULL;
+ rm->annotations = NULL;
+ rm->parameterAnnotations = NULL;
+ rm->annotationDefault = NULL;
+
+#else
+# error unknown classpath configuration
+#endif
/* store object into array */
rc = (java_lang_reflect_Constructor *) o;
- rc->clazz = (java_lang_Class *) c;
- rc->slot = i;
+#if defined(WITH_CLASSPATH_GNU)
+
+ rc->clazz = (java_lang_Class *) c;
+ rc->slot = i;
+
+#elif defined(WITH_CLASSPATH_SUN)
+
+ rc->clazz = (java_lang_Class *) c;
+ rc->parameterTypes = method_get_parametertypearray(m);
+ rc->exceptionTypes = method_get_exceptionarray(m);
+ rc->modifiers = m->flags & ACC_CLASS_REFLECT_MASK;
+ rc->slot = i;
+ rc->signature = m->signature ? (java_lang_String *) javastring_new(m->signature) : NULL;
+ rc->annotations = NULL;
+ rc->parameterAnnotations = NULL;
+
+#else
+# error unknown classpath configuration
+#endif
/* store object into array */
rm = (java_lang_reflect_Method *) o;
- rm->declaringClass = (java_lang_Class *) m->class;
+#if defined(WITH_CLASSPATH_GNU)
+ rm->clazz = (java_lang_Class *) m->class;
+#elif defined(WITH_CLASSPATH_SUN)
+ rm->clazz = (java_lang_Class *) m->class;
+#else
+# error unknown classpath configuration
+#endif
+
rm->name = (java_lang_String *) javastring_new(m->name);
rm->slot = m - m->class->methods; /* calculate method slot */
#include "native/jni.h"
+/* keep this order of the native includes */
+
#include "native/include/java_lang_Object.h"
#if defined(ENABLE_JAVASE)
-# include "native/include/java_lang_String.h"/* required by java_lang_Class.h */
+# include "native/include/java_lang_String.h" /* required by j.l.C */
+
+# if defined(WITH_CLASSPATH_SUN)
+# include "native/include/java_nio_ByteBuffer.h" /* required by j.l.CL */
+# endif
+
+# include "native/include/java_lang_ClassLoader.h" /* required by j.l.C */
# include "native/include/java_lang_Class.h"
-# include "native/include/java_lang_ClassLoader.h"
# include "native/include/java_security_ProtectionDomain.h"
#endif
classinfo *c;
classloader *loader;
java_lang_Class *o;
+
#if defined(ENABLE_JVMTI)
jint new_class_data_len = 0;
unsigned char* new_class_data = NULL;
if (c == NULL)
return NULL;
- /* set ProtectionDomain */
+ /* for convenience */
o = (java_lang_Class *) c;
+#if defined(WITH_CLASSPATH_GNU)
+ /* set ProtectionDomain */
+
o->pd = pd;
+#endif
return o;
}
#include "native/jni.h"
-#if defined(ENABLE_JAVAME_CLDC1_1)
-# include "native/include/java_lang_String.h"/* required by java_lang_Class.h */
-#endif
-
-#include "native/include/java_lang_Class.h"
+#include "native/include/java_lang_Object.h"
+#include "native/include/java_lang_String.h" /* required by j.l.CL */
#if defined(ENABLE_JAVASE)
+# if defined(WITH_CLASSPATH_SUN)
+# include "native/include/java_nio_ByteBuffer.h" /* required by j.l.CL */
+# endif
+
+# include "native/include/java_lang_ClassLoader.h" /* required by j.l.C */
# include "native/include/java_lang_Cloneable.h"
#endif
-#include "native/include/java_lang_Object.h"
+#include "native/include/java_lang_Class.h"
#include "threads/lock-common.h"
#include "vm/builtin.h"
+#include "vm/exceptions.h"
#include "vmcore/options.h"
*/
java_lang_Class *_Jv_java_lang_Object_getClass(java_lang_Object *obj)
{
- classinfo *c;
+ java_objectheader *o;
+ classinfo *c;
+
+ o = (java_objectheader *) obj;
- if (obj == NULL)
+ if (o == NULL) {
+ exceptions_throw_nullpointerexception();
return NULL;
+ }
- c = ((java_objectheader *) obj)->vftbl->class;
+ c = o->vftbl->class;
return (java_lang_Class *) c;
}
#include "native/jni.h"
-#include "native/include/java_lang_Class.h"
-
#if defined(ENABLE_JAVASE)
+# include "native/include/java_lang_String.h" /* required by j.l.CL */
+
+# if defined(WITH_CLASSPATH_SUN)
+# include "native/include/java_nio_ByteBuffer.h" /* required by j.l.CL */
+# endif
+
+# include "native/include/java_lang_ClassLoader.h" /* required by j.l.C */
# include "native/include/java_lang_Cloneable.h"
#endif
+#include "native/include/java_lang_Class.h"
+
#include "native/include/java_lang_Object.h"
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: java_lang_Thread.c 7833 2007-04-26 13:07:05Z twisti $
+ $Id: java_lang_Thread.c 8132 2007-06-22 11:15:47Z twisti $
*/
#if defined(ENABLE_JAVASE)
# include "native/include/java_lang_ThreadGroup.h"
-# include "native/include/java_lang_VMThread.h"
+
+# if defined(WITH_CLASSPATH_GNU)
+# include "native/include/java_lang_VMThread.h"
+# endif
#endif
#include "threads/lock-common.h"
s4 _Jv_java_lang_Thread_isAlive(java_lang_Thread *this)
{
#if defined(ENABLE_THREADS)
- threadobject *thread;
+ threadobject *t;
-#if defined(WITH_CLASSPATH_GNU)
- thread = (threadobject *) this->vmThread->vmdata;
-#elif defined(WITH_CLASSPATH_CLDC1_1)
- thread = (threadobject *) this->vm_thread;
-#endif
+# if defined(WITH_CLASSPATH_GNU)
+ t = (threadobject *) this->vmThread->vmdata;
+# elif defined(WITH_CLASSPATH_SUN)
+ /* XXX this is just a quick hack */
- return threads_thread_is_alive(thread);
+ for (t = threads_list_first(); t != NULL; t = threads_list_next(t)) {
+ if (t->object == this)
+ break;
+ }
+
+ /* The threadobject is null when a thread is created in Java. The
+ priority is set later during startup. */
+
+ if (t == NULL)
+ return 0;
+# elif defined(WITH_CLASSPATH_CLDC1_1)
+ t = (threadobject *) this->vm_thread;
+# else
+# error unknown classpath configuration
+# endif
+
+ return threads_thread_is_alive(t);
#else
/* if threads are disabled, the only thread running is alive */
s4 _Jv_java_lang_Thread_isInterrupted(java_lang_Thread *this)
{
#if defined(ENABLE_THREADS)
- threadobject *thread;
+ threadobject *t;
-#if defined(WITH_CLASSPATH_GNU)
- thread = (threadobject *) this->vmThread->vmdata;
-#elif defined(WITH_CLASSPATH_CLDC1_1)
- thread = (threadobject *) this->vm_thread;
-#endif
+# if defined(WITH_CLASSPATH_GNU)
+ t = (threadobject *) this->vmThread->vmdata;
+# elif defined(WITH_CLASSPATH_SUN)
+ /* XXX this is just a quick hack */
+
+ for (t = threads_list_first(); t != NULL; t = threads_list_next(t)) {
+ if (t->object == this)
+ break;
+ }
+# elif defined(WITH_CLASSPATH_CLDC1_1)
+ t = (threadobject *) this->vm_thread;
+# else
+# error unknown classpath configuration
+# endif
- return threads_thread_has_been_interrupted(thread);
+ return threads_thread_has_been_interrupted(t);
#else
return 0;
#endif
void _Jv_java_lang_Thread_setPriority(java_lang_Thread *this, s4 priority)
{
#if defined(ENABLE_THREADS)
- threadobject *thread;
+ threadobject *t;
-#if defined(WITH_CLASSPATH_GNU)
- thread = (threadobject *) this->vmThread->vmdata;
-#elif defined(WITH_CLASSPATH_CLDC1_1)
- thread = (threadobject *) this->vm_thread;
+# if defined(WITH_CLASSPATH_GNU)
+ t = (threadobject *) this->vmThread->vmdata;
+# elif defined(WITH_CLASSPATH_SUN)
+ /* XXX this is just a quick hack */
+
+ for (t = threads_list_first(); t != NULL; t = threads_list_next(t)) {
+ if (t->object == this)
+ break;
+ }
/* The threadobject is null when a thread is created in Java. The
priority is set later during startup. */
- if (thread == NULL)
+ if (t == NULL)
return;
-#endif
+# elif defined(WITH_CLASSPATH_CLDC1_1)
+ t = (threadobject *) this->vm_thread;
+
+ /* The threadobject is null when a thread is created in Java. The
+ priority is set later during startup. */
+
+ if (t == NULL)
+ return;
+# else
+# error unknown classpath configuration
+# endif
- threads_set_thread_priority(thread->tid, priority);
+ threads_set_thread_priority(t->tid, priority);
#endif
}
{
classinfo *c;
methodinfo *m;
+ s4 override;
- c = (classinfo *) this->declaringClass;
+ c = (classinfo *) this->clazz;
m = &(c->methods[this->slot]);
/* check method access */
/* check if we should bypass security checks (AccessibleObject) */
- if (this->flag == false) {
+#if defined(WITH_CLASSPATH_GNU)
+ override = this->flag;
+#elif defined(WITH_CLASSPATH_SUN)
+ override = this->override;
+#else
+# error unknown classpath configuration
+#endif
+
+ if (override == false) {
if (!access_check_method(m, 1))
return NULL;
}
/* call the Java method via a helper function */
- return (java_lang_Object *) _Jv_jni_invokeNative(m, (jobject) o, args);
+ return (java_lang_Object *) _Jv_jni_invokeNative(m, (java_objectheader *) o, args);
}
#include "native/vm/nativevm.h"
+#include "vmcore/method.h"
-/* nativevm_init ***************************************************************
+#if defined(WITH_CLASSPATH_SUN)
+# include "native/native.h"
- Initialize the implementation specific native stuff.
+# include "vm/vm.h"
+
+# include "vmcore/class.h"
+# include "vmcore/utf8.h"
+#endif
+
+
+/* nativevm_preinit ************************************************************
+
+ Pre-initialize the implementation specific native stuff.
*******************************************************************************/
-bool nativevm_init(void)
+bool nativevm_preinit(void)
{
/* register native methods of all classes implemented */
_Jv_java_util_concurrent_atomic_AtomicLong_init();
_Jv_sun_misc_Unsafe_init();
+# elif defined(WITH_CLASSPATH_SUN)
+
+ utf *u;
+ lt_dlhandle handle;
+
+ u = utf_new_char(CLASSPATH_LIBDIR"/libjava.so");
+
+ handle = native_library_open(u);
+ native_library_add(u, NULL, handle);
+
+ _Jv_sun_misc_Unsafe_init();
+
# else
# error unknown classpath configuration
}
+/* nativevm_init ***************************************************************
+
+ Initialize the implementation specific native stuff.
+
+*******************************************************************************/
+
+bool nativevm_init(void)
+{
+#if defined(ENABLE_JAVASE)
+
+# if defined(WITH_CLASSPATH_GNU)
+
+ /* nothing to do */
+
+# elif defined(WITH_CLASSPATH_SUN)
+
+ methodinfo *m;
+
+ m = class_resolveclassmethod(class_java_lang_System,
+ utf_new_char("initializeSystemClass"),
+ utf_void__void,
+ class_java_lang_Object,
+ false);
+
+ if (m == NULL)
+ return false;
+
+ (void) vm_call_method(m, NULL);
+
+# else
+
+# error unknown classpath configuration
+
+# endif
+
+#elif defined(ENABLE_JAVAME_CLDC1_1)
+
+ /* nothing to do */
+
+#else
+
+# error unknown Java configuration
+
+#endif
+
+ /* everything's ok */
+
+ return true;
+}
+
+
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
/* function prototypes ********************************************************/
+bool nativevm_preinit(void);
bool nativevm_init(void);
#if defined(ENABLE_JAVASE)
void _Jv_java_util_concurrent_atomic_AtomicLong_init();
void _Jv_sun_misc_Unsafe_init();
+# elif defined(WITH_CLASSPATH_SUN)
+
+void _Jv_sun_misc_Unsafe_init();
+
# else
# error unknown classpath configuration
#include <stdint.h>
+#include "mm/memory.h"
+
#include "native/jni.h"
#include "native/native.h"
-#include "native/include/java_lang_Object.h"
+#include "native/include/java_lang_Object.h" /* before c.l.C */
+#include "native/include/java_lang_String.h" /* required by j.l.CL */
+
+#if defined(WITH_CLASSPATH_SUN)
+# include "native/include/java_nio_ByteBuffer.h" /* required by j.l.CL */
+#endif
+
+#include "native/include/java_lang_ClassLoader.h" /* required by j.l.C */
+#include "native/include/java_lang_Class.h"
#include "native/include/java_lang_reflect_Field.h"
#include "native/include/java_lang_Thread.h" /* required by s.m.U */
+#include "native/include/java_lang_Throwable.h"
+
+#if defined(WITH_CLASSPATH_SUN)
+# include "native/include/java_security_ProtectionDomain.h" /* required by smU*/
+#endif
#include "native/include/sun_misc_Unsafe.h"
+#include "vm/exceptions.h"
+#include "vm/initialize.h"
+
#include "vmcore/utf8.h"
/* native methods implemented by this file ************************************/
static JNINativeMethod methods[] = {
- { "objectFieldOffset", "(Ljava/lang/reflect/Field;)J", (void *) (intptr_t) &Java_sun_misc_Unsafe_objectFieldOffset },
- { "compareAndSwapInt", "(Ljava/lang/Object;JII)Z", (void *) (intptr_t) &Java_sun_misc_Unsafe_compareAndSwapInt },
-#if 0
- { "compareAndSwapLong", "(Ljava/lang/Object;JJJ)Z", (void *) (intptr_t) &Java_sun_misc_Unsafe_compareAndSwapLong },
- { "compareAndSwapObject", "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", (void *) (intptr_t) &Java_sun_misc_Unsafe_compareAndSwapObject },
- { "putOrderedInt", "(Ljava/lang/Object;JI)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putOrderedInt },
- { "putOrderedLong", "(Ljava/lang/Object;JJ)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putOrderedLong },
- { "putOrderedObject", "(Ljava/lang/Object;JLjava/lang/Object;)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putOrderedObject },
- { "putIntVolatile", "(Ljava/lang/Object;JI)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putIntVolatile },
- { "getIntVolatile", "(Ljava/lang/Object;J)I", (void *) (intptr_t) &Java_sun_misc_Unsafe_getIntVolatile },
- { "putLongVolatile", "(Ljava/lang/Object;JJ)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putLongVolatile },
- { "putLong", "(Ljava/lang/Object;JJ)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putLong },
- { "getLongVolatile", "(Ljava/lang/Object;J)J", (void *) (intptr_t) &Java_sun_misc_Unsafe_getLongVolatile },
- { "getLong", "(Ljava/lang/Object;J)J", (void *) (intptr_t) &Java_sun_misc_Unsafe_getLong },
- { "putObjectVolatile", "(Ljava/lang/Object;JLjava/lang/Object;)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putObjectVolatile },
- { "putObject", "(Ljava/lang/Object;JLjava/lang/Object;)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putObject },
- { "getObjectVolatile", "(Ljava/lang/Object;J)Ljava/lang/Object;", (void *) (intptr_t) &Java_sun_misc_Unsafe_getObjectVolatile },
- { "arrayBaseOffset", "(Ljava/lang/Class;)I", (void *) (intptr_t) &Java_sun_misc_Unsafe_arrayBaseOffset },
- { "arrayIndexScale", "(Ljava/lang/Class;)I", (void *) (intptr_t) &Java_sun_misc_Unsafe_arrayIndexScale },
- { "unpark", "(Ljava/lang/Thread;)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_unpark },
- { "park", "(ZJ)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_park },
-#endif
+ { "registerNatives", "()V", (void *) (intptr_t) &Java_sun_misc_Unsafe_registerNatives },
+ { "getInt", "(Ljava/lang/Object;J)I", (void *) (intptr_t) &Java_sun_misc_Unsafe_getInt__Ljava_lang_Object_2J },
+ { "getBoolean", "(Ljava/lang/Object;J)Z", (void *) (intptr_t) &Java_sun_misc_Unsafe_getBoolean },
+ { "putBoolean", "(Ljava/lang/Object;JZ)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putBoolean },
+ { "getByte", "(Ljava/lang/Object;J)B", (void *) (intptr_t) &Java_sun_misc_Unsafe_getByte__Ljava_lang_Object_2J },
+ { "putByte", "(Ljava/lang/Object;JB)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putByte__Ljava_lang_Object_2JB },
+ { "getChar", "(Ljava/lang/Object;J)C", (void *) (intptr_t) &Java_sun_misc_Unsafe_getChar__Ljava_lang_Object_2J },
+ { "putChar", "(Ljava/lang/Object;JC)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putChar__Ljava_lang_Object_2JC },
+ { "getByte", "(J)B", (void *) (intptr_t) &Java_sun_misc_Unsafe_getByte__J },
+ { "getInt", "(J)I", (void *) (intptr_t) &Java_sun_misc_Unsafe_getInt__J },
+ { "getLong", "(J)J", (void *) (intptr_t) &Java_sun_misc_Unsafe_getLong__J },
+ { "putLong", "(JJ)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_putLong__JJ },
+ { "objectFieldOffset", "(Ljava/lang/reflect/Field;)J", (void *) (intptr_t) &Java_sun_misc_Unsafe_objectFieldOffset },
+ { "allocateMemory", "(J)J", (void *) (intptr_t) &Java_sun_misc_Unsafe_allocateMemory },
+ { "freeMemory", "(J)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_freeMemory },
+ { "staticFieldOffset", "(Ljava/lang/reflect/Field;)J", (void *) (intptr_t) &Java_sun_misc_Unsafe_staticFieldOffset },
+ { "staticFieldBase", "(Ljava/lang/reflect/Field;)Ljava/lang/Object;", (void *) (intptr_t) &Java_sun_misc_Unsafe_staticFieldBase },
+ { "ensureClassInitialized", "(Ljava/lang/Class;)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_ensureClassInitialized },
+ { "arrayBaseOffset", "(Ljava/lang/Class;)I", (void *) (intptr_t) &Java_sun_misc_Unsafe_arrayBaseOffset },
+ { "arrayIndexScale", "(Ljava/lang/Class;)I", (void *) (intptr_t) &Java_sun_misc_Unsafe_arrayIndexScale },
+ { "addressSize", "()I", (void *) (intptr_t) &Java_sun_misc_Unsafe_addressSize },
+ { "throwException", "(Ljava/lang/Throwable;)V", (void *) (intptr_t) &Java_sun_misc_Unsafe_throwException },
+ { "compareAndSwapObject", "(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z", (void *) (intptr_t) &Java_sun_misc_Unsafe_compareAndSwapObject },
+ { "compareAndSwapInt", "(Ljava/lang/Object;JII)Z", (void *) (intptr_t) &Java_sun_misc_Unsafe_compareAndSwapInt },
+ { "compareAndSwapLong", "(Ljava/lang/Object;JJJ)Z", (void *) (intptr_t) &Java_sun_misc_Unsafe_compareAndSwapLong },
+ { "getObjectVolatile", "(Ljava/lang/Object;J)Ljava/lang/Object;", (void *) (intptr_t) &Java_sun_misc_Unsafe_getObjectVolatile },
+ { "getIntVolatile", "(Ljava/lang/Object;J)I", (void *) (intptr_t) &Java_sun_misc_Unsafe_getIntVolatile },
};
/*
* Class: sun/misc/Unsafe
- * Method: objectFieldOffset
- * Signature: (Ljava/lang/reflect/Field;)J
+ * Method: registerNatives
+ * Signature: ()V
*/
-JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_objectFieldOffset(JNIEnv *env, sun_misc_Unsafe* this, java_lang_reflect_Field* field)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_registerNatives(JNIEnv *env, jclass clazz)
{
- classinfo *c;
- fieldinfo *f;
+ /* The native methods of this function are already registered in
+ _Jv_sun_misc_Unsafe_init() which is called during VM
+ startup. */
+}
- c = (classinfo *) field->declaringClass;
- f = &c->fields[field->slot];
- return (int64_t) f->offset;
+/*
+ * Class: sun/misc/Unsafe
+ * Method: getInt
+ * Signature: (Ljava/lang/Object;J)I
+ */
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getInt__Ljava_lang_Object_2J(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Object *o, int64_t offset)
+{
+ int32_t *p;
+ int32_t value;
+
+ p = (int32_t *) (((uint8_t *) o) + offset);
+
+ value = *p;
+
+ return value;
}
/*
* Class: sun/misc/Unsafe
- * Method: compareAndSwapInt
- * Signature: (Ljava/lang/Object;JII)Z
+ * Method: getBoolean
+ * Signature: (Ljava/lang/Object;J)Z
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapInt(JNIEnv *env, sun_misc_Unsafe* this, java_lang_Object* obj, int64_t offset, int32_t expect, int32_t update)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getBoolean(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Object *o, int64_t offset)
{
int32_t *p;
int32_t value;
- p = (int32_t *) (((u1 *) obj) + offset);
-
- /* XXX this should be atomic */
+ p = (int32_t *) (((uint8_t *) o) + offset);
value = *p;
- if (value == expect) {
- *p = update;
+ return value;
+}
- return true;
- }
- return false;
+/*
+ * Class: sun/misc/Unsafe
+ * Method: putBoolean
+ * Signature: (Ljava/lang/Object;JZ)V
+ */
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putBoolean(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Object *o, int64_t offset, int32_t x)
+{
+ int32_t *p;
+
+ p = (int32_t *) (((uint8_t *) o) + offset);
+
+ *p = x;
}
-#if 0
/*
* Class: sun/misc/Unsafe
- * Method: compareAndSwapLong
- * Signature: (Ljava/lang/Object;JJJ)Z
+ * Method: getByte
+ * Signature: (Ljava/lang/Object;J)B
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int64_t par3, int64_t par4)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getByte__Ljava_lang_Object_2J(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Object *o, int64_t offset)
{
+ int32_t *p;
+ int32_t value;
+
+ p = (int32_t *) (((uint8_t *) o) + offset);
+
+ value = *p;
+
+ return value;
}
/*
* Class: sun/misc/Unsafe
- * Method: compareAndSwapObject
- * Signature: (Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z
+ * Method: putByte
+ * Signature: (Ljava/lang/Object;JB)V
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, struct java_lang_Object* par3, struct java_lang_Object* par4)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putByte__Ljava_lang_Object_2JB(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Object *o, int64_t offset, int32_t x)
{
+ int32_t *p;
+
+ p = (int32_t *) (((uint8_t *) o) + offset);
+
+ *p = x;
}
/*
* Class: sun/misc/Unsafe
- * Method: putOrderedInt
- * Signature: (Ljava/lang/Object;JI)V
+ * Method: getChar
+ * Signature: (Ljava/lang/Object;J)C
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedInt(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int32_t par3)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getChar__Ljava_lang_Object_2J(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Object *o, int64_t offset)
{
+ int32_t *p;
+ int32_t value;
+
+ p = (int32_t *) (((uint8_t *) o) + offset);
+
+ value = *p;
+
+ return value;
}
/*
* Class: sun/misc/Unsafe
- * Method: putOrderedLong
- * Signature: (Ljava/lang/Object;JJ)V
+ * Method: putChar
+ * Signature: (Ljava/lang/Object;JC)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int64_t par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putChar__Ljava_lang_Object_2JC(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Object *o, int64_t offset, int32_t x)
{
+ int32_t *p;
+
+ p = (int32_t *) (((uint8_t *) o) + offset);
+
+ *p = x;
}
/*
* Class: sun/misc/Unsafe
- * Method: putOrderedObject
- * Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
+ * Method: getByte
+ * Signature: (J)B
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putOrderedObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, struct java_lang_Object* par3)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getByte__J(JNIEnv *env, sun_misc_Unsafe *this, int64_t address)
{
+ int8_t *p;
+ int8_t value;
+
+ p = (int8_t *) (intptr_t) address;
+
+ value = *p;
+
+ return (int32_t) value;
}
/*
* Class: sun/misc/Unsafe
- * Method: putIntVolatile
- * Signature: (Ljava/lang/Object;JI)V
+ * Method: getInt
+ * Signature: (J)I
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putIntVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int32_t par3)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getInt__J(JNIEnv *env, sun_misc_Unsafe *this, int64_t address)
{
+ int32_t *p;
+ int32_t value;
+
+ p = (int32_t *) (intptr_t) address;
+
+ value = *p;
+
+ return value;
}
/*
* Class: sun/misc/Unsafe
- * Method: getIntVolatile
- * Signature: (Ljava/lang/Object;J)I
+ * Method: getLong
+ * Signature: (J)J
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getIntVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2)
+JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_getLong__J(JNIEnv *env, sun_misc_Unsafe *this, int64_t address)
{
+ int64_t *p;
+ int64_t value;
+
+ p = (int64_t *) (intptr_t) address;
+
+ value = *p;
+
+ return value;
}
/*
* Class: sun/misc/Unsafe
- * Method: putLongVolatile
- * Signature: (Ljava/lang/Object;JJ)V
+ * Method: putLong
+ * Signature: (JJ)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLongVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int64_t par3)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong__JJ(JNIEnv *env, sun_misc_Unsafe *this, int64_t address, int64_t value)
{
+ int64_t *p;
+
+ p = (int64_t *) (intptr_t) address;
+
+ *p = value;
}
/*
* Class: sun/misc/Unsafe
- * Method: putLong
- * Signature: (Ljava/lang/Object;JJ)V
+ * Method: objectFieldOffset
+ * Signature: (Ljava/lang/reflect/Field;)J
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, int64_t par3)
+JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_objectFieldOffset(JNIEnv *env, sun_misc_Unsafe* this, java_lang_reflect_Field* field)
{
+ classinfo *c;
+ fieldinfo *f;
+
+ c = (classinfo *) field->clazz;
+ f = &c->fields[field->slot];
+
+ return (int64_t) f->offset;
}
/*
* Class: sun/misc/Unsafe
- * Method: getLongVolatile
- * Signature: (Ljava/lang/Object;J)J
+ * Method: allocateMemory
+ * Signature: (J)J
*/
-JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_getLongVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2)
+JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_allocateMemory(JNIEnv *env, sun_misc_Unsafe *this, int64_t bytes)
{
+ size_t length;
+ void *p;
+
+ length = (size_t) bytes;
+
+ if ((length != (uint64_t) bytes) || (bytes < 0)) {
+ exceptions_throw_illegalargumentexception();
+ return 0;
+ }
+
+ p = MNEW(uint8_t, length);
+
+ return (int64_t) (intptr_t) p;
}
/*
* Class: sun/misc/Unsafe
- * Method: getLong
- * Signature: (Ljava/lang/Object;J)J
+ * Method: freeMemory
+ * Signature: (J)V
*/
-JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_getLong(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_freeMemory(JNIEnv *env, sun_misc_Unsafe *this, int64_t address)
{
+ void *p;
+
+ p = (void *) (intptr_t) address;
+
+ if (p == NULL)
+ return;
+
+ /* we pass length 1 to trick the free function */
+
+ MFREE(p, uint8_t, 1);
}
/*
* Class: sun/misc/Unsafe
- * Method: putObjectVolatile
- * Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
+ * Method: staticFieldOffset
+ * Signature: (Ljava/lang/reflect/Field;)J
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObjectVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, struct java_lang_Object* par3)
+JNIEXPORT int64_t JNICALL Java_sun_misc_Unsafe_staticFieldOffset(JNIEnv *env, sun_misc_Unsafe *this, java_lang_reflect_Field *field)
{
+ classinfo *c;
+ fieldinfo *f;
+
+ c = (classinfo *) field->clazz;
+ f = &(c->fields[field->slot]);
+
+ return (int64_t) (intptr_t) &(f->value);
}
/*
* Class: sun/misc/Unsafe
- * Method: putObject
- * Signature: (Ljava/lang/Object;JLjava/lang/Object;)V
+ * Method: staticFieldBase
+ * Signature: (Ljava/lang/reflect/Field;)Ljava/lang/Object;
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_putObject(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2, struct java_lang_Object* par3)
+JNIEXPORT java_lang_Object* JNICALL Java_sun_misc_Unsafe_staticFieldBase(JNIEnv *env, sun_misc_Unsafe *this, java_lang_reflect_Field *f)
{
+ /* In CACAO we return the absolute address in staticFieldOffset. */
+
+ return NULL;
}
/*
* Class: sun/misc/Unsafe
- * Method: getObjectVolatile
- * Signature: (Ljava/lang/Object;J)Ljava/lang/Object;
+ * Method: ensureClassInitialized
+ * Signature: (Ljava/lang/Class;)V
*/
-JNIEXPORT struct java_lang_Object* JNICALL Java_sun_misc_Unsafe_getObjectVolatile(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Object* par1, int64_t par2)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_ensureClassInitialized(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Class *class)
{
+ classinfo *c;
+
+ c = (classinfo *) class;
+
+ if (!(c->state & CLASS_INITIALIZED))
+ initialize_class(c);
}
* Method: arrayBaseOffset
* Signature: (Ljava/lang/Class;)I
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_arrayBaseOffset(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Class* par1)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_arrayBaseOffset(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Class *arrayClass)
{
+ classinfo *c;
+ arraydescriptor *ad;
+
+ c = (classinfo *) arrayClass;
+ ad = c->vftbl->arraydesc;
+
+ if (ad == NULL) {
+ /* XXX does that exception exist? */
+ exceptions_throw_internalerror("java/lang/InvalidClassException");
+ return 0;
+ }
+
+ return ad->dataoffset;
}
* Method: arrayIndexScale
* Signature: (Ljava/lang/Class;)I
*/
-JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_arrayIndexScale(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Class* par1)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_arrayIndexScale(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Class *arrayClass)
{
+ classinfo *c;
+ arraydescriptor *ad;
+
+ c = (classinfo *) arrayClass;
+ ad = c->vftbl->arraydesc;
+
+ if (ad == NULL) {
+ /* XXX does that exception exist? */
+ exceptions_throw_internalerror("java/lang/InvalidClassException");
+ return 0;
+ }
+
+ return ad->componentsize;
}
/*
* Class: sun/misc/Unsafe
- * Method: unpark
- * Signature: (Ljava/lang/Thread;)V
+ * Method: addressSize
+ * Signature: ()I
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_unpark(JNIEnv *env, struct sun_misc_Unsafe* this, struct java_lang_Thread* par1)
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_addressSize(JNIEnv *env, sun_misc_Unsafe *this)
{
+ return SIZEOF_VOID_P;
}
/*
* Class: sun/misc/Unsafe
- * Method: park
- * Signature: (ZJ)V
+ * Method: throwException
+ * Signature: (Ljava/lang/Throwable;)V
*/
-JNIEXPORT void JNICALL Java_sun_misc_Unsafe_park(JNIEnv *env, struct sun_misc_Unsafe* this, int32_t par1, int64_t par2)
+JNIEXPORT void JNICALL Java_sun_misc_Unsafe_throwException(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Throwable *ee)
{
+ java_objectheader *o;
+
+ o = (java_objectheader *) ee;
+
+ exceptions_set_exception(o);
+}
+
+
+/*
+ * Class: sun/misc/Unsafe
+ * Method: compareAndSwapObject
+ * Signature: (Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z
+ */
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapObject(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Object *o, int64_t offset, java_lang_Object *expected, java_lang_Object *x)
+{
+ void **p;
+ void *value;
+
+ p = (void **) (((uint8_t *) o) + offset);
+
+ /* XXX this should be atomic */
+
+ value = *p;
+
+ if (value == expected) {
+ *p = x;
+
+ return true;
+ }
+
+ return false;
+}
+
+
+/*
+ * Class: sun/misc/Unsafe
+ * Method: compareAndSwapInt
+ * Signature: (Ljava/lang/Object;JII)Z
+ */
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapInt(JNIEnv *env, sun_misc_Unsafe* this, java_lang_Object* obj, int64_t offset, int32_t expect, int32_t update)
+{
+ int32_t *p;
+ int32_t value;
+
+ p = (int32_t *) (((uint8_t *) obj) + offset);
+
+ /* XXX this should be atomic */
+
+ value = *p;
+
+ if (value == expect) {
+ *p = update;
+
+ return true;
+ }
+
+ return false;
+}
+
+
+/*
+ * Class: sun/misc/Unsafe
+ * Method: compareAndSwapLong
+ * Signature: (Ljava/lang/Object;JJJ)Z
+ */
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_compareAndSwapLong(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Object *o, int64_t offset, int64_t expected, int64_t x)
+{
+ int64_t *p;
+ int64_t value;
+
+ p = (int64_t *) (((uint8_t *) o) + offset);
+
+ /* XXX this should be atomic */
+
+ value = *p;
+
+ if (value == expected) {
+ *p = x;
+
+ return true;
+ }
+
+ return false;
+}
+
+
+/*
+ * Class: sun/misc/Unsafe
+ * Method: getObjectVolatile
+ * Signature: (Ljava/lang/Object;J)Ljava/lang/Object;
+ */
+JNIEXPORT java_lang_Object* JNICALL Java_sun_misc_Unsafe_getObjectVolatile(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Object *o, int64_t offset)
+{
+ volatile void **p;
+ volatile void *value;
+
+ p = (volatile void **) (((uint8_t *) o) + offset);
+
+ value = *p;
+
+ return (java_lang_Object *) value;
+}
+
+
+/*
+ * Class: sun/misc/Unsafe
+ * Method: getIntVolatile
+ * Signature: (Ljava/lang/Object;J)I
+ */
+JNIEXPORT int32_t JNICALL Java_sun_misc_Unsafe_getIntVolatile(JNIEnv *env, sun_misc_Unsafe *this, java_lang_Object *o, int64_t offset)
+{
+ volatile int32_t *p;
+ volatile int32_t value;
+
+ p = (volatile int32_t *) (((uint8_t *) o) + offset);
+
+ value = *p;
+
+ return value;
}
-#endif
/*
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: threads.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: threads.c 8137 2007-06-22 16:41:36Z michi $
*/
(void) vm_call_method(method_thread_init, o, vmt, threadname, NORM_PRIORITY,
false);
+
+#elif defined(WITH_CLASSPATH_SUN)
+
+ /* We trick java.lang.Thread.init, which sets the priority of the
+ current thread to the parent's one. */
+
+ t->priority = NORM_PRIORITY;
+
#elif defined(WITH_CLASSPATH_CLDC1_1)
+
/* set the thread */
t->vm_thread = (java_lang_Object *) mainthread;
o = (java_objectheader *) t;
(void) vm_call_method(method_thread_init, o, threadname);
+#else
+# error unknown classpath configuration
#endif
if (exceptions_get_exception())
#if defined(ENABLE_JAVASE)
t->group = threadgroup;
+# if defined(WITH_CLASSPATH_GNU)
/* add main thread to java.lang.ThreadGroup */
m = class_resolveclassmethod(class_java_lang_ThreadGroup,
if (exceptions_get_exception())
return false;
+# else
+# warning Do not know what to do here
+# endif
#endif
threads_set_thread_priority(pthread_self(), NORM_PRIORITY);
java.lang.VMThread. Since this is a final class, we can use
the class object directly. */
- c = class_java_lang_VMThread;
-#elif defined(WITH_CLASSPATH_CLDC1_1)
- c = thread->object->header.vftbl->class;
+ c = class_java_lang_VMThread;
+#elif defined(WITH_CLASSPATH_SUN) || defined(WITH_CLASSPATH_CLDC1_1)
+ c = thread->object->header.vftbl->class;
+#else
+# error unknown classpath configuration
#endif
m = class_resolveclassmethod(c, utf_run, utf_void__void, c, true);
vmt = (java_lang_VMThread *) thread->object->vmThread;
o = (java_objectheader *) vmt;
-#elif defined(WITH_CLASSPATH_CLDC1_1)
+#elif defined(WITH_CLASSPATH_SUN) || defined(WITH_CLASSPATH_CLDC1_1)
o = (java_objectheader *) thread->object;
+#else
+# error unknown classpath configuration
#endif
/* run the thread */
#endif
#if defined(WITH_CLASSPATH_GNU)
+
/* create a java.lang.VMThread object */
vmt = (java_lang_VMThread *) builtin_new(class_java_lang_VMThread);
vmt->thread = t;
vmt->vmdata = (java_lang_Object *) thread;
+
+#elif defined(WITH_CLASSPATH_SUN)
+
+ vm_abort("threads_attach_current_thread: IMPLEMENT ME!");
+
#elif defined(WITH_CLASSPATH_CLDC1_1)
+
t->vm_thread = (java_lang_Object *) thread;
+
+#else
+# error unknown classpath configuration
#endif
if (vm_aargs != NULL) {
/* XXX TWISTI: should all threads be in a ThreadGroup? */
if (group != NULL) {
+# if defined(WITH_CLASSPATH_GNU)
m = class_resolveclassmethod(group->header.vftbl->class,
utf_removeThread,
utf_java_lang_Thread__V,
class_java_lang_ThreadGroup,
true);
+# elif defined(WITH_CLASSPATH_SUN)
+ m = class_resolveclassmethod(group->header.vftbl->class,
+ utf_remove,
+ utf_java_lang_Thread__V,
+ class_java_lang_ThreadGroup,
+ true);
+# else
+# error unknown classpath configuration
+# endif
if (m == NULL)
return false;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: threads-common.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: threads-common.c 8137 2007-06-22 16:41:36Z michi $
*/
if (object != NULL) {
/* get thread name */
-#if defined(ENABLE_JAVASE)
+#if defined(WITH_CLASSPATH_GNU)
name = javastring_toutf((java_objectheader *) object->name, false);
-#elif defined(ENABLE_JAVAME_CLDC1_1)
+#elif defined(WITH_CLASSPATH_SUN) || defined(WITH_CLASSPATH_CLDC1_1)
/* FIXME: In cldc the name is a char[] */
/* name = object->name; */
name = utf_null;
+#else
+# error unknown classpath configuration
#endif
printf("\"");
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: arch.h 7701 2007-04-15 00:38:00Z michi $
+ $Id: arch.h 8127 2007-06-21 11:55:56Z michi $
*/
#endif
-#define HAS_4BYTE_STACKSLOT
#define SUPPORT_COMBINE_INTEGER_REGISTERS
#define SUPPORT_PASS_FLOATARGS_IN_INTREGS
-#define ALIGN_LONGS_IN_MEMORY /* Align Longs and/or Doubles at */
-#define ALIGN_DOUBLES_IN_MEMORY /* 2*Stackslotsize relativ to stackframe */
-/* Memory Positions for not Interface Stackslots (allocate_scratch_registers) */
-/* are not properly aligned in case HAS_4_BYTE_STACKSLOT is not defined! */
-/* For HAS_4_BYTE_STACKSLOT archs no distinction is made between long and */
-/* define SUPPORT_COMBINE_INTEGER_REGISTERS */
-
/* branches *******************************************************************/
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.S 7940 2007-05-23 09:42:08Z michi $
+ $Id: asmpart.S 8127 2007-06-21 11:55:56Z michi $
*/
.word _no_threads_exceptionptr
#endif
-asm_jitcompilerptr:
- .word asm_call_jit_compiler
-
asm_criticalsections:
#if defined(ENABLE_THREADS)
.word _crit_begin
/* asm_vm_call_method_float:
asm_vm_call_method_double: */
SAVE_SCRATCH_REGISTERS /* save our personal scratch regs */
- stmfd sp!, {v1} /* V1 is used to recompute SP ... */
- mov v1, #0 /* ... when using stack arguments */
- ldr ip, asm_jitcompilerptr
- str ip, [sp, #-4]! /* store fake address */
- mov mptr, sp /* set method pointer */
+ stmfd sp!, {v1} /* V1 is used to remember SP */
+ str a0, [sp, #-4]! /* store methods entrypoint */
- mov itmp1, a0 /* pass methodinfo* via ITMP1 */
+ mov v1, sp /* remember SP */
- cmp a1, #0 /* do we have arguments? */
- ble asm_calljava_copyfinish /* no -> do not care :-) */
+ mov itmp1, a1 /* address of data structure */
+ mov itmp3, a2 /* stack argument count */
- /* REMEMBER: stack space for arguments is reserved here! */
- /* TODO: we possibly reserve to much here */
- mov v1, a1, lsl #3 /* how much stack do we alloc? */
- sub sp, sp, v1 /* allocate stack for arguments! */
+ ldr a0, [itmp1], #8 /* load argument registers */
+ ldr a1, [itmp1], #8
+ ldr a2, [itmp1], #8
+ ldr a3, [itmp1], #8
+
+ cmp itmp3, #0 /* do we have stack arguments? */
+ ble asm_calljava_copyfinish /* no -> do not care :-) */
- mov itmp3, #0 /* stack position */
+ mov itmp2, #0
+ sub sp, sp, itmp3, lsl #3 /* create stackframe for arguments */
asm_calljava_copyloop: /* reorder stack arguments! */
-#if defined(__ARMEL__)
- ldr ip, [a2,#offvmargtype] /* align 2_WORD_TYPEs */
- tst ip, #1
- tstne itmp3, #4
- addne itmp3, itmp3, #4
- ldr ip, [a2,#offvmargdata] /* get LOW word of argument */
- str ip, [sp, itmp3]
- add itmp3, itmp3, #4
- ldr ip, [a2,#offvmargtype] /* is it a 2_WORD_TYPE? */
- tst ip, #1
- ldrne ip, [a2,#offvmargdata + 4] /* yes -> get HIGH word of argument */
- strne ip, [sp, itmp3]
- addne itmp3, itmp3, #4
-#else /* defined(__ARMEB__) */
- ldr ip, [a2,#offvmargtype + 4] /* get our item type (it is u8) */
- tst ip, #1 /* align 2_WORD_TYPEs */
- tstne itmp3, #4
- addne itmp3, itmp3, #4
- teq ip, #2 /* is it a TYPE_FLOAT? */
- ldreq ip, [a2,#offvmargdata] /* yes -> get LOW word of float */
- streq ip, [sp, itmp3]
- addeq itmp3, itmp3, #4
- beq asm_calljava_copydone
- tst ip, #1 /* is it a 2_WORD_TYPE? */
- ldrne ip, [a2,#offvmargdata] /* yes -> get HIGH word of argument */
- strne ip, [sp, itmp3]
- addne itmp3, itmp3, #4
- ldr ip, [a2,#offvmargdata + 4] /* get LOW word of argument */
- str ip, [sp, itmp3]
- add itmp3, itmp3, #4
-asm_calljava_copydone:
-#endif
- add a2, a2, #sizevmarg /* next argument block */
- subs a1, a1, #1
+ ldr ip, [itmp1], #4 /* load argument */
+ str ip, [sp, itmp2] /* store argument on stack */
+ add itmp2, itmp2, #4 /* next stackslot */
+ ldr ip, [itmp1], #4 /* load argument */
+ str ip, [sp, itmp2] /* store argument on stack */
+ add itmp2, itmp2, #4 /* next stackslot */
+ subs itmp3, itmp3, #1 /* next argument */
bgt asm_calljava_copyloop
- /* REMEMBER: first four args are passed in regs, take them out again */
- ldmfd sp, {a0, a1, a2, a3} /* load first four args to register */
- cmp v1, #16 /* do we have four arguments? */
- addlt sp, sp, v1
- movlt v1, #0
- addge sp, sp, #16
- subge v1, v1, #16
-
asm_calljava_copyfinish:
+ mov mptr, v1 /* set method pointer */
+
/* REMEMBER: do the method call just like in java! */
ldr ip, [mptr] /* fake virtual function call */
- mov lr, pc
- mov pc, ip
-fake2:
- sub ip, pc, #(fake2 - asm_vm_call_method)+8
+ mov lr, pc
+ mov pc, ip
+fake:
+ sub ip, pc, #(fake - asm_vm_call_method)+8
- add sp, sp, v1 /* free stack arguments! */
+ mov sp, v1 /* restore SP */
add sp, sp, #4 /* free fake address */
ldmfd sp!, {v1}
RESTORE_SCRATCH_REGS_AND_RETURN /* return to caller, restore regs */
bl builtin_throw_exception /* throw the exception */
mov res1, #0 /* return NULL */
mov res2, #0 /* return NULL */
- add sp, sp, v1 /* free stack arguments! */
+ mov sp, v1 /* restore SP */
add sp, sp, #4 /* free fake address */
ldmfd sp!, {v1}
RESTORE_SCRATCH_REGS_AND_RETURN /* return to caller, restore regs */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: codegen.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: codegen.c 8127 2007-06-21 11:55:56Z michi $
*/
savedregs_num = (jd->isleafmethod) ? 0 : 1; /* space to save the LR */
savedregs_num += (INT_SAV_CNT - rd->savintreguse);
- savedregs_num += (FLT_SAV_CNT - rd->savfltreguse);
+ /*savedregs_num += (FLT_SAV_CNT - rd->savfltreguse);*/
+ assert((FLT_SAV_CNT - rd->savfltreguse) == 0);
spilledregs_num = rd->memuse;
spilledregs_num++;
#endif
- cd->stackframesize = (spilledregs_num + savedregs_num) * 4;
+ cd->stackframesize = spilledregs_num * 8 + savedregs_num * 4;
/* XXX QUICK FIX: We shouldn't align the stack in Java code, but
only in native stubs. */
*/
if (checksync && (m->flags & ACC_SYNCHRONIZED))
- (void) dseg_add_unique_s4(cd, (rd->memuse + 1) * 4);/* IsSync */
+ (void) dseg_add_unique_s4(cd, rd->memuse * 8 + 4);/* IsSync */
else
#endif
(void) dseg_add_unique_s4(cd, 0); /* IsSync */
if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
/* stack offset for monitor argument */
- s1 = rd->memuse;
+ s1 = rd->memuse * 8;
# if !defined(NDEBUG)
if (JITDATA_HAS_FLAG_VERBOSECALL(jd)) {
M_STMFD(BITMASK_ARGS, REG_SP);
- s1 += 4;
+ s1 += 4 * 4;
}
# endif
emit_nullpointer_check_force(cd, iptr, REG_A0);
}
- M_STR(REG_A0, REG_SP, s1 * 4);
+ M_STR(REG_A0, REG_SP, s1);
disp = dseg_add_functionptr(cd, LOCK_monitor_enter);
M_DSEG_BRANCH(disp);
s1 = (s4) (cd->mcodeptr - cd->mcodebase);
if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
/* stack offset for monitor argument */
- s1 = rd->memuse;
+ s1 = rd->memuse * 8;
/* we need to save the proper return value */
case ICMD_FRETURN: /* XXX TWISTI: is that correct? */
case ICMD_DRETURN:
M_STMFD(BITMASK_RESULT, REG_SP);
- s1 += 2;
+ s1 += 2 * 4;
break;
}
- M_LDR(REG_A0, REG_SP, s1 * 4);
+ M_LDR(REG_A0, REG_SP, s1);
disp = dseg_add_functionptr(cd, LOCK_monitor_exit);
M_DSEG_BRANCH(disp);
/* calculate stackframe size */
- cd->stackframesize = (
- 1 + /* return address */
- sizeof(stackframeinfo) / SIZEOF_VOID_P + /* stackframeinfo */
- sizeof(localref_table) / SIZEOF_VOID_P + /* localref_table */
- nmd->memuse /* stack arguments */
- ) * 4;
+ cd->stackframesize =
+ 4 + /* return address */
+ sizeof(stackframeinfo) + /* stackframeinfo */
+ sizeof(localref_table) + /* localref_table */
+ nmd->memuse * 4; /* stack arguments */
/* align stack to 8-byte */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: md-abi.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: md-abi.c 8127 2007-06-21 11:55:56Z michi $
*/
case TYPE_FLT:
if (reguse < INT_ARG_CNT) {
pd->inmemory = false;
+ pd->index = reguse;
pd->regoff = abi_registers_integer_argument[reguse];
reguse++;
}
else {
pd->inmemory = true;
- pd->regoff = stacksize * 4;
+ pd->index = stacksize;
+ pd->regoff = stacksize * 8;
stacksize++;
}
break;
if (reguse < INT_ARG_CNT) {
pd->inmemory = false;
#if defined(__ARMEL__)
+ pd->index = PACK_REGS(reguse, reguse + 1);
pd->regoff =
PACK_REGS(abi_registers_integer_argument[reguse],
abi_registers_integer_argument[reguse + 1]);
#else
+ pd->index = PACK_REGS(reguse + 1, reguse);
pd->regoff =
PACK_REGS(abi_registers_integer_argument[reguse + 1],
abi_registers_integer_argument[reguse]);
}
else {
- ALIGN_2(stacksize);
+ /*ALIGN_2(stacksize);*/
pd->inmemory = true;
- pd->regoff = stacksize * 4;
- stacksize += 2;
+ pd->index = stacksize;
+ pd->regoff = stacksize * 8;
+ /*stacksize += 2;*/
+ stacksize++;
}
break;
}
case TYPE_FLT:
if (reguse < INT_ARG_CNT) {
pd->inmemory = false;
+ pd->index = -1;
pd->regoff = abi_registers_integer_argument[reguse];
reguse++;
}
else {
pd->inmemory = true;
+ pd->index = -1;
pd->regoff = stacksize * 4;
stacksize++;
}
#endif
pd->inmemory = false;
#if defined(__ARMEL__)
+ pd->index = -1;
pd->regoff =
PACK_REGS(abi_registers_integer_argument[reguse],
abi_registers_integer_argument[reguse + 1]);
#else
+ pd->index = -1;
pd->regoff =
PACK_REGS(abi_registers_integer_argument[reguse + 1],
abi_registers_integer_argument[reguse]);
else if (reguse < INT_ARG_CNT) {
pd->inmemory = false;
# if defined(__ARMEL__)
+ pd->index = -1;
pd->regoff =
PACK_REGS(abi_registers_integer_argument[reguse],
abi_registers_integer_argument[INT_ARG_CNT]);
# else
+ pd->index = -1;
pd->regoff =
PACK_REGS(abi_registers_integer_argument[INT_ARG_CNT],
abi_registers_integer_argument[reguse]);
ALIGN_2(stacksize);
#endif
pd->inmemory = true;
+ pd->index = -1;
pd->regoff = stacksize * 4;
reguse = INT_ARG_CNT;
stacksize += 2;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: asmpart.h 8123 2007-06-20 23:50:55Z michi $
+ $Id: asmpart.h 8128 2007-06-21 16:29:53Z tbfg $
*/
void asm_call_jit_compiler(void);
#if defined(ENABLE_JIT)
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__)
java_objectheader *asm_vm_call_method(methodinfo *m, s4 vmargscount,
vm_arg *vmargs);
s4 asm_vm_call_method_int(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
#define HAS_ADDRESS_REGISTER_FILE 1
-#define HAS_4BYTE_STACKSLOT 1
-
/* coldfire has tst instruction */
#define SUPPORT_BRANCH_CONDITIONAL_CONDITION_REGISTER 1
#define SUPPORT_BRANCH_CONDITIONAL_UNSIGNED_CONDITIONS 1
#include "md-abi.h"
#include "vm/jit/methodheader.h"
-.data
-call_jit_dummy:
- .long 0xdeadbeef
-
.text
.globl asm_vm_call_method
.long 0 /* IsSync */
.long 0 /* frame size */
.long 0 /* codeinfo pointer */
+
+
+/*
+ This method gets called with 3 arguments:
+ 1st arg: addres of method to call (fake invokevirtual here)
+ 2nd arg: uint64_t array of argument registers followed by stack
+ 3rd arg: number of 8 byte stack slots to be copied.
+
+ coldifire does not use any argument registers, so just the stack has to be copied
+*/
asm_vm_call_method:
asm_vm_call_method_int:
asm_vm_call_method_long:
asm_vm_call_method_double:
#if defined(ENABLE_SOFTFLOAT)
- addal #(-11*4),%sp /* create stackframe to save registers */
+ addal #(-12*4),%sp /* create stackframe to save registers, and 1 slot for method invocation */
moveml %d2/%d3/%d4/%d5/%d6/%d7/%a2/%a3/%a4/%a5/%fp,%sp@ /* save registers */
/* fetch arguments from vmargs data structure */
- movel %sp@(11*4+1*4),%a2 /* methodinfo argument in atmp1 */
- movel %sp@(11*4+3*4),%a3 /* args block */
- movel %sp@(11*4+2*4),%d2 /* arg count */
+ movel %sp@(12*4+1*4),%a3 /* method */
+ movel %sp@(12*4+2*4),%a2 /* arg array */
+ movel %sp@(12*4+3*4),%d2 /* arg count */
+
+ movel %a3, %sp@(12*4) /* copy method address to stackslot */
+ leal %sp@(12*4), %a3 /* and store that address in %a3 */
#else
- addal #(-11*4-6*8), %sp
+ addal #(-12*4-6*8), %sp
moveml %d2/%d3/%d4/%d5/%d6/%d7/%a2/%a3/%a4/%a5/%fp,%sp@ /* save registers */
fmovemd %fp2/%fp3/%fp4/%fp5/%fp6/%fp7,%sp@(11*4) /* save registers */
/* fetch arguments from vmargs data structure */
- movel %sp@(11*4+6*8+1*4),%a2 /* methodinfo argument in atmp1 */
- movel %sp@(11*4+6*8+3*4),%a3 /* args block */
- movel %sp@(11*4+6*8+2*4),%d2 /* arg count */
-#endif
+ movel %sp@(12*4+6*8+1*4),%a3 /* method */
+ movel %sp@(12*4+6*8+2*4),%a2 /* arg array */
+ movel %sp@(12*4+6*8+3*4),%d2 /* arg count */
+ movel %a3, %sp@(11*4+6*8) /* copy method address to stackslot */
+ leal %sp@(11*4+6*8), %a3 /* and store that address in %a3 */
+#endif
moveal %sp, %a5 /* memorize stack */
+
tstl %d2 /* do we have arguments ? */
beq L_asm_vm_call_method_copy_done
- subql #1,%d2 /* simplifies offset calulation */
-
- movel #(sizevmarg), %d0
- mulsl %d2, %d0
- moveal %a3, %a0
- addal %d0, %a0 /* %a0 points to last vmarg block */
-
- addql #1, %d2
-L_asm_vm_call_copy_arg:
- subql #1, %d2 /* decrement argument counter */
- movel %a0@(offvmargtype+4), %d1 /* %d1 contains type of arg, vmargtype is u8 */
-
- cmpil #2, %d1 /* float type ? */
- bne L_asm_vm_call_copy_int
-
- movel %a0@(offvmargdata), %d0 /* float has different endianess as int */
- movel %d0, %sp@-
- bra L_asm_vm_call_copy_1_word_type
-
-L_asm_vm_call_copy_int:
- movel %a0@(offvmargdata+4), %d0
- movel %d0,%sp@- /* push argument onto stack */
-
- btstl #0, %d1 /* test if 2 word type */
- beq L_asm_vm_call_copy_1_word_type
- movel %a0@(offvmargdata), %d0 /* push second word onto stack */
- movel %d0,%sp@-
-L_asm_vm_call_copy_1_word_type:
+ movel %d2, %d3 /* create stackframe */
+ asll #3, %d3 /* number args * 8 */
+ subal %d3, %sp
+ moveal %sp, %a4 /* %a4 is temp stack pointer */
+
+L_asm_vm_call_method_copy_loop:
+ movel %a2@(0), %d3
+ movel %d3, %a4@(0) /* copy 4 bytes */
+ movel %a2@(4), %d3
+ movel %d3, %a4@(4) /* a whole stack slot has been copied */
+
+ addal #8, %a2
+ addal #8, %a4
+ addl #-1, %d2
+ tstl %d2 /* do we have more arguments ? */
+ beq L_asm_vm_call_method_copy_done
+ br L_asm_vm_call_method_copy_loop
- subl #(sizevmarg),%a0
- tstl %d2 /* arguments left ? */
- bne L_asm_vm_call_copy_arg
L_asm_vm_call_method_copy_done:
+ /* now we fake method invocation as it would happen from invokevirtual */
+ /* this is needed as we patch the caller site, so we need a writeable slot */
+ /* %a3 points to the address containing the method, %a3 == REG_METHODPTR */
- leal asm_call_jit_compiler,%a4 /* we need to fake a invocation as it would happen from jit code */
- movel %a4, call_jit_dummy /* we need a writeable memory location */
- moveal call_jit_dummy, %a4 /* XXX do we have a race condition here ? */
+ moveal %a3@(0), %a4
jsr %a4@
L_asm_vm_call_method_return:
#if defined(ENABLE_SOFTFLOAT)
moveml %sp@, %d2/%d3/%d4/%d5/%d6/%d7/%a2/%a3/%a4/%a5/%fp /* restore registers */
- addal #(11*4),%sp /* restore stack */
+ addal #(12*4),%sp /* restore stack */
#else
- fmovemd %sp@(11*4), %fp2/%fp3/%fp4/%fp5/%fp6/%fp7 /* restore registers */
+ fmovemd %sp@(12*4), %fp2/%fp3/%fp4/%fp5/%fp6/%fp7 /* restore registers */
moveml %sp@, %d2/%d3/%d4/%d5/%d6/%d7/%a2/%a3/%a4/%a5/%fp /* restore registers */
- addal #(11*4+6*8),%sp /* restore stack */
+ addal #(12*4+6*8),%sp /* restore stack */
#endif
moveal %d0, %a0 /* XXX return value in %a0, too, gcc sometimes expects addresses in %a0, wired */
asm_vm_call_method_end: /* symbol needed to insert method into avl tree */
lsrl #8, %d0
lsrl #8, %d0
+#if 0
+ cmpb #0, %d0
+ beq L_asm_handle_ex_adr_done
+ moveal -(%a0), %a5
+#else
cmpb #0, %d0
beq L_asm_handle_ex_adr_done
moveal -(%a0), %fp
cmpb #1,%d0
beq L_asm_handle_ex_adr_done
moveal -(%a0), %a5
+#endif
L_asm_handle_ex_adr_done:
savedregs_num += (INT_SAV_CNT - rd->savintreguse);
savedregs_num += (ADR_SAV_CNT - rd->savadrreguse);
- savedregs_num += (FLT_SAV_CNT - rd->savfltreguse) * 2;
+ savedregs_num += (FLT_SAV_CNT - rd->savfltreguse);
cd->stackframesize = rd->memuse + savedregs_num;
- /* we always add 3 words,
- * 1 word the lock word, which may be unused and resides @ rd->memuse * 4
- * + 2 words to either save the return value for LOCK_monitor_exit @ rd->memuse * 4 + 4
+ /* we always add 2 stack slots.
+ * 1 word the lock word, which may be unused and resides @ rd->memuse * 8
+ * + 2 words to either save the return value for LOCK_monitor_exit @ rd->memuse * 8 + 8
* on the other hand we could use 2 words when a builtin returns a doulbe which are
* returned in %d0, %d1 and need to be stored onto the stack and read in used a fmovemd
- * so we always _need_ at least 2 words, and this keeps the code simple */
- cd->stackframesize += 3;
+ * so we always _need_ at least 2 slots, and this keeps the code simple */
+ cd->stackframesize += 2;
+
+ cd->stackframesize *= 8; /* we use 8 byte stack slots */
#if 0
#if defined(ENABLE_THREADS)
/* create method header */
(void) dseg_add_unique_address(cd, code); /* CodeinfoPointer */
- (void) dseg_add_unique_s4(cd, cd->stackframesize * 4); /* FrameSize */
+ (void) dseg_add_unique_s4(cd, cd->stackframesize); /* FrameSize */
#if defined(ENABLE_THREADS)
if (checksync && (m->flags & ACC_SYNCHRONIZED))
- (void) dseg_add_unique_s4(cd, (rd->memuse + 1) * 4);/* IsSync */
+ (void) dseg_add_unique_s4(cd, (rd->memuse + 1) * 8);/* IsSync */
else
#endif
(void) dseg_add_unique_s4(cd, 0); /* IsSync */
emit_verbosecall_enter(jd);
#endif
/* create stack frame */
- M_AADD_IMM(-(cd->stackframesize*4), REG_SP);
+ M_AADD_IMM(-(cd->stackframesize), REG_SP);
/* save used callee saved registers */
p = cd->stackframesize;
for (i=INT_SAV_CNT-1; i>=rd->savintreguse; --i) {
- p--; M_IST(rd->savintregs[i], REG_SP, p*4);
+ p-=8; M_IST(rd->savintregs[i], REG_SP, p);
}
for (i=ADR_SAV_CNT-1; i>=rd->savadrreguse; --i) {
- p--; M_AST(rd->savadrregs[i], REG_SP, p*4);
+ p-=8; M_AST(rd->savadrregs[i], REG_SP, p);
}
#if !defined(ENABLE_SOFTFLOAT)
for (i=FLT_SAV_CNT-1; i>=rd->savfltreguse; --i) {
- p-=2; M_FSTORE(rd->savfltregs[i], REG_SP, p*4);
+ p-=8; M_FSTORE(rd->savfltregs[i], REG_SP, p);
}
#else
assert(FLT_SAV_CNT == 0);
case TYPE_INT:
if (!IS_INMEMORY(var->flags)) { /* stack arg -> register */
if (IS_2_WORD_TYPE(t)) {
- M_LLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_LLD(var->vv.regoff, REG_SP, cd->stackframesize + s1 + 4);
} else {
- M_ILD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_ILD(var->vv.regoff, REG_SP, cd->stackframesize + s1 + 4);
}
} else { /* stack arg -> spilled */
-#if 1
- M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_ILD(REG_ITMP1, REG_SP, cd->stackframesize + s1 + 4);
M_IST(REG_ITMP1, REG_SP, var->vv.regoff);
if (IS_2_WORD_TYPE(t)) {
- M_ILD(REG_ITMP1, REG_SP, cd->stackframesize * 4 + s1 + 4 + 4);
+ M_ILD(REG_ITMP1, REG_SP, cd->stackframesize + s1 + 4 + 4);
M_IST(REG_ITMP1, REG_SP, var->vv.regoff + 4);
}
-#else
- /* Reuse Memory Position on Caller Stack */
- var->vv.regoff = cd->stackframesize * 4 + s1;
-#endif
}
break;
#if !defined(ENABLE_SOFTFLOAT)
case TYPE_DBL:
if (!IS_INMEMORY(var->flags)) { /* stack-arg -> register */
if (IS_2_WORD_TYPE(t)) {
- M_DLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_DLD(var->vv.regoff, REG_SP, cd->stackframesize + s1 + 4);
} else {
- M_FLD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_FLD(var->vv.regoff, REG_SP, cd->stackframesize + s1 + 4);
}
} else { /* stack-arg -> spilled */
-#if 1
if (IS_2_WORD_TYPE(t)) {
- M_DLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_DLD(REG_FTMP1, REG_SP, cd->stackframesize + s1 + 4);
M_DST(REG_FTMP1, REG_SP, var->vv.regoff);
} else {
- M_FLD(REG_FTMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_FLD(REG_FTMP1, REG_SP, cd->stackframesize + s1 + 4);
M_FST(REG_FTMP1, REG_SP, var->vv.regoff);
}
-#else
- /* Reuse Memory Position on Caller Stack */
- var->vv.regoff = cd->stackframesize * 4 + s1;
-#endif
}
break;
#endif /* SOFTFLOAT */
case TYPE_ADR:
if (!IS_INMEMORY(var->flags)) { /* stack-arg -> register */
- M_ALD(var->vv.regoff, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_ALD(var->vv.regoff, REG_SP, cd->stackframesize + s1 + 4);
} else { /* stack-arg -> spilled */
-#if 1
- M_ALD(REG_ATMP1, REG_SP, cd->stackframesize * 4 + s1 + 4);
+ M_ALD(REG_ATMP1, REG_SP, cd->stackframesize + s1 + 4);
M_AST(REG_ATMP1, REG_SP, var->vv.regoff);
-#else
- /* Reuse Memory Position on Caller Stack */
- var->vv.regoff = cd->stackframesize * 4 + s1;
-#endif
}
break;
default: assert(0);
M_AMOV_IMM((&m->class->object.header), REG_ATMP1);
} else {
/* for non-static case the first arg is the object */
- M_ALD(REG_ATMP1, REG_SP, cd->stackframesize*4 + 4);
+ M_ALD(REG_ATMP1, REG_SP, cd->stackframesize + 4);
M_ATST(REG_ATMP1);
M_BNE(2);
M_TRAP(M68K_EXCEPTION_HARDWARE_NULLPOINTER);
}
- M_AST(REG_ATMP1, REG_SP, rd->memuse * 4);
+ M_AST(REG_ATMP1, REG_SP, rd->memuse * 8);
M_AST(REG_ATMP1, REG_SP, 0 * 4);
M_JSR_IMM(LOCK_monitor_enter);
}
#if defined(ENABLE_THREADS)
/* call lock_monitor_exit */
if (checksync && (m->flags & ACC_SYNCHRONIZED)) {
- M_ILD(REG_ITMP3, REG_SP, rd->memuse * 4);
+ M_ILD(REG_ITMP3, REG_SP, rd->memuse * 8);
/* we need to save the proper return value */
/* we do not care for the long -> doubel convert space here */
case ICMD_DRETURN:
#endif
case ICMD_LRETURN:
- M_LST(REG_RESULT_PACKED, REG_SP, rd->memuse * 4 + 4);
+ M_LST(REG_RESULT_PACKED, REG_SP, rd->memuse * 8 + 8);
break;
#if defined(ENABLE_SOFTFLOAT)
case ICMD_FRETURN:
#endif
case ICMD_IRETURN:
case ICMD_ARETURN:
- M_IST(REG_RESULT , REG_SP, rd->memuse * 4 + 4);
+ M_IST(REG_RESULT , REG_SP, rd->memuse * 8 + 8);
break;
#if !defined(ENABLE_SOFTFLOAT)
case ICMD_FRETURN:
- M_FST(REG_FRESULT, REG_SP, rd->memuse * 4 + 4);
+ M_FST(REG_FRESULT, REG_SP, rd->memuse * 8 + 8);
break;
case ICMD_DRETURN:
- M_DST(REG_FRESULT, REG_SP, rd->memuse * 4 + 4);
+ M_DST(REG_FRESULT, REG_SP, rd->memuse * 8 + 8);
break;
#endif
}
case ICMD_DRETURN:
#endif
case ICMD_LRETURN:
- M_LLD(REG_RESULT_PACKED, REG_SP, rd->memuse * 4 + 4);
+ M_LLD(REG_RESULT_PACKED, REG_SP, rd->memuse * 8 + 8);
break;
#if defined(ENABLE_SOFTFLOAT)
case ICMD_FRETURN:
#endif
case ICMD_IRETURN:
case ICMD_ARETURN:
- M_ILD(REG_RESULT , REG_SP, rd->memuse * 4 + 4);
+ M_ILD(REG_RESULT , REG_SP, rd->memuse * 8 + 8);
break;
#if !defined(ENABLE_SOFTFLOAT)
case ICMD_FRETURN:
- M_FLD(REG_FRESULT, REG_SP, rd->memuse * 4 + 4);
+ M_FLD(REG_FRESULT, REG_SP, rd->memuse * 8 + 8);
break;
case ICMD_DRETURN:
- M_DLD(REG_FRESULT, REG_SP, rd->memuse * 4 + 4);
+ M_DLD(REG_FRESULT, REG_SP, rd->memuse * 8 + 8);
break;
#endif
}
/* restore saved registers */
for (i = INT_SAV_CNT - 1; i >= rd->savintreguse; i--) {
- p--; M_ILD(rd->savintregs[i], REG_SP, p * 4);
+ p-=8; M_ILD(rd->savintregs[i], REG_SP, p);
}
for (i=ADR_SAV_CNT-1; i>=rd->savadrreguse; --i) {
- p--; M_ALD(rd->savadrregs[i], REG_SP, p*4);
+ p-=8; M_ALD(rd->savadrregs[i], REG_SP, p);
}
#if !defined(ENABLE_SOFTFLOAT)
for (i = FLT_SAV_CNT - 1; i >= rd->savfltreguse; i--) {
- p -= 2; M_FLOAD(rd->savfltregs[i], REG_SP, p * 4);
+ p-=8; M_FLOAD(rd->savfltregs[i], REG_SP, p);
}
#endif
/* deallocate stack */
- M_AADD_IMM(cd->stackframesize*4, REG_SP);
+ M_AADD_IMM(cd->stackframesize, REG_SP);
M_RET;
}
break;
/* travel up stack to the first argument of the function which needs to be copied */
for (i=0; (i < md->paramcount) && (i < TRACE_ARGS_NUM); i++) {
- disp += 4;
- if (IS_2_WORD_TYPE(md->paramtypes[i].type)) {
- disp += 4;
- }
+ disp += 8;
}
/* disp now points to the first arg which gets copied to the trace stack, relative to REG_SP! */
/* traced function has such an argument */
t = md->paramtypes[i].type;
- if (IS_2_WORD_TYPE(t)) {
- /* copy from original argument stack */
- M_ILD(REG_ITMP1, REG_SP, disp);
- M_IPUSH(REG_ITMP1);
- M_ILD(REG_ITMP1, REG_SP, disp);
- M_IPUSH(REG_ITMP1);
- } else {
- /* displacment is increased as 4 byte on original stack but 8 byte on trace stack */
- M_ILD(REG_ITMP1, REG_SP, disp);
- M_IPUSH(REG_ITMP1);
- M_IPUSH_IMM(0);
- disp += 4;
- }
+ /* copy from original argument stack */
+ M_ILD(REG_ITMP1, REG_SP, disp);
+ M_ILD(REG_ITMP2, REG_SP, disp-4);
+ M_IPUSH(REG_ITMP2);
+ M_IPUSH(REG_ITMP1);
} else {
/* function has no arg here, push nothing and adapt displacement */
M_IPUSH_IMM(0);
#if !defined(ENABLE_SOFTFLOAT)
M_AADD_IMM(-8, REG_SP);
- M_FSTORE(REG_F1, REG_SP, 0);
+ M_FSTORE(REG_D1, REG_SP, 0);
#endif
M_IPUSH_IMM(m); /* push methodinfo */
M_AADD_IMM(3*4 + 4, REG_SP);
#if !defined(ENABLE_SOFTFLOAT)
- M_FLOAD(REG_F1, REG_SP, 0)
+ M_FLOAD(REG_D1, REG_SP, 0)
M_AADD_IMM(8, REG_SP);
#endif
/* Address register description */
/* A6 is used as framepointer by native code, so be sure it is REG_RES */
/* A0, A1, ATMP1, ATMP2, ATMP3, A5, REG_FP, REG_SP */
+#if 0
+s4 nregdescadr[] = { REG_TMP, REG_TMP, REG_RES, REG_RES, REG_RES, REG_SAV, REG_RES, REG_RES, REG_END };
+#else
s4 nregdescadr[] = { REG_TMP, REG_TMP, REG_RES, REG_RES, REG_RES, REG_SAV, REG_SAV, REG_RES, REG_END };
+#endif
const char *abi_registers_address_name [] = { "A0", "A1", "A2", "A3", "A4", "A5", "A6", "A7" };
const s4 abi_registers_address_argument[] ;
+#if 0
+const s4 abi_registers_address_saved[] = {5};
+#else
const s4 abi_registers_address_saved[] = {5,6};
+#endif
const s4 abi_registers_address_temporary[] = {0,1};
#define FLT_RES_CNT 8 /* number of float reserved registers */
#endif
+#if 0
+#define ADR_REG_CNT 8
+#define ADR_SAV_CNT 1
+#define ADR_ARG_CNT 0
+#define ADR_TMP_CNT 2
+#define ADR_RES_CNT 5
+#else
#define ADR_REG_CNT 8
#define ADR_SAV_CNT 2
#define ADR_ARG_CNT 0
#define ADR_TMP_CNT 2
#define ADR_RES_CNT 4
-
+#endif
/* packed register defines ***************************************************/
IN:
es...............execution state
- sp...............stack pointer of the execution state (XXX eliminate?)
ra...............allocation
javaval..........where to put the value
*******************************************************************************/
static void replace_read_value(executionstate_t *es,
- stackslot_t *sp,
rplalloc *ra,
replace_val_t *javaval)
{
/* XXX HAS_4BYTE_STACKSLOT may not be the right discriminant here */
#ifdef HAS_4BYTE_STACKSLOT
if (IS_2_WORD_TYPE(ra->type)) {
- javaval->l = *(u8*)(sp + ra->regoff);
+ javaval->l = *(u8*)(es->sp + ra->regoff);
}
else {
#endif
- javaval->p = sp[ra->regoff];
+ javaval->p = *(ptrint*)(es->sp + ra->regoff);
#ifdef HAS_4BYTE_STACKSLOT
}
#endif
IN:
es...............execution state
- sp...............stack pointer of the execution state (XXX eliminate?)
ra...............allocation
*javaval.........the value
*******************************************************************************/
static void replace_write_value(executionstate_t *es,
- stackslot_t *sp,
rplalloc *ra,
replace_val_t *javaval)
{
/* XXX HAS_4BYTE_STACKSLOT may not be the right discriminant here */
#ifdef HAS_4BYTE_STACKSLOT
if (IS_2_WORD_TYPE(ra->type)) {
- *(u8*)(sp + ra->regoff) = javaval->l;
+ *(u8*)(es->sp + ra->regoff) = javaval->l;
}
else {
#endif
- sp[ra->regoff] = javaval->p;
+ *(ptrint*)(es->sp + ra->regoff) = javaval->p;
#ifdef HAS_4BYTE_STACKSLOT
}
#endif
if (ra->type == TYPE_RET)
frame->javalocals[i].i = ra->regoff;
else
- replace_read_value(es, sp, ra, frame->javalocals + i);
+ replace_read_value(es, ra, frame->javalocals + i);
ra++;
count--;
}
instra.regoff = md->params[0].regoff;
if (md->params[0].inmemory) {
instra.flags = INMEMORY;
- instra.regoff += (1 + code->stackframesize);
+ instra.regoff += (1 + code->stackframesize) * SIZE_OF_STACKSLOT;
}
else {
instra.flags = 0;
}
- replace_read_value(es, sp, &instra, &(frame->instance));
+ replace_read_value(es, &instra, &(frame->instance));
#endif
}
#endif /* defined(REPLACE_PATCH_DYNAMIC_CALL) */
calleeframe->syncslotcount = 1;
calleeframe->syncslots = DMNEW(replace_val_t, 1);
- replace_read_value(es,sp,ra,calleeframe->syncslots);
+ replace_read_value(es,ra,calleeframe->syncslots);
}
frame->javastackdepth--;
if (ra->type == TYPE_RET)
frame->javastack[i].i = ra->regoff;
else
- replace_read_value(es,sp,ra,frame->javastack + i);
+ replace_read_value(es,ra,frame->javastack + i);
frame->javastacktype[i] = ra->type;
i++;
}
/* XXX assert that it matches this rplpoint */
}
else
- replace_write_value(es, sp, ra, frame->javalocals + i);
+ replace_write_value(es, ra, frame->javalocals + i);
count--;
ra++;
}
assert(frame->down->syncslotcount == 1); /* XXX need to understand more cases */
assert(frame->down->syncslots != NULL);
- replace_write_value(es,sp,ra,frame->down->syncslots);
+ replace_write_value(es,ra,frame->down->syncslots);
}
continue;
}
/* XXX assert that it matches this rplpoint */
}
else {
- replace_write_value(es,sp,ra,frame->javastack + i);
+ replace_write_value(es,ra,frame->javastack + i);
}
i++;
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: properties.c 7783 2007-04-20 13:28:27Z twisti $
+ $Id: properties.c 8132 2007-06-22 11:15:47Z twisti $
*/
bool properties_init(void)
{
#if defined(ENABLE_JAVASE)
- char *cwd;
char *env_java_home;
+ char *java_home;
+ s4 len;
+
+# if defined(WITH_CLASSPATH_GNU)
+ char *cwd;
char *env_user;
char *env_home;
char *env_lang;
- char *java_home;
char *extdirs;
char *lang;
char *country;
struct utsname *utsnamebuf;
- s4 len;
+# endif
#endif
/* create the properties list */
list_properties = list_create(OFFSET(list_properties_entry, linkage));
#if defined(ENABLE_JAVASE)
+
/* get properties from system */
- cwd = _Jv_getcwd();
env_java_home = getenv("JAVA_HOME");
- env_user = getenv("USER");
- env_home = getenv("HOME");
- env_lang = getenv("LANG");
-
- utsnamebuf = NEW(struct utsname);
-
- uname(utsnamebuf);
/* set JAVA_HOME to default prefix if not defined */
/* fill in system properties */
- properties_add("java.version", JAVA_VERSION);
- properties_add("java.vendor", "GNU Classpath");
- properties_add("java.vendor.url", "http://www.gnu.org/software/classpath/");
-
/* add /jre to java.home property */
len = strlen(env_java_home) + strlen("/jre") + strlen("0");
properties_add("java.vm.version", VERSION);
properties_add("java.vm.vendor", "CACAO Team");
properties_add("java.vm.name", "CACAO");
+
+# if defined(WITH_CLASSPATH_GNU)
+
+ /* get properties from system */
+
+ cwd = _Jv_getcwd();
+
+ env_user = getenv("USER");
+ env_home = getenv("HOME");
+ env_lang = getenv("LANG");
+
+ utsnamebuf = NEW(struct utsname);
+
+ uname(utsnamebuf);
+
+ properties_add("java.runtime.version", VERSION);
+ properties_add("java.runtime.name", "CACAO");
+
properties_add("java.specification.version", "1.5");
properties_add("java.specification.vendor", "Sun Microsystems Inc.");
properties_add("java.specification.name", "Java Platform API Specification");
- properties_add("java.class.version", CLASS_VERSION);
- properties_add("java.class.path", _Jv_classpath);
- properties_add("java.runtime.version", VERSION);
- properties_add("java.runtime.name", "CACAO");
+ properties_add("java.version", JAVA_VERSION);
+ properties_add("java.vendor", "GNU Classpath");
+ properties_add("java.vendor.url", "http://www.gnu.org/software/classpath/");
+
+ properties_add("java.class.path", _Jv_classpath);
+ properties_add("java.class.version", CLASS_VERSION);
/* Set bootclasspath properties. One for GNU classpath and the
other for compatibility with Sun (required by most
properties_add("java.boot.class.path", _Jv_bootclasspath);
properties_add("sun.boot.class.path", _Jv_bootclasspath);
-#if defined(WITH_STATIC_CLASSPATH)
+# if defined(WITH_STATIC_CLASSPATH)
properties_add("gnu.classpath.boot.library.path", ".");
properties_add("java.library.path" , ".");
-#else
+# else
/* fill gnu.classpath.boot.library.path with GNU Classpath library
path */
properties_add("gnu.classpath.boot.library.path", classpath_libdir);
properties_add("java.library.path", _Jv_java_library_path);
-#endif
+# endif
properties_add("java.io.tmpdir", "/tmp");
-#if defined(ENABLE_INTRP)
+# if defined(ENABLE_INTRP)
if (opt_intrp) {
/* XXX We don't support java.lang.Compiler */
/* properties_add("java.compiler", "cacao.intrp"); */
properties_add("gnu.java.compiler.name", "cacao.intrp");
}
else
-#endif
+# endif
{
/* XXX We don't support java.lang.Compiler */
/* properties_add("java.compiler", "cacao.jit"); */
properties_add("java.endorsed.dirs", ""CACAO_PREFIX"/jre/lib/endorsed");
-#if defined(DISABLE_GC)
+# if defined(DISABLE_GC)
/* When we disable the GC, we mmap the whole heap to a specific
address, so we can compare call traces. For this reason we have
to add the same properties on different machines, otherwise
properties_add("os.arch", "unknown");
properties_add("os.name", "unknown");
properties_add("os.version", "unknown");
-#else
+# else
/* We need to set the os.arch hardcoded to be compatible with SUN. */
-# if defined(__I386__)
+# if defined(__I386__)
/* map all x86 architectures (i386, i486, i686) to i386 */
properties_add("os.arch", "i386");
-# elif defined(__POWERPC__)
+# elif defined(__POWERPC__)
properties_add("os.arch", "ppc");
-# elif defined(__X86_64__)
+# elif defined(__X86_64__)
properties_add("os.arch", "amd64");
-# else
+# else
/* default to what uname returns */
properties_add("os.arch", utsnamebuf->machine);
-# endif
+# endif
properties_add("os.name", utsnamebuf->sysname);
properties_add("os.version", utsnamebuf->release);
-#endif
-
- properties_add("file.separator", "/");
- properties_add("path.separator", ":");
- properties_add("line.separator", "\n");
- properties_add("user.name", env_user ? env_user : "null");
- properties_add("user.home", env_home ? env_home : "null");
- properties_add("user.dir", cwd ? cwd : "null");
+# endif
-#if defined(WITH_STATIC_CLASSPATH)
+# if defined(WITH_STATIC_CLASSPATH)
/* This is just for debugging purposes and can cause troubles in
GNU Classpath. */
properties_add("gnu.cpu.endian", "unknown");
-#else
-# if WORDS_BIGENDIAN == 1
+# else
+# if WORDS_BIGENDIAN == 1
properties_add("gnu.cpu.endian", "big");
-# else
+# else
properties_add("gnu.cpu.endian", "little");
-# endif
-#endif
+# endif
+# endif
+
+ properties_add("file.separator", "/");
+ properties_add("path.separator", ":");
+ properties_add("line.separator", "\n");
+
+ properties_add("user.name", env_user ? env_user : "null");
+ properties_add("user.home", env_home ? env_home : "null");
+ properties_add("user.dir", cwd ? cwd : "null");
/* get locale */
properties_add("user.language", "en");
properties_add("user.country", "US");
}
+
+# elif defined(WITH_CLASSPATH_SUN)
+
+ properties_add("sun.boot.library.path", classpath_libdir);
+
+# else
+
+# error unknown classpath configuration
+
+# endif
+
#elif defined(ENABLE_JAVAME_CLDC1_1)
+
properties_add("microedition.configuration", "CLDC-1.1");
properties_add("microedition.platform", "generic");
properties_add("microedition.encoding", "ISO8859_1");
properties_add("microedition.profiles", "");
+
#else
-#error unknown Java configuration
+
+# error unknown Java configuration
+
#endif
/* everything's ok */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: vm.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: vm.c 8137 2007-06-22 16:41:36Z michi $
*/
#include "native/jni.h"
#include "native/native.h"
-#include "native/include/java_lang_String.h" /* required by java_lang_Class.h */
+
+#include "native/include/java_lang_Object.h" /* required by j.l.C */
+#include "native/include/java_lang_String.h" /* required by j.l.C */
+
+#if defined(WITH_CLASSPATH_SUN)
+# include "native/include/java_nio_ByteBuffer.h" /* required by j.l.CL */
+# include "native/include/java_lang_ClassLoader.h" /* required by j.l.C */
+#endif
+
#include "native/include/java_lang_Class.h"
#include "native/include/java_lang_Byte.h"
#include "native/include/java_lang_Float.h"
#include "native/include/java_lang_Double.h"
+#include "native/vm/nativevm.h"
+
#include "threads/threads-common.h"
#include "toolbox/logging.h"
#else
cacao_prefix = CACAO_PREFIX;
cacao_libjvm = CACAO_LIBDIR"/libjvm";
+
+# if defined(WITH_CLASSPATH_GNU)
classpath_libdir = CLASSPATH_LIBDIR"/classpath";
+# else
+ classpath_libdir = CLASSPATH_LIBDIR;
+# endif
#endif
/* set the bootclasspath */
if (!primitive_init())
vm_abort("vm_create: primitive_init failed");
+ if (!exceptions_init())
+ vm_abort("vm_create: exceptions_init failed");
+
+ if (!builtin_init())
+ vm_abort("vm_create: builtin_init failed");
+
/* Initialize the native subsystem. */
+ /* BEFORE: threads_init */
if (!native_init())
vm_abort("vm_create: native_init failed");
- if (!exceptions_init())
- vm_abort("vm_create: exceptions_init failed");
+ /* Register the native methods implemented in the VM. */
+ /* BEFORE: threads_init */
- if (!builtin_init())
- vm_abort("vm_create: builtin_init failed");
+ if (!nativevm_preinit())
+ vm_abort("vm_create: nativevm_preinit failed");
#if defined(ENABLE_JNI)
/* Initialize the JNI subsystem (must be done _before_
vm_abort("vm_create: threads_init failed");
#endif
+ /* Initialize the native VM subsystem. */
+ /* AFTER: threads_init (at least for SUN's classes) */
+
+ if (!nativevm_init())
+ vm_abort("vm_create: nativevm_init failed");
+
#if defined(ENABLE_PROFILING)
/* initialize profiling */
int32_t index;
if (!pd->inmemory) {
+#if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
+ index = pd->index;
+#else
index = INT_ARG_CNT + pd->index;
+#endif
#if WORDS_BIGENDIAN == 1 && !defined(__POWERPC64__)
array[index] = value >> 32;
#else
{
int32_t index;
- if (!pd->inmemory)
- index = INT_ARG_CNT + pd->index;
- else
- index = ARG_CNT + pd->index;
+ if (!pd->inmemory) {
+#if SIZEOF_VOID_P != 8 && defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
+ index = GET_LOW_REG(pd->index);
+ array[index] = value & 0x00000000ffffffff;
- array[index] = value;
+ index = GET_HIGH_REG(pd->index);
+ array[index] = value >> 32;
+#else
+ index = INT_ARG_CNT + pd->index;
+ array[index] = value;
+#endif
+ }
+ else {
+ index = ARG_CNT + pd->index;
+ array[index] = value;
+ }
}
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
static void vm_vmargs_from_valist(methodinfo *m, java_objectheader *o,
vm_arg *vmargs, va_list ap)
{
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
static void vm_vmargs_from_jvalue(methodinfo *m, java_objectheader *o,
- vm_arg *vmargs, jvalue *args)
+ vm_arg *vmargs, const jvalue *args)
{
typedesc *paramtypes;
s4 i;
}
#else
static uint64_t *vm_array_from_jvalue(methodinfo *m, java_objectheader *o,
- jvalue *args)
+ const jvalue *args)
{
methoddesc *md;
paramdesc *pd;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
bool vm_vmargs_from_objectarray(methodinfo *m, java_objectheader *o,
vm_arg *vmargs, java_objectarray *params)
{
java_objectheader *vm_call_method_valist(methodinfo *m, java_objectheader *o,
va_list ap)
{
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__ARM__) & !defined(__M68K__)
s4 vmargscount;
vm_arg *vmargs;
java_objectheader *ro;
*******************************************************************************/
java_objectheader *vm_call_method_jvalue(methodinfo *m, java_objectheader *o,
- jvalue *args)
+ const jvalue *args)
{
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
s4 vmargscount;
vm_arg *vmargs;
java_objectheader *ro;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
java_objectheader *vm_call_method_vmarg(methodinfo *m, s4 vmargscount,
vm_arg *vmargs)
{
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
{
s4 i;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
s4 vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap)
{
s4 vmargscount;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
-s4 vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) && !defined(__ARM__)
+s4 vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o,
+ const jvalue *args)
{
s4 vmargscount;
vm_arg *vmargs;
return i;
}
#else
-int32_t vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+int32_t vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o,
+ const jvalue *args)
{
int32_t dumpsize;
uint64_t *array;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
s8 vm_call_method_long_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
{
s8 l;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
s8 vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap)
{
s4 vmargscount;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
-s8 vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
+s8 vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o,
+ const jvalue *args)
{
s4 vmargscount;
vm_arg *vmargs;
return l;
}
#else
-int64_t vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+int64_t vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o,
+ const jvalue *args)
{
int32_t dumpsize;
uint64_t *array;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
float vm_call_method_float_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs)
{
float f;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
va_list ap)
{
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o,
- jvalue *args)
+ const jvalue *args)
{
s4 vmargscount;
vm_arg *vmargs;
return f;
}
#else
-float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o, const jvalue *args)
{
int32_t dumpsize;
uint64_t *array;
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
double vm_call_method_double_vmarg(methodinfo *m, s4 vmargscount,
vm_arg *vmargs)
{
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
va_list ap)
{
*******************************************************************************/
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o,
- jvalue *args)
+ const jvalue *args)
{
s4 vmargscount;
vm_arg *vmargs;
return d;
}
#else
-double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o, jvalue *args)
+double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o, const jvalue *args)
{
int32_t dumpsize;
uint64_t *array;
void vm_abort(const char *text, ...);
/* Java method calling functions */
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
bool vm_vmargs_from_objectarray(methodinfo *m, java_objectheader *o,
vm_arg *vmargs, java_objectarray *params);
#else
java_objectheader *vm_call_method_valist(methodinfo *m, java_objectheader *o,
va_list ap);
java_objectheader *vm_call_method_jvalue(methodinfo *m, java_objectheader *o,
- jvalue *args);
+ const jvalue *args);
-#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__)
+#if !defined(__MIPS__) && !defined(__X86_64__) && !defined(__POWERPC64__) && !defined(__SPARC_64__) && !defined(__M68K__) & !defined(__ARM__)
java_objectheader *vm_call_method_vmarg(methodinfo *m, s4 vmargscount,
vm_arg *vmargs);
s4 vm_call_method_int_vmarg(methodinfo *m, s4 vmargscount, vm_arg *vmargs);
s4 vm_call_method_int(methodinfo *m, java_objectheader *o, ...);
s4 vm_call_method_int_valist(methodinfo *m, java_objectheader *o, va_list ap);
-s4 vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o, jvalue *args);
+s4 vm_call_method_int_jvalue(methodinfo *m, java_objectheader *o,
+ const jvalue *args);
s8 vm_call_method_long(methodinfo *m, java_objectheader *o, ...);
s8 vm_call_method_long_valist(methodinfo *m, java_objectheader *o, va_list ap);
-s8 vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o, jvalue *args);
+s8 vm_call_method_long_jvalue(methodinfo *m, java_objectheader *o,
+ const jvalue *args);
float vm_call_method_float(methodinfo *m, java_objectheader *o, ...);
float vm_call_method_float_valist(methodinfo *m, java_objectheader *o,
va_list ap);
float vm_call_method_float_jvalue(methodinfo *m, java_objectheader *o,
- jvalue *args);
+ const jvalue *args);
double vm_call_method_double(methodinfo *m, java_objectheader *o, ...);
double vm_call_method_double_valist(methodinfo *m, java_objectheader *o,
va_list ap);
double vm_call_method_double_jvalue(methodinfo *m, java_objectheader *o,
- jvalue *args);
+ const jvalue *args);
#endif /* _VM_H */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: class.h 8123 2007-06-20 23:50:55Z michi $
+ $Id: class.h 8137 2007-06-22 16:41:36Z michi $
*/
#include "config.h"
+
+#include <stdint.h>
+
#include "vm/types.h"
#include "toolbox/list.h"
typedef struct {
java_objectheader header;
- ptrint padding[4];
+#if defined(WITH_CLASSPATH_GNU)
+ intptr_t padding[4];
+#elif defined(WITH_CLASSPATH_SUN)
+ intptr_t padding[19];
+#elif defined(WITH_CLASSPATH_CLDC1_1)
+ intptr_t padding[3];
+#else
+# error unknown classpath configuration
+#endif
} dummy_java_lang_Class;
struct classinfo { /* class structure */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: field.c 7246 2007-01-29 18:49:05Z twisti $
+ $Id: field.c 8132 2007-06-22 11:15:47Z twisti $
*/
#include "config.h"
+#include <assert.h>
#include <stdio.h>
#include "vm/types.h"
+#include "vmcore/class.h"
#include "vmcore/field.h"
+#include "vmcore/primitive.h"
#include "vmcore/references.h"
#include "vmcore/utf8.h"
+/* field_get_type **************************************************************
+
+ Returns the type of the field as class.
+
+*******************************************************************************/
+
+classinfo *field_get_type(fieldinfo *f)
+{
+ typedesc *td;
+ utf *u;
+ classinfo *c;
+
+ td = f->parseddesc;
+
+ if (td->type == TYPE_ADR) {
+ assert(td->classref);
+
+ u = td->classref->name;
+
+ /* load the class of the field-type with the field's
+ classloader */
+
+ c = load_class_from_classloader(u, f->class->classloader);
+ }
+ else {
+ c = primitive_class_get_by_type(td->decltype);
+ }
+
+ return c;
+}
+
+
/* field_free ******************************************************************
Frees a fields' resources.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: field.h 7246 2007-01-29 18:49:05Z twisti $
+ $Id: field.h 8132 2007-06-22 11:15:47Z twisti $
*/
/* function prototypes ********************************************************/
-void field_free(fieldinfo *f);
+classinfo *field_get_type(fieldinfo *f);
+void field_free(fieldinfo *f);
#if !defined(NDEBUG)
void field_printflags(fieldinfo *f);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: options.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: options.c 8134 2007-06-22 14:49:10Z twisti $
*/
/* NOTE: For better readability keep these alpha-sorted. */
+int32_t opt_MaxPermSize = 0;
+int32_t opt_PermSize = 0;
int32_t opt_ProfileGCMemoryUsage = 0;
int32_t opt_ProfileMemoryUsage = 0;
FILE *opt_ProfileMemoryUsageGNUPlot = NULL;
+int32_t opt_ThreadStackSize = 0;
int32_t opt_TraceExceptions = 0;
#if defined(ENABLE_REPLACEMENT)
int32_t opt_TraceReplacement = 0;
enum {
+ OPT_MaxPermSize,
+ OPT_PermSize,
OPT_ProfileGCMemoryUsage,
OPT_ProfileMemoryUsage,
OPT_ProfileMemoryUsageGNUPlot,
+ OPT_ThreadStackSize,
OPT_TraceExceptions,
OPT_TraceReplacement
};
option_t options_XX[] = {
+ { "MaxPermSize", OPT_MaxPermSize, "" },
+ { "PermSize", OPT_PermSize, "" },
{ "ProfileGCMemoryUsage", OPT_ProfileGCMemoryUsage, "" },
{ "ProfileMemoryUsage", OPT_ProfileMemoryUsage, "" },
{ "ProfileMemoryUsageGNUPlot", OPT_ProfileMemoryUsageGNUPlot, "" },
+ { "ThreadStackSize", OPT_ThreadStackSize, "" },
{ "TraceExceptions", OPT_TraceExceptions, "" },
#if defined(ENABLE_REPLACEMENT)
{ "TraceReplacement", OPT_TraceReplacement, "" },
void options_xx(const char *name)
{
+ char *start;
char *end;
int32_t length;
+ int32_t enable;
char *value;
int32_t option;
char *filename;
FILE *file;
int32_t i;
- log_println("name: %s", name);
+ /* Check if the option is a boolean option. */
- /* Search for a ':' in the option name and get the option name
+ if (name[0] == '+') {
+ start = name + 1;
+ enable = 1;
+ }
+ else if (name[0] == '-') {
+ start = name + 1;
+ enable = 0;
+ }
+ else {
+ start = name;
+ enable = -1;
+ }
+
+ /* Search for a '=' in the option name and get the option name
length and the value of the option. */
- end = strchr(name, ':');
+ end = strchr(start, '=');
if (end == NULL) {
- length = strlen(name);
+ length = strlen(start);
value = NULL;
}
else {
- length = end - name;
+ length = end - start;
value = end + 1;
}
option = OPT_ERROR;
for (i = 0; options_XX[i].name != NULL; i++) {
- if (strncmp(options_XX[i].name, name, length) == 0) {
+ if (strncmp(options_XX[i].name, start, length) == 0) {
option = options_XX[i].option;
break;
}
/* process the option */
switch (option) {
+ case OPT_MaxPermSize:
+ /* currently ignored */
+ break;
+
+ case OPT_PermSize:
+ /* currently ignored */
+ break;
+
case OPT_ProfileGCMemoryUsage:
if (value == NULL)
opt_ProfileGCMemoryUsage = 5;
opt_ProfileMemoryUsageGNUPlot = file;
break;
+ case OPT_ThreadStackSize:
+ /* currently ignored */
+ break;
+
case OPT_TraceExceptions:
- opt_TraceExceptions = true;
+ opt_TraceExceptions = enable;
break;
#if defined(ENABLE_REPLACEMENT)
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: options.h 8123 2007-06-20 23:50:55Z michi $
+ $Id: options.h 8134 2007-06-22 14:49:10Z twisti $
*/
/* NOTE: For better readability keep these alpha-sorted. */
+extern int32_t opt_MaxPermSize;
+extern int32_t opt_PermSize;
extern int32_t opt_ProfileGCMemoryUsage;
extern int32_t opt_ProfileMemoryUsage;
extern FILE *opt_ProfileMemoryUsageGNUPlot;
+extern int32_t opt_ThreadStackSize;
extern int32_t opt_TraceExceptions;
#if defined(ENABLE_REPLACEMENT)
extern int32_t opt_TraceReplacement;
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: utf8.c 8123 2007-06-20 23:50:55Z michi $
+ $Id: utf8.c 8132 2007-06-22 11:15:47Z twisti $
*/
utf *utf_value;
utf *utf_fillInStackTrace;
+utf *utf_findNative;
utf *utf_getSystemClassLoader;
utf *utf_initCause;
utf *utf_loadClass;
utf *utf_void__java_lang_ClassLoader; /* ()Ljava/lang/ClassLoader; */
utf *utf_void__java_lang_Object; /* ()Ljava/lang/Object; */
utf *utf_void__java_lang_Throwable; /* ()Ljava/lang/Throwable; */
+utf *utf_java_lang_ClassLoader_java_lang_String__J;
utf *utf_java_lang_Exception__V; /* (Ljava/lang/Exception;)V */
utf *utf_java_lang_Object__java_lang_Object;
utf *utf_java_lang_String__void; /* (Ljava/lang/String;)V */
utf_value = utf_new_char("value");
utf_fillInStackTrace = utf_new_char("fillInStackTrace");
+ utf_findNative = utf_new_char("findNative");
utf_getSystemClassLoader = utf_new_char("getSystemClassLoader");
utf_initCause = utf_new_char("initCause");
utf_loadClass = utf_new_char("loadClass");
utf_void__java_lang_ClassLoader =
utf_new_char("()Ljava/lang/ClassLoader;");
+ utf_java_lang_ClassLoader_java_lang_String__J =
+ utf_new_char("(Ljava/lang/ClassLoader;Ljava/lang/String;)J");
+
utf_java_lang_Exception__V = utf_new_char("(Ljava/lang/Exception;)V");
utf_java_lang_Object__java_lang_Object =
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: utf8.h 8123 2007-06-20 23:50:55Z michi $
+ $Id: utf8.h 8132 2007-06-22 11:15:47Z twisti $
*/
extern utf *utf_value;
extern utf *utf_fillInStackTrace;
+extern utf *utf_findNative;
extern utf *utf_getSystemClassLoader;
extern utf *utf_initCause;
extern utf *utf_loadClass;
extern utf *utf_void__java_lang_ClassLoader;
extern utf *utf_void__java_lang_Object;
extern utf *utf_void__java_lang_Throwable;
+extern utf *utf_java_lang_ClassLoader_java_lang_String__J;
extern utf *utf_java_lang_Exception__V;
extern utf *utf_java_lang_Object__java_lang_Object;
extern utf *utf_java_lang_String__void;