From 18bbd718a86642a2fc82d27abc5891056a3889b8 Mon Sep 17 00:00:00 2001 From: Christian Thalinger Date: Wed, 13 Aug 2008 17:27:28 +0200 Subject: [PATCH] * src/vm/options.c (opt_shownops): Removed. This should be replaced 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. --- src/vm/jit/alpha/patcher.c | 25 -------- src/vm/jit/arm/patcher.c | 15 ----- src/vm/jit/i386/patcher.c | 75 ------------------------ src/vm/jit/m68k/codegen.h | 2 +- src/vm/jit/m68k/patcher.c | 23 +------- src/vm/jit/mips/patcher.c | 25 -------- src/vm/jit/patcher-common.c | 5 -- src/vm/jit/powerpc/patcher.c | 25 -------- src/vm/jit/powerpc64/patcher.c | 24 -------- src/vm/jit/s390/codegen.h | 1 - src/vm/jit/s390/patcher.c | 20 ------- src/vm/jit/sparc64/patcher.c | 102 ++++++--------------------------- src/vm/jit/x86_64/patcher.c | 35 ----------- src/vm/options.c | 1 - src/vm/options.h | 1 - src/vm/vm.cpp | 4 -- 16 files changed, 20 insertions(+), 363 deletions(-) diff --git a/src/vm/jit/alpha/patcher.c b/src/vm/jit/alpha/patcher.c index 0e981a090..41006bdaf 100644 --- a/src/vm/jit/alpha/patcher.c +++ b/src/vm/jit/alpha/patcher.c @@ -253,11 +253,6 @@ bool patcher_get_putfield(patchref_t *pr) 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); @@ -333,11 +328,6 @@ bool patcher_invokevirtual(patchref_t *pr) 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]) + @@ -379,11 +369,6 @@ bool patcher_invokeinterface(patchref_t *pr) 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]) - @@ -431,11 +416,6 @@ bool patcher_checkcast_interface(patchref_t *pr) 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); @@ -480,11 +460,6 @@ bool patcher_instanceof_interface(patchref_t *pr) 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); diff --git a/src/vm/jit/arm/patcher.c b/src/vm/jit/arm/patcher.c index e7df6ca4a..28f359db1 100644 --- a/src/vm/jit/arm/patcher.c +++ b/src/vm/jit/arm/patcher.c @@ -145,11 +145,6 @@ bool patcher_get_putfield(patchref_t *pr) 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) { @@ -307,11 +302,6 @@ bool patcher_invokevirtual(patchref_t *pr) 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)); @@ -356,11 +346,6 @@ bool patcher_invokeinterface(patchref_t *pr) 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)); diff --git a/src/vm/jit/i386/patcher.c b/src/vm/jit/i386/patcher.c index 80feee6a0..438ce1bf4 100644 --- a/src/vm/jit/i386/patcher.c +++ b/src/vm/jit/i386/patcher.c @@ -94,11 +94,6 @@ bool patcher_get_putstatic(patchref_t *pr) 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; @@ -134,11 +129,6 @@ bool patcher_getfield(patchref_t *pr) 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); @@ -179,11 +169,6 @@ bool patcher_putfield(patchref_t *pr) 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) { @@ -231,11 +216,6 @@ bool patcher_putfieldconst(patchref_t *pr) 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)) { @@ -284,11 +264,6 @@ bool patcher_aconst(patchref_t *pr) 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; @@ -330,11 +305,6 @@ bool patcher_builtin_multianewarray(patchref_t *pr) 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; @@ -372,11 +342,6 @@ bool patcher_builtin_arraycheckcast(patchref_t *pr) 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; @@ -417,11 +382,6 @@ bool patcher_invokestatic_special(patchref_t *pr) 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; @@ -459,11 +419,6 @@ bool patcher_invokevirtual(patchref_t *pr) 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]) + @@ -503,11 +458,6 @@ bool patcher_invokeinterface(patchref_t *pr) 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]) - @@ -549,11 +499,6 @@ bool patcher_checkcast_instanceof_flags(patchref_t *pr) 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; @@ -594,11 +539,6 @@ bool patcher_checkcast_interface(patchref_t *pr) 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; @@ -642,11 +582,6 @@ bool patcher_instanceof_interface(patchref_t *pr) 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; @@ -690,11 +625,6 @@ bool patcher_checkcast_class(patchref_t *pr) 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; @@ -734,11 +664,6 @@ bool patcher_instanceof_class(patchref_t *pr) 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; diff --git a/src/vm/jit/m68k/codegen.h b/src/vm/jit/m68k/codegen.h index 689dd9b6a..b0add07ba 100644 --- a/src/vm/jit/m68k/codegen.h +++ b/src/vm/jit/m68k/codegen.h @@ -63,7 +63,7 @@ #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 ***************************************************************/ diff --git a/src/vm/jit/m68k/patcher.c b/src/vm/jit/m68k/patcher.c index a5e03b503..36344a73c 100644 --- a/src/vm/jit/m68k/patcher.c +++ b/src/vm/jit/m68k/patcher.c @@ -130,9 +130,6 @@ bool patcher_invokevirtual(patchref_t *pr) /* 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 */ @@ -173,9 +170,6 @@ bool patcher_invokestatic_special(patchref_t *pr) /* 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 */ @@ -209,7 +203,6 @@ bool patcher_resolve_classref_to_classinfo(patchref_t *pr) PATCH_BACK_ORIGINAL_MCODE; /* patch the classinfo pointer */ - if (opt_shownops) disp += PATCHER_CALL_SIZE; *((ptrint *) (disp+2)) = (ptrint) c; /* synchronize inst cache */ @@ -248,7 +241,6 @@ bool patcher_get_putstatic(patchref_t *pr) 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; @@ -283,9 +275,6 @@ bool patcher_get_putfield(patchref_t *pr) 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)) { /* @@ -371,7 +360,6 @@ bool patcher_resolve_classref_to_flags(patchref_t *pr) 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; @@ -415,7 +403,6 @@ bool patcher_resolve_classref_to_vftbl(patchref_t *pr) 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; @@ -460,9 +447,6 @@ bool patcher_instanceof_interface(patchref_t *pr) 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 ); @@ -514,9 +498,6 @@ bool patcher_checkcast_interface(patchref_t *pr) 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 ); @@ -559,7 +540,6 @@ bool patcher_resolve_native_function(patchref_t *pr) md_icacheflush(pr->mpc, 2); /* patch native function pointer */ - if (opt_shownops) disp += PATCHER_CALL_SIZE; *((ptrint *) (disp + 2)) = (ptrint) f; /* synchronize data cache */ @@ -601,7 +581,6 @@ bool patcher_invokeinterface(patchref_t *pr) 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) */ @@ -620,6 +599,8 @@ bool patcher_invokeinterface(patchref_t *pr) 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 diff --git a/src/vm/jit/mips/patcher.c b/src/vm/jit/mips/patcher.c index 2a0a9dd9a..1c2bc975c 100644 --- a/src/vm/jit/mips/patcher.c +++ b/src/vm/jit/mips/patcher.c @@ -139,11 +139,6 @@ bool patcher_get_putfield(patchref_t *pr) 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 @@ -378,11 +373,6 @@ bool patcher_invokevirtual(patchref_t *pr) 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)) |= @@ -428,11 +418,6 @@ bool patcher_invokeinterface(patchref_t *pr) 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)) |= @@ -484,11 +469,6 @@ bool patcher_checkcast_interface(patchref_t *pr) 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); @@ -538,11 +518,6 @@ bool patcher_instanceof_interface(patchref_t *pr) 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); diff --git a/src/vm/jit/patcher-common.c b/src/vm/jit/patcher-common.c index ce7be53fb..2833b0fcf 100644 --- a/src/vm/jit/patcher-common.c +++ b/src/vm/jit/patcher-common.c @@ -209,11 +209,6 @@ void patcher_add_patch_ref(jitdata *jd, functionptr patcher, void* ref, s4 disp) 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 diff --git a/src/vm/jit/powerpc/patcher.c b/src/vm/jit/powerpc/patcher.c index 13b50d814..d7ef9bc43 100644 --- a/src/vm/jit/powerpc/patcher.c +++ b/src/vm/jit/powerpc/patcher.c @@ -288,11 +288,6 @@ bool patcher_get_putfield(patchref_t *pr) 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)) { @@ -397,11 +392,6 @@ bool patcher_invokevirtual(patchref_t *pr) 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); @@ -448,11 +438,6 @@ bool patcher_invokeinterface(patchref_t *pr) 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]) - @@ -511,11 +496,6 @@ bool patcher_checkcast_interface(patchref_t *pr) 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); @@ -567,11 +547,6 @@ bool patcher_instanceof_interface(patchref_t *pr) 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); diff --git a/src/vm/jit/powerpc64/patcher.c b/src/vm/jit/powerpc64/patcher.c index c7c1eae6c..75c2fcb5e 100644 --- a/src/vm/jit/powerpc64/patcher.c +++ b/src/vm/jit/powerpc64/patcher.c @@ -156,11 +156,6 @@ bool patcher_get_putfield(patchref_t *pr) 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); @@ -263,11 +258,6 @@ bool patcher_invokevirtual(patchref_t *pr) 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); @@ -322,11 +312,6 @@ bool patcher_invokeinterface(patchref_t *pr) 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]) - @@ -391,10 +376,6 @@ bool patcher_checkcast_interface(patchref_t *pr) 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); @@ -451,11 +432,6 @@ bool patcher_instanceof_interface(patchref_t *pr) 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); diff --git a/src/vm/jit/s390/codegen.h b/src/vm/jit/s390/codegen.h index 8cb750ac9..8e4bbb8c9 100644 --- a/src/vm/jit/s390/codegen.h +++ b/src/vm/jit/s390/codegen.h @@ -49,7 +49,6 @@ #define PATCHER_CALL_SIZE 2 /* size in bytes of a patcher call */ #define PATCHER_NOPS M_NOP3 -#define PATCHER_NOPS_SKIP 2 /* branch defines ************************************************************/ diff --git a/src/vm/jit/s390/patcher.c b/src/vm/jit/s390/patcher.c index 94e40a9ff..57533fd82 100644 --- a/src/vm/jit/s390/patcher.c +++ b/src/vm/jit/s390/patcher.c @@ -131,11 +131,6 @@ bool patcher_get_putfield(patchref_t *pr) 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; @@ -219,11 +214,6 @@ bool patcher_invokevirtual(patchref_t *pr) PATCH_BACK_ORIGINAL_MCODE; - /* If NOPs are generated, skip them */ - - if (opt_shownops) - ra += PATCHER_NOPS_SKIP; - /* patch vftbl index */ @@ -267,11 +257,6 @@ bool patcher_invokeinterface(patchref_t *pr) 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]) - @@ -428,11 +413,6 @@ bool patcher_checkcast_instanceof_interface(patchref_t *pr) 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 */ diff --git a/src/vm/jit/sparc64/patcher.c b/src/vm/jit/sparc64/patcher.c index ff6e996af..56536ee14 100644 --- a/src/vm/jit/sparc64/patcher.c +++ b/src/vm/jit/sparc64/patcher.c @@ -231,22 +231,9 @@ bool patcher_get_putfield(u1 *sp) 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; } @@ -445,28 +432,11 @@ bool patcher_invokevirtual(u1 *sp) 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; } @@ -501,42 +471,20 @@ bool patcher_invokeinterface(u1 *sp) 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; } @@ -614,11 +562,6 @@ bool patcher_checkcast_interface(u1 *sp) 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); @@ -629,10 +572,7 @@ bool patcher_checkcast_interface(u1 *sp) /* 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; } @@ -667,11 +607,6 @@ bool patcher_instanceof_interface(u1 *sp) 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); @@ -681,10 +616,7 @@ bool patcher_instanceof_interface(u1 *sp) /* 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; } diff --git a/src/vm/jit/x86_64/patcher.c b/src/vm/jit/x86_64/patcher.c index 18e81ddc6..aed1918f5 100644 --- a/src/vm/jit/x86_64/patcher.c +++ b/src/vm/jit/x86_64/patcher.c @@ -173,11 +173,6 @@ bool patcher_resolve_classref_to_flags(patchref_t *pr) 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; */ @@ -253,11 +248,6 @@ bool patcher_get_putfield(patchref_t *pr) 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. */ @@ -312,11 +302,6 @@ bool patcher_putfieldconst(patchref_t *pr) 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)) { @@ -409,11 +394,6 @@ bool patcher_invokevirtual(patchref_t *pr) 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)) = @@ -454,11 +434,6 @@ bool patcher_invokeinterface(patchref_t *pr) 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)) = @@ -503,11 +478,6 @@ bool patcher_checkcast_interface(patchref_t *pr) 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; @@ -548,11 +518,6 @@ bool patcher_instanceof_interface(patchref_t *pr) 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; diff --git a/src/vm/options.c b/src/vm/options.c index 68def40bc..cb4fd010e 100644 --- a/src/vm/options.c +++ b/src/vm/options.c @@ -83,7 +83,6 @@ bool compileverbose = false; /* trace compiler actions */ 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 */ diff --git a/src/vm/options.h b/src/vm/options.h index 09738742b..b36130aec 100644 --- a/src/vm/options.h +++ b/src/vm/options.h @@ -109,7 +109,6 @@ extern bool compileverbose; extern bool showstack; extern bool opt_showdisassemble; -extern bool opt_shownops; extern bool opt_showddatasegment; extern bool opt_showintermediate; diff --git a/src/vm/vm.cpp b/src/vm/vm.cpp index 0335c5f97..d7966f300 100644 --- a/src/vm/vm.cpp +++ b/src/vm/vm.cpp @@ -1176,10 +1176,6 @@ VM::VM(JavaVMInitArgs* vm_args) opt_showdisassemble = true; compileverbose = true; break; - - case 'o': - opt_shownops = true; - break; #endif case 'd': -- 2.25.1