* Updated header: Added 2006. Changed address of FSF. Changed email
[cacao.git] / src / vm / linker.c
index 0981baf388c1136be921905ddce28c308cafaac8..a2308ff50adbe95106b6bbc321aefa77a191d371 100644 (file)
@@ -1,9 +1,9 @@
 /* src/vm/linker.c - class linker functions
 
-   Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
-   R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
-   C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
-   Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+   J. Wenninger, Institut f. Computersprachen - TU Wien
 
    This file is part of CACAO.
 
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
-   Contact: cacao@complang.tuwien.ac.at
+   Contact: cacao@cacaojvm.org
 
    Authors: Reinhard Grafl
 
             Edwin Steiner
             Christian Thalinger
 
-   $Id: linker.c 3888 2005-12-05 22:08:45Z twisti $
+   $Id: linker.c 4357 2006-01-22 23:33:38Z twisti $
 
 */
 
 
+#include "config.h"
+
 #include <assert.h>
 
-#include "config.h"
 #include "vm/types.h"
 
 #include "mm/memory.h"
@@ -53,7 +54,6 @@
 #include "vm/resolve.h"
 #include "vm/statistics.h"
 #include "vm/stringlocal.h"
-#include "vm/jit/codegen.inc.h"
 
 
 /* global variables ***********************************************************/
@@ -362,7 +362,7 @@ classinfo *link_class(classinfo *c)
        classinfo *r;
 
        if (!c) {
-               *exceptionptr = new_nullpointerexception();
+               exceptions_throw_nullpointerexception();
                return NULL;
        }
 
@@ -382,7 +382,7 @@ classinfo *link_class(classinfo *c)
                return c;
        }
 
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
        /* measure time */
 
        if (getcompilingtime)
@@ -401,7 +401,7 @@ classinfo *link_class(classinfo *c)
        if (!r)
                c->state &= ~CLASS_LINKING;
 
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
        /* measure time */
 
        if (getloadingtime)
@@ -699,7 +699,7 @@ static classinfo *link_class_intern(classinfo *c)
        }
 
 
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
        if (opt_stat)
                count_vftbl_len +=
                        sizeof(vftbl_t) + (sizeof(methodptr) * (vftbllength - 1));
@@ -749,8 +749,18 @@ static classinfo *link_class_intern(classinfo *c)
                /* Methods in ABSTRACT classes from interfaces maybe already have a   */
                /* stubroutine.                                                       */
 
-               if (!m->stubroutine)
-                       m->stubroutine = createcompilerstub(m);
+               if (!m->stubroutine) {
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+                       if (opt_intrp)
+                               m->stubroutine = intrp_createcompilerstub(m);
+                       else
+#endif
+                               m->stubroutine = createcompilerstub(m);
+#else
+                       m->stubroutine = intrp_createcompilerstub(m);
+#endif
+               }
 
                if (!(m->flags & ACC_STATIC))
                        v->table[m->vftblindex] = (methodptr) (ptrint) m->stubroutine;
@@ -774,7 +784,7 @@ static classinfo *link_class_intern(classinfo *c)
        
        v->interfacevftbllength = MNEW(s4, interfacetablelength);
 
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
        if (opt_stat)
                count_vftbl_len += (4 + sizeof(s4)) * v->interfacetablelength;
 #endif
@@ -1080,7 +1090,7 @@ static void linker_addinterface(classinfo *c, classinfo *ic)
                v->interfacevftbllength[i] = ic->methodscount;
                v->interfacetable[-i] = MNEW(methodptr, ic->methodscount);
 
-#if defined(STATISTICS)
+#if defined(ENABLE_STATISTICS)
                if (opt_stat)
                        count_vftbl_len += sizeof(methodptr) *
                                (ic->methodscount + (ic->methodscount == 0));