This one should be generated by cacaoh.
[cacao.git] / loader.c
index f5d29f58327778272812d1b33b928c01fc300a2a..ce65f7abb4c72e52d090394733774afc6f427a8d 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 1508 2004-11-15 08:34:10Z carolyn $
 
 */
 
@@ -50,7 +50,6 @@
 #include "builtin.h"
 #include "jit/jit.h"
 #include "asmpart.h"
-#include "options.h"
 #include "statistics.h"
 #include "toolbox/memory.h"
 #include "toolbox/logging.h"
@@ -1322,7 +1321,6 @@ static bool method_load(classbuffer *cb, classinfo *c, methodinfo *m)
        m->stackcount = 0;
        m->stack = NULL;
        m->exceptiontable = NULL;
-       m->registerdata = NULL;
        m->stubroutine = NULL;
        m->mcode = NULL;
        m->entrypoint = NULL;
@@ -1337,9 +1335,16 @@ 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) {
+                                                       (m->flags & ACC_STATIC) != 0);
+#ifdef STATIC_CLASSPATH
+               if (f) 
+#endif
+                {
                        m->stubroutine = createnativestub(f, m);
                }
        }
@@ -1417,7 +1422,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 +1536,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;
 }
@@ -1893,12 +1899,13 @@ static bool class_loadcpool(classbuffer *cb, classinfo *c)
                                return false;
 
                        if (opt_verify &&
-                               !is_valid_utf(cb->pos + 1, cb->pos + 1 + length)) {
+                               !is_valid_utf((char *) (cb->pos + 1),
+                                                         (char *) (cb->pos + 1 + length))) {
                                dolog("Invalid UTF-8 string (constant pool index %d)",idx);
                                panic("Invalid UTF-8 string");
                        }
                        /* insert utf-string into the utf-symboltable */
-                       cpinfos[idx] = utf_new_intern(cb->pos + 1, length);
+                       cpinfos[idx] = utf_new_intern((char *) (cb->pos + 1), length);
 
                        /* skip bytes of the string (buffer size check above) */
                        skip_nbytes(cb, length);
@@ -2374,7 +2381,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 +2390,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;
@@ -2893,7 +2907,7 @@ static classinfo *class_link_intern(classinfo *c)
                                return NULL;
 
                if (super->flags & ACC_INTERFACE) {
-                       // java.lang.IncompatibleClassChangeError: class a has interface java.lang.Cloneable as super class
+                       /* java.lang.IncompatibleClassChangeError: class a has interface java.lang.Cloneable as super class */
                        panic("Interface specified as super class");
                }
 
@@ -2942,7 +2956,7 @@ static classinfo *class_link_intern(classinfo *c)
                                                        goto notfoundvftblindex;
 
                                                if (tc->methods[j].flags & ACC_FINAL) {
-                                                       // class a overrides final method .
+                                                       /* class a overrides final method . */
                                                        *exceptionptr =
                                                                new_exception(string_java_lang_VerifyError);
                                                        return NULL;