X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjit%2Fjit.cpp;h=f560457b08840242381ce2fcddc94418b7d67568;hb=029131e1a80f63317b3e122771c104a51baa95d8;hp=baaf5900f62eeedcb16ce7aee9dbaa6e9ce91ac1;hpb=cce34f898a508bde05c54be7f19c0fbfeb2dc0a2;p=cacao.git diff --git a/src/vm/jit/jit.cpp b/src/vm/jit/jit.cpp index baaf5900f..f560457b0 100644 --- a/src/vm/jit/jit.cpp +++ b/src/vm/jit/jit.cpp @@ -1,6 +1,6 @@ /* src/vm/jit/jit.cpp - Just-In-Time compiler - Copyright (C) 1996-2005, 2006, 2007, 2008 + Copyright (C) 1996-2011 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO This file is part of CACAO. @@ -32,17 +32,18 @@ #include "md.h" -#include "mm/memory.h" +#include "mm/memory.hpp" #include "native/native.hpp" -#include "toolbox/logging.h" +#include "toolbox/logging.hpp" #include "threads/mutex.hpp" #include "vm/class.hpp" #include "vm/global.h" #include "vm/globals.hpp" +#include "vm/hook.hpp" #include "vm/initialize.hpp" #include "vm/loader.hpp" #include "vm/method.hpp" @@ -65,10 +66,6 @@ #include "vm/jit/stack.h" #include "vm/jit/stubs.hpp" -#if defined(ENABLE_OPAGENT) -#include "vm/jit/oprofile-agent.hpp" -#endif - #include "vm/jit/allocator/simplereg.h" #if defined(ENABLE_LSRA) && !defined(ENABLE_SSA) # include "vm/jit/allocator/lsra.h" @@ -173,11 +170,6 @@ void jit_init(void) #else intrp_md_init(); #endif - -#if defined(ENABLE_OPAGENT) - if (opt_EnableOpagent) - OprofileAgent::initialize(); -#endif } @@ -189,10 +181,7 @@ void jit_init(void) void jit_close(void) { -#if defined(ENABLE_OPAGENT) - if (opt_EnableOpagent) - OprofileAgent::close(); -#endif + /* nop */ } @@ -389,14 +378,6 @@ u1 *jit_compile(methodinfo *m) /* release codeinfo */ code_codeinfo_free(jd->code); - -#if defined(ENABLE_PROFILING) - /* Release memory for basic block profiling information. */ - - if (JITDATA_HAS_FLAG_INSTRUMENT(jd)) - if (jd->code->bbfrequency != NULL) - MFREE(jd->code->bbfrequency, u4, jd->code->basicblockcount); -#endif } else { DEBUG_JIT_COMPILEVERBOSE("Running: "); @@ -409,10 +390,8 @@ u1 *jit_compile(methodinfo *m) compilingtime_stop(); #endif -#if defined(ENABLE_OPAGENT) - if (opt_EnableOpagent) - OprofileAgent::newmethod(m); -#endif + // Hook point just after code was generated. + Hook::jit_generated(m, m->code); /* leave the monitor */ @@ -520,10 +499,8 @@ u1 *jit_recompile(methodinfo *m) compilingtime_stop(); #endif -#if defined(ENABLE_OPAGENT) - if (opt_EnableOpagent) - OprofileAgent::newmethod(m); -#endif + // Hook point just after code was generated. + Hook::jit_generated(m, m->code); DEBUG_JIT_COMPILEVERBOSE("Recompiling done: "); @@ -774,8 +751,10 @@ static u1 *jit_compile_intern(jitdata *jd) _must_ be done after loop optimization and register allocation, since they can change the basic block count. */ - if (JITDATA_HAS_FLAG_INSTRUMENT(jd)) + if (JITDATA_HAS_FLAG_INSTRUMENT(jd)) { + code->basicblockcount = jd->basicblockcount; code->bbfrequency = MNEW(u4, jd->basicblockcount); + } #endif DEBUG_JIT_COMPILEVERBOSE("Generating code: "); @@ -1057,9 +1036,14 @@ void *jit_compile_handle(methodinfo *m, void *pv, void *ra, void *mptr) *p = (uintptr_t) newpv; +#if !defined(JIT_COMPILER_VIA_SIGNAL) /* Flush both caches. */ + /* This might have been necessary before we had the compiler trap, but now + * it's not. I don't care enough about the (broken) non-signal case to + * investigate this. */ md_cacheflush(pa, SIZEOF_VOID_P); +#endif return newpv; }