* src/vm/jit/jit.h (jitdata): Added isleafmethod.
* src/vm/jit/alpha/codegen.c (codegen): Use jd->isleafmethod. Pass
register number to codegen_add_classcastexception_ref.
* src/vm/jit/allocator/simplereg.c (interface_regalloc): Use
jd->isleafmethod.
(local_regalloc): Likewise.
* src/vm/jit/parse.c (new_parse): Likewise.
(parse): Likewise.
* src/vm/jit/parse.h (NEW_OP_BUILTIN_CHECK_EXCEPTION): Likewise.
(NEW_OP_BUILTIN_NO_EXCEPTION): Likewise.
(NEW_OP_BUILTIN_ARITHMETIC): Likewise.
(BUILTIN): Likewise.
Michael Starzinger
Edwin Steiner
- $Id: simplereg.c 5079 2006-07-06 11:36:01Z twisti $
+ $Id: simplereg.c 5096 2006-07-10 14:02:25Z twisti $
*/
static void interface_regalloc(jitdata *jd)
{
methodinfo *m;
- codeinfo *code;
codegendata *cd;
registerdata *rd;
/* get required compiler data */
- m = jd->m;
- code = jd->code;
- cd = jd->cd;
- rd = jd->rd;
+ m = jd->m;
+ cd = jd->cd;
+ rd = jd->rd;
/* rd->memuse was already set in stack.c to allocate stack space
for passing arguments to called methods. */
}
#endif
- if (code->isleafmethod) {
+ if (jd->isleafmethod) {
/* Reserve argument register, which will be used for Locals acting */
/* as Parameters */
if (rd->argintreguse < m->parseddesc->argintreguse)
if (!saved) {
#if defined(HAS_ADDRESS_REGISTER_FILE)
if (IS_ADR_TYPE(t)) {
- if (!code->isleafmethod
+ if (!jd->isleafmethod
&&(rd->argadrreguse < ADR_ARG_CNT)) {
v->regoff = rd->argadrregs[rd->argadrreguse++];
} else if (rd->tmpadrreguse > 0) {
static void local_regalloc(jitdata *jd)
{
methodinfo *m;
- codeinfo *code;
codegendata *cd;
registerdata *rd;
/* get required compiler data */
- m = jd->m;
- code = jd->code;
- cd = jd->cd;
- rd = jd->rd;
+ m = jd->m;
+ cd = jd->cd;
+ rd = jd->rd;
- if (code->isleafmethod) {
+ if (jd->isleafmethod) {
methoddesc *md = m->parseddesc;
iargcnt = rd->argintreguse;
Christian Ullrich
Edwin Steiner
- $Id: codegen.c 5071 2006-07-03 13:49:14Z twisti $
+ $Id: codegen.c 5096 2006-07-10 14:02:25Z twisti $
*/
s4 i, p, t, l;
s4 savedregs_num;
- savedregs_num = (m->isleafmethod) ? 0 : 1; /* space to save the RA */
+ savedregs_num = (jd->isleafmethod) ? 0 : 1; /* space to save the RA */
/* space to save used callee saved registers */
#endif
(void) dseg_adds4(cd, 0); /* IsSync */
- (void) dseg_adds4(cd, m->isleafmethod); /* IsLeaf */
+ (void) dseg_adds4(cd, jd->isleafmethod); /* IsLeaf */
(void) dseg_adds4(cd, INT_SAV_CNT - rd->savintreguse); /* IntSave */
(void) dseg_adds4(cd, FLT_SAV_CNT - rd->savfltreguse); /* FltSave */
/* save return address and used callee saved registers */
p = stackframesize;
- if (!m->isleafmethod) {
+ if (!jd->isleafmethod) {
p--; M_AST(REG_RA, REG_SP, p * 8);
}
for (i = INT_SAV_CNT - 1; i >= rd->savintreguse; i--) {
/* restore return address */
- if (!m->isleafmethod) {
+ if (!jd->isleafmethod) {
p--; M_LLD(REG_RA, REG_SP, p * 8);
}
super = (classinfo *) iptr->val.a;
- if (!super) {
+ if (super == NULL) {
superindex = 0;
supervftbl = NULL;
-
- } else {
+ }
+ else {
superindex = super->index;
supervftbl = super->vftbl;
}
/* calculate interface checkcast code size */
s2 = 6;
- if (!super)
+ if (super == NULL)
s2 += opt_showdisassemble ? 1 : 0;
/* calculate class checkcast code size */
s3 = 9 /* 8 + (s1 == REG_ITMP1) */;
- if (!super)
+ if (super == NULL)
s3 += opt_showdisassemble ? 1 : 0;
/* if class is not resolved, check which code to call */
- if (!super) {
+ if (super == NULL) {
M_BEQZ(s1, 4 + (opt_showdisassemble ? 1 : 0) + s2 + 1 + s3);
disp = dseg_adds4(cd, 0); /* super->flags */
/* interface checkcast code */
- if (!super || (super->flags & ACC_INTERFACE)) {
- if (super) {
+ if ((super == NULL) || (super->flags & ACC_INTERFACE)) {
+ if (super != NULL) {
M_BEQZ(s1, s2);
-
- } else {
+ }
+ else {
codegen_addpatchref(cd,
PATCHER_checkcast_instanceof_interface,
(constant_classref *) iptr->target,
OFFSET(vftbl_t, interfacetablelength));
M_LDA(REG_ITMP3, REG_ITMP3, -superindex);
M_BLEZ(REG_ITMP3, 0);
- codegen_add_classcastexception_ref(cd);
+ codegen_add_classcastexception_ref(cd, s1);
M_ALD(REG_ITMP3, REG_ITMP2,
(s4) (OFFSET(vftbl_t, interfacetable[0]) -
superindex * sizeof(methodptr*)));
M_BEQZ(REG_ITMP3, 0);
- codegen_add_classcastexception_ref(cd);
+ codegen_add_classcastexception_ref(cd, s1);
- if (!super)
+ if (super == NULL)
M_BR(s3);
}
/* class checkcast code */
- if (!super || !(super->flags & ACC_INTERFACE)) {
+ if ((super == NULL) || !(super->flags & ACC_INTERFACE)) {
disp = dseg_addaddress(cd, supervftbl);
- if (super) {
+ if (super != NULL) {
M_BEQZ(s1, s3);
-
- } else {
+ }
+ else {
codegen_addpatchref(cd,
PATCHER_checkcast_instanceof_class,
(constant_classref *) iptr->target,
/* } */
M_CMPULE(REG_ITMP2, REG_ITMP3, REG_ITMP3);
M_BEQZ(REG_ITMP3, 0);
- codegen_add_classcastexception_ref(cd);
+ codegen_add_classcastexception_ref(cd, s1);
}
- d = codegen_reg_of_var(rd, iptr->opc, iptr->dst, s1);
- } else {
+ d = codegen_reg_of_var(rd, iptr->opc, iptr->dst, s1);
+ }
+ else {
/* array type cast-check */
s1 = emit_load_s1(jd, iptr, src, rd->argintregs[0]);
M_LDA(REG_PV, REG_RA, -disp);
M_BEQZ(REG_RESULT, 0);
- codegen_add_classcastexception_ref(cd);
+ codegen_add_classcastexception_ref(cd, s1);
s1 = emit_load_s1(jd, iptr, src, REG_ITMP1);
d = codegen_reg_of_var(rd, iptr->opc, iptr->dst, s1);
}
+
M_INTMOVE(s1, d);
emit_store(jd, iptr, iptr->dst, d);
break;
super = (classinfo *) iptr->val.a;
- if (!super) {
+ if (super == NULL) {
superindex = 0;
supervftbl = NULL;
-
- } else {
+ }
+ else {
superindex = super->index;
supervftbl = super->vftbl;
}
/* calculate interface instanceof code size */
s2 = 6;
- if (!super)
+ if (super == NULL)
s2 += (d == REG_ITMP2 ? 1 : 0) + (opt_showdisassemble ? 1 : 0);
/* calculate class instanceof code size */
s3 = 7;
- if (!super)
+ if (super == NULL)
s3 += (opt_showdisassemble ? 1 : 0);
/* if class is not resolved, check which code to call */
- if (!super) {
+ if (super == NULL) {
M_CLR(d);
M_BEQZ(s1, 4 + (opt_showdisassemble ? 1 : 0) + s2 + 1 + s3);
/* interface instanceof code */
- if (!super || (super->flags & ACC_INTERFACE)) {
- if (super) {
+ if ((super == NULL) || (super->flags & ACC_INTERFACE)) {
+ if (super != NULL) {
M_CLR(d);
M_BEQZ(s1, s2);
-
- } else {
- /* If d == REG_ITMP2, then it's destroyed in check code */
- /* above. */
+ }
+ else {
+ /* If d == REG_ITMP2, then it's destroyed in check
+ code above. */
if (d == REG_ITMP2)
M_CLR(d);
superindex * sizeof(methodptr*)));
M_CMPULT(REG_ZERO, REG_ITMP1, d); /* REG_ITMP1 != 0 */
- if (!super)
+ if (super == NULL)
M_BR(s3);
}
/* class instanceof code */
- if (!super || !(super->flags & ACC_INTERFACE)) {
+ if ((super == NULL) || !(super->flags & ACC_INTERFACE)) {
disp = dseg_addaddress(cd, supervftbl);
- if (super) {
+ if (super != NULL) {
M_CLR(d);
M_BEQZ(s1, s3);
-
- } else {
+ }
+ else {
codegen_addpatchref(cd, PATCHER_checkcast_instanceof_class,
(constant_classref *) iptr->target,
disp);
M_MOV(REG_PV, rd->argintregs[0]);
M_MOV(REG_SP, rd->argintregs[1]);
- if (m->isleafmethod)
+ if (jd->isleafmethod)
M_MOV(REG_RA, rd->argintregs[2]);
else
M_ALD(rd->argintregs[2],
M_LDA(REG_SP, REG_SP, -2 * 8);
M_AST(rd->argintregs[3], REG_SP, 0 * 8); /* store XPC */
- if (m->isleafmethod)
+ if (jd->isleafmethod)
M_AST(REG_RA, REG_SP, 1 * 8);
M_MOV(REG_ITMP3, REG_PV);
M_MOV(REG_RESULT, REG_ITMP1_XPTR);
- if (m->isleafmethod)
+ if (jd->isleafmethod)
M_ALD(REG_RA, REG_SP, 1 * 8);
M_ALD(REG_ITMP2_XPC, REG_SP, 0 * 8);
codegen_finish(jd);
- return jd->code->entrypoint;
+ return code->entrypoint;
}
codeinfo *prev; /* previous codeinfo of this method */
u1 optlevel; /* optimization level of this code */
-
s4 basicblockcount; /* number of basic blocks */
- basicblock *basicblocks; /* points to basic block array */
/* machine code */
u1 *mcode; /* pointer to machine code */
u1 *entrypoint; /* machine code entry point */
s4 mcodelength; /* length of generated machine code */
- bool isleafmethod; /* does method call subroutines */
/* replacement */
rplpoint *rplpoints; /* replacement points */
Changes: Christian Thalinger
Edwin Steiner
- $Id: jit.h 5052 2006-06-28 17:05:46Z twisti $
+ $Id: jit.h 5096 2006-07-10 14:02:25Z twisti $
*/
#if defined(ENABLE_LOOP)
loopdata *ld;
#endif
+
u4 flags; /* contains JIT compiler flags */
+ bool isleafmethod; /* does method call subroutines */
new_instruction *new_instructions;
basicblock *new_basicblocks;
Joseph Wenninger
Christian Thalinger
- $Id: parse.c 5079 2006-07-06 11:36:01Z twisti $
+ $Id: parse.c 5096 2006-07-10 14:02:25Z twisti $
*/
#if defined(ENABLE_THREADS)
if (checksync && (m->flags & ACC_SYNCHRONIZED))
- code->isleafmethod = false;
+ jd->isleafmethod = false;
#endif
/* setup line number info */
break;
case JAVA_MULTIANEWARRAY:
- code->isleafmethod = false;
+ jd->isleafmethod = false;
i = code_get_u2(p + 1, m);
{
s4 v = code_get_u1(p + 3, m);
case JAVA_AASTORE:
NEW_OP(opcode);
- code->isleafmethod = false;
+ jd->isleafmethod = false;
break;
case JAVA_GETSTATIC:
return false;
invoke_method:
- code->isleafmethod = false;
+ jd->isleafmethod = false;
NEW_OP_PREPARE_ZEROFLAGS(opcode);
iptr->sx.s23.s3.fmiref = mr;
if (cr->name->text[0] == '[') {
/* array type cast-check */
flags = INS_FLAG_ARRAY;
- code->isleafmethod = false;
+ jd->isleafmethod = false;
}
else {
/* object type cast-check */
#if defined(ENABLE_THREADS)
if (checksync && (m->flags & ACC_SYNCHRONIZED))
- code->isleafmethod = false;
+ jd->isleafmethod = false;
#endif
/* scan all java instructions */
break;
case JAVA_MULTIANEWARRAY:
- code->isleafmethod = false;
+ jd->isleafmethod = false;
i = code_get_u2(p + 1, m);
{
s4 v = code_get_u1(p + 3, m);
case JAVA_AASTORE:
OP(opcode);
- code->isleafmethod = false;
+ jd->isleafmethod = false;
break;
case JAVA_GETSTATIC:
return false;
invoke_method:
- code->isleafmethod = false;
+ jd->isleafmethod = false;
OP2A_NOINC(opcode, 0, mr, currentline);
if (cr->name->text[0] == '[') {
/* array type cast-check */
OP2AT(opcode, 0, c, cr, currentline);
- code->isleafmethod = false;
+ jd->isleafmethod = false;
}
else {
#if !SUPPORT_DIVISION
bte = builtintable_get_internal(BUILTIN_idiv);
OP2A(opcode, bte->md->paramcount, bte, currentline);
- code->isleafmethod = false;
+ jd->isleafmethod = false;
#else
OP(opcode);
#endif
#if !SUPPORT_DIVISION
bte = builtintable_get_internal(BUILTIN_irem);
OP2A(opcode, bte->md->paramcount, bte, currentline);
- code->isleafmethod = false;
+ jd->isleafmethod = false;
#else
OP(opcode);
#endif
#if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
bte = builtintable_get_internal(BUILTIN_ldiv);
OP2A(opcode, bte->md->paramcount, bte, currentline);
- code->isleafmethod = false;
+ jd->isleafmethod = false;
#else
OP(opcode);
#endif
#if !(SUPPORT_DIVISION && SUPPORT_LONG && SUPPORT_LONG_DIV)
bte = builtintable_get_internal(BUILTIN_lrem);
OP2A(opcode, bte->md->paramcount, bte, currentline);
- code->isleafmethod = false;
+ jd->isleafmethod = false;
#else
OP(opcode);
#endif
Changes: Edwin Steiner
- $Id: parse.h 5079 2006-07-06 11:36:01Z twisti $
+ $Id: parse.h 5096 2006-07-10 14:02:25Z twisti $
*/
} while (0)
#define NEW_OP_BUILTIN_CHECK_EXCEPTION(bte) \
- code->isleafmethod = false; \
+ jd->isleafmethod = false; \
NEW_OP_PREPARE_ZEROFLAGS(ICMD_BUILTIN); \
iptr->sx.s23.s3.bte = (bte); \
PINC
#define NEW_OP_BUILTIN_NO_EXCEPTION(bte) \
- code->isleafmethod = false; \
+ jd->isleafmethod = false; \
NEW_OP_PREPARE(ICMD_BUILTIN); \
iptr->sx.s23.s3.bte = (bte); \
iptr->flags.bits = INS_FLAG_NOCHECK; \
PINC
#define NEW_OP_BUILTIN_ARITHMETIC(opcode, bte) \
- code->isleafmethod = false; \
+ jd->isleafmethod = false; \
NEW_OP_PREPARE_ZEROFLAGS(opcode); \
iptr->sx.s23.s3.bte = (bte); \
PINC
PINC
#define BUILTIN(v,o1,t,l) \
- code->isleafmethod = false; \
- iptr->opc = ICMD_BUILTIN; \
- iptr->op1 = (o1); \
- iptr->val.a = (v); \
- iptr->target = (t); \
- iptr->line = (l); \
+ jd->isleafmethod = false; \
+ iptr->opc = ICMD_BUILTIN; \
+ iptr->op1 = (o1); \
+ iptr->val.a = (v); \
+ iptr->target = (t); \
+ iptr->line = (l); \
PINC
#define OP1LOAD_ONEWORD(o,o1) \