-/* src/vm/jit/codegen-common.h - architecture independent code generator stuff
+/* src/vm/jit/codegen-common.hpp - architecture independent code generator stuff
- Copyright (C) 1996-2005, 2006, 2007, 2008
+ Copyright (C) 1996-2005, 2006, 2007, 2008, 2009
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
typedef struct branch_label_ref_t branch_label_ref_t;
typedef struct jumpref jumpref;
typedef struct dataref dataref;
-typedef struct exceptionref exceptionref;
-typedef struct linenumberref linenumberref;
+struct patchref_t;
#include "config.h"
#include "vm/types.h"
+#include "toolbox/list.hpp"
+
#include "vm/jit/builtin.hpp"
-#include "vm/descriptor.h"
+#include "vm/descriptor.hpp"
#include "vm/global.h"
-#include "vm/method.h"
+#include "vm/method.hpp"
#include "vm/references.h"
#include "vm/jit/dseg.h"
#include "vm/jit/jit.hpp"
#include "vm/jit/reg.h"
#include "vm/jit/code.hpp"
+#include "vm/jit/linenumbertable.hpp"
#include "vm/jit/replace.hpp"
#define GET_LOW_REG(a) ((a) & 0x0000ffff)
#define GET_HIGH_REG(a) (((a) & 0xffff0000) >> 16)
+/* All 32-bit machines we support use packed registers to store
+ return values and temporary values. */
+
+#if SIZEOF_VOID_P == 8
+# define REG_LRESULT REG_RESULT
+# define REG_LTMP12 REG_ITMP1
+# define REG_LTMP23 REG_ITMP2
+#else
+# define REG_LRESULT REG_RESULT_PACKED
+# define REG_LTMP12 REG_ITMP12_PACKED
+# define REG_LTMP23 REG_ITMP23_PACKED
+#endif
+
/* branch conditions **********************************************************/
dataref *datareferences; /* list of data segment references */
#endif
- list_t *brancheslabel;
- list_t *linenumbers; /* list of line numbers */
+#ifdef __cplusplus
+ DumpList<branch_label_ref_t*>* brancheslabel;
+ DumpList<Linenumber>* linenumbers; ///< List of line numbers.
+#else
+ // REMOVEME
+ DumpList* brancheslabel;
+ DumpList* linenumbers;
+#endif
methodinfo *method;
s4 condition; /* conditional branch condition */
s4 reg; /* register number to check */
u4 options; /* branch options */
- listnode_t linkage;
+/* listnode_t linkage; */
};
};
-/* linenumberref **************************************************************/
-
-struct linenumberref {
- s4 tablepos; /* patching position in data segment */
- s4 linenumber; /* line number, used for inserting into the */
- /* table and for validity checking */
- /* -1......start of inlined body */
- /* -2......end of inlined body */
- /* <= -3...special entry with methodinfo * */
- /* (see doc/inlining_stacktrace.txt) */
- ptrint targetmpc; /* machine code program counter of first */
- /* instruction for given line */
- /* NOTE: for linenumber <= -3 this is a the */
- /* (methodinfo *) of the inlined method */
- linenumberref *next; /* next element in linenumberref list */
-};
-
-
/* function prototypes ********************************************************/
#ifdef __cplusplus
bool codegen_generate(jitdata *jd);
bool codegen_emit(jitdata *jd);
+void codegen_emit_prolog(jitdata* jd);
+void codegen_emit_epilog(jitdata* jd);
+void codegen_emit_instruction(jitdata* jd, instruction* iptr);
+
+#if defined(USES_PATCHABLE_MEMORY_BARRIER)
+void codegen_emit_patchable_barrier(instruction *iptr, codegendata *cd, struct patchref_t *pr, fieldinfo *fi);
+#endif
+
#if defined(ENABLE_INTRP)
bool intrp_codegen(jitdata *jd);
#endif