generate package names correctly, now they are not allways (utf*)0. Adds a new crash...
authorjowenn <none@none>
Mon, 20 Dec 2004 20:16:57 +0000 (20:16 +0000)
committerjowenn <none@none>
Mon, 20 Dec 2004 20:16:57 +0000 (20:16 +0000)
13 files changed:
src/native/include/gnu_java_awt_peer_gtk_GdkFontPeer.h
src/native/jni.c
src/native/vm/Field.c
src/native/vm/Method.c
src/native/vm/VMClass.c
src/vm/builtin.c
src/vm/exceptions.c
src/vm/exceptions.h
src/vm/jit/stacktrace.c
src/vm/jit/stacktrace.h
src/vm/jit/verify/typecheck.c
src/vm/tables.c
tests/stack/sleep_exception.java [new file with mode: 0644]

index b26e5cd990f75871fe6a06fc7b5e1927e8dfe142..c20bbf15957c0b8a906f5db3ac06b70689006265 100644 (file)
@@ -1,46 +1,52 @@
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class gnu_java_awt_peer_gtk_GdkFontPeer */
-
-#ifndef _Included_gnu_java_awt_peer_gtk_GdkFontPeer
-#define _Included_gnu_java_awt_peer_gtk_GdkFontPeer
-#ifdef __cplusplus
-extern "C" {
-#endif
-/* Inaccessible static: bundle */
+/* This file is machine generated, don't edit it !*/
+
+#ifndef _GNU_JAVA_AWT_PEER_GTK_GDKFONTPEER_H
+#define _GNU_JAVA_AWT_PEER_GTK_GDKFONTPEER_H
+
+/* Structure information for class: gnu/java/awt/peer/gtk/GdkFontPeer */
+
+typedef struct gnu_java_awt_peer_gtk_GdkFontPeer {
+   java_objectheader header;
+   struct java_lang_String* logicalName;
+   struct java_lang_String* familyName;
+   struct java_lang_String* faceName;
+   s4 style;
+   float size;
+   struct java_awt_geom_AffineTransform* transform;
+   s4 native_state;
+} gnu_java_awt_peer_gtk_GdkFontPeer;
+
+
 /*
- * Class:     gnu_java_awt_peer_gtk_GdkFontPeer
+ * Class:     gnu/java/awt/peer/gtk/GdkFontPeer
  * Method:    initStaticState
  * Signature: ()V
  */
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_initStaticState
-  (JNIEnv *, jclass);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_initStaticState(JNIEnv *env, jclass clazz);
+
 
 /*
- * Class:     gnu_java_awt_peer_gtk_GdkFontPeer
+ * Class:     gnu/java/awt/peer/gtk/GdkFontPeer
  * Method:    initState
  * Signature: ()V
  */
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_initState
-  (JNIEnv *, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_initState(JNIEnv *env, struct gnu_java_awt_peer_gtk_GdkFontPeer* this);
+
 
 /*
- * Class:     gnu_java_awt_peer_gtk_GdkFontPeer
+ * Class:     gnu/java/awt/peer/gtk/GdkFontPeer
  * Method:    dispose
  * Signature: ()V
  */
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose
-  (JNIEnv *, jobject);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_dispose(JNIEnv *env, struct gnu_java_awt_peer_gtk_GdkFontPeer* this);
+
 
 /*
- * Class:     gnu_java_awt_peer_gtk_GdkFontPeer
+ * Class:     gnu/java/awt/peer/gtk/GdkFontPeer
  * Method:    setFont
  * Signature: (Ljava/lang/String;IIZ)V
  */
-JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont
-  (JNIEnv *, jobject, jstring, jint, jint, jboolean);
+JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GdkFontPeer_setFont(JNIEnv *env, struct gnu_java_awt_peer_gtk_GdkFontPeer* this, struct java_lang_String* par1, s4 par2, s4 par3, s4 par4);
 
-#ifdef __cplusplus
-}
-#endif
 #endif
+
index 8b1c644b41438e61c92c0f473936502296ff3d85..f016a47dd618db89d0b35e790ede36372b9baf0c 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Joseph Wenninger, Martin Platter
 
-   $Id: jni.c 1771 2004-12-17 23:05:27Z jowenn $
+   $Id: jni.c 1774 2004-12-20 20:16:57Z jowenn $
 
 */
 
@@ -3583,14 +3583,13 @@ jobject *jni_method_invokeNativeHelper(JNIEnv *env, struct methodinfo *methodID,
                return 0;
        }
 #endif
-
-       if (((!params) && (argcount != 0)) || (params && (params->header.size != argcount))) {
+       if (((params==0) && (argcount != 0)) || (params && (params->header.size != argcount))) {
                *exceptionptr = new_exception(string_java_lang_IllegalArgumentException);
                return 0;
        }
 
 
-       if (!(methodID->flags & ACC_STATIC) && (!obj))  {
+       if (((methodID->flags & ACC_STATIC)==0) && (0==obj))  {
                *exceptionptr =
                        new_exception_message(string_java_lang_NullPointerException,
                                                                  "Static mismatch in Java_java_lang_reflect_Method_invokeNative");
@@ -3599,6 +3598,12 @@ jobject *jni_method_invokeNativeHelper(JNIEnv *env, struct methodinfo *methodID,
 
        if ((methodID->flags & ACC_STATIC) && (obj)) obj = 0;
 
+       if (obj) {
+               if ( (methodID->flags & ACC_ABSTRACT) || (methodID->class->flags & ACC_INTERFACE) ) {
+                       methodID=get_virtual(obj,methodID);
+               }
+       }
+
        blk = MNEW(jni_callblock, /*4 */argcount+2);
 
        retT = fill_callblock_objA(obj, methodID->descriptor, blk, params);
index 6b2fe40162417251abea49b583f560808e6d032c..7c505594a98f79f82f52ec321366541b667bbfae 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Joseph Wenninger
 
-   $Id: Field.c 1765 2004-12-15 17:25:04Z jowenn $
+   $Id: Field.c 1774 2004-12-20 20:16:57Z jowenn $
 
 */
 
 #include "vm/loader.h"
 #include "vm/tables.h"
 #include "vm/loader.h"
+#include "vm/global.h"
+#include "vm/builtin.h"
+#include "vm/jit/stacktrace.h"
+#include "vm/exceptions.h"
 
 #undef DEBUG
 
+#ifdef __GNUC__
+#warning       FIXE SET NATIVES
+#endif
+
+#if (defined(__ALPHA__) || defined(__I386__))
+/*this = java_lang_reflect_Field, fi=fieldinfo, c=declaredClass (classinfo)*/
+#define CHECKFIELDACCESS(this,fi,c)    \
+       /*log_text("Checking access rights");*/ \
+       if (!(getField(this,jboolean,getFieldID_critical(env,this->header.vftbl->class,"flag","Z")))) { \
+               int throwAccess=0;      \
+               struct methodinfo *callingMethod;       \
+       \
+               if ((fi->flags & ACC_PUBLIC)==0) {      \
+                       callingMethod=cacao_callingMethod();    \
+       \
+                       if ((fi->flags & ACC_PRIVATE)!=0) {     \
+                               if (c!=callingMethod->class) {  \
+                                       throwAccess=1;  \
+                               }       \
+                       } else {        \
+                               if ((fi->flags & ACC_PROTECTED)!=0) {   \
+                                       if (!builtin_isanysubclass(callingMethod->class, c)) {  \
+                                               throwAccess=1;  \
+                                       }       \
+                               } else {        \
+                                       /* default visibility*/ \
+                                       if (c->packagename!=callingMethod->class->packagename) {        \
+                                               throwAccess=1;  \
+                                       }       \
+                               }       \
+                       }       \
+               }       \
+               if (throwAccess) {      \
+                       *exceptionptr=0;        \
+                       *exceptionptr = new_exception(string_java_lang_IllegalAccessException); \
+                       return 0;       \
+               }       \
+       }       
+#else
+define CHECKFIELDACCESS(this,fi)
+#endif
+
+
+
+
+
+
+
 /*
  * Class:     java/lang/reflect/Field
  * Method:    get
@@ -57,10 +109,15 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Field_get(JNIEnv *env
        jfieldID fid;          /* the JNI-fieldid of the field containing the value */
        jobject o;               /* the object for wrapping the primitive type */
        classinfo *c = (classinfo *) this->declaringClass;
-       int st = (this->flag & ACC_STATIC); /* true if field is static */
+       int st;
 
        /* get the fieldid of the field represented by this Field-object */
-       fid = class_findfield_approx((classinfo *) this->declaringClass,javastring_toutf(this->name, false));
+       fid=&((classinfo*)this->declaringClass)->fields[this->slot]; /*get field*/
+       /*fid = class_findfield_approx((classinfo *) this->declaringClass,javastring_toutf(this->name, false));*/
+       st = (fid->flags & ACC_STATIC); /* true if field is static */
+
+
+       CHECKFIELDACCESS(this,fid,c);
 
        /* The fieldid is used to retrieve the value, for primitive types a new 
           object for wrapping the primitive type is created.  */
@@ -207,21 +264,59 @@ JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Field_get(JNIEnv *env
 JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getBoolean(JNIEnv *env, java_lang_reflect_Field *this, java_lang_Object *obj)
 {
        jfieldID fid;
+       char *utf_ptr;
+       classinfo *c = (classinfo *) this->declaringClass;
 
-       if (this->declaringClass && obj) {
-               /* get the fieldid represented by the field-object */
-               fid = class_findfield_approx((classinfo *) this->declaringClass,
-                                                                        javastring_toutf(this->name, false));
-
-               if (fid)
-                       /* call the JNI-function to retrieve the field */ 
-                       return (*env)->GetBooleanField(env, (jobject) obj, fid);
+#ifdef DEBUG
+       /* check if the specified slot could be a valid field of this class*/
+       if (this->slot>((classinfo*)this->declaringClass)->fieldscount) throw_cacao_exception_exit(string_java_lang_IncompatibleClassChangeError,
+                                                                          "declaring class: fieldscount mismatch");
+#endif
+       fid=&((classinfo*)this->declaringClass)->fields[this->slot]; /*get field*/
+       CHECKFIELDACCESS(this,fid,c);
+#ifdef DEBUG
+       /* check if the field really has the same name and check if the type descriptor is not empty*/
+       if (fid->name!=javastring_toutf(this->name,false)) throw_cacao_exception_exit(string_java_lang_IncompatibleClassChangeError,
+                                                                          "declaring class: field name mismatch");
+       if (fid->descriptor->blength<1) panic("Type-Descriptor is empty");
+#endif
+       /* check if obj would be needed (not static field), but is 0)*/
+       if ((!(fid->flags & ACC_STATIC)) && (obj==0)) {
+               *exceptionptr = new_exception(string_java_lang_NullPointerException);
+               return 0;
        }
+       
+       /*if (!(fid->flags & ACC_PUBLIC)) {
+               *exceptionptr = new_exception(string_java_lang_IllegalArgumentException);
+               return 0;
 
-       /* raise exception */
-       *exceptionptr = new_exception(string_java_lang_IllegalArgumentException);
+       } */
 
-       return 0;
+       if (fid->flags & ACC_STATIC) {
+               /* initialize class if needed*/
+               class_init((classinfo*)this->declaringClass);
+               if (*exceptionptr) return 0;
+               /*return value*/
+                utf_ptr = fid->descriptor->text;
+                switch (*utf_ptr) {
+                       case 'Z': return fid->value.i;
+                        default:
+                                *exceptionptr = new_exception(string_java_lang_IllegalArgumentException);
+                                return 0;
+                }
+       } else {
+               if (!builtin_instanceof((java_objectheader*)obj,(classinfo*)this->declaringClass)) {
+                               *exceptionptr = new_exception(string_java_lang_IllegalArgumentException);
+                               return 0;
+               }
+               utf_ptr = fid->descriptor->text;
+               switch (*utf_ptr) {
+                       case 'Z':return getField(obj,jboolean,fid);
+                       default:
+                               *exceptionptr = new_exception(string_java_lang_IllegalArgumentException);
+                               return 0;
+               }
+       }
 }
 
 
@@ -234,6 +329,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getByte(JNIEnv *env, java_lang
 {
        jfieldID fid;
        char *utf_ptr;
+       classinfo *c = (classinfo *) this->declaringClass;
 
 #ifdef DEBUG
        /* check if the specified slot could be a valid field of this class*/
@@ -241,6 +337,8 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getByte(JNIEnv *env, java_lang
                                                                           "declaring class: fieldscount mismatch");
 #endif
        fid=&((classinfo*)this->declaringClass)->fields[this->slot]; /*get field*/
+
+       CHECKFIELDACCESS(this,fid,c);
 #ifdef DEBUG
        /* check if the field really has the same name and check if the type descriptor is not empty*/
        if (fid->name!=javastring_toutf(this->name,false)) throw_cacao_exception_exit(string_java_lang_IncompatibleClassChangeError,
@@ -296,6 +394,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getChar(JNIEnv *env, java_lang
 {
        jfieldID fid;
        char *utf_ptr;
+       classinfo *c = (classinfo *) this->declaringClass;
 
 #ifdef DEBUG
        /* check if the specified slot could be a valid field of this class*/
@@ -303,6 +402,8 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getChar(JNIEnv *env, java_lang
                                                                           "declaring class: fieldscount mismatch");
 #endif
        fid=&((classinfo*)this->declaringClass)->fields[this->slot]; /*get field*/
+       CHECKFIELDACCESS(this,fid,c);
+
 #ifdef DEBUG
        /* check if the field really has the same name and check if the type descriptor is not empty*/
        if (fid->name!=javastring_toutf(this->name,false)) throw_cacao_exception_exit(string_java_lang_IncompatibleClassChangeError,
@@ -358,6 +459,7 @@ JNIEXPORT double JNICALL Java_java_lang_reflect_Field_getDouble(JNIEnv *env , ja
 {
        jfieldID fid;
        char *utf_ptr;
+       classinfo *c = (classinfo *) this->declaringClass;
 
 #ifdef DEBUG
        /* check if the specified slot could be a valid field of this class*/
@@ -365,6 +467,8 @@ JNIEXPORT double JNICALL Java_java_lang_reflect_Field_getDouble(JNIEnv *env , ja
                                                                           "declaring class: fieldscount mismatch");
 #endif
        fid=&((classinfo*)this->declaringClass)->fields[this->slot]; /*get field*/
+       CHECKFIELDACCESS(this,fid,c);
+
 #ifdef DEBUG
        /* check if the field really has the same name and check if the type descriptor is not empty*/
        if (fid->name!=javastring_toutf(this->name,false)) throw_cacao_exception_exit(string_java_lang_IncompatibleClassChangeError,
@@ -429,6 +533,7 @@ JNIEXPORT float JNICALL Java_java_lang_reflect_Field_getFloat(JNIEnv *env, java_
 {
        jfieldID fid;
        char *utf_ptr;
+       classinfo *c = (classinfo *) this->declaringClass;
 
 #ifdef DEBUG
        /* check if the specified slot could be a valid field of this class*/
@@ -436,6 +541,8 @@ JNIEXPORT float JNICALL Java_java_lang_reflect_Field_getFloat(JNIEnv *env, java_
                                                                           "declaring class: fieldscount mismatch");
 #endif
        fid=&((classinfo*)this->declaringClass)->fields[this->slot]; /*get field*/
+       CHECKFIELDACCESS(this,fid,c);
+
 #ifdef DEBUG
        /* check if the field really has the same name and check if the type descriptor is not empty*/
        if (fid->name!=javastring_toutf(this->name,false)) throw_cacao_exception_exit(string_java_lang_IncompatibleClassChangeError,
@@ -499,6 +606,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getInt(JNIEnv *env , java_lang
 {
        jfieldID fid;
        char *utf_ptr;
+       classinfo *c = (classinfo *) this->declaringClass;
 
 #ifdef DEBUG
        /* check if the specified slot could be a valid field of this class*/
@@ -506,6 +614,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getInt(JNIEnv *env , java_lang
                                                                           "declaring class: fieldscount mismatch");
 #endif
        fid=&((classinfo*)this->declaringClass)->fields[this->slot]; /*get field*/
+       CHECKFIELDACCESS(this,fid,c);
 #ifdef DEBUG
        /* check if the field really has the same name and check if the type descriptor is not empty*/
        if (fid->name!=javastring_toutf(this->name,false)) throw_cacao_exception_exit(string_java_lang_IncompatibleClassChangeError,
@@ -567,6 +676,7 @@ JNIEXPORT s8 JNICALL Java_java_lang_reflect_Field_getLong(JNIEnv *env, java_lang
 {
        jfieldID fid;
        char *utf_ptr;
+       classinfo *c = (classinfo *) this->declaringClass;
 
 #ifdef DEBUG
        /* check if the specified slot could be a valid field of this class*/
@@ -574,6 +684,8 @@ JNIEXPORT s8 JNICALL Java_java_lang_reflect_Field_getLong(JNIEnv *env, java_lang
                                                                           "declaring class: fieldscount mismatch");
 #endif
        fid=&((classinfo*)this->declaringClass)->fields[this->slot]; /*get field*/
+       CHECKFIELDACCESS(this,fid,c);
+
 #ifdef DEBUG
        /* check if the field really has the same name and check if the type descriptor is not empty*/
        if (fid->name!=javastring_toutf(this->name,false)) throw_cacao_exception_exit(string_java_lang_IncompatibleClassChangeError,
@@ -637,6 +749,7 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getShort(JNIEnv *env, java_lan
 {
        jfieldID fid;
        char *utf_ptr;
+       classinfo *c = (classinfo *) this->declaringClass;
 
 #ifdef DEBUG
        /* check if the specified slot could be a valid field of this class*/
@@ -644,6 +757,8 @@ JNIEXPORT s4 JNICALL Java_java_lang_reflect_Field_getShort(JNIEnv *env, java_lan
                                                                           "declaring class: fieldscount mismatch");
 #endif
        fid=&((classinfo*)this->declaringClass)->fields[this->slot]; /*get field*/
+       CHECKFIELDACCESS(this,fid,c);
+
 #ifdef DEBUG
        /* check if the field really has the same name and check if the type descriptor is not empty*/
        if (fid->name!=javastring_toutf(this->name,false)) throw_cacao_exception_exit(string_java_lang_IncompatibleClassChangeError,
@@ -702,10 +817,12 @@ JNIEXPORT void JNICALL Java_java_lang_reflect_Field_set(JNIEnv *env, java_lang_r
        jfieldID source_fid;  /* the field containing the value to be written */
        jfieldID fid;         /* the field to be written */
        classinfo *c;
+
        int st = (this->flag & ACC_STATIC); /* true if the field is static */
 
        fid = class_findfield_approx((classinfo *) this->declaringClass,
                                                                 javastring_toutf(this->name, false));
+       CHECKFIELDACCESS(this,fid,((classinfo *) this->declaringClass));
 
        if (val && (st || obj)) {
 
index aab8cb34316e4e1c5e1a02f50422f6dee6117248..cce2ac36474def5759f7a259a072b46c9955fc0f 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Joseph Wenninger
 
-   $Id: Method.c 1735 2004-12-07 14:33:27Z twisti $
+   $Id: Method.c 1774 2004-12-20 20:16:57Z jowenn $
 
 */
 
 #include "native/include/java_lang_Class.h"
 #include "native/include/java_lang_reflect_Method.h"
 #include "toolbox/logging.h"
-
+#include "vm/global.h"
+#include "vm/builtin.h"
+#include "vm/jit/stacktrace.h"
+#include "vm/exceptions.h"
 
 /*
  * Class:     java_lang_reflect_Method
@@ -116,14 +119,50 @@ JNIEXPORT java_objectarray* JNICALL Java_java_lang_reflect_Method_getExceptionTy
  */
 JNIEXPORT java_lang_Object* JNICALL Java_java_lang_reflect_Method_invokeNative(JNIEnv *env, java_lang_reflect_Method *this, java_lang_Object *obj, java_objectarray *params, java_lang_Class *declaringClass, s4 slot)
 {
-    struct methodinfo *mi;
+       struct methodinfo *mi;
 
-    classinfo *c = (classinfo *) declaringClass;
-    if (slot < 0 || slot >= c->methodscount) {
-               panic("error illegal slot for method in class(getParameterTypes)");
-    }
+       classinfo *c = (classinfo *) declaringClass;
 
-    mi = &(c->methods[slot]);
+       if (slot < 0 || slot >= c->methodscount) {
+               panic("error illegal slot for method in class(getParameterTypes)");
+       }
+       mi = &(c->methods[slot]);
+
+#if (defined(__ALPHA__) || defined(__I386__))
+       /*log_text("Checking access rights");*/
+       if (!(getField(this,jboolean,getFieldID_critical(env,this->header.vftbl->class,"flag","Z")))) {
+               int throwAccess=0;
+               struct methodinfo *callingMethod;
+
+               if ((mi->flags & ACC_PUBLIC)==0) {
+                       callingMethod=cacao_callingMethod();
+
+                       if ((mi->flags & ACC_PRIVATE)!=0) {
+                               if (c!=callingMethod->class) {
+                                       throwAccess=1;
+                               }
+                       } else {
+                               if ((mi->flags & ACC_PROTECTED)!=0) {
+                                       if (!builtin_isanysubclass(callingMethod->class, c)) {
+                                               throwAccess=1;
+                                       } 
+                               } else {
+                                       /* default visibility*/
+                                       if (c->packagename!=callingMethod->class->packagename) {
+                                               throwAccess=1;
+                                       }
+                               }
+                       }
+               }
+               if (throwAccess) {
+                       *exceptionptr=0;
+                       *exceptionptr = new_exception(string_java_lang_IllegalAccessException);
+                       return 0;
+               }
+
+       }
+
+#endif
 
     return (java_lang_Object *) jni_method_invokeNativeHelper(env, mi, (jobject) obj, params);
 }
index 56820cad5a048a742b010988d449e68eb231abcf..7bbccb2efb5763431ab8af6926a997de10801012 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Joseph Wenninger
 
-   $Id: VMClass.c 1735 2004-12-07 14:33:27Z twisti $
+   $Id: VMClass.c 1774 2004-12-20 20:16:57Z jowenn $
 
 */
 
@@ -345,7 +345,7 @@ java_lang_reflect_Field* cacao_getField0(JNIEnv *env, java_lang_Class *that, jav
                /*      ((java_lang_reflect_Field*)(o))->flag=f->flags;*/
                /* save type in slot-field for faster processing */
                /* setfield_critical(c,o,"flag",           "I",             jint,    (jint) f->flags); */
-               o->flag = f->flags;
+               /*o->flag = f->flags;*/
                setfield_critical(c,o,"slot",           "I",                jint,    (jint) idx);  
                setfield_critical(c,o,"name",           "Ljava/lang/String;", jstring, (jstring) name);
                /*setfield_critical(c,o,"type",           "Ljava/lang/Class;",  jclass,  fieldtype);*/
index bdbd2d7df38fa2867ec6435811a16ebb68740ac7..9e543016a3cf79ac17be7702cd0ae92c74cf41d9 100644 (file)
@@ -34,7 +34,7 @@
    calls instead of machine instructions, using the C calling
    convention.
 
-   $Id: builtin.c 1735 2004-12-07 14:33:27Z twisti $
+   $Id: builtin.c 1774 2004-12-20 20:16:57Z jowenn $
 
 */
 
@@ -97,34 +97,6 @@ s4 builtin_isanysubclass(classinfo *sub, classinfo *super)
                return (sub->vftbl->interfacetablelength > super->index) &&
                        (sub->vftbl->interfacetable[-super->index] != NULL);
 
-       /*
-         while (sub != 0)
-         if (sub == super)
-         return 1;
-         else
-         sub = sub->super;
-
-         return 0;
-       */
-
-/*
-       for (tmp=sub;tmp!=0;tmp=tmp->super) {
-               printf("->");
-               utf_display(tmp->name);
-       }
-               printf("\n\n");
-       
-       for (tmp=super;tmp!=0;tmp=tmp->super) {
-               printf("->");
-               utf_display(tmp->name);
-       }
-               printf("\n");
-       
-
-       printf("sub->vftbl->baseval %d, super->vftbl->baseval %d\n diff %d, super->vftbl->diffval %d\n",
-                       sub->vftbl->baseval, super->vftbl->baseval, (unsigned)(sub->vftbl->baseval - super->vftbl->baseval),
-                       super->vftbl->diffval); */
-
        asm_getclassvalues_atomic(super->vftbl, sub->vftbl, &classvalues);
 
        res = (unsigned) (classvalues.sub_baseval - classvalues.super_baseval) <=
index bfc8ce68752c11129d106bcd6c9b453b207893d7..4272acab1ec19dbbd6a849eef8383c8f618e4c37 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Christian Thalinger
 
-   $Id: exceptions.c 1735 2004-12-07 14:33:27Z twisti $
+   $Id: exceptions.c 1774 2004-12-20 20:16:57Z jowenn $
 
 */
 
@@ -91,6 +91,9 @@ char *string_java_lang_CloneNotSupportedException =
 char *string_java_lang_Exception =
     "java/lang/Exception";
 
+char *string_java_lang_IllegalAccessException =
+    "java/lang/IllegalAccessException";
+
 char *string_java_lang_IllegalArgumentException =
     "java/lang/IllegalArgumentException";
 
index e1e9a0911222a52f5e1f807378a7385b9a8acb5f..cf64f2b42414966fac75a5f626d1fcf6c65a4a88 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Christian Thalinger
 
-   $Id: exceptions.h 1735 2004-12-07 14:33:27Z twisti $
+   $Id: exceptions.h 1774 2004-12-20 20:16:57Z jowenn $
 
 */
 
@@ -63,6 +63,7 @@ extern char *string_java_lang_ClassCastException;
 extern char *string_java_lang_ClassNotFoundException;
 extern char *string_java_lang_CloneNotSupportedException;
 extern char *string_java_lang_Exception;
+extern char *string_java_lang_IllegalAccessException;
 extern char *string_java_lang_IllegalArgumentException;
 extern char *string_java_lang_IllegalMonitorStateException;
 extern char *string_java_lang_IndexOutOfBoundsException;
index 725045868256c7a44eafe1e48ee8cfaf6fdd2d1b..27cbf603e3f60d78b226d6735d06c36fcbffecd0 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Joseph Wenninger
 
-   $Id: stacktrace.c 1771 2004-12-17 23:05:27Z jowenn $
+   $Id: stacktrace.c 1774 2004-12-20 20:16:57Z jowenn $
 
 */
 
@@ -46,6 +46,7 @@
 
 
 #undef JWDEBUG
+/*JoWenn: simplify collectors (trace doesn't contain internal methods)*/
 
 extern classinfo *class_java_lang_Class;
 extern classinfo *class_java_lang_SecurityManager;
@@ -416,6 +417,18 @@ java_objectheader *cacao_currentClassLoader() {
 }
 
 
+static
+void callingMethodCollector(void **target, stackTraceBuffer *buffer) { 
+        if (buffer->full >2) (*target)=buffer->start[2].method;
+       else (*target=0);
+}
+
+methodinfo *cacao_callingMethod() {
+       methodinfo *method;
+       cacao_stacktrace_fillInStackTrace(&method,&callingMethodCollector);
+       return method;
+}
+
 /*
  * 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
index f20d88920d74fe3dcfc74aea6ea9dbf533a931a2..59b382cc2c4d5fe7896ee5fd07b64f19844feca5 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes:
 
-   $Id: stacktrace.h 1735 2004-12-07 14:33:27Z twisti $
+   $Id: stacktrace.h 1774 2004-12-20 20:16:57Z jowenn $
 
 */
 
@@ -41,6 +41,7 @@
 void cacao_stacktrace_NormalTrace(void **target);
 java_objectarray *cacao_createClassContextArray();
 java_objectheader *cacao_currentClassLoader();
+methodinfo* cacao_callingMethod();
 
 #endif /* _STACKTRACE_H */
 
index 900262a3512d3c92cffcbffb930e3ca1dfa70732..f7932935c38f8278321b8c5b7e1777def93cf5bd 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Edwin Steiner
 
-   $Id: typecheck.c 1735 2004-12-07 14:33:27Z twisti $
+   $Id: typecheck.c 1774 2004-12-20 20:16:57Z jowenn $
 
 */
 
@@ -1654,7 +1654,8 @@ methodinfo *typecheck(methodinfo *m, codegendata *cd, registerdata *rd)
 
                                                          /* XXX We should resolve the method and pass its
                                                           * class as implementingclass to is_accessible. */
-                                                         if (!is_accessible(mi->flags,mi->class,NULL, myclass,
+                                                         /* JOWENN: FIXME (and on other invokation places of is_accessible too) */
+                                                         if (!is_accessible(mi->flags,mi->class,/*NULL have to check what here should really be*/ mi->class /*dont't crash right now*/, myclass,
                                                                                                 (opcode == ICMD_INVOKESTATIC) ? NULL
                                                                                                 : &(srcstack->typeinfo)))
                                                                  panic("Invoking unaccessible method");
index 63a3894ed126625149863dc08588e8545aec430a..d8277da327f2fe463623eb826f7ee0e79e4f5db1 100644 (file)
@@ -35,7 +35,7 @@
        - the heap
        - additional support functions
 
-   $Id: tables.c 1735 2004-12-07 14:33:27Z twisti $
+   $Id: tables.c 1774 2004-12-20 20:16:57Z jowenn $
 
 */
 
@@ -1113,8 +1113,8 @@ classinfo *class_new_intern(utf *classname)
                char *p = utf_end(c->name) - 1;
                char *start = c->name->text;
                for (;p > start; --p) {
-                       if (*p == '.') {
-                               c->packagename = utf_new(start, p - start);
+                       if (*p == '/') {
+                               c->packagename = utf_new (start, p - start);
                                break;
                        }
                }
diff --git a/tests/stack/sleep_exception.java b/tests/stack/sleep_exception.java
new file mode 100644 (file)
index 0000000..8082e35
--- /dev/null
@@ -0,0 +1,33 @@
+import java.util.*;
+
+public class sleep_exception extends Thread {
+    public static Random r = new Random();
+
+    public sleep_exception (String name) {
+       super(name);
+    }
+
+    public void run() {
+        for (int i = 0; i < 10; ++i) {
+            System.out.println(getName());
+            try {
+                throw new Exception("Exception in thread");
+            } catch (Exception e) {
+              e.printStackTrace();
+            }
+            try {
+               sleep((long) (r.nextFloat() * 1000));
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    public static void main(String args[]) {
+       sleep_exception t1 = new sleep_exception("a");
+       sleep_exception t2 = new sleep_exception("b");
+
+       t1.start();
+       t2.start();
+    }
+}