-/* vm/jit/jit.c - calls the code generation functions
+/* src/vm/jit/jit.c - calls the code generation functions
Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
Reinhard Grafl
Changes: Edwin Steiner
+ Christian Thalinger
- $Id: jit.c 1953 2005-02-17 13:42:23Z christian $
+ $Id: jit.c 2040 2005-03-20 13:39:51Z twisti $
*/
#include <stdlib.h>
+#include "config.h"
#include "codegen.h"
#include "disass.h"
#include "types.h"
1,
#define ICMD_SASTORECONST 211
1,
+#define ICMD_PUTSTATICCONST 212
+ 1,
+#define ICMD_PUTFIELDCONST 213
+ 1,
+#define ICMD_IMULPOW2 214
+ 1,
+#define ICMD_LMULPOW2 215
+ 1,
/* unused */
- 1,1,1,1,1,1,1,1,
+ 1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,
"BASTORECONST ", /* 209 */
"CASTORECONST ", /* 210 */
"SASTORECONST ", /* 211 */
+ "PUTSTATICCONST ", /* 212 */
+ "PUTFIELDCONST ", /* 213 */
+ "IMULPOW2 ", /* 214 */
+ "LMULPOW2 ", /* 215 */
- "UNDEF212", "UNDEF213", "UNDEF214", "UNDEF215",
"UNDEF216", "UNDEF217", "UNDEF218", "UNDEF219", "UNDEF220",
"UNDEF221", "UNDEF222", "UNDEF223", "UNDEF224", "UNDEF225",
"UNDEF226", "UNDEF227", "UNDEF228", "UNDEF229", "UNDEF230",
{ ICMD_LCMP, TYPE_LONG, TYPE_LONG, TYPE_INT, ICMD_BUILTIN2,
(functionptr) builtin_lcmp , SUPPORT_LONG && SUPPORT_LONG_CMP, false },
{ ICMD_LAND, TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
- (functionptr) builtin_land , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
+ (functionptr) builtin_land , SUPPORT_LONG && SUPPORT_LONG_LOGICAL, false },
{ ICMD_LOR, TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
- (functionptr) builtin_lor , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
+ (functionptr) builtin_lor , SUPPORT_LONG && SUPPORT_LONG_LOGICAL, false },
{ ICMD_LXOR, TYPE_LONG, TYPE_LONG, TYPE_LONG, ICMD_BUILTIN2,
- (functionptr) builtin_lxor , SUPPORT_LONG && SUPPORT_LONG_LOG, false },
+ (functionptr) builtin_lxor , SUPPORT_LONG && SUPPORT_LONG_LOGICAL, false },
{ ICMD_LSHL, TYPE_LONG, TYPE_INT, TYPE_LONG, ICMD_BUILTIN2,
(functionptr) builtin_lshl , SUPPORT_LONG && SUPPORT_LONG_SHIFT, false },
{ ICMD_LSHR, TYPE_LONG, TYPE_INT, TYPE_LONG, ICMD_BUILTIN2,
SUPPORT_LONG && SUPPORT_LONG_CMP,false,"lcmp"},
{ICMD_LAND , BUILTIN_land ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_LONG ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_LONG && SUPPORT_LONG_LOG,false,"land"},
+ SUPPORT_LONG && SUPPORT_LONG_LOGICAL,false,"land"},
{ICMD_LOR , BUILTIN_lor ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_LONG ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_LONG && SUPPORT_LONG_LOG,false,"lor"},
+ SUPPORT_LONG && SUPPORT_LONG_LOGICAL,false,"lor"},
{ICMD_LXOR , BUILTIN_lxor ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_LONG ,TYPE_VOID ,TYPE_LONG ,
- SUPPORT_LONG && SUPPORT_LONG_LOG,false,"lxor"},
+ SUPPORT_LONG && SUPPORT_LONG_LOGICAL,false,"lxor"},
{ICMD_LSHL , BUILTIN_lshl ,ICMD_BUILTIN2,TYPE_LONG ,TYPE_INT ,TYPE_VOID ,TYPE_LONG ,
SUPPORT_LONG && SUPPORT_LONG_SHIFT,false,"lshl"},
t_inlining_globals *id;
s4 dumpsize;
+#if defined(STATISTICS)
if (opt_stat)
count_jit_calls++;
+#endif
/* this is the case if a native function is called by jni */
return m->entrypoint;
}
+#if defined(STATISTICS)
if (opt_stat)
count_methods++;
+#endif
/* if there is no javacode, print error message and return empty method */
return m->entrypoint; /* return empty method */
}
+#if defined(STATISTICS)
/* measure time */
if (getcompilingtime)
compilingtime_start();
+#endif
/* mark start of dump memory area */
dump_release(dumpsize);
+#if defined(STATISTICS)
/* measure time */
if (getcompilingtime)
compilingtime_stop();
+#endif
/* define in options.h; Used in main.c, jit.c & inline.c */
#ifdef INAFTERMAIN
#ifdef LSRA
bool old_opt_lsra;
#endif
-#ifdef STATISTICS
- int i,type;
- s4 len;
- stackptr src, src_old;
- stackptr dst;
- instruction *iptr;
- basicblock *bptr;
-#endif
+
/* print log message for compiled method */
#ifdef LSRA
old_opt_lsra=opt_lsra;
if (opt_lsra) {
- if (!lsra(m, cd, rd, ld, id)) {
+ if (!lsra(m, cd, rd, id)) {
opt_lsra = false;
/* log_message_method("Regalloc Fallback: ", m); */
regalloc( m, cd, rd );
}
#ifdef STATISTICS
- if (opt_stat) {
- /* count how many local variables are held in memory or register */
- for(i=0; i < cd->maxlocals; i++)
- for (type=0; type <=4; type++)
- if (rd->locals[i][type].type != -1) { /* valid local */
- if (rd->locals[i][type].flags & INMEMORY)
- count_locals_spilled++;
- else
- count_locals_register++;
- }
- /* count how many stack slots are held in memory or register */
-
- bptr = m->basicblocks;
- while (bptr != NULL) {
- if (bptr->flags >= BBREACHED) {
-
-#ifdef LSRA
- if (!opt_lsra) {
-#endif
- /* check for memory moves from interface to BB instack */
- dst = bptr->instack;
- len = bptr->indepth;
- while (dst != NULL) {
- len--;
- if (dst->varkind != STACKVAR) {
- if ( (dst->flags & INMEMORY) ||
- (rd->interfaces[len][dst->type].flags & INMEMORY) ||
- ( (dst->flags & INMEMORY) &&
- (rd->interfaces[len][dst->type].flags & INMEMORY) &&
- (dst->regoff != rd->interfaces[len][dst->type].regoff) ))
- {
- /* one in memory or both inmemory at different offsets */
- count_mem_move_bb++;
- }
- }
-
- dst = dst->prev;
- }
-
- /* check for memory moves from BB outstack to interface */
- dst = bptr->outstack;
- len = bptr->outdepth;
-
- while (dst) {
- len--;
- if (dst->varkind != STACKVAR) {
- if ( (dst->flags & INMEMORY) || \
- (rd->interfaces[len][dst->type].flags & INMEMORY) || \
- ( (dst->flags & INMEMORY) && \
- (rd->interfaces[len][dst->type].flags & INMEMORY) && \
- (dst->regoff != rd->interfaces[len][dst->type].regoff) ))
- {
- /* one in memory or both inmemory at different offsets */
- count_mem_move_bb++;
- }
- }
-
- dst = dst->prev;
- }
-#ifdef LSRA
- }
-#endif
-
-
- dst = bptr->instack;
- iptr = bptr->iinstr;
- len = bptr->icount;
- src_old = NULL;
-
- while (--len >= 0) {
- src = dst;
- dst = iptr->dst;
-
- if ((src!= NULL) && (src != src_old)) { /* new stackslot */
- switch (src->varkind) {
- case TEMPVAR:
- case STACKVAR:
- if (!(src->flags & INMEMORY))
- count_ss_register++;
- else
- count_ss_spilled++;
- break;
- /* case LOCALVAR: */
- /* if (!(rd->locals[src->varnum][src->type].flags & INMEMORY)) */
- /* count_ss_register++; */
- /* else */
- /* count_ss_spilled++; */
- /* break; */
- /* case ARGVAR: */
- /* if (IS_FLT_DBL_TYPE(src->type)) { */
- /* if (src->varnum < FLT_ARG_CNT) { */
- /* count_ss_register++; */
- /* break; */
- /* } */
- /* } else { */
- /* #if defined(__POWERPC__) */
- /* if (src->varnum < INT_ARG_CNT - (IS_2_WORD_TYPE(src->type) != 0)) { */
- /* #else */
- /* if (src->varnum < INT_ARG_CNT) { */
- /* #endif */
- /* count_ss_register++; */
- /* break; */
- /* } */
- /* } */
- /* count_ss_spilled++; */
- /* break; */
- }
- }
- src_old = src;
-
- iptr++;
- } /* while instructions */
- } /* if */
- bptr = bptr->next;
- } /* while blocks */
- }
+ if (opt_stat)
+ reg_make_statistics(m, cd, rd);
#endif
if (compileverbose) {