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)
/* inlining */
-#if defined(ENABLE_INLINING)
+#if defined(ENABLE_INLINING) && !defined(ENABLE_ESCAPE)
if (JITDATA_HAS_FLAG_INLINE(jd)) {
if (!inline_inline(jd))
return NULL;
/*&& strncmp(jd->m->name->text, "banana", 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);
replace_read_value(es, &instra, &(frame->instance));
#endif
}
+#if defined(__I386__)
+ else if (!(rp->method->flags & ACC_STATIC)) {
+ /* On i386 we always pass the first argument on stack. */
+ frame->instance.a = *(java_object_t **)(basesp + 1);
+ }
+#endif
#endif /* defined(REPLACE_PATCH_DYNAMIC_CALL) */
/* read stack slots */
/* we can only patch such calls if we are at the entry point */
+#if !defined(__I386__)
+ /* On i386 we always know the instance argument. */
if (!atentry)
return;
+#endif
assert((calleem->flags & ACC_STATIC) == 0);
else {
/* the call was statically bound */
+#if defined(__I386__)
+ /* It happens that there is a patcher trap. (pm) */
+ if (*(u2 *)(patchpos - 1) == 0x0b0f) {
+ } else
+#endif
replace_patch_method_pointer((methodptr *) patchpos, entrypoint, "static ");
}
}
*******************************************************************************/
-rplpoint *replace_find_replacement_point_for_pc(codeinfo *code, u1 *pc)
+rplpoint *replace_find_replacement_point_for_pc(codeinfo *code, u1 *pc, unsigned desired_flags)
{
rplpoint *found;
rplpoint *rp;
rp = code->rplpoints;
for (i=0; i<code->rplpointcount; ++i, ++rp) {
DOLOG( replace_replacement_point_println(rp, 2); );
- if (rp->pc <= pc && rp->pc + rp->callsize >= pc)
- found = rp;
+ if (rp->pc <= pc && rp->pc + rp->callsize >= pc) {
+ if (desired_flags) {
+ if (rp->flags & desired_flags) {
+ found = rp;
+ }
+ } else {
+ found = rp;
+ }
+ }
}
return found;
}
-
/* replace_pop_native_frame ****************************************************
Unroll a native frame in the execution state and create a source frame
/* find the replacement point at the call site */
after_machine_frame:
- rp = replace_find_replacement_point_for_pc(es->code, es->pc);
+ rp = replace_find_replacement_point_for_pc(es->code, es->pc, 0);
if (rp == NULL)
vm_abort("could not find replacement point while unrolling call");
/* search for a replacement point at the given PC */
- rp = replace_find_replacement_point_for_pc(code, pc);
+ rp = replace_find_replacement_point_for_pc(code, pc, (RPLPOINT_FLAG_ACTIVE | RPLPOINT_FLAG_COUNTDOWN));
/* check if the replacement point belongs to given PC and is active */
pv = NULL;
break;
-#if defined(ENABLE_REPLACEMENT)
- case TRAP_COUNTDOWN:
-#if defined(__I386__)
- replace_me_wrapper((char*)xpc - 13, context);
-#endif
- p = NULL;
- break;
-#endif
-
default:
/* do nothing */
break;
p = jit_compile_handle(m, sfi.pv, ra, (void *) val);
break;
+#if defined(ENABLE_REPLACEMENT)
+ case TRAP_COUNTDOWN:
+#if defined(__I386__)
+ replace_me_wrapper((char*)xpc - 13, context);
+#endif
+ p = NULL;
+ break;
+#endif
+
default:
/* Let's try to get a backtrace. */