63 #if defined(ENABLE_LSRA) && !defined(ENABLE_SSA)
67 #if defined(ENABLE_SSA)
72 #if defined(ENABLE_INLINING)
76 #if defined(ENABLE_IFCONV)
80 #if defined(ENABLE_LOOP)
84 #if defined(ENABLE_COMPILER2)
93 #define DEBUG_JIT_COMPILEVERBOSE(x) \
95 if (compileverbose) { \
96 log_message_method(x, m); \
100 #define DEBUG_JIT_COMPILEVERBOSE(x)
104 # define TRACECOMPILERCALLS() \
106 if (opt_TraceCompilerCalls) { \
108 log_print("[JIT compiler started: method="); \
115 # define TRACECOMPILERCALLS()
118 STAT_REGISTER_VAR(
int,count_jit_calls,0,
"jit calls",
"Number of JIT compiler calls")
124 STAT_REGISTER_VAR(
int,count_methods_allocated_by_lsra,0,"meth. alloc.
lsra","Methods allocated by LSRA")
155 #if defined(ENABLE_JIT)
177 #if defined(ENABLE_JIT)
178 # if defined(ENABLE_INTRP)
189 #define DEBUG_NAME "jit"
229 #if defined(ENABLE_LOOP)
264 STAT_REGISTER_VAR_EXTERN(std::size_t, compiler_last_codesize, 0,
"last-code-size",
"code size of the last compiled method")
298 if ((m->code != NULL) && (m->code->entrypoint != NULL))
299 return m->code->entrypoint;
308 if (m->code != NULL) {
311 assert(m->code->entrypoint);
312 return m->code->entrypoint;
319 #if defined(ENABLE_STATISTICS)
322 if (opt_getcompilingtime)
337 #if defined(ENABLE_VERIFIER)
342 #if defined(ENABLE_PROFILING)
347 #if defined(ENABLE_IFCONV)
352 #if defined(ENABLE_INLINING) && defined(ENABLE_INLINING_DEBUG)
353 if (opt_Inline && opt_InlineAll)
366 #if defined(ENABLE_REPLACEMENT) && defined(ENABLE_INLINING) && defined(ENABLE_INLINING_DEBUG) && !defined(NDEBUG)
367 if (opt_Inline && (jd->
m->hitcountdown > 0) && (jd->
code->
optlevel == 0)) {
368 if (!opt_InlineMethod) {
371 if (!opt_InlineMethodUtf) {
376 if ( jd->
m->
name.
hash() == opt_InlineMethodUtf.hash() ) {
383 #if defined(ENABLE_JIT)
384 # if defined(ENABLE_INTRP)
400 #if defined(ENABLE_COMPILER2)
402 using namespace cacao::jit::compiler2;
422 #if defined(ENABLE_STATISTICS)
425 if (opt_getcompilingtime)
436 #if defined(ENABLE_STATISTICS)
438 compiler_last_codesize = m->code->mcodelength;
473 #if defined(ENABLE_STATISTICS)
476 if (opt_getcompilingtime)
493 #if defined(ENABLE_VERIFIER)
505 #if defined(ENABLE_INLINING)
513 #if defined(ENABLE_JIT)
514 # if defined(ENABLE_INTRP)
538 #if defined(ENABLE_STATISTICS)
541 if (opt_getcompilingtime)
555 #if defined(ENABLE_PM_HACKS)
556 #include "vm/jit/jit_pm_1.inc"
588 #if defined(ENABLE_LSRA) || defined(ENABLE_SSA)
595 #if defined(ENABLE_DEBUG_FILTER)
623 if (m->
jcode == NULL) {
633 STATISTICS(count_tryblocks += jd->exceptiontablelength);
634 STATISTICS(count_javaexcsize += jd->exceptiontablelength * SIZEOF_VOID_P);
638 #if defined(WITH_JAVA_RUNTIME_LIBRARY_OPENJDK)
644 # if defined(ENABLE_VERIFIER)
665 #if defined(ENABLE_JIT)
666 # if defined(ENABLE_INTRP)
683 #ifdef ENABLE_VERIFIER
699 #if defined(ENABLE_IFCONV)
710 #if defined(ENABLE_INLINING) && (!defined(ENABLE_ESCAPE) || 1)
717 #if defined(ENABLE_SSA)
729 #if defined(ENABLE_LOOP)
742 #if defined(ENABLE_PROFILING)
754 #if defined(ENABLE_PM_HACKS)
755 #include "vm/jit/jit_pm_2.inc"
759 #if defined(ENABLE_LSRA) && !defined(ENABLE_SSA)
765 STATISTICS(count_methods_allocated_by_lsra++);
769 #if defined(ENABLE_SSA)
773 jd->code->optlevel > 0)
783 STATISTICS(count_methods_allocated_by_lsra++);
788 STATISTICS(count_locals_conflicts += (jd->maxlocals - 1) * (jd->maxlocals));
797 # if defined(ENABLE_INTRP)
803 #if defined(ENABLE_PROFILING)
809 code->basicblockcount = jd->basicblockcount;
810 code->bbfrequency =
MNEW(
u4, jd->basicblockcount);
818 #if defined(ENABLE_JIT)
819 # if defined(ENABLE_INTRP)
821 #if defined(ENABLE_VERIFIER)
856 #if !defined(NDEBUG) && defined(ENABLE_REPLACEMENT)
859 if (opt_TestReplacement)
864 #if defined(ENABLE_DEBUG_FILTER)
874 # if defined(ENABLE_DISASSEMBLER)
923 #if defined(ENABLE_REPLACEMENT)
926 vm_abort(
"invalidating code only works with ENABLE_REPLACEMENT");
979 #if defined(ENABLE_COMPILER2)
1005 #if defined(ENABLE_JIT)
1006 #if !defined(JIT_COMPILER_VIA_SIGNAL)
1030 if (entrypoint == NULL)
1039 p = (uintptr_t*) pa;
1041 *p = (uintptr_t) entrypoint;
1085 p = (uintptr_t *) pa;
1087 *p = (uintptr_t) newpv;
1130 return ICMD(opcode + 1);
1132 return ICMD(opcode - 1);
1176 #if !defined(NDEBUG)
1184 assert(bptr->
nr == nr);
#define JITDATA_FLAG_IFCONV
#define JITDATA_HAS_FLAG_SHOWDISASSEMBLE(jd)
bool cfg_build(jitdata *jd)
#define JITDATA_HAS_FLAG_INLINE(jd)
codeinfo * jit_get_current_code(methodinfo *m)
#define STATISTICS(x)
Wrapper for statistics only code.
void code_codeinfo_free(codeinfo *code)
Table containing all native methods registered with the VM.
NativeMethods & get_nativemethods()
#define JITDATA_HAS_FLAG_REORDER(jd)
#define RT_TIMER_STOP(var)
Stop the timer var.
void replace_activate_replacement_points(codeinfo *code, bool mappable)
exception_entry * exceptiontable
void * jit_compile_handle(methodinfo *m, void *pv, void *ra, void *mptr)
void cfg_clear(jitdata *jd)
bool inline_inline(jitdata *jd)
static int code_is_invalid(codeinfo *code)
#define JITDATA_FLAG_VERBOSECALL
bool reorder(jitdata *jd)
bool typecheck(jitdata *jd)
bool typecheck_stackbased(jitdata *jd)
#define JITDATA_FLAG_INSTRUMENT
#define JITDATA_HAS_FLAG_INSTRUMENT(jd)
typedef void(JNICALL *jvmtiEventSingleStep)(jvmtiEnv *jvmti_env
#define JITDATA_FLAG_VERIFY
static void code_flag_invalid(codeinfo *code)
u1 * jit_compile(methodinfo *m)
#define RT_TIMER_START(var)
Start the timer var.
MachineCode * compile(methodinfo *m)
static void code_flag_synchronized(codeinfo *code)
#define DEBUG_JIT_COMPILEVERBOSE(x)
static void code_unflag_leafmethod(codeinfo *code)
Second stage compiler class.
static u1 * do_nothing_function(void)
JNIEnv jthread jobject jclass jlong size
void dseg_display(jitdata *jd)
void jit_request_optimization(methodinfo *m)
#define TRACESUBSYSTEMINITIALIZATION(text)
void md_cacheflush(u1 *addr, s4 nbytes)
#define JITDATA_FLAG_PARSE
void vm_abort(const char *text,...)
#define RT_REGISTER_GROUP(var, name, description)
Register a new (toplevel) group.
codeinfo * code_codeinfo_new(methodinfo *m)
#define JITDATA_FLAG_SHOWINTERMEDIATE
void jit_renumber_basicblocks(jitdata *jd)
void jit_invalidate_code(methodinfo *m)
static u1 * jit_compile_intern(jitdata *jd)
#define RT_REGISTER_GROUP_TIMER(var, name, description, group)
Register a new timer.
bool opt_showddatasegment
ObjectFileWriterPass TODO: more info.
struct MethodLoopData MethodLoopData
jitdata * jit_jitdata_new(methodinfo *m)
bool stack_analyse(jitdata *jd)
static JNINativeMethod methods[]
alloc::list< PassInfo::IDTy >::type & stack
This file contains the statistics framework.
#define SHOW_FILTER_FLAG_SHOW_METHOD
#define JITDATA_HAS_FLAG_VERIFY(jd)
void reg_setup(jitdata *jd)
#define STAT_REGISTER_SUM_GROUP(var, name, description)
Register a statistics summary group.
bool method_matches(methodinfo *m, const char *name)
u1 * jit_recompile(methodinfo *m)
static void Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception, jmethodID catch_method, jlocation catch_location)
#define JITDATA_HAS_FLAG_IFCONV(jd)
#define JITDATA_HAS_FLAG_SHOWINTERMEDIATE(jd)
static Utf8String from_utf8(const char *, size_t)
void jit_generated(methodinfo *m, codeinfo *code)
Hook point just after code was generated.
static void code_flag_leafmethod(codeinfo *code)
void stacktrace_stackframeinfo_add(stackframeinfo_t *sfi, void *pv, void *sp, void *ra, void *xpc)
bool initialize_class(classinfo *c)
bool class_issubclass(classinfo *sub, classinfo *super)
This file contains the real-time timing utilities.
void * resolve_method(methodinfo *m)
Resolves a native method, maybe from a dynamic library.
void compilingtime_start(void)
void * md_jit_method_patch_address(void *pv, void *ra, void *mptr)
bool regalloc(jitdata *jd)
void codegen_setup(jitdata *jd)
This is a generic accessor class for Java arrays (of unspecified type), which can be used to safely o...
STAT_REGISTER_GROUP_VAR_EXTERN(int, size_classinfo, 0,"size classinfo","classinfo", info_struct_stat) STAT_REGISTER_GROUP_VAR(int
bool opt_showintermediate
void removeArrayBoundChecks(jitdata *jd)
#define JITDATA_FLAG_INLINE
void stacktrace_stackframeinfo_remove(stackframeinfo_t *sfi)
void show_filters_apply(methodinfo *m)
static void * allocate(size_t size)
#define JITDATA_FLAG_COUNTDOWN
#define RT_TIMER_STOPSTART(var1, var2)
Stop the timer var1 and start the timer var2.
#define TRACECOMPILERCALLS()
void jit_check_basicblock_numbers(jitdata *jd)
void fix_exception_handlers(jitdata *jd)
#define JITDATA_FLAG_SHOWDISASSEMBLE
ICMD jit_complement_condition(ICMD opcode)
bool codegen_generate(jitdata *jd)
bool intrp_codegen(jitdata *jd)
block_count * blocks[HASH_SIZE]
static void md_icacheflush(void *addr, int nbytes)
static codeinfo * generate(methodinfo *m, functionptr f)
Wrapper for codegen_emit_stub_native.
#define STAT_REGISTER_VAR_EXTERN(type, var, init, name, description)
Register an external statistics variable.
#define STAT_REGISTER_VAR(type, var, init, name, description)
Register an external statistics variable.
bool ifconv_static(jitdata *jd)
virtual void initialize()
Initialize the Pass.
void log_message_class(const char *msg, classinfo *c)
void compilingtime_stop(void)
static VM * get_current()