Changes: Edwin Steiner
- $Id: codegen.c 5664 2006-10-04 14:31:01Z edwin $
+ $Id: codegen.c 5667 2006-10-04 15:14:19Z edwin $
*/
#include "vm/jit/jit.h"
#include "vm/jit/parse.h"
#include "vm/jit/patcher.h"
+#include "vm/jit/stack.h"
#define gen_branch(_inst) { \
gen_##_inst(cd, 0); \
- codegen_addreference(cd, iptr->dst.block); \
+ codegen_addreference(cd, BLOCK_OF(iptr->dst.insindex)); \
}
#define index2offset(_i) (-(_i) * SIZEOF_VOID_P)
bptr->mpc = (s4) (cd->mcodeptr - cd->mcodebase);
- if (bptr->flags >= BBREACHED) {
+ if (bptr->flags != BBDELETED) {
/* walk through all instructions */
/* op1 = target JavaVM pc */
gen_JSR(cd, NULL);
- codegen_addreference(cd, iptr->sx.s23.s3.jsrtarget.block);
+ codegen_addreference(cd, BLOCK_OF(iptr->sx.s23.s3.jsrtarget.insindex));
break;
case ICMD_RET: /* ... ==> ... */
dseg_adddata(cd);
cd->mcodeptr = (u1 *) cd->mcodeptr + 2 * sizeof(Inst);
- codegen_addreference(cd, table[0].block);
+ codegen_addreference(cd, BLOCK_OF(table[0].insindex));
/* build jump table top down and use address of lowest entry */
table += i;
while (--i >= 0) {
- dseg_addtarget(cd, table->block);
+ dseg_addtarget(cd, BLOCK_OF(table->insindex));
--table;
}
}
/* build jump table top down and use address of lowest entry */
while (--i >= 0) {
- dseg_addtarget(cd, lookup->target.block);
+ dseg_addtarget(cd, BLOCK_OF(lookup->target.insindex));
dseg_addaddress(cd, lookup->value);
lookup++;
}
- codegen_addreference(cd, iptr->sx.s23.s3.lookupdefault.block);
+ codegen_addreference(cd, BLOCK_OF(iptr->sx.s23.s3.lookupdefault.insindex));
}
/* length of dataseg after last dseg_addtarget is used by load */
gen_BBEND;
- } /* if (bptr->flags >= BBREACHED) */
+ } /* if (bptr->flags != BBDELETED) */
} /* for basic block */
dseg_createlinenumbertable(cd);
Christian Thalinger
Christian Ullrich
- $Id: jit.c 5656 2006-10-03 20:57:15Z edwin $
+ $Id: jit.c 5667 2006-10-04 15:14:19Z edwin $
*/
DEBUG_JIT_COMPILEVERBOSE("Parsing done: ");
- DEBUG_JIT_COMPILEVERBOSE("Analysing: ");
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+ if (!opt_intrp) {
+# endif
+ DEBUG_JIT_COMPILEVERBOSE("Analysing: ");
- /* call stack analysis pass */
+ /* call stack analysis pass */
- if (!stack_analyse(jd)) {
- DEBUG_JIT_COMPILEVERBOSE("Exception while analysing: ");
+ if (!stack_analyse(jd)) {
+ DEBUG_JIT_COMPILEVERBOSE("Exception while analysing: ");
- return NULL;
- }
- RT_TIMING_GET_TIME(time_stack);
+ return NULL;
+ }
+ RT_TIMING_GET_TIME(time_stack);
- DEBUG_JIT_COMPILEVERBOSE("Analysing done: ");
+ DEBUG_JIT_COMPILEVERBOSE("Analysing done: ");
- /* Build the CFG. This has to be done after stack_analyse, as
- there happens the JSR elimination. */
+ /* Build the CFG. This has to be done after stack_analyse, as
+ there happens the JSR elimination. */
- if (!cfg_build(jd))
- return NULL;
+ if (!cfg_build(jd))
+ return NULL;
#ifdef ENABLE_VERIFIER
- if (jd->flags & JITDATA_FLAG_VERIFY) {
- DEBUG_JIT_COMPILEVERBOSE("Typechecking: ");
+ if (jd->flags & JITDATA_FLAG_VERIFY) {
+ DEBUG_JIT_COMPILEVERBOSE("Typechecking: ");
- /* call typecheck pass */
- if (!typecheck(jd)) {
- DEBUG_JIT_COMPILEVERBOSE("Exception while typechecking: ");
+ /* call typecheck pass */
+ if (!typecheck(jd)) {
+ DEBUG_JIT_COMPILEVERBOSE("Exception while typechecking: ");
- return NULL;
- }
+ return NULL;
+ }
- DEBUG_JIT_COMPILEVERBOSE("Typechecking done: ");
- }
+ DEBUG_JIT_COMPILEVERBOSE("Typechecking done: ");
+ }
#endif
- RT_TIMING_GET_TIME(time_typecheck);
+ RT_TIMING_GET_TIME(time_typecheck);
#if defined(ENABLE_LOOP)
- if (opt_loops) {
- depthFirst(jd);
- analyseGraph(jd);
- optimize_loops(jd);
- }
+ if (opt_loops) {
+ depthFirst(jd);
+ analyseGraph(jd);
+ optimize_loops(jd);
+ }
#endif
- RT_TIMING_GET_TIME(time_loop);
+ RT_TIMING_GET_TIME(time_loop);
#if defined(ENABLE_IFCONV)
- if (JITDATA_HAS_FLAG_IFCONV(jd))
- if (!ifconv_static(jd))
- return NULL;
+ if (JITDATA_HAS_FLAG_IFCONV(jd))
+ if (!ifconv_static(jd))
+ return NULL;
#endif
- RT_TIMING_GET_TIME(time_ifconv);
+ RT_TIMING_GET_TIME(time_ifconv);
- /* Basic block reordering. I think this should be done after
- if-conversion, as we could lose the ability to do the
- if-conversion. */
+ /* Basic block reordering. I think this should be done after
+ if-conversion, as we could lose the ability to do the
+ if-conversion. */
- if (JITDATA_HAS_FLAG_REORDER(jd))
- if (!reorder(jd))
- return NULL;
+ if (JITDATA_HAS_FLAG_REORDER(jd))
+ if (!reorder(jd))
+ return NULL;
-#if defined(ENABLE_JIT)
-# if defined(ENABLE_INTRP)
- if (!opt_intrp) {
-# endif
DEBUG_JIT_COMPILEVERBOSE("Allocating registers: ");
#if defined(ENABLE_LSRA) && !defined(ENABLE_SSA)