inlining starts working again for the first time after typecheck modifications. ...
authorjowenn <none@none>
Thu, 25 Mar 2004 17:31:13 +0000 (17:31 +0000)
committerjowenn <none@none>
Thu, 25 Mar 2004 17:31:13 +0000 (17:31 +0000)
jit/jit.h
jit/parse.c
jit/stack.c
jit/typecheck.c
src/vm/jit/jit.h
src/vm/jit/parse.c
src/vm/jit/stack.c
src/vm/jit/verify/typecheck.c

index a8ecc16405efafff4349183267308cfdaddeafc0..84eac5e88e62979eaa8cc458e6868c270868316a 100644 (file)
--- a/jit/jit.h
+++ b/jit/jit.h
@@ -29,7 +29,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: jit.h 955 2004-03-13 12:51:30Z jowenn $
+   $Id: jit.h 974 2004-03-25 17:31:13Z jowenn $
 
 */
 
@@ -114,6 +114,8 @@ struct instruction {
                                        /* and as address for list of targets for         */
                                        /* statements                                   */
        u2 line;                                /* line number in source file */
+       classinfo *clazz;               /*needed for inlining. can't be done on basic block level, since an inlined
+                                       function doesn't start necessarily start a new block*/
 };
 
 
index b30c7fe41e5a32cb91329deb1d6dcafdc618a390..70ebed98b718c90c7f16408c84a571d583d6d3e1 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Carolyn Oates
             Edwin Steiner
 
-   $Id: parse.c 951 2004-03-11 17:30:03Z jowenn $
+   $Id: parse.c 974 2004-03-25 17:31:13Z jowenn $
 
 */
 
@@ -329,28 +329,28 @@ void descriptor2types(methodinfo *m)
 /* intermediate code generating macros */
 
 #define PINC           iptr++;ipc++
-#define LOADCONST_I(v) iptr->opc=ICMD_ICONST;/*iptr->op1=0*/;iptr->val.i=(v);iptr->line=currentline;PINC
-#define LOADCONST_L(v) iptr->opc=ICMD_LCONST;/*iptr->op1=0*/;iptr->val.l=(v);iptr->line=currentline;PINC
-#define LOADCONST_F(v) iptr->opc=ICMD_FCONST;/*iptr->op1=0*/;iptr->val.f=(v);iptr->line=currentline;PINC
-#define LOADCONST_D(v) iptr->opc=ICMD_DCONST;/*iptr->op1=0*/;iptr->val.d=(v);iptr->line=currentline;PINC
-#define LOADCONST_A(v) iptr->opc=ICMD_ACONST;/*iptr->op1=0*/;iptr->val.a=(v);iptr->line=currentline;PINC
+#define LOADCONST_I(v) iptr->opc=ICMD_ICONST;/*iptr->op1=0*/;iptr->val.i=(v);iptr->line=currentline;iptr->clazz=class;PINC
+#define LOADCONST_L(v) iptr->opc=ICMD_LCONST;/*iptr->op1=0*/;iptr->val.l=(v);iptr->line=currentline;iptr->clazz=class;PINC
+#define LOADCONST_F(v) iptr->opc=ICMD_FCONST;/*iptr->op1=0*/;iptr->val.f=(v);iptr->line=currentline;iptr->clazz=class;PINC
+#define LOADCONST_D(v) iptr->opc=ICMD_DCONST;/*iptr->op1=0*/;iptr->val.d=(v);iptr->line=currentline;iptr->clazz=class;PINC
+#define LOADCONST_A(v) iptr->opc=ICMD_ACONST;/*iptr->op1=0*/;iptr->val.a=(v);iptr->line=currentline;iptr->clazz=class;PINC
 
 /* ACONST instructions generated as arguments for builtin functions
  * have op1 set to non-zero. This is used for stack overflow checking
  * in stack.c. */
 #define LOADCONST_A_BUILTIN(v) \
-                       iptr->opc=ICMD_ACONST;iptr->op1=1;iptr->val.a=(v);iptr->line=currentline;PINC
+                       iptr->opc=ICMD_ACONST;iptr->op1=1;iptr->val.a=(v);iptr->line=currentline;iptr->clazz=class;PINC
 
-#define OP(o)          iptr->opc=(o);/*iptr->op1=0*/;/*iptr->val.l=0*/;iptr->line=currentline;PINC
-#define OP1(o,o1)      iptr->opc=(o);iptr->op1=(o1);/*iptr->val.l=(0)*/;iptr->line=currentline;PINC
-#define OP2I(o,o1,v)   iptr->opc=(o);iptr->op1=(o1);iptr->val.i=(v);iptr->line=currentline;PINC
-#define OP2A(o,o1,v,l)   iptr->opc=(o);iptr->op1=(o1);iptr->val.a=(v);iptr->line=l;PINC
+#define OP(o)          iptr->opc=(o);/*iptr->op1=0*/;/*iptr->val.l=0*/;iptr->line=currentline;iptr->clazz=class;PINC
+#define OP1(o,o1)      iptr->opc=(o);iptr->op1=(o1);/*iptr->val.l=(0)*/;iptr->line=currentline;iptr->clazz=class;PINC
+#define OP2I(o,o1,v)   iptr->opc=(o);iptr->op1=(o1);iptr->val.i=(v);iptr->line=currentline;iptr->clazz=class;PINC
+#define OP2A(o,o1,v,l)   iptr->opc=(o);iptr->op1=(o1);iptr->val.a=(v);iptr->line=l;iptr->clazz=class;PINC
 #define BUILTIN1(v,t,l)  isleafmethod=false;iptr->opc=ICMD_BUILTIN1;iptr->op1=t;\
-                       iptr->val.a=(v);iptr->line=l;PINC
+                       iptr->val.a=(v);iptr->line=l;iptr->clazz=class;PINC
 #define BUILTIN2(v,t,l)  isleafmethod=false;iptr->opc=ICMD_BUILTIN2;iptr->op1=t;\
-                       iptr->val.a=(v);iptr->line=l;PINC
+                       iptr->val.a=(v);iptr->line=l;iptr->clazz=class;PINC
 #define BUILTIN3(v,t,l)  isleafmethod=false;iptr->opc=ICMD_BUILTIN3;iptr->op1=t;\
-                       iptr->val.a=(v);iptr->line=l;PINC
+                       iptr->val.a=(v);iptr->line=l;iptr->clazz=class;PINC
 
 /* We have to check local variables indices here because they are
  * used in stack.c to index the locals array. */
@@ -606,7 +606,7 @@ void parse()
 
                /* mark this position as a valid instruction start */
                if (!iswide) {
-                       instructionstart[p] = 1;
+                       instructionstart[gp] = 1;
                        /*log_text("new start of instruction");*/
                        if (linepcchange==p) {
                                if (jlinenumbercount>lineindex) {
@@ -624,6 +624,7 @@ void parse()
                        u1 *tptr;
                        bool *readonly = NULL;
 
+
                        opcode = code_get_u1(p);
                        nextp = p += jcommandsize[opcode];
                        if (nextp > jcodelength)
@@ -655,6 +656,16 @@ void parse()
 
                        inlining_save_compiler_variables();
                        inlining_set_compiler_variables(tmpinlinf);
+                       if (compileverbose) {
+                               char logtext[MAXLOGTEXT];
+                               sprintf(logtext, "Parsing (inlined): ");
+                               utf_sprint(logtext+strlen(logtext), method->class->name);
+                               strcpy(logtext+strlen(logtext), ".");
+                               utf_sprint(logtext+strlen(logtext), method->name);
+                               utf_sprint(logtext+strlen(logtext), method->descriptor);
+                               log_text(logtext);
+                       }
+
 
                        if (inlinfo->inlinedmethods == NULL) {
                                gp = -1;
index a1e0fcb77e9500abfe2689e0de3d519a50db19c1..7d19f393241d39a41a4b5d9afa9e289bd5fc7c87 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: stack.c 971 2004-03-24 22:44:29Z edwin $
+   $Id: stack.c 974 2004-03-25 17:31:13Z jowenn $
 
 */
 
@@ -2214,7 +2214,7 @@ void show_icmd_method()
        printf ("\n\nMax locals: %d\n", (int) maxlocals);
        printf ("Max stack:  %d\n", (int) maxstack);
 
-       printf ("Line number table lengt: %d\n",method->linenumbercount);
+       printf ("Line number table length: %d\n",method->linenumbercount);
 
        printf ("Exceptions (Number: %d):\n", exceptiontablelength);
        for (ex = extable; ex != NULL; ex = ex->down) {
@@ -2683,7 +2683,8 @@ void show_icmd(instruction *iptr,bool deadcode)
                }
                break;
        }
-       printf(" Line number: %d",iptr->line);
+       printf(" Line number: %d, class:",iptr->line);
+       utf_display(iptr->clazz->name);
 }
 
 
index 7f28f2e6e1d4390043eb68bfe1ead999c8eb6c8c..227c62b707ac172972035d57e619e8a88e8e0857 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Edwin Steiner
 
-   $Id: typecheck.c 919 2004-02-08 20:24:57Z edwin $
+   $Id: typecheck.c 974 2004-03-25 17:31:13Z jowenn $
 
 */
 
@@ -593,11 +593,11 @@ typestate_ret(void *localbuf,
 
 /* If a field is checked, definingclass == implementingclass */
 static bool
-is_accessible(int flags,classinfo *definingclass,classinfo *implementingclass,
+is_accessible(int flags,classinfo *definingclass,classinfo *implementingclass, classinfo *methodclass,
                          typeinfo *instance)
 {
        /* check access rights */
-       if (class != definingclass) {
+       if (methodclass != definingclass) {
                switch (flags & (ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED)) {
                  case ACC_PUBLIC:
                          break;
@@ -605,23 +605,23 @@ is_accessible(int flags,classinfo *definingclass,classinfo *implementingclass,
                          /* In the cases below, definingclass cannot be an interface */
                          
                  case 0:
-                         if (definingclass->packagename != class->packagename)
+                         if (definingclass->packagename != methodclass->packagename)
                                  return false;
                          break;
                  case ACC_PROTECTED:
-                         if (definingclass->packagename != class->packagename) {
-                                 if (!builtin_isanysubclass(class,implementingclass))
+                         if (definingclass->packagename != methodclass->packagename) {
+                                 if (!builtin_isanysubclass(methodclass,implementingclass))
                                          return false;
                                  
                                  /* For protected access of super class members in another
                                   * package the instance must be a subclass of or the same
                                   * as the current class. */
                                  LOG("protected access into other package");
-                                 implementingclass = class;
+                                 implementingclass = methodclass;
                          }
                          break;
                  case ACC_PRIVATE:
-                         if (definingclass != class) {
+                         if (definingclass != methodclass) {
                                  LOG("private access");
                                  return false;
                          }
@@ -820,6 +820,8 @@ typecheck()
        builtin_descriptor *builtindesc;    /* temp. descriptor of builtin */
        bool jsrencountered = false;         /* true if we there was a JSR */
 
+    classinfo *myclass;
+
 #ifdef TYPECHECK_STATISTICS
        int count_iterations = 0;
        TYPECHECK_COUNT(stat_typechecked);
@@ -994,6 +996,7 @@ typecheck()
                     DOLOG(show_icmd(iptr,false)); LOGNL; LOGFLUSH;
                         
                     opcode = iptr->opc;
+                   myclass = iptr->clazz;
                     dst = iptr->dst;
                     maythrow = false;
                                                
@@ -1056,6 +1059,15 @@ typecheck()
                           break;
 
                           /****************************************/
+
+
+
+
+
+
+
+
+
                           /* PRIMITIVE VARIABLE ACCESS            */
 
                       case ICMD_ILOAD: CHECK_ONEWORD(iptr->op1,TYPE_INT); break;
@@ -1142,7 +1154,7 @@ typecheck()
                                                                  }
                                                          }
                                                          else {
-                                                                 if (!is_accessible(fi->flags,fi->class,fi->class,
+                                                                 if (!is_accessible(fi->flags,fi->class,fi->class, myclass,
                                                                                                         &(curstack->prev->typeinfo)))
                                                                          panic("PUTFIELD: field is not accessible");
                                                          }
@@ -1165,7 +1177,7 @@ typecheck()
                                                  {
                                                          fieldinfo *fi = (fieldinfo*) iptr[0].val.a;
 
-                                                         if (!is_accessible(fi->flags,fi->class,fi->class,NULL))
+                                                         if (!is_accessible(fi->flags,fi->class,fi->class,myclass,NULL))
                                                                  panic("PUTSTATIC: field is not accessible");
 
                                                          if (curstack->type != fi->type)
@@ -1190,7 +1202,7 @@ typecheck()
                           {
                               fieldinfo *fi = (fieldinfo *)(iptr->val.a);
 
-                                                         if (!is_accessible(fi->flags,fi->class,fi->class,
+                                                         if (!is_accessible(fi->flags,fi->class,fi->class,myclass,
                                                                                                 &(curstack->typeinfo)))
                                                                  panic("GETFIELD: field is not accessible");
                                                          
@@ -1206,8 +1218,16 @@ typecheck()
                           {
                               fieldinfo *fi = (fieldinfo *)(iptr->val.a);
                                                          
-                                                         if (!is_accessible(fi->flags,fi->class,fi->class,NULL))
+                                                         if (!is_accessible(fi->flags,fi->class,fi->class,myclass,NULL)) {
+                                                               printf("---------\n");
+                                                                 utf_display(fi->class->name);
+                                                               printf("\n");
+                                                                 utf_display(myclass->name);
+                                                               printf("\n");
+
+
                                                                  panic("GETSTATIC: field is not accessible");
+                                                       }
 
                               if (dst->type == TYPE_ADR) {
                                   TYPEINFO_INIT_FROM_FIELDINFO(dst->typeinfo,fi);
@@ -1561,7 +1581,7 @@ typecheck()
 
                                                          /* XXX We should resolve the method and pass its
                                                           * class as implementingclass to is_accessible. */
-                                                         if (!is_accessible(mi->flags,mi->class,NULL,
+                                                         if (!is_accessible(mi->flags,mi->class,NULL, myclass,
                                                                                                 (opcode == ICMD_INVOKESTATIC) ? NULL
                                                                                                 : &(srcstack->typeinfo)))
                                                                  panic("Invoking unaccessible method");
index a8ecc16405efafff4349183267308cfdaddeafc0..84eac5e88e62979eaa8cc458e6868c270868316a 100644 (file)
@@ -29,7 +29,7 @@
 
    Changes: Christian Thalinger
 
-   $Id: jit.h 955 2004-03-13 12:51:30Z jowenn $
+   $Id: jit.h 974 2004-03-25 17:31:13Z jowenn $
 
 */
 
@@ -114,6 +114,8 @@ struct instruction {
                                        /* and as address for list of targets for         */
                                        /* statements                                   */
        u2 line;                                /* line number in source file */
+       classinfo *clazz;               /*needed for inlining. can't be done on basic block level, since an inlined
+                                       function doesn't start necessarily start a new block*/
 };
 
 
index b30c7fe41e5a32cb91329deb1d6dcafdc618a390..70ebed98b718c90c7f16408c84a571d583d6d3e1 100644 (file)
@@ -29,7 +29,7 @@
    Changes: Carolyn Oates
             Edwin Steiner
 
-   $Id: parse.c 951 2004-03-11 17:30:03Z jowenn $
+   $Id: parse.c 974 2004-03-25 17:31:13Z jowenn $
 
 */
 
@@ -329,28 +329,28 @@ void descriptor2types(methodinfo *m)
 /* intermediate code generating macros */
 
 #define PINC           iptr++;ipc++
-#define LOADCONST_I(v) iptr->opc=ICMD_ICONST;/*iptr->op1=0*/;iptr->val.i=(v);iptr->line=currentline;PINC
-#define LOADCONST_L(v) iptr->opc=ICMD_LCONST;/*iptr->op1=0*/;iptr->val.l=(v);iptr->line=currentline;PINC
-#define LOADCONST_F(v) iptr->opc=ICMD_FCONST;/*iptr->op1=0*/;iptr->val.f=(v);iptr->line=currentline;PINC
-#define LOADCONST_D(v) iptr->opc=ICMD_DCONST;/*iptr->op1=0*/;iptr->val.d=(v);iptr->line=currentline;PINC
-#define LOADCONST_A(v) iptr->opc=ICMD_ACONST;/*iptr->op1=0*/;iptr->val.a=(v);iptr->line=currentline;PINC
+#define LOADCONST_I(v) iptr->opc=ICMD_ICONST;/*iptr->op1=0*/;iptr->val.i=(v);iptr->line=currentline;iptr->clazz=class;PINC
+#define LOADCONST_L(v) iptr->opc=ICMD_LCONST;/*iptr->op1=0*/;iptr->val.l=(v);iptr->line=currentline;iptr->clazz=class;PINC
+#define LOADCONST_F(v) iptr->opc=ICMD_FCONST;/*iptr->op1=0*/;iptr->val.f=(v);iptr->line=currentline;iptr->clazz=class;PINC
+#define LOADCONST_D(v) iptr->opc=ICMD_DCONST;/*iptr->op1=0*/;iptr->val.d=(v);iptr->line=currentline;iptr->clazz=class;PINC
+#define LOADCONST_A(v) iptr->opc=ICMD_ACONST;/*iptr->op1=0*/;iptr->val.a=(v);iptr->line=currentline;iptr->clazz=class;PINC
 
 /* ACONST instructions generated as arguments for builtin functions
  * have op1 set to non-zero. This is used for stack overflow checking
  * in stack.c. */
 #define LOADCONST_A_BUILTIN(v) \
-                       iptr->opc=ICMD_ACONST;iptr->op1=1;iptr->val.a=(v);iptr->line=currentline;PINC
+                       iptr->opc=ICMD_ACONST;iptr->op1=1;iptr->val.a=(v);iptr->line=currentline;iptr->clazz=class;PINC
 
-#define OP(o)          iptr->opc=(o);/*iptr->op1=0*/;/*iptr->val.l=0*/;iptr->line=currentline;PINC
-#define OP1(o,o1)      iptr->opc=(o);iptr->op1=(o1);/*iptr->val.l=(0)*/;iptr->line=currentline;PINC
-#define OP2I(o,o1,v)   iptr->opc=(o);iptr->op1=(o1);iptr->val.i=(v);iptr->line=currentline;PINC
-#define OP2A(o,o1,v,l)   iptr->opc=(o);iptr->op1=(o1);iptr->val.a=(v);iptr->line=l;PINC
+#define OP(o)          iptr->opc=(o);/*iptr->op1=0*/;/*iptr->val.l=0*/;iptr->line=currentline;iptr->clazz=class;PINC
+#define OP1(o,o1)      iptr->opc=(o);iptr->op1=(o1);/*iptr->val.l=(0)*/;iptr->line=currentline;iptr->clazz=class;PINC
+#define OP2I(o,o1,v)   iptr->opc=(o);iptr->op1=(o1);iptr->val.i=(v);iptr->line=currentline;iptr->clazz=class;PINC
+#define OP2A(o,o1,v,l)   iptr->opc=(o);iptr->op1=(o1);iptr->val.a=(v);iptr->line=l;iptr->clazz=class;PINC
 #define BUILTIN1(v,t,l)  isleafmethod=false;iptr->opc=ICMD_BUILTIN1;iptr->op1=t;\
-                       iptr->val.a=(v);iptr->line=l;PINC
+                       iptr->val.a=(v);iptr->line=l;iptr->clazz=class;PINC
 #define BUILTIN2(v,t,l)  isleafmethod=false;iptr->opc=ICMD_BUILTIN2;iptr->op1=t;\
-                       iptr->val.a=(v);iptr->line=l;PINC
+                       iptr->val.a=(v);iptr->line=l;iptr->clazz=class;PINC
 #define BUILTIN3(v,t,l)  isleafmethod=false;iptr->opc=ICMD_BUILTIN3;iptr->op1=t;\
-                       iptr->val.a=(v);iptr->line=l;PINC
+                       iptr->val.a=(v);iptr->line=l;iptr->clazz=class;PINC
 
 /* We have to check local variables indices here because they are
  * used in stack.c to index the locals array. */
@@ -606,7 +606,7 @@ void parse()
 
                /* mark this position as a valid instruction start */
                if (!iswide) {
-                       instructionstart[p] = 1;
+                       instructionstart[gp] = 1;
                        /*log_text("new start of instruction");*/
                        if (linepcchange==p) {
                                if (jlinenumbercount>lineindex) {
@@ -624,6 +624,7 @@ void parse()
                        u1 *tptr;
                        bool *readonly = NULL;
 
+
                        opcode = code_get_u1(p);
                        nextp = p += jcommandsize[opcode];
                        if (nextp > jcodelength)
@@ -655,6 +656,16 @@ void parse()
 
                        inlining_save_compiler_variables();
                        inlining_set_compiler_variables(tmpinlinf);
+                       if (compileverbose) {
+                               char logtext[MAXLOGTEXT];
+                               sprintf(logtext, "Parsing (inlined): ");
+                               utf_sprint(logtext+strlen(logtext), method->class->name);
+                               strcpy(logtext+strlen(logtext), ".");
+                               utf_sprint(logtext+strlen(logtext), method->name);
+                               utf_sprint(logtext+strlen(logtext), method->descriptor);
+                               log_text(logtext);
+                       }
+
 
                        if (inlinfo->inlinedmethods == NULL) {
                                gp = -1;
index a1e0fcb77e9500abfe2689e0de3d519a50db19c1..7d19f393241d39a41a4b5d9afa9e289bd5fc7c87 100644 (file)
@@ -28,7 +28,7 @@
 
    Changes: Edwin Steiner
 
-   $Id: stack.c 971 2004-03-24 22:44:29Z edwin $
+   $Id: stack.c 974 2004-03-25 17:31:13Z jowenn $
 
 */
 
@@ -2214,7 +2214,7 @@ void show_icmd_method()
        printf ("\n\nMax locals: %d\n", (int) maxlocals);
        printf ("Max stack:  %d\n", (int) maxstack);
 
-       printf ("Line number table lengt: %d\n",method->linenumbercount);
+       printf ("Line number table length: %d\n",method->linenumbercount);
 
        printf ("Exceptions (Number: %d):\n", exceptiontablelength);
        for (ex = extable; ex != NULL; ex = ex->down) {
@@ -2683,7 +2683,8 @@ void show_icmd(instruction *iptr,bool deadcode)
                }
                break;
        }
-       printf(" Line number: %d",iptr->line);
+       printf(" Line number: %d, class:",iptr->line);
+       utf_display(iptr->clazz->name);
 }
 
 
index 7f28f2e6e1d4390043eb68bfe1ead999c8eb6c8c..227c62b707ac172972035d57e619e8a88e8e0857 100644 (file)
@@ -26,7 +26,7 @@
 
    Authors: Edwin Steiner
 
-   $Id: typecheck.c 919 2004-02-08 20:24:57Z edwin $
+   $Id: typecheck.c 974 2004-03-25 17:31:13Z jowenn $
 
 */
 
@@ -593,11 +593,11 @@ typestate_ret(void *localbuf,
 
 /* If a field is checked, definingclass == implementingclass */
 static bool
-is_accessible(int flags,classinfo *definingclass,classinfo *implementingclass,
+is_accessible(int flags,classinfo *definingclass,classinfo *implementingclass, classinfo *methodclass,
                          typeinfo *instance)
 {
        /* check access rights */
-       if (class != definingclass) {
+       if (methodclass != definingclass) {
                switch (flags & (ACC_PUBLIC | ACC_PRIVATE | ACC_PROTECTED)) {
                  case ACC_PUBLIC:
                          break;
@@ -605,23 +605,23 @@ is_accessible(int flags,classinfo *definingclass,classinfo *implementingclass,
                          /* In the cases below, definingclass cannot be an interface */
                          
                  case 0:
-                         if (definingclass->packagename != class->packagename)
+                         if (definingclass->packagename != methodclass->packagename)
                                  return false;
                          break;
                  case ACC_PROTECTED:
-                         if (definingclass->packagename != class->packagename) {
-                                 if (!builtin_isanysubclass(class,implementingclass))
+                         if (definingclass->packagename != methodclass->packagename) {
+                                 if (!builtin_isanysubclass(methodclass,implementingclass))
                                          return false;
                                  
                                  /* For protected access of super class members in another
                                   * package the instance must be a subclass of or the same
                                   * as the current class. */
                                  LOG("protected access into other package");
-                                 implementingclass = class;
+                                 implementingclass = methodclass;
                          }
                          break;
                  case ACC_PRIVATE:
-                         if (definingclass != class) {
+                         if (definingclass != methodclass) {
                                  LOG("private access");
                                  return false;
                          }
@@ -820,6 +820,8 @@ typecheck()
        builtin_descriptor *builtindesc;    /* temp. descriptor of builtin */
        bool jsrencountered = false;         /* true if we there was a JSR */
 
+    classinfo *myclass;
+
 #ifdef TYPECHECK_STATISTICS
        int count_iterations = 0;
        TYPECHECK_COUNT(stat_typechecked);
@@ -994,6 +996,7 @@ typecheck()
                     DOLOG(show_icmd(iptr,false)); LOGNL; LOGFLUSH;
                         
                     opcode = iptr->opc;
+                   myclass = iptr->clazz;
                     dst = iptr->dst;
                     maythrow = false;
                                                
@@ -1056,6 +1059,15 @@ typecheck()
                           break;
 
                           /****************************************/
+
+
+
+
+
+
+
+
+
                           /* PRIMITIVE VARIABLE ACCESS            */
 
                       case ICMD_ILOAD: CHECK_ONEWORD(iptr->op1,TYPE_INT); break;
@@ -1142,7 +1154,7 @@ typecheck()
                                                                  }
                                                          }
                                                          else {
-                                                                 if (!is_accessible(fi->flags,fi->class,fi->class,
+                                                                 if (!is_accessible(fi->flags,fi->class,fi->class, myclass,
                                                                                                         &(curstack->prev->typeinfo)))
                                                                          panic("PUTFIELD: field is not accessible");
                                                          }
@@ -1165,7 +1177,7 @@ typecheck()
                                                  {
                                                          fieldinfo *fi = (fieldinfo*) iptr[0].val.a;
 
-                                                         if (!is_accessible(fi->flags,fi->class,fi->class,NULL))
+                                                         if (!is_accessible(fi->flags,fi->class,fi->class,myclass,NULL))
                                                                  panic("PUTSTATIC: field is not accessible");
 
                                                          if (curstack->type != fi->type)
@@ -1190,7 +1202,7 @@ typecheck()
                           {
                               fieldinfo *fi = (fieldinfo *)(iptr->val.a);
 
-                                                         if (!is_accessible(fi->flags,fi->class,fi->class,
+                                                         if (!is_accessible(fi->flags,fi->class,fi->class,myclass,
                                                                                                 &(curstack->typeinfo)))
                                                                  panic("GETFIELD: field is not accessible");
                                                          
@@ -1206,8 +1218,16 @@ typecheck()
                           {
                               fieldinfo *fi = (fieldinfo *)(iptr->val.a);
                                                          
-                                                         if (!is_accessible(fi->flags,fi->class,fi->class,NULL))
+                                                         if (!is_accessible(fi->flags,fi->class,fi->class,myclass,NULL)) {
+                                                               printf("---------\n");
+                                                                 utf_display(fi->class->name);
+                                                               printf("\n");
+                                                                 utf_display(myclass->name);
+                                                               printf("\n");
+
+
                                                                  panic("GETSTATIC: field is not accessible");
+                                                       }
 
                               if (dst->type == TYPE_ADR) {
                                   TYPEINFO_INIT_FROM_FIELDINFO(dst->typeinfo,fi);
@@ -1561,7 +1581,7 @@ typecheck()
 
                                                          /* XXX We should resolve the method and pass its
                                                           * class as implementingclass to is_accessible. */
-                                                         if (!is_accessible(mi->flags,mi->class,NULL,
+                                                         if (!is_accessible(mi->flags,mi->class,NULL, myclass,
                                                                                                 (opcode == ICMD_INVOKESTATIC) ? NULL
                                                                                                 : &(srcstack->typeinfo)))
                                                                  panic("Invoking unaccessible method");