* src/mm/memory.cpp,
[cacao.git] / src / vm / jit / intrp / engine.c
index 0b163d3c84b13915b2e04b582ebad29f2f6446f0..118883f720c09c21215ae8d55979395389073968 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/intrp/engine.c - #included by engine1.c and engine2.c
 
-   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
+   Copyright (C) 1996-2005, 2006, 2007, 2008
+   CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
 
    This file is part of CACAO.
 
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Christian Thalinger
-            Anton Ertl
-
-   Changes:
-
-   $Id: engine.c 5666 2006-10-04 15:04:52Z twisti $
 */
 
 
-#define VM_DEBUG
+/* #define VM_DEBUG */
 
 #include "config.h"
 
 #include <assert.h>
 
+#include "vm/types.h"
+
 #include "arch.h"
+
 #include "vm/jit/intrp/intrp.h"
 
 #include "md-abi.h"                           /* required for TRACE_ARGS_NUM */
 
-#include "vm/builtin.h"
-#include "vm/exceptions.h"
-#include "vm/loader.h"
+#include "mm/memory.hpp"
+
+#include "threads/thread.hpp"
+
+#include "vm/jit/builtin.hpp"
+#include "vm/loader.hpp"
 #include "vm/options.h"
+
 #include "vm/jit/methodheader.h"
 #include "vm/jit/patcher.h"
+#include "vm/jit/stacktrace.hpp"
+
 
 #if defined(ENABLE_THREADS)
-# ifndef USE_FAKE_ATOMIC_INSTRUCTIONS
-#  include "machine-instr.h"
-# else
-#  include "threads/native/generic-primitives.h"
-# endif
+# include "threads/atomic.hpp"
 #endif
 
 #if !defined(STORE_ORDER_BARRIER) && !defined(ENABLE_THREADS)
 #define THROW_CLASSCASTEXCEPTION(o) \
     { \
                classcastexception_object = o; \
-        THROW(nullpointerexception); \
+        THROW(classcastexception); \
        }
 
 #define CHECK_OUT_OF_BOUNDS(_array, _idx)              \
 #define access_array_float(array, index)               \
         ((((java_floatarray*)(array))->data)[index])
 
-#define MAXLOCALS(stub) (((Cell *)stub)[1])
+/* (see createcompilerstub in codegen.c) */
+#define FRAMESIZE(stub) (((Cell *)stub)[1])
 
 #if 0
 #define CLEARSTACK(_start, _end) \
@@ -221,24 +217,24 @@ engine(Inst *ip0, Cell * sp0, Cell * fp)
 {
   Inst *ip;
   register Cell *sp SPREG = sp0;
-  Inst ca1; /* code address; this is the next dispatched instruction */
+  /* Inst ca1; XXX unused? */ /* code address; this is the next dispatched instruction */
   IF_spTOS(register Cell spTOS TOSREG;)
   static Inst   labels[] = {
 #define INST_ADDR(_inst) (&&I_##_inst)
-#include "java-labels.i"
+#include <java-labels.i>
 #undef INST_ADDR
          NULL,
 #define INST_ADDR(_inst) (&&J_##_inst)
-#include "java-labels.i"
+#include <java-labels.i>
 #undef INST_ADDR
 #define INST_ADDR(_inst) (&&K_##_inst)
-#include "java-labels.i"
+#include <java-labels.i>
 #undef INST_ADDR
     (Label)&&after_last,
     (Label)&&before_goto,
     (Label)&&after_goto,
 #define INST_ADDR(_inst) (&&H_##_inst)
-#include "java-labels.i"
+#include <java-labels.i>
 #undef INST_ADDR
   };
   /* local variables for the various throw codes; this helps make
@@ -249,8 +245,8 @@ engine(Inst *ip0, Cell * sp0, Cell * fp)
   Label throw_classcastexception                        = &&throw_classcastexception1;  
   Label throw_nullpointerexception                  = &&throw_nullpointerexception1;
   Label throw_arraystoreexception            = &&throw_arraystoreexception1;
-  java_objectheader *classcastexception_object;
-  s4 arrayindexoutofbounds_index; /* pass the index to the throw code */
+  java_objectheader *classcastexception_object = NULL;
+  s4 arrayindexoutofbounds_index = 0; /* pass the index to the throw code */
 
   if (vm_debug)
       fprintf(vm_out,"entering engine(%p,%p,%p)\n",ip0,sp,fp);
@@ -296,7 +292,7 @@ engine(Inst *ip0, Cell * sp0, Cell * fp)
   NEXT;
 
 #define INST_ADDR(_inst) (&&I_##_inst)
-#include "java-vm.i"
+#include <java-vm.i>
 #undef NAME
  after_last: return NULL;
 }
@@ -313,4 +309,5 @@ engine(Inst *ip0, Cell * sp0, Cell * fp)
  * c-basic-offset: 4
  * tab-width: 4
  * End:
+ * vim:noexpandtab:sw=4:ts=4:
  */