calls instead of machine instructions, using the C calling
convention.
- $Id: builtin.c 1490 2004-11-12 13:24:14Z twisti $
+ $Id: builtin.c 1506 2004-11-14 14:48:49Z jowenn $
*/
monitorEnter((threadobject *) THREADOBJECT, o);
#endif
#endif
+
}
/*
Authors: Andreas Krall
Christian Thalinger
- $Id: codegen.c 1461 2004-11-05 16:23:47Z twisti $
+ $Id: codegen.c 1506 2004-11-14 14:48:49Z jowenn $
*/
store_reg_to_var_int(iptr->dst, s1);
break;
+ case ICMD_INLINE_START:
+ case ICMD_INLINE_END:
+ break;
default:
error ("Unknown pseudo command: %d", iptr->opc);
} /* switch */
i386_mov_imm_reg(cd, (u4) new_negativearraysizeexception, REG_ITMP1);
i386_call_reg(cd, REG_ITMP1); /* return value is REG_ITMP1_XPTR */
+ /*i386_alu_imm_reg(cd, I386_ADD, 1 * 4, REG_SP);*/
+
REMOVE_NATIVE_STACKINFO;
i386_mov_imm_reg(cd, (u4) new_classcastexception, REG_ITMP1);
i386_call_reg(cd, REG_ITMP1); /* return value is REG_ITMP1_XPTR */
+ /*i386_alu_imm_reg(cd, I386_ADD, 1 * 4, REG_SP);*/
+
REMOVE_NATIVE_STACKINFO;
Authors: Dieter Thuernbeck
- $Id: inline.c 1494 2004-11-12 13:34:26Z twisti $
+ $Id: inline.c 1506 2004-11-14 14:48:49Z jowenn $
*/
switch (opcode) {
case JAVA_INVOKEVIRTUAL:
- if (!inlinevirtuals)
+ if (!inlinevirtuals)
break;
/*log_text("\nINLINE INVOKEVIRTUAL :\t");*/
case JAVA_INVOKESPECIAL:
if (!is_unique_method(imi->class, imi, imr->name, imr->descriptor))
break;
+
}
/*if (imi->flags & ACC_NATIVE) log_text("Native method,no inlining");*/
} /* for */
newnode->stopgp = gp;
-
+ label_index[jcodelength]=gp;
if (DEBUGi==true) {
printf ("\nResult of inlining analysis of: ");
IMETHINFO(m);
Authors: Dieter Thuernbeck
- $Id: inline.h 1494 2004-11-12 13:34:26Z twisti $
+ $Id: inline.h 1506 2004-11-14 14:48:49Z jowenn $
*/
#include "global.h"
#include "toolbox/list.h"
-#define INLINING_MAXDEPTH 1
-#define INLINING_MAXCODESIZE 32
-#define INLINING_MAXMETHODS 8
+#define INLINING_MAXDEPTH 2 /*1*/
+#define INLINING_MAXCODESIZE 128 /*32*/
+#define INLINING_MAXMETHODS 32 /*8*/
/*typedef struct {
Changes: Edwin Steiner
- $Id: jit.c 1494 2004-11-12 13:34:26Z twisti $
+ $Id: jit.c 1506 2004-11-14 14:48:49Z jowenn $
*/
"UNDEF236","UNDEF237","UNDEF238","UNDEF239","UNDEF240",
"UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
"UNDEF246","UNDEF247","UNDEF248","UNDEF249","UNDEF250",
- "UNDEF251","UNDEF252",
+
+ "INLINE_START", /* 251 */
+ "INLINE_END", /* 252"*/
"BUILTIN3 ", /* 253 */
"BUILTIN2 ", /* 254 */
"UNDEF236","UNDEF237","UNDEF238","UNDEF239","UNDEF240",
"UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
"UNDEF246","UNDEF247","UNDEF248","UNDEF249","UNDEF250",
- "UNDEF251","UNDEF252",
+ "INLINE_START", /* 251 */
+ "INLINE_END", /* 252 */
"BUILTIN3 ", /* 253 */
"BUILTIN2 ", /* 254 */
"BUILTIN1 " /* 255 */
Changes: Christian Thalinger
- $Id: jit.h 1494 2004-11-12 13:34:26Z twisti $
+ $Id: jit.h 1506 2004-11-14 14:48:49Z jowenn $
*/
u2 line; /* line number in source file */
methodinfo *method; /* needed for inlining. can't be done on */
/* basic block level, since an inlined */
- /* function doesn't start necessarily start */
+ /* function doesn't necessarily start */
/* a new block */
};
#define ICMD_SASTORECONST 211
+#define ICMD_INLINE_START 251 /* before the first instruction of an inlined method */
+#define ICMD_INLINE_END 252 /* after the last instruction of an inlined method */
#define ICMD_BUILTIN3 253 /* internal opcode */
#define ICMD_BUILTIN2 254 /* internal opcode */
#define ICMD_BUILTIN1 255 /* internal opcode */
Changes: Carolyn Oates
Edwin Steiner
- $Id: parse.c 1494 2004-11-12 13:34:26Z twisti $
+ $Id: parse.c 1506 2004-11-14 14:48:49Z jowenn $
*/
int *label_index, int *block_count,
t_inlining_globals *inline_env)
{
- int b_count, i, p;
+ int b_count, i, p, src, insertBlock;
if (exceptiontablelength == 0)
return extable;
b_count = *block_count;
- for (i = 0; i < exceptiontablelength; i++) {
+ for (src = exceptiontablelength-1; src >=0; src--) {
/* printf("Excepiont table index: %d\n",i); */
- p = raw_extable[i].startpc;
+ p = raw_extable[src].startpc;
if (label_index != NULL) p = label_index[p];
- extable[i].startpc = p;
+ extable->startpc = p;
bound_check(p);
block_insert(p);
/*** if (DEBUG==true){printf("---------------------block_inserted:b_count=%i m->basicblockindex[(p=%i)]=%i=%p\n",b_count,p,m->basicblockindex[(p)],m->basicblockindex[(p)]);
fflush(stdout); } ***/
- p = raw_extable[i].endpc; /* see JVM Spec 4.7.3 */
- if (p < raw_extable[i].startpc)
+ p = raw_extable[src].endpc; /* see JVM Spec 4.7.3 */
+ if (p <= raw_extable[src].startpc)
panic("Invalid exception handler range");
- if (p > m->jcodelength) {
+
+ if (p >inline_env->method->jcodelength) {
panic("Invalid exception handler end is after code end");
}
+ if (p<inline_env->method->jcodelength) insertBlock=1; else insertBlock=0;
+ /*if (label_index !=NULL) printf("%s:translating endpc:%ld to %ld, label_index:%p\n",m->name->text,p,label_index[p],label_index); else
+ printf("%s:fillextab: endpc:%ld\n",m->name->text,p);*/
if (label_index != NULL) p = label_index[p];
- extable[i].endpc = p;
+ extable->endpc = p;
bound_check1(p);
- if (p < m->jcodelength) {
- block_insert(p); }
+ /*if (p < inline_env->method->jcodelength) {
+ block_insert(p); }*/
+ if (insertBlock) block_insert(p);
- p = raw_extable[i].handlerpc;
+ p = raw_extable[src].handlerpc;
if (label_index != NULL) p = label_index[p];
- extable[i].handlerpc = p;
+ extable->handlerpc = p;
bound_check(p);
block_insert(p);
- extable[i].catchtype = raw_extable[i].catchtype;
- extable[i].next = NULL;
- extable[i].down = &extable[i + 1];
+ extable->catchtype = raw_extable[src].catchtype;
+ extable->next = NULL;
+ extable->down = &extable[1];
+ extable--;
}
*block_count = b_count;
- return &extable[i]; /* return the next free xtable* */
+ return extable; /*&extable[i];*/ /* return the next free xtable* */
}
*/
nextex = fillextable(m,
- cd->exceptiontable, m->exceptiontable, m->exceptiontablelength,
+ &(cd->exceptiontable[cd->exceptiontablelength-1]), m->exceptiontable, m->exceptiontablelength,
label_index, &b_count, inline_env);
s_count = 1 + m->exceptiontablelength; /* initialize stack element counter */
}
+ OP(ICMD_INLINE_START);
+
if (inlinfo->inlinedmethods == NULL) {
gp = -1;
} else {
{
printf("Parse p=%i<%i<%i< opcode=<%i> %s\n",
p, gp, inline_env->jcodelength, opcode, opcode_names[opcode]);
+ if (label_index)
+ printf("label_index[%ld]=%ld\n",p,label_index[p]);
}
/*
printf("basicblockindex[gp=%i]=%i=%p ipc=%i=%p shifted ipc=%i=%p\n",
/* printf("setting gp from %d to %d\n",gp, inlinfo->stopgp); */
gp = inlinfo->stopgp;
inlining_restore_compiler_variables();
+ OP(ICMD_INLINE_END);
/*label_index = inlinfo->label_index;*/
+
if (DEBUG==true) {
printf("AFTER RESTORE : "); fflush(stdout);
DEBUGMETH(inline_env->method);
cd->exceptiontable[i].start = m->basicblocks + m->basicblockindex[p];
p = cd->exceptiontable[i].endpc;
- cd->exceptiontable[i].end = (p == m->jcodelength) ? (m->basicblocks + m->basicblockcount + 1) : (m->basicblocks + m->basicblockindex[p]);
+ cd->exceptiontable[i].end = (p == inline_env->method->jcodelength) ? (m->basicblocks + m->basicblockcount /*+ 1*/) : (m->basicblocks + m->basicblockindex[p]);
p = cd->exceptiontable[i].handlerpc;
cd->exceptiontable[i].handler = m->basicblocks + m->basicblockindex[p];
Changes: Stefan Ring
Christian Thalinger
- $Id: reg.inc 1466 2004-11-08 11:24:50Z twisti $
+ $Id: reg.inc 1506 2004-11-14 14:48:49Z jowenn $
*/
case ICMD_RET:
case ICMD_RETURN:
case ICMD_GOTO:
+ case ICMD_INLINE_START:
+ case ICMD_INLINE_END:
break;
/* pop 0 push 1 const */
Changes: Edwin Steiner
- $Id: stack.c 1456 2004-11-05 14:33:14Z twisti $
+ $Id: stack.c 1506 2004-11-14 14:48:49Z jowenn $
*/
}
break;
}
+ case ICMD_INLINE_START:
+ case ICMD_INLINE_END:
+ SETDST;
+ break;
case ICMD_BUILTIN3:
/* DEBUG */ /*dolog("builtin3");*/
if (m->basicblockcount > count_max_basic_blocks)
count_max_basic_blocks = m->basicblockcount;
count_basic_blocks += m->basicblockcount;
- if (m->instructioncount > count_max_javainstr)
- count_max_javainstr = m->instructioncount;
+ if (m->instructioncount > count_max_javainstr) count_max_javainstr = m->instructioncount;
count_javainstr += m->instructioncount;
if (m->stackcount > count_upper_bound_new_stack)
count_upper_bound_new_stack = m->stackcount;
}
break;
+ case ICMD_INLINE_START:
+ printf("\t\t\t%s.%s%s",iptr->method->class->name->text,iptr->method->name->text,iptr->method->descriptor->text);
+ break;
+ case ICMD_INLINE_END:
+ break;
+
case ICMD_BUILTIN3:
case ICMD_BUILTIN2:
case ICMD_BUILTIN1:
break;
}
/* printf(" Line number: %d, method:",iptr->line); */
- printf("\t\t");
+/* printf("\t\t");
utf_display(iptr->method->class->name);
printf(".");
- utf_display(iptr->method->name);
+ utf_display(iptr->method->name); */
}
Authors: Edwin Steiner
- $Id: typecheck.c 1483 2004-11-11 14:40:10Z twisti $
+ $Id: typecheck.c 1506 2004-11-14 14:48:49Z jowenn $
*/
static bool
-typestate_reach(methodinfo *m, void *localbuf,
+typestate_reach(codegendata *cd, registerdata *rd,void *localbuf,
basicblock *current,
basicblock *destblock,
stackptr ystack,typevector *yloc,
LOG1("reaching block L%03d",destblock->debug_nr);
TYPECHECK_COUNT(stat_reached);
- destidx = destblock - m->basicblocks;
+ destidx = destblock - cd->method->basicblocks;
destloc = MGET_TYPEVECTOR(localbuf,destidx,locsize);
/* When branching backwards we have to check for uninitialized objects */
if (destblock <= current) {
stackptr sp;
int i;
-
- TYPECHECK_COUNT(stat_backwards);
- LOG("BACKWARDS!");
- for (sp = ystack; sp; sp=sp->prev)
- if (sp->type == TYPE_ADR &&
- TYPEINFO_IS_NEWOBJECT(sp->typeinfo))
- panic("Branching backwards with uninitialized object on stack");
-
- for (i=0; i<locsize; ++i)
- if (yloc->td[i].type == TYPE_ADR &&
- TYPEINFO_IS_NEWOBJECT(yloc->td[i].info))
- panic("Branching backwards with uninitialized object in local variable");
- }
+#warning FIXME FOR INLINING
+ if (!useinlining) {
+ TYPECHECK_COUNT(stat_backwards);
+ LOG("BACKWARDS!");
+ for (sp = ystack; sp; sp=sp->prev)
+ if (sp->type == TYPE_ADR &&
+ TYPEINFO_IS_NEWOBJECT(sp->typeinfo)) {
+ show_icmd_method(cd->method,cd,rd);
+ printf("current: %ld, dest: %ld\n",current->debug_nr,destblock->debug_nr);
+ panic("Branching backwards with uninitialized object on stack");
+ }
+
+ for (i=0; i<locsize; ++i)
+ if (yloc->td[i].type == TYPE_ADR &&
+ TYPEINFO_IS_NEWOBJECT(yloc->td[i].info))
+ panic("Branching backwards with uninitialized object in local variable");
+ }
+ }
if (destblock->flags == BBTYPECHECK_UNDEF) {
/* The destblock has never been reached before */
static bool
-typestate_ret(methodinfo *m, void *localbuf,
+typestate_ret(codegendata *cd,registerdata *rd, void *localbuf,
basicblock *current,
stackptr ystack,typevector *yloc,
int retindex,int locsize)
selected = typevectorset_select(&yvec,retindex,destblock);
- repeat |= typestate_reach(m, localbuf,current,destblock,
+ repeat |= typestate_reach(cd, rd, localbuf,current,destblock,
ystack,selected,locsize,true);
}
return repeat;
*/
#define TYPECHECK_REACH \
do { \
- repeat |= typestate_reach(m, localbuf,bptr,tbptr,dst, \
+ repeat |= typestate_reach(cd,rd, localbuf,bptr,tbptr,dst, \
localset,numlocals,jsrencountered); \
LOG("done."); \
} while (0)
if (bptr + 1 == (m->basicblocks + m->basicblockcount + 1))
panic("Illegal instruction: JSR at end of bytecode");
typestack_put_retaddr(dst,bptr+1,localset);
- repeat |= typestate_reach(m, localbuf,bptr,tbptr,dst,
+ repeat |= typestate_reach(cd, rd,localbuf,bptr,tbptr,dst,
localset,numlocals,true);
superblockend = true;
if (!typevectorset_checkretaddr(localset,iptr->op1))
panic("illegal instruction: RET using non-returnAddress variable");
- repeat |= typestate_ret(m, localbuf,bptr,curstack,
+ repeat |= typestate_ret(cd,rd, localbuf,bptr,curstack,
localset,iptr->op1,numlocals);
superblockend = true;
cls = handlers[i]->catchtype;
excstack.typeinfo.typeclass = (cls) ? cls
: class_java_lang_Throwable;
- repeat |= typestate_reach(m, localbuf,bptr,
+ repeat |= typestate_reach(cd,rd, localbuf,bptr,
handlers[i]->handler,
&excstack,localset,
numlocals,
Changes: Joseph Wenninger
Christian Thalinger
- $Id: Runtime.c 1494 2004-11-12 13:34:26Z twisti $
+ $Id: Runtime.c 1506 2004-11-14 14:48:49Z jowenn $
*/
int buffer_len;
utf *data;
+#ifdef JOWENN_DEBUG
log_text("Java_java_lang_VMRuntime_nativeLoad");
+#endif
data = javastring_toutf(par1, 0);
return 1;
}
+#if JOWENN_DEBUG
buffer_len = utf_strlen(data) + 40;
-
buffer = MNEW(char, buffer_len);
strcpy(buffer, "Java_java_lang_VMRuntime_nativeLoad:");
utf_sprint(buffer + strlen((char *) data), data);
MFREE(buffer, char, buffer_len);
-
+#endif
#ifndef STATIC_CLASSPATH
/*here it could be interesting to store the references in a list eg for nicely cleaning up or for certain platforms*/
/* XXX do we need this one? */
{ "java.protocol.handler.pkgs", "gnu.java.net.protocol"}
#endif
+ insert_property(m,p,"java.protocol.handler.pkgs","gnu.java.net.protocol");
/* insert properties defined on commandline */
Changes: Joseph Wenninger
Christian Thalinger
- $Id: VMRuntime.c 1494 2004-11-12 13:34:26Z twisti $
+ $Id: VMRuntime.c 1506 2004-11-14 14:48:49Z jowenn $
*/
int buffer_len;
utf *data;
+#ifdef JOWENN_DEBUG
log_text("Java_java_lang_VMRuntime_nativeLoad");
+#endif
data = javastring_toutf(par1, 0);
return 1;
}
+#if JOWENN_DEBUG
buffer_len = utf_strlen(data) + 40;
-
buffer = MNEW(char, buffer_len);
strcpy(buffer, "Java_java_lang_VMRuntime_nativeLoad:");
utf_sprint(buffer + strlen((char *) data), data);
MFREE(buffer, char, buffer_len);
-
+#endif
#ifndef STATIC_CLASSPATH
/*here it could be interesting to store the references in a list eg for nicely cleaning up or for certain platforms*/
/* XXX do we need this one? */
{ "java.protocol.handler.pkgs", "gnu.java.net.protocol"}
#endif
+ insert_property(m,p,"java.protocol.handler.pkgs","gnu.java.net.protocol");
/* insert properties defined on commandline */
calls instead of machine instructions, using the C calling
convention.
- $Id: builtin.c 1490 2004-11-12 13:24:14Z twisti $
+ $Id: builtin.c 1506 2004-11-14 14:48:49Z jowenn $
*/
monitorEnter((threadobject *) THREADOBJECT, o);
#endif
#endif
+
}
/*
Authors: Andreas Krall
Christian Thalinger
- $Id: codegen.c 1461 2004-11-05 16:23:47Z twisti $
+ $Id: codegen.c 1506 2004-11-14 14:48:49Z jowenn $
*/
store_reg_to_var_int(iptr->dst, s1);
break;
+ case ICMD_INLINE_START:
+ case ICMD_INLINE_END:
+ break;
default:
error ("Unknown pseudo command: %d", iptr->opc);
} /* switch */
i386_mov_imm_reg(cd, (u4) new_negativearraysizeexception, REG_ITMP1);
i386_call_reg(cd, REG_ITMP1); /* return value is REG_ITMP1_XPTR */
+ /*i386_alu_imm_reg(cd, I386_ADD, 1 * 4, REG_SP);*/
+
REMOVE_NATIVE_STACKINFO;
i386_mov_imm_reg(cd, (u4) new_classcastexception, REG_ITMP1);
i386_call_reg(cd, REG_ITMP1); /* return value is REG_ITMP1_XPTR */
+ /*i386_alu_imm_reg(cd, I386_ADD, 1 * 4, REG_SP);*/
+
REMOVE_NATIVE_STACKINFO;
Authors: Dieter Thuernbeck
- $Id: inline.c 1494 2004-11-12 13:34:26Z twisti $
+ $Id: inline.c 1506 2004-11-14 14:48:49Z jowenn $
*/
switch (opcode) {
case JAVA_INVOKEVIRTUAL:
- if (!inlinevirtuals)
+ if (!inlinevirtuals)
break;
/*log_text("\nINLINE INVOKEVIRTUAL :\t");*/
case JAVA_INVOKESPECIAL:
if (!is_unique_method(imi->class, imi, imr->name, imr->descriptor))
break;
+
}
/*if (imi->flags & ACC_NATIVE) log_text("Native method,no inlining");*/
} /* for */
newnode->stopgp = gp;
-
+ label_index[jcodelength]=gp;
if (DEBUGi==true) {
printf ("\nResult of inlining analysis of: ");
IMETHINFO(m);
Authors: Dieter Thuernbeck
- $Id: inline.h 1494 2004-11-12 13:34:26Z twisti $
+ $Id: inline.h 1506 2004-11-14 14:48:49Z jowenn $
*/
#include "global.h"
#include "toolbox/list.h"
-#define INLINING_MAXDEPTH 1
-#define INLINING_MAXCODESIZE 32
-#define INLINING_MAXMETHODS 8
+#define INLINING_MAXDEPTH 2 /*1*/
+#define INLINING_MAXCODESIZE 128 /*32*/
+#define INLINING_MAXMETHODS 32 /*8*/
/*typedef struct {
Changes: Edwin Steiner
- $Id: jit.c 1494 2004-11-12 13:34:26Z twisti $
+ $Id: jit.c 1506 2004-11-14 14:48:49Z jowenn $
*/
"UNDEF236","UNDEF237","UNDEF238","UNDEF239","UNDEF240",
"UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
"UNDEF246","UNDEF247","UNDEF248","UNDEF249","UNDEF250",
- "UNDEF251","UNDEF252",
+
+ "INLINE_START", /* 251 */
+ "INLINE_END", /* 252"*/
"BUILTIN3 ", /* 253 */
"BUILTIN2 ", /* 254 */
"UNDEF236","UNDEF237","UNDEF238","UNDEF239","UNDEF240",
"UNDEF","UNDEF","UNDEF","UNDEF","UNDEF",
"UNDEF246","UNDEF247","UNDEF248","UNDEF249","UNDEF250",
- "UNDEF251","UNDEF252",
+ "INLINE_START", /* 251 */
+ "INLINE_END", /* 252 */
"BUILTIN3 ", /* 253 */
"BUILTIN2 ", /* 254 */
"BUILTIN1 " /* 255 */
Changes: Christian Thalinger
- $Id: jit.h 1494 2004-11-12 13:34:26Z twisti $
+ $Id: jit.h 1506 2004-11-14 14:48:49Z jowenn $
*/
u2 line; /* line number in source file */
methodinfo *method; /* needed for inlining. can't be done on */
/* basic block level, since an inlined */
- /* function doesn't start necessarily start */
+ /* function doesn't necessarily start */
/* a new block */
};
#define ICMD_SASTORECONST 211
+#define ICMD_INLINE_START 251 /* before the first instruction of an inlined method */
+#define ICMD_INLINE_END 252 /* after the last instruction of an inlined method */
#define ICMD_BUILTIN3 253 /* internal opcode */
#define ICMD_BUILTIN2 254 /* internal opcode */
#define ICMD_BUILTIN1 255 /* internal opcode */
Changes: Carolyn Oates
Edwin Steiner
- $Id: parse.c 1494 2004-11-12 13:34:26Z twisti $
+ $Id: parse.c 1506 2004-11-14 14:48:49Z jowenn $
*/
int *label_index, int *block_count,
t_inlining_globals *inline_env)
{
- int b_count, i, p;
+ int b_count, i, p, src, insertBlock;
if (exceptiontablelength == 0)
return extable;
b_count = *block_count;
- for (i = 0; i < exceptiontablelength; i++) {
+ for (src = exceptiontablelength-1; src >=0; src--) {
/* printf("Excepiont table index: %d\n",i); */
- p = raw_extable[i].startpc;
+ p = raw_extable[src].startpc;
if (label_index != NULL) p = label_index[p];
- extable[i].startpc = p;
+ extable->startpc = p;
bound_check(p);
block_insert(p);
/*** if (DEBUG==true){printf("---------------------block_inserted:b_count=%i m->basicblockindex[(p=%i)]=%i=%p\n",b_count,p,m->basicblockindex[(p)],m->basicblockindex[(p)]);
fflush(stdout); } ***/
- p = raw_extable[i].endpc; /* see JVM Spec 4.7.3 */
- if (p < raw_extable[i].startpc)
+ p = raw_extable[src].endpc; /* see JVM Spec 4.7.3 */
+ if (p <= raw_extable[src].startpc)
panic("Invalid exception handler range");
- if (p > m->jcodelength) {
+
+ if (p >inline_env->method->jcodelength) {
panic("Invalid exception handler end is after code end");
}
+ if (p<inline_env->method->jcodelength) insertBlock=1; else insertBlock=0;
+ /*if (label_index !=NULL) printf("%s:translating endpc:%ld to %ld, label_index:%p\n",m->name->text,p,label_index[p],label_index); else
+ printf("%s:fillextab: endpc:%ld\n",m->name->text,p);*/
if (label_index != NULL) p = label_index[p];
- extable[i].endpc = p;
+ extable->endpc = p;
bound_check1(p);
- if (p < m->jcodelength) {
- block_insert(p); }
+ /*if (p < inline_env->method->jcodelength) {
+ block_insert(p); }*/
+ if (insertBlock) block_insert(p);
- p = raw_extable[i].handlerpc;
+ p = raw_extable[src].handlerpc;
if (label_index != NULL) p = label_index[p];
- extable[i].handlerpc = p;
+ extable->handlerpc = p;
bound_check(p);
block_insert(p);
- extable[i].catchtype = raw_extable[i].catchtype;
- extable[i].next = NULL;
- extable[i].down = &extable[i + 1];
+ extable->catchtype = raw_extable[src].catchtype;
+ extable->next = NULL;
+ extable->down = &extable[1];
+ extable--;
}
*block_count = b_count;
- return &extable[i]; /* return the next free xtable* */
+ return extable; /*&extable[i];*/ /* return the next free xtable* */
}
*/
nextex = fillextable(m,
- cd->exceptiontable, m->exceptiontable, m->exceptiontablelength,
+ &(cd->exceptiontable[cd->exceptiontablelength-1]), m->exceptiontable, m->exceptiontablelength,
label_index, &b_count, inline_env);
s_count = 1 + m->exceptiontablelength; /* initialize stack element counter */
}
+ OP(ICMD_INLINE_START);
+
if (inlinfo->inlinedmethods == NULL) {
gp = -1;
} else {
{
printf("Parse p=%i<%i<%i< opcode=<%i> %s\n",
p, gp, inline_env->jcodelength, opcode, opcode_names[opcode]);
+ if (label_index)
+ printf("label_index[%ld]=%ld\n",p,label_index[p]);
}
/*
printf("basicblockindex[gp=%i]=%i=%p ipc=%i=%p shifted ipc=%i=%p\n",
/* printf("setting gp from %d to %d\n",gp, inlinfo->stopgp); */
gp = inlinfo->stopgp;
inlining_restore_compiler_variables();
+ OP(ICMD_INLINE_END);
/*label_index = inlinfo->label_index;*/
+
if (DEBUG==true) {
printf("AFTER RESTORE : "); fflush(stdout);
DEBUGMETH(inline_env->method);
cd->exceptiontable[i].start = m->basicblocks + m->basicblockindex[p];
p = cd->exceptiontable[i].endpc;
- cd->exceptiontable[i].end = (p == m->jcodelength) ? (m->basicblocks + m->basicblockcount + 1) : (m->basicblocks + m->basicblockindex[p]);
+ cd->exceptiontable[i].end = (p == inline_env->method->jcodelength) ? (m->basicblocks + m->basicblockcount /*+ 1*/) : (m->basicblocks + m->basicblockindex[p]);
p = cd->exceptiontable[i].handlerpc;
cd->exceptiontable[i].handler = m->basicblocks + m->basicblockindex[p];
Changes: Stefan Ring
Christian Thalinger
- $Id: reg.inc 1466 2004-11-08 11:24:50Z twisti $
+ $Id: reg.inc 1506 2004-11-14 14:48:49Z jowenn $
*/
case ICMD_RET:
case ICMD_RETURN:
case ICMD_GOTO:
+ case ICMD_INLINE_START:
+ case ICMD_INLINE_END:
break;
/* pop 0 push 1 const */
Changes: Edwin Steiner
- $Id: stack.c 1456 2004-11-05 14:33:14Z twisti $
+ $Id: stack.c 1506 2004-11-14 14:48:49Z jowenn $
*/
}
break;
}
+ case ICMD_INLINE_START:
+ case ICMD_INLINE_END:
+ SETDST;
+ break;
case ICMD_BUILTIN3:
/* DEBUG */ /*dolog("builtin3");*/
if (m->basicblockcount > count_max_basic_blocks)
count_max_basic_blocks = m->basicblockcount;
count_basic_blocks += m->basicblockcount;
- if (m->instructioncount > count_max_javainstr)
- count_max_javainstr = m->instructioncount;
+ if (m->instructioncount > count_max_javainstr) count_max_javainstr = m->instructioncount;
count_javainstr += m->instructioncount;
if (m->stackcount > count_upper_bound_new_stack)
count_upper_bound_new_stack = m->stackcount;
}
break;
+ case ICMD_INLINE_START:
+ printf("\t\t\t%s.%s%s",iptr->method->class->name->text,iptr->method->name->text,iptr->method->descriptor->text);
+ break;
+ case ICMD_INLINE_END:
+ break;
+
case ICMD_BUILTIN3:
case ICMD_BUILTIN2:
case ICMD_BUILTIN1:
break;
}
/* printf(" Line number: %d, method:",iptr->line); */
- printf("\t\t");
+/* printf("\t\t");
utf_display(iptr->method->class->name);
printf(".");
- utf_display(iptr->method->name);
+ utf_display(iptr->method->name); */
}
Authors: Edwin Steiner
- $Id: typecheck.c 1483 2004-11-11 14:40:10Z twisti $
+ $Id: typecheck.c 1506 2004-11-14 14:48:49Z jowenn $
*/
static bool
-typestate_reach(methodinfo *m, void *localbuf,
+typestate_reach(codegendata *cd, registerdata *rd,void *localbuf,
basicblock *current,
basicblock *destblock,
stackptr ystack,typevector *yloc,
LOG1("reaching block L%03d",destblock->debug_nr);
TYPECHECK_COUNT(stat_reached);
- destidx = destblock - m->basicblocks;
+ destidx = destblock - cd->method->basicblocks;
destloc = MGET_TYPEVECTOR(localbuf,destidx,locsize);
/* When branching backwards we have to check for uninitialized objects */
if (destblock <= current) {
stackptr sp;
int i;
-
- TYPECHECK_COUNT(stat_backwards);
- LOG("BACKWARDS!");
- for (sp = ystack; sp; sp=sp->prev)
- if (sp->type == TYPE_ADR &&
- TYPEINFO_IS_NEWOBJECT(sp->typeinfo))
- panic("Branching backwards with uninitialized object on stack");
-
- for (i=0; i<locsize; ++i)
- if (yloc->td[i].type == TYPE_ADR &&
- TYPEINFO_IS_NEWOBJECT(yloc->td[i].info))
- panic("Branching backwards with uninitialized object in local variable");
- }
+#warning FIXME FOR INLINING
+ if (!useinlining) {
+ TYPECHECK_COUNT(stat_backwards);
+ LOG("BACKWARDS!");
+ for (sp = ystack; sp; sp=sp->prev)
+ if (sp->type == TYPE_ADR &&
+ TYPEINFO_IS_NEWOBJECT(sp->typeinfo)) {
+ show_icmd_method(cd->method,cd,rd);
+ printf("current: %ld, dest: %ld\n",current->debug_nr,destblock->debug_nr);
+ panic("Branching backwards with uninitialized object on stack");
+ }
+
+ for (i=0; i<locsize; ++i)
+ if (yloc->td[i].type == TYPE_ADR &&
+ TYPEINFO_IS_NEWOBJECT(yloc->td[i].info))
+ panic("Branching backwards with uninitialized object in local variable");
+ }
+ }
if (destblock->flags == BBTYPECHECK_UNDEF) {
/* The destblock has never been reached before */
static bool
-typestate_ret(methodinfo *m, void *localbuf,
+typestate_ret(codegendata *cd,registerdata *rd, void *localbuf,
basicblock *current,
stackptr ystack,typevector *yloc,
int retindex,int locsize)
selected = typevectorset_select(&yvec,retindex,destblock);
- repeat |= typestate_reach(m, localbuf,current,destblock,
+ repeat |= typestate_reach(cd, rd, localbuf,current,destblock,
ystack,selected,locsize,true);
}
return repeat;
*/
#define TYPECHECK_REACH \
do { \
- repeat |= typestate_reach(m, localbuf,bptr,tbptr,dst, \
+ repeat |= typestate_reach(cd,rd, localbuf,bptr,tbptr,dst, \
localset,numlocals,jsrencountered); \
LOG("done."); \
} while (0)
if (bptr + 1 == (m->basicblocks + m->basicblockcount + 1))
panic("Illegal instruction: JSR at end of bytecode");
typestack_put_retaddr(dst,bptr+1,localset);
- repeat |= typestate_reach(m, localbuf,bptr,tbptr,dst,
+ repeat |= typestate_reach(cd, rd,localbuf,bptr,tbptr,dst,
localset,numlocals,true);
superblockend = true;
if (!typevectorset_checkretaddr(localset,iptr->op1))
panic("illegal instruction: RET using non-returnAddress variable");
- repeat |= typestate_ret(m, localbuf,bptr,curstack,
+ repeat |= typestate_ret(cd,rd, localbuf,bptr,curstack,
localset,iptr->op1,numlocals);
superblockend = true;
cls = handlers[i]->catchtype;
excstack.typeinfo.typeclass = (cls) ? cls
: class_java_lang_Throwable;
- repeat |= typestate_reach(m, localbuf,bptr,
+ repeat |= typestate_reach(cd,rd, localbuf,bptr,
handlers[i]->handler,
&excstack,localset,
numlocals,
System.out.println("ERROR EXCEPTION EXPECTED");
} catch (Exception e) {
System.out.println(e);
+ System.out.println("End of outer exception handler");
System.exit(0);
}
System.out.println("SHOULD NOT BE REACHED");
--- /dev/null
+public class InlineExTest3 {
+ public static void internal() throws Exception {
+ System.out.println("INTERNAL");
+ }
+
+ public static void main(String args[]) {
+ try {
+ internal();
+ throw new Exception("ex");
+ //System.out.println("ERROR EXCEPTION EXPECTED");
+ } catch (Exception e) {
+ System.out.println(e);
+ System.exit(0);
+ }
+ // System.out.println("SHOULD NOT BE REACHED");
+ }
+}
--- /dev/null
+public class InlineExTest4 {
+ public static void internal() throws Exception {
+ try {
+ throw new Exception("*");
+ } catch (Exception e) {
+ throw new Exception("*"+e.getMessage());
+ }
+ }
+
+ public static void main(String args[]) {
+ try {
+ internal();
+ System.out.println("ERROR EXCEPTION EXPECTED");
+ } catch (Throwable e) {
+ System.out.println(e);
+ System.out.println("End of outer exception handler");
+ System.exit(0);
+ }
+ System.out.println("SHOULD NOT BE REACHED");
+ }
+}
--- /dev/null
+public class InlineSynchronized {
+
+ public static void testit(InlineSynchronized o) throws Exception {
+ synchronized(o) {
+ System.out.println("Within protected section, about to throw an exception");
+ throw new Exception("");
+ }
+ }
+ public static void main(String args[]) {
+ InlineSynchronized o=new InlineSynchronized();
+ try {
+ try {
+ testit(o);
+ } catch (Exception e) {
+ System.out.println("First catch");
+ testit(o);
+ }
+ } catch (Exception e) {
+ System.out.println("Second catch");
+ }
+ }
+}
--- /dev/null
+public class InlineSynchronized2 extends Thread{
+
+ private InlineSynchronized2 m_o;
+ String m_name;
+ public InlineSynchronized2(String name, InlineSynchronized2 o) {
+ super(name);
+ m_o=o;
+ m_name=name;
+ }
+
+ public void run() {
+ while (true) {
+ try {
+ try {
+ testit(m_o);
+ } catch (Exception e) {
+ System.out.println(m_name+":First catch");
+ testit(m_o);
+ }
+ } catch (Exception e) {
+ System.out.println(m_name+":Second catch");
+ }
+ try {
+ sleep(2000);
+ } catch (Exception e) {}
+ }
+ }
+ public static void testit(InlineSynchronized2 o) throws Exception {
+ synchronized(o) {
+ System.out.println("Within protected section, about to throw an exception");
+ throw new Exception("");
+ }
+ }
+ public static void main(String args[]) {
+ InlineSynchronized2 o=new InlineSynchronized2("dummy",null);
+ InlineSynchronized2 o1=new InlineSynchronized2("1",o);
+ InlineSynchronized2 o2=new InlineSynchronized2("2",o);
+ InlineSynchronized2 o3=new InlineSynchronized2("3",o);
+ o1.start();
+ o2.start();
+ o3.start();
+ }
+}
--- /dev/null
+public class InlineSynchronized3 extends Thread{
+
+ private InlineSynchronized3 m_o;
+ String m_name;
+ public InlineSynchronized3(String name, InlineSynchronized3 o) {
+ super(name);
+ m_o=o;
+ m_name=name;
+ }
+
+ public void run() {
+ while (true) {
+ testit(m_o);
+ System.out.println("("+m_name+")");
+ try {
+ sleep(2000);
+ } catch (Exception e) {}
+ }
+ }
+ public static void testit(InlineSynchronized3 o) {
+ synchronized(o) {
+ System.out.println("Within protected section, about to throw an exception");
+ }
+ }
+ public static void main(String args[]) {
+ InlineSynchronized3 o=new InlineSynchronized3("dummy",null);
+ InlineSynchronized3 o1=new InlineSynchronized3("1",o);
+ InlineSynchronized3 o2=new InlineSynchronized3("2",o);
+ InlineSynchronized3 o3=new InlineSynchronized3("3",o);
+ o1.start();
+ o2.start();
+ o3.start();
+ }
+}
--- /dev/null
+public class InlineSynchronized4 extends Thread{
+
+ private InlineSynchronized4 m_o;
+ String m_name;
+ public InlineSynchronized4(String name, InlineSynchronized4 o) {
+ super(name);
+ m_o=o;
+ m_name=name;
+ }
+
+ public void run() {
+ while (true) {
+ testit(m_o);
+ System.out.println("("+m_name+")");
+ try {
+ sleep(2000);
+ } catch (Exception e) {}
+ }
+ }
+ public static void testit(InlineSynchronized4 o){
+ try {
+ synchronized(o) {
+ System.out.println("Within protected section, about to throw an exception");
+ throw new Exception("");
+ }
+ }
+ catch (Exception e) {
+ System.out.println("Exception caught");
+ }
+ }
+ public static void main(String args[]) {
+ InlineSynchronized4 o=new InlineSynchronized4("dummy",null);
+ InlineSynchronized4 o1=new InlineSynchronized4("1",o);
+ InlineSynchronized4 o2=new InlineSynchronized4("2",o);
+ InlineSynchronized4 o3=new InlineSynchronized4("3",o);
+ o1.start();
+ o2.start();
+ o3.start();
+ }
+}
--- /dev/null
+public class InlineSynchronized5 extends Thread{
+
+ private InlineSynchronized5 m_o;
+ String m_name;
+ public InlineSynchronized5(String name, InlineSynchronized5 o) {
+ super(name);
+ m_o=o;
+ m_name=name;
+ }
+
+ public void run() {
+ while (true) {
+ try {
+ try {
+ testit(m_o);
+ } catch (Exception e) {
+ System.out.println(m_name+":First catch");
+ testit(m_o);
+ }
+ } catch (Exception e) {
+ System.out.println(m_name+":Second catch");
+ }
+ try {
+ sleep(2000);
+ } catch (Exception e) {}
+ }
+ }
+ public static void testit(InlineSynchronized5 o) throws Exception {
+ try {
+ synchronized(o) {
+ System.out.println("Within protected section, about to throw an exception");
+ throw new Exception("");
+ }
+ } catch (Exception e) {
+ System.out.println("Exception caught, rethrowing");
+ throw e;
+ }
+ }
+ public static void main(String args[]) {
+ InlineSynchronized5 o=new InlineSynchronized5("dummy",null);
+ InlineSynchronized5 o1=new InlineSynchronized5("1",o);
+ InlineSynchronized5 o2=new InlineSynchronized5("2",o);
+ InlineSynchronized5 o3=new InlineSynchronized5("3",o);
+ o1.start();
+ o2.start();
+ o3.start();
+ }
+}
--- /dev/null
+public class InlineSynchronized6 extends Thread{
+
+ private InlineSynchronized6 m_o;
+ String m_name;
+ public InlineSynchronized6(String name, InlineSynchronized6 o) {
+ super(name);
+ m_o=o;
+ m_name=name;
+ }
+
+ public void run() {
+ while (true) {
+ try {
+ try {
+ testit(m_o);
+ } catch (Exception e) {
+ System.out.println(m_name+":First catch");
+ testit(m_o);
+ }
+ } catch (Exception e) {
+ System.out.println(m_name+":Second catch");
+ }
+ try {
+ sleep(2000);
+ } catch (Exception e) {}
+ }
+ }
+ public static synchronized void testit(InlineSynchronized6 o) throws Exception {
+ System.out.println("Within protected section, about to throw an exception");
+ throw new Exception("");
+ }
+ public static void main(String args[]) {
+ InlineSynchronized6 o=new InlineSynchronized6("dummy",null);
+ InlineSynchronized6 o1=new InlineSynchronized6("1",o);
+ InlineSynchronized6 o2=new InlineSynchronized6("2",o);
+ InlineSynchronized6 o3=new InlineSynchronized6("3",o);
+ o1.start();
+ o2.start();
+ o3.start();
+ }
+}