memory. All functions writing values into the data area return the offset
relative the begin of the code area (start of procedure).
- $Id: codegen.inc 1475 2004-11-11 10:27:49Z twisti $
+ $Id: codegen.inc 1494 2004-11-12 13:34:26Z twisti $
*/
mte = NEW(methodtree_element);
- mte->startpc = asm_calljavafunction;
- mte->endpc = asm_calljavafunction2 - 1;
+ mte->startpc = (functionptr) asm_calljavafunction;
+ mte->endpc = (functionptr) ((long) asm_calljavafunction2 - 1);
avl_insert(methodtree, mte);
mte = NEW(methodtree_element);
- mte->startpc = asm_calljavafunction2;
- mte->endpc = asm_call_jit_compiler - 1;
+ mte->startpc = (functionptr) asm_calljavafunction2;
+ mte->endpc = (functionptr) ((long) asm_call_jit_compiler - 1);
avl_insert(methodtree, mte);
}
/* compare both startpc and endpc of pc, even if they have the same value,
otherwise the avl_probe sometimes thinks the element is already in the
tree */
- if (mte->startpc <= mtepc->startpc && mtepc->startpc <= mte->endpc &&
- mte->startpc <= mtepc->endpc && mtepc->endpc <= mte->endpc) {
+ if ((long) mte->startpc <= (long) mtepc->startpc &&
+ (long) mtepc->startpc <= (long) mte->endpc &&
+ (long) mte->startpc <= (long) mtepc->endpc &&
+ (long) mtepc->endpc <= (long) mte->endpc) {
return 0;
- } else if (mtepc->startpc < mte->startpc) {
+ } else if ((long) mtepc->startpc < (long) mte->startpc) {
return -1;
} else {
#endif
-void codegen_insertmethod(void *startpc, void *endpc)
+void codegen_insertmethod(functionptr startpc, functionptr endpc)
{
methodtree_element *mte;
}
-void *codegen_findmethod(void *pc)
+functionptr codegen_findmethod(functionptr pc)
{
methodtree_element *mtepc;
methodtree_element *mte;
static void codegen_finish(methodinfo *m, codegendata *cd, s4 mcodelen)
{
jumpref *jr;
- u1 *epoint;
+ functionptr epoint;
s4 extralen;
s4 alignedlen;
alignedlen = ALIGN(mcodelen, MAX_ALIGN) + cd->dseglen;
m->mcodelength = mcodelen + cd->dseglen;
- m->mcode = CNEW(u1, alignedlen + extralen);
+ m->mcode = (functionptr) (long) CNEW(u1, alignedlen + extralen);
- memcpy(m->mcode, cd->dsegtop - cd->dseglen, cd->dseglen);
- memcpy(m->mcode + cd->dseglen, cd->mcodebase, mcodelen);
+ memcpy((void *) (long) m->mcode, cd->dsegtop - cd->dseglen, cd->dseglen);
+ memcpy((void *) ((long) m->mcode + cd->dseglen), cd->mcodebase, mcodelen);
- m->entrypoint = epoint = (u1 *) (m->mcode + cd->dseglen);
+ m->entrypoint = epoint = (functionptr) ((long) m->mcode + cd->dseglen);
/* jump table resolving */
jr = cd->jumpreferences;
while (jr != NULL) {
- *((void**) (epoint + jr->tablepos)) = epoint + jr->target->mpc;
+ *((functionptr *) ((long) epoint + jr->tablepos)) =
+ (functionptr) ((long) epoint + (long) jr->target->mpc);
jr = jr->next;
}
dataref *dr;
/* add method into methodtree to find the entrypoint */
- codegen_insertmethod(m->entrypoint, m->entrypoint + mcodelen);
+ codegen_insertmethod(m->entrypoint,
+ (functionptr) ((long) m->entrypoint + mcodelen));
/* data segment references resolving */
dr = cd->datareferences;
while (dr != NULL) {
- *((void**) ((long) epoint + (long) dr->pos - POINTERSIZE)) = epoint;
+ *((functionptr *) ((long) epoint + (long) dr->pos - POINTERSIZE)) =
+ epoint;
dr = dr->next;
}
}
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
{
- threadcritnode *n = (threadcritnode *) (m->mcode + alignedlen);
+ threadcritnode *n = (threadcritnode *) ((long) m->mcode + alignedlen);
s4 i;
threadcritnodetemp *nt = cd->threadcrit;
for (i = 0; i < cd->threadcritcount; i++) {
- n->mcodebegin = m->mcode + nt->mcodebegin;
- n->mcodeend = m->mcode + nt->mcodeend;
- n->mcoderestart = m->mcode + nt->mcoderestart;
+ n->mcodebegin = (u1 *) (long) m->mcode + nt->mcodebegin;
+ n->mcodeend = (u1 *) (long) m->mcode + nt->mcodeend;
+ n->mcoderestart = (u1 *) (long) m->mcode + nt->mcoderestart;
thread_registercritical(n);
n++;
nt = nt->next;
s4 *s4ptr;
s4 i;
- s4ptr = (s4 *) m->mcode;
+ s4ptr = (s4 *) (long) m->mcode;
printf(" --- dump of datasegment\n");
for (i = cd->dseglen; i > 0 ; i -= 4) {
printf("-%6x: %8x\n", i, (s4) (*s4ptr++));
}
- printf(" --- begin of data segment: %p\n", s4ptr);
+ printf(" --- begin of data segment: %p\n", (void *) s4ptr);
}
Authors: Christian Thalinger
- $Id: codegen.inc.h 1458 2004-11-05 15:33:49Z twisti $
+ $Id: codegen.inc.h 1494 2004-11-12 13:34:26Z twisti $
*/
typedef struct _methodtree_element methodtree_element;
struct _methodtree_element {
- void *startpc;
- void *endpc;
+ functionptr startpc;
+ functionptr endpc;
};
#endif
void codegen(methodinfo *m, codegendata *cd, registerdata *rd);
void codegen_free(methodinfo *m, codegendata *cd);
void codegen_close();
-void codegen_insertmethod(void *startpc, void *endpc);
+void codegen_insertmethod(functionptr startpc, functionptr endpc);
#if defined(__I386__) || defined(__X86_64__)
void codegen_addreference(codegendata *cd, struct basicblock *target, void *branchptr);
Authors: Dieter Thuernbeck
- $Id: inline.c 1474 2004-11-11 10:09:10Z carolyn $
+ $Id: inline.c 1494 2004-11-12 13:34:26Z twisti $
*/
printf("m->maxstack=%i;\n",m->maxstack); fflush(stdout);
bool DEBUGi = false;
-// checked functions and macros: LOADCONST code_get OP1 BUILTIN block_insert bound_check ALIGN
+/* checked functions and macros: LOADCONST code_get OP1 BUILTIN block_insert bound_check ALIGN */
-// replace jcodelength loops with correct number after main for loop in parse()!
+/* replace jcodelength loops with correct number after main for loop in parse()! */
/*-----------------------------------------------------------*/
inline_env->cummaxstack = m->maxstack; /*why has here been 0 ? */
inline_env->cumextablelength = 0;
inline_env->cumlocals = m->maxlocals;
- inline_env->cummethods = 0;//co not global or static-used only here?
+ inline_env->cummethods = 0; /* co not global or static-used only here? */
inline_env->inlining_stack = NULL;
inline_env->inlining_rootinfo = NULL;
}
= inlining_analyse_method(m, 0, 0, 0, 0, inline_env);
if (DEBUGi==true) {print_t_inlining_globals(inline_env);}
/*---------------------*/
- //if (inline_env->cummethods == 0) {
- // inline_env = DNEW(t_inlining_globals);
- // inlining_init0(m,inline_env);
- // return inline_env;
- // }
+/*
+ if (inline_env->cummethods == 0) {
+ inline_env = DNEW(t_inlining_globals);
+ inlining_init0(m,inline_env);
+ return inline_env;
+ }
+*/
if (DEBUGi==true) {
printf("(l,s) (%i,%i) was (%i,%i)\n",
m->maxlocals, inline_env->cumlocals,
bool isnotrootlevel = (level > 0);
bool isnotleaflevel = (level < INLINING_MAXDEPTH);
- // if (level == 0) gp = 0;
+ /* if (level == 0) gp = 0; */
/*
sprintf (logtext, "Performing inlining analysis of: ");
utf_sprint (logtext+strlen(logtext), m->class->name);
dolog (); */
if (isnotrootlevel) {
- newnode->readonly = readonly = DMNEW(bool, m->maxlocals); //FIXME only paramcount entrys necessary
+ newnode->readonly = readonly = DMNEW(bool, m->maxlocals); /* FIXME only paramcount entrys necessary */
for (i = 0; i < m->maxlocals; readonly[i++] = true);
isnotrootlevel = true;
(imi->jcodelength < INLINING_MAXCODESIZE) &&
(imi->jcodelength > 0) &&
(((!inlinevirtuals) || (uniqueVirt)) || (opcode != JAVA_INVOKEVIRTUAL)) &&
- (inlineexceptions || (imi->exceptiontablelength == 0))) { //FIXME: eliminate empty methods?
+ (inlineexceptions || (imi->exceptiontablelength == 0))) { /* FIXME: eliminate empty methods? */
inlining_methodinfo *tmp;
descriptor2types(imi);
Authors: Dieter Thuernbeck
- $Id: inline.h 1456 2004-11-05 14:33:14Z twisti $
+ $Id: inline.h 1494 2004-11-12 13:34:26Z twisti $
*/
typedef struct {
listnode linkage;
- // saved static compiler variables
+ /* saved static compiler variables */
methodinfo *method;
- // restored through method
+ /* restored through method */
- // int jcodelength;
- // u1 *jcode;
- // classinfo *class;
+ /* int jcodelength; */
+ /* u1 *jcode; */
+ /* classinfo *class; */
- // descriptor never used
- // maxstack used outside of main for loop
- // maxlocals never used
+ /* descriptor never used */
+ /* maxstack used outside of main for loop */
+ /* maxlocals never used */
- // exceptiontablelength
- // raw_extable used outside of main for loop
- // mreturntype used outside of main for loop
- // mparamcount used outside of main for loop
- // mparamtypes used outside of main for loop
+ /* exceptiontablelength */
+ /* raw_extable used outside of main for loop */
+ /* mreturntype used outside of main for loop */
+ /* mparamcount used outside of main for loop */
+ /* mparamtypes used outside of main for loop */
- //local variables used in parse()
+ /* local variables used in parse() */
int i; /* temporary for different uses (counters)*/
int p; /* java instruction counter */
} t_inlining_stacknode;
-typedef struct t_inlining_globals { // try in parse.h with struct not include
+typedef struct t_inlining_globals { /* try in parse.h with struct not include */
bool isinlinedmethod;
int cumjcodelength; /* cumulative immediate intruction length */
int cummaxstack;
Changes: Edwin Steiner
- $Id: jit.c 1478 2004-11-11 11:16:30Z twisti $
+ $Id: jit.c 1494 2004-11-12 13:34:26Z twisti $
*/
*******************************************************************************/
-static methodptr jit_compile_intern(methodinfo *m, codegendata *cd,
- registerdata *rd, loopdata *ld,
- t_inlining_globals *id);
+static functionptr jit_compile_intern(methodinfo *m, codegendata *cd,
+ registerdata *rd, loopdata *ld,
+ t_inlining_globals *id);
-methodptr jit_compile(methodinfo *m)
+functionptr jit_compile(methodinfo *m)
{
static bool jitrunning;
- methodptr r;
+ functionptr r;
s4 dumpsize;
codegendata *cd;
registerdata *rd;
if (compileverbose)
log_message_method("No code given for: ", m);
- m->entrypoint = (methodptr) do_nothing_function;
+ /*m->entrypoint = (methodptr) do_nothing_function;*/
+ m->entrypoint = (functionptr) do_nothing_function;
return m->entrypoint; /* return empty method */
}
/* RTA static analysis must be called before inlining */
if (opt_rt)
- RT_jit_parse(m); // will be called just once
- /* return value ignored for now */
+ RT_jit_parse(m); /* will be called just once */
+ /* return value ignored for now */
/* must be called before reg_setup, because it can change maxlocals */
/* init reqd to initialize for parse even in no inlining */
*******************************************************************************/
-static methodptr jit_compile_intern(methodinfo *m, codegendata *cd,
- registerdata *rd, loopdata *ld,
- t_inlining_globals *id)
+static functionptr jit_compile_intern(methodinfo *m, codegendata *cd,
+ registerdata *rd, loopdata *ld,
+ t_inlining_globals *id)
{
/* print log message for compiled method */
show_icmd_method(m, cd, rd);
} else if (showdisassemble) {
- disassemble((void *) (m->mcode + cd->dseglen),
+ disassemble((void *) ((long) m->mcode + cd->dseglen),
m->mcodelength - cd->dseglen);
}
Changes: Christian Thalinger
- $Id: jit.h 1456 2004-11-05 14:33:14Z twisti $
+ $Id: jit.h 1494 2004-11-12 13:34:26Z twisti $
*/
/* function prototypes */
-methodptr jit_compile(methodinfo *m); /* compile a method with jit compiler */
+functionptr jit_compile(methodinfo *m); /* compile a method with jit compiler */
void jit_init(); /* compiler initialisation */
void jit_close(); /* compiler finalisation */
Changes: Carolyn Oates
Edwin Steiner
- $Id: parse.c 1462 2004-11-06 15:08:49Z motse $
+ $Id: parse.c 1494 2004-11-12 13:34:26Z twisti $
*/
bool DEBUG4 = false; /*opcodes*/
/*INLINING*/
-#define debug_writebranch if (DEBUG2==true) printf("op:: %s i: %d label_index[i]: %d label_index=%p\n",opcode_names[opcode], i, label_index[i],label_index);
+#define debug_writebranch if (DEBUG2==true) printf("op:: %s i: %d label_index[i]: %d label_index=0x%x\n",opcode_names[opcode], i, label_index[i], label_index);
#define debug_writebranch1
if (exceptiontablelength == 0)
return extable;
+
-//if (m->exceptiontablelength > 0) {
-// DEBUGMETH(m);
-// printf("m->exceptiontablelength=%i\n",m->exceptiontablelength);
-// panic("exceptiontablelength > 0");
-// }
+ /*if (m->exceptiontablelength > 0) {
+ DEBUGMETH(m);
+ printf("m->exceptiontablelength=%i\n",m->exceptiontablelength);
+ panic("exceptiontablelength > 0");
+ }*/
b_count = *block_count;
/*** 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
+ p = raw_extable[i].endpc; /* see JVM Spec 4.7.3 */
if (p < raw_extable[i].startpc)
panic("Invalid exception handler range");
if (p > m->jcodelength) {
memset(iptr, 0, sizeof(instruction) * (inline_env->cumjcodelength + 5));
/* compute branch targets of exception table */
-//if (m->exceptiontable == NULL) {
-// printf("m->exceptiontable=NULL\n");fflush(stdout);
-// }
-//else {
-// printf("m->exceptiontable != NULL\n");fflush(stdout);
-// }
-//printf("m->exceptiontablelength=%i, inline_env->method->exceptiontablelength=%i,inline_env->cumextablelength=%i\n",
-//m->exceptiontablelength, inline_env->method->exceptiontablelength,inline_env->cumextablelength);
-
-//if (m->exceptiontablelength > 0)
-// m->exceptiontable = DMNEW(exceptiontable, m->exceptiontablelength + 1);
+ /*
+if (m->exceptiontable == NULL) {
+ printf("m->exceptiontable=NULL\n");fflush(stdout);
+ }
+else {
+ printf("m->exceptiontable != NULL\n");fflush(stdout);
+ }
+printf("m->exceptiontablelength=%i, inline_env->method->exceptiontablelength=%i,inline_env->cumextablelength=%i\n",
+m->exceptiontablelength, inline_env->method->exceptiontablelength,inline_env->cumextablelength);
+ */
+ /*
+if (m->exceptiontablelength > 0)
+ m->exceptiontable = DMNEW(exceptiontable, m->exceptiontablelength + 1);
+ */
nextex = fillextable(m,
cd->exceptiontable, m->exceptiontable, m->exceptiontablelength,
bool *readonly = NULL;
int argBlockIdx=0;
- block_insert(gp); //JJJJJJJJJJ
+ block_insert(gp); /* JJJJJJJJJJ */
blockend=false;
instructionstart[gp] = 1;
m->basicblockindex[gp] |= (ipc << 1); /*FIXME: necessary ? */
argBlockIdx--;
OP1(op, firstlocal + argBlockIdx);
- //OP1(op, firstlocal + tmpinlinf->method->paramcount - 1 - i);
- //printf("inline argument load operation for local: %ld\n",firstlocal + tmpinlinf->method->paramcount - 1 - i);
+ /* OP1(op, firstlocal + tmpinlinf->method->paramcount - 1 - i); */
+ /* printf("inline argument load operation for local: %ld\n",firstlocal + tmpinlinf->method->paramcount - 1 - i); */
}
skipBasicBlockChange=1;
if (DEBUG==true) {
printf("Parse p=%i<%i<%i< opcode=<%i> %s\n",
p, gp, inline_env->jcodelength, opcode, opcode_names[opcode]);
}
-
-//printf("basicblockindex[gp=%i]=%i=%p ipc=%i=%p shifted ipc=%i=%p\n",
-//gp,m->basicblockindex[gp],m->basicblockindex[gp],ipc,ipc,(ipc<<1),(ipc<<1));
-//fflush(stdout);
+ /*
+printf("basicblockindex[gp=%i]=%i=%p ipc=%i=%p shifted ipc=%i=%p\n",
+gp,m->basicblockindex[gp],m->basicblockindex[gp],ipc,ipc,(ipc<<1),(ipc<<1));
+fflush(stdout);
+ */
if (!skipBasicBlockChange) {
m->basicblockindex[gp] |= (ipc << 1); /*store intermed cnt*/
} else skipBasicBlockChange=0;
-//printf("basicblockindex[gp=%i]=%i=%p \n",
-//gp,m->basicblockindex[gp],m->basicblockindex[gp]);
-//fflush(stdout);
+ /*
+printf("basicblockindex[gp=%i]=%i=%p \n",
+gp,m->basicblockindex[gp],m->basicblockindex[gp]);
+fflush(stdout);
+ */
if (blockend) {
-//printf("B4 BEND\t"); fflush(stdout);
+ /* printf("B4 BEND\t"); fflush(stdout); */
block_insert(gp); /* start new block */
blockend = false;
/*printf("blockend was set: new blockcount: %ld at:%ld\n",b_count,gp);*/
i = label_index[i];
}
bound_check(i);
-//printf("B6 JSR_W\t"); fflush(stdout);
+ /*printf("B6 JSR_W\t"); fflush(stdout);*/
block_insert(i);
blockend = true;
OP1(opcode, i);
/* break; */
/* } */
if (nextp>inline_env->method->jcodelength-1) {
- //OP1(ICMD_GOTO, inlinfo->stopgp);
- //OP(ICMD_NOP);
- //OP(ICMD_NOP);
- blockend=true;
- break;
- }//JJJJJJJ
+ /* OP1(ICMD_GOTO, inlinfo->stopgp);
+ OP(ICMD_NOP);
+ OP(ICMD_NOP);
+ */
+ blockend=true;
+ break;
+ } /* JJJJJJJ */
blockend = true;
OP1(ICMD_GOTO, inlinfo->stopgp);
break;
tablep++;
nextp += 4;
bound_check(j);
-//printf("B7 LOOKUP1\t"); fflush(stdout);
+/*
+printf("B7 LOOKUP1\t"); fflush(stdout);
+*/
block_insert(j);
/* number of pairs */
tablep++;
nextp += 4;
bound_check(j);
-//printf("B8 LOOKUP2\t"); fflush(stdout);
+/*
+printf("B8 LOOKUP2\t"); fflush(stdout);
+*/
block_insert(j);
}
tablep++;
nextp += 4;
bound_check(j);
-//printf("B9 TABLESWITCH1\t"); fflush(stdout);
+/*
+printf("B9 TABLESWITCH1\t"); fflush(stdout);
+*/
block_insert(j);
/* lower bound */
tablep++;
nextp += 4;
bound_check(j);
-//printf("B10 TABLESWITCH2\t"); fflush(stdout);
+/*
+printf("B10 TABLESWITCH2\t"); fflush(stdout);
+*/
block_insert(j);
/*printf("TABLESWITCH: block_insert(%ld)\n",j);*/
}
if (!mi)
return NULL;
- /*RTAprint*/// if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
+ /*RTAprint*/ /* if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt) */
if (DEBUG4==true)
/*RTAprint*/ {printf(" method name =");
/*RTAprint*/ utf_display(mi->class->name); printf(".");
if (!mi)
return NULL;
- /*RTAprint*/ // if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
+ /*RTAprint*/ /* if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt) */
if (DEBUG4==true)
/*RTAprint*/ {printf(" method name =");
method_display(mi);
/* INLINING */
-// if (inline_env->isinlinedmethod && p == inline_env->method->jcodelength - 1) { /* end of an inlined method */
+ /* if (inline_env->isinlinedmethod && p == inline_env->method->jcodelength - 1) { */ /* end of an inlined method */
if (inline_env->isinlinedmethod && (nextp >= inline_env->method->jcodelength) ) { /* end of an inlined method */
/* printf("setting gp from %d to %d\n",gp, inlinfo->stopgp); */
gp = inlinfo->stopgp;
inlining_restore_compiler_variables();
-//label_index = inlinfo->label_index;
+/*label_index = inlinfo->label_index;*/
if (DEBUG==true) {
printf("AFTER RESTORE : "); fflush(stdout);
DEBUGMETH(inline_env->method);
}
list_remove(inlinfo->inlinedmethods, list_first(inlinfo->inlinedmethods));
- if (inlinfo->inlinedmethods == NULL) { //JJJJ
+ if (inlinfo->inlinedmethods == NULL) { /* JJJJ */
nextgp = -1;
} else {
tmpinlinf = list_first(inlinfo->inlinedmethods);
/* allocate blocks */
for (p = 0; p < inline_env->cumjcodelength; p++) {
-// for (p = 0; p < m->jcodelength; p++) {
+ /* for (p = 0; p < m->jcodelength; p++) { */
if (m->basicblockindex[p] & 1) {
/* check if this block starts at the beginning of an instruction */
if (!instructionstart[p]) {
Authors: Carolyn Oates
- $Id: parseRT.c 1473 2004-11-10 10:33:59Z carolyn $
+ $Id: parseRT.c 1494 2004-11-12 13:34:26Z twisti $
Changes:
opcode put into functions
}
}
/* add method to rta work list if conditions met */
- //if ( (submeth->class->classUsed == USED) ||
+ /* if ( (submeth->class->classUsed == USED) || */
if (class->classUsed == USED) {
submeth->monoPoly = POLY;
addToRtaWorkList(submeth,
true);
if (!fi)
- return 0; // was NULL
+ return 0; /* was NULL */
CLASSNAME(fi->class,"\tPUTSTATIC: ");
if (!fi->class->initialized) {
}
/* see INVOKESTATIC for explanation about */
/* case when Interface is not resolved */
- //descriptor2types(mi); ?? do need paramcnt?
+ /* descriptor2types(mi); ?? do need paramcnt? */
}
break;
classinfo *ci;
ci = class_getconstant(m->class, i, CONSTANT_Class);
m->isleafmethod = false; /* why for new ? */
- // s_count++; look for s_counts for VTA
- //ci->classUsed=USED;
+ /* s_count++; look for s_counts for VTA */
+ /* ci->classUsed=USED; */
/* add marked methods */
CLASSNAME(ci,"NEW : do nothing");
}
/*----- rtMissedIn 0 */
if ( (rtMissedIn = fopen("rtMissedIn0", "r")) == NULL) {
- //if (verbose)
+ /* if (verbose) */
{printf("No rtMissedIn0 file\n");fflush(stdout);}
return rm;
}
strcat(filenameIn, (const char *)mainstring);
printf("filenameIn=%s|\n",filenameIn); fflush(stdout);
if ( (rtMissedIn = fopen(filenameIn, "r")) == NULL) {
- //if (verbose)
+ /* if (verbose) */
{printf("NNo rtMissedIn=%s file\n",filenameIn);fflush(stdout);}
return rm;
}
Authors: Carolyn Oates
- $Id: parseRTstats.c 1469 2004-11-08 21:08:13Z carolyn $
+ $Id: parseRTstats.c 1494 2004-11-12 13:34:26Z twisti $
*/
#include <stdio.h>
}
}
printRTClassHeirarchy(class_java_lang_Object);
- //printRTClassHeirarchy(m->class);
+ /* printRTClassHeirarchy(m->class); */
if (pClassHeirStatsOnly >= 2) {
fflush(stdout);
printf("--- end of RT info ---------------\n");
Authors: Christian Thalinger
- $Id: reg.h 1456 2004-11-05 14:33:14Z twisti $
+ $Id: reg.h 1494 2004-11-12 13:34:26Z twisti $
*/
#include "jit/jit.h"
-typedef struct registerdata registerdata;
+/************************* pseudo variable structure **************************/
+
typedef struct varinfo varinfo;
+
+struct varinfo {
+ int type; /* basic type of variable */
+ int flags; /* flags (SAVED, INMEMORY) */
+ int regoff; /* register number or memory offset */
+};
+
typedef struct varinfo varinfo5[5];
-//struct t_inlining_globals;
+typedef struct registerdata registerdata;
struct registerdata {
varinfo5 *locals;
};
-/************************* pseudo variable structure **************************/
-
-struct varinfo {
- int type; /* basic type of variable */
- int flags; /* flags (SAVED, INMEMORY) */
- int regoff; /* register number or memory offset */
-};
-
-
/* function prototypes */
void reg_init();
Authors: Andreas Krall
Christian Thalinger
- $Id: codegen.c 1466 2004-11-08 11:24:50Z twisti $
+ $Id: codegen.c 1494 2004-11-12 13:34:26Z twisti $
*/
/* faultaddr = sigctx->sc_regs[(instr >> 16) & 0x1f]; */
/* if (faultaddr == 0) { */
- act.sa_sigaction = (void *) catch_NullPointerException; /* reinstall handler */
+ act.sa_sigaction = (functionptr) catch_NullPointerException; /* reinstall handler */
act.sa_flags = SA_SIGINFO;
sigaction(sig, &act, NULL);
/* Reset signal handler - necessary for SysV, does no harm for BSD */
- act.sa_sigaction = (void *) catch_ArithmeticException; /* reinstall handler */
+ act.sa_sigaction = (functionptr) catch_ArithmeticException; /* reinstall handler */
act.sa_flags = SA_SIGINFO;
sigaction(sig, &act, NULL);
if (!checknull) {
#if defined(SIGSEGV)
- act.sa_sigaction = (void *) catch_NullPointerException;
+ act.sa_sigaction = (functionptr) catch_NullPointerException;
act.sa_flags = SA_SIGINFO;
sigaction(SIGSEGV, &act, NULL);
#endif
#if defined(SIGBUS)
- act.sa_sigaction = (void *) catch_NullPointerException;
+ act.sa_sigaction = (functionptr) catch_NullPointerException;
act.sa_flags = SA_SIGINFO;
sigaction(SIGBUS, &act, NULL);
#endif
}
- act.sa_sigaction = (void *) catch_ArithmeticException;
+ act.sa_sigaction = (functionptr) catch_ArithmeticException;
act.sa_flags = SA_SIGINFO;
sigaction(SIGFPE, &act, NULL);
}
Changes: Joseph Wenninger, Martin Platter
- $Id: jni.c 1471 2004-11-09 11:54:53Z motse $
+ $Id: jni.c 1494 2004-11-12 13:34:26Z twisti $
*/
initrunning = true;
log_text("JNI-Init: initialize global_ref_table");
- // initalize global reference table
+ /* initalize global reference table */
ihmclass = FindClass(NULL, "java/util/IdentityHashMap");
if (ihmclass == NULL) {
if (!(methodID->flags & ACC_STATIC) && (!obj)) {
- *exceptionptr = new_exception_message(string_java_lang_NullPointerException,
- "Static mismatch in Java_java_lang_reflect_Method_invokeNative");
+ *exceptionptr =
+ new_exception_message(string_java_lang_NullPointerException,
+ "Static mismatch in Java_java_lang_reflect_Method_invokeNative");
return 0;
}
Edwin Steiner
Christian Thalinger
- $Id: loader.c 1443 2004-11-05 13:53:13Z twisti $
+ $Id: loader.c 1494 2004-11-12 13:34:26Z twisti $
*/
return false;
if (opt_verify &&
- !is_valid_utf(cb->pos + 1, cb->pos + 1 + length)) {
+ !is_valid_utf((char *) (cb->pos + 1),
+ (char *) (cb->pos + 1 + length))) {
dolog("Invalid UTF-8 string (constant pool index %d)",idx);
panic("Invalid UTF-8 string");
}
/* insert utf-string into the utf-symboltable */
- cpinfos[idx] = utf_new_intern(cb->pos + 1, length);
+ cpinfos[idx] = utf_new_intern((char *) (cb->pos + 1), length);
/* skip bytes of the string (buffer size check above) */
skip_nbytes(cb, length);
return NULL;
if (super->flags & ACC_INTERFACE) {
- // java.lang.IncompatibleClassChangeError: class a has interface java.lang.Cloneable as super class
+ /* java.lang.IncompatibleClassChangeError: class a has interface java.lang.Cloneable as super class */
panic("Interface specified as super class");
}
goto notfoundvftblindex;
if (tc->methods[j].flags & ACC_FINAL) {
- // class a overrides final method .
+ /* class a overrides final method . */
*exceptionptr =
new_exception(string_java_lang_VerifyError);
return NULL;
# ifndef __INTEL_COMPILER
__asm__ __volatile__("st4.rel %0=r0" : "=m" (*addr) : : "memory");
# else
- // there is no st4 but I can use xchg I hope
+ /* there is no st4 but I can use xchg I hope */
_InterlockedExchange(addr, 0);
# endif
}
__lfetch(__lfhint_nta, (x))
# define CLEAR_DOUBLE(x) \
__stf_spill((void *)(x), 0)
-# endif // __INTEL_COMPILER
+# endif /* __INTEL_COMPILER */
# endif
# endif
# ifdef MSWIN32
jmethodID mid;
printf("JOWENNTest1_nat_f6:%d\n",par1);
-// class_showmethods(this->header.vftbl->class);
+ /*class_showmethods(this->header.vftbl->class);*/
mid = (*env)->GetMethodID(env, this->header.vftbl->class, "f6a", "(I)V");
(*env)->CallVoidMethod(env, this, mid,par1);
jmethodID mid;
printf("JOWENNTest1_nat_f7\n");
-// class_showmethods(this->header.vftbl->class);
+ /*class_showmethods(this->header.vftbl->class);*/
mid = (*env)->GetMethodID(env, this->header.vftbl->class, "f7a", "(III)V");
(*env)->CallVoidMethod(env, this, mid,1,2,3);
jmethodID mid;
printf("JOWENNTest1_nat_f8\n");
-// class_showmethods(this->header.vftbl->class);
+ /*class_showmethods(this->header.vftbl->class);*/
mid = (*env)->GetStaticMethodID(env, this->header.vftbl->class, "f7a", "(III)V");
(*env)->CallStaticVoidMethod(env, this, mid,1,2,3);
jmethodID mid;
printf("JOWENNTest1_nat_f9\n");
-// class_showmethods(this->header.vftbl->class);
+ /*class_showmethods(this->header.vftbl->class);*/
mid = (*env)->GetStaticMethodID(env, this->header.vftbl->class, "f7b", "(III)V");
(*env)->CallVoidMethod(env, this, mid,1,2,3);
Changes: Joseph Wenninger
Christian Thalinger
- $Id: Runtime.c 1487 2004-11-12 11:25:19Z twisti $
+ $Id: Runtime.c 1494 2004-11-12 13:34:26Z twisti $
*/
{
/* if (finalizeOnExit) { */
/* gc_call(); */
- // gc_finalize_all();
+ /* gc_finalize_all(); */
/* } */
/* log_text("Java_java_lang_VMRuntime_runFinalizationForExit called"); */
- //gc_finalize_all();
- //gc_invoke_finalizers();
- //gc_call();
+ /*gc_finalize_all();*/
+ /*gc_invoke_finalizers();*/
+ /*gc_call();*/
}
# ifndef __INTEL_COMPILER
__asm__ __volatile__("st4.rel %0=r0" : "=m" (*addr) : : "memory");
# else
- // there is no st4 but I can use xchg I hope
+ /* there is no st4 but I can use xchg I hope */
_InterlockedExchange(addr, 0);
# endif
}
__lfetch(__lfhint_nta, (x))
# define CLEAR_DOUBLE(x) \
__stf_spill((void *)(x), 0)
-# endif // __INTEL_COMPILER
+# endif /* __INTEL_COMPILER */
# endif
# endif
# ifdef MSWIN32
Authors: Reinhard Grafl
- $Id: memory.c 1489 2004-11-12 11:31:47Z twisti $
+ $Id: memory.c 1494 2004-11-12 13:34:26Z twisti $
*/
}
/* allocate dumpblock memory */
- //printf("new dumpblock: %d\n", newdumpblocksize);
+ /*printf("new dumpblock: %d\n", newdumpblocksize);*/
newdumpblock->dumpmem = checked_alloc(newdumpblocksize);
newdumpblock->prev = di->currentdumpblock;
/* Used dump size is previously allocated dump size, because the */
/* remaining free memory of the previous dump block cannot be used. */
- //printf("unused memory: %d\n", allocateddumpsize - useddumpsize);
+ /*printf("unused memory: %d\n", allocateddumpsize - useddumpsize);*/
di->useddumpsize = di->allocateddumpsize;
/* increase the allocated dump size by the size of the new dump block */
Authors: Reinhard Grafl
- $Id: memory.h 1437 2004-11-05 09:51:07Z twisti $
+ $Id: memory.h 1494 2004-11-12 13:34:26Z twisti $
*/
struct dumpblock {
dumpblock *prev;
- void *dumpmem;
+ u1 *dumpmem;
s4 size;
};
Changes: Joseph Wenninger, Martin Platter
- $Id: jni.c 1471 2004-11-09 11:54:53Z motse $
+ $Id: jni.c 1494 2004-11-12 13:34:26Z twisti $
*/
initrunning = true;
log_text("JNI-Init: initialize global_ref_table");
- // initalize global reference table
+ /* initalize global reference table */
ihmclass = FindClass(NULL, "java/util/IdentityHashMap");
if (ihmclass == NULL) {
if (!(methodID->flags & ACC_STATIC) && (!obj)) {
- *exceptionptr = new_exception_message(string_java_lang_NullPointerException,
- "Static mismatch in Java_java_lang_reflect_Method_invokeNative");
+ *exceptionptr =
+ new_exception_message(string_java_lang_NullPointerException,
+ "Static mismatch in Java_java_lang_reflect_Method_invokeNative");
return 0;
}
Changes: Joseph Wenninger
Christian Thalinger
- $Id: VMRuntime.c 1487 2004-11-12 11:25:19Z twisti $
+ $Id: VMRuntime.c 1494 2004-11-12 13:34:26Z twisti $
*/
{
/* if (finalizeOnExit) { */
/* gc_call(); */
- // gc_finalize_all();
+ /* gc_finalize_all(); */
/* } */
/* log_text("Java_java_lang_VMRuntime_runFinalizationForExit called"); */
- //gc_finalize_all();
- //gc_invoke_finalizers();
- //gc_call();
+ /*gc_finalize_all();*/
+ /*gc_invoke_finalizers();*/
+ /*gc_call();*/
}
#include <errno.h>
#include "config.h"
+#include "exceptions.h"
#include "thread.h"
#include "locks.h"
#include "tables.h"
void asm_perform_threadswitch(u1 **from, u1 **to, u1 **stackTop);
u1* asm_initialize_thread_stack(void *func, u1 *stack);
-#else // defined(NATIVE_THREADS)
+#else /* NATIVE_THREADS */
#include "nativethread.h"
#endif
memory. All functions writing values into the data area return the offset
relative the begin of the code area (start of procedure).
- $Id: codegen.inc 1475 2004-11-11 10:27:49Z twisti $
+ $Id: codegen.inc 1494 2004-11-12 13:34:26Z twisti $
*/
mte = NEW(methodtree_element);
- mte->startpc = asm_calljavafunction;
- mte->endpc = asm_calljavafunction2 - 1;
+ mte->startpc = (functionptr) asm_calljavafunction;
+ mte->endpc = (functionptr) ((long) asm_calljavafunction2 - 1);
avl_insert(methodtree, mte);
mte = NEW(methodtree_element);
- mte->startpc = asm_calljavafunction2;
- mte->endpc = asm_call_jit_compiler - 1;
+ mte->startpc = (functionptr) asm_calljavafunction2;
+ mte->endpc = (functionptr) ((long) asm_call_jit_compiler - 1);
avl_insert(methodtree, mte);
}
/* compare both startpc and endpc of pc, even if they have the same value,
otherwise the avl_probe sometimes thinks the element is already in the
tree */
- if (mte->startpc <= mtepc->startpc && mtepc->startpc <= mte->endpc &&
- mte->startpc <= mtepc->endpc && mtepc->endpc <= mte->endpc) {
+ if ((long) mte->startpc <= (long) mtepc->startpc &&
+ (long) mtepc->startpc <= (long) mte->endpc &&
+ (long) mte->startpc <= (long) mtepc->endpc &&
+ (long) mtepc->endpc <= (long) mte->endpc) {
return 0;
- } else if (mtepc->startpc < mte->startpc) {
+ } else if ((long) mtepc->startpc < (long) mte->startpc) {
return -1;
} else {
#endif
-void codegen_insertmethod(void *startpc, void *endpc)
+void codegen_insertmethod(functionptr startpc, functionptr endpc)
{
methodtree_element *mte;
}
-void *codegen_findmethod(void *pc)
+functionptr codegen_findmethod(functionptr pc)
{
methodtree_element *mtepc;
methodtree_element *mte;
static void codegen_finish(methodinfo *m, codegendata *cd, s4 mcodelen)
{
jumpref *jr;
- u1 *epoint;
+ functionptr epoint;
s4 extralen;
s4 alignedlen;
alignedlen = ALIGN(mcodelen, MAX_ALIGN) + cd->dseglen;
m->mcodelength = mcodelen + cd->dseglen;
- m->mcode = CNEW(u1, alignedlen + extralen);
+ m->mcode = (functionptr) (long) CNEW(u1, alignedlen + extralen);
- memcpy(m->mcode, cd->dsegtop - cd->dseglen, cd->dseglen);
- memcpy(m->mcode + cd->dseglen, cd->mcodebase, mcodelen);
+ memcpy((void *) (long) m->mcode, cd->dsegtop - cd->dseglen, cd->dseglen);
+ memcpy((void *) ((long) m->mcode + cd->dseglen), cd->mcodebase, mcodelen);
- m->entrypoint = epoint = (u1 *) (m->mcode + cd->dseglen);
+ m->entrypoint = epoint = (functionptr) ((long) m->mcode + cd->dseglen);
/* jump table resolving */
jr = cd->jumpreferences;
while (jr != NULL) {
- *((void**) (epoint + jr->tablepos)) = epoint + jr->target->mpc;
+ *((functionptr *) ((long) epoint + jr->tablepos)) =
+ (functionptr) ((long) epoint + (long) jr->target->mpc);
jr = jr->next;
}
dataref *dr;
/* add method into methodtree to find the entrypoint */
- codegen_insertmethod(m->entrypoint, m->entrypoint + mcodelen);
+ codegen_insertmethod(m->entrypoint,
+ (functionptr) ((long) m->entrypoint + mcodelen));
/* data segment references resolving */
dr = cd->datareferences;
while (dr != NULL) {
- *((void**) ((long) epoint + (long) dr->pos - POINTERSIZE)) = epoint;
+ *((functionptr *) ((long) epoint + (long) dr->pos - POINTERSIZE)) =
+ epoint;
dr = dr->next;
}
}
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
{
- threadcritnode *n = (threadcritnode *) (m->mcode + alignedlen);
+ threadcritnode *n = (threadcritnode *) ((long) m->mcode + alignedlen);
s4 i;
threadcritnodetemp *nt = cd->threadcrit;
for (i = 0; i < cd->threadcritcount; i++) {
- n->mcodebegin = m->mcode + nt->mcodebegin;
- n->mcodeend = m->mcode + nt->mcodeend;
- n->mcoderestart = m->mcode + nt->mcoderestart;
+ n->mcodebegin = (u1 *) (long) m->mcode + nt->mcodebegin;
+ n->mcodeend = (u1 *) (long) m->mcode + nt->mcodeend;
+ n->mcoderestart = (u1 *) (long) m->mcode + nt->mcoderestart;
thread_registercritical(n);
n++;
nt = nt->next;
s4 *s4ptr;
s4 i;
- s4ptr = (s4 *) m->mcode;
+ s4ptr = (s4 *) (long) m->mcode;
printf(" --- dump of datasegment\n");
for (i = cd->dseglen; i > 0 ; i -= 4) {
printf("-%6x: %8x\n", i, (s4) (*s4ptr++));
}
- printf(" --- begin of data segment: %p\n", s4ptr);
+ printf(" --- begin of data segment: %p\n", (void *) s4ptr);
}
Authors: Christian Thalinger
- $Id: codegen.inc.h 1458 2004-11-05 15:33:49Z twisti $
+ $Id: codegen.inc.h 1494 2004-11-12 13:34:26Z twisti $
*/
typedef struct _methodtree_element methodtree_element;
struct _methodtree_element {
- void *startpc;
- void *endpc;
+ functionptr startpc;
+ functionptr endpc;
};
#endif
void codegen(methodinfo *m, codegendata *cd, registerdata *rd);
void codegen_free(methodinfo *m, codegendata *cd);
void codegen_close();
-void codegen_insertmethod(void *startpc, void *endpc);
+void codegen_insertmethod(functionptr startpc, functionptr endpc);
#if defined(__I386__) || defined(__X86_64__)
void codegen_addreference(codegendata *cd, struct basicblock *target, void *branchptr);
Authors: Dieter Thuernbeck
- $Id: inline.c 1474 2004-11-11 10:09:10Z carolyn $
+ $Id: inline.c 1494 2004-11-12 13:34:26Z twisti $
*/
printf("m->maxstack=%i;\n",m->maxstack); fflush(stdout);
bool DEBUGi = false;
-// checked functions and macros: LOADCONST code_get OP1 BUILTIN block_insert bound_check ALIGN
+/* checked functions and macros: LOADCONST code_get OP1 BUILTIN block_insert bound_check ALIGN */
-// replace jcodelength loops with correct number after main for loop in parse()!
+/* replace jcodelength loops with correct number after main for loop in parse()! */
/*-----------------------------------------------------------*/
inline_env->cummaxstack = m->maxstack; /*why has here been 0 ? */
inline_env->cumextablelength = 0;
inline_env->cumlocals = m->maxlocals;
- inline_env->cummethods = 0;//co not global or static-used only here?
+ inline_env->cummethods = 0; /* co not global or static-used only here? */
inline_env->inlining_stack = NULL;
inline_env->inlining_rootinfo = NULL;
}
= inlining_analyse_method(m, 0, 0, 0, 0, inline_env);
if (DEBUGi==true) {print_t_inlining_globals(inline_env);}
/*---------------------*/
- //if (inline_env->cummethods == 0) {
- // inline_env = DNEW(t_inlining_globals);
- // inlining_init0(m,inline_env);
- // return inline_env;
- // }
+/*
+ if (inline_env->cummethods == 0) {
+ inline_env = DNEW(t_inlining_globals);
+ inlining_init0(m,inline_env);
+ return inline_env;
+ }
+*/
if (DEBUGi==true) {
printf("(l,s) (%i,%i) was (%i,%i)\n",
m->maxlocals, inline_env->cumlocals,
bool isnotrootlevel = (level > 0);
bool isnotleaflevel = (level < INLINING_MAXDEPTH);
- // if (level == 0) gp = 0;
+ /* if (level == 0) gp = 0; */
/*
sprintf (logtext, "Performing inlining analysis of: ");
utf_sprint (logtext+strlen(logtext), m->class->name);
dolog (); */
if (isnotrootlevel) {
- newnode->readonly = readonly = DMNEW(bool, m->maxlocals); //FIXME only paramcount entrys necessary
+ newnode->readonly = readonly = DMNEW(bool, m->maxlocals); /* FIXME only paramcount entrys necessary */
for (i = 0; i < m->maxlocals; readonly[i++] = true);
isnotrootlevel = true;
(imi->jcodelength < INLINING_MAXCODESIZE) &&
(imi->jcodelength > 0) &&
(((!inlinevirtuals) || (uniqueVirt)) || (opcode != JAVA_INVOKEVIRTUAL)) &&
- (inlineexceptions || (imi->exceptiontablelength == 0))) { //FIXME: eliminate empty methods?
+ (inlineexceptions || (imi->exceptiontablelength == 0))) { /* FIXME: eliminate empty methods? */
inlining_methodinfo *tmp;
descriptor2types(imi);
Authors: Dieter Thuernbeck
- $Id: inline.h 1456 2004-11-05 14:33:14Z twisti $
+ $Id: inline.h 1494 2004-11-12 13:34:26Z twisti $
*/
typedef struct {
listnode linkage;
- // saved static compiler variables
+ /* saved static compiler variables */
methodinfo *method;
- // restored through method
+ /* restored through method */
- // int jcodelength;
- // u1 *jcode;
- // classinfo *class;
+ /* int jcodelength; */
+ /* u1 *jcode; */
+ /* classinfo *class; */
- // descriptor never used
- // maxstack used outside of main for loop
- // maxlocals never used
+ /* descriptor never used */
+ /* maxstack used outside of main for loop */
+ /* maxlocals never used */
- // exceptiontablelength
- // raw_extable used outside of main for loop
- // mreturntype used outside of main for loop
- // mparamcount used outside of main for loop
- // mparamtypes used outside of main for loop
+ /* exceptiontablelength */
+ /* raw_extable used outside of main for loop */
+ /* mreturntype used outside of main for loop */
+ /* mparamcount used outside of main for loop */
+ /* mparamtypes used outside of main for loop */
- //local variables used in parse()
+ /* local variables used in parse() */
int i; /* temporary for different uses (counters)*/
int p; /* java instruction counter */
} t_inlining_stacknode;
-typedef struct t_inlining_globals { // try in parse.h with struct not include
+typedef struct t_inlining_globals { /* try in parse.h with struct not include */
bool isinlinedmethod;
int cumjcodelength; /* cumulative immediate intruction length */
int cummaxstack;
Authors: Carolyn Oates
- $Id: parseRT.c 1473 2004-11-10 10:33:59Z carolyn $
+ $Id: parseRT.c 1494 2004-11-12 13:34:26Z twisti $
Changes:
opcode put into functions
}
}
/* add method to rta work list if conditions met */
- //if ( (submeth->class->classUsed == USED) ||
+ /* if ( (submeth->class->classUsed == USED) || */
if (class->classUsed == USED) {
submeth->monoPoly = POLY;
addToRtaWorkList(submeth,
true);
if (!fi)
- return 0; // was NULL
+ return 0; /* was NULL */
CLASSNAME(fi->class,"\tPUTSTATIC: ");
if (!fi->class->initialized) {
}
/* see INVOKESTATIC for explanation about */
/* case when Interface is not resolved */
- //descriptor2types(mi); ?? do need paramcnt?
+ /* descriptor2types(mi); ?? do need paramcnt? */
}
break;
classinfo *ci;
ci = class_getconstant(m->class, i, CONSTANT_Class);
m->isleafmethod = false; /* why for new ? */
- // s_count++; look for s_counts for VTA
- //ci->classUsed=USED;
+ /* s_count++; look for s_counts for VTA */
+ /* ci->classUsed=USED; */
/* add marked methods */
CLASSNAME(ci,"NEW : do nothing");
}
/*----- rtMissedIn 0 */
if ( (rtMissedIn = fopen("rtMissedIn0", "r")) == NULL) {
- //if (verbose)
+ /* if (verbose) */
{printf("No rtMissedIn0 file\n");fflush(stdout);}
return rm;
}
strcat(filenameIn, (const char *)mainstring);
printf("filenameIn=%s|\n",filenameIn); fflush(stdout);
if ( (rtMissedIn = fopen(filenameIn, "r")) == NULL) {
- //if (verbose)
+ /* if (verbose) */
{printf("NNo rtMissedIn=%s file\n",filenameIn);fflush(stdout);}
return rm;
}
Authors: Carolyn Oates
- $Id: parseRTstats.c 1469 2004-11-08 21:08:13Z carolyn $
+ $Id: parseRTstats.c 1494 2004-11-12 13:34:26Z twisti $
*/
#include <stdio.h>
}
}
printRTClassHeirarchy(class_java_lang_Object);
- //printRTClassHeirarchy(m->class);
+ /* printRTClassHeirarchy(m->class); */
if (pClassHeirStatsOnly >= 2) {
fflush(stdout);
printf("--- end of RT info ---------------\n");
Changes: Edwin Steiner
- $Id: jit.c 1478 2004-11-11 11:16:30Z twisti $
+ $Id: jit.c 1494 2004-11-12 13:34:26Z twisti $
*/
*******************************************************************************/
-static methodptr jit_compile_intern(methodinfo *m, codegendata *cd,
- registerdata *rd, loopdata *ld,
- t_inlining_globals *id);
+static functionptr jit_compile_intern(methodinfo *m, codegendata *cd,
+ registerdata *rd, loopdata *ld,
+ t_inlining_globals *id);
-methodptr jit_compile(methodinfo *m)
+functionptr jit_compile(methodinfo *m)
{
static bool jitrunning;
- methodptr r;
+ functionptr r;
s4 dumpsize;
codegendata *cd;
registerdata *rd;
if (compileverbose)
log_message_method("No code given for: ", m);
- m->entrypoint = (methodptr) do_nothing_function;
+ /*m->entrypoint = (methodptr) do_nothing_function;*/
+ m->entrypoint = (functionptr) do_nothing_function;
return m->entrypoint; /* return empty method */
}
/* RTA static analysis must be called before inlining */
if (opt_rt)
- RT_jit_parse(m); // will be called just once
- /* return value ignored for now */
+ RT_jit_parse(m); /* will be called just once */
+ /* return value ignored for now */
/* must be called before reg_setup, because it can change maxlocals */
/* init reqd to initialize for parse even in no inlining */
*******************************************************************************/
-static methodptr jit_compile_intern(methodinfo *m, codegendata *cd,
- registerdata *rd, loopdata *ld,
- t_inlining_globals *id)
+static functionptr jit_compile_intern(methodinfo *m, codegendata *cd,
+ registerdata *rd, loopdata *ld,
+ t_inlining_globals *id)
{
/* print log message for compiled method */
show_icmd_method(m, cd, rd);
} else if (showdisassemble) {
- disassemble((void *) (m->mcode + cd->dseglen),
+ disassemble((void *) ((long) m->mcode + cd->dseglen),
m->mcodelength - cd->dseglen);
}
Changes: Christian Thalinger
- $Id: jit.h 1456 2004-11-05 14:33:14Z twisti $
+ $Id: jit.h 1494 2004-11-12 13:34:26Z twisti $
*/
/* function prototypes */
-methodptr jit_compile(methodinfo *m); /* compile a method with jit compiler */
+functionptr jit_compile(methodinfo *m); /* compile a method with jit compiler */
void jit_init(); /* compiler initialisation */
void jit_close(); /* compiler finalisation */
Changes: Carolyn Oates
Edwin Steiner
- $Id: parse.c 1462 2004-11-06 15:08:49Z motse $
+ $Id: parse.c 1494 2004-11-12 13:34:26Z twisti $
*/
bool DEBUG4 = false; /*opcodes*/
/*INLINING*/
-#define debug_writebranch if (DEBUG2==true) printf("op:: %s i: %d label_index[i]: %d label_index=%p\n",opcode_names[opcode], i, label_index[i],label_index);
+#define debug_writebranch if (DEBUG2==true) printf("op:: %s i: %d label_index[i]: %d label_index=0x%x\n",opcode_names[opcode], i, label_index[i], label_index);
#define debug_writebranch1
if (exceptiontablelength == 0)
return extable;
+
-//if (m->exceptiontablelength > 0) {
-// DEBUGMETH(m);
-// printf("m->exceptiontablelength=%i\n",m->exceptiontablelength);
-// panic("exceptiontablelength > 0");
-// }
+ /*if (m->exceptiontablelength > 0) {
+ DEBUGMETH(m);
+ printf("m->exceptiontablelength=%i\n",m->exceptiontablelength);
+ panic("exceptiontablelength > 0");
+ }*/
b_count = *block_count;
/*** 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
+ p = raw_extable[i].endpc; /* see JVM Spec 4.7.3 */
if (p < raw_extable[i].startpc)
panic("Invalid exception handler range");
if (p > m->jcodelength) {
memset(iptr, 0, sizeof(instruction) * (inline_env->cumjcodelength + 5));
/* compute branch targets of exception table */
-//if (m->exceptiontable == NULL) {
-// printf("m->exceptiontable=NULL\n");fflush(stdout);
-// }
-//else {
-// printf("m->exceptiontable != NULL\n");fflush(stdout);
-// }
-//printf("m->exceptiontablelength=%i, inline_env->method->exceptiontablelength=%i,inline_env->cumextablelength=%i\n",
-//m->exceptiontablelength, inline_env->method->exceptiontablelength,inline_env->cumextablelength);
-
-//if (m->exceptiontablelength > 0)
-// m->exceptiontable = DMNEW(exceptiontable, m->exceptiontablelength + 1);
+ /*
+if (m->exceptiontable == NULL) {
+ printf("m->exceptiontable=NULL\n");fflush(stdout);
+ }
+else {
+ printf("m->exceptiontable != NULL\n");fflush(stdout);
+ }
+printf("m->exceptiontablelength=%i, inline_env->method->exceptiontablelength=%i,inline_env->cumextablelength=%i\n",
+m->exceptiontablelength, inline_env->method->exceptiontablelength,inline_env->cumextablelength);
+ */
+ /*
+if (m->exceptiontablelength > 0)
+ m->exceptiontable = DMNEW(exceptiontable, m->exceptiontablelength + 1);
+ */
nextex = fillextable(m,
cd->exceptiontable, m->exceptiontable, m->exceptiontablelength,
bool *readonly = NULL;
int argBlockIdx=0;
- block_insert(gp); //JJJJJJJJJJ
+ block_insert(gp); /* JJJJJJJJJJ */
blockend=false;
instructionstart[gp] = 1;
m->basicblockindex[gp] |= (ipc << 1); /*FIXME: necessary ? */
argBlockIdx--;
OP1(op, firstlocal + argBlockIdx);
- //OP1(op, firstlocal + tmpinlinf->method->paramcount - 1 - i);
- //printf("inline argument load operation for local: %ld\n",firstlocal + tmpinlinf->method->paramcount - 1 - i);
+ /* OP1(op, firstlocal + tmpinlinf->method->paramcount - 1 - i); */
+ /* printf("inline argument load operation for local: %ld\n",firstlocal + tmpinlinf->method->paramcount - 1 - i); */
}
skipBasicBlockChange=1;
if (DEBUG==true) {
printf("Parse p=%i<%i<%i< opcode=<%i> %s\n",
p, gp, inline_env->jcodelength, opcode, opcode_names[opcode]);
}
-
-//printf("basicblockindex[gp=%i]=%i=%p ipc=%i=%p shifted ipc=%i=%p\n",
-//gp,m->basicblockindex[gp],m->basicblockindex[gp],ipc,ipc,(ipc<<1),(ipc<<1));
-//fflush(stdout);
+ /*
+printf("basicblockindex[gp=%i]=%i=%p ipc=%i=%p shifted ipc=%i=%p\n",
+gp,m->basicblockindex[gp],m->basicblockindex[gp],ipc,ipc,(ipc<<1),(ipc<<1));
+fflush(stdout);
+ */
if (!skipBasicBlockChange) {
m->basicblockindex[gp] |= (ipc << 1); /*store intermed cnt*/
} else skipBasicBlockChange=0;
-//printf("basicblockindex[gp=%i]=%i=%p \n",
-//gp,m->basicblockindex[gp],m->basicblockindex[gp]);
-//fflush(stdout);
+ /*
+printf("basicblockindex[gp=%i]=%i=%p \n",
+gp,m->basicblockindex[gp],m->basicblockindex[gp]);
+fflush(stdout);
+ */
if (blockend) {
-//printf("B4 BEND\t"); fflush(stdout);
+ /* printf("B4 BEND\t"); fflush(stdout); */
block_insert(gp); /* start new block */
blockend = false;
/*printf("blockend was set: new blockcount: %ld at:%ld\n",b_count,gp);*/
i = label_index[i];
}
bound_check(i);
-//printf("B6 JSR_W\t"); fflush(stdout);
+ /*printf("B6 JSR_W\t"); fflush(stdout);*/
block_insert(i);
blockend = true;
OP1(opcode, i);
/* break; */
/* } */
if (nextp>inline_env->method->jcodelength-1) {
- //OP1(ICMD_GOTO, inlinfo->stopgp);
- //OP(ICMD_NOP);
- //OP(ICMD_NOP);
- blockend=true;
- break;
- }//JJJJJJJ
+ /* OP1(ICMD_GOTO, inlinfo->stopgp);
+ OP(ICMD_NOP);
+ OP(ICMD_NOP);
+ */
+ blockend=true;
+ break;
+ } /* JJJJJJJ */
blockend = true;
OP1(ICMD_GOTO, inlinfo->stopgp);
break;
tablep++;
nextp += 4;
bound_check(j);
-//printf("B7 LOOKUP1\t"); fflush(stdout);
+/*
+printf("B7 LOOKUP1\t"); fflush(stdout);
+*/
block_insert(j);
/* number of pairs */
tablep++;
nextp += 4;
bound_check(j);
-//printf("B8 LOOKUP2\t"); fflush(stdout);
+/*
+printf("B8 LOOKUP2\t"); fflush(stdout);
+*/
block_insert(j);
}
tablep++;
nextp += 4;
bound_check(j);
-//printf("B9 TABLESWITCH1\t"); fflush(stdout);
+/*
+printf("B9 TABLESWITCH1\t"); fflush(stdout);
+*/
block_insert(j);
/* lower bound */
tablep++;
nextp += 4;
bound_check(j);
-//printf("B10 TABLESWITCH2\t"); fflush(stdout);
+/*
+printf("B10 TABLESWITCH2\t"); fflush(stdout);
+*/
block_insert(j);
/*printf("TABLESWITCH: block_insert(%ld)\n",j);*/
}
if (!mi)
return NULL;
- /*RTAprint*/// if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
+ /*RTAprint*/ /* if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt) */
if (DEBUG4==true)
/*RTAprint*/ {printf(" method name =");
/*RTAprint*/ utf_display(mi->class->name); printf(".");
if (!mi)
return NULL;
- /*RTAprint*/ // if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt)
+ /*RTAprint*/ /* if (((pOpcodes == 2) || (pOpcodes == 3)) && opt_rt) */
if (DEBUG4==true)
/*RTAprint*/ {printf(" method name =");
method_display(mi);
/* INLINING */
-// if (inline_env->isinlinedmethod && p == inline_env->method->jcodelength - 1) { /* end of an inlined method */
+ /* if (inline_env->isinlinedmethod && p == inline_env->method->jcodelength - 1) { */ /* end of an inlined method */
if (inline_env->isinlinedmethod && (nextp >= inline_env->method->jcodelength) ) { /* end of an inlined method */
/* printf("setting gp from %d to %d\n",gp, inlinfo->stopgp); */
gp = inlinfo->stopgp;
inlining_restore_compiler_variables();
-//label_index = inlinfo->label_index;
+/*label_index = inlinfo->label_index;*/
if (DEBUG==true) {
printf("AFTER RESTORE : "); fflush(stdout);
DEBUGMETH(inline_env->method);
}
list_remove(inlinfo->inlinedmethods, list_first(inlinfo->inlinedmethods));
- if (inlinfo->inlinedmethods == NULL) { //JJJJ
+ if (inlinfo->inlinedmethods == NULL) { /* JJJJ */
nextgp = -1;
} else {
tmpinlinf = list_first(inlinfo->inlinedmethods);
/* allocate blocks */
for (p = 0; p < inline_env->cumjcodelength; p++) {
-// for (p = 0; p < m->jcodelength; p++) {
+ /* for (p = 0; p < m->jcodelength; p++) { */
if (m->basicblockindex[p] & 1) {
/* check if this block starts at the beginning of an instruction */
if (!instructionstart[p]) {
Authors: Christian Thalinger
- $Id: reg.h 1456 2004-11-05 14:33:14Z twisti $
+ $Id: reg.h 1494 2004-11-12 13:34:26Z twisti $
*/
#include "jit/jit.h"
-typedef struct registerdata registerdata;
+/************************* pseudo variable structure **************************/
+
typedef struct varinfo varinfo;
+
+struct varinfo {
+ int type; /* basic type of variable */
+ int flags; /* flags (SAVED, INMEMORY) */
+ int regoff; /* register number or memory offset */
+};
+
typedef struct varinfo varinfo5[5];
-//struct t_inlining_globals;
+typedef struct registerdata registerdata;
struct registerdata {
varinfo5 *locals;
};
-/************************* pseudo variable structure **************************/
-
-struct varinfo {
- int type; /* basic type of variable */
- int flags; /* flags (SAVED, INMEMORY) */
- int regoff; /* register number or memory offset */
-};
-
-
/* function prototypes */
void reg_init();
Authors: Andreas Krall
Christian Thalinger
- $Id: codegen.c 1466 2004-11-08 11:24:50Z twisti $
+ $Id: codegen.c 1494 2004-11-12 13:34:26Z twisti $
*/
/* faultaddr = sigctx->sc_regs[(instr >> 16) & 0x1f]; */
/* if (faultaddr == 0) { */
- act.sa_sigaction = (void *) catch_NullPointerException; /* reinstall handler */
+ act.sa_sigaction = (functionptr) catch_NullPointerException; /* reinstall handler */
act.sa_flags = SA_SIGINFO;
sigaction(sig, &act, NULL);
/* Reset signal handler - necessary for SysV, does no harm for BSD */
- act.sa_sigaction = (void *) catch_ArithmeticException; /* reinstall handler */
+ act.sa_sigaction = (functionptr) catch_ArithmeticException; /* reinstall handler */
act.sa_flags = SA_SIGINFO;
sigaction(sig, &act, NULL);
if (!checknull) {
#if defined(SIGSEGV)
- act.sa_sigaction = (void *) catch_NullPointerException;
+ act.sa_sigaction = (functionptr) catch_NullPointerException;
act.sa_flags = SA_SIGINFO;
sigaction(SIGSEGV, &act, NULL);
#endif
#if defined(SIGBUS)
- act.sa_sigaction = (void *) catch_NullPointerException;
+ act.sa_sigaction = (functionptr) catch_NullPointerException;
act.sa_flags = SA_SIGINFO;
sigaction(SIGBUS, &act, NULL);
#endif
}
- act.sa_sigaction = (void *) catch_ArithmeticException;
+ act.sa_sigaction = (functionptr) catch_ArithmeticException;
act.sa_flags = SA_SIGINFO;
sigaction(SIGFPE, &act, NULL);
}
Edwin Steiner
Christian Thalinger
- $Id: loader.c 1443 2004-11-05 13:53:13Z twisti $
+ $Id: loader.c 1494 2004-11-12 13:34:26Z twisti $
*/
return false;
if (opt_verify &&
- !is_valid_utf(cb->pos + 1, cb->pos + 1 + length)) {
+ !is_valid_utf((char *) (cb->pos + 1),
+ (char *) (cb->pos + 1 + length))) {
dolog("Invalid UTF-8 string (constant pool index %d)",idx);
panic("Invalid UTF-8 string");
}
/* insert utf-string into the utf-symboltable */
- cpinfos[idx] = utf_new_intern(cb->pos + 1, length);
+ cpinfos[idx] = utf_new_intern((char *) (cb->pos + 1), length);
/* skip bytes of the string (buffer size check above) */
skip_nbytes(cb, length);
return NULL;
if (super->flags & ACC_INTERFACE) {
- // java.lang.IncompatibleClassChangeError: class a has interface java.lang.Cloneable as super class
+ /* java.lang.IncompatibleClassChangeError: class a has interface java.lang.Cloneable as super class */
panic("Interface specified as super class");
}
goto notfoundvftblindex;
if (tc->methods[j].flags & ACC_FINAL) {
- // class a overrides final method .
+ /* class a overrides final method . */
*exceptionptr =
new_exception(string_java_lang_VerifyError);
return NULL;
#include <errno.h>
#include "config.h"
+#include "exceptions.h"
#include "thread.h"
#include "locks.h"
#include "tables.h"
void asm_perform_threadswitch(u1 **from, u1 **to, u1 **stackTop);
u1* asm_initialize_thread_stack(void *func, u1 *stack);
-#else // defined(NATIVE_THREADS)
+#else /* NATIVE_THREADS */
#include "nativethread.h"
#endif
Authors: Reinhard Grafl
- $Id: memory.c 1489 2004-11-12 11:31:47Z twisti $
+ $Id: memory.c 1494 2004-11-12 13:34:26Z twisti $
*/
}
/* allocate dumpblock memory */
- //printf("new dumpblock: %d\n", newdumpblocksize);
+ /*printf("new dumpblock: %d\n", newdumpblocksize);*/
newdumpblock->dumpmem = checked_alloc(newdumpblocksize);
newdumpblock->prev = di->currentdumpblock;
/* Used dump size is previously allocated dump size, because the */
/* remaining free memory of the previous dump block cannot be used. */
- //printf("unused memory: %d\n", allocateddumpsize - useddumpsize);
+ /*printf("unused memory: %d\n", allocateddumpsize - useddumpsize);*/
di->useddumpsize = di->allocateddumpsize;
/* increase the allocated dump size by the size of the new dump block */
Authors: Reinhard Grafl
- $Id: memory.h 1437 2004-11-05 09:51:07Z twisti $
+ $Id: memory.h 1494 2004-11-12 13:34:26Z twisti $
*/
struct dumpblock {
dumpblock *prev;
- void *dumpmem;
+ u1 *dumpmem;
s4 size;
};