Merged with tip.
[cacao.git] / src / vm / jit / code.h
index dd0a390858f544a0c6ecefe77fb1d9a1657791b1..375379725984bfcec636ae7f6c9d29591a1a7de4 100644 (file)
@@ -1,9 +1,7 @@
 /* src/vm/jit/code.h - codeinfo struct for representing compiled code
 
-   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.
 
@@ -30,6 +28,7 @@
 
 #include "config.h"
 
+#include <assert.h>
 #include <stdint.h>
 
 #include "vm/types.h"
@@ -40,6 +39,7 @@
 
 #include "vm/jit/exceptiontable.h"
 #include "vm/jit/linenumbertable.h"
+#include "vm/jit/methodheader.h"
 #include "vm/jit/replace.h"
 
 #include "vmcore/method.h"
@@ -50,6 +50,7 @@
 #define CODE_FLAG_INVALID         0x0001
 #define CODE_FLAG_LEAFMETHOD      0x0002
 #define CODE_FLAG_SYNCHRONIZED    0x0004
+#define CODE_FLAG_TLH             0x0008
 
 
 /* codeinfo *******************************************************************
@@ -86,6 +87,8 @@ struct codeinfo {
        list_t       *patchers;
 
        /* replacement */                                   
+       s4            stackframesize;       /* size of the stackframe in slots    */
+
 #if defined(ENABLE_REPLACEMENT)
        rplpoint     *rplpoints;            /* replacement points                 */
        rplalloc     *regalloc;             /* register allocation info           */
@@ -93,7 +96,6 @@ struct codeinfo {
        s4            globalcount;          /* number of global allocations       */
        s4            regalloccount;        /* number of total allocations        */
        s4            memuse;               /* number of arg + local slots        */
-       s4            stackframesize;       /* size of the stackframe in slots    */
        u1            savedintcount;        /* number of callee saved int regs    */
        u1            savedfltcount;        /* number of callee saved flt regs    */
 # if defined(HAS_ADDRESS_REGISTER_FILE)
@@ -178,18 +180,41 @@ inline static void code_unflag_synchronized(codeinfo *code)
 }
 
 
+/* code_get_codeinfo_for_pv ****************************************************
+
+   Return the codeinfo for the given PV.
+
+   IN:
+       pv...............PV
+
+   RETURN VALUE:
+       the codeinfo *
+
+*******************************************************************************/
+
+inline static codeinfo *code_get_codeinfo_for_pv(void *pv)
+{
+       codeinfo *code;
+
+       assert(pv != NULL);
+
+       code = *((codeinfo **) (((uintptr_t) pv) + CodeinfoPointer));
+
+       return code;
+}
+
+
 /* function prototypes ********************************************************/
 
-bool code_init(void);
+void code_init(void);
 
 codeinfo *code_codeinfo_new(methodinfo *m);
 void code_codeinfo_free(codeinfo *code);
 
-codeinfo *code_find_codeinfo_for_pc(u1 *pc);
-codeinfo *code_find_codeinfo_for_pc_nocheck(u1 *pc);
+codeinfo *code_find_codeinfo_for_pc(void *pc);
+codeinfo *code_find_codeinfo_for_pc_nocheck(void *pc);
 
-codeinfo   *code_get_codeinfo_for_pv(u1 *pv);
-methodinfo *code_get_methodinfo_for_pv(u1 *pv);
+methodinfo *code_get_methodinfo_for_pv(void *pv);
 
 #if defined(ENABLE_REPLACEMENT)
 int code_get_sync_slot_count(codeinfo *code);