Fix a crash in the code which tests, if a method is identifyable by name and paramete...
authorjowenn <none@none>
Mon, 11 Oct 2004 20:12:08 +0000 (20:12 +0000)
committerjowenn <none@none>
Mon, 11 Oct 2004 20:12:08 +0000 (20:12 +0000)
Make inlining work again on i386. Alpha should work, but it is not tested

29 files changed:
configure.in
global.h
jit/alpha/codegen.c
jit/codegen.inc
jit/codegen.inc.h
jit/i386/codegen.c
jit/inline.c
jit/inline.h
jit/jit.c
jit/parse.c
jit/stack.c
jit/stack.h
jit/typecheck.c
jit/typecheck.h
loader.c
src/vm/global.h
src/vm/jit/alpha/codegen.c
src/vm/jit/codegen.inc
src/vm/jit/codegen.inc.h
src/vm/jit/i386/codegen.c
src/vm/jit/inline/inline.c
src/vm/jit/inline/inline.h
src/vm/jit/jit.c
src/vm/jit/parse.c
src/vm/jit/stack.c
src/vm/jit/stack.h
src/vm/jit/verify/typecheck.c
src/vm/jit/verify/typecheck.h
src/vm/loader.c

index e91572d360953068e4688ac68312ba3134258348..3ddf7bc0c8211f305739401a38370427ff5015a1 100644 (file)
@@ -239,6 +239,7 @@ dnl enable gtk peer
 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\
@@ -285,6 +286,7 @@ if test x"$enable_gtk_peer" = "xyes"; then
                AC_DEFINE([USE_GTK], 1, [use gtk])
 
 else
+       CACAO_GTK=no
        AWT_OBJS=""
        AWTPEERS=""
        USEGTK="no"
@@ -300,6 +302,7 @@ fi
 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)
 
 
index 538bf874f50f3215045bfddf47271a9d6abbfb2b..8081e92769597adbda5abfcdb83764f648ca3d89 100644 (file)
--- a/global.h
+++ b/global.h
@@ -31,7 +31,7 @@
             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
index b39647a9daff4d3d883e6674d7f9251bea8b7fa4..9b12a802e8278e9ca7dc485dd1ed84293374997f 100644 (file)
@@ -28,7 +28,7 @@
    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 $
 
 */
 
@@ -295,11 +295,11 @@ void codegen(methodinfo *m)
 
        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);
@@ -3569,7 +3569,7 @@ gen_method: {
        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);
@@ -3627,7 +3627,7 @@ gen_method: {
        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);
@@ -3685,7 +3685,7 @@ gen_method: {
        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);
@@ -3748,7 +3748,7 @@ gen_method: {
        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);
index 9e3b0359e8e619cfcb5989eced0f49180b3be45f..6736609515f146658d4e5138c98cbc9743ff6467 100644 (file)
@@ -48,7 +48,7 @@
    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 $
 
 */
 
@@ -113,7 +113,7 @@ void codegen_init()
 
 *******************************************************************************/
 
-void codegen_setup(methodinfo *m)
+void codegen_setup(methodinfo *m, t_inlining_globals * e)
 {
        codegendata *cd;
 
@@ -143,6 +143,19 @@ void codegen_setup(methodinfo *m)
        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;
@@ -160,6 +173,12 @@ void codegen_close(methodinfo *m)
        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;
index 0f8193ed83f3b34e13c212da0318083eeb1675f3..6b57ed670a820441f6a42c69f1a0404a23f89bb3 100644 (file)
@@ -26,7 +26,7 @@
 
    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 $
 
 */
 
@@ -39,6 +39,8 @@
 #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 */
 
@@ -95,6 +97,10 @@ struct codegendata {
        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             */
@@ -148,7 +154,7 @@ struct _methodtree_element {
 /* 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);
index 8f3072ba6cfd360ef831e6d492e7b1837ebeda9b..94ab359b1ca6dc86263fe2b80b8d0e7a7a8f3544 100644 (file)
@@ -28,7 +28,7 @@
    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 $
 
 */
 
@@ -308,11 +308,11 @@ void codegen(methodinfo *m)
           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);
@@ -4423,7 +4423,7 @@ gen_method: {
        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));
@@ -4472,7 +4472,7 @@ gen_method: {
        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));
@@ -4522,7 +4522,7 @@ gen_method: {
        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));
@@ -4571,7 +4571,7 @@ gen_method: {
        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));
@@ -4659,7 +4659,7 @@ java stack at this point*/
        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));
@@ -4747,7 +4747,7 @@ u1 *createcompilerstub(methodinfo *m)
        codegendata *cd;
 
        /* setup codegendata structure */
-       codegen_setup(m);
+       codegen_setup(m,0);
 
        cd = m->codegendata;
     cd->mcodeptr = s;
@@ -4834,7 +4834,7 @@ u1 *createnativestub(functionptr f, methodinfo *m)
        codegendata *cd;
 
        /* setup codegendata structure */
-       codegen_setup(m);
+       codegen_setup(m,0);
 
        cd = m->codegendata;
        cd->mcodeptr = s;
index 6c264780484ae44b0f732ce5534a43caabcba62b..1f59f473b59202c6fd1d892c62d9b53bd5080838 100644 (file)
@@ -28,7 +28,7 @@ globals moved to structure and passed as parameter
 
    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 $
 
 */
 
@@ -128,7 +128,7 @@ void inlining_cleanup(t_inlining_globals *inline_env)
 }
 
 
-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);
 
@@ -137,15 +137,19 @@ void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, inlin
        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)
 {
@@ -158,6 +162,11 @@ void inlining_pop_compiler_variables(
        *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*/
@@ -441,6 +450,7 @@ inlining_methodinfo *inlining_analyse_method(methodinfo *m,
                                                        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)) && 
index 2b05d4baf14594304c2ed37de4f574d1fe275bc0..8c1b76b434070da1696c5118def33e419520f9d8 100644 (file)
@@ -26,7 +26,7 @@
 
    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 $
 
 */
 
@@ -92,7 +92,9 @@ typedef struct {
     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;
@@ -117,10 +119,12 @@ t_inlining_globals *inlining_init(methodinfo *m);
 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, 
@@ -137,10 +141,12 @@ void print_inlining_stack     ( list                *s);
 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,&currentline,&linepcchange,&inlinfo, \
        inline_env)
 
 #define inlining_set_compiler_variables(i) \
index 69f0cf637e71908e56ea45e8692b8d4815529fea..091ae5b65e02bd0b8a6fd38fe72c4617ffc861cc 100644 (file)
--- a/jit/jit.c
+++ b/jit/jit.c
@@ -29,7 +29,7 @@
 
    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 $
 
 */
 
@@ -60,7 +60,8 @@
 #include "loop/analyze.h"
 #include "toolbox/logging.h"
 #include "toolbox/memory.h"
-
+#include "types.h"
+#include <stdio.h>
 
 /* global switches ************************************************************/
 
@@ -1210,6 +1211,19 @@ static int builtintablelen;
 #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
 
@@ -1388,7 +1402,7 @@ methodptr jit_compile(methodinfo *m)
        m->basicblockindex = NULL;
        m->instructions = NULL;
        m->stack = NULL;
-       m->exceptiontable = NULL;
+       /* NO !!! m->exceptiontable = NULL; */
 
        /* release dump area */
 
@@ -1472,6 +1486,7 @@ t_inlining_globals *inline_env = NULL;
 
        /* call the compiler passes ***********************************************/
 
+       EXTABLEN
        /* first of all initialize the register allocator */
        reg_init(m);
 
@@ -1479,10 +1494,14 @@ t_inlining_globals *inline_env = NULL;
         /* 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);
@@ -1499,7 +1518,8 @@ t_inlining_globals *inline_env = NULL;
                log_message_method("Analysing: ", m);
        }
 
-       if (!analyse_stack(m)) {
+
+       if (!analyse_stack(m->codegendata)) {
                if (compileverbose)
                        log_message_method("Exception while analysing: ", m);
 
@@ -1514,7 +1534,7 @@ t_inlining_globals *inline_env = NULL;
                if (compileverbose)
                        log_message_method("Typechecking: ", m);
 
-               if (!typecheck(m)) {
+               if (!typecheck(m->codegendata)) {
                        if (compileverbose)
                                log_message_method("Exception while typechecking: ", m);
 
@@ -1525,7 +1545,6 @@ t_inlining_globals *inline_env = NULL;
                        log_message_method("Typechecking done: ", m);
        }
 #endif
-       
        if (opt_loops) {
                depthFirst(m);
                analyseGraph(m);
index 8719e5d5620a8b9998ba272429480a7ed0bb2a70..12ee09fe75dcb070f36b692ec306e21e17e0c1f2 100644 (file)
@@ -29,7 +29,7 @@
    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.
 */
@@ -374,6 +374,7 @@ static exceptiontable* fillextable(methodinfo *m,
        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;
@@ -384,6 +385,9 @@ if (DEBUG3==true) {printf("B1 EEE1 \t"); fflush(stdout);}
                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);
@@ -435,7 +439,7 @@ methodinfo *parse(methodinfo *m, t_inlining_globals *inline_env)
        u2 lineindex=0;
        u2 currentline=0;
        u2 linepcchange=0;
-
+       codegendata *cd=m->codegendata;
 
 if (DEBUG==true) {printf("PARSING: "); fflush(stdout);
 DEBUGMETH(m);
@@ -444,7 +448,7 @@ 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;
@@ -500,7 +504,7 @@ DEBUGMETH(m);
 //     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   */
 
@@ -530,11 +534,11 @@ DEBUGMETH(m);
                        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);*/
                                }
                        }
@@ -572,7 +576,7 @@ DEBUGMETH(m);
                                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);
@@ -1670,8 +1674,8 @@ if (DEBUG==true) printf("&&&&&&&&&&&&&&&&\n");
 
                /* 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])
@@ -1711,22 +1715,19 @@ if (DEBUG==true) printf("&&&&&&&&&&&&&&&&\n");
                (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];
            }
        }
        
index 9a45b8a234db303a03ebaaa931547ac92193b9d8..da3ccbf6f3a42b05e9d57daac6b79607cd11c6f7 100644 (file)
@@ -28,7 +28,7 @@
 
    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 $
 
 */
 
@@ -76,7 +76,7 @@
  * types are not discerned.
  */
 
-methodinfo *analyse_stack(methodinfo *m)
+methodinfo *analyse_stack(codegendata *codegendata)
 {
        int b_count;
        int b_index;
@@ -92,6 +92,7 @@ methodinfo *analyse_stack(methodinfo *m)
        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++)
@@ -104,8 +105,8 @@ methodinfo *analyse_stack(methodinfo *m)
        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;
@@ -2132,8 +2133,8 @@ void show_icmd_method(methodinfo *m)
 
        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);
index 05b77a668e9e38d97367f12e1552fb8a325c33c0..c993b1495131faaf43bd104994917a1e2a93f3e3 100644 (file)
@@ -26,7 +26,7 @@
 
    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);
index be479ec1f0c96093aa7c847fea51b28a5b95c292..76be4259cc33b530fd312e9f0caaca311ec01a18 100644 (file)
@@ -26,7 +26,7 @@
 
    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 $
 
 */
 
@@ -778,7 +778,7 @@ is_accessible(int flags,classinfo *definingclass,classinfo *implementingclass, c
 
 /* 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 */
@@ -821,6 +821,7 @@ methodinfo *typecheck(methodinfo *m)
        bool jsrencountered = false;         /* true if we there was a JSR */
 
     classinfo *myclass;
+    methodinfo *m=codegendata->method;
 
 #ifdef TYPECHECK_STATISTICS
        int count_iterations = 0;
@@ -892,7 +893,7 @@ methodinfo *typecheck(methodinfo *m)
     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 */
@@ -968,10 +969,10 @@ methodinfo *typecheck(methodinfo *m)
                 /* 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;
index 9dfded64b15c1c1f2441c8deffa43b55dcbe404d..af10c128f52e4c917be09ef6e8263030a6c730b6 100644 (file)
@@ -26,7 +26,7 @@
 
    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 $
 
 */
 
@@ -35,8 +35,8 @@
 #define _TYPECHECK_H
 
 /* function prototypes */
-
-methodinfo *typecheck(methodinfo *m);
+struct codegendata;
+methodinfo *typecheck(codegendata *codegendata);
 
 #endif /* _TYPECHECK_H */
 
index f5d29f58327778272812d1b33b928c01fc300a2a..bdfe7d691199c80fdd3d742dc47a8b15bebc93da 100644 (file)
--- a/loader.c
+++ b/loader.c
@@ -32,7 +32,7 @@
             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 $
 
 */
 
@@ -1337,6 +1337,10 @@ static bool method_load(classbuffer *cb, classinfo *c, methodinfo *m)
                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) {
@@ -1417,7 +1421,6 @@ static bool method_load(classbuffer *cb, classinfo *c, methodinfo *m)
                                return false;
 
                        m->exceptiontablelength = suck_u2(cb);
-
                        if (!check_classbuffer_size(cb, (2 + 2 + 2 + 2) * m->exceptiontablelength))
                                return false;
 
@@ -1532,6 +1535,8 @@ static bool method_load(classbuffer *cb, classinfo *c, methodinfo *m)
        }
 
        /* everything was ok */
+       /*              utf_display(m->name);
+                       printf("\nexceptiontablelength:%ld\n",m->exceptiontablelength);*/
 
        return true;
 }
@@ -2374,7 +2379,7 @@ classinfo *class_load_intern(classbuffer *cb)
                }
                
                /* 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;
@@ -2383,6 +2388,13 @@ classinfo *class_load_intern(classbuffer *cb)
                        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;
index 538bf874f50f3215045bfddf47271a9d6abbfb2b..8081e92769597adbda5abfcdb83764f648ca3d89 100644 (file)
@@ -31,7 +31,7 @@
             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
index b39647a9daff4d3d883e6674d7f9251bea8b7fa4..9b12a802e8278e9ca7dc485dd1ed84293374997f 100644 (file)
@@ -28,7 +28,7 @@
    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 $
 
 */
 
@@ -295,11 +295,11 @@ void codegen(methodinfo *m)
 
        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);
@@ -3569,7 +3569,7 @@ gen_method: {
        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);
@@ -3627,7 +3627,7 @@ gen_method: {
        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);
@@ -3685,7 +3685,7 @@ gen_method: {
        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);
@@ -3748,7 +3748,7 @@ gen_method: {
        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);
index 9e3b0359e8e619cfcb5989eced0f49180b3be45f..6736609515f146658d4e5138c98cbc9743ff6467 100644 (file)
@@ -48,7 +48,7 @@
    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 $
 
 */
 
@@ -113,7 +113,7 @@ void codegen_init()
 
 *******************************************************************************/
 
-void codegen_setup(methodinfo *m)
+void codegen_setup(methodinfo *m, t_inlining_globals * e)
 {
        codegendata *cd;
 
@@ -143,6 +143,19 @@ void codegen_setup(methodinfo *m)
        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;
@@ -160,6 +173,12 @@ void codegen_close(methodinfo *m)
        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;
index 0f8193ed83f3b34e13c212da0318083eeb1675f3..6b57ed670a820441f6a42c69f1a0404a23f89bb3 100644 (file)
@@ -26,7 +26,7 @@
 
    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 $
 
 */
 
@@ -39,6 +39,8 @@
 #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 */
 
@@ -95,6 +97,10 @@ struct codegendata {
        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             */
@@ -148,7 +154,7 @@ struct _methodtree_element {
 /* 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);
index 8f3072ba6cfd360ef831e6d492e7b1837ebeda9b..94ab359b1ca6dc86263fe2b80b8d0e7a7a8f3544 100644 (file)
@@ -28,7 +28,7 @@
    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 $
 
 */
 
@@ -308,11 +308,11 @@ void codegen(methodinfo *m)
           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);
@@ -4423,7 +4423,7 @@ gen_method: {
        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));
@@ -4472,7 +4472,7 @@ gen_method: {
        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));
@@ -4522,7 +4522,7 @@ gen_method: {
        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));
@@ -4571,7 +4571,7 @@ gen_method: {
        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));
@@ -4659,7 +4659,7 @@ java stack at this point*/
        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));
@@ -4747,7 +4747,7 @@ u1 *createcompilerstub(methodinfo *m)
        codegendata *cd;
 
        /* setup codegendata structure */
-       codegen_setup(m);
+       codegen_setup(m,0);
 
        cd = m->codegendata;
     cd->mcodeptr = s;
@@ -4834,7 +4834,7 @@ u1 *createnativestub(functionptr f, methodinfo *m)
        codegendata *cd;
 
        /* setup codegendata structure */
-       codegen_setup(m);
+       codegen_setup(m,0);
 
        cd = m->codegendata;
        cd->mcodeptr = s;
index 6c264780484ae44b0f732ce5534a43caabcba62b..1f59f473b59202c6fd1d892c62d9b53bd5080838 100644 (file)
@@ -28,7 +28,7 @@ globals moved to structure and passed as parameter
 
    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 $
 
 */
 
@@ -128,7 +128,7 @@ void inlining_cleanup(t_inlining_globals *inline_env)
 }
 
 
-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);
 
@@ -137,15 +137,19 @@ void inlining_push_compiler_variables(int i, int p, int nextp, int opcode, inlin
        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)
 {
@@ -158,6 +162,11 @@ void inlining_pop_compiler_variables(
        *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*/
@@ -441,6 +450,7 @@ inlining_methodinfo *inlining_analyse_method(methodinfo *m,
                                                        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)) && 
index 2b05d4baf14594304c2ed37de4f574d1fe275bc0..8c1b76b434070da1696c5118def33e419520f9d8 100644 (file)
@@ -26,7 +26,7 @@
 
    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 $
 
 */
 
@@ -92,7 +92,9 @@ typedef struct {
     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;
@@ -117,10 +119,12 @@ t_inlining_globals *inlining_init(methodinfo *m);
 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, 
@@ -137,10 +141,12 @@ void print_inlining_stack     ( list                *s);
 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,&currentline,&linepcchange,&inlinfo, \
        inline_env)
 
 #define inlining_set_compiler_variables(i) \
index 69f0cf637e71908e56ea45e8692b8d4815529fea..091ae5b65e02bd0b8a6fd38fe72c4617ffc861cc 100644 (file)
@@ -29,7 +29,7 @@
 
    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 $
 
 */
 
@@ -60,7 +60,8 @@
 #include "loop/analyze.h"
 #include "toolbox/logging.h"
 #include "toolbox/memory.h"
-
+#include "types.h"
+#include <stdio.h>
 
 /* global switches ************************************************************/
 
@@ -1210,6 +1211,19 @@ static int builtintablelen;
 #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
 
@@ -1388,7 +1402,7 @@ methodptr jit_compile(methodinfo *m)
        m->basicblockindex = NULL;
        m->instructions = NULL;
        m->stack = NULL;
-       m->exceptiontable = NULL;
+       /* NO !!! m->exceptiontable = NULL; */
 
        /* release dump area */
 
@@ -1472,6 +1486,7 @@ t_inlining_globals *inline_env = NULL;
 
        /* call the compiler passes ***********************************************/
 
+       EXTABLEN
        /* first of all initialize the register allocator */
        reg_init(m);
 
@@ -1479,10 +1494,14 @@ t_inlining_globals *inline_env = NULL;
         /* 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);
@@ -1499,7 +1518,8 @@ t_inlining_globals *inline_env = NULL;
                log_message_method("Analysing: ", m);
        }
 
-       if (!analyse_stack(m)) {
+
+       if (!analyse_stack(m->codegendata)) {
                if (compileverbose)
                        log_message_method("Exception while analysing: ", m);
 
@@ -1514,7 +1534,7 @@ t_inlining_globals *inline_env = NULL;
                if (compileverbose)
                        log_message_method("Typechecking: ", m);
 
-               if (!typecheck(m)) {
+               if (!typecheck(m->codegendata)) {
                        if (compileverbose)
                                log_message_method("Exception while typechecking: ", m);
 
@@ -1525,7 +1545,6 @@ t_inlining_globals *inline_env = NULL;
                        log_message_method("Typechecking done: ", m);
        }
 #endif
-       
        if (opt_loops) {
                depthFirst(m);
                analyseGraph(m);
index 8719e5d5620a8b9998ba272429480a7ed0bb2a70..12ee09fe75dcb070f36b692ec306e21e17e0c1f2 100644 (file)
@@ -29,7 +29,7 @@
    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.
 */
@@ -374,6 +374,7 @@ static exceptiontable* fillextable(methodinfo *m,
        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;
@@ -384,6 +385,9 @@ if (DEBUG3==true) {printf("B1 EEE1 \t"); fflush(stdout);}
                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);
@@ -435,7 +439,7 @@ methodinfo *parse(methodinfo *m, t_inlining_globals *inline_env)
        u2 lineindex=0;
        u2 currentline=0;
        u2 linepcchange=0;
-
+       codegendata *cd=m->codegendata;
 
 if (DEBUG==true) {printf("PARSING: "); fflush(stdout);
 DEBUGMETH(m);
@@ -444,7 +448,7 @@ 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;
@@ -500,7 +504,7 @@ DEBUGMETH(m);
 //     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   */
 
@@ -530,11 +534,11 @@ DEBUGMETH(m);
                        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);*/
                                }
                        }
@@ -572,7 +576,7 @@ DEBUGMETH(m);
                                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);
@@ -1670,8 +1674,8 @@ if (DEBUG==true) printf("&&&&&&&&&&&&&&&&\n");
 
                /* 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])
@@ -1711,22 +1715,19 @@ if (DEBUG==true) printf("&&&&&&&&&&&&&&&&\n");
                (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];
            }
        }
        
index 9a45b8a234db303a03ebaaa931547ac92193b9d8..da3ccbf6f3a42b05e9d57daac6b79607cd11c6f7 100644 (file)
@@ -28,7 +28,7 @@
 
    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 $
 
 */
 
@@ -76,7 +76,7 @@
  * types are not discerned.
  */
 
-methodinfo *analyse_stack(methodinfo *m)
+methodinfo *analyse_stack(codegendata *codegendata)
 {
        int b_count;
        int b_index;
@@ -92,6 +92,7 @@ methodinfo *analyse_stack(methodinfo *m)
        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++)
@@ -104,8 +105,8 @@ methodinfo *analyse_stack(methodinfo *m)
        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;
@@ -2132,8 +2133,8 @@ void show_icmd_method(methodinfo *m)
 
        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);
index 05b77a668e9e38d97367f12e1552fb8a325c33c0..c993b1495131faaf43bd104994917a1e2a93f3e3 100644 (file)
@@ -26,7 +26,7 @@
 
    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);
index be479ec1f0c96093aa7c847fea51b28a5b95c292..76be4259cc33b530fd312e9f0caaca311ec01a18 100644 (file)
@@ -26,7 +26,7 @@
 
    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 $
 
 */
 
@@ -778,7 +778,7 @@ is_accessible(int flags,classinfo *definingclass,classinfo *implementingclass, c
 
 /* 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 */
@@ -821,6 +821,7 @@ methodinfo *typecheck(methodinfo *m)
        bool jsrencountered = false;         /* true if we there was a JSR */
 
     classinfo *myclass;
+    methodinfo *m=codegendata->method;
 
 #ifdef TYPECHECK_STATISTICS
        int count_iterations = 0;
@@ -892,7 +893,7 @@ methodinfo *typecheck(methodinfo *m)
     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 */
@@ -968,10 +969,10 @@ methodinfo *typecheck(methodinfo *m)
                 /* 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;
index 9dfded64b15c1c1f2441c8deffa43b55dcbe404d..af10c128f52e4c917be09ef6e8263030a6c730b6 100644 (file)
@@ -26,7 +26,7 @@
 
    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 $
 
 */
 
@@ -35,8 +35,8 @@
 #define _TYPECHECK_H
 
 /* function prototypes */
-
-methodinfo *typecheck(methodinfo *m);
+struct codegendata;
+methodinfo *typecheck(codegendata *codegendata);
 
 #endif /* _TYPECHECK_H */
 
index f5d29f58327778272812d1b33b928c01fc300a2a..bdfe7d691199c80fdd3d742dc47a8b15bebc93da 100644 (file)
@@ -32,7 +32,7 @@
             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 $
 
 */
 
@@ -1337,6 +1337,10 @@ static bool method_load(classbuffer *cb, classinfo *c, methodinfo *m)
                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) {
@@ -1417,7 +1421,6 @@ static bool method_load(classbuffer *cb, classinfo *c, methodinfo *m)
                                return false;
 
                        m->exceptiontablelength = suck_u2(cb);
-
                        if (!check_classbuffer_size(cb, (2 + 2 + 2 + 2) * m->exceptiontablelength))
                                return false;
 
@@ -1532,6 +1535,8 @@ static bool method_load(classbuffer *cb, classinfo *c, methodinfo *m)
        }
 
        /* everything was ok */
+       /*              utf_display(m->name);
+                       printf("\nexceptiontablelength:%ld\n",m->exceptiontablelength);*/
 
        return true;
 }
@@ -2374,7 +2379,7 @@ classinfo *class_load_intern(classbuffer *cb)
                }
                
                /* 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;
@@ -2383,6 +2388,13 @@ classinfo *class_load_intern(classbuffer *cb)
                        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;