51 #include "codegen.hpp"
94 #if defined(ENABLE_SSA)
97 #elif defined(ENABLE_LSRA)
101 #if defined(ENABLE_INTRP)
107 #define DEBUG_NAME "codegen"
110 STAT_REGISTER_VAR(
int,count_branches_unresolved,0,
"unresolved branches",
"unresolved branches")
112 STAT_REGISTER_GROUP_VAR(
u8,count_calls_java_to_native,0,"calls java to native","java-to-native calls",function_call_stat)
121 using namespace cacao;
171 #if defined(ENABLE_INTRP)
180 cd->ncodeptr = cd->ncodebase;
182 cd->lastinstwithoutdispatch = ~0;
183 cd->superstarts = NULL;
192 #if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(ENABLE_INTRP)
193 cd->datareferences = NULL;
233 #if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(ENABLE_INTRP)
234 cd->datareferences = NULL;
253 #if defined(ENABLE_REPLACEMENT)
254 code->rplpoints = NULL;
255 code->rplpointcount = 0;
256 code->regalloc = NULL;
257 code->regalloccount = 0;
258 code->globalcount = 0;
306 os::abort(
"codegen_generate: unknown error occurred during codegen_emit: flags=%x\n", cd->
flags);
363 #if defined(__I386__) || defined(__MIPS__) || defined(__X86_64__) || defined(ENABLE_INTRP) \
364 || defined(__SPARC_64__)
379 #if defined(ENABLE_INTRP)
386 oldncodebase = cd->ncodebase;
398 return (cd->ncodebase + (ncodeptr - oldncodebase));
451 assert(bptr->
mpc >= 0);
500 #if defined(ENABLE_REPLACEMENT)
501 void codegen_set_replacement_point(
codegendata *cd)
503 assert(cd->replacementpoint);
507 #if (defined(__AARCH64__) || defined(__X86_64__)) && defined(ENABLE_COUNTDOWN_TRAPS)
510 if (cd->replacementpoint->
flags & rplpoint::FLAG_COUNTDOWN) {
517 cd->replacementpoint++;
546 #if defined(ENABLE_REPLACEMENT)
547 static void codegen_create_replacement_point(
569 for (
s4 i = 0;
i < rp->method->maxlocals; ++
i) {
570 s4 varindex = javalocals[
i];
583 ra->inmemory =
false;
591 for (
s4 stack_index = 0; stack_index < stackdepth; stack_index++) {
592 s4 varindex = stackvars[stack_index];
595 ra->index = (stack_index < paramcount) ? RPLALLOC_PARAM : RPLALLOC_STACK;
609 rp->regalloccount = ra - rp->regalloc;
613 LOG(
"created replacement point " << rp <<
nl);
635 #if defined(ENABLE_REPLACEMENT)
637 #define CLEAR_javalocals(array, method) \
639 for (int i=0; i<(method)->maxlocals; ++i) \
640 (array)[i] = jitdata::UNUSED; \
643 #define COPY_OR_CLEAR_javalocals(dest, array, method) \
645 if ((array) != NULL) \
646 MCOPY((dest), (array), s4, (method)->maxlocals); \
648 CLEAR_javalocals((dest), (method)); \
651 #define COUNT_javalocals(array, method, counter) \
653 for (int i=0; i<(method)->maxlocals; ++i) \
654 if ((array)[i] != jitdata::UNUSED) \
658 void codegen_create_replacement_points(
jitdata *jd)
660 LOG(
"create replacement points for method '" << jd->
m->
name <<
"'" <<
nl);
671 assert(code->rplpoints == NULL);
672 assert(code->rplpointcount == 0);
673 assert(code->regalloc == NULL);
674 assert(code->regalloccount == 0);
675 assert(code->globalcount == 0);
698 COPY_OR_CLEAR_javalocals(live_javalocals, bptr->javalocals, method);
706 alloccount += bptr->indepth;
707 COUNT_javalocals(bptr->javalocals, bptr->method, alloccount);
715 for (; iptr != iend; ++iptr) {
719 #if defined(ENABLE_GC_CACAO)
722 COUNT_javalocals(live_javalocals, method, alloccount);
732 COUNT_javalocals(live_javalocals, method, alloccount);
751 alloccount += iptr->stackdepth_after;
752 COUNT_javalocals(live_javalocals, method, alloccount);
765 rplpoint *rplpoints =
MNEW(rplpoint, count);
766 rplalloc *allocs =
MNEW(rplalloc, alloccount);
767 rplalloc *ra = allocs;
771 rplpoint *rp = rplpoints;
786 COPY_OR_CLEAR_javalocals(live_javalocals, bptr->javalocals, method);
800 flags |= rplpoint::FLAG_TRAPPABLE;
801 flags |= rplpoint::FLAG_COUNTDOWN;
804 codegen_create_replacement_point(jd, rp++, bptr->iinstr, &ra,
805 live_javalocals, bptr->invars, bptr->indepth, 0, flags);
813 for (; iptr != iend; ++iptr) {
817 #if defined(ENABLE_GC_CACAO)
821 codegen_create_replacement_point(jd, rp++,
822 iptr, &va, live_javalocals, iptr->
sx.
s23.s2.args,
836 codegen_create_replacement_point(jd, rp++,
837 iptr, &ra, live_javalocals, iptr->
sx.
s23.s2.args,
857 codegen_create_replacement_point(jd, rp++, &iptr[1], &ra,
858 live_javalocals, iptr->stack_after,
859 iptr->stackdepth_after, 0, 0);
864 assert((rp - rplpoints) == count);
865 assert((ra - allocs) == alloccount);
869 code->rplpoints = rplpoints;
870 code->rplpointcount = count;
871 code->regalloc = allocs;
872 code->regalloccount = alloccount;
873 code->globalcount = 0;
874 code->memuse = rd->
memuse;
890 #if defined(ENABLE_INTRP)
906 #if defined(ENABLE_INTRP)
919 #if defined(ENABLE_INTRP)
921 ncodelen = cd->ncodeptr - cd->ncodebase;
928 alignedlen = alignedmcodelen + cd->
dseglen;
930 #if defined(ENABLE_INTRP)
932 alignedlen += ncodelen;
954 #if defined(ENABLE_INTRP)
963 MCOPY((
void *) ncodebase, cd->ncodebase,
u1, ncodelen);
971 cd->ncodebase = ncodebase;
974 cd->ncodebase = NULL;
1006 #if defined(ENABLE_REPLACEMENT)
1012 rp = code->rplpoints;
1013 for (i=0; i<code->rplpointcount; ++
i, ++rp) {
1023 #if defined(__I386__) || defined(__X86_64__) || defined(__XDSPCORE__) || defined(ENABLE_INTRP)
1026 dseg_resolve_datareferences(jd);
1040 #if defined(__AARCH64__)
1044 FrameInfo(
u1 *
sp, int32_t framesize) : sp(sp), framesize(framesize) {}
1045 uint8_t *get_datasp()
const {
return sp + framesize - SIZEOF_VOID_P; }
1046 uint8_t *get_javasp()
const {
return sp + framesize; }
1047 uint64_t *get_arg_regs()
const {
return (uint64_t *)
sp; }
1048 uint64_t *get_arg_stack()
const {
return (uint64_t *) get_javasp(); }
1049 uint64_t *get_ret_regs()
const {
return (uint64_t *)
sp; }
1051 #elif defined(__ALPHA__)
1055 FrameInfo(
u1 *
sp, int32_t framesize) : sp(sp), framesize(framesize) {}
1056 uint8_t *get_datasp()
const {
return sp + framesize - SIZEOF_VOID_P; }
1057 uint8_t *get_javasp()
const {
return sp + framesize; }
1058 uint64_t *get_arg_regs()
const {
return (uint64_t *)
sp; }
1059 uint64_t *get_arg_stack()
const {
return (uint64_t *) get_javasp(); }
1060 uint64_t *get_ret_regs()
const {
return (uint64_t *)
sp; }
1062 #elif defined(__ARM__)
1066 FrameInfo(
u1 *
sp, int32_t framesize) : sp(sp), framesize(framesize) {}
1067 uint8_t *get_datasp()
const {
return sp + framesize - SIZEOF_VOID_P; }
1068 uint8_t *get_javasp()
const {
return sp + framesize; }
1069 uint64_t *get_arg_regs()
const {
return (uint64_t *)
sp; }
1070 uint64_t *get_arg_stack()
const {
return (uint64_t *) get_javasp(); }
1071 uint64_t *get_ret_regs()
const {
return (uint64_t *)
sp; }
1073 #elif defined(__I386__)
1077 FrameInfo(
u1 *
sp, int32_t framesize) : sp(sp), framesize(framesize) {}
1078 uint8_t *get_datasp()
const {
return sp + framesize; }
1079 uint8_t *get_javasp()
const {
return sp + framesize + SIZEOF_VOID_P; }
1080 uint64_t *get_arg_regs()
const {
return (uint64_t *)
sp; }
1081 uint64_t *get_arg_stack()
const {
return (uint64_t *) get_javasp(); }
1082 uint64_t *get_ret_regs()
const {
return (uint64_t *) (
sp + 2 * SIZEOF_VOID_P); }
1084 #elif defined(__MIPS__)
1088 FrameInfo(
u1 *
sp, int32_t framesize) : sp(sp), framesize(framesize) {}
1090 uint8_t *get_datasp()
const {
return sp + framesize - 8; }
1091 uint8_t *get_javasp()
const {
return sp + framesize; }
1092 uint64_t *get_arg_regs()
const {
1093 # if SIZEOF_VOID_P == 8
1094 return (uint64_t *)
sp;
1096 return (uint64_t *) (
sp + 5 * 8);
1099 uint64_t *get_ret_regs()
const {
1100 # if SIZEOF_VOID_P == 8
1101 return (uint64_t *)
sp;
1103 return (uint64_t *) (
sp + 1 * 8);
1106 uint64_t *get_arg_stack()
const {
return (uint64_t *) get_javasp(); }
1108 #elif defined(__S390__)
1112 FrameInfo(
u1 *
sp, int32_t framesize) : sp(sp), framesize(framesize) {}
1113 uint8_t *get_datasp()
const {
return sp + framesize - 8; }
1114 uint8_t *get_javasp()
const {
return sp + framesize; }
1115 uint64_t *get_arg_regs()
const {
return (uint64_t *) (
sp + 96); }
1116 uint64_t *get_arg_stack()
const {
return (uint64_t *) get_javasp(); }
1117 uint64_t *get_ret_regs()
const {
return (uint64_t *) (
sp + 96); }
1119 #elif defined(__POWERPC__)
1123 FrameInfo(
u1 *
sp, int32_t framesize) : sp(sp), framesize(framesize) {}
1124 uint8_t *get_datasp()
const {
return sp + framesize; }
1125 uint8_t *get_javasp()
const {
return sp + framesize; }
1126 uint64_t *get_arg_regs()
const {
1127 return (uint64_t *) (
sp +
LA_SIZE + 4 * SIZEOF_VOID_P);
1129 uint64_t *get_arg_stack()
const {
return (uint64_t *) get_javasp(); }
1130 uint64_t *get_ret_regs()
const {
1131 return (uint64_t *) (
sp +
LA_SIZE + 2 * SIZEOF_VOID_P);
1134 #elif defined(__POWERPC64__)
1138 FrameInfo(
u1 *
sp, int32_t framesize) : sp(sp), framesize(framesize) {}
1139 uint8_t *get_datasp()
const {
return sp + framesize; }
1140 uint8_t *get_javasp()
const {
return sp + framesize; }
1141 uint64_t *get_arg_regs()
const {
1144 uint64_t *get_arg_stack()
const {
return (uint64_t *) get_javasp(); }
1145 uint64_t *get_ret_regs()
const {
1149 #elif defined(__X86_64__)
1153 FrameInfo(
u1 *
sp, int32_t framesize) : sp(sp), framesize(framesize) {}
1154 uint8_t *get_datasp()
const {
return sp + framesize; }
1155 uint8_t *get_javasp()
const {
return sp + framesize + SIZEOF_VOID_P; }
1156 uint64_t *get_arg_regs()
const {
return (uint64_t *)
sp; }
1157 uint64_t *get_arg_stack()
const {
return (uint64_t *) get_javasp(); }
1158 uint64_t *get_ret_regs()
const {
return (uint64_t *)
sp; }
1165 FrameInfo(
u1 *
sp, int32_t framesize) : sp(sp), framesize(framesize) {
1168 os::abort(
"codegen_start_native_call: unsupported architecture");
1170 uint8_t *get_datasp()
const {
return NULL; }
1171 uint8_t *get_javasp()
const {
return NULL; }
1172 uint64_t *get_arg_regs()
const {
return NULL; }
1173 uint64_t *get_arg_stack()
const {
return NULL; }
1174 uint64_t *get_ret_regs()
const {
return NULL; }
1226 assert(code != NULL);
1237 FrameInfo FI(sp,framesize);
1239 uint8_t *datasp = FI.get_datasp();
1241 #if defined(ENABLE_HANDLES) || ( !defined(NDEBUG) && !defined(__ARM__) )
1242 uint64_t *arg_regs = FI.get_arg_regs();
1243 uint64_t *arg_stack = FI.get_arg_stack();
1252 #if defined(ENABLE_JNI)
1258 #if !defined(NDEBUG)
1259 # if defined(__AARCH64__) || defined(__ALPHA__) || defined(__I386__) || defined(__MIPS__) || defined(__POWERPC__) || defined(__POWERPC64__) || defined(__S390__) || defined(__X86_64__)
1268 #if defined(ENABLE_HANDLES)
1312 assert(code != NULL);
1317 #if defined(ENABLE_HANDLES) || !defined(NDEBUG)
1324 FrameInfo FI(sp,framesize);
1326 uint8_t *datasp = FI.get_datasp();
1327 #if defined(ENABLE_HANDLES) || ( !defined(NDEBUG) && !defined(__ARM__) )
1328 uint64_t *ret_regs = FI.get_ret_regs();
1339 #if defined(ENABLE_HANDLES)
1354 #if defined(ENABLE_JNI)
1361 #if !defined(NDEBUG)
1362 # if defined(__AARCH64__) || defined(__ALPHA__) || defined(__I386__) || defined(__MIPS__) || defined(__POWERPC__) || defined(__POWERPC64__) || defined(__S390__) || defined(__X86_64__)
1436 #if !defined(__I386__)
1447 #if defined(ENABLE_SSA)
1449 bool last_cmd_was_goto =
false;
1453 int32_t savedregs_num = 0;
1461 #if STACKFRAME_RA_TOP_OF_FRAME
1462 # if STACKFRAME_LEAFMETHODS_RA_REGISTER
1488 #if defined(SPECIALMEMUSE)
1509 #if defined(__I386__)
1523 #if defined(ENABLE_PROFILING)
1528 emit_profile_method(cd, code);
1531 emit_profile_cycle_start(cd, code);
1542 #if !defined(NDEBUG)
1548 #if defined(ENABLE_SSA)
1554 #if defined(ENABLE_REPLACEMENT)
1556 codegen_create_replacement_points(jd);
1557 cd->replacementpoint = jd->
code->rplpoints;
1576 #if defined(ENABLE_REPLACEMENT)
1580 codegen_set_replacement_point(cd);
1584 #if defined(ENABLE_PROFILING)
1589 emit_profile_basicblock(cd, code, bptr);
1593 emit_profile_cycle_start(cd, code);
1598 int32_t indepth = bptr->indepth;
1603 #if defined(ENABLE_SSA)
1606 last_cmd_was_goto =
false;
1608 #elif defined(ENABLE_LSRA)
1610 while (indepth > 0) {
1612 var =
VAR(bptr->invars[indepth]);
1626 while (indepth > 0) {
1628 var =
VAR(bptr->invars[indepth]);
1640 #if defined(ENABLE_SSA) || defined(ENABLE_LSRA)
1645 int32_t len = bptr->icount;
1646 uint16_t currentline = 0;
1647 for (
instruction* iptr = bptr->iinstr; len > 0; len--, iptr++) {
1650 if (iptr->
line != currentline) {
1652 currentline = iptr->
line;
1662 switch (iptr->
opc) {
1682 #if defined(ENABLE_SSA)
1838 #if !defined(ENABLE_SOFTFLOAT)
1923 #if defined(__I386__)
1942 fi = iptr->
sx.
s23.s3.fmiref->p.field;
1943 fieldtype = fi->
type;
1961 switch (fieldtype) {
1967 #if defined(ENABLE_SOFTFLOAT)
1974 #if defined(ENABLE_SOFTFLOAT)
1980 #if !defined(ENABLE_SOFTFLOAT)
2001 #if defined(__I386__)
2008 #if defined(USES_PATCHABLE_MEMORY_BARRIER)
2017 #if defined(USES_PATCHABLE_MEMORY_BARRIER)
2025 fi = iptr->
sx.
s23.s3.fmiref->p.field;
2026 fieldtype = fi->
type;
2042 switch (fieldtype) {
2048 #if defined(ENABLE_SOFTFLOAT)
2055 #if defined(ENABLE_SOFTFLOAT)
2061 #if !defined(ENABLE_SOFTFLOAT)
2072 #if defined(USES_PATCHABLE_MEMORY_BARRIER)
2090 #ifdef ENABLE_VERIFIER
2105 #if defined(ENABLE_SSA)
2109 last_cmd_was_goto =
true;
2110 codegen_emit_phi_moves(jd, bptr);
2131 #if SUPPORT_BRANCH_CONDITIONAL_ONE_INTEGER_REGISTER
2133 #elif SUPPORT_BRANCH_CONDITIONAL_CONDITION_REGISTER
2137 # error Unable to generate code for this configuration!
2154 #if SUPPORT_BRANCH_CONDITIONAL_ONE_INTEGER_REGISTER
2155 if (iptr->
sx.
val.
i == 0) {
2162 #elif SUPPORT_BRANCH_CONDITIONAL_CONDITION_REGISTER
2167 # error Unable to generate code for this configuration!
2191 #if SUPPORT_BRANCH_CONDITIONAL_TWO_INTEGER_REGISTERS
2192 switch (iptr->
opc) {
2194 emit_beq(cd, iptr->
dst.
block, s1, s2);
2197 emit_bne(cd, iptr->
dst.
block, s1, s2);
2202 #elif SUPPORT_BRANCH_CONDITIONAL_CONDITION_REGISTER
2205 #elif SUPPORT_BRANCH_CONDITIONAL_ONE_INTEGER_REGISTER
2207 switch (iptr->
opc) {
2218 # error Unable to generate code for this configuration!
2227 #if SUPPORT_BRANCH_CONDITIONAL_TWO_INTEGER_REGISTERS
2230 switch (iptr->
opc) {
2232 emit_beq(cd, iptr->
dst.
block, s1, s2);
2235 emit_bne(cd, iptr->
dst.
block, s1, s2);
2252 #if SUPPORT_BRANCH_CONDITIONAL_CONDITION_REGISTER
2253 # if defined(__I386__) || defined(__X86_64__)
2260 #elif SUPPORT_BRANCH_CONDITIONAL_ONE_INTEGER_REGISTER
2264 # error Unable to generate code for this configuration!
2283 goto nowperformreturn;
2291 #ifdef ENABLE_VERIFIER
2299 goto nowperformreturn;
2302 #if defined(ENABLE_SOFTFLOAT)
2309 goto nowperformreturn;
2312 #if defined(ENABLE_SOFTFLOAT)
2319 goto nowperformreturn;
2321 #if !defined(ENABLE_SOFTFLOAT)
2325 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2330 goto nowperformreturn;
2335 #if defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2340 goto nowperformreturn;
2344 #if !defined(NDEBUG)
2365 bte = iptr->
sx.
s23.s3.bte;
2368 #if defined(ENABLE_ESCAPE_REASON) && defined(__I386__)
2369 if (bte->
fp == BUILTIN_escape_reason_new) {
2370 void set_escape_reasons(
void *);
2391 emit_fastpath(jd, iptr, d);
2398 #if SUPPORT_BRANCH_CONDITIONAL_ONE_INTEGER_REGISTER
2399 os::abort(
"codegen_emit: Implement jump over slow-path for this configuration.");
2400 #elif SUPPORT_BRANCH_CONDITIONAL_CONDITION_REGISTER
2404 # error Unable to generate code for this configuration!
2415 #if defined(ENABLE_REPLACEMENT)
2416 codegen_set_replacement_point(cd);
2435 for (i = i - 1; i >= 0; i--) {
2436 var =
VAR(iptr->
sx.
s23.s2.args[i]);
2444 switch (var->
type) {
2447 #if defined(ENABLE_SOFTFLOAT)
2455 #if defined(ENABLE_SOFTFLOAT)
2462 #if !defined(ENABLE_SOFTFLOAT)
2464 #if !defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2474 #if !defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2489 switch (var->
type) {
2498 #if defined(ENABLE_SOFTFLOAT)
2501 #if SIZEOF_VOID_P == 4
2510 #if defined(ENABLE_SOFTFLOAT)
2519 #if !defined(ENABLE_SOFTFLOAT)
2548 #if defined(ENABLE_REPLACEMENT)
2553 - (
ptrint) cd->replacementpoint[-1].pc;
2561 #if defined(ENABLE_SSA)
2569 #if defined(ENABLE_SOFTFLOAT)
2579 #if defined(ENABLE_SOFTFLOAT)
2588 #if !defined(ENABLE_SOFTFLOAT)
2590 #if !defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2601 #if !defined(SUPPORT_PASS_FLOATARGS_IN_INTREGS)
2636 i = iptr->
sx.
s23.s2.lookupcount;
2645 #if SUPPORT_BRANCH_CONDITIONAL_CONDITION_REGISTER
2647 emit_beq(cd, lookup->target.block);
2648 #elif SUPPORT_BRANCH_CONDITIONAL_TWO_INTEGER_REGISTERS
2650 emit_beq(cd, lookup->target.block, s1,
REG_ITMP2);
2651 #elif SUPPORT_BRANCH_CONDITIONAL_ONE_INTEGER_REGISTER
2653 emit_bnez(cd, lookup->target.block,
REG_ITMP2);
2655 # error Unable to generate code for this configuration!
2679 #if defined(ENABLE_REPLACEMENT)
2681 codegen_set_replacement_point(cd);
2687 #if defined(ENABLE_SSA)
2691 if (!last_cmd_was_goto)
2692 codegen_emit_phi_moves(jd, bptr);
2696 #if defined(__I386__) || defined(__MIPS__) || defined(__S390__) || defined(__SPARC_64__) || defined(__X86_64__)
2736 #if defined(ENABLE_SSA)
2757 #if defined(SSA_DEBUG_VERBOSE)
2759 printf(
"BB %3i Move %3i <- %3i ", bptr->
nr, lt_d, lt_s);
2762 #if defined(SSA_DEBUG_VERBOSE)
2764 printf(
" ... not processed \n");
2774 #if defined(SSA_DEBUG_VERBOSE)
2776 printf(
"...returning - phi lifetimes where joined\n");
2782 #if defined(SSA_DEBUG_VERBOSE)
2784 printf(
"...returning - phi lifetimes where joined\n");
2794 #if defined(SSA_DEBUG_VERBOSE)
void codegen_emit_instruction(jitdata *jd, instruction *iptr)
Generates machine code for one ICMD.
#define CODEGENDATA_FLAG_ERROR
static bool instruction_has_side_effects(const instruction *iptr)
s4 emit_load_s1(jitdata *jd, instruction *iptr, s4 tempreg)
static void codegen_reset(jitdata *jd)
#define M_ALD(a, b, disp)
void localref_native_exit(methodinfo *m, uint64_t *return_regs)
#define STATISTICS(x)
Wrapper for statistics only code.
DumpList< Linenumber > * linenumbers
List of line numbers.
#define STACKFRAME_SYNC_NEEDS_TWO_SLOTS
void emit_monitor_exit(jitdata *jd, int32_t syncslot_offset)
Generates synchronization code to leave a monitor.
#define M_LST(a, b, disp)
#define STAT_REGISTER_SUM_SUBGROUP(var, name, description, group)
Register a statistics summary group.
void linenumbertable_list_entry_add(codegendata *cd, int32_t linenumber)
#define JITDATA_HAS_FLAG_VERBOSECALL(jd)
#define M_ILD(a, b, disp)
methodinfo * code_get_methodinfo_for_pv(void *pv)
s4 dseg_add_unique_address(codegendata *cd, void *value)
#define M_IST(a, b, disp)
Linenumber table of a Java method.
void dynamic_super_rewrite(codegendata *cd)
#define DMREALLOC(ptr, type, num1, num2)
#define PATCHER_CALL_SIZE
void emit_monitor_enter(jitdata *jd, int32_t syncslot_offset)
Generates synchronization code to enter a monitor.
void log_message_method(const char *msg, methodinfo *m)
void emit_trap_countdown(codegendata *cd, s4 *counter)
#define M_AADD_IMM(a, b, c)
#define M_CAST_L2D(a, Fb)
static void fixup_exc_handler_interface(jitdata *jd, basicblock *bptr)
Fix up register locations in the case where control is transferred to an exception handler block via ...
s4 dseg_add_address(codegendata *cd, void *value)
s4 codegen_reg_of_var(u2 opcode, varinfo *v, s4 tempregnum)
void emit_bcc(codegendata *cd, basicblock *target, s4 condition, u4 options)
void localref_table_remove()
#define JITDATA_HAS_FLAG_INSTRUMENT(jd)
#define PATCHER_resolve_class
static void emit_lmove(codegendata *cd, int s, int d)
Generates a long-move from register s to d.
#define M_CAST_D2L(Fa, b)
typedef void(JNICALL *jvmtiEventSingleStep)(jvmtiEnv *jvmti_env
struct lifetime * lifetime
#define JITDATA_HAS_FLAG_DEOPTIMIZE(jd)
#define M_FST(a, b, disp)
void localref_native_enter(methodinfo *m, uint64_t *argument_regs, uint64_t *argument_stack)
patchref_t * patcher_add_patch_ref(jitdata *jd, functionptr patcher, void *ref, s4 disp)
void patcher_resolve(codeinfo *code)
Resolve all patchers in the current JIT run.
#define M_FLD(a, b, disp)
void trace_java_call_exit(methodinfo *m, uint64_t *return_regs)
void codegen_increase(codegendata *cd)
#define PATCHER_breakpoint
java_object_t * codegen_finish_native_call(u1 *sp, u1 *pv)
#define CODEGENDATA_HAS_FLAG_LONGBRANCHES(cd)
#define JITDATA_HAS_FLAG_COUNTDOWN(jd)
#define CODEGENDATA_FLAG_LONGBRANCHES
JNIEnv jthread jobject jclass jlong size
void emit_recompute_pv(codegendata *cd)
Emit code to recompute the procedure vector.
#define PATCHER_get_putstatic
static int code_is_leafmethod(codeinfo *code)
void md_cacheflush(u1 *addr, s4 nbytes)
void(* functionptr)(void)
void emit_verbosecall_enter(jitdata *jd)
java_handle_t * codegen_start_native_call(u1 *sp, u1 *pv)
#define MCOPY(dest, src, type, num)
int opt_TraceBuiltinCalls
#define CODEGENDATA_HAS_FLAG_ERROR(cd)
#define STACKFRAME_RA_BETWEEN_FRAMES
#define LLNI_classinfo_wrap(classinfo)
s4 codegen_reg_of_dst(jitdata *jd, instruction *iptr, s4 tempregnum)
void trace_java_call_enter(methodinfo *m, uint64_t *arg_regs, uint64_t *stack)
void codegen_resolve_branchrefs(codegendata *cd, basicblock *bptr)
#define PROFILE_CYCLE_STOP
void emit_patcher_traps(jitdata *jd)
JNIEnv jthread jmethodID method
constant_FMIref * fieldref
void localref_frame_pop_all(void)
This file contains the statistics framework.
s4 emit_load_s2(jitdata *jd, instruction *iptr, s4 tempreg)
static codeinfo * code_get_codeinfo_for_pv(void *pv)
#define STAT_REGISTER_GROUP_VAR(type, var, init, name, description, group)
Register an statistics variable and add it to a group.
static void * reallocate(void *src, size_t len1, size_t len2)
Stupid realloc implementation for dump memory.
Type
Types used internally by JITTED code.
void exceptions_throw_internalerror(const char *message,...)
#define RETADDR_FROM_JAVALOCAL(jl)
void linenumbertable_list_entry_add_inline_start(codegendata *cd, instruction *iptr)
#define MEMORY_ALIGN(pos, size)
void dseg_finish(jitdata *jd)
void patcher_list_reset(codeinfo *code)
#define M_ASUB_IMM(a, b, c)
#define exceptions_get_and_clear_exception
#define STAT_REGISTER_GROUP(var, name, description)
Register a statistics group.
s4 emit_load(jitdata *jd, instruction *iptr, varinfo *src, s4 tempreg)
basicblock ** basicblocks
void stacktrace_stackframeinfo_add(stackframeinfo_t *sfi, void *pv, void *sp, void *ra, void *xpc)
s4 dseg_add_unique_s4(codegendata *cd, s4 value)
void emit_store(jitdata *jd, instruction *iptr, varinfo *dst, s4 d)
DumpList< branch_label_ref_t * > * brancheslabel
void codegen_branch_label_add(codegendata *cd, s4 label, s4 condition, s4 reg, u4 options)
#define M_AST(a, b, disp)
union instruction::@12 sx
struct localref_table localref_table
void stack_javalocals_store(instruction *iptr, s4 *javalocals)
#define M_CAST_I2F(a, Fb)
#define INSTRUCTION_GET_METHODDESC(iptr, md)
void emit_icmp_imm(codegendata *cd, int reg, int32_t value)
Emits code comparing a single register.
void emit_store_dst(jitdata *jd, instruction *iptr, s4 d)
functionptr emit_fastpath
void emit_copy(jitdata *jd, instruction *iptr)
#define LOG(STMT)
Analogous to DEBUG.
void codegen_setup(jitdata *jd)
void exceptiontable_create(jitdata *jd)
constant_FMIref * methodref
void emit_icmpeq_imm(codegendata *cd, int reg, int32_t value, int d)
Emits code comparing one integer register to an immediate value.
int32_t synchronizedoffset
void stacktrace_stackframeinfo_remove(stackframeinfo_t *sfi)
static bool IS_INMEMORY(s4 flags)
void codegen_emit_epilog(jitdata *jd)
Generates machine code for the method epilog.
LinenumberTable * linenumbertable
#define STAT_DECLARE_GROUP(var)
Declare an external group (or subgroup).
void codegen_add_branch_ref(codegendata *cd, basicblock *target, s4 condition, s4 reg, u4 options)
#define M_ALD_DSEG(a, disp)
static void * allocate(size_t size)
void methodtree_insert(void *startpc, void *endpc)
static bool class_is_or_almost_initialized(classinfo *c)
static int code_is_synchronized(codeinfo *code)
#define PATCHER_initialize_class
#define M_DST(a, b, disp)
#define INSTRUCTION_IS_UNRESOLVED(iptr)
struct instruction::@12::@13 s23
#define M_CAST_F2I(Fa, b)
void codegen_emit_prolog(jitdata *jd)
Generates machine code for the method prolog.
#define M_LLD(a, b, disp)
const parseddesc_t parseddesc
static void emit_fmove(codegendata *cd, int s, int d)
Generates a float-move from register s to d.
bool codegen_generate(jitdata *jd)
void emit_label(codegendata *cd, s4 label)
void linenumbertable_list_entry_add_inline_end(codegendata *cd, instruction *iptr)
void emit_bccz(codegendata *cd, basicblock *target, s4 condition, s4 reg, u4 options)
static void emit_dmove(codegendata *cd, int s, int d)
Generates an double-move from register s to d.
static void emit_imove(codegendata *cd, int s, int d)
Generates an integer-move from register s to d.
void localref_table_add(localref_table *lrt)
#define M_DLD(a, b, disp)
#define STAT_REGISTER_VAR(type, var, init, name, description)
Register an external statistics variable.
void emit_verbosecall_exit(jitdata *jd)
void emit_br(codegendata *cd, basicblock *target)
const char const void jint length
bool opt_AlwaysEmitLongBranches
void codegen_emit_patchable_barrier(instruction *iptr, codegendata *cd, patchref_t *pr, fieldinfo *fi)
Generates a memory barrier to be used after volatile writes.
#define LA_SIZE_IN_POINTERS
bool codegen_emit(jitdata *jd)
Generates machine code.
void emit_nullpointer_check(codegendata *cd, instruction *iptr, s4 reg)
static int32_t md_stacktrace_get_framesize(codeinfo *code)
Returns the size (in bytes) of the current stackframe, specified by the passed codeinfo structure...
#define PROFILE_CYCLE_START
void codegen_finish(jitdata *jd)
#define INS_FLAG_ID_SHIFT