Merged revisions 7501-7598 via svnmerge from
[cacao.git] / src / vm / jit / jit.h
index 136896063f35f78e5d912a2d2039e0cba170432c..fe5d3949c51a2d7922bc564c37f6e5bb57b3cb25 100644 (file)
@@ -1,6 +1,6 @@
 /* src/vm/jit/jit.h - code generation header
 
-   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   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
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   Contact: cacao@cacaojvm.org
-
-   Authors: Andreas Krall
-            Reinhard Grafl
-            Christian Thalinger
-            Edwin Steiner
-
-   $Id: jit.h 5998 2006-11-15 23:15:13Z edwin $
+   $Id: jit.h 7596 2007-03-28 21:05:53Z twisti $
 
 */
 
@@ -43,7 +36,6 @@ typedef struct jitdata jitdata;
 typedef struct stackelement stackelement;
 typedef stackelement *stackptr;
 typedef struct basicblock basicblock;
-typedef struct branchref branchref;
 typedef struct instruction instruction;
 typedef struct insinfo_inline insinfo_inline;
 typedef struct exception_entry exception_entry;
@@ -53,14 +45,11 @@ typedef struct exception_entry exception_entry;
 #include "vm/types.h"
 
 #include "toolbox/chain.h"
+
 #include "vm/global.h"
-#include "vm/method.h"
-#include "vm/references.h"
-#include "vm/resolve.h"
-#include "vm/statistics.h"
+
 #include "vm/jit/codegen-common.h"
 #include "vm/jit/reg.h"
-#include "vm/jit/stacktrace.h"
 #include "vm/jit/replace.h"
 
 #if defined(ENABLE_INLINING)
@@ -79,6 +68,15 @@ typedef struct exception_entry exception_entry;
 
 #include "vm/jit/verify/typeinfo.h"
 
+#include "vmcore/method.h"
+#include "vmcore/references.h"
+#include "vm/resolve.h"
+
+#if defined(ENABLE_STATISTICS)
+# include "vmcore/statistics.h"
+#endif
+
+
 /* common jit/codegen macros **************************************************/
 
 #if defined(ENABLE_STATISTICS)
@@ -158,6 +156,9 @@ struct jitdata {
 
 #define JITDATA_FLAG_IFCONV              0x00000008
 #define JITDATA_FLAG_REORDER             0x00000010
+#define JITDATA_FLAG_INLINE              0x00000020
+
+#define JITDATA_FLAG_COUNTDOWN           0x00000100
 
 #define JITDATA_FLAG_SHOWINTERMEDIATE    0x20000000
 #define JITDATA_FLAG_SHOWDISASSEMBLE     0x40000000
@@ -179,6 +180,12 @@ struct jitdata {
 #define JITDATA_HAS_FLAG_REORDER(jd) \
     ((jd)->flags & JITDATA_FLAG_REORDER)
 
+#define JITDATA_HAS_FLAG_INLINE(jd) \
+    ((jd)->flags & JITDATA_FLAG_INLINE)
+
+#define JITDATA_HAS_FLAG_COUNTDOWN(jd) \
+    ((jd)->flags & JITDATA_FLAG_COUNTDOWN)
+
 #define JITDATA_HAS_FLAG_SHOWINTERMEDIATE(jd) \
     ((jd)->flags & JITDATA_FLAG_SHOWINTERMEDIATE)
 
@@ -282,6 +289,7 @@ typedef union {
     ptrint                     constval;         /* for PUT*CONST             */
     s4                         tablelow;         /* for TABLESWITCH           */
     u4                         lookupcount;      /* for LOOKUPSWITCH          */
+       s4                         retaddrnr;        /* for ASTORE                */
 } s2_operand_t;
 
 /*** s3 operand ***/
@@ -326,7 +334,7 @@ typedef union {
 /*** flags (32 bits) ***/
 
 #define INS_FLAG_UNRESOLVED    0x01    /* contains unresolved field/meth/class*/
-#define INS_FLAG_CLASS         0x02    /* for ACONST with class               */
+#define INS_FLAG_CLASS         0x02    /* for ACONST, PUT*CONST with class    */
 #define INS_FLAG_ARRAY         0x04    /* for CHECKCAST/INSTANCEOF with array */
 #define INS_FLAG_CHECK         0x08    /* for *ALOAD|*ASTORE: check index     */
                                        /* for BUILTIN: check exception        */
@@ -421,7 +429,9 @@ struct insinfo_inline {
        s4         *javalocals_end;   /* javalocals after inlined body            */
 
        /* fields set by replacement point creation ------------------------------*/
+#if defined(ENABLE_REPLACEMENT)
        rplpoint   *rp;             /* replacement point at INLINE_START          */
+#endif
 
        /* fields set by the codegen ---------------------------------------------*/
        s4          startmpc;       /* machine code offset of start of inlining   */
@@ -503,14 +513,6 @@ struct basicblock {
        } while (0)
                        
 
-/* branchref *****************************************************************/
-
-struct branchref {
-       s4         branchpos;       /* patching position in code segment          */
-       branchref *next;            /* next element in branchref list             */
-};
-
-
 /* data-flow constants for the ICMD table ************************************/
 
 #define DF_0_TO_0      0
@@ -1230,7 +1232,7 @@ extern int stackreq[256];
 
 #define ICMD_INLINE_START     251       /* instruction before inlined method  */
 #define ICMD_INLINE_END       252       /* instruction after inlined method   */
-#define ICMD_INLINE_GOTO      253       /* jump to caller of inlined method   */
+#define ICMD_INLINE_BODY      253       /* start of inlined body              */
 
 #define ICMD_BUILTIN          255       /* internal opcode                    */
 
@@ -1266,6 +1268,8 @@ u1 *jit_compile(methodinfo *m);
 u1 *jit_recompile(methodinfo *m);
 
 void jit_invalidate_code(methodinfo *m);
+codeinfo *jit_get_current_code(methodinfo *m);
+void jit_request_optimization(methodinfo *m);
 
 /* patch the method entrypoint */
 u1 *jit_asm_compile(methodinfo *m, u1 *mptr, u1 *sp, u1 *ra);
@@ -1277,21 +1281,6 @@ void jit_renumber_basicblocks(jitdata *jd);
 void jit_check_basicblock_numbers(jitdata *jd);
 #endif
 
-/* machine dependent functions */
-#if defined(ENABLE_JIT)
-void md_init(void);
-
-u1  *md_get_method_patch_address(u1 *ra, stackframeinfo *sfi, u1 *mptr);
-
-void md_cacheflush(u1 *addr, s4 nbytes);
-void md_icacheflush(u1 *addr, s4 nbytes);
-void md_dcacheflush(u1 *addr, s4 nbytes);
-#endif
-
-#if defined(ENABLE_INTRP)
-void intrp_md_init(void);
-#endif
-
 #endif /* _JIT_H */