projects
/
cacao.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* src/vm/jit/jit.cpp: Eliminate one instance of useless cache flushing.
[cacao.git]
/
src
/
vm
/
jit
/
jit.cpp
diff --git
a/src/vm/jit/jit.cpp
b/src/vm/jit/jit.cpp
index baada57fef79badded260c7f1e14953d491ba8aa..f560457b08840242381ce2fcddc94418b7d67568 100644
(file)
--- 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
/* src/vm/jit/jit.cpp - Just-In-Time compiler
- Copyright (C) 1996-20
05, 2006, 2007, 2008
+ Copyright (C) 1996-20
11
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
This file is part of CACAO.
@@
-32,20
+32,21
@@
#include "md.h"
#include "md.h"
-#include "mm/memory.h"
+#include "mm/memory.h
pp
"
-#include "native/native.h"
+#include "native/native.h
pp
"
-#include "toolbox/logging.h"
+#include "toolbox/logging.h
pp
"
#include "threads/mutex.hpp"
#include "threads/mutex.hpp"
-#include "vm/class.h"
+#include "vm/class.h
pp
"
#include "vm/global.h"
#include "vm/globals.hpp"
#include "vm/global.h"
#include "vm/globals.hpp"
-#include "vm/initialize.h"
+#include "vm/hook.hpp"
+#include "vm/initialize.hpp"
#include "vm/loader.hpp"
#include "vm/loader.hpp"
-#include "vm/method.h"
+#include "vm/method.h
pp
"
#include "vm/options.h"
#include "vm/rt-timing.h"
#include "vm/statistics.h"
#include "vm/options.h"
#include "vm/rt-timing.h"
#include "vm/statistics.h"
@@
-58,17
+59,13
@@
#include "vm/jit/disass.h"
#include "vm/jit/dseg.h"
#include "vm/jit/jit.hpp"
#include "vm/jit/disass.h"
#include "vm/jit/dseg.h"
#include "vm/jit/jit.hpp"
-#include "vm/jit/parse.h"
+#include "vm/jit/parse.h
pp
"
#include "vm/jit/reg.h"
#include "vm/jit/reg.h"
-#include "vm/jit/show.h"
+#include "vm/jit/show.h
pp
"
#include "vm/jit/stack.h"
#include "vm/jit/stubs.hpp"
#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"
#include "vm/jit/allocator/simplereg.h"
#if defined(ENABLE_LSRA) && !defined(ENABLE_SSA)
# include "vm/jit/allocator/lsra.h"
@@
-80,7
+77,7
@@
#endif
#if defined(ENABLE_INLINING)
#endif
#if defined(ENABLE_INLINING)
-# include "vm/jit/inline/inline.h"
+# include "vm/jit/inline/inline.h
pp
"
#endif
#include "vm/jit/ir/bytecode.h"
#endif
#include "vm/jit/ir/bytecode.h"
@@
-99,7
+96,7
@@
# include "vm/jit/python.h"
#endif
# include "vm/jit/python.h"
#endif
-#include "vm/jit/verify/typecheck.h"
+#include "vm/jit/verify/typecheck.h
pp
"
/* debug macros ***************************************************************/
/* debug macros ***************************************************************/
@@
-173,11
+170,6
@@
void jit_init(void)
#else
intrp_md_init();
#endif
#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)
{
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);
/* 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: ");
}
else {
DEBUG_JIT_COMPILEVERBOSE("Running: ");
@@
-409,10
+390,8
@@
u1 *jit_compile(methodinfo *m)
compilingtime_stop();
#endif
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 */
/* leave the monitor */
@@
-520,10
+499,8
@@
u1 *jit_recompile(methodinfo *m)
compilingtime_stop();
#endif
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: ");
DEBUG_JIT_COMPILEVERBOSE("Recompiling done: ");
@@
-569,17
+546,15
@@
static u1 *jit_compile_intern(jitdata *jd)
show_filters_apply(jd->m);
#endif
show_filters_apply(jd->m);
#endif
- /* Handle native methods and create a native stub. */
-
+ // Handle native methods and create a native stub.
if (m->flags & ACC_NATIVE) {
if (m->flags & ACC_NATIVE) {
- functionptr f;
-
- f = native_method_resolve(m);
+ NativeMethods& nm = VM::get_current()->get_nativemethods();
+ void* f = nm.resolve_method(m);
if (f == NULL)
return NULL;
if (f == NULL)
return NULL;
- code = NativeStub::generate(m, f);
+ code = NativeStub::generate(m,
(functionptr)
f);
/* Native methods are never recompiled. */
/* Native methods are never recompiled. */
@@
-776,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. */
_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);
code->bbfrequency = MNEW(u4, jd->basicblockcount);
+ }
#endif
DEBUG_JIT_COMPILEVERBOSE("Generating code: ");
#endif
DEBUG_JIT_COMPILEVERBOSE("Generating code: ");
@@
-1059,9
+1036,14
@@
void *jit_compile_handle(methodinfo *m, void *pv, void *ra, void *mptr)
*p = (uintptr_t) newpv;
*p = (uintptr_t) newpv;
+#if !defined(JIT_COMPILER_VIA_SIGNAL)
/* Flush both caches. */
/* 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);
md_cacheflush(pa, SIZEOF_VOID_P);
+#endif
return newpv;
}
return newpv;
}