From: michi Date: Sun, 10 Jun 2007 14:49:57 +0000 (+0000) Subject: Merged revisions 8034-8055 via svnmerge from X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=fe9173152ddcefdfa39ec6a2fc77dd6113cb4cfe;p=cacao.git Merged revisions 8034-8055 via svnmerge from svn+ssh://michi@c1.complang.tuwien.ac.at/ahome/cacao/svn/cacao/trunk ........ r8041 | twisti | 2007-06-07 18:21:11 +0200 (Thu, 07 Jun 2007) | 4 lines * configure.ac (AC_CHECK_HEADERS): Check for sys/select.h, sys/stat.h, sys/types.h. (AC_CHECK_FUNCS): Check for fstat, ioctl, select. ........ r8042 | twisti | 2007-06-07 19:43:29 +0200 (Thu, 07 Jun 2007) | 9 lines * src/vmcore/class.c (class_primitive_get): New function. * src/vmcore/class.h (class_primitive_get): Added. * src/vmcore/linker.c (primitivetype_table): Changed layout. (link_primitivetype_table): Store UTF-8 name in table. * src/vmcore/linker.h (primitivetypeinfo): Changed layout, added cname, changed name to UTF-8. ........ r8043 | twisti | 2007-06-07 21:22:31 +0200 (Thu, 07 Jun 2007) | 2 lines * configure.ac (AC_CHECK_FUNCS): Added open, strerror. ........ r8044 | twisti | 2007-06-07 21:24:35 +0200 (Thu, 07 Jun 2007) | 5 lines * src/vm/builtin.c (builtin_nanotime): New function. (builtin_currenttimemillis): Use builtin_nanotime. * src/vm/builtin.h (builtin_nanotime): Added. ........ r8045 | twisti | 2007-06-07 23:52:21 +0200 (Thu, 07 Jun 2007) | 2 lines * src/native/jni.c (_Jv_JNI_FatalError): Changed error message. ........ r8046 | pm | 2007-06-08 00:02:16 +0200 (Fri, 08 Jun 2007) | 4 lines * src/vm/jit/s390/emit.c (emit_verbosecall_enter): Fix passing of float argument 2 to builtin_verbosecall_enter. * src/vm/builtin.c (builtin_print_argument): Fix malfunctioning conversion from s8 to float on s390. ........ r8047 | twisti | 2007-06-08 00:20:37 +0200 (Fri, 08 Jun 2007) | 13 lines * src/vmcore/utf8.c (utf_java_security_PrivilegedActionException): Added. (utf8_init): Initialize utf_java_security_PrivilegedActionException. * src/vmcore/utf8.h (utf_java_security_PrivilegedActionException): Added. * src/vm/exceptions.c (exceptions_throw_privilegedactionexception): New function. * src/vm/exceptions.h (exceptions_throw_privilegedactionexception): Added. ........ r8048 | twisti | 2007-06-08 00:41:54 +0200 (Fri, 08 Jun 2007) | 11 lines * src/vmcore/utf8.c (utf_java_lang_Exception__V): Added. (utf8_init): Initialize utf_java_lang_Exception__V. * src/vmcore/utf8.h (utf_java_lang_Exception__V): Added. * src/vm/exceptions.c (exceptions_throw_utf_exception): New function. (exceptions_throw_privilegedactionexception): Use exceptions_throw_utf_exception. * src/native/native.c (native_new_and_init_exception): New function. * src/native/native.h (native_new_and_init_exception): Added. ........ r8049 | twisti | 2007-06-08 01:30:45 +0200 (Fri, 08 Jun 2007) | 6 lines * src/vmcore/class.c (class_define): New function. * src/vmcore/class.h (class_define): Added. * src/native/vm/java_lang_ClassLoader.c (defineClass): Use class_define. ........ r8050 | twisti | 2007-06-08 22:04:34 +0200 (Fri, 08 Jun 2007) | 2 lines * configure.ac (AC_CHECK_FUNCS): Added lseek. ........ r8051 | twisti | 2007-06-08 22:42:54 +0200 (Fri, 08 Jun 2007) | 3 lines * m4/classpath.m4 (AC_CHECK_WITH_CLASSPATH_INCLUDEDIR): Check for jni_md.h too. ........ --HG-- branch : exact-gc --- diff --git a/configure.ac b/configure.ac index 432713ac2..a725e4f62 100644 --- a/configure.ac +++ b/configure.ac @@ -22,7 +22,7 @@ dnl along with this program; if not, write to the Free Software 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. @@ -222,7 +222,10 @@ AC_CHECK_HEADERS([unistd.h]) 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]) @@ -252,18 +255,24 @@ AC_FUNC_MMAP 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]) diff --git a/m4/classpath.m4 b/m4/classpath.m4 index 94e07079c..c54ef6120 100644 --- a/m4/classpath.m4 +++ b/m4/classpath.m4 @@ -113,4 +113,8 @@ AC_MSG_RESULT(${CLASSPATH_INCLUDEDIR}) 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)]) ]) diff --git a/src/native/jni.c b/src/native/jni.c index 33ea7eed5..d51531bd8 100644 --- a/src/native/jni.c +++ b/src/native/jni.c @@ -22,7 +22,7 @@ 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 $ */ @@ -1502,7 +1502,7 @@ void _Jv_JNI_FatalError(JNIEnv *env, const char *msg) /* this seems to be the best way */ - vm_abort(msg); + vm_abort("JNI Fatal error: %s", msg); } diff --git a/src/native/native.c b/src/native/native.c index 083e02ae6..c4a0dfa64 100644 --- a/src/native/native.c +++ b/src/native/native.c @@ -22,7 +22,7 @@ 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 $ */ @@ -956,6 +956,38 @@ java_objectheader *native_new_and_init_throwable(classinfo *c, java_objectheader } +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 diff --git a/src/native/native.h b/src/native/native.h index 9904ab696..5ca77ba42 100644 --- a/src/native/native.h +++ b/src/native/native.h @@ -22,7 +22,7 @@ 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 $ */ @@ -144,6 +144,9 @@ java_objectheader *native_new_and_init_string(classinfo *c, 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 */ diff --git a/src/native/vm/java_lang_ClassLoader.c b/src/native/vm/java_lang_ClassLoader.c index 0334c26a5..2c3f1d599 100644 --- a/src/native/vm/java_lang_ClassLoader.c +++ b/src/native/vm/java_lang_ClassLoader.c @@ -70,10 +70,8 @@ java_lang_Class *_Jv_java_lang_ClassLoader_defineClass(java_lang_ClassLoader *cl { 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; @@ -102,15 +100,6 @@ java_lang_Class *_Jv_java_lang_ClassLoader_defineClass(java_lang_ClassLoader *cl /* 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; @@ -127,82 +116,27 @@ java_lang_Class *_Jv_java_lang_ClassLoader_defineClass(java_lang_ClassLoader *cl &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; } diff --git a/src/vm/builtin.c b/src/vm/builtin.c index 1a1de55a5..a5fc298c9 100644 --- a/src/vm/builtin.c +++ b/src/vm/builtin.c @@ -28,7 +28,7 @@ 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 $ */ @@ -1385,7 +1385,12 @@ static char *builtin_print_argument(char *logtext, s4 *logtextlen, 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; @@ -2683,25 +2688,39 @@ bool builtin_arraycopy(java_arrayheader *src, s4 srcStart, } -/* 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; } diff --git a/src/vm/builtin.h b/src/vm/builtin.h index e77ef882b..b8adcda68 100644 --- a/src/vm/builtin.h +++ b/src/vm/builtin.h @@ -22,7 +22,7 @@ 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 $ */ @@ -304,6 +304,7 @@ bool builtin_arraycopy(java_arrayheader *src, s4 srcStart, 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 diff --git a/src/vm/exceptions.c b/src/vm/exceptions.c index 0e6cfc166..79dca438c 100644 --- a/src/vm/exceptions.c +++ b/src/vm/exceptions.c @@ -22,7 +22,7 @@ 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 $ */ @@ -313,6 +313,37 @@ static void exceptions_throw_utf_throwable(utf *classname, } +/* 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 @@ -1437,6 +1468,19 @@ void exceptions_throw_nullpointerexception(void) } +/* 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 diff --git a/src/vm/exceptions.h b/src/vm/exceptions.h index 118821ee0..bd58a9270 100644 --- a/src/vm/exceptions.h +++ b/src/vm/exceptions.h @@ -22,7 +22,7 @@ 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 $ */ @@ -123,6 +123,7 @@ void exceptions_throw_negativearraysizeexception(void); 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); diff --git a/src/vm/jit/s390/emit.c b/src/vm/jit/s390/emit.c index adc1c2d6b..02f961863 100644 --- a/src/vm/jit/s390/emit.c +++ b/src/vm/jit/s390/emit.c @@ -22,7 +22,7 @@ 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 $ */ @@ -505,7 +505,7 @@ void emit_verbosecall_enter(jitdata *jd) 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)) { diff --git a/src/vmcore/class.c b/src/vmcore/class.c index 42ad33215..c2fc59726 100644 --- a/src/vmcore/class.c +++ b/src/vmcore/class.c @@ -22,7 +22,7 @@ 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 $ */ @@ -282,6 +282,94 @@ void class_postset_header_vftbl(void) } } +/* 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 ********************************************* @@ -1388,6 +1476,30 @@ bool class_is_primitive(classinfo *c) } +/* 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. diff --git a/src/vmcore/class.h b/src/vmcore/class.h index 84082ba2a..e172d3a1c 100644 --- a/src/vmcore/class.h +++ b/src/vmcore/class.h @@ -22,7 +22,7 @@ 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 $ */ @@ -284,6 +284,8 @@ classinfo *class_create_classinfo(utf *u); /* 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); @@ -337,7 +339,8 @@ methodinfo *class_resolvemethod(classinfo *c, utf *name, utf *dest); 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); diff --git a/src/vmcore/linker.c b/src/vmcore/linker.c index 20e78dc8e..20a8e746d 100644 --- a/src/vmcore/linker.c +++ b/src/vmcore/linker.c @@ -22,7 +22,7 @@ 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 $ */ @@ -90,20 +90,20 @@ java_objectheader *linker_classrenumber_lock; *******************************************************************************/ 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 }; @@ -329,6 +329,7 @@ bool linker_init(void) static bool link_primitivetype_table(void) { + utf *name; classinfo *c; utf *u; s4 i; @@ -336,12 +337,18 @@ static bool link_primitivetype_table(void) 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 */ diff --git a/src/vmcore/linker.h b/src/vmcore/linker.h index 2eff2a98d..1035798f6 100644 --- a/src/vmcore/linker.h +++ b/src/vmcore/linker.h @@ -22,7 +22,7 @@ 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 $ */ @@ -137,11 +137,12 @@ struct arraydescriptor { /* 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 */ diff --git a/src/vmcore/utf8.c b/src/vmcore/utf8.c index 9d92b9157..4e045fdf3 100644 --- a/src/vmcore/utf8.c +++ b/src/vmcore/utf8.c @@ -22,7 +22,7 @@ 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 $ */ @@ -119,6 +119,8 @@ utf *utf_java_lang_StringIndexOutOfBoundsException; utf *utf_java_lang_reflect_InvocationTargetException; +utf *utf_java_security_PrivilegedActionException; + #if defined(ENABLE_JAVASE) utf* utf_java_lang_Void; #endif @@ -197,6 +199,7 @@ utf *utf_double__void; /* (D)V */ 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; @@ -347,6 +350,9 @@ bool utf8_init(void) 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"); @@ -432,6 +438,8 @@ bool utf8_init(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;"); diff --git a/src/vmcore/utf8.h b/src/vmcore/utf8.h index 415b8142e..83f990b09 100644 --- a/src/vmcore/utf8.h +++ b/src/vmcore/utf8.h @@ -22,7 +22,7 @@ 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 $ */ @@ -115,6 +115,8 @@ extern utf *utf_java_lang_StringIndexOutOfBoundsException; extern utf *utf_java_lang_reflect_InvocationTargetException; +extern utf *utf_java_security_PrivilegedActionException; + #if defined(ENABLE_JAVASE) extern utf* utf_java_lang_Void; #endif @@ -193,6 +195,7 @@ extern utf *utf_double__void; 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;