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 $
*/
/* 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*/
};
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 $
*/
/* 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. */
/* 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) {
u1 *tptr;
bool *readonly = NULL;
+
opcode = code_get_u1(p);
nextp = p += jcommandsize[opcode];
if (nextp > jcodelength)
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;
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 $
*/
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) {
}
break;
}
- printf(" Line number: %d",iptr->line);
+ printf(" Line number: %d, class:",iptr->line);
+ utf_display(iptr->clazz->name);
}
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 $
*/
/* 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;
/* 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;
}
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);
DOLOG(show_icmd(iptr,false)); LOGNL; LOGFLUSH;
opcode = iptr->opc;
+ myclass = iptr->clazz;
dst = iptr->dst;
maythrow = false;
break;
/****************************************/
+
+
+
+
+
+
+
+
+
/* PRIMITIVE VARIABLE ACCESS */
case ICMD_ILOAD: CHECK_ONEWORD(iptr->op1,TYPE_INT); break;
}
}
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");
}
{
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)
{
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");
{
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);
/* 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");
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 $
*/
/* 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*/
};
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 $
*/
/* 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. */
/* 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) {
u1 *tptr;
bool *readonly = NULL;
+
opcode = code_get_u1(p);
nextp = p += jcommandsize[opcode];
if (nextp > jcodelength)
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;
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 $
*/
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) {
}
break;
}
- printf(" Line number: %d",iptr->line);
+ printf(" Line number: %d, class:",iptr->line);
+ utf_display(iptr->clazz->name);
}
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 $
*/
/* 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;
/* 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;
}
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);
DOLOG(show_icmd(iptr,false)); LOGNL; LOGFLUSH;
opcode = iptr->opc;
+ myclass = iptr->clazz;
dst = iptr->dst;
maythrow = false;
break;
/****************************************/
+
+
+
+
+
+
+
+
+
/* PRIMITIVE VARIABLE ACCESS */
case ICMD_ILOAD: CHECK_ONEWORD(iptr->op1,TYPE_INT); break;
}
}
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");
}
{
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)
{
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");
{
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);
/* 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");