Philipp Tomsich
Edwin Steiner
- $Id: global.h 940 2004-03-06 14:04:15Z jowenn $
+ $Id: global.h 941 2004-03-06 17:27:56Z jowenn $
*/
typedef u1* methodptr;
typedef struct fieldinfo fieldinfo;
typedef struct methodinfo methodinfo;
+typedef struct lineinfo lineinfo;
typedef struct arraydescriptor arraydescriptor;
} xtainfo;
+/* lineinfo *****************************************************************/
+struct lineinfo {
+ u2 start_pc;
+ u2 line_number;
+};
+
/* methodinfo *****************************************************************/
struct methodinfo { /* method structure */
u1 *jcode; /* pointer to JavaVM code */
s4 exceptiontablelength;/* exceptiontable length */
- exceptiontable *exceptiontable;
+ exceptiontable *exceptiontable; /* the exceptiontable */
+
+ u2 thrownexceptionscount; /*number of exceptions declared to be thrown by a method*/
+ classinfo **thrownexceptions; /*array of classinfos of declared exceptions*/
- u2 thrownexceptionscount;
- classinfo **thrownexceptions;
- /* the exceptiontable */
+ u2 linenumbercount; /*number of linenumber attributes*/
+ lineinfo *linenumbers; /*array of lineinfo items (start_pc,line_number)*/
u1 *stubroutine; /* stub for compiling or calling natives */
s4 mcodelength; /* legth of generated machine code */
Changes: Edwin Steiner
- $Id: jit.c 923 2004-02-24 13:28:08Z edwin $
+ $Id: jit.c 941 2004-03-06 17:27:56Z jowenn $
*/
int maxlocals; /* maximal number of local JavaVM variables */
int jcodelength; /* length of JavaVM-codes */
u1 *jcode; /* pointer to start of JavaVM-code */
+lineinfo *jlinenumbers; /* line information array */
+u2 jlinenumbercount; /* number of entries in the linenumber array */
int exceptiontablelength; /* length of exception table */
xtable *extable; /* pointer to start of exception table */
exceptiontable *raw_extable;
maxlocals = m->maxlocals;
jcodelength = m->jcodelength;
jcode = m->jcode;
+ jlinenumbers = m->linenumbers;
+ jlinenumbercount = m->linenumbercount;
exceptiontablelength = m->exceptiontablelength;
raw_extable = m->exceptiontable;
regs_ok = false;
Changes: Christian Thalinger
- $Id: jit.h 938 2004-03-06 00:56:43Z twisti $
+ $Id: jit.h 941 2004-03-06 17:27:56Z jowenn $
*/
u2 opc; /* opcode of intermediate code command */
s4 op1; /* first operand, usually variable number */
imm_union val; /* immediate constant */
- void *target; /* used for targets of branches and jumps */
- /* and as address for list of targets for */
- /* statements */
+ void *target; /* used for targets of branches and jumps */
+ /* and as address for list of targets for */
+ /* statements */
+ u2 line /* line number in source file */
};
extern int maxlocals; /* maximal number of local JavaVM variables */
extern int jcodelength; /* length of JavaVM-codes */
extern u1 *jcode; /* pointer to start of JavaVM-code */
+lineinfo *jlinenumbers; /* line information array */
+u2 jlinenumbercount; /* number of entries in the linenumber array */
extern int exceptiontablelength;/* length of exception table */
extern xtable *extable; /* pointer to start of exception table */
extern exceptiontable *raw_extable;
Changes: Carolyn Oates
Edwin Steiner
- $Id: parse.c 893 2004-01-19 12:53:24Z edwin $
+ $Id: parse.c 941 2004-03-06 17:27:56Z jowenn $
*/
#define OP(o) iptr->opc=(o);/*iptr->op1=0*/;/*iptr->val.l=0*/;PINC
#define OP1(o,o1) iptr->opc=(o);iptr->op1=(o1);/*iptr->val.l=(0)*/;PINC
#define OP2I(o,o1,v) iptr->opc=(o);iptr->op1=(o1);iptr->val.i=(v);PINC
-#define OP2A(o,o1,v) iptr->opc=(o);iptr->op1=(o1);iptr->val.a=(v);PINC
-#define BUILTIN1(v,t) isleafmethod=false;iptr->opc=ICMD_BUILTIN1;iptr->op1=t;\
- iptr->val.a=(v);PINC
-#define BUILTIN2(v,t) isleafmethod=false;iptr->opc=ICMD_BUILTIN2;iptr->op1=t;\
- iptr->val.a=(v);PINC
-#define BUILTIN3(v,t) isleafmethod=false;iptr->opc=ICMD_BUILTIN3;iptr->op1=t;\
- iptr->val.a=(v);PINC
+#define OP2A(o,o1,v,l) iptr->opc=(o);iptr->op1=(o1);iptr->val.a=(v);iptr->line=l;PINC
+#define BUILTIN1(v,t,l) isleafmethod=false;iptr->opc=ICMD_BUILTIN1;iptr->op1=t;\
+ iptr->val.a=(v);iptr->line=l;PINC
+#define BUILTIN2(v,t,l) isleafmethod=false;iptr->opc=ICMD_BUILTIN2;iptr->op1=t;\
+ iptr->val.a=(v);iptr->line=l;PINC
+#define BUILTIN3(v,t,l) isleafmethod=false;iptr->opc=ICMD_BUILTIN3;iptr->op1=t;\
+ iptr->val.a=(v);iptr->line=l;PINC
/* We have to check local variables indices here because they are
* used in stack.c to index the locals array. */
xtable* nextex; /* points next free entry in extable */
u1 *instructionstart; /* 1 for pcs which are valid instr. starts */
+ u2 lineindex=0;
+ u2 currentline=0;
+ u2 linepcchange=0;
+
bool useinltmp;
if (compileverbose) {
#endif
/* scan all java instructions */
+ currentline=0;
+ linepcchange=0;
+ if (jlinenumbercount==0) {
+ lineindex=0;
+ } else {
+ linepcchange=jlinenumbers[0].start_pc;
+ }
for (p = 0, gp = 0; p < jcodelength; gp += (nextp - p), p = nextp) {
/* DEBUG */ /*printf("p:%d gp:%d ",p,gp);*/
/* mark this position as a valid instruction start */
- if (!iswide)
+ if (!iswide) {
instructionstart[p] = 1;
+ if (linepcchange==p) {
+ if (jlinenumbercount>lineindex) {
+ currentline=jlinenumbers[lineindex].line_number;
+ lineindex++;
+ if (lineindex<jlinenumbercount)
+ linepcchange=jlinenumbers[lineindex].start_pc;
+/* printf("Line number changed to: %ld\n",currentline);*/
+ }
+ }
+ }
/*INLINING*/
if ((useinlining) && (gp == nextgp)) {
OP2I(ICMD_CHECKASIZE, 0, 0);
switch (code_get_s1(p + 1)) {
case 4:
- BUILTIN1(BUILTIN_newarray_boolean, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_boolean, TYPE_ADR,currentline);
break;
case 5:
- BUILTIN1(BUILTIN_newarray_char, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_char, TYPE_ADR,currentline);
break;
case 6:
- BUILTIN1(BUILTIN_newarray_float, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_float, TYPE_ADR,currentline);
break;
case 7:
- BUILTIN1(BUILTIN_newarray_double, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_double, TYPE_ADR,currentline);
break;
case 8:
- BUILTIN1(BUILTIN_newarray_byte, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_byte, TYPE_ADR,currentline);
break;
case 9:
- BUILTIN1(BUILTIN_newarray_short, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_short, TYPE_ADR,currentline);
break;
case 10:
- BUILTIN1(BUILTIN_newarray_int, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_int, TYPE_ADR,currentline);
break;
case 11:
- BUILTIN1(BUILTIN_newarray_long, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_long, TYPE_ADR,currentline);
break;
default: panic("Invalid array-type to create");
}
s_count++;
- BUILTIN2(BUILTIN_newarray, TYPE_ADR);
+ BUILTIN2(BUILTIN_newarray, TYPE_ADR,currentline);
}
break;
{
int v = code_get_u1(p + 3);
vftbl *arrayvftbl = ((classinfo*)class_getconstant (class, i, CONSTANT_Class))->vftbl;
- OP2A(opcode, v, arrayvftbl);
+ OP2A(opcode, v, arrayvftbl,currentline);
}
break;
tablep = DMNEW(s4, num * 2 + 2);
}
- OP2A(opcode, 0, tablep);
+ OP2A(opcode, 0, tablep,currentline);
/* default target */
tablep = DMNEW(s4, num + 1 + 3);
}
- OP2A(opcode, 0, tablep);
+ OP2A(opcode, 0, tablep,currentline);
/* default target */
/* load and store of object fields *******************/
case JAVA_AASTORE:
- BUILTIN3(BUILTIN_aastore, TYPE_VOID);
+ BUILTIN3(BUILTIN_aastore, TYPE_VOID,currentline);
break;
case JAVA_PUTSTATIC:
fieldinfo *fi;
fr = class_getconstant(class, i, CONSTANT_Fieldref);
fi = class_findfield(fr->class, fr->name, fr->descriptor);
- OP2A(opcode, fi->type, fi);
+ OP2A(opcode, fi->type, fi,currentline);
if (!fi->class->initialized) {
isleafmethod = false;
}
fieldinfo *fi;
fr = class_getconstant (class, i, CONSTANT_Fieldref);
fi = class_findfield (fr->class, fr->name, fr->descriptor);
- OP2A(opcode, fi->type, fi);
+ OP2A(opcode, fi->type, fi,currentline);
}
break;
descriptor2types(mi);
isleafmethod=false;
- OP2A(opcode, mi->paramcount, mi);
+ OP2A(opcode, mi->paramcount, mi,currentline);
}
break;
panic ("Static/Nonstatic mismatch calling static method");
descriptor2types(mi);
isleafmethod=false;
- OP2A(opcode, mi->paramcount, mi);
+ OP2A(opcode, mi->paramcount, mi,currentline);
}
break;
panic ("Static/Nonstatic mismatch calling static method");
descriptor2types(mi);
isleafmethod=false;
- OP2A(opcode, mi->paramcount, mi);
+ OP2A(opcode, mi->paramcount, mi,currentline);
}
break;
LOADCONST_A_BUILTIN(class_getconstant(class, i, CONSTANT_Class));
s_count++;
- BUILTIN1(BUILTIN_new, TYPE_ADR);
+ BUILTIN1(BUILTIN_new, TYPE_ADR,currentline);
break;
case JAVA_CHECKCAST:
/* array type cast-check */
LOADCONST_A_BUILTIN(cls->vftbl);
s_count++;
- BUILTIN2(BUILTIN_checkarraycast, TYPE_ADR);
+ BUILTIN2(BUILTIN_checkarraycast, TYPE_ADR,currentline);
}
else { /* object type cast-check */
/*
+ LOADCONST_A_BUILTIN(class_getconstant(class, i, CONSTANT_Class));
+ s_count++;
-+ BUILTIN2(BUILTIN_checkcast, TYPE_ADR);
++ BUILTIN2(BUILTIN_checkcast, TYPE_ADR,currentline);
+ */
- OP2A(opcode, 1, cls);
+ OP2A(opcode, 1, cls,currentline);
}
}
/* array type cast-check */
LOADCONST_A_BUILTIN(cls->vftbl);
s_count++;
- BUILTIN2(BUILTIN_arrayinstanceof, TYPE_INT);
+ BUILTIN2(BUILTIN_arrayinstanceof, TYPE_INT,currentline);
}
else { /* object type cast-check */
/*
LOADCONST_A_BUILTIN(class_getconstant(class, i, CONSTANT_Class));
s_count++;
- BUILTIN2(BUILTIN_instanceof, TYPE_INT);
+ BUILTIN2(BUILTIN_instanceof, TYPE_INT,currentline);
+ */
- OP2A(opcode, 1, cls);
+ OP2A(opcode, 1, cls,currentline);
}
}
break;
case JAVA_MONITORENTER:
#ifdef USE_THREADS
if (checksync) {
- BUILTIN1(BUILTIN_monitorenter, TYPE_VOID);
+ BUILTIN1(BUILTIN_monitorenter, TYPE_VOID,currentline);
} else
#endif
{
case JAVA_MONITOREXIT:
#ifdef USE_THREADS
if (checksync) {
- BUILTIN1(BUILTIN_monitorexit, TYPE_VOID);
+ BUILTIN1(BUILTIN_monitorexit, TYPE_VOID,currentline);
}
else
#endif
#if defined(__I386__)
OP(opcode);
#else
- BUILTIN2(BUILTIN_frem, TYPE_FLOAT);
+ BUILTIN2(BUILTIN_frem, TYPE_FLOAT,currentline);
#endif
break;
#if defined(__I386__)
OP(opcode);
#else
- BUILTIN2(BUILTIN_drem, TYPE_DOUBLE);
+ BUILTIN2(BUILTIN_drem, TYPE_DOUBLE,currentline);
#endif
break;
case JAVA_F2I:
#if defined(__ALPHA__)
if (!opt_noieee) {
- BUILTIN1(BUILTIN_f2i, TYPE_INT);
+ BUILTIN1(BUILTIN_f2i, TYPE_INT,currentline);
} else
#endif
{
case JAVA_F2L:
#if defined(__ALPHA__)
if (!opt_noieee) {
- BUILTIN1(BUILTIN_f2l, TYPE_LONG);
+ BUILTIN1(BUILTIN_f2l, TYPE_LONG,currentline);
} else
#endif
{
case JAVA_D2I:
#if defined(__ALPHA__)
if (!opt_noieee) {
- BUILTIN1(BUILTIN_d2i, TYPE_INT);
+ BUILTIN1(BUILTIN_d2i, TYPE_INT,currentline);
} else
#endif
{
case JAVA_D2L:
#if defined(__ALPHA__)
if (!opt_noieee) {
- BUILTIN1(BUILTIN_d2l, TYPE_LONG);
+ BUILTIN1(BUILTIN_d2l, TYPE_LONG,currentline);
} else
#endif
{
Mark Probst
Edwin Steiner
- $Id: loader.c 940 2004-03-06 14:04:15Z jowenn $
+ $Id: loader.c 941 2004-03-06 17:27:56Z jowenn $
*/
static utf *utf_constantvalue; /* ConstantValue */
static utf *utf_code; /* Code */
static utf *utf_exceptions; /* Exceptions */
+static utf *utf_linenumbertable; /* LineNumberTable */
static utf *utf_finalize; /* finalize */
static utf *utf_fidesc; /* ()V changed */
static utf *utf_init; /* <init> */
count_all_methods++;
#endif
m->thrownexceptionscount=0;
+ m->linenumbercount=0;
+ m->linenumbers=0;
m->class = c;
m->flags = suck_u2();
class_getconstant(c, idx, CONSTANT_Class);
}
}
-
- skipattributes(suck_u2());
+ {
+ u2 codeattrnum;
+ for (codeattrnum=suck_u2();codeattrnum>0;codeattrnum--) {
+ utf * caname = class_getconstant(c, suck_u2(), CONSTANT_Utf8);
+ if (caname==utf_linenumbertable) {
+ u2 lncid;
+ /*log_text("LineNumberTable found");*/
+ suck_u4();
+ m->linenumbercount=suck_u2();
+ /*printf("length:%d\n",m->linenumbercount);*/
+ m->linenumbers=MNEW(lineinfo,m->linenumbercount);
+ for (lncid=0;lncid<m->linenumbercount;lncid++) {
+ m->linenumbers[lncid].start_pc=suck_u2();
+ m->linenumbers[lncid].line_number=suck_u2();
+ }
+ codeattrnum--;
+ skipattributes(codeattrnum);
+ break;
+ } else skipattributebody();
+
+ }
+ }
}
}
utf_constantvalue = utf_new_char("ConstantValue");
utf_code = utf_new_char("Code");
utf_exceptions = utf_new_char("Exceptions");
+ utf_linenumbertable = utf_new_char("LineNumberTable");
utf_finalize = utf_new_char("finalize");
utf_fidesc = utf_new_char("()V");
utf_init = utf_new_char("<init>");
Philipp Tomsich
Edwin Steiner
- $Id: global.h 940 2004-03-06 14:04:15Z jowenn $
+ $Id: global.h 941 2004-03-06 17:27:56Z jowenn $
*/
typedef u1* methodptr;
typedef struct fieldinfo fieldinfo;
typedef struct methodinfo methodinfo;
+typedef struct lineinfo lineinfo;
typedef struct arraydescriptor arraydescriptor;
} xtainfo;
+/* lineinfo *****************************************************************/
+struct lineinfo {
+ u2 start_pc;
+ u2 line_number;
+};
+
/* methodinfo *****************************************************************/
struct methodinfo { /* method structure */
u1 *jcode; /* pointer to JavaVM code */
s4 exceptiontablelength;/* exceptiontable length */
- exceptiontable *exceptiontable;
+ exceptiontable *exceptiontable; /* the exceptiontable */
+
+ u2 thrownexceptionscount; /*number of exceptions declared to be thrown by a method*/
+ classinfo **thrownexceptions; /*array of classinfos of declared exceptions*/
- u2 thrownexceptionscount;
- classinfo **thrownexceptions;
- /* the exceptiontable */
+ u2 linenumbercount; /*number of linenumber attributes*/
+ lineinfo *linenumbers; /*array of lineinfo items (start_pc,line_number)*/
u1 *stubroutine; /* stub for compiling or calling natives */
s4 mcodelength; /* legth of generated machine code */
Changes: Edwin Steiner
- $Id: jit.c 923 2004-02-24 13:28:08Z edwin $
+ $Id: jit.c 941 2004-03-06 17:27:56Z jowenn $
*/
int maxlocals; /* maximal number of local JavaVM variables */
int jcodelength; /* length of JavaVM-codes */
u1 *jcode; /* pointer to start of JavaVM-code */
+lineinfo *jlinenumbers; /* line information array */
+u2 jlinenumbercount; /* number of entries in the linenumber array */
int exceptiontablelength; /* length of exception table */
xtable *extable; /* pointer to start of exception table */
exceptiontable *raw_extable;
maxlocals = m->maxlocals;
jcodelength = m->jcodelength;
jcode = m->jcode;
+ jlinenumbers = m->linenumbers;
+ jlinenumbercount = m->linenumbercount;
exceptiontablelength = m->exceptiontablelength;
raw_extable = m->exceptiontable;
regs_ok = false;
Changes: Christian Thalinger
- $Id: jit.h 938 2004-03-06 00:56:43Z twisti $
+ $Id: jit.h 941 2004-03-06 17:27:56Z jowenn $
*/
u2 opc; /* opcode of intermediate code command */
s4 op1; /* first operand, usually variable number */
imm_union val; /* immediate constant */
- void *target; /* used for targets of branches and jumps */
- /* and as address for list of targets for */
- /* statements */
+ void *target; /* used for targets of branches and jumps */
+ /* and as address for list of targets for */
+ /* statements */
+ u2 line /* line number in source file */
};
extern int maxlocals; /* maximal number of local JavaVM variables */
extern int jcodelength; /* length of JavaVM-codes */
extern u1 *jcode; /* pointer to start of JavaVM-code */
+lineinfo *jlinenumbers; /* line information array */
+u2 jlinenumbercount; /* number of entries in the linenumber array */
extern int exceptiontablelength;/* length of exception table */
extern xtable *extable; /* pointer to start of exception table */
extern exceptiontable *raw_extable;
Changes: Carolyn Oates
Edwin Steiner
- $Id: parse.c 893 2004-01-19 12:53:24Z edwin $
+ $Id: parse.c 941 2004-03-06 17:27:56Z jowenn $
*/
#define OP(o) iptr->opc=(o);/*iptr->op1=0*/;/*iptr->val.l=0*/;PINC
#define OP1(o,o1) iptr->opc=(o);iptr->op1=(o1);/*iptr->val.l=(0)*/;PINC
#define OP2I(o,o1,v) iptr->opc=(o);iptr->op1=(o1);iptr->val.i=(v);PINC
-#define OP2A(o,o1,v) iptr->opc=(o);iptr->op1=(o1);iptr->val.a=(v);PINC
-#define BUILTIN1(v,t) isleafmethod=false;iptr->opc=ICMD_BUILTIN1;iptr->op1=t;\
- iptr->val.a=(v);PINC
-#define BUILTIN2(v,t) isleafmethod=false;iptr->opc=ICMD_BUILTIN2;iptr->op1=t;\
- iptr->val.a=(v);PINC
-#define BUILTIN3(v,t) isleafmethod=false;iptr->opc=ICMD_BUILTIN3;iptr->op1=t;\
- iptr->val.a=(v);PINC
+#define OP2A(o,o1,v,l) iptr->opc=(o);iptr->op1=(o1);iptr->val.a=(v);iptr->line=l;PINC
+#define BUILTIN1(v,t,l) isleafmethod=false;iptr->opc=ICMD_BUILTIN1;iptr->op1=t;\
+ iptr->val.a=(v);iptr->line=l;PINC
+#define BUILTIN2(v,t,l) isleafmethod=false;iptr->opc=ICMD_BUILTIN2;iptr->op1=t;\
+ iptr->val.a=(v);iptr->line=l;PINC
+#define BUILTIN3(v,t,l) isleafmethod=false;iptr->opc=ICMD_BUILTIN3;iptr->op1=t;\
+ iptr->val.a=(v);iptr->line=l;PINC
/* We have to check local variables indices here because they are
* used in stack.c to index the locals array. */
xtable* nextex; /* points next free entry in extable */
u1 *instructionstart; /* 1 for pcs which are valid instr. starts */
+ u2 lineindex=0;
+ u2 currentline=0;
+ u2 linepcchange=0;
+
bool useinltmp;
if (compileverbose) {
#endif
/* scan all java instructions */
+ currentline=0;
+ linepcchange=0;
+ if (jlinenumbercount==0) {
+ lineindex=0;
+ } else {
+ linepcchange=jlinenumbers[0].start_pc;
+ }
for (p = 0, gp = 0; p < jcodelength; gp += (nextp - p), p = nextp) {
/* DEBUG */ /*printf("p:%d gp:%d ",p,gp);*/
/* mark this position as a valid instruction start */
- if (!iswide)
+ if (!iswide) {
instructionstart[p] = 1;
+ if (linepcchange==p) {
+ if (jlinenumbercount>lineindex) {
+ currentline=jlinenumbers[lineindex].line_number;
+ lineindex++;
+ if (lineindex<jlinenumbercount)
+ linepcchange=jlinenumbers[lineindex].start_pc;
+/* printf("Line number changed to: %ld\n",currentline);*/
+ }
+ }
+ }
/*INLINING*/
if ((useinlining) && (gp == nextgp)) {
OP2I(ICMD_CHECKASIZE, 0, 0);
switch (code_get_s1(p + 1)) {
case 4:
- BUILTIN1(BUILTIN_newarray_boolean, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_boolean, TYPE_ADR,currentline);
break;
case 5:
- BUILTIN1(BUILTIN_newarray_char, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_char, TYPE_ADR,currentline);
break;
case 6:
- BUILTIN1(BUILTIN_newarray_float, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_float, TYPE_ADR,currentline);
break;
case 7:
- BUILTIN1(BUILTIN_newarray_double, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_double, TYPE_ADR,currentline);
break;
case 8:
- BUILTIN1(BUILTIN_newarray_byte, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_byte, TYPE_ADR,currentline);
break;
case 9:
- BUILTIN1(BUILTIN_newarray_short, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_short, TYPE_ADR,currentline);
break;
case 10:
- BUILTIN1(BUILTIN_newarray_int, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_int, TYPE_ADR,currentline);
break;
case 11:
- BUILTIN1(BUILTIN_newarray_long, TYPE_ADR);
+ BUILTIN1(BUILTIN_newarray_long, TYPE_ADR,currentline);
break;
default: panic("Invalid array-type to create");
}
s_count++;
- BUILTIN2(BUILTIN_newarray, TYPE_ADR);
+ BUILTIN2(BUILTIN_newarray, TYPE_ADR,currentline);
}
break;
{
int v = code_get_u1(p + 3);
vftbl *arrayvftbl = ((classinfo*)class_getconstant (class, i, CONSTANT_Class))->vftbl;
- OP2A(opcode, v, arrayvftbl);
+ OP2A(opcode, v, arrayvftbl,currentline);
}
break;
tablep = DMNEW(s4, num * 2 + 2);
}
- OP2A(opcode, 0, tablep);
+ OP2A(opcode, 0, tablep,currentline);
/* default target */
tablep = DMNEW(s4, num + 1 + 3);
}
- OP2A(opcode, 0, tablep);
+ OP2A(opcode, 0, tablep,currentline);
/* default target */
/* load and store of object fields *******************/
case JAVA_AASTORE:
- BUILTIN3(BUILTIN_aastore, TYPE_VOID);
+ BUILTIN3(BUILTIN_aastore, TYPE_VOID,currentline);
break;
case JAVA_PUTSTATIC:
fieldinfo *fi;
fr = class_getconstant(class, i, CONSTANT_Fieldref);
fi = class_findfield(fr->class, fr->name, fr->descriptor);
- OP2A(opcode, fi->type, fi);
+ OP2A(opcode, fi->type, fi,currentline);
if (!fi->class->initialized) {
isleafmethod = false;
}
fieldinfo *fi;
fr = class_getconstant (class, i, CONSTANT_Fieldref);
fi = class_findfield (fr->class, fr->name, fr->descriptor);
- OP2A(opcode, fi->type, fi);
+ OP2A(opcode, fi->type, fi,currentline);
}
break;
descriptor2types(mi);
isleafmethod=false;
- OP2A(opcode, mi->paramcount, mi);
+ OP2A(opcode, mi->paramcount, mi,currentline);
}
break;
panic ("Static/Nonstatic mismatch calling static method");
descriptor2types(mi);
isleafmethod=false;
- OP2A(opcode, mi->paramcount, mi);
+ OP2A(opcode, mi->paramcount, mi,currentline);
}
break;
panic ("Static/Nonstatic mismatch calling static method");
descriptor2types(mi);
isleafmethod=false;
- OP2A(opcode, mi->paramcount, mi);
+ OP2A(opcode, mi->paramcount, mi,currentline);
}
break;
LOADCONST_A_BUILTIN(class_getconstant(class, i, CONSTANT_Class));
s_count++;
- BUILTIN1(BUILTIN_new, TYPE_ADR);
+ BUILTIN1(BUILTIN_new, TYPE_ADR,currentline);
break;
case JAVA_CHECKCAST:
/* array type cast-check */
LOADCONST_A_BUILTIN(cls->vftbl);
s_count++;
- BUILTIN2(BUILTIN_checkarraycast, TYPE_ADR);
+ BUILTIN2(BUILTIN_checkarraycast, TYPE_ADR,currentline);
}
else { /* object type cast-check */
/*
+ LOADCONST_A_BUILTIN(class_getconstant(class, i, CONSTANT_Class));
+ s_count++;
-+ BUILTIN2(BUILTIN_checkcast, TYPE_ADR);
++ BUILTIN2(BUILTIN_checkcast, TYPE_ADR,currentline);
+ */
- OP2A(opcode, 1, cls);
+ OP2A(opcode, 1, cls,currentline);
}
}
/* array type cast-check */
LOADCONST_A_BUILTIN(cls->vftbl);
s_count++;
- BUILTIN2(BUILTIN_arrayinstanceof, TYPE_INT);
+ BUILTIN2(BUILTIN_arrayinstanceof, TYPE_INT,currentline);
}
else { /* object type cast-check */
/*
LOADCONST_A_BUILTIN(class_getconstant(class, i, CONSTANT_Class));
s_count++;
- BUILTIN2(BUILTIN_instanceof, TYPE_INT);
+ BUILTIN2(BUILTIN_instanceof, TYPE_INT,currentline);
+ */
- OP2A(opcode, 1, cls);
+ OP2A(opcode, 1, cls,currentline);
}
}
break;
case JAVA_MONITORENTER:
#ifdef USE_THREADS
if (checksync) {
- BUILTIN1(BUILTIN_monitorenter, TYPE_VOID);
+ BUILTIN1(BUILTIN_monitorenter, TYPE_VOID,currentline);
} else
#endif
{
case JAVA_MONITOREXIT:
#ifdef USE_THREADS
if (checksync) {
- BUILTIN1(BUILTIN_monitorexit, TYPE_VOID);
+ BUILTIN1(BUILTIN_monitorexit, TYPE_VOID,currentline);
}
else
#endif
#if defined(__I386__)
OP(opcode);
#else
- BUILTIN2(BUILTIN_frem, TYPE_FLOAT);
+ BUILTIN2(BUILTIN_frem, TYPE_FLOAT,currentline);
#endif
break;
#if defined(__I386__)
OP(opcode);
#else
- BUILTIN2(BUILTIN_drem, TYPE_DOUBLE);
+ BUILTIN2(BUILTIN_drem, TYPE_DOUBLE,currentline);
#endif
break;
case JAVA_F2I:
#if defined(__ALPHA__)
if (!opt_noieee) {
- BUILTIN1(BUILTIN_f2i, TYPE_INT);
+ BUILTIN1(BUILTIN_f2i, TYPE_INT,currentline);
} else
#endif
{
case JAVA_F2L:
#if defined(__ALPHA__)
if (!opt_noieee) {
- BUILTIN1(BUILTIN_f2l, TYPE_LONG);
+ BUILTIN1(BUILTIN_f2l, TYPE_LONG,currentline);
} else
#endif
{
case JAVA_D2I:
#if defined(__ALPHA__)
if (!opt_noieee) {
- BUILTIN1(BUILTIN_d2i, TYPE_INT);
+ BUILTIN1(BUILTIN_d2i, TYPE_INT,currentline);
} else
#endif
{
case JAVA_D2L:
#if defined(__ALPHA__)
if (!opt_noieee) {
- BUILTIN1(BUILTIN_d2l, TYPE_LONG);
+ BUILTIN1(BUILTIN_d2l, TYPE_LONG,currentline);
} else
#endif
{
Mark Probst
Edwin Steiner
- $Id: loader.c 940 2004-03-06 14:04:15Z jowenn $
+ $Id: loader.c 941 2004-03-06 17:27:56Z jowenn $
*/
static utf *utf_constantvalue; /* ConstantValue */
static utf *utf_code; /* Code */
static utf *utf_exceptions; /* Exceptions */
+static utf *utf_linenumbertable; /* LineNumberTable */
static utf *utf_finalize; /* finalize */
static utf *utf_fidesc; /* ()V changed */
static utf *utf_init; /* <init> */
count_all_methods++;
#endif
m->thrownexceptionscount=0;
+ m->linenumbercount=0;
+ m->linenumbers=0;
m->class = c;
m->flags = suck_u2();
class_getconstant(c, idx, CONSTANT_Class);
}
}
-
- skipattributes(suck_u2());
+ {
+ u2 codeattrnum;
+ for (codeattrnum=suck_u2();codeattrnum>0;codeattrnum--) {
+ utf * caname = class_getconstant(c, suck_u2(), CONSTANT_Utf8);
+ if (caname==utf_linenumbertable) {
+ u2 lncid;
+ /*log_text("LineNumberTable found");*/
+ suck_u4();
+ m->linenumbercount=suck_u2();
+ /*printf("length:%d\n",m->linenumbercount);*/
+ m->linenumbers=MNEW(lineinfo,m->linenumbercount);
+ for (lncid=0;lncid<m->linenumbercount;lncid++) {
+ m->linenumbers[lncid].start_pc=suck_u2();
+ m->linenumbers[lncid].line_number=suck_u2();
+ }
+ codeattrnum--;
+ skipattributes(codeattrnum);
+ break;
+ } else skipattributebody();
+
+ }
+ }
}
}
utf_constantvalue = utf_new_char("ConstantValue");
utf_code = utf_new_char("Code");
utf_exceptions = utf_new_char("Exceptions");
+ utf_linenumbertable = utf_new_char("LineNumberTable");
utf_finalize = utf_new_char("finalize");
utf_fidesc = utf_new_char("()V");
utf_init = utf_new_char("<init>");