49 #if defined(ENABLE_RT_TIMING)
66 #define DEBUG_NAME "replace"
68 using namespace cacao;
70 #define REPLACE_PATCH_DYNAMIC_CALL
75 #define TOP_IS_NORMAL 0
76 #define TOP_IS_ON_STACK 1
77 #define TOP_IS_IN_ITMP1 2
84 #define REPLACE_IS_NATIVE_FRAME(frame) ((frame)->sfi != NULL)
89 #define REPLACE_IS_CALL_SITE(rp) ((rp)->callsize > 0)
105 MFREE(code->rplpoints,rplpoint,code->rplpointcount);
108 MFREE(code->regalloc,rplalloc,code->regalloccount);
110 code->rplpoints = NULL;
111 code->rplpointcount = 0;
112 code->regalloc = NULL;
113 code->regalloccount = 0;
114 code->globalcount = 0;
139 assert(code->savedmcode == NULL);
144 i = code->rplpointcount;
145 rp = code->rplpoints;
147 if (!(rp->flags & rplpoint::FLAG_TRAPPABLE))
151 if (mappable && (rp->type == rplpoint::TYPE_RETURN))
161 code->savedmcode = savedmcode;
167 i = code->rplpointcount;
168 rp = code->rplpoints +
i;
170 assert(!(rp->flags & rplpoint::FLAG_ACTIVE));
172 if (!(rp->flags & rplpoint::FLAG_TRAPPABLE))
176 if (mappable && (rp->type == rplpoint::TYPE_RETURN))
180 LOG2(
"activate replacement point: " << rp <<
nl);
183 md_patch_replacement_point(rp->pc, savedmcode,
false);
184 rp->flags |= rplpoint::FLAG_ACTIVE;
187 assert(savedmcode == code->savedmcode);
209 assert(code->savedmcode != NULL);
210 savedmcode = code->savedmcode;
214 i = code->rplpointcount;
215 rp = code->rplpoints;
218 if (!(rp->flags & rplpoint::FLAG_ACTIVE))
223 LOG2(
"deactivate replacement point: " << rp <<
nl);
224 md_patch_replacement_point(rp->pc, savedmcode,
true);
225 rp->flags &= ~rplpoint::FLAG_ACTIVE;
233 MFREE(code->savedmcode,
u1, count * REPLACEMENT_PATCH_SIZE);
234 code->savedmcode = NULL;
254 replace_val_t *javaval)
258 #ifdef HAS_4BYTE_STACKSLOT
260 javaval->l = *(
u8*)(es->
sp + ra->regoff);
264 javaval->p = *(
ptrint*)(es->
sp + ra->regoff);
265 #ifdef HAS_4BYTE_STACKSLOT
272 javaval->d = es->
fltregs[ra->regoff];
275 javaval->f = javaval->d;
278 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
285 javaval->p = es->
intregs[ra->regoff];
304 replace_val_t *javaval)
308 #ifdef HAS_4BYTE_STACKSLOT
310 *(
u8*)(es->
sp + ra->regoff) = javaval->l;
314 *(
ptrint*)(es->
sp + ra->regoff) = javaval->p;
315 #ifdef HAS_4BYTE_STACKSLOT
323 es->
fltregs[ra->regoff] = (double) javaval->f;
326 es->
fltregs[ra->regoff] = javaval->d;
335 es->
intregs[ra->regoff] = javaval->p;
358 sourceframe_t *frame;
361 MZERO(frame, sourceframe_t, 1);
363 frame->down = ss->frames;
393 rplpoint::TYPE_RETURN,
405 sourceframe_t *frame;
408 #if defined(__I386__)
413 LOG(
"read execution state at replacement point " << rp <<
nl);
418 topframe = ss->frames == NULL;
427 if (rp->type == rplpoint::TYPE_EXH) {
434 #if defined(__I386__)
441 frame->method = rp->method;
448 frame->fromcode = code;
453 frame->javalocals = (replace_val_t*)
DumpMemory::allocate(
sizeof(replace_val_t) * frame->javalocalcount);
457 for (
int javalocal_index = 0; javalocal_index < frame->javalocalcount;
460 frame->javalocals[javalocal_index].l = (
u8) 0x00dead0000dead00ULL;
462 frame->javalocaltype[javalocal_index] =
TYPE_VOID;
477 int remaining_allocations = rp->regalloccount;
479 while (remaining_allocations && ra->index >= 0) {
481 frame->javalocaltype[ra->index] = ra->type;
483 frame->javalocals[ra->index].i = ra->regoff;
487 remaining_allocations--;
492 #if defined(REPLACE_PATCH_DYNAMIC_CALL)
493 if (topframe && !(rp->method->flags &
ACC_STATIC) && rp == code->rplpoints) {
497 if (frame->javalocaltype[0] ==
TYPE_ADR)
498 frame->instance = frame->javalocals[0];
503 md = rp->method->parseddesc;
518 #if defined(__I386__)
528 frame->javastackdepth = remaining_allocations;
529 frame->javastack = (replace_val_t*)
DumpMemory::allocate(
sizeof(replace_val_t) * frame->javastackdepth);
534 for (
int stack_index = 0; stack_index < frame->javastackdepth; ++stack_index) {
535 frame->javastack[stack_index].l = (
u8) 0x00dead0000dead00ULL;
536 frame->javastacktype[stack_index] =
TYPE_VOID;
545 assert(remaining_allocations);
547 assert(ra->index == RPLALLOC_STACK);
549 frame->javastack[stack_index].p = sp[-1];
550 frame->javastacktype[stack_index] =
TYPE_ADR;
551 remaining_allocations--;
556 assert(remaining_allocations);
558 assert(ra->index == RPLALLOC_STACK);
561 frame->javastacktype[stack_index] =
TYPE_ADR;
562 remaining_allocations--;
567 assert(remaining_allocations);
569 assert(ra->index == RPLALLOC_STACK);
570 frame->javastack[stack_index].l = 0;
571 frame->javastacktype[stack_index] =
TYPE_VOID;
572 remaining_allocations--;
579 for (; remaining_allocations--; ra++) {
580 if (ra->index == RPLALLOC_SYNC) {
581 assert(rp->type == rplpoint::TYPE_INLINE);
586 sourceframe_t *calleeframe = frame->down;
588 assert(calleeframe->syncslotcount == 0);
589 assert(calleeframe->syncslots == NULL);
591 calleeframe->syncslotcount = 1;
596 frame->javastackdepth--;
600 assert(ra->index == RPLALLOC_STACK || ra->index == RPLALLOC_PARAM);
604 if (!topframe && ra->index == RPLALLOC_PARAM) {
605 frame->javastackdepth--;
608 frame->javastack[stack_index].i = ra->regoff;
611 frame->javastacktype[stack_index] = ra->type;
616 LOG(
"recovered source frame: [" << frame <<
"]" <<
nl);
644 sourceframe_t *frame;
649 LOG(
"write execution state for " << rp <<
nl);
653 topframe = ss->frames->down == NULL;
659 ss->frames = frame->down;
665 #
if defined(__AARCH64__) || defined(__X86_64__)
669 # if defined(__X86_64__)
670 es->
intregs[
RBP] = (uintptr_t) (sp + frame->tocode->stackframesize - 1);
672 # elif defined(__AARCH64__)
673 auto stackframesize = frame->tocode->stackframesize + (frame->tocode->stackframesize % 2);
683 if (rp->type == rplpoint::TYPE_EXH) {
691 int remaining_allocations = rp->regalloccount;
693 while (remaining_allocations && ra->index >= 0) {
695 assert(ra->index < frame->javalocalcount);
696 assert(ra->type == frame->javalocaltype[ra->index]);
702 remaining_allocations--;
713 assert(remaining_allocations);
715 assert(ra->index == RPLALLOC_STACK);
716 assert(stack_index < frame->javastackdepth);
717 assert(frame->javastacktype[stack_index] ==
TYPE_ADR);
718 sp[-1] = frame->javastack[stack_index].p;
719 remaining_allocations--;
724 assert(remaining_allocations);
726 assert(ra->index == RPLALLOC_STACK);
727 assert(stack_index < frame->javastackdepth);
728 assert(frame->javastacktype[stack_index] ==
TYPE_ADR);
730 remaining_allocations--;
735 assert(remaining_allocations);
737 assert(ra->index == RPLALLOC_STACK);
738 assert(stack_index < frame->javastackdepth);
739 assert(frame->javastacktype[stack_index] ==
TYPE_VOID);
740 remaining_allocations--;
747 for (; remaining_allocations--; ra++) {
748 if (ra->index == RPLALLOC_SYNC) {
749 assert(rp->type == rplpoint::TYPE_INLINE);
755 assert(frame->down->syncslotcount == 1);
756 assert(frame->down->syncslots != NULL);
763 assert(ra->index == RPLALLOC_STACK || ra->index == RPLALLOC_PARAM);
767 if (!topframe && ra->index == RPLALLOC_PARAM) {
777 assert(stack_index < frame->javastackdepth);
778 assert(ra->type == frame->javastacktype[stack_index]);
826 #if STACKFRAME_RA_BETWEEN_FRAMES
827 es->
sp -= SIZEOF_VOID_P;
828 *((
void **)es->
sp) = (
void *) ra;
844 #
if defined(__AARCH64__)
855 #if !defined(NDEBUG) && 0
856 for (i=0; i< (basesp -
sp) && i < 1; ++
i) {
861 #if defined(__I386__)
865 if ((basesp - sp) > 0) {
872 #if STACKFRAME_RA_TOP_OF_FRAME
873 # if STACKFRAME_LEAFMETHODS_RA_REGISTER
879 #if STACKFRAME_RA_LINKAGE_AREA
880 # if STACKFRAME_LEAFMETHODS_RA_REGISTER
886 #if defined(__AARCH64__) || defined(__X86_64__)
888 # if defined(__X86_64__)
891 # elif defined(__AARCH64__)
898 #if defined(__AARCH64__)
911 *((uintptr_t*) basesp) = es->
intregs[reg];
914 #if !defined(NDEBUG) && 0
929 *((
double*) basesp) = es->
fltregs[reg];
932 #if !defined(NDEBUG) && 0
933 *(
u8*)&(es->
fltregs[reg]) = 0x44dead4444dead44ULL;
958 sourceframe_t *frame)
969 LOG(
"pop activation record for method [" << frame->method->name <<
"]" <<
nl);
974 assert(frame->syncslotcount == 0);
975 assert(frame->syncslots == NULL);
976 count = code_get_sync_slot_count(es->
code);
977 frame->syncslotcount = count;
979 for (i=0; i<count; ++
i) {
980 frame->syncslots[
i].p = *((intptr_t*) (sp + es->
code->memuse + i));
990 #if defined(__AARCH64__)
991 if (((
u8)es->
pc) % 4) {
1006 es->
pv = (uint8_t*) pv;
1027 #if !defined(NDEBUG)
1031 assert(oldcode->
m == newcode->
m);
1034 LOG(
"patch method pointer from " << (
void *) *mpp <<
" to "
1035 << (
void *) entrypoint <<
nl);
1076 assert(oldentrypoint);
1081 for (; mpp != mppend; ++mpp)
1082 if (*mpp == oldentrypoint) {
1130 LOG(
"patching class hierarchy: " << *m <<
nl);
1151 sourceframe_t *callerframe,
1152 sourceframe_t *calleeframe)
1157 #if !defined(__I386__)
1167 assert(callerframe->down == calleeframe);
1171 calleecode = calleeframe->tocode;
1174 calleem = calleeframe->method;
1175 assert(calleem == calleecode->
m);
1181 #
if !defined(__I386__)
1182 atentry = (calleeframe->down == NULL)
1184 && (calleeframe->fromrp->id == 0);
1189 pv = callerframe->fromcode->entrypoint;
1190 if (callerframe->fromcode->optlevel > 0) {
1191 patchpos = (
u1*) callerframe->fromrp->patch_target_addr;
1196 if (patchpos == NULL) {
1201 #if !defined(__I386__)
1209 oldentrypoint = calleeframe->fromcode->entrypoint;
1213 if (!calleeframe->instance.a) {
1221 obj = calleeframe->instance.a;
1232 #if defined(__I386__) || defined(__X86_64__)
1234 if (*(
u2 *)(patchpos - 1) == 0x0b0f) {
1235 LOG2(
"enountered patcher trap, not patching static call");
1240 #if defined(__AARCH64__)
1242 if ((*(
u4 *)(patchpos - 4) & (0xE7000700)) == 0xE7000700) {
1248 LOG2(
"patch static call of [" << *calleem <<
"] in ["
1249 << *callerframe->method <<
"]" <<
nl);
1277 sourceframe_t *callerframe,
1278 sourceframe_t *calleeframe)
1286 assert(!rpcall || callerframe);
1288 assert(!rpcall || rpcall->type == rplpoint::TYPE_CALL);
1290 assert(!rpcall || rpcall == callerframe->torp);
1291 assert(calleeframe);
1292 assert(!callerframe || calleeframe == callerframe->down);
1294 LOG(
"push activation record for " << *calleeframe->method <<
nl);
1298 calleecode = calleeframe->tocode;
1306 ra = rpcall->pc + rpcall->callsize;
1308 #if defined(__X86_64__)
1323 es->
code = calleecode;
1332 count = code_get_sync_slot_count(calleecode);
1333 assert(count == calleeframe->syncslotcount);
1334 for (
s4 slot_index = 0; slot_index < count; ++slot_index) {
1335 *((intptr_t*) (sp + calleecode->memuse + slot_index)) = calleeframe->syncslots[slot_index].p;
1340 if (callerframe && rpcall) {
1341 #if !defined(REPLACE_PATCH_ALL)
1342 if (rpcall == callerframe->fromrp)
1349 sourceframe_t *frame)
1354 LOG(
"searching for call site rp for source id " << frame->id
1355 <<
" in method [" << *frame->method <<
"]" <<
nl);
1357 rplpoint *rp = code->rplpoints;
1359 for (
s4 i = 0;
i < code->rplpointcount;
i++, rp++) {
1360 if (rp->id == frame->id
1361 && rp->method == frame->method
1367 ABORT_MSG(
"no matching replacement point found",
"");
1387 sourceframe_t *frame)
1396 LOG(
"searching for rp for source id " << frame->id
1397 <<
" in method [" << *frame->method <<
"]" <<
nl);
1399 rp = code->rplpoints;
1400 for (
s4 i = 0;
i < code->rplpointcount;
i++, rp++) {
1401 if (rp->id == frame->id && rp->method == frame->method) {
1406 for (
s4 j = rp->regalloccount; j--; ++ra) {
1408 if (ra->index == RPLALLOC_STACK) {
1409 assert(stacki < frame->javastackdepth);
1410 if (frame->javastack[stacki].i != ra->regoff)
1414 assert(ra->index >= 0 && ra->index < frame->javalocalcount);
1415 if (frame->javalocals[ra->index].i != ra->regoff)
1426 ABORT_MSG(
"no matching replacement point found",
"");
1447 unsigned int desired_flags) {
1448 LOG(
"searching for nearest rp before pc " << pc
1449 <<
" in method [" << *code->
m <<
"]" <<
nl);
1451 rplpoint *nearest = NULL;
1452 rplpoint *rp = code->rplpoints;
1454 for (
s4 i = 0;
i < code->rplpointcount; ++
i, ++rp) {
1455 if (rp->pc <= pc && (rp->flags & desired_flags)) {
1456 if (nearest == NULL || nearest->pc < rp->pc) {
1485 LOG(
"searching for rp at pc " << pc <<
" in method [" << *code->
m <<
"]"
1488 rp = code->rplpoints;
1489 for (i=0; i<code->rplpointcount; ++
i, ++rp) {
1490 if (rp->pc <= pc && rp->pc + rp->callsize >= pc) {
1518 sourceframe_t *frame;
1530 frame->nativepc = es->
pc;
1531 frame->nativeframesize = (es->
sp != 0) ? (((uintptr_t) sfi->
sp) - ((uintptr_t) es->
sp)) : 0;
1532 assert(frame->nativeframesize >= 0);
1539 frame->nativesavint[j++] = es->
intregs[
i];
1545 frame->nativesavflt[j++] = es->
fltregs[
i];
1571 #if STACKFRAME_RA_BETWEEN_FRAMES
1572 es->
sp += SIZEOF_VOID_P;
1575 es->
pc = (uint8_t*) (((uintptr_t) ((sfi->
xpc) ? sfi->
xpc : sfi->
ra)) - 1);
1601 sourceframe_t *frame;
1607 LOG(
"push native frame" <<
nl);
1615 ss->frames = frame->down;
1620 #if STACKFRAME_RA_BETWEEN_FRAMES
1621 es->
sp -= SIZEOF_VOID_P;
1626 assert(es->
sp == frame->sfi->sp);
1633 es->
intregs[
i] = frame->nativesavint[j++];
1639 es->
fltregs[
i] = frame->nativesavflt[j++];
1644 es->
sp -= frame->nativeframesize;
1648 es->
pc = frame->nativepc;
1673 sourcestate_t *ss) {
1680 rplpoint *next_rp = NULL;
1684 LOG(
"INLINED!" <<
nl);
1686 next_rp = rp->parent;
1689 assert(next_rp->type == rplpoint::TYPE_INLINE);
1695 if (es->
code == NULL) {
1696 LOG(
"REACHED NATIVE CODE" <<
nl);
1745 if (rpcall != NULL) {
1775 sourceframe_t *prevframe;
1782 while (ss->frames) {
1784 prevframe = ss->frames;
1789 if (parent == NULL) {
1795 rp = ss->frames->torp;
1798 es->
code = ss->frames->tocode;
1799 prevframe = ss->frames;
1838 sourceframe_t *topframe;
1839 sourceframe_t *callerframe;
1841 if (ss->frames->down) {
1842 callerframe = ss->frames;
1843 topframe = ss->frames->down;
1846 topframe = ss->frames;
1858 callerframe->tocode = callerframe->fromcode;
1859 callerframe->torp = callerframe->fromrp;
1889 LOG(
"handle countdown trap" <<
nl);
1902 assert(rp->flags & rplpoint::FLAG_COUNTDOWN);
1903 assert(method->hitcountdown <= 0);
1942 if (rp != NULL && (rp->flags & rplpoint::FLAG_ACTIVE)) {
1944 LOG(
"handle replacement trap" <<
nl);
1975 LOG(
"handle deopimization trap" <<
nl);
1990 assert(rp->flags & rplpoint::FLAG_DEOPTIMIZE);
1996 sourceframe_t *topframe;
1997 sourceframe_t *callerframe;
1999 if (ss->frames->down) {
2000 callerframe = ss->frames;
2001 topframe = ss->frames->down;
2004 topframe = ss->frames;
2009 if (topframe->method->deopttarget == NULL) {
2013 LOG(
"reinvoke baseline compiler" <<
nl);
2015 topframe->method->deopttarget = topframe->method->code;
2016 assert(topframe->method->deopttarget);
2019 topframe->tocode = topframe->method->deopttarget;
2025 callerframe->tocode = callerframe->fromcode;
2026 callerframe->torp = callerframe->fromrp;
2041 #define TYPECHAR(t) (((t) >= 0 && (t) <= TYPE_RET) ? show_jit_type_letters[t] : '?')
2047 return OS <<
"(rplpoint *) NULL";
2055 OS <<
"id=" << rp.id <<
", pc=" << rp.pc;
2058 if (rp.flags & rplpoint::FLAG_ACTIVE) {
2061 if (rp.flags & rplpoint::FLAG_TRAPPABLE) {
2062 OS <<
" TRAPPABLE ";
2064 if (rp.flags & rplpoint::FLAG_COUNTDOWN) {
2065 OS <<
" COUNTDOWN ";
2067 if (rp.flags & rplpoint::FLAG_DEOPTIMIZE) {
2068 OS <<
" DEOPTIMIZE ";
2072 OS <<
", parent=" << rp.parent <<
", ";
2073 OS <<
"allocations=[";
2075 for (
int j=0; j < rp.regalloccount; ++j) {
2079 OS << rp.regalloc[j];
2083 OS <<
"method=[" << *rp.method <<
"], ";
2084 OS <<
"callsize=" << rp.callsize;
2093 return OS <<
"(rplalloc *) NULL";
2102 case RPLALLOC_STACK: OS <<
"S";
break;
2103 case RPLALLOC_PARAM: OS <<
"P";
break;
2104 case RPLALLOC_SYNC : OS <<
"Y";
break;
2105 default: OS << ra.index;
2108 OS <<
":" <<
TYPECHAR(ra.type) <<
", ";
2111 OS <<
"ret(L" << ra.regoff <<
")";
2112 }
else if (ra.inmemory) {
2113 OS <<
"M" << ra.regoff;
2115 OS <<
"F" << ra.regoff;
2119 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2121 # if defined(ENABLE_JIT)
2124 OS << abi_registers_integer_name[
GET_HIGH_REG(ra.regoff)];
2133 #if defined(SUPPORT_COMBINE_INTEGER_REGISTERS)
2145 return OS <<
"(sourceframe_t *) NULL";
2147 return OS << *frame;
2156 OS <<
"<INVALID TYPE:" << type <<
">";
2161 OS <<
", raw=" << value.l <<
", value=";
2163 if (type ==
TYPE_ADR && value.a != NULL) {
2189 for (
s4 i = 0;
i < count; ++
i) {
2199 if (
i + 1 < count) {
2211 OS <<
"nativepc=" << frame.nativepc <<
nl;
2212 OS <<
"framesize=" << frame.nativeframesize <<
nl;
2214 OS <<
"registers (integer)=[";
2222 OS <<
"registers (float)=[";
2225 OS <<
"F" <<
i <<
": " << frame.nativesavflt[j++] <<
", ";
2230 OS <<
"method=" << frame.method->name <<
", ";
2231 OS <<
"id=" << frame.id;
2234 if (frame->instance.a) {
2236 java_value_print(
TYPE_ADR, frame->instance);
2241 if (frame.javalocalcount) {
2242 OS <<
", locals (" << frame.javalocalcount <<
")=[";
2244 frame.javalocalcount);
2248 if (frame.javastackdepth) {
2249 OS <<
", stack (depth=" << frame.javastackdepth <<
")=[";
2251 frame.javastackdepth);
2256 if (frame->syncslotcount) {
2257 printf(
"\tsynchronization slots (%d):\n",frame->syncslotcount);
2258 for (
i=0;
i<frame->syncslotcount; ++
i) {
2259 printf(
"\tslot[%2d] = %016llx\n",
i,(
unsigned long long) frame->syncslots[
i].p);
2265 if (frame.fromcode) {
2266 OS <<
", from=" << (
void*) frame.fromcode;
2269 OS <<
", to=" << (
void*) frame.tocode;
2281 return OS <<
"(sourcestate_t *) NULL" <<
nl;
2287 OS <<
"sourcestate_t:" <<
nl;
2289 sourceframe_t *frame;
2290 for (i = 0, frame = ss.frames; frame != NULL; frame = frame->down, ++i) {
2291 OS <<
"frame " << i <<
": [" << frame <<
"]" <<
nl;
methodptr * interfacetable[1]
static void replace_push_native_frame(executionstate_t *es, sourcestate_t *ss)
codeinfo * jit_get_current_code(methodinfo *m)
sourcestate_t * replace_recover_source_state(rplpoint *rp, executionstate_t *es)
void replace_free_replacement_points(codeinfo *code)
void executionstate_pop_stackframe(executionstate_t *es)
Restore callee-saved registers (including the RA register), set the stack pointer to the next stackfr...
static void replace_optimize(codeinfo *code, rplpoint *rp, executionstate_t *es)
rplpoint * replace_find_replacement_point(codeinfo *code, sourceframe_t *frame)
methodinfo * code_get_methodinfo_for_pv(void *pv)
void replace_activate_replacement_points(codeinfo *code, bool mappable)
Utf8String to_utf8() const
#define SUPPORT_COMBINE_INTEGER_REGISTERS
void replace_handle_deoptimization_trap(u1 *pc, executionstate_t *es)
static sourceframe_t * replace_new_sourceframe(sourcestate_t *ss)
rplpoint * replace_recover_source_frame(rplpoint *rp, executionstate_t *es, sourcestate_t *ss)
void replace_deactivate_replacement_points(codeinfo *code)
static s4 replace_normalize_type_map[]
static void replace_pop_native_frame(executionstate_t *es, sourcestate_t *ss, stackframeinfo_t *sfi)
void replace_patch_future_calls(u1 *ra, sourceframe_t *callerframe, sourceframe_t *calleeframe)
void replace_patch_callback(classinfo *c, struct replace_patch_data_t *pd)
static void md_dcacheflush(void *addr, int nbytes)
static void replace_build_execution_state(sourcestate_t *ss, executionstate_t *es)
rplpoint * replace_find_replacement_point_at_or_before_pc(codeinfo *code, u1 *pc, unsigned int desired_flags)
s4 * interfacevftbllength
void(* classcache_foreach_functionptr_t)(classinfo *, void *)
static int code_is_using_frameptr(codeinfo *code)
void jit_request_optimization(methodinfo *m)
static int code_is_leafmethod(codeinfo *code)
void replace_patch_class_hierarchy(methodinfo *m, u1 *oldentrypoint, u1 *entrypoint)
static void replace_read_value(executionstate_t *es, rplalloc *ra, replace_val_t *javaval)
void md_cacheflush(u1 *addr, s4 nbytes)
#define IS_2_WORD_TYPE(a)
static void replace_write_value(executionstate_t *es, rplalloc *ra, replace_val_t *javaval)
codeinfo * code_find_codeinfo_for_pc(void *pc)
#define MFREE(ptr, type, num)
JNIEnv jthread jmethodID method
void replace_patch_class(vftbl_t *vftbl, methodinfo *m, u1 *oldentrypoint, u1 *entrypoint)
static codeinfo * code_get_codeinfo_for_pv(void *pv)
const char * show_jit_type_names[]
#define IS_FLT_DBL_TYPE(a)
#define MZERO(ptr, type, num)
Simple stream class for formatted output.
#define SIZE_OF_STACKSLOT
static void * md_codegen_get_pv_from_pc(void *ra)
void md_push_stackframe(executionstate_t *es, codeinfo *calleecode, u1 *ra)
rplpoint * replace_find_replacement_point_for_pc(codeinfo *code, u1 *pc)
OStream & operator<<(OStream &OS, const std::string &t)
#define STACK_SLOTS_PER_FLOAT
void replace_pop_activation_record(executionstate_t *es, sourceframe_t *frame)
const char * abi_registers_integer_name[]
This file contains the real-time timing utilities.
void utf_display_printable_ascii(Utf8String u)
void replace_push_activation_record(executionstate_t *es, rplpoint *rpcall, sourceframe_t *callerframe, sourceframe_t *calleeframe)
#define LOG(STMT)
Analogous to DEBUG.
void * md_jit_method_patch_address(void *pv, void *ra, void *mptr)
#define REPLACEMENT_PATCH_SIZE
classinfo * class_java_lang_String
static void replace_write_executionstate(rplpoint *rp, executionstate_t *es, sourcestate_t *ss)
bool replace_handle_replacement_trap(u1 *pc, executionstate_t *es)
static OStream & replace_val_print(OStream &OS, s4 type, replace_val_t value)
void replace_handle_countdown_trap(u1 *pc, executionstate_t *es)
static void * allocate(size_t size)
static void replace_patch_method_pointer(methodptr *mpp, methodptr entrypoint, const char *kind)
void classcache_foreach_loaded_class(classcache_foreach_functionptr_t func, void *data)
#define REPLACE_IS_NATIVE_FRAME(frame)
Determines whether a given sourceframe represents a frame of a native method.
uintptr_t intregs[INT_REG_CNT]
#define REPLACE_IS_CALL_SITE(rp)
Determeines whether the given replacement point is at a call site.
rplpoint * replace_find_replacement_point_at_call_site(codeinfo *code, sourceframe_t *frame)
#define ABORT_MSG(EXPR_SHORT, EXPR_LONG)
double fltregs[FLT_REG_CNT]
u1 * jit_recompile_for_deoptimization(methodinfo *m)
static void replace_read_executionstate(rplpoint *rp, executionstate_t *es, sourcestate_t *ss)
static int32_t md_stacktrace_get_framesize(codeinfo *code)
Returns the size (in bytes) of the current stackframe, specified by the passed codeinfo structure...
static OStream & print_replace_vals(OStream &OS, replace_val_t *values, u1 *types, s4 count)