X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjit%2Fparse.c;h=b2c74ccd7ec09230b1a99f19cc09c09d7ca79a5e;hb=442995cf7995968cef0869f3dfba20b609cbe5be;hp=fd9490a87fd267a5ccc1ec6b5ddacda61b2e6253;hpb=4bca02837622e8ab576a2d177ff5eda0d3987dfc;p=cacao.git diff --git a/src/vm/jit/parse.c b/src/vm/jit/parse.c index fd9490a87..b2c74ccd7 100644 --- a/src/vm/jit/parse.c +++ b/src/vm/jit/parse.c @@ -22,8 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: parse.c 7663 2007-04-04 22:14:42Z twisti $ - */ @@ -35,11 +33,10 @@ #include "vm/types.h" #include "mm/memory.h" + #include "native/native.h" -#if defined(ENABLE_THREADS) -# include "threads/native/lock.h" -#endif +#include "threads/lock-common.h" #include "toolbox/logging.h" @@ -51,7 +48,6 @@ #include "vm/jit/asmpart.h" #include "vm/jit/jit.h" #include "vm/jit/parse.h" -#include "vm/jit/patcher.h" #include "vm/jit/loop/loop.h" #include "vmcore/linker.h" @@ -375,6 +371,7 @@ static bool parse_resolve_exception_table(jitdata *jd, parsedata_t *pd) bool parse(jitdata *jd) { methodinfo *m; /* method being parsed */ + codeinfo *code; parsedata_t pd; instruction *iptr; /* current ptr into instruction array */ @@ -407,7 +404,7 @@ bool parse(jitdata *jd) u4 flags; basicblock *bptr; - int *local_map; /* local pointer to renaming structore */ + int *local_map; /* local pointer to renaming map */ /* is assigned to rd->local_map at the end */ branch_target_t *table; lookup_target_t *lookup; @@ -416,7 +413,8 @@ bool parse(jitdata *jd) /* get required compiler data */ - m = jd->m; + m = jd->m; + code = jd->code; /* allocate buffers for local variable renaming */ @@ -912,7 +910,6 @@ fetch_opcode: break; case JAVA_MULTIANEWARRAY: - jd->isleafmethod = false; i = SUCK_BE_U2(m->jcode + bcindex + 1); j = SUCK_BE_U1(m->jcode + bcindex + 3); @@ -927,6 +924,7 @@ fetch_opcode: iptr->s1.argcount = j; OP_S3_CLASSINFO_OR_CLASSREF(opcode, c, cr, INS_FLAG_CHECK); + code_unflag_leafmethod(code); break; /* control flow instructions ******************************************/ @@ -1152,7 +1150,7 @@ jsr_tail: case JAVA_AASTORE: OP(opcode); - jd->isleafmethod = false; + code_unflag_leafmethod(code); break; case JAVA_GETSTATIC: @@ -1248,7 +1246,7 @@ invoke_nonstatic_method: return false; invoke_method: - jd->isleafmethod = false; + code_unflag_leafmethod(code); iptr->sx.s23.s3.fmiref = fmi; @@ -1329,7 +1327,7 @@ invoke_method: if (cr->name->text[0] == '[') { /* array type cast-check */ flags = INS_FLAG_CHECK | INS_FLAG_ARRAY; - jd->isleafmethod = false; + code_unflag_leafmethod(code); } else { /* object type cast-check */ @@ -1821,15 +1819,16 @@ invoke_method: { s4 nlocals = 0; s4 i; - s4 *mapptr; mapptr = local_map; - /* iterate over local_map[0..m->maxlocals*5] and set all existing */ - /* index,type pairs (local_map[index*5+type]==1) to an unique value */ - /* -> == new local var index */ - for(i = 0; i < (m->maxlocals * 5); i++, mapptr++) { + /* iterate over local_map[0..m->maxlocals*5-1] and allocate a unique */ + /* variable index for each _used_ (javaindex,type) pair. */ + /* (local_map[javaindex*5+type] = cacaoindex) */ + /* Unused (javaindex,type) pairs are marked with UNUSED. */ + + for (i = 0; i < (m->maxlocals * 5); i++, mapptr++) { if (*mapptr) *mapptr = nlocals++; else @@ -1868,7 +1867,7 @@ invoke_method: /* set types of all locals in jd->var */ - for(mapptr = local_map, i = 0; i < (m->maxlocals * 5); i++, mapptr++) + for (mapptr = local_map, i = 0; i < (m->maxlocals * 5); i++, mapptr++) if (*mapptr != UNUSED) VAR(*mapptr)->type = i%5; }