/* src/vm/jit/parse.c - parser for JavaVM to intermediate code translation
- Copyright (C) 1996-2005, 2006, 2007 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.
#include "toolbox/logging.h"
#include "vm/builtin.h"
-#include "vm/exceptions.h"
+#include "vm/exceptions.hpp"
#include "vm/global.h"
-#include "vm/stringlocal.h"
+#include "vm/linker.h"
+#include "vm/loader.h"
+#include "vm/options.h"
+#include "vm/resolve.h"
+
+#if defined(ENABLE_STATISTICS)
+# include "vm/statistics.h"
+#endif
+
+#include "vm/string.hpp"
+#include "vm/suck.h"
#include "vm/jit/asmpart.h"
-#include "vm/jit/jit.h"
+#include "vm/jit/jit.hpp"
#include "vm/jit/parse.h"
#include "vm/jit/loop/loop.h"
#include "vm/jit/ir/bytecode.h"
-#include "vmcore/linker.h"
-#include "vmcore/loader.h"
-#include "vmcore/options.h"
-#include "vm/resolve.h"
-
-#if defined(ENABLE_STATISTICS)
-# include "vmcore/statistics.h"
-#endif
-
-#include "vmcore/suck.h"
#define INSTRUCTIONS_INCREMENT 5 /* number of additional instructions to */
/* allocate if space runs out */
pushconstantitem:
#if defined(ENABLE_VERIFIER)
- if (i >= m->class->cpcount) {
+ if (i >= m->clazz->cpcount) {
exceptions_throw_verifyerror(m,
"Attempt to access constant outside range");
return false;
}
#endif
- switch (m->class->cptags[i]) {
+ switch (m->clazz->cptags[i]) {
case CONSTANT_Integer:
- OP_LOADCONST_I(((constant_integer *) (m->class->cpinfos[i]))->value);
+ OP_LOADCONST_I(((constant_integer *) (m->clazz->cpinfos[i]))->value);
break;
case CONSTANT_Long:
- OP_LOADCONST_L(((constant_long *) (m->class->cpinfos[i]))->value);
+ OP_LOADCONST_L(((constant_long *) (m->clazz->cpinfos[i]))->value);
break;
case CONSTANT_Float:
- OP_LOADCONST_F(((constant_float *) (m->class->cpinfos[i]))->value);
+ OP_LOADCONST_F(((constant_float *) (m->clazz->cpinfos[i]))->value);
break;
case CONSTANT_Double:
- OP_LOADCONST_D(((constant_double *) (m->class->cpinfos[i]))->value);
+ OP_LOADCONST_D(((constant_double *) (m->clazz->cpinfos[i]))->value);
break;
case CONSTANT_String:
- OP_LOADCONST_STRING(literalstring_new((utf *) (m->class->cpinfos[i])));
+ OP_LOADCONST_STRING(literalstring_new((utf *) (m->clazz->cpinfos[i])));
break;
case CONSTANT_Class:
- cr = (constant_classref *) (m->class->cpinfos[i]);
+ cr = (constant_classref *) (m->clazz->cpinfos[i]);
if (!resolve_classref(m, cr, resolveLazy, true, true, &c))
return false;
case BC_anewarray:
i = SUCK_BE_U2(m->jcode + bcindex + 1);
- compr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
+ compr = (constant_classref *) class_getconstant(m->clazz, i, CONSTANT_Class);
if (compr == NULL)
return false;
i = SUCK_BE_U2(m->jcode + bcindex + 1);
j = SUCK_BE_U1(m->jcode + bcindex + 3);
- cr = (constant_classref *) class_getconstant(m->class, i, CONSTANT_Class);
+ cr = (constant_classref *) class_getconstant(m->clazz, i, CONSTANT_Class);
if (cr == NULL)
return false;
case BC_getfield:
case BC_putfield:
i = SUCK_BE_U2(m->jcode + bcindex + 1);
- fmi = class_getconstant(m->class, i, CONSTANT_Fieldref);
+ fmi = class_getconstant(m->clazz, i, CONSTANT_Fieldref);
if (fmi == NULL)
return false;
return false;
if (result != resolveSucceeded) {
- uf = resolve_create_unresolved_field(m->class, m, iptr);
+ uf = resolve_create_unresolved_field(m->clazz, m, iptr);
if (uf == NULL)
return false;
OP_PREPARE_ZEROFLAGS(opcode);
i = SUCK_BE_U2(m->jcode + bcindex + 1);
- fmi = class_getconstant(m->class, i, CONSTANT_Methodref);
+ fmi = class_getconstant(m->clazz, i, CONSTANT_Methodref);
if (fmi == NULL)
return false;
OP_PREPARE_FLAGS(opcode, INS_FLAG_CHECK);
i = SUCK_BE_U2(m->jcode + bcindex + 1);
- fmi = class_getconstant(m->class, i, CONSTANT_Methodref);
+ fmi = class_getconstant(m->clazz, i, CONSTANT_Methodref);
goto invoke_nonstatic_method;
OP_PREPARE_ZEROFLAGS(opcode);
i = SUCK_BE_U2(m->jcode + bcindex + 1);
- fmi = class_getconstant(m->class, i, CONSTANT_InterfaceMethodref);
+ fmi = class_getconstant(m->clazz, i, CONSTANT_InterfaceMethodref);
goto invoke_nonstatic_method;
OP_PREPARE_ZEROFLAGS(opcode);
i = SUCK_BE_U2(m->jcode + bcindex + 1);
- fmi = class_getconstant(m->class, i, CONSTANT_Methodref);
+ fmi = class_getconstant(m->clazz, i, CONSTANT_Methodref);
invoke_nonstatic_method:
if (fmi == NULL)
}
}
else {
- um = resolve_create_unresolved_method(m->class, m, fmi,
+ um = resolve_create_unresolved_method(m->clazz, m, fmi,
(opcode == BC_invokestatic),
(opcode == BC_invokespecial));
case BC_new:
i = SUCK_BE_U2(m->jcode + bcindex + 1);
- cr = class_getconstant(m->class, i, CONSTANT_Class);
+ cr = class_getconstant(m->clazz, i, CONSTANT_Class);
if (cr == NULL)
return false;
case BC_checkcast:
i = SUCK_BE_U2(m->jcode + bcindex + 1);
- cr = class_getconstant(m->class, i, CONSTANT_Class);
+ cr = class_getconstant(m->clazz, i, CONSTANT_Class);
if (cr == NULL)
return false;
case BC_instanceof:
i = SUCK_BE_U2(m->jcode + bcindex + 1);
- cr = class_getconstant(m->class, i, CONSTANT_Class);
+ cr = class_getconstant(m->clazz, i, CONSTANT_Class);
if (cr == NULL)
return false;
/* allocate stack table */
- jd->stack = DMNEW(stackelement, jd->stackcount);
+ jd->stack = DMNEW(stackelement_t, jd->stackcount);
/* everything's ok */