dnl Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
dnl 02110-1301, USA.
dnl
-dnl $Id: configure.ac 8027 2007-06-07 10:30:33Z michi $
+dnl $Id: configure.ac 8056 2007-06-10 14:49:57Z michi $
dnl Process this file with autoconf to produce a configure script.
AC_CHECK_HEADERS([sys/ioctl.h])
AC_CHECK_HEADERS([sys/mman.h])
AC_CHECK_HEADERS([sys/resource.h])
+AC_CHECK_HEADERS([sys/select.h])
+AC_CHECK_HEADERS([sys/stat.h])
AC_CHECK_HEADERS([sys/time.h])
+AC_CHECK_HEADERS([sys/types.h])
dnl this is for fdlibm
AC_CHECK_HEADERS([stdint.h])
dnl keep them alpha-sorted!
AC_CHECK_FUNCS([calloc])
AC_CHECK_FUNCS([confstr])
-AC_CHECK_FUNCS([getpagesize])
AC_CHECK_FUNCS([free])
+AC_CHECK_FUNCS([fstat])
AC_CHECK_FUNCS([getcwd])
-AC_CHECK_FUNCS([gettimeofday])
+AC_CHECK_FUNCS([getpagesize])
AC_CHECK_FUNCS([getrusage])
+AC_CHECK_FUNCS([gettimeofday])
+AC_CHECK_FUNCS([ioctl])
AC_CHECK_FUNCS([isnan])
AC_CHECK_FUNCS([localtime])
AC_CHECK_FUNCS([localtime_r])
+AC_CHECK_FUNCS([lseek])
AC_CHECK_FUNCS([mmap])
AC_CHECK_FUNCS([mprotect])
+AC_CHECK_FUNCS([open])
AC_CHECK_FUNCS([scandir])
+AC_CHECK_FUNCS([select])
AC_CHECK_FUNCS([strdup])
+AC_CHECK_FUNCS([strerror])
AC_CHECK_FUNCS([strstr])
AC_CHECK_FUNCS([time])
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)])
])
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: jni.c 7940 2007-05-23 09:42:08Z michi $
+ $Id: jni.c 8056 2007-06-10 14:49:57Z michi $
*/
/* this seems to be the best way */
- vm_abort(msg);
+ vm_abort("JNI Fatal error: %s", msg);
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: native.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: native.c 8056 2007-06-10 14:49:57Z michi $
*/
}
+java_objectheader *native_new_and_init_exception(classinfo *c, java_objectheader *e)
+{
+ java_objectheader *o;
+ methodinfo *m;
+
+ if (c == NULL)
+ vm_abort("native_new_and_init_exception: c == NULL");
+
+ /* create object */
+
+ o = builtin_new(c);
+
+ if (o == NULL)
+ return NULL;
+
+ /* find initializer */
+
+ m = class_findmethod(c, utf_init, utf_java_lang_Exception__V);
+
+ /* initializer not found */
+
+ if (m == NULL)
+ return NULL;
+
+ /* call initializer */
+
+ (void) vm_call_method(m, o, e);
+
+ return o;
+}
+
+
/*
* 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
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: native.h 8027 2007-06-07 10:30:33Z michi $
+ $Id: native.h 8056 2007-06-10 14:49:57Z michi $
*/
java_objectheader *native_new_and_init_throwable(classinfo *c,
java_objectheader *t);
+java_objectheader *native_new_and_init_exception(classinfo *c,
+ java_objectheader *e);
+
#endif /* _NATIVE_H */
{
utf *utfname;
classinfo *c;
- classinfo *r;
- classbuffer *cb;
classloader *loader;
- java_lang_Class *co;
+ java_lang_Class *o;
#if defined(ENABLE_JVMTI)
jint new_class_data_len = 0;
unsigned char* new_class_data = NULL;
/* convert '.' to '/' in java string */
utfname = javastring_toutf((java_objectheader *) name, true);
-
- /* check if this class has already been defined */
-
- c = classcache_lookup_defined_or_initiated(cl, utfname);
-
- if (c != NULL) {
- exceptions_throw_linkageerror("duplicate class definition: ", c);
- return NULL;
- }
}
else {
utfname = NULL;
&new_class_data_len, &new_class_data);
#endif
- /* create a new classinfo struct */
-
- c = class_create_classinfo(utfname);
-
-#if defined(ENABLE_STATISTICS)
- /* measure time */
-
- if (opt_getloadingtime)
- loadingtime_start();
-#endif
+ /* define the class */
- /* build a classbuffer with the given data */
-
- cb = NEW(classbuffer);
- cb->class = c;
#if defined(ENABLE_JVMTI)
/* check if the JVMTI wants to modify the class */
- if (new_class_data == NULL) {
-#endif
- cb->size = len;
- cb->data = (u1 *) &data->data[offset];
-#if defined(ENABLE_JVMTI)
- } else {
- cb->size = new_class_data_len;
- cb->data = (u1 *) new_class_data;
- }
-#endif
- cb->pos = cb->data;
-
- /* preset the defining classloader */
- c->classloader = loader;
-
- /* load the class from this buffer */
-
- r = load_class_from_classbuffer(cb);
-
- /* free memory */
-
- FREE(cb, classbuffer);
-
-#if defined(ENABLE_STATISTICS)
- /* measure time */
-
- if (opt_getloadingtime)
- loadingtime_stop();
+ if (new_class_data == NULL)
+ c = class_define(utfname, loader, new_class_data_len, new_class_data);
+ else
#endif
+ c = class_define(utfname, loader, len, (u1 *) &data->data[offset]);
- if (r == NULL) {
- /* If return value is NULL, we had a problem and the class is
- not loaded. Now free the allocated memory, otherwise we
- could run into a DOS. */
-
- class_free(c);
-
+ if (c == NULL)
return NULL;
- }
/* set ProtectionDomain */
- co = (java_lang_Class *) c;
-
- co->pd = pd;
-
- /* Store the newly defined class in the class cache. This call also */
- /* checks whether a class of the same name has already been defined by */
- /* the same defining loader, and if so, replaces the newly created class */
- /* by the one defined earlier. */
- /* Important: The classinfo given to classcache_store must be */
- /* fully prepared because another thread may return this */
- /* pointer after the lookup at to top of this function */
- /* directly after the class cache lock has been released. */
+ o = (java_lang_Class *) c;
- c = classcache_store(loader, c, true);
+ o->pd = pd;
- return (java_lang_Class *) c;
+ return o;
}
calls instead of machine instructions, using the C calling
convention.
- $Id: builtin.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: builtin.c 8056 2007-06-10 14:49:57Z michi $
*/
break;
case TYPE_FLT:
+#if defined(__S390__)
+ imu.l = value;
+ /* The below won't work on S390 */
+#else
imu.i = (s4) value;
+#endif
sprintf(logtext + strlen(logtext), "%g (0x%08x)", imu.f, imu.i);
break;
}
-/* builtin_currenttimemillis ***************************************************
+/* builtin_nanotime ************************************************************
- Return the current time in milliseconds.
+ Return the current time in nanoseconds.
*******************************************************************************/
-s8 builtin_currenttimemillis(void)
+s8 builtin_nanotime(void)
{
struct timeval tv;
- s8 result;
+ s8 usecs;
if (gettimeofday(&tv, NULL) == -1)
vm_abort("gettimeofday failed: %s", strerror(errno));
- result = (s8) tv.tv_sec;
- result *= 1000;
- result += (tv.tv_usec / 1000);
+ usecs = (s8) tv.tv_sec * (1000 * 1000) + (s8) tv.tv_usec;
- return result;
+ return usecs * 1000;
+}
+
+
+/* builtin_currenttimemillis ***************************************************
+
+ Return the current time in milliseconds.
+
+*******************************************************************************/
+
+s8 builtin_currenttimemillis(void)
+{
+ s8 msecs;
+
+ msecs = builtin_nanotime() / 1000 / 1000;
+
+ return msecs;
}
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: builtin.h 7797 2007-04-23 20:12:39Z michi $
+ $Id: builtin.h 8056 2007-06-10 14:49:57Z michi $
*/
java_arrayheader *dest, s4 destStart, s4 len);
#define BUILTIN_arraycopy (functionptr) builtin_arraycopy
+s8 builtin_nanotime(void);
s8 builtin_currenttimemillis(void);
#define BUILTIN_currenttimemillis (functionptr) builtin_currenttimemillis
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: exceptions.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: exceptions.c 8056 2007-06-10 14:49:57Z michi $
*/
}
+/* exceptions_throw_utf_exception **********************************************
+
+ Creates an exception object with the given name and initalizes it
+ with the given java/lang/Exception exception.
+
+ IN:
+ classname....class name in UTF-8
+ exception....the given Exception
+
+*******************************************************************************/
+
+static void exceptions_throw_utf_exception(utf *classname,
+ java_objectheader *exception)
+{
+ java_objectheader *o;
+ classinfo *c;
+
+ c = load_class_bootstrap(classname);
+
+ if (c == NULL)
+ return;
+
+ o = native_new_and_init_exception(c, exception);
+
+ if (o == NULL)
+ return;
+
+ *exceptionptr = o;
+}
+
+
/* exceptions_new_utf_javastring ***********************************************
Creates an exception object with the given name and initalizes it
}
+/* exceptions_throw_privilegedactionexception **********************************
+
+ Generates and throws a java.security.PrivilegedActionException.
+
+*******************************************************************************/
+
+void exceptions_throw_privilegedactionexception(java_objectheader *exception)
+{
+ exceptions_throw_utf_exception(utf_java_security_PrivilegedActionException,
+ exception);
+}
+
+
/* exceptions_throw_stringindexoutofboundsexception ****************************
Generates and throws a java.lang.StringIndexOutOfBoundsException
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: exceptions.h 8027 2007-06-07 10:30:33Z michi $
+ $Id: exceptions.h 8056 2007-06-10 14:49:57Z michi $
*/
java_objectheader *exceptions_new_nullpointerexception(void);
void exceptions_throw_nullpointerexception(void);
+void exceptions_throw_privilegedactionexception(java_objectheader *cause);
void exceptions_throw_stringindexoutofboundsexception(void);
java_objectheader *exceptions_fillinstacktrace(void);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: emit.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: emit.c 8056 2007-06-10 14:49:57Z michi $
*/
if (IS_FLT_DBL_TYPE(t)) {
if (fargctr < 2) { /* passed in register */
- N_STD(REG_FA0 + fargctr, doff, RN, REG_SP);
+ N_STD(abi_registers_float_argument[fargctr], doff, RN, REG_SP);
fargctr += 1;
} else { /* passed on stack */
if (IS_2_WORD_TYPE(t)) {
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: class.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: class.c 8056 2007-06-10 14:49:57Z michi $
*/
}
}
+/* class_define ****************************************************************
+
+ Calls the loader and defines a class in the VM.
+
+*******************************************************************************/
+
+classinfo *class_define(utf *name, java_objectheader *cl, s4 length, u1 *data)
+{
+ classinfo *c;
+ classinfo *r;
+ classbuffer *cb;
+
+ if (name != NULL) {
+ /* check if this class has already been defined */
+
+ c = classcache_lookup_defined_or_initiated(cl, name);
+
+ if (c != NULL) {
+ exceptions_throw_linkageerror("duplicate class definition: ", c);
+ return NULL;
+ }
+ }
+
+ /* create a new classinfo struct */
+
+ c = class_create_classinfo(name);
+
+#if defined(ENABLE_STATISTICS)
+ /* measure time */
+
+ if (opt_getloadingtime)
+ loadingtime_start();
+#endif
+
+ /* build a classbuffer with the given data */
+
+ cb = NEW(classbuffer);
+
+ cb->class = c;
+ cb->size = length;
+ cb->data = data;
+ cb->pos = cb->data;
+
+ /* preset the defining classloader */
+
+ c->classloader = cl;
+
+ /* load the class from this buffer */
+
+ r = load_class_from_classbuffer(cb);
+
+ /* free memory */
+
+ FREE(cb, classbuffer);
+
+#if defined(ENABLE_STATISTICS)
+ /* measure time */
+
+ if (opt_getloadingtime)
+ loadingtime_stop();
+#endif
+
+ if (r == NULL) {
+ /* If return value is NULL, we had a problem and the class is
+ not loaded. Now free the allocated memory, otherwise we
+ could run into a DOS. */
+
+ class_free(c);
+
+ return NULL;
+ }
+
+ /* Store the newly defined class in the class cache. This call
+ also checks whether a class of the same name has already been
+ defined by the same defining loader, and if so, replaces the
+ newly created class by the one defined earlier. */
+
+ /* Important: The classinfo given to classcache_store must be
+ fully prepared because another thread may return
+ this pointer after the lookup at to top of this
+ function directly after the class cache lock has
+ been released. */
+
+ c = classcache_store(cl, c, true);
+
+ return c;
+}
+
/* class_load_attribute_sourcefile *********************************************
}
+/* class_primitive_get *********************************************************
+
+ Returns the primitive class of the given class name.
+
+*******************************************************************************/
+
+classinfo *class_primitive_get(utf *name)
+{
+ s4 i;
+
+ /* search table of primitive classes */
+
+ for (i = 0; i < PRIMITIVETYPE_COUNT; i++)
+ if (primitivetype_table[i].name == name)
+ return primitivetype_table[i].class_primitive;
+
+ vm_abort("class_primitive_get: unknown primitive type");
+
+ /* keep compiler happy */
+
+ return NULL;
+}
+
+
/* class_issubclass ************************************************************
Checks if sub is a descendant of super.
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: class.h 8027 2007-06-07 10:30:33Z michi $
+ $Id: class.h 8056 2007-06-10 14:49:57Z michi $
*/
/* postset's the header.vftbl */
void class_postset_header_vftbl(void);
+classinfo *class_define(utf *name, java_objectheader *cl, s4 length, u1 *data);
+
/* set the package name after the name has been set */
void class_set_packagename(classinfo *c);
methodinfo *class_resolveclassmethod(classinfo *c, utf *name, utf *dest, classinfo *referer, bool throwexception);
methodinfo *class_resolveinterfacemethod(classinfo *c, utf *name, utf *dest, classinfo *referer, bool throwexception);
-bool class_is_primitive(classinfo *c);
+classinfo *class_primitive_get(utf *name);
+bool class_is_primitive(classinfo *c);
bool class_issubclass(classinfo *sub, classinfo *super);
bool class_isanysubclass(classinfo *sub, classinfo *super);
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: linker.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: linker.c 8056 2007-06-10 14:49:57Z michi $
*/
*******************************************************************************/
primitivetypeinfo primitivetype_table[PRIMITIVETYPE_COUNT] = {
- { NULL, NULL, "java/lang/Integer", 'I', "int" , "[I", NULL, NULL },
- { NULL, NULL, "java/lang/Long", 'J', "long" , "[J", NULL, NULL },
- { NULL, NULL, "java/lang/Float", 'F', "float" , "[F", NULL, NULL },
- { NULL, NULL, "java/lang/Double", 'D', "double" , "[D", NULL, NULL },
- { NULL, NULL, NULL, 0 , NULL , NULL, NULL, NULL },
- { NULL, NULL, "java/lang/Byte", 'B', "byte" , "[B", NULL, NULL },
- { NULL, NULL, "java/lang/Character", 'C', "char" , "[C", NULL, NULL },
- { NULL, NULL, "java/lang/Short", 'S', "short" , "[S", NULL, NULL },
- { NULL, NULL, "java/lang/Boolean", 'Z', "boolean" , "[Z", NULL, NULL },
- { NULL, NULL, NULL, 0 , NULL , NULL, NULL, NULL },
+ { "int" , NULL, NULL, NULL, "java/lang/Integer", 'I', "[I", NULL, NULL },
+ { "long" , NULL, NULL, NULL, "java/lang/Long", 'J', "[J", NULL, NULL },
+ { "float" , NULL, NULL, NULL, "java/lang/Float", 'F', "[F", NULL, NULL },
+ { "double" , NULL, NULL, NULL, "java/lang/Double", 'D', "[D", NULL, NULL },
+ { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL, NULL },
+ { "byte" , NULL, NULL, NULL, "java/lang/Byte", 'B', "[B", NULL, NULL },
+ { "char" , NULL, NULL, NULL, "java/lang/Character", 'C', "[C", NULL, NULL },
+ { "short" , NULL, NULL, NULL, "java/lang/Short", 'S', "[S", NULL, NULL },
+ { "boolean" , NULL, NULL, NULL, "java/lang/Boolean", 'Z', "[Z", NULL, NULL },
+ { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL, NULL },
#if defined(ENABLE_JAVASE)
- { NULL, NULL, "java/lang/Void", 'V', "void" , NULL, NULL, NULL }
+ { "void" , NULL, NULL, NULL, "java/lang/Void", 'V', NULL, NULL, NULL }
#else
- { NULL, NULL, NULL, 0 , NULL , NULL, NULL, NULL },
+ { NULL , NULL, NULL, NULL, NULL, 0 , NULL, NULL, NULL },
#endif
};
static bool link_primitivetype_table(void)
{
+ utf *name;
classinfo *c;
utf *u;
s4 i;
for (i = 0; i < PRIMITIVETYPE_COUNT; i++) {
/* skip dummies */
- if (!primitivetype_table[i].name)
+ if (primitivetype_table[i].cname == NULL)
continue;
-
+
+ /* create UTF-8 name */
+
+ name = utf_new_char(primitivetype_table[i].cname);
+
+ primitivetype_table[i].name = name;
+
/* create primitive class */
- c = class_create_classinfo(utf_new_char(primitivetype_table[i].name));
+ c = class_create_classinfo(name);
/* primitive classes don't have a super class */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: linker.h 7688 2007-04-12 09:05:12Z michi $
+ $Id: linker.h 8056 2007-06-10 14:49:57Z michi $
*/
/* primitivetypeinfo **********************************************************/
struct primitivetypeinfo {
+ char *cname; /* char name of primitive class */
+ utf *name; /* name of primitive class */
classinfo *class_wrap; /* class for wrapping primitive type */
classinfo *class_primitive; /* primitive class */
char *wrapname; /* name of class for wrapping */
char typesig; /* one character type signature */
- char *name; /* name of primitive class */
char *arrayname; /* name of primitive array class */
classinfo *arrayclass; /* primitive array class */
vftbl_t *arrayvftbl; /* vftbl of primitive array class */
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: utf8.c 8027 2007-06-07 10:30:33Z michi $
+ $Id: utf8.c 8056 2007-06-10 14:49:57Z michi $
*/
utf *utf_java_lang_reflect_InvocationTargetException;
+utf *utf_java_security_PrivilegedActionException;
+
#if defined(ENABLE_JAVASE)
utf* utf_java_lang_Void;
#endif
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_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 *utf_java_lang_String__java_lang_Class;
utf_java_lang_reflect_InvocationTargetException =
utf_new_char("java/lang/reflect/InvocationTargetException");
+
+ utf_java_security_PrivilegedActionException =
+ utf_new_char("java/security/PrivilegedActionException");
#if defined(ENABLE_JAVASE)
utf_java_lang_Void = utf_new_char("java/lang/Void");
utf_void__java_lang_ClassLoader =
utf_new_char("()Ljava/lang/ClassLoader;");
+ utf_java_lang_Exception__V = utf_new_char("(Ljava/lang/Exception;)V");
+
utf_java_lang_Object__java_lang_Object =
utf_new_char("(Ljava/lang/Object;)Ljava/lang/Object;");
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: utf8.h 8027 2007-06-07 10:30:33Z michi $
+ $Id: utf8.h 8056 2007-06-10 14:49:57Z michi $
*/
extern utf *utf_java_lang_reflect_InvocationTargetException;
+extern utf *utf_java_security_PrivilegedActionException;
+
#if defined(ENABLE_JAVASE)
extern utf* utf_java_lang_Void;
#endif
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_Exception__V;
extern utf *utf_java_lang_Object__java_lang_Object;
extern utf *utf_java_lang_String__void;
extern utf *utf_java_lang_String__java_lang_Class;