AC_MSG_CHECKING(whether to use gtk awt peers)
if test x"$enable_gtk_peer" = "xyes"; then
AC_MSG_RESULT(yes)
+ CACAO_GTK=yes
AWTPEERS="java.awt.peer.ComponentPeer \
java.awt.Graphics\
java.awt.Window\
AC_DEFINE([USE_GTK], 1, [use gtk])
else
+ CACAO_GTK=no
AWT_OBJS=""
AWTPEERS=""
USEGTK="no"
dnl now configure boehm gc and gnu classpath
dnl the export is not my favorite (is there another way?)
export CFLAGS
+export CACAO_GTK
AC_CONFIG_SUBDIRS(mm/boehm-gc classpath)
Philipp Tomsich
Edwin Steiner
- $Id: global.h 1377 2004-08-01 22:01:00Z stefan $
+ $Id: global.h 1415 2004-10-11 20:12:08Z jowenn $
*/
* TYPECHECK_VERBOSE activates all debug messages
*/
#ifdef CACAO_TYPECHECK
-/*#define TYPECHECK_STATISTICS*/
-/*#define TYPEINFO_DEBUG*/
-/*#define TYPECHECK_DEBUG*/
-/*#define TYPEINFO_DEBUG_TEST*/
-/*#define TYPECHECK_VERBOSE*/
-/*#define TYPECHECK_VERBOSE_IMPORTANT*/
+/*#define TYPECHECK_STATISTICS
+#define TYPEINFO_DEBUG
+#define TYPECHECK_DEBUG
+#define TYPEINFO_DEBUG_TEST
+#define TYPECHECK_VERBOSE
+#define TYPECHECK_VERBOSE_IMPORTANT*/
#if defined(TYPECHECK_VERBOSE) || defined(TYPECHECK_VERBOSE_IMPORTANT)
#define TYPECHECK_VERBOSE_OPT
#endif
Authors: Andreas Krall
Reinhard Grafl
- $Id: codegen.c 1347 2004-07-21 23:29:39Z twisti $
+ $Id: codegen.c 1415 2004-10-11 20:12:08Z jowenn $
*/
dseg_addlinenumbertablesize(m);
- (void) dseg_adds4(m, m->exceptiontablelength); /* ExTableSize */
+ (void) dseg_adds4(m, cd->exceptiontablelength); /* ExTableSize */
/* create exception table */
- for (ex = m->exceptiontable; ex != NULL; ex = ex->down) {
+ for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
dseg_addtarget(m, ex->start);
dseg_addtarget(m, ex->end);
dseg_addtarget(m, ex->handler);
xcodeptr = NULL;
for (bref = cd->xcheckarefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
bref->branchpos,
(u1 *) xcodeptr - (u1 *) cd->mcodebase - 4);
xcodeptr = NULL;
for (bref = cd->xcastrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
bref->branchpos,
(u1 *) xcodeptr - (u1 *) cd->mcodebase - 4);
xcodeptr = NULL;
for (bref = cd->xexceptionrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
bref->branchpos,
(u1 *) xcodeptr - (u1 *) cd->mcodebase - 4);
xcodeptr = NULL;
for (bref = cd->xnullrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
bref->branchpos,
(u1 *) xcodeptr - (u1 *) cd->mcodebase - 4);
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 1346 2004-07-21 23:29:21Z twisti $
+ $Id: codegen.inc 1415 2004-10-11 20:12:08Z jowenn $
*/
*******************************************************************************/
-void codegen_setup(methodinfo *m)
+void codegen_setup(methodinfo *m, t_inlining_globals * e)
{
codegendata *cd;
cd->linenumbertablesizepos = 0;
cd->linenumbertablestartpos = 0;
cd->linenumbertab = 0;
+
+ cd->method=m;
+ cd->exceptiontable=0;
+ cd->exceptiontablelength=0;
+ if (useinlining && e) {
+ if (e->cumextablelength>0) {
+ cd->exceptiontablelength=e->cumextablelength;
+ cd->exceptiontable = MNEW(exceptiontable, e->cumextablelength + 1);
+ }
+ } else if (e && (e->method->exceptiontablelength >0)) {
+ cd->exceptiontablelength=m->exceptiontablelength;
+ cd->exceptiontable = MNEW(exceptiontable, m->exceptiontablelength + 1);
+ }
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
cd->threadcritcurrent.next = NULL;
cd = m->codegendata;
if (cd) {
+ if (cd->exceptiontablelength) {
+ cd->exceptiontablelength=m->exceptiontablelength;
+ MFREE(cd->exceptiontable, exceptiontable, cd->exceptiontablelength + 1);
+ cd->exceptiontable=0;
+ cd->exceptiontablelength=0;
+ }
if (cd->mcodebase) {
MFREE(cd->mcodebase, u1, cd->mcodesize);
cd->mcodebase = NULL;
Authors: Christian Thalinger
- $Id: codegen.inc.h 1352 2004-07-26 21:00:00Z twisti $
+ $Id: codegen.inc.h 1415 2004-10-11 20:12:08Z jowenn $
*/
#include "global.h"
+struct t_inlining_globals;
+
#define MCODEINITSIZE (1<<15) /* 32 Kbyte code area initialization size */
#define DSEGINITSIZE (1<<12) /* 4 Kbyte data area initialization size */
s4 linenumbertablestartpos;
s4 linenumbertab;
+ methodinfo *method;
+ s4 exceptiontablelength;/* exceptiontable length */
+ exceptiontable *exceptiontable; /* the exceptiontable */
+
threadcritnodetemp *threadcrit; /* List of critical code regions */
threadcritnodetemp threadcritcurrent;
s4 threadcritcount; /* Number of critical regions */
/* function prototypes */
void codegen_init();
-void codegen_setup(methodinfo *m); /* allocates code and data area */
+void codegen_setup(methodinfo *m, struct t_inlining_globals *e); /* allocates code and data area */
void codegen(methodinfo *m);
void codegen_close(methodinfo *m); /* releases temporary storage */
void codegen_insertmethod(void *startpc, void *endpc);
Authors: Andreas Krall
Christian Thalinger
- $Id: codegen.c 1367 2004-08-01 07:29:50Z stefan $
+ $Id: codegen.c 1415 2004-10-11 20:12:08Z jowenn $
*/
to the information gotten from the class file */
(void) dseg_addlinenumbertablesize(m);
- (void) dseg_adds4(m, m->exceptiontablelength); /* ExTableSize */
+ (void) dseg_adds4(m, cd->exceptiontablelength); /* ExTableSize */
/* create exception table */
- for (ex = m->exceptiontable; ex != NULL; ex = ex->down) {
+ for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
dseg_addtarget(m, ex->start);
dseg_addtarget(m, ex->end);
dseg_addtarget(m, ex->handler);
xcodeptr = NULL;
for (bref = cd->xcheckarefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch(cd->mcodebase + bref->branchpos,
bref->branchpos,
xcodeptr - cd->mcodebase - (5 + 5 + 2));
xcodeptr = NULL;
for (bref = cd->xcastrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch(cd->mcodebase + bref->branchpos,
bref->branchpos,
xcodeptr - cd->mcodebase - (5 + 5 + 2));
xcodeptr = NULL;
for (bref = cd->xdivrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch(cd->mcodebase + bref->branchpos,
bref->branchpos,
xcodeptr - cd->mcodebase - (5 + 5 + 2));
xcodeptr = NULL;
for (bref = cd->xexceptionrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch(cd->mcodebase + bref->branchpos,
bref->branchpos,
xcodeptr - cd->mcodebase - (5 + 5 + 2));
xcodeptr = NULL;
for (bref = cd->xnullrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch(cd->mcodebase + bref->branchpos,
bref->branchpos,
xcodeptr - cd->mcodebase - (5 + 5 + 2));
codegendata *cd;
/* setup codegendata structure */
- codegen_setup(m);
+ codegen_setup(m,0);
cd = m->codegendata;
cd->mcodeptr = s;
codegendata *cd;
/* setup codegendata structure */
- codegen_setup(m);
+ codegen_setup(m,0);
cd = m->codegendata;
cd->mcodeptr = s;
Authors: Dieter Thuernbeck
- $Id: inline.c 1414 2004-10-04 12:55:33Z carolyn $
+ $Id: inline.c 1415 2004-10-11 20:12:08Z jowenn $
*/
}
-void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, inlining_methodinfo *inlinfo, t_inlining_globals *inline_env)
+void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, u2 lineindex,u2 currentline,u2 linepcchange,inlining_methodinfo *inlinfo, t_inlining_globals *inline_env)
{
t_inlining_stacknode *new = NEW(t_inlining_stacknode);
new->nextp = nextp;
new->opcode = opcode;
new->method = inline_env->method;
+ new->lineindex=lineindex;
+ new->currentline=currentline;
+ new->linepcchange=linepcchange;
new->inlinfo = inlinfo;
-
list_addfirst(inline_env->inlining_stack, new);
inline_env->isinlinedmethod++;
}
void inlining_pop_compiler_variables(
- int *i, int *p, int *nextp, int *opcode,
+ int *i, int *p, int *nextp,
+ int *opcode, u2 *lineindex,
+ u2 *currentline,u2 *linepcchange,
inlining_methodinfo **inlinfo,
t_inlining_globals *inline_env)
{
*p = tmp->p;
*nextp = tmp->nextp;
*opcode = tmp->opcode;
+
+ *lineindex=tmp->lineindex;
+ *currentline=tmp->currentline;
+ *currentline=tmp->linepcchange;
+
*inlinfo = tmp->inlinfo;
inline_env->method = tmp->method; /*co*/
break;
}
+ if (imi->flags & ACC_NATIVE) log_text("Native method,no inlining"); //DEBUG
if ((inline_env->cummethods < INLINING_MAXMETHODS) &&
(!(imi->flags & ACC_NATIVE)) &&
(!inlineoutsiders || (m->class == imr->class)) &&
Authors: Dieter Thuernbeck
- $Id: inline.h 1414 2004-10-04 12:55:33Z carolyn $
+ $Id: inline.h 1415 2004-10-11 20:12:08Z jowenn $
*/
int p; /* java instruction counter */
int nextp; /* start of next java instruction */
int opcode; /* java opcode */
-
+ u2 lineindex;
+ u2 currentline;
+ u2 linepcchange;
inlining_methodinfo *inlinfo;
} t_inlining_stacknode;
void inlining_cleanup(t_inlining_globals *inline_env);
void inlining_push_compiler_variables(
int i, int p, int nextp, int opcode,
+ u2 lineindex,u2 currentline,u2 linepcchange,
inlining_methodinfo* inlinfo,
t_inlining_globals *inline_env);
void inlining_pop_compiler_variables(
int *i, int *p, int *nextp, int *opcode,
+ u2 *lineindex,u2 *currentline,u2 *linepcchange,
inlining_methodinfo **inlinfo,
t_inlining_globals *inline_env);
void inlining_set_compiler_variables_fun(methodinfo *m,
void print_inlining_methodinfo( inlining_methodinfo *r);
#define inlining_save_compiler_variables() \
- inlining_push_compiler_variables(i,p,nextp,opcode,inlinfo,inline_env)
+ inlining_push_compiler_variables(i,p,nextp,opcode, lineindex,currentline, \
+ linepcchange,inlinfo,inline_env)
#define inlining_restore_compiler_variables() \
- inlining_pop_compiler_variables(&i, &p, &nextp, &opcode, &inlinfo, \
+ inlining_pop_compiler_variables(&i, &p, &nextp, &opcode, \
+ &lineindex,¤tline,&linepcchange,&inlinfo, \
inline_env)
#define inlining_set_compiler_variables(i) \
Changes: Edwin Steiner
- $Id: jit.c 1414 2004-10-04 12:55:33Z carolyn $
+ $Id: jit.c 1415 2004-10-11 20:12:08Z jowenn $
*/
#include "loop/analyze.h"
#include "toolbox/logging.h"
#include "toolbox/memory.h"
-
+#include "types.h"
+#include <stdio.h>
/* global switches ************************************************************/
#endif /* USEBUILTINTABLE */
+
+#define EXTABLEN
+/* \
+ { \
+ printf("PARSE method name ="); \
+ utf_display(m->class->name); \
+ printf("."); \
+ method_display(m); \
+ printf(" exceptiontablelength %d\n",m->exceptiontablelength); \
+ fflush(stdout); \
+ }
+*/
+
/*****************************************************************************
TABLE OF BUILTIN FUNCTIONS
m->basicblockindex = NULL;
m->instructions = NULL;
m->stack = NULL;
- m->exceptiontable = NULL;
+ /* NO !!! m->exceptiontable = NULL; */
/* release dump area */
/* call the compiler passes ***********************************************/
+ EXTABLEN
/* first of all initialize the register allocator */
reg_init(m);
/* init reqd to initialize for parse even in no inlining */
inline_env = inlining_init(m);
+ EXTABLEN
+
reg_setup(m);
/* setup the codegendata memory */
- codegen_setup(m);
+ codegen_setup(m,inline_env);
+
+ EXTABLEN
if (compileverbose)
log_message_method("Parsing: ", m);
log_message_method("Analysing: ", m);
}
- if (!analyse_stack(m)) {
+
+ if (!analyse_stack(m->codegendata)) {
if (compileverbose)
log_message_method("Exception while analysing: ", m);
if (compileverbose)
log_message_method("Typechecking: ", m);
- if (!typecheck(m)) {
+ if (!typecheck(m->codegendata)) {
if (compileverbose)
log_message_method("Exception while typechecking: ", m);
log_message_method("Typechecking done: ", m);
}
#endif
-
if (opt_loops) {
depthFirst(m);
analyseGraph(m);
Changes: Carolyn Oates
Edwin Steiner
- $Id: parse.c 1414 2004-10-04 12:55:33Z carolyn $
+ $Id: parse.c 1415 2004-10-11 20:12:08Z jowenn $
Extra print is due backing changes that removed globals and merged variables that should not be merged... They will be removed... do not delete yet.
*/
b_count = *block_count;
for (i = 0; i < exceptiontablelength; i++) {
+ /* printf("Excepiont table index: %d\n",i); */
p = raw_extable[i].startpc;
if (label_index != NULL) p = label_index[p];
extable[i].startpc = p;
p = raw_extable[i].endpc;
if (p <= raw_extable[i].startpc)
panic("Invalid exception handler range");
+ if (p >=m->jcodelength) {
+ panic("Invalid exception handler end is after code end");
+ }
if (label_index != NULL) p = label_index[p];
extable[i].endpc = p;
bound_check1(p);
u2 lineindex=0;
u2 currentline=0;
u2 linepcchange=0;
-
+ codegendata *cd=m->codegendata;
if (DEBUG==true) {printf("PARSING: "); fflush(stdout);
DEBUGMETH(m);
if (useinlining) {
label_index = inlinfo->label_index;
m->maxstack = inline_env->cummaxstack;
- m->exceptiontablelength = inline_env->cumextablelength;
+ /*JOWENN m->exceptiontablelength = inline_env->cumextablelength;*/
tmpinlinf = (inlining_methodinfo*)
list_first(inlinfo->inlinedmethods);
if (tmpinlinf != NULL) nextgp = tmpinlinf->startgp;
// m->exceptiontable = DMNEW(exceptiontable, m->exceptiontablelength + 1);
nextex = fillextable(m,
- m->exceptiontable, m->exceptiontable, m->exceptiontablelength,
+ cd->exceptiontable, m->exceptiontable, m->exceptiontablelength,
label_index, &b_count, inline_env);
s_count = 1 + m->exceptiontablelength; /* initialize stack element counter */
instructionstart[gp] = 1;
/*log_text("new start of instruction");*/
if (linepcchange==p) {
- if (m->linenumbercount > lineindex) {
- currentline = m->linenumbers[lineindex].line_number;
+ if (inline_env->method->linenumbercount > lineindex) {
+ currentline = inline_env->method->linenumbers[lineindex].line_number;
lineindex++;
- if (lineindex < m->linenumbercount)
- linepcchange = m->linenumbers[lineindex].start_pc;
+ if (lineindex < inline_env->method->linenumbercount)
+ linepcchange = inline_env->method->linenumbers[lineindex].start_pc;
/*printf("Line number changed to: %ld\n",currentline);*/
}
}
op += *tptr;
OP1(op, firstlocal + tmpinlinf->method->paramcount - 1 - i);
- /* m->basicblockindex[gp] |= (ipc << 1);*/ /*FIXME: necessary ? */
+ /*m->basicblockindex[gp] |= (ipc << 1);*/ /*FIXME: necessary ? */
}
if (DEBUG==true) {
printf("BEFORE SAVE: "); fflush(stdout);
/* allocate blocks */
-/* for (p = 0; p < inline_env->cumjcodelength; p++) { */
- for (p = 0; p < m->jcodelength; p++) {
+ for (p = 0; p < inline_env->cumjcodelength; 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])
(bptr - 1)->next = bptr;
bptr->next = NULL;
- if (m->exceptiontablelength > 0) {
- m->exceptiontable[m->exceptiontablelength - 1].down = NULL;
-
- } else {
- m->exceptiontable = NULL;
+ if (cd->exceptiontablelength > 0) {
+ cd->exceptiontable[cd->exceptiontablelength - 1].down = NULL;
}
+
+ for (i = 0; i < cd->exceptiontablelength; ++i) {
+ p = cd->exceptiontable[i].startpc;
+ cd->exceptiontable[i].start = m->basicblocks + m->basicblockindex[p];
- for (i = 0; i < m->exceptiontablelength; ++i) {
- p = m->exceptiontable[i].startpc;
- m->exceptiontable[i].start = m->basicblocks + m->basicblockindex[p];
-
- p = m->exceptiontable[i].endpc;
- m->exceptiontable[i].end = (p == m->jcodelength) ? (m->basicblocks + m->basicblockcount + 1) : (m->basicblocks + m->basicblockindex[p]);
+ p = cd->exceptiontable[i].endpc;
+ cd->exceptiontable[i].end = (p == m->jcodelength) ? (m->basicblocks + m->basicblockcount + 1) : (m->basicblocks + m->basicblockindex[p]);
- p = m->exceptiontable[i].handlerpc;
- m->exceptiontable[i].handler = m->basicblocks + m->basicblockindex[p];
+ p = cd->exceptiontable[i].handlerpc;
+ cd->exceptiontable[i].handler = m->basicblocks + m->basicblockindex[p];
}
}
Changes: Edwin Steiner
- $Id: stack.c 1338 2004-07-21 16:02:14Z twisti $
+ $Id: stack.c 1415 2004-10-11 20:12:08Z jowenn $
*/
* types are not discerned.
*/
-methodinfo *analyse_stack(methodinfo *m)
+methodinfo *analyse_stack(codegendata *codegendata)
{
int b_count;
int b_index;
s4 *s4ptr;
void* *tptr;
s4 *argren;
+ methodinfo *m=codegendata->method;
argren = DMNEW(s4, m->maxlocals); /* table for argument renaming */
for (i = 0; i < m->maxlocals; i++)
m->basicblocks[0].instack = 0;
m->basicblocks[0].indepth = 0;
- for (i = 0; i < m->exceptiontablelength; i++) {
- bptr = &m->basicblocks[m->basicblockindex[m->exceptiontable[i].handlerpc]];
+ for (i = 0; i < m->codegendata->exceptiontablelength; i++) {
+ bptr = &m->basicblocks[m->basicblockindex[m->codegendata->exceptiontable[i].handlerpc]];
bptr->flags = BBREACHED;
bptr->type = BBTYPE_EXH;
bptr->instack = new;
printf ("Line number table length: %d\n", m->linenumbercount);
- printf ("Exceptions (Number: %d):\n", m->exceptiontablelength);
- for (ex = m->exceptiontable; ex != NULL; ex = ex->down) {
+ printf ("Exceptions (Number: %d):\n", m->codegendata->exceptiontablelength);
+ for (ex = m->codegendata->exceptiontable; ex != NULL; ex = ex->down) {
printf(" L%03d ... ", ex->start->debug_nr );
printf("L%03d = ", ex->end->debug_nr);
printf("L%03d\n", ex->handler->debug_nr);
Authors: Christian Thalinger
- $Id: stack.h 1338 2004-07-21 16:02:14Z twisti $
+ $Id: stack.h 1415 2004-10-11 20:12:08Z jowenn $
*/
/* function prototypes */
-methodinfo *analyse_stack(methodinfo *m);
+methodinfo *analyse_stack(codegendata *codegendata);
void icmd_print_stack(methodinfo *m, stackptr s);
char *icmd_builtin_name(functionptr bptr);
Authors: Edwin Steiner
- $Id: typecheck.c 1348 2004-07-22 09:57:51Z twisti $
+ $Id: typecheck.c 1415 2004-10-11 20:12:08Z jowenn $
*/
/* typecheck is called directly after analyse_stack */
-methodinfo *typecheck(methodinfo *m)
+methodinfo *typecheck(codegendata *codegendata)
{
int b_count, b_index;
stackptr curstack; /* input stack top for current instruction */
bool jsrencountered = false; /* true if we there was a JSR */
classinfo *myclass;
+ methodinfo *m=codegendata->method;
#ifdef TYPECHECK_STATISTICS
int count_iterations = 0;
LOG("Variable buffer allocated.\n");
/* allocate the buffer of active exception handlers */
- handlers = DMNEW(exceptiontable*, m->exceptiontablelength + 1);
+ handlers = DMNEW(exceptiontable*, codegendata->exceptiontablelength + 1);
/* initialize the variable types of the first block */
/* to the types of the arguments */
/* XXX could use a faster algorithm with sorted lists or
* something? */
len = 0;
- for (i = 0; i < m->exceptiontablelength; ++i) {
- if ((m->exceptiontable[i].start <= bptr) && (m->exceptiontable[i].end > bptr)) {
- LOG1("active handler L%03d", m->exceptiontable[i].handler->debug_nr);
- handlers[len++] = m->exceptiontable + i;
+ for (i = 0; i < codegendata->exceptiontablelength; ++i) {
+ if ((codegendata->exceptiontable[i].start <= bptr) && (codegendata->exceptiontable[i].end > bptr)) {
+ LOG1("active handler L%03d", codegendata->exceptiontable[i].handler->debug_nr);
+ handlers[len++] = codegendata->exceptiontable + i;
}
}
handlers[len] = NULL;
Authors: Christian Thalinger
- $Id: typecheck.h 1079 2004-05-26 09:41:33Z twisti $
+ $Id: typecheck.h 1415 2004-10-11 20:12:08Z jowenn $
*/
#define _TYPECHECK_H
/* function prototypes */
-
-methodinfo *typecheck(methodinfo *m);
+struct codegendata;
+methodinfo *typecheck(codegendata *codegendata);
#endif /* _TYPECHECK_H */
Edwin Steiner
Christian Thalinger
- $Id: loader.c 1409 2004-08-17 12:48:52Z twisti $
+ $Id: loader.c 1415 2004-10-11 20:12:08Z jowenn $
*/
m->stubroutine = createcompilerstub(m);
} else {
+ /*if (useinlining) {
+ log_text("creating native stub:");
+ method_display(m);
+ }*/
functionptr f = native_findfunction(c->name, m->name, m->descriptor,
(m->flags & ACC_STATIC) != 0);
if (f) {
return false;
m->exceptiontablelength = suck_u2(cb);
-
if (!check_classbuffer_size(cb, (2 + 2 + 2 + 2) * m->exceptiontablelength))
return false;
}
/* everything was ok */
+ /* utf_display(m->name);
+ printf("\nexceptiontablelength:%ld\n",m->exceptiontablelength);*/
return true;
}
}
/* Check methods */
- memset(hashtab, 0, sizeof(u2) * (hashlen + len));
+ memset(hashtab, 0, sizeof(u2) * (hashlen + hashlen/5));
for (i = 0; i < c->methodscount; ++i) {
methodinfo *mi = c->methods + i;
index = ((((size_t) mi->name) +
((size_t) mi->descriptor)) >> shift) % hashlen;
+ /*{ JOWENN
+ int dbg;
+ for (dbg=0;dbg<hashlen+hashlen/5;++dbg){
+ printf("Hash[%d]:%d\n",dbg,hashtab[dbg]);
+ }
+ }*/
+
if ((old = hashtab[index])) {
old--;
next[i] = old;
Philipp Tomsich
Edwin Steiner
- $Id: global.h 1377 2004-08-01 22:01:00Z stefan $
+ $Id: global.h 1415 2004-10-11 20:12:08Z jowenn $
*/
* TYPECHECK_VERBOSE activates all debug messages
*/
#ifdef CACAO_TYPECHECK
-/*#define TYPECHECK_STATISTICS*/
-/*#define TYPEINFO_DEBUG*/
-/*#define TYPECHECK_DEBUG*/
-/*#define TYPEINFO_DEBUG_TEST*/
-/*#define TYPECHECK_VERBOSE*/
-/*#define TYPECHECK_VERBOSE_IMPORTANT*/
+/*#define TYPECHECK_STATISTICS
+#define TYPEINFO_DEBUG
+#define TYPECHECK_DEBUG
+#define TYPEINFO_DEBUG_TEST
+#define TYPECHECK_VERBOSE
+#define TYPECHECK_VERBOSE_IMPORTANT*/
#if defined(TYPECHECK_VERBOSE) || defined(TYPECHECK_VERBOSE_IMPORTANT)
#define TYPECHECK_VERBOSE_OPT
#endif
Authors: Andreas Krall
Reinhard Grafl
- $Id: codegen.c 1347 2004-07-21 23:29:39Z twisti $
+ $Id: codegen.c 1415 2004-10-11 20:12:08Z jowenn $
*/
dseg_addlinenumbertablesize(m);
- (void) dseg_adds4(m, m->exceptiontablelength); /* ExTableSize */
+ (void) dseg_adds4(m, cd->exceptiontablelength); /* ExTableSize */
/* create exception table */
- for (ex = m->exceptiontable; ex != NULL; ex = ex->down) {
+ for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
dseg_addtarget(m, ex->start);
dseg_addtarget(m, ex->end);
dseg_addtarget(m, ex->handler);
xcodeptr = NULL;
for (bref = cd->xcheckarefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
bref->branchpos,
(u1 *) xcodeptr - (u1 *) cd->mcodebase - 4);
xcodeptr = NULL;
for (bref = cd->xcastrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
bref->branchpos,
(u1 *) xcodeptr - (u1 *) cd->mcodebase - 4);
xcodeptr = NULL;
for (bref = cd->xexceptionrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
bref->branchpos,
(u1 *) xcodeptr - (u1 *) cd->mcodebase - 4);
xcodeptr = NULL;
for (bref = cd->xnullrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch((u1 *) cd->mcodebase + bref->branchpos,
bref->branchpos,
(u1 *) xcodeptr - (u1 *) cd->mcodebase - 4);
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 1346 2004-07-21 23:29:21Z twisti $
+ $Id: codegen.inc 1415 2004-10-11 20:12:08Z jowenn $
*/
*******************************************************************************/
-void codegen_setup(methodinfo *m)
+void codegen_setup(methodinfo *m, t_inlining_globals * e)
{
codegendata *cd;
cd->linenumbertablesizepos = 0;
cd->linenumbertablestartpos = 0;
cd->linenumbertab = 0;
+
+ cd->method=m;
+ cd->exceptiontable=0;
+ cd->exceptiontablelength=0;
+ if (useinlining && e) {
+ if (e->cumextablelength>0) {
+ cd->exceptiontablelength=e->cumextablelength;
+ cd->exceptiontable = MNEW(exceptiontable, e->cumextablelength + 1);
+ }
+ } else if (e && (e->method->exceptiontablelength >0)) {
+ cd->exceptiontablelength=m->exceptiontablelength;
+ cd->exceptiontable = MNEW(exceptiontable, m->exceptiontablelength + 1);
+ }
#if defined(USE_THREADS) && defined(NATIVE_THREADS)
cd->threadcritcurrent.next = NULL;
cd = m->codegendata;
if (cd) {
+ if (cd->exceptiontablelength) {
+ cd->exceptiontablelength=m->exceptiontablelength;
+ MFREE(cd->exceptiontable, exceptiontable, cd->exceptiontablelength + 1);
+ cd->exceptiontable=0;
+ cd->exceptiontablelength=0;
+ }
if (cd->mcodebase) {
MFREE(cd->mcodebase, u1, cd->mcodesize);
cd->mcodebase = NULL;
Authors: Christian Thalinger
- $Id: codegen.inc.h 1352 2004-07-26 21:00:00Z twisti $
+ $Id: codegen.inc.h 1415 2004-10-11 20:12:08Z jowenn $
*/
#include "global.h"
+struct t_inlining_globals;
+
#define MCODEINITSIZE (1<<15) /* 32 Kbyte code area initialization size */
#define DSEGINITSIZE (1<<12) /* 4 Kbyte data area initialization size */
s4 linenumbertablestartpos;
s4 linenumbertab;
+ methodinfo *method;
+ s4 exceptiontablelength;/* exceptiontable length */
+ exceptiontable *exceptiontable; /* the exceptiontable */
+
threadcritnodetemp *threadcrit; /* List of critical code regions */
threadcritnodetemp threadcritcurrent;
s4 threadcritcount; /* Number of critical regions */
/* function prototypes */
void codegen_init();
-void codegen_setup(methodinfo *m); /* allocates code and data area */
+void codegen_setup(methodinfo *m, struct t_inlining_globals *e); /* allocates code and data area */
void codegen(methodinfo *m);
void codegen_close(methodinfo *m); /* releases temporary storage */
void codegen_insertmethod(void *startpc, void *endpc);
Authors: Andreas Krall
Christian Thalinger
- $Id: codegen.c 1367 2004-08-01 07:29:50Z stefan $
+ $Id: codegen.c 1415 2004-10-11 20:12:08Z jowenn $
*/
to the information gotten from the class file */
(void) dseg_addlinenumbertablesize(m);
- (void) dseg_adds4(m, m->exceptiontablelength); /* ExTableSize */
+ (void) dseg_adds4(m, cd->exceptiontablelength); /* ExTableSize */
/* create exception table */
- for (ex = m->exceptiontable; ex != NULL; ex = ex->down) {
+ for (ex = cd->exceptiontable; ex != NULL; ex = ex->down) {
dseg_addtarget(m, ex->start);
dseg_addtarget(m, ex->end);
dseg_addtarget(m, ex->handler);
xcodeptr = NULL;
for (bref = cd->xcheckarefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch(cd->mcodebase + bref->branchpos,
bref->branchpos,
xcodeptr - cd->mcodebase - (5 + 5 + 2));
xcodeptr = NULL;
for (bref = cd->xcastrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch(cd->mcodebase + bref->branchpos,
bref->branchpos,
xcodeptr - cd->mcodebase - (5 + 5 + 2));
xcodeptr = NULL;
for (bref = cd->xdivrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch(cd->mcodebase + bref->branchpos,
bref->branchpos,
xcodeptr - cd->mcodebase - (5 + 5 + 2));
xcodeptr = NULL;
for (bref = cd->xexceptionrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch(cd->mcodebase + bref->branchpos,
bref->branchpos,
xcodeptr - cd->mcodebase - (5 + 5 + 2));
xcodeptr = NULL;
for (bref = cd->xnullrefs; bref != NULL; bref = bref->next) {
- if ((m->exceptiontablelength == 0) && (xcodeptr != NULL)) {
+ if ((cd->exceptiontablelength == 0) && (xcodeptr != NULL)) {
gen_resolvebranch(cd->mcodebase + bref->branchpos,
bref->branchpos,
xcodeptr - cd->mcodebase - (5 + 5 + 2));
codegendata *cd;
/* setup codegendata structure */
- codegen_setup(m);
+ codegen_setup(m,0);
cd = m->codegendata;
cd->mcodeptr = s;
codegendata *cd;
/* setup codegendata structure */
- codegen_setup(m);
+ codegen_setup(m,0);
cd = m->codegendata;
cd->mcodeptr = s;
Authors: Dieter Thuernbeck
- $Id: inline.c 1414 2004-10-04 12:55:33Z carolyn $
+ $Id: inline.c 1415 2004-10-11 20:12:08Z jowenn $
*/
}
-void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, inlining_methodinfo *inlinfo, t_inlining_globals *inline_env)
+void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, u2 lineindex,u2 currentline,u2 linepcchange,inlining_methodinfo *inlinfo, t_inlining_globals *inline_env)
{
t_inlining_stacknode *new = NEW(t_inlining_stacknode);
new->nextp = nextp;
new->opcode = opcode;
new->method = inline_env->method;
+ new->lineindex=lineindex;
+ new->currentline=currentline;
+ new->linepcchange=linepcchange;
new->inlinfo = inlinfo;
-
list_addfirst(inline_env->inlining_stack, new);
inline_env->isinlinedmethod++;
}
void inlining_pop_compiler_variables(
- int *i, int *p, int *nextp, int *opcode,
+ int *i, int *p, int *nextp,
+ int *opcode, u2 *lineindex,
+ u2 *currentline,u2 *linepcchange,
inlining_methodinfo **inlinfo,
t_inlining_globals *inline_env)
{
*p = tmp->p;
*nextp = tmp->nextp;
*opcode = tmp->opcode;
+
+ *lineindex=tmp->lineindex;
+ *currentline=tmp->currentline;
+ *currentline=tmp->linepcchange;
+
*inlinfo = tmp->inlinfo;
inline_env->method = tmp->method; /*co*/
break;
}
+ if (imi->flags & ACC_NATIVE) log_text("Native method,no inlining"); //DEBUG
if ((inline_env->cummethods < INLINING_MAXMETHODS) &&
(!(imi->flags & ACC_NATIVE)) &&
(!inlineoutsiders || (m->class == imr->class)) &&
Authors: Dieter Thuernbeck
- $Id: inline.h 1414 2004-10-04 12:55:33Z carolyn $
+ $Id: inline.h 1415 2004-10-11 20:12:08Z jowenn $
*/
int p; /* java instruction counter */
int nextp; /* start of next java instruction */
int opcode; /* java opcode */
-
+ u2 lineindex;
+ u2 currentline;
+ u2 linepcchange;
inlining_methodinfo *inlinfo;
} t_inlining_stacknode;
void inlining_cleanup(t_inlining_globals *inline_env);
void inlining_push_compiler_variables(
int i, int p, int nextp, int opcode,
+ u2 lineindex,u2 currentline,u2 linepcchange,
inlining_methodinfo* inlinfo,
t_inlining_globals *inline_env);
void inlining_pop_compiler_variables(
int *i, int *p, int *nextp, int *opcode,
+ u2 *lineindex,u2 *currentline,u2 *linepcchange,
inlining_methodinfo **inlinfo,
t_inlining_globals *inline_env);
void inlining_set_compiler_variables_fun(methodinfo *m,
void print_inlining_methodinfo( inlining_methodinfo *r);
#define inlining_save_compiler_variables() \
- inlining_push_compiler_variables(i,p,nextp,opcode,inlinfo,inline_env)
+ inlining_push_compiler_variables(i,p,nextp,opcode, lineindex,currentline, \
+ linepcchange,inlinfo,inline_env)
#define inlining_restore_compiler_variables() \
- inlining_pop_compiler_variables(&i, &p, &nextp, &opcode, &inlinfo, \
+ inlining_pop_compiler_variables(&i, &p, &nextp, &opcode, \
+ &lineindex,¤tline,&linepcchange,&inlinfo, \
inline_env)
#define inlining_set_compiler_variables(i) \
Changes: Edwin Steiner
- $Id: jit.c 1414 2004-10-04 12:55:33Z carolyn $
+ $Id: jit.c 1415 2004-10-11 20:12:08Z jowenn $
*/
#include "loop/analyze.h"
#include "toolbox/logging.h"
#include "toolbox/memory.h"
-
+#include "types.h"
+#include <stdio.h>
/* global switches ************************************************************/
#endif /* USEBUILTINTABLE */
+
+#define EXTABLEN
+/* \
+ { \
+ printf("PARSE method name ="); \
+ utf_display(m->class->name); \
+ printf("."); \
+ method_display(m); \
+ printf(" exceptiontablelength %d\n",m->exceptiontablelength); \
+ fflush(stdout); \
+ }
+*/
+
/*****************************************************************************
TABLE OF BUILTIN FUNCTIONS
m->basicblockindex = NULL;
m->instructions = NULL;
m->stack = NULL;
- m->exceptiontable = NULL;
+ /* NO !!! m->exceptiontable = NULL; */
/* release dump area */
/* call the compiler passes ***********************************************/
+ EXTABLEN
/* first of all initialize the register allocator */
reg_init(m);
/* init reqd to initialize for parse even in no inlining */
inline_env = inlining_init(m);
+ EXTABLEN
+
reg_setup(m);
/* setup the codegendata memory */
- codegen_setup(m);
+ codegen_setup(m,inline_env);
+
+ EXTABLEN
if (compileverbose)
log_message_method("Parsing: ", m);
log_message_method("Analysing: ", m);
}
- if (!analyse_stack(m)) {
+
+ if (!analyse_stack(m->codegendata)) {
if (compileverbose)
log_message_method("Exception while analysing: ", m);
if (compileverbose)
log_message_method("Typechecking: ", m);
- if (!typecheck(m)) {
+ if (!typecheck(m->codegendata)) {
if (compileverbose)
log_message_method("Exception while typechecking: ", m);
log_message_method("Typechecking done: ", m);
}
#endif
-
if (opt_loops) {
depthFirst(m);
analyseGraph(m);
Changes: Carolyn Oates
Edwin Steiner
- $Id: parse.c 1414 2004-10-04 12:55:33Z carolyn $
+ $Id: parse.c 1415 2004-10-11 20:12:08Z jowenn $
Extra print is due backing changes that removed globals and merged variables that should not be merged... They will be removed... do not delete yet.
*/
b_count = *block_count;
for (i = 0; i < exceptiontablelength; i++) {
+ /* printf("Excepiont table index: %d\n",i); */
p = raw_extable[i].startpc;
if (label_index != NULL) p = label_index[p];
extable[i].startpc = p;
p = raw_extable[i].endpc;
if (p <= raw_extable[i].startpc)
panic("Invalid exception handler range");
+ if (p >=m->jcodelength) {
+ panic("Invalid exception handler end is after code end");
+ }
if (label_index != NULL) p = label_index[p];
extable[i].endpc = p;
bound_check1(p);
u2 lineindex=0;
u2 currentline=0;
u2 linepcchange=0;
-
+ codegendata *cd=m->codegendata;
if (DEBUG==true) {printf("PARSING: "); fflush(stdout);
DEBUGMETH(m);
if (useinlining) {
label_index = inlinfo->label_index;
m->maxstack = inline_env->cummaxstack;
- m->exceptiontablelength = inline_env->cumextablelength;
+ /*JOWENN m->exceptiontablelength = inline_env->cumextablelength;*/
tmpinlinf = (inlining_methodinfo*)
list_first(inlinfo->inlinedmethods);
if (tmpinlinf != NULL) nextgp = tmpinlinf->startgp;
// m->exceptiontable = DMNEW(exceptiontable, m->exceptiontablelength + 1);
nextex = fillextable(m,
- m->exceptiontable, m->exceptiontable, m->exceptiontablelength,
+ cd->exceptiontable, m->exceptiontable, m->exceptiontablelength,
label_index, &b_count, inline_env);
s_count = 1 + m->exceptiontablelength; /* initialize stack element counter */
instructionstart[gp] = 1;
/*log_text("new start of instruction");*/
if (linepcchange==p) {
- if (m->linenumbercount > lineindex) {
- currentline = m->linenumbers[lineindex].line_number;
+ if (inline_env->method->linenumbercount > lineindex) {
+ currentline = inline_env->method->linenumbers[lineindex].line_number;
lineindex++;
- if (lineindex < m->linenumbercount)
- linepcchange = m->linenumbers[lineindex].start_pc;
+ if (lineindex < inline_env->method->linenumbercount)
+ linepcchange = inline_env->method->linenumbers[lineindex].start_pc;
/*printf("Line number changed to: %ld\n",currentline);*/
}
}
op += *tptr;
OP1(op, firstlocal + tmpinlinf->method->paramcount - 1 - i);
- /* m->basicblockindex[gp] |= (ipc << 1);*/ /*FIXME: necessary ? */
+ /*m->basicblockindex[gp] |= (ipc << 1);*/ /*FIXME: necessary ? */
}
if (DEBUG==true) {
printf("BEFORE SAVE: "); fflush(stdout);
/* allocate blocks */
-/* for (p = 0; p < inline_env->cumjcodelength; p++) { */
- for (p = 0; p < m->jcodelength; p++) {
+ for (p = 0; p < inline_env->cumjcodelength; 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])
(bptr - 1)->next = bptr;
bptr->next = NULL;
- if (m->exceptiontablelength > 0) {
- m->exceptiontable[m->exceptiontablelength - 1].down = NULL;
-
- } else {
- m->exceptiontable = NULL;
+ if (cd->exceptiontablelength > 0) {
+ cd->exceptiontable[cd->exceptiontablelength - 1].down = NULL;
}
+
+ for (i = 0; i < cd->exceptiontablelength; ++i) {
+ p = cd->exceptiontable[i].startpc;
+ cd->exceptiontable[i].start = m->basicblocks + m->basicblockindex[p];
- for (i = 0; i < m->exceptiontablelength; ++i) {
- p = m->exceptiontable[i].startpc;
- m->exceptiontable[i].start = m->basicblocks + m->basicblockindex[p];
-
- p = m->exceptiontable[i].endpc;
- m->exceptiontable[i].end = (p == m->jcodelength) ? (m->basicblocks + m->basicblockcount + 1) : (m->basicblocks + m->basicblockindex[p]);
+ p = cd->exceptiontable[i].endpc;
+ cd->exceptiontable[i].end = (p == m->jcodelength) ? (m->basicblocks + m->basicblockcount + 1) : (m->basicblocks + m->basicblockindex[p]);
- p = m->exceptiontable[i].handlerpc;
- m->exceptiontable[i].handler = m->basicblocks + m->basicblockindex[p];
+ p = cd->exceptiontable[i].handlerpc;
+ cd->exceptiontable[i].handler = m->basicblocks + m->basicblockindex[p];
}
}
Changes: Edwin Steiner
- $Id: stack.c 1338 2004-07-21 16:02:14Z twisti $
+ $Id: stack.c 1415 2004-10-11 20:12:08Z jowenn $
*/
* types are not discerned.
*/
-methodinfo *analyse_stack(methodinfo *m)
+methodinfo *analyse_stack(codegendata *codegendata)
{
int b_count;
int b_index;
s4 *s4ptr;
void* *tptr;
s4 *argren;
+ methodinfo *m=codegendata->method;
argren = DMNEW(s4, m->maxlocals); /* table for argument renaming */
for (i = 0; i < m->maxlocals; i++)
m->basicblocks[0].instack = 0;
m->basicblocks[0].indepth = 0;
- for (i = 0; i < m->exceptiontablelength; i++) {
- bptr = &m->basicblocks[m->basicblockindex[m->exceptiontable[i].handlerpc]];
+ for (i = 0; i < m->codegendata->exceptiontablelength; i++) {
+ bptr = &m->basicblocks[m->basicblockindex[m->codegendata->exceptiontable[i].handlerpc]];
bptr->flags = BBREACHED;
bptr->type = BBTYPE_EXH;
bptr->instack = new;
printf ("Line number table length: %d\n", m->linenumbercount);
- printf ("Exceptions (Number: %d):\n", m->exceptiontablelength);
- for (ex = m->exceptiontable; ex != NULL; ex = ex->down) {
+ printf ("Exceptions (Number: %d):\n", m->codegendata->exceptiontablelength);
+ for (ex = m->codegendata->exceptiontable; ex != NULL; ex = ex->down) {
printf(" L%03d ... ", ex->start->debug_nr );
printf("L%03d = ", ex->end->debug_nr);
printf("L%03d\n", ex->handler->debug_nr);
Authors: Christian Thalinger
- $Id: stack.h 1338 2004-07-21 16:02:14Z twisti $
+ $Id: stack.h 1415 2004-10-11 20:12:08Z jowenn $
*/
/* function prototypes */
-methodinfo *analyse_stack(methodinfo *m);
+methodinfo *analyse_stack(codegendata *codegendata);
void icmd_print_stack(methodinfo *m, stackptr s);
char *icmd_builtin_name(functionptr bptr);
Authors: Edwin Steiner
- $Id: typecheck.c 1348 2004-07-22 09:57:51Z twisti $
+ $Id: typecheck.c 1415 2004-10-11 20:12:08Z jowenn $
*/
/* typecheck is called directly after analyse_stack */
-methodinfo *typecheck(methodinfo *m)
+methodinfo *typecheck(codegendata *codegendata)
{
int b_count, b_index;
stackptr curstack; /* input stack top for current instruction */
bool jsrencountered = false; /* true if we there was a JSR */
classinfo *myclass;
+ methodinfo *m=codegendata->method;
#ifdef TYPECHECK_STATISTICS
int count_iterations = 0;
LOG("Variable buffer allocated.\n");
/* allocate the buffer of active exception handlers */
- handlers = DMNEW(exceptiontable*, m->exceptiontablelength + 1);
+ handlers = DMNEW(exceptiontable*, codegendata->exceptiontablelength + 1);
/* initialize the variable types of the first block */
/* to the types of the arguments */
/* XXX could use a faster algorithm with sorted lists or
* something? */
len = 0;
- for (i = 0; i < m->exceptiontablelength; ++i) {
- if ((m->exceptiontable[i].start <= bptr) && (m->exceptiontable[i].end > bptr)) {
- LOG1("active handler L%03d", m->exceptiontable[i].handler->debug_nr);
- handlers[len++] = m->exceptiontable + i;
+ for (i = 0; i < codegendata->exceptiontablelength; ++i) {
+ if ((codegendata->exceptiontable[i].start <= bptr) && (codegendata->exceptiontable[i].end > bptr)) {
+ LOG1("active handler L%03d", codegendata->exceptiontable[i].handler->debug_nr);
+ handlers[len++] = codegendata->exceptiontable + i;
}
}
handlers[len] = NULL;
Authors: Christian Thalinger
- $Id: typecheck.h 1079 2004-05-26 09:41:33Z twisti $
+ $Id: typecheck.h 1415 2004-10-11 20:12:08Z jowenn $
*/
#define _TYPECHECK_H
/* function prototypes */
-
-methodinfo *typecheck(methodinfo *m);
+struct codegendata;
+methodinfo *typecheck(codegendata *codegendata);
#endif /* _TYPECHECK_H */
Edwin Steiner
Christian Thalinger
- $Id: loader.c 1409 2004-08-17 12:48:52Z twisti $
+ $Id: loader.c 1415 2004-10-11 20:12:08Z jowenn $
*/
m->stubroutine = createcompilerstub(m);
} else {
+ /*if (useinlining) {
+ log_text("creating native stub:");
+ method_display(m);
+ }*/
functionptr f = native_findfunction(c->name, m->name, m->descriptor,
(m->flags & ACC_STATIC) != 0);
if (f) {
return false;
m->exceptiontablelength = suck_u2(cb);
-
if (!check_classbuffer_size(cb, (2 + 2 + 2 + 2) * m->exceptiontablelength))
return false;
}
/* everything was ok */
+ /* utf_display(m->name);
+ printf("\nexceptiontablelength:%ld\n",m->exceptiontablelength);*/
return true;
}
}
/* Check methods */
- memset(hashtab, 0, sizeof(u2) * (hashlen + len));
+ memset(hashtab, 0, sizeof(u2) * (hashlen + hashlen/5));
for (i = 0; i < c->methodscount; ++i) {
methodinfo *mi = c->methods + i;
index = ((((size_t) mi->name) +
((size_t) mi->descriptor)) >> shift) % hashlen;
+ /*{ JOWENN
+ int dbg;
+ for (dbg=0;dbg<hashlen+hashlen/5;++dbg){
+ printf("Hash[%d]:%d\n",dbg,hashtab[dbg]);
+ }
+ }*/
+
if ((old = hashtab[index])) {
old--;
next[i] = old;