* libffi: Added.
[cacao.git] / src / vm / linker.c
index 05b2c0655786b9499e66c731b2e7c956a96d60ac..20351062904246dbfc113119ea21cf4cf06402bc 100644 (file)
@@ -32,7 +32,7 @@
             Edwin Steiner
             Christian Thalinger
 
-   $Id: linker.c 2725 2005-06-16 19:10:35Z edwin $
+   $Id: linker.c 3267 2005-09-21 20:21:48Z twisti $
 
 */
 
@@ -67,7 +67,7 @@ static s4 classvalue;
    primitive class.
  
    CAUTION: Don't change the order of the types. This table is indexed
-   by the ARRAYTYPE_ constants (expcept ARRAYTYPE_OBJECT).
+   by the ARRAYTYPE_ constants (except ARRAYTYPE_OBJECT).
 
 *******************************************************************************/
 
@@ -279,16 +279,17 @@ static bool link_primitivetype_table(void)
                /* create primitive class */
 
                c = class_create_classinfo(utf_new_char(primitivetype_table[i].name));
+
+               c->flags = ACC_PUBLIC | ACC_FINAL | ACC_ABSTRACT;
                c->classUsed = NOTUSED; /* not used initially CO-RT */
                c->impldBy = NULL;
                
                /* prevent loader from loading primitive class */
 
                c->loaded = true;
-               if (!classcache_store_unique(c)) {
-                       log_text("Could not cache primitive class");
-                       return false;
-               }
+
+               /* INFO: don't put primitive classes into the classcache */
+
                if (!link_class(c))
                        return false;
 
@@ -444,7 +445,7 @@ static classinfo *link_class_intern(classinfo *c)
                /* resolve this super interface */
 
                if (!resolve_classref_or_classinfo(NULL, c->interfaces[i], resolveEager,
-                                                                                  false, &tc))
+                                                                                  true, false, &tc))
                        return NULL;
 
                c->interfaces[i].cls = tc;
@@ -489,7 +490,7 @@ static classinfo *link_class_intern(classinfo *c)
        } else {
                /* resolve super class */
 
-               if (!resolve_classref_or_classinfo(NULL, c->super, resolveEager, false,
+               if (!resolve_classref_or_classinfo(NULL, c->super, resolveEager, true, false,
                                                                                   &super))
                        return NULL;
                c->super.cls = super;
@@ -718,23 +719,11 @@ static classinfo *link_class_intern(classinfo *c)
                /* Methods in ABSTRACT classes from interfaces maybe already have a   */
                /* stubroutine.                                                       */
 
-               if (!m->stubroutine) {
-                       if (!(m->flags & ACC_NATIVE)) {
-                               m->stubroutine = createcompilerstub(m);
-
-                       } else {
-                               functionptr f = native_findfunction(c->name,
-                                                                                                       m->name, m->descriptor,
-                                                                                                       (m->flags & ACC_STATIC));
-#if defined(STATIC_CLASSPATH)
-                               if (f)
-#endif
-                                       m->stubroutine = codegen_createnativestub(f, m);
-                       }
-               }
+               if (!m->stubroutine)
+                       m->stubroutine = createcompilerstub(m);
 
                if (!(m->flags & ACC_STATIC))
-                       v->table[m->vftblindex] = (methodptr) m->stubroutine;
+                       v->table[m->vftblindex] = (methodptr) (ptrint) m->stubroutine;
        }
 
        /* compute instance size and offset of each field */
@@ -793,14 +782,14 @@ static classinfo *link_class_intern(classinfo *c)
                                continue;
                        if (!resolve_classref_or_classinfo(NULL,
                                                                                           m->exceptiontable[j].catchtype,
-                                                                                          resolveEager, false,
+                                                                                          resolveEager, true, false,
                                                                                           &(m->exceptiontable[j].catchtype.cls)))
                                return NULL;
                }
 
                for (j = 0; j < m->thrownexceptionscount; j++)
                        if (!resolve_classref_or_classinfo(NULL, m->thrownexceptions[j],
-                                                                                          resolveEager, false,
+                                                                                          resolveEager, true, false,
                                                                                           &(m->thrownexceptions[j].cls)))
                                return NULL;
        }
@@ -952,8 +941,8 @@ static arraydescriptor *link_array(classinfo *c)
                        break;
 
                default:
-                       log_text("Invalid array class name");
-                       assert(0);
+                       *exceptionptr = new_classnotfoundexception(c->name);
+                       return NULL;
                }
                
                desc->componentvftbl = NULL;