Merged with tip.
[cacao.git] / src / vm / jit / jit.c
index 55ccab791abd86d5fb20e2b3198f0e9678fc43f9..971a9dd752b937a6d9554b44dbd5b81d24d0bcc1 100644 (file)
@@ -390,8 +390,9 @@ u1 *jit_compile(methodinfo *m)
                jd->flags |= JITDATA_FLAG_VERBOSECALL;
 
 #if defined(ENABLE_REPLACEMENT) && defined(ENABLE_INLINING)
-       if (opt_Inline)
+       if (opt_Inline && (jd->m->hitcountdown > 0) && (jd->code->optlevel == 0)) {
                jd->flags |= JITDATA_FLAG_COUNTDOWN;
+       }
 #endif
 
 #if defined(ENABLE_JIT)
@@ -640,7 +641,7 @@ static u1 *jit_compile_intern(jitdata *jd)
 
        RT_TIMING_GET_TIME(time_checks);
 
-#if defined(WITH_CLASSPATH_SUN)
+#if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
        /* Code for Sun's OpenJDK (see
           hotspot/src/share/vm/classfile/verifier.cpp
           (Verifier::is_eligible_for_verification)): Don't verify
@@ -700,16 +701,6 @@ static u1 *jit_compile_intern(jitdata *jd)
 #endif
                RT_TIMING_GET_TIME(time_typecheck);
 
-#if defined(ENABLE_SSA)
-               fix_exception_handlers(jd);
-#endif
-
-               /* Build the CFG.  This has to be done after stack_analyse, as
-                  there happens the JSR elimination. */
-
-               if (!cfg_build(jd))
-                       return NULL;
-
 #if defined(ENABLE_LOOP)
                if (opt_loops) {
                        depthFirst(jd);
@@ -731,13 +722,25 @@ static u1 *jit_compile_intern(jitdata *jd)
 
                /* inlining */
 
-#if defined(ENABLE_INLINING)
+#if defined(ENABLE_INLINING) && (!defined(ENABLE_ESCAPE) || 1)
                if (JITDATA_HAS_FLAG_INLINE(jd)) {
                        if (!inline_inline(jd))
                                return NULL;
                }
 #endif
 
+#if defined(ENABLE_SSA)
+               if (opt_lsra) {
+                       fix_exception_handlers(jd);
+               }
+#endif
+
+               /* Build the CFG.  This has to be done after stack_analyse, as
+                  there happens the JSR elimination. */
+
+               if (!cfg_build(jd))
+                       return NULL;
+
 #if defined(ENABLE_PROFILING)
                /* Basic block reordering.  I think this should be done after
                   if-conversion, as we could lose the ability to do the
@@ -768,16 +771,17 @@ static u1 *jit_compile_intern(jitdata *jd)
 #if defined(ENABLE_SSA)
                /* allocate registers */
                if (
-                       (opt_lsra) 
-                       /*&& strncmp(jd->m->name->text, "banana", 6) == 0*/
+                       (opt_lsra &&
+                       jd->code->optlevel > 0) 
+                       /* strncmp(jd->m->name->text, "hottie", 6) == 0*/
                        /*&& jd->exceptiontablelength == 0*/
                ) {
-                       /* printf("=== %s ===\n", jd->m->name->text); */
+                       /*printf("=== %s ===\n", jd->m->name->text);*/
                        jd->ls = DNEW(lsradata);
                        jd->ls = NULL;
                        ssa(jd);
                        /*lsra(jd);*/ regalloc(jd);
-                       eliminate_subbasicblocks(jd);
+                       /*eliminate_subbasicblocks(jd);*/
                        STATISTICS(count_methods_allocated_by_lsra++);
 
                } else