X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjit%2Fintrp%2Fengine.c;h=a09239243c2e1b46069a6a370a0cfcefe7d92e5e;hb=219e4a46e3d127d3c0883ee2e8635b4fe3c94d60;hp=1d0e69e9f95eee270a9e0658300a41940dd93cfa;hpb=cb1c88a960c3d3905f03ca740978e35bf865932c;p=cacao.git diff --git a/src/vm/jit/intrp/engine.c b/src/vm/jit/intrp/engine.c index 1d0e69e9f..a09239243 100644 --- a/src/vm/jit/intrp/engine.c +++ b/src/vm/jit/intrp/engine.c @@ -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. @@ -22,14 +20,6 @@ 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 4629 2006-03-16 13:59:14Z twisti $ */ @@ -39,27 +29,32 @@ #include +#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.h" + +#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(USE_THREADS) && defined(NATIVE_THREADS) -# ifndef USE_MD_THREAD_STUFF -# include "machine-instr.h" -# else -# include "threads/native/generic-primitives.h" -# endif + +#if defined(ENABLE_THREADS) +# include "threads/atomic.hpp" #endif -#if !defined(STORE_ORDER_BARRIER) && !defined(USE_THREADS) +#if !defined(STORE_ORDER_BARRIER) && !defined(ENABLE_THREADS) #define STORE_ORDER_BARRIER() /* nothing */ #endif @@ -147,6 +142,12 @@ } \ } +#define THROW_CLASSCASTEXCEPTION(o) \ + { \ + classcastexception_object = o; \ + THROW(classcastexception); \ + } + #define CHECK_OUT_OF_BOUNDS(_array, _idx) \ { \ if (length_array(_array) <= (u4) (_idx)) { \ @@ -190,7 +191,8 @@ #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) \ @@ -215,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 #undef INST_ADDR NULL, #define INST_ADDR(_inst) (&&J_##_inst) -#include "java-labels.i" +#include #undef INST_ADDR #define INST_ADDR(_inst) (&&K_##_inst) -#include "java-labels.i" +#include #undef INST_ADDR (Label)&&after_last, (Label)&&before_goto, (Label)&&after_goto, #define INST_ADDR(_inst) (&&H_##_inst) -#include "java-labels.i" +#include #undef INST_ADDR }; /* local variables for the various throw codes; this helps make @@ -243,7 +245,8 @@ engine(Inst *ip0, Cell * sp0, Cell * fp) Label throw_classcastexception = &&throw_classcastexception1; Label throw_nullpointerexception = &&throw_nullpointerexception1; Label throw_arraystoreexception = &&throw_arraystoreexception1; - 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); @@ -265,10 +268,15 @@ engine(Inst *ip0, Cell * sp0, Cell * fp) /* the actual codes jumped to through the ...exception variables */ THROWCODE(arithmeticexception); - THROWCODE(classcastexception); THROWCODE(nullpointerexception); THROWCODE(arraystoreexception); + throw_classcastexception1: + global_sp = sp; + *exceptionptr = stacktrace_inline_classcastexception(NULL, (u1 *) fp, (u1 *) IP, (u1 *) IP, classcastexception_object); + CLEAR_global_sp; + THROW0; + throw_arrayindexoutofboundsexception1: global_sp = sp; *exceptionptr = stacktrace_inline_arrayindexoutofboundsexception(NULL, (u1 *) fp, (u1 *) IP, (u1 *) IP, arrayindexoutofbounds_index); @@ -284,7 +292,7 @@ engine(Inst *ip0, Cell * sp0, Cell * fp) NEXT; #define INST_ADDR(_inst) (&&I_##_inst) -#include "java-vm.i" +#include #undef NAME after_last: return NULL; } @@ -301,4 +309,5 @@ engine(Inst *ip0, Cell * sp0, Cell * fp) * c-basic-offset: 4 * tab-width: 4 * End: + * vim:noexpandtab:sw=4:ts=4: */