with some patcher dump function.
* src/vm/options.h: Likewise.
* src/vm/jit/alpha/patcher.c,
src/vm/jit/arm/patcher.c,
src/vm/jit/i386/patcher.c,
src/vm/jit/m68k/codegen.h,
src/vm/jit/m68k/patcher.c,
src/vm/jit/mips/patcher.c,
src/vm/jit/patcher-common.c,
src/vm/jit/powerpc/patcher.c,
src/vm/jit/powerpc64/patcher.c,
src/vm/jit/s390/codegen.h,
src/vm/jit/s390/patcher.c,
src/vm/jit/sparc64/patcher.c,
src/vm/jit/x86_64/patcher.c,
src/vm/vm.cpp: Likewise.
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop */
-
- if (opt_shownops)
- ra = ra + 4;
-
/* patch the field's offset into the instruction */
*((u4 *) ra) |= (s2) (fi->offset & 0x0000ffff);
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop */
-
- if (opt_shownops)
- ra = ra + 4;
-
/* patch vftbl index */
*((s4 *) (ra + 4)) |= (s4) ((OFFSET(vftbl_t, table[0]) +
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop */
-
- if (opt_shownops)
- ra = ra + 4;
-
/* patch interfacetable index */
*((s4 *) (ra + 4)) |= (s4) ((OFFSET(vftbl_t, interfacetable[0]) -
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop */
-
- if (opt_shownops)
- ra = ra + 4;
-
/* patch super class index */
*((s4 *) (ra + 2 * 4)) |= (s4) (-(c->index) & 0x0000ffff);
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop */
-
- if (opt_shownops)
- ra = ra + 4;
-
/* patch super class index */
*((s4 *) (ra + 2 * 4)) |= (s4) (-(c->index) & 0x0000ffff);
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop */
-
- if (opt_shownops)
- ra = ra + 1 * 4;
-
/* patch the field's offset into the instruction */
switch(fi->type) {
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop */
-
- if (opt_shownops)
- ra = ra + 1 * 4;
-
/* patch vftbl index */
gen_resolveload(*((s4 *) (ra + 1 * 4)), (s4) (OFFSET(vftbl_t, table[0]) + sizeof(methodptr) * m->vftblindex));
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop */
-
- if (opt_shownops)
- ra = ra + 1 * 4;
-
/* patch interfacetable index */
gen_resolveload(*((s4 *) (ra + 1 * 4)), (s4) (OFFSET(vftbl_t, interfacetable[0]) - sizeof(methodptr*) * m->clazz->index));
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch the field value's address */
*((intptr_t *) (ra + 1)) = (intptr_t) fi->value;
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch the field's offset */
*((u4 *) (ra + 2)) = (u4) (fi->offset);
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch the field's offset */
if (fi->type != TYPE_LNG) {
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch the field's offset */
if (!IS_2_WORD_TYPE(fi->type)) {
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch the classinfo pointer */
*((ptrint *) (ra + 1)) = (ptrint) c;
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch the classinfo pointer */
*((ptrint *) (ra + 7 + 4)) = (ptrint) c;
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch the classinfo pointer */
*((ptrint *) (ra + 4)) = (ptrint) c;
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch stubroutine */
*((ptrint *) (ra + 1)) = (ptrint) m->stubroutine;
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch vftbl index */
*((s4 *) (ra + 2 + 2)) = (s4) (OFFSET(vftbl_t, table[0]) +
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch interfacetable index */
*((s4 *) (ra + 2 + 2)) = (s4) (OFFSET(vftbl_t, interfacetable[0]) -
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch class flags */
*((s4 *) (ra + 1)) = (s4) c->flags;
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch super class index */
*((s4 *) (ra + 6 + 2)) = (s4) c->index;
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch super class index */
*((s4 *) (ra + 6 + 2)) = (s4) c->index;
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch super class' vftbl */
*((ptrint *) (ra + 1)) = (ptrint) c->vftbl;
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch super class' vftbl */
*((ptrint *) (ra + 1)) = (ptrint) c->vftbl;
#define PATCHER_NOPS \
do { M_TPFL; M_TPF; M_TPF } while (0);
-#define PATCHER_CALL_SIZE (3*2)
+#define PATCHER_CALL_SIZE 2
/* stub defines ***************************************************************/
/* patch back original code */
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show NOPs, we have to skip them */
- if (opt_shownops) ra += PATCHER_CALL_SIZE;
-
assert( *((u2*)(ra+8)) == 0x286b);
/* patch vftbl index */
/* patch back original code */
PATCH_BACK_ORIGINAL_MCODE;
- /* patch stubroutine */
- if (opt_shownops) disp += PATCHER_CALL_SIZE;
-
*((ptrint *) (disp+2)) = (ptrint) m->stubroutine;
/* synchronize inst cache */
PATCH_BACK_ORIGINAL_MCODE;
/* patch the classinfo pointer */
- if (opt_shownops) disp += PATCHER_CALL_SIZE;
*((ptrint *) (disp+2)) = (ptrint) c;
/* synchronize inst cache */
md_icacheflush(pr->mpc, 2);
/* patch the field value's address */
- if (opt_shownops) disp += PATCHER_CALL_SIZE;
assert(*((uint16_t*)(disp)) == 0x247c);
*((intptr_t *) (disp+2)) = (intptr_t) fi->value;
PATCH_BACK_ORIGINAL_MCODE;
md_icacheflush(pr->mpc, 2);
- /* if we show NOPs, we have to skip them */
- if (opt_shownops) ra += PATCHER_CALL_SIZE;
-
/* patch the field's offset */
if (IS_LNG_TYPE(fi->type)) {
/*
md_icacheflush(pr->mpc, 2);
/* patch class flags */
- if (opt_shownops) disp += PATCHER_CALL_SIZE;
assert( (*((u2*)(disp)) == 0x263c) || (*((u2*)(disp)) == 0x283c) );
*((s4 *) (disp + 2)) = (s4) c->flags;
md_icacheflush(pr->mpc, 2);
/* patch super class' vftbl */
- if (opt_shownops) disp += PATCHER_CALL_SIZE;
assert( (*((u2*)disp) == 0x287c) || (*((u2*)disp)== 0x267c) );
*((s4 *) (disp+2)) = (s4) c->vftbl;
PATCH_BACK_ORIGINAL_MCODE;
md_icacheflush(pr->mpc, 2);
- /* if we show NOPs, we have to skip them */
- if (opt_shownops) ra += PATCHER_CALL_SIZE;
-
/* patch super class index */
disp = -(c->index);
assert( *((u2*)(ra + 8)) == 0xd8bc );
PATCH_BACK_ORIGINAL_MCODE;
md_icacheflush(pr->mpc, 2);
- /* if we show NOPs, we have to skip them */
- if (opt_shownops) ra += PATCHER_CALL_SIZE;
-
/* patch super class index */
disp = -(c->index);
assert ( *((u2 *)(ra + 8)) == 0xd8bc );
md_icacheflush(pr->mpc, 2);
/* patch native function pointer */
- if (opt_shownops) disp += PATCHER_CALL_SIZE;
*((ptrint *) (disp + 2)) = (ptrint) f;
/* synchronize data cache */
md_icacheflush(pr->mpc, 2);
/* if we show NOPs, we have to skip them */
- if (opt_shownops) ra += PATCHER_CALL_SIZE;
assert( *((uint32_t*)ra) == 0x246f0000 );
/* patch interfacetable index (first #0) */
return true;
}
+
+
/*
* These are local overrides for various environment variables in Emacs.
* Please do not remove this and leave it at the end of the file, where
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
#if SIZEOF_VOID_P == 4
if (IS_LNG_TYPE(fi->type)) {
# if WORDS_BIGENDIAN == 1
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch vftbl index */
*((s4 *) (ra + 1 * 4)) |=
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch interfacetable index */
*((s4 *) (ra + 1 * 4)) |=
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch super class index */
*((s4 *) (ra + 2 * 4)) |= (s4) (-(c->index) & 0x0000ffff);
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch super class index */
*((s4 *) (ra + 2 * 4)) |= (s4) (-(c->index) & 0x0000ffff);
pr->mcode = 0;
pr->done = false;
- /* Generate NOPs for opt_shownops. */
-
- if (opt_shownops)
- PATCHER_NOPS;
-
#if defined(ENABLE_JIT) && (defined(__I386__) || defined(__M68K__) || defined(__SPARC_64__) || defined(__X86_64__))
/* XXX We can remove that when we don't use UD2 anymore on i386
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show NOPs, we have to skip them */
-
- if (opt_shownops)
- ra = ra + 1 * 4;
-
/* patch the field's offset */
if (IS_LNG_TYPE(fi->type)) {
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show NOPs, we have to skip them */
-
- if (opt_shownops)
- ra = ra + 1 * 4;
-
/* patch vftbl index */
disp = (OFFSET(vftbl_t, table[0]) + sizeof(methodptr) * m->vftblindex);
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show NOPs, we have to skip them */
-
- if (opt_shownops)
- ra = ra + 1 * 4;
-
/* patch interfacetable index */
disp = OFFSET(vftbl_t, interfacetable[0]) -
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show NOPs, we have to skip them */
-
- if (opt_shownops)
- ra = ra + 1 * 4;
-
/* patch super class index */
disp = -(c->index);
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show NOPs, we have to skip them */
-
- if (opt_shownops)
- ra = ra + 1 * 4;
-
/* patch super class index */
disp = -(c->index);
md_icacheflush(ra, 4);
- /* if we show disassembly, we have to skip the nop */
-
- if (opt_shownops)
- ra = ra + 4;
-
/* patch the field's offset */
*((u4 *) ra) |= (s2) (fi->offset & 0x0000ffff);
md_icacheflush(ra, 4);
- /* if we show disassembly, we have to skip the nop */
-
- if (opt_shownops)
- ra = ra + 4;
-
/* patch vftbl index */
disp = (OFFSET(vftbl_t, table[0]) + sizeof(methodptr) * m->vftblindex);
md_icacheflush(ra, 4);
- /* if we show disassembly, we have to skip the nop */
-
- if (opt_shownops)
- ra = ra + 4;
-
/* patch interfacetable index */
disp = OFFSET(vftbl_t, interfacetable[0]) -
md_icacheflush(ra, 4);
- /* if we show NOPs, we have to skip them */
- if (opt_shownops)
- ra = ra +4;
-
/* patch super class index */
disp = -(c->index);
md_icacheflush(ra, 4);
- /* if we show disassembly, we have to skip the nop */
-
- if (opt_shownops)
- ra = ra + 4;
-
/* patch super class index */
disp = -(c->index);
#define PATCHER_CALL_SIZE 2 /* size in bytes of a patcher call */
#define PATCHER_NOPS M_NOP3
-#define PATCHER_NOPS_SKIP 2
/* branch defines ************************************************************/
PATCH_BACK_ORIGINAL_MCODE;
- /* If NOPs are generated, skip them */
-
- if (opt_shownops)
- ra += PATCHER_NOPS_SKIP;
-
/* If there is an operand load before, skip the load size passed in disp (see ICMD_PUTFIELD) */
ra += disp;
PATCH_BACK_ORIGINAL_MCODE;
- /* If NOPs are generated, skip them */
-
- if (opt_shownops)
- ra += PATCHER_NOPS_SKIP;
-
/* patch vftbl index */
PATCH_BACK_ORIGINAL_MCODE;
- /* If NOPs are generated, skip them */
-
- if (opt_shownops)
- ra += PATCHER_NOPS_SKIP;
-
/* get interfacetable index */
idx = (s4) (OFFSET(vftbl_t, interfacetable[0]) -
PATCH_BACK_ORIGINAL_MCODE;
- /* If NOPs are generated, skip them */
-
- if (opt_shownops)
- ra += PATCHER_NOPS_SKIP;
-
/* patch super class index */
/* From here, split your editor and open codegen.c */
if (!(fi = resolve_field_eager(uf)))
return false;
- /* if we show disassembly, we have to skip the nop's */
+ /* store the patched instruction on the stack */
- if (opt_shownops) {
- /* patch the field's offset into the instruction */
-
- *((u4 *) (ra + 2 * 4)) |= (s2) (fi->offset & 0x00001fff);
-
- /* synchronize instruction cache */
-
- md_icacheflush(ra + 2 * 4, 1 * 4);
- }
- else {
- /* otherwise store the patched instruction on the stack */
-
- *((u4 *) (sp + 3 * 8)) |= (s2) (fi->offset & 0x00001fff);
- }
+ *((u4 *) (sp + 3 * 8)) |= (s2) (fi->offset & 0x00001fff);
return true;
}
if (!(m = resolve_method_eager(um)))
return false;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops) {
- ra = ra + PATCHER_CALL_SIZE;
+ /* patch vftbl index */
- /* patch vftbl index */
-
- *((s4 *) (ra + 1 * 4)) |=
- (s4) ((OFFSET(vftbl_t, table[0]) +
- sizeof(methodptr) * m->vftblindex) & 0x00001fff);
-
- /* synchronize instruction cache */
-
- md_icacheflush(ra + 1 * 4, 1 * 4);
- }
- else {
- /* patch vftbl index */
-
- *((s4 *) (sp + 3 * 8 + 4)) |=
- (s4) ((OFFSET(vftbl_t, table[0]) +
- sizeof(methodptr) * m->vftblindex) & 0x00001fff);
- }
+ *((s4 *) (sp + 3 * 8 + 4)) |=
+ (s4) ((OFFSET(vftbl_t, table[0]) +
+ sizeof(methodptr) * m->vftblindex) & 0x00001fff);
return true;
}
if (!(m = resolve_method_eager(um)))
return false;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops) {
- ra = ra + PATCHER_CALL_SIZE;
+ /* patch interfacetable index */
- /* patch interfacetable index */
-
- *((s4 *) (ra + 1 * 4)) |=
- (s4) ((OFFSET(vftbl_t, interfacetable[0]) -
- sizeof(methodptr*) * m->clazz->index) & 0x00001fff);
-
- /* patch method offset */
-
- *((s4 *) (ra + 2 * 4)) |=
- (s4) ((sizeof(methodptr) * (m - m->clazz->methods)) & 0x00001fff);
-
- /* synchronize instruction cache */
-
- md_icacheflush(ra + 1 * 4, 2 * 4);
- }
- else {
- /* patch interfacetable index */
-
- *((s4 *) (sp + 3 * 8 + 4)) |=
- (s4) ((OFFSET(vftbl_t, interfacetable[0]) -
- sizeof(methodptr*) * m->clazz->index) & 0x00001fff);
+ *((s4 *) (sp + 3 * 8 + 4)) |=
+ (s4) ((OFFSET(vftbl_t, interfacetable[0]) -
+ sizeof(methodptr*) * m->clazz->index) & 0x00001fff);
- /* patch method offset */
+ /* patch method offset */
- *((s4 *) (ra + 2 * 4)) |=
- (s4) ((sizeof(methodptr) * (m - m->clazz->methods)) & 0x00001fff);
+ *((s4 *) (ra + 2 * 4)) |=
+ (s4) ((sizeof(methodptr) * (m - m->clazz->methods)) & 0x00001fff);
- /* synchronize instruction cache */
+ /* synchronize instruction cache */
- md_icacheflush(ra + 2 * 4, 1 * 4);
- }
+ md_icacheflush(ra + 2 * 4, 1 * 4);
return true;
}
if (!(c = resolve_classref_eager(cr)))
return false;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch super class index */
*((s4 *) (ra + 2 * 4)) |= (s4) (-(c->index) & 0x00001fff);
/* synchronize instruction cache */
- if (opt_shownops)
- md_icacheflush(ra - 2 * 4, (6 + EXCEPTION_CHECK_INSTRUCTIONS) * 4);
- else
- md_icacheflush(ra, (4 + EXCEPTION_CHECK_INSTRUCTIONS) * 4);
+ md_icacheflush(ra, (4 + EXCEPTION_CHECK_INSTRUCTIONS) * 4);
return true;
}
if (!(c = resolve_classref_eager(cr)))
return false;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch super class index */
*((s4 *) (ra + 2 * 4)) |= (s4) ((c->index) & 0x00001fff);
/* synchronize instruction cache */
- if (opt_shownops)
- md_icacheflush(ra - PATCHER_CALL_SIZE * 4, 8 * 4);
- else
- md_icacheflush(ra, 6 * 4);
+ md_icacheflush(ra, 6 * 4);
return true;
}
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch class flags */
/* *datap = c->flags; */
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* Patch the field's offset: we check for the field type, because
the instructions have different lengths. */
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch the field's offset */
if (IS_2_WORD_TYPE(fi->type) || IS_ADR_TYPE(fi->type)) {
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch vftbl index */
*((int32_t *) (ra + 3 + 3)) =
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch interfacetable index */
*((int32_t *) (ra + 3 + 3)) =
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch super class index */
*((int32_t *) (ra + 7 + 3)) = c->index;
PATCH_BACK_ORIGINAL_MCODE;
- /* if we show disassembly, we have to skip the nop's */
-
- if (opt_shownops)
- ra = ra + PATCHER_CALL_SIZE;
-
/* patch super class index */
*((int32_t *) (ra + 7 + 3)) = c->index;
bool showstack = false;
bool opt_showdisassemble = false; /* generate disassembler listing */
-bool opt_shownops = false;
bool opt_showddatasegment = false; /* generate data segment listing */
bool opt_showintermediate = false; /* generate intermediate code listing */
extern bool showstack;
extern bool opt_showdisassemble;
-extern bool opt_shownops;
extern bool opt_showddatasegment;
extern bool opt_showintermediate;
opt_showdisassemble = true;
compileverbose = true;
break;
-
- case 'o':
- opt_shownops = true;
- break;
#endif
case 'd':