Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
- $Id: parse.c 7663 2007-04-04 22:14:42Z twisti $
-
*/
#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"
#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"
bool parse(jitdata *jd)
{
methodinfo *m; /* method being parsed */
+ codeinfo *code;
parsedata_t pd;
instruction *iptr; /* current ptr into instruction array */
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;
/* get required compiler data */
- m = jd->m;
+ m = jd->m;
+ code = jd->code;
/* allocate buffers for local variable renaming */
break;
case JAVA_MULTIANEWARRAY:
- jd->isleafmethod = false;
i = SUCK_BE_U2(m->jcode + bcindex + 1);
j = SUCK_BE_U1(m->jcode + bcindex + 3);
iptr->s1.argcount = j;
OP_S3_CLASSINFO_OR_CLASSREF(opcode, c, cr, INS_FLAG_CHECK);
+ code_unflag_leafmethod(code);
break;
/* control flow instructions ******************************************/
case JAVA_AASTORE:
OP(opcode);
- jd->isleafmethod = false;
+ code_unflag_leafmethod(code);
break;
case JAVA_GETSTATIC:
return false;
invoke_method:
- jd->isleafmethod = false;
+ code_unflag_leafmethod(code);
iptr->sx.s23.s3.fmiref = fmi;
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 */
{
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
/* 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;
}