|
From: Jeremy F. <je...@go...> - 2005-02-01 22:53:09
|
CVS commit by fitzhardinge:
Remove all helper entries in the baseblock. Converts all callers to
directly call the appropriate function. This eliminates all the
helper-registration stuff, and the requirement that helpers be
registered at all.
M +0 -9 addrcheck/ac_main.c 1.72
M +0 -5 cachegrind/cg_main.c 1.83
M +0 -4 coregrind/core.h 1.74
M +6 -40 coregrind/vg_from_ucode.c 1.87
M +0 -126 coregrind/vg_main.c 1.241
M +81 -58 coregrind/vg_to_ucode.c 1.153
M +1 -1 coregrind/vg_translate.c 1.97
M +50 -49 coregrind/x86/core_arch.h 1.19
M +0 -90 coregrind/x86/state.c 1.15
M +0 -13 helgrind/hg_main.c 1.93
M +2 -10 include/tool.h.base 1.21
M +0 -7 lackey/lk_main.c 1.26
M +4 -5 memcheck/mc_from_ucode.c 1.16
M +0 -16 memcheck/mc_main.c 1.57
--- valgrind/coregrind/core.h #1.73:1.74
@@ -301,6 +301,4 @@ extern Bool VG_(clo_run_libc_freeres);
/* Use the basic-block chaining optimisation? Default: YES */
extern Bool VG_(clo_chain_bb);
-/* Use direct jumps to helper functions? Default: YES */
-extern Bool VG_(clo_direct_helpers);
/* Generate branch-prediction hints? */
extern Bool VG_(clo_branchpred);
@@ -1689,6 +1687,4 @@ extern UChar VG_(patch_me)[];
------------------------------------------------------------------ */
-extern void VG_(helper_undefined_instruction);
-
/* Information about trampoline code (for signal return and syscalls) */
extern const Char VG_(trampoline_code_start);
--- valgrind/coregrind/vg_main.c #1.240:1.241
@@ -1500,5 +1500,4 @@ Bool VG_(clo_run_libc_freeres) = True;
Bool VG_(clo_track_fds) = False;
Bool VG_(clo_chain_bb) = True;
-Bool VG_(clo_direct_helpers) = True;
Bool VG_(clo_show_below_main) = False;
Bool VG_(clo_pointercheck) = True;
@@ -1559,5 +1558,4 @@ void usage ( Bool debug_help )
" --profile=no|yes profile? (tool must be built for it) [no]\n"
" --chain-bb=no|yes do basic-block chaining? [yes]\n"
-" --direct-helpers=yes|no call helpers directly? [yes]\n"
" --branchpred=yes|no generate branch prediction hints [no]\n"
" --trace-codegen=<XXXXX> show generated code? (X = 0|1) [00000]\n"
@@ -1717,5 +1715,4 @@ static void process_cmd_line_options( UI
else VG_BOOL_CLO("--branchpred", VG_(clo_branchpred))
else VG_BOOL_CLO("--chain-bb", VG_(clo_chain_bb))
- else VG_BOOL_CLO("--direct-helpers", VG_(clo_direct_helpers))
else VG_BOOL_CLO("--db-attach", VG_(clo_db_attach))
else VG_BOOL_CLO("--demangle", VG_(clo_demangle))
@@ -2126,23 +2123,4 @@ static void setup_file_descriptors(void)
/*====================================================================*/
-Int VGOFF_(helper_undefined_instruction) = INVALID_OFFSET;
-
-/* MAX_NONCOMPACT_HELPERS can be increased easily. If MAX_COMPACT_HELPERS is
- * increased too much, they won't really be compact any more... */
-#define MAX_COMPACT_HELPERS 8
-#define MAX_NONCOMPACT_HELPERS 50
-
-/* For storing tool-specific helpers, determined at runtime. The addr
- * and offset arrays together form a (addr, offset) map that allows a
- * helper's baseBlock offset to be computed from its address. It's done
- * like this so CCALLs can use the function address rather than having to
- * muck around with offsets. */
-static UInt VG_(n_compact_helpers) = 0;
-static UInt VG_(n_noncompact_helpers) = 0;
-static Addr VG_(compact_helper_addrs) [MAX_COMPACT_HELPERS];
-static Int VG_(compact_helper_offsets)[MAX_COMPACT_HELPERS];
-static Addr VG_(noncompact_helper_addrs) [MAX_NONCOMPACT_HELPERS];
-static Int VG_(noncompact_helper_offsets)[MAX_NONCOMPACT_HELPERS];
-
/* This is the actual defn of baseblock. */
UInt VG_(baseBlock)[VG_BASEBLOCK_WORDS];
@@ -2179,41 +2157,4 @@ Int VG_(alloc_BaB_1_set) ( Addr a )
}
-/* Registers a function in compact_helper_addrs; compact_helper_offsets is
- filled in later. */
-void VG_(register_compact_helper)(Addr a)
-{
- if (MAX_COMPACT_HELPERS <= VG_(n_compact_helpers)) {
- VG_(printf)("Can only register %d compact helpers\n",
- MAX_COMPACT_HELPERS);
- VG_(core_panic)("Too many compact helpers registered");
- }
- VG_(compact_helper_addrs)[VG_(n_compact_helpers)] = a;
- VG_(n_compact_helpers)++;
-}
-
-/* Registers a function in noncompact_helper_addrs; noncompact_helper_offsets
- * is filled in later.
- */
-void VG_(register_noncompact_helper)(Addr a)
-{
- if (MAX_NONCOMPACT_HELPERS <= VG_(n_noncompact_helpers)) {
- VG_(printf)("Can only register %d non-compact helpers\n",
- MAX_NONCOMPACT_HELPERS);
- VG_(printf)("Try increasing MAX_NON_COMPACT_HELPERS\n");
- VG_(core_panic)("Too many non-compact helpers registered");
- }
- VG_(noncompact_helper_addrs)[VG_(n_noncompact_helpers)] = a;
- VG_(n_noncompact_helpers)++;
-}
-
-/* Allocate offsets in baseBlock for the tool helpers */
-static
-void assign_helpers_in_baseBlock(UInt n, Int offsets[], Addr addrs[])
-{
- UInt i;
- for (i = 0; i < n; i++)
- offsets[i] = VG_(alloc_BaB_1_set)( addrs[i] );
-}
-
Bool VG_(need_to_handle_SP_assignment)(void)
{
@@ -2239,74 +2180,7 @@ static void init_baseBlock ( Addr client
{
VGA_(init_low_baseBlock)(client_eip, sp_at_startup);
-
- /* Allocate slots for compact helpers */
- assign_helpers_in_baseBlock(VG_(n_compact_helpers),
- VG_(compact_helper_offsets),
- VG_(compact_helper_addrs));
-
VGA_(init_high_baseBlock)(client_eip, sp_at_startup);
-
-#define REG(kind, size) \
- if (VG_(defined_##kind##_mem_stack##size)()) \
- VG_(register_noncompact_helper)( \
- (Addr) VG_(tool_interface).track_##kind##_mem_stack##size );
- REG(new, _8);
- REG(new, _12);
- REG(new, _16);
- REG(new, _32);
- REG(new, );
- REG(die, _8);
- REG(die, _12);
- REG(die, _16);
- REG(die, _32);
- REG(die, );
-#undef REG
-
- if (VG_(need_to_handle_SP_assignment)())
- VG_(register_noncompact_helper)((Addr) VG_(unknown_SP_update));
-
- VGOFF_(helper_undefined_instruction)
- = VG_(alloc_BaB_1_set)( (Addr) & VG_(helper_undefined_instruction));
-
- /* Allocate slots for noncompact helpers */
- assign_helpers_in_baseBlock(VG_(n_noncompact_helpers),
- VG_(noncompact_helper_offsets),
- VG_(noncompact_helper_addrs));
}
-// Finds the baseBlock offset of a tool-specified helper.
-// Searches through compacts first, then non-compacts.
-Int VG_(helper_offset)(Addr a)
-{
- UInt i;
- Char buf[100];
-
- for (i = 0; i < VG_(n_compact_helpers); i++)
- if (VG_(compact_helper_addrs)[i] == a)
- return VG_(compact_helper_offsets)[i];
- for (i = 0; i < VG_(n_noncompact_helpers); i++)
- if (VG_(noncompact_helper_addrs)[i] == a)
- return VG_(noncompact_helper_offsets)[i];
-
- /* Shouldn't get here */
- VG_(get_fnname) ( a, buf, 100 );
-
- VG_(printf)(
- "\nCouldn't find offset of helper from its address (%p: %s).\n"
- "A helper function probably used hasn't been registered?\n\n", a, buf);
-
- VG_(printf)(" compact helpers: ");
- for (i = 0; i < VG_(n_compact_helpers); i++)
- VG_(printf)("%p ", VG_(compact_helper_addrs)[i]);
-
- VG_(printf)("\n non-compact helpers: ");
- for (i = 0; i < VG_(n_noncompact_helpers); i++)
- VG_(printf)("%p ", VG_(noncompact_helper_addrs)[i]);
-
- VG_(printf)("\n");
- VG_(skin_panic)("Unfound helper");
-}
-
-
/*====================================================================*/
/*=== Initialise program data/text, etc. ===*/
--- valgrind/coregrind/vg_from_ucode.c #1.86:1.87
@@ -1994,24 +1994,4 @@ void emit_call_abs(Bool simd_flags, Addr
}
-static
-void emit_call_star_EBP_off ( Bool simd_flags, Int byte_off,
- FlagSet use_flag, FlagSet set_flag )
-{
- /* Used for helpers which expect to see Simd flags in Real flags */
- VG_(new_emit)(simd_flags, use_flag, set_flag);
-
- if (byte_off < -128 || byte_off > 127) {
- VG_(emitB) ( 0xFF );
- VG_(emitB) ( 0x95 );
- VG_(emitL) ( byte_off );
- } else {
- VG_(emitB) ( 0xFF );
- VG_(emitB) ( 0x55 );
- VG_(emitB) ( byte_off );
- }
- if (dis)
- VG_(printf)( "\n\t\tcall * %d(%%ebp)\n", byte_off );
-}
-
#if 0
/* evidently unused */
@@ -2374,21 +2354,8 @@ static Condcode invertCondition ( Condco
/* Synthesise a call to a helper.
*/
-void VG_(synth_call) ( Bool ensure_shortform, Int word_offset,
- Bool simd_flags, FlagSet use_flags, FlagSet set_flags )
+void VG_(synth_call) ( Addr target, Bool simd_flags, FlagSet use_flags, FlagSet set_flags )
{
- vg_assert(word_offset >= 0);
- vg_assert(word_offset < VG_BASEBLOCK_WORDS);
- if (ensure_shortform) {
- vg_assert(word_offset < 32);
- }
- if (VG_(clo_direct_helpers)) {
/* Call the helper directly */
- Addr target = VG_(baseBlock)[word_offset];
emit_call_abs ( simd_flags, target, use_flags, set_flags );
- } else {
- /* Call the helper via the baseBlock: *baseBlock[offset], ie,
- call * (4 x offset)(%ebp). */
- emit_call_star_EBP_off ( simd_flags, 4 * word_offset, use_flags, set_flags );
- }
}
@@ -2603,5 +2570,5 @@ void VG_(synth_ccall) ( Addr fn, Int arg
/* Call the function - may trash all flags */
- VG_(synth_call) ( False, VG_(helper_offset) ( fn ), False,
+ VG_(synth_call) ( fn, False,
FlagsEmpty, FlagsOSZACP );
@@ -4008,5 +3975,5 @@ static void emitUInstr ( UCodeBlock* cb,
case CALLM:
- vg_assert(u->tag1 == Lit16);
+ vg_assert(u->tag1 == Literal);
vg_assert(u->tag2 == NoValue);
vg_assert(u->size == 0);
@@ -4018,6 +3985,5 @@ static void emitUInstr ( UCodeBlock* cb,
instruction (and therefore operates on Real flags and
registers) */
- VG_(synth_call) ( False, u->val1,
- True, u->flags_r, u->flags_w );
+ VG_(synth_call) ( u->lit32, True, u->flags_r, u->flags_w );
break;
--- valgrind/coregrind/vg_to_ucode.c #1.152:1.153
@@ -1352,17 +1352,17 @@ static
void codegen_div ( UCodeBlock* cb, Int sz, Int t, Bool signed_divide )
{
- Int helper;
+ const Char *helper;
Int ta = newTemp(cb);
Int td = newTemp(cb);
switch (sz) {
- case 4: helper = (signed_divide ? VGOFF_(helper_idiv_64_32)
- : VGOFF_(helper_div_64_32));
+ case 4: helper = (signed_divide ? VG_(helper_idiv_64_32)
+ : VG_(helper_div_64_32));
break;
- case 2: helper = (signed_divide ? VGOFF_(helper_idiv_32_16)
- : VGOFF_(helper_div_32_16));
+ case 2: helper = (signed_divide ? VG_(helper_idiv_32_16)
+ : VG_(helper_div_32_16));
break;
- case 1: helper = (signed_divide ? VGOFF_(helper_idiv_16_8)
- : VGOFF_(helper_div_16_8));
+ case 1: helper = (signed_divide ? VG_(helper_idiv_16_8)
+ : VG_(helper_div_16_8));
break;
default: VG_(core_panic)("codegen_div");
@@ -1375,5 +1375,6 @@ void codegen_div ( UCodeBlock* cb, Int s
uInstr2(cb, GET, sz, ArchReg, R_EDX, TempReg, td);
uInstr1(cb, PUSH, sz, TempReg, td);
- uInstr1(cb, CALLM, 0, Lit16, helper);
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)helper);
uFlagsRWU(cb, FlagsEmpty, FlagsEmpty, FlagsOSZACP);
uInstr1(cb, POP, sz, TempReg, t);
@@ -1389,5 +1390,6 @@ void codegen_div ( UCodeBlock* cb, Int s
uLiteral(cb, 0);
uInstr1(cb, PUSH, 1, TempReg, td);
- uInstr1(cb, CALLM, 0, Lit16, helper);
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)helper);
uFlagsRWU(cb, FlagsEmpty, FlagsEmpty, FlagsOSZACP);
uInstr1(cb, POP, 1, TempReg, t);
@@ -1686,13 +1688,13 @@ static void codegen_mul_A_D_Reg ( UCodeB
UChar modrm, Bool signed_multiply )
{
- Int helper = signed_multiply
+ const Char *helper = signed_multiply
?
- (sz==1 ? VGOFF_(helper_imul_8_16)
- : (sz==2 ? VGOFF_(helper_imul_16_32)
- : VGOFF_(helper_imul_32_64)))
+ (sz==1 ? VG_(helper_imul_8_16)
+ : (sz==2 ? VG_(helper_imul_16_32)
+ : VG_(helper_imul_32_64)))
:
- (sz==1 ? VGOFF_(helper_mul_8_16)
- : (sz==2 ? VGOFF_(helper_mul_16_32)
- : VGOFF_(helper_mul_32_64)));
+ (sz==1 ? VG_(helper_mul_8_16)
+ : (sz==2 ? VG_(helper_mul_16_32)
+ : VG_(helper_mul_32_64)));
Int t1 = newTemp(cb);
Int ta = newTemp(cb);
@@ -1702,5 +1704,6 @@ static void codegen_mul_A_D_Reg ( UCodeB
uInstr2(cb, GET, sz, ArchReg, R_EAX, TempReg, ta);
uInstr1(cb, PUSH, sz, TempReg, ta);
- uInstr1(cb, CALLM, 0, Lit16, helper);
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)helper);
uFlagsRWU(cb, FlagsEmpty, FlagsOC, FlagsSZAP);
if (sz > 1) {
@@ -1727,13 +1730,13 @@ static void codegen_mul_A_D_Temp ( UCode
UChar* dis_buf )
{
- Int helper = signed_multiply
+ const Char *helper = signed_multiply
?
- (sz==1 ? VGOFF_(helper_imul_8_16)
- : (sz==2 ? VGOFF_(helper_imul_16_32)
- : VGOFF_(helper_imul_32_64)))
+ (sz==1 ? VG_(helper_imul_8_16)
+ : (sz==2 ? VG_(helper_imul_16_32)
+ : VG_(helper_imul_32_64)))
:
- (sz==1 ? VGOFF_(helper_mul_8_16)
- : (sz==2 ? VGOFF_(helper_mul_16_32)
- : VGOFF_(helper_mul_32_64)));
+ (sz==1 ? VG_(helper_mul_8_16)
+ : (sz==2 ? VG_(helper_mul_16_32)
+ : VG_(helper_mul_32_64)));
Int t1 = newTemp(cb);
uInstr0(cb, CALLM_S, 0);
@@ -1741,5 +1744,6 @@ static void codegen_mul_A_D_Temp ( UCode
uInstr2(cb, GET, sz, ArchReg, R_EAX, TempReg, t1);
uInstr1(cb, PUSH, sz, TempReg, t1);
- uInstr1(cb, CALLM, 0, Lit16, helper);
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)helper);
uFlagsRWU(cb, FlagsEmpty, FlagsOC, FlagsSZAP);
if (sz > 1) {
@@ -2062,5 +2066,6 @@ void dis_string_op_increment(UCodeBlock*
uInstr1 (cb, PUSH, 4, TempReg, t_inc);
- uInstr1 (cb, CALLM, 0, Lit16, VGOFF_(helper_get_dirflag));
+ uInstr1 (cb, CALLM, 0, Literal, 0);
+ uLiteral (cb, (Addr)VG_(helper_get_dirflag));
uFlagsRWU(cb, FlagD, FlagsEmpty, FlagsEmpty);
@@ -2418,5 +2423,6 @@ Addr dis_fpu ( UCodeBlock* cb,
uLiteral(cb, 0);
uInstr1(cb, PUSH, 4, TempReg, t1);
- uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_fstsw_AX) );
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_fstsw_AX) );
uFlagsRWU(cb, FlagsEmpty, FlagsEmpty, FlagsEmpty);
uInstr1(cb, POP, 2, TempReg, t1);
@@ -2603,5 +2609,6 @@ Addr dis_SHLRD_Gv_Ev ( UCodeBlock* cb,
/* amt_tag and amt_val denote either ArchReg(%CL) or a Literal.
And eip on entry points at the modrm byte. */
- Int t, t1, t2, ta, helper;
+ Int t, t1, t2, ta;
+ const Char *helper;
UInt pair;
UChar dis_buf[50];
@@ -2610,8 +2617,8 @@ Addr dis_SHLRD_Gv_Ev ( UCodeBlock* cb,
helper = left_shift
- ? (sz==4 ? VGOFF_(helper_shldl)
- : VGOFF_(helper_shldw))
- : (sz==4 ? VGOFF_(helper_shrdl)
- : VGOFF_(helper_shrdw));
+ ? (sz==4 ? VG_(helper_shldl)
+ : VG_(helper_shldw))
+ : (sz==4 ? VG_(helper_shrdl)
+ : VG_(helper_shrdw));
/* Get the amount to be shifted by onto the stack. */
@@ -2641,5 +2648,6 @@ Addr dis_SHLRD_Gv_Ev ( UCodeBlock* cb,
uInstr2(cb, GET, sz, ArchReg, eregOfRM(modrm), TempReg, t2);
uInstr1(cb, PUSH, sz, TempReg, t2);
- uInstr1(cb, CALLM, 0, Lit16, helper);
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)helper);
uFlagsRWU(cb, FlagsEmpty, FlagsOSZACP, FlagsEmpty);
uInstr1(cb, POP, sz, TempReg, t);
@@ -2654,5 +2662,6 @@ Addr dis_SHLRD_Gv_Ev ( UCodeBlock* cb,
uInstr2(cb, LOAD, sz, TempReg, ta, TempReg, t2);
uInstr1(cb, PUSH, sz, TempReg, t2);
- uInstr1(cb, CALLM, 0, Lit16, helper);
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)helper);
uFlagsRWU(cb, FlagsEmpty, FlagsOSZACP, FlagsEmpty);
uInstr1(cb, POP, sz, TempReg, t);
@@ -2827,5 +2836,6 @@ Addr dis_bs_E_G ( UCodeBlock* cb,
Int sz, Addr eip, Bool fwds )
{
- Int t, t1, ta, helper;
+ Int t, t1, ta;
+ const Char *helper;
UInt pair;
Char dis_buf[50];
@@ -2836,7 +2846,7 @@ Addr dis_bs_E_G ( UCodeBlock* cb,
if (fwds)
- helper = sz == 2 ? VGOFF_(helper_bsfw) : VGOFF_(helper_bsfl);
+ helper = sz == 2 ? VG_(helper_bsfw) : VG_(helper_bsfl);
else
- helper = sz == 2 ? VGOFF_(helper_bsrw) : VGOFF_(helper_bsrl);
+ helper = sz == 2 ? VG_(helper_bsrw) : VG_(helper_bsrl);
modrm = getUChar(eip);
@@ -2864,5 +2874,6 @@ Addr dis_bs_E_G ( UCodeBlock* cb,
uInstr1(cb, PUSH, sz, TempReg, t);
- uInstr1(cb, CALLM, 0, Lit16, helper);
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)helper);
uFlagsRWU(cb, FlagsEmpty, FlagZ, FlagsOSACP);
uInstr1(cb, POP, sz, TempReg, t);
@@ -2913,5 +2924,6 @@ void codegen_SAHF ( UCodeBlock* cb )
uInstr0(cb, CALLM_S, 0);
uInstr1(cb, PUSH, 4, TempReg, t);
- uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_SAHF));
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_SAHF));
uFlagsRWU(cb, FlagsEmpty, FlagsSZACP, FlagsEmpty);
uInstr1(cb, CLEAR, 0, Lit16, 4);
@@ -2929,5 +2941,6 @@ void codegen_LAHF ( UCodeBlock* cb )
uInstr0(cb, CALLM_S, 0);
uInstr1(cb, PUSH, 4, TempReg, t);
- uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_LAHF));
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_LAHF));
uFlagsRWU(cb, FlagsSZACP, FlagsEmpty, FlagsEmpty);
uInstr1(cb, POP, 4, TempReg, t);
@@ -3043,5 +3056,6 @@ Addr dis_cmpxchg8b ( UCodeBlock* cb,
uInstr1(cb, PUSH, 4, TempReg, accl);
- uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_cmpxchg8b));
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_cmpxchg8b));
uFlagsRWU(cb, FlagsEmpty, FlagZ, FlagsEmpty);
@@ -5366,6 +5380,6 @@ static Addr disInstr ( UCodeBlock* cb, A
uInstr0(cb, CALLM_S, 0);
uInstr1(cb, PUSH, 4, TempReg, t1);
- uInstr1(cb, CALLM, 0, Lit16,
- opc == 0x27 ? VGOFF_(helper_DAA) : VGOFF_(helper_DAS) );
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)(opc == 0x27 ? VG_(helper_DAA) : VG_(helper_DAS)) );
uFlagsRWU(cb, FlagsAC, FlagsSZACP, FlagO);
uInstr1(cb, POP, 4, TempReg, t1);
@@ -5384,6 +5398,6 @@ static Addr disInstr ( UCodeBlock* cb, A
uInstr0(cb, CALLM_S, 0);
uInstr1(cb, PUSH, 4, TempReg, t1);
- uInstr1(cb, CALLM, 0, Lit16,
- opc == 0x37 ? VGOFF_(helper_AAA) : VGOFF_(helper_AAS) );
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)(opc == 0x37 ? VG_(helper_AAA) : VG_(helper_AAS)) );
uFlagsRWU(cb, FlagA, FlagsAC, FlagsEmpty);
uInstr1(cb, POP, 4, TempReg, t1);
@@ -5404,6 +5418,6 @@ static Addr disInstr ( UCodeBlock* cb, A
uInstr0(cb, CALLM_S, 0);
uInstr1(cb, PUSH, 4, TempReg, t1);
- uInstr1(cb, CALLM, 0, Lit16,
- opc == 0xD4 ? VGOFF_(helper_AAM) : VGOFF_(helper_AAD) );
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)(opc == 0xD4 ? VG_(helper_AAM) : VG_(helper_AAD)) );
uFlagsRWU(cb, FlagsEmpty, FlagsSZP, FlagsEmpty);
uInstr1(cb, POP, 4, TempReg, t1);
@@ -6191,5 +6205,6 @@ static Addr disInstr ( UCodeBlock* cb, A
case 0xFC: /* CLD */
uInstr0(cb, CALLM_S, 0);
- uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_CLD));
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_CLD));
uFlagsRWU(cb, FlagsEmpty, FlagD, FlagsEmpty);
uInstr0(cb, CALLM_E, 0);
@@ -6199,5 +6214,6 @@ static Addr disInstr ( UCodeBlock* cb, A
case 0xFD: /* STD */
uInstr0(cb, CALLM_S, 0);
- uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_STD));
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_STD));
uFlagsRWU(cb, FlagsEmpty, FlagD, FlagsEmpty);
uInstr0(cb, CALLM_E, 0);
@@ -6207,5 +6223,6 @@ static Addr disInstr ( UCodeBlock* cb, A
case 0xF8: /* CLC */
uInstr0(cb, CALLM_S, 0);
- uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_CLC));
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_CLC));
uFlagsRWU(cb, FlagsEmpty, FlagC, FlagsOSZAP);
uInstr0(cb, CALLM_E, 0);
@@ -6215,5 +6232,6 @@ static Addr disInstr ( UCodeBlock* cb, A
case 0xF9: /* STC */
uInstr0(cb, CALLM_S, 0);
- uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_STC));
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_STC));
uFlagsRWU(cb, FlagsEmpty, FlagC, FlagsOSZAP);
uInstr0(cb, CALLM_E, 0);
@@ -6223,5 +6241,6 @@ static Addr disInstr ( UCodeBlock* cb, A
case 0xF5: /* CMC */
uInstr0(cb, CALLM_S, 0);
- uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_CMC));
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_CMC));
uFlagsRWU(cb, FlagC, FlagC, FlagsOSZAP);
uInstr0(cb, CALLM_E, 0);
@@ -6397,5 +6416,6 @@ static Addr disInstr ( UCodeBlock* cb, A
uInstr1(cb, PUSH, 4, TempReg, t2);
- uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_IN));
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_IN));
uFlagsRWU(cb, FlagsEmpty, FlagsEmpty, FlagsEmpty);
uInstr1(cb, POP, 4, TempReg, t2);
@@ -6433,5 +6453,6 @@ static Addr disInstr ( UCodeBlock* cb, A
uInstr2(cb, GET, 4, ArchReg, R_EAX, TempReg, t3);
uInstr1(cb, PUSH, 4, TempReg, t3);
- uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_OUT));
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_OUT));
uFlagsRWU(cb, FlagsEmpty, FlagsEmpty, FlagsEmpty);
uInstr1(cb, CLEAR, 0, Lit16, 12);
@@ -6661,5 +6682,6 @@ static Addr disInstr ( UCodeBlock* cb, A
uInstr1(cb, PUSH, 4, TempReg, t4);
- uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_CPUID));
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_CPUID));
uFlagsRWU(cb, FlagsEmpty, FlagsEmpty, FlagsEmpty);
@@ -6757,5 +6779,6 @@ static Addr disInstr ( UCodeBlock* cb, A
uLiteral(cb, 0);
uInstr1(cb, PUSH, 4, TempReg, t2);
- uInstr1(cb, CALLM, 0, Lit16, VGOFF_(helper_RDTSC));
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_RDTSC));
uFlagsRWU(cb, FlagsEmpty, FlagsEmpty, FlagsEmpty);
uInstr1(cb, POP, 4, TempReg, t3);
@@ -7341,6 +7364,6 @@ static Addr disInstr ( UCodeBlock* cb, A
uInstr0(cb, CALLM_S, 0);
- uInstr1(cb, CALLM, 0, Lit16,
- VGOFF_(helper_undefined_instruction));
+ uInstr1(cb, CALLM, 0, Literal, 0);
+ uLiteral(cb, (Addr)VG_(helper_undefined_instruction));
uInstr0(cb, CALLM_E, 0);
--- valgrind/coregrind/vg_translate.c #1.96:1.97
@@ -569,5 +569,5 @@ static Bool is_sane_UInstr ( UInstr* u )
case WIDEN: return LIT0 && SZ42 && CC0 && TR1 && N2 && N3 && XWIDEN;
case JMP: return LITm && SZ0 && CCj && TRL1 && N2 && N3 && XJMP;
- case CALLM: return LIT0 && SZ0 /*any*/ && Ls1 && N2 && N3 && XOTHER;
+ case CALLM: return LIT1 && SZ0 /*any*/ && L1 && N2 && N3 && XOTHER;
case CALLM_S:
case CALLM_E:return LIT0 && SZ0 && CC0 && N1 && N2 && N3 && XOTHER;
--- valgrind/include/tool.h.base #1.20:1.21
@@ -1055,11 +1055,4 @@
-/* Used to register helper functions to be called from generated code. A
- limited number of compact helpers can be registered; the code generated
- to call them is slightly shorter -- so register the mostly frequently
- called helpers as compact. */
-extern void VG_(register_compact_helper) ( Addr a );
-extern void VG_(register_noncompact_helper) ( Addr a );
-
/* ------------------------------------------------------------------ */
@@ -1271,5 +1264,4 @@
/* Finding offsets */
-extern Int VG_(helper_offset) ( Addr a );
extern Int VG_(shadow_reg_offset) ( Int arch );
extern Int VG_(shadow_flags_offset) ( void );
@@ -1281,6 +1273,6 @@
/* Call a subroutine. Does no argument passing, stack manipulations, etc. */
-extern void VG_(synth_call) ( Bool ensure_shortform, Int word_offset,
- Bool upd_cc, FlagSet use_flags, FlagSet set_flags );
+extern void VG_(synth_call) ( Addr target, Bool upd_cc,
+ FlagSet use_flags, FlagSet set_flags );
/* For calling C functions -- saves caller save regs, pushes args, calls,
--- valgrind/coregrind/x86/state.c #1.14:1.15
@@ -70,45 +70,4 @@ Int VGOFF_(sh_edi) = INVALID_OFFSET;
Int VGOFF_(sh_eflags) = INVALID_OFFSET;
-Int VGOFF_(helper_idiv_64_32) = INVALID_OFFSET;
-Int VGOFF_(helper_div_64_32) = INVALID_OFFSET;
-Int VGOFF_(helper_idiv_32_16) = INVALID_OFFSET;
-Int VGOFF_(helper_div_32_16) = INVALID_OFFSET;
-Int VGOFF_(helper_idiv_16_8) = INVALID_OFFSET;
-Int VGOFF_(helper_div_16_8) = INVALID_OFFSET;
-Int VGOFF_(helper_imul_32_64) = INVALID_OFFSET;
-Int VGOFF_(helper_mul_32_64) = INVALID_OFFSET;
-Int VGOFF_(helper_imul_16_32) = INVALID_OFFSET;
-Int VGOFF_(helper_mul_16_32) = INVALID_OFFSET;
-Int VGOFF_(helper_imul_8_16) = INVALID_OFFSET;
-Int VGOFF_(helper_mul_8_16) = INVALID_OFFSET;
-Int VGOFF_(helper_CLD) = INVALID_OFFSET;
-Int VGOFF_(helper_STD) = INVALID_OFFSET;
-Int VGOFF_(helper_get_dirflag) = INVALID_OFFSET;
-Int VGOFF_(helper_CLC) = INVALID_OFFSET;
-Int VGOFF_(helper_STC) = INVALID_OFFSET;
-Int VGOFF_(helper_CMC) = INVALID_OFFSET;
-Int VGOFF_(helper_shldl) = INVALID_OFFSET;
-Int VGOFF_(helper_shldw) = INVALID_OFFSET;
-Int VGOFF_(helper_shrdl) = INVALID_OFFSET;
-Int VGOFF_(helper_shrdw) = INVALID_OFFSET;
-Int VGOFF_(helper_IN) = INVALID_OFFSET;
-Int VGOFF_(helper_OUT) = INVALID_OFFSET;
-Int VGOFF_(helper_RDTSC) = INVALID_OFFSET;
-Int VGOFF_(helper_CPUID) = INVALID_OFFSET;
-Int VGOFF_(helper_BSWAP) = INVALID_OFFSET;
-Int VGOFF_(helper_bsfw) = INVALID_OFFSET;
-Int VGOFF_(helper_bsfl) = INVALID_OFFSET;
-Int VGOFF_(helper_bsrw) = INVALID_OFFSET;
-Int VGOFF_(helper_bsrl) = INVALID_OFFSET;
-Int VGOFF_(helper_fstsw_AX) = INVALID_OFFSET;
-Int VGOFF_(helper_SAHF) = INVALID_OFFSET;
-Int VGOFF_(helper_LAHF) = INVALID_OFFSET;
-Int VGOFF_(helper_DAS) = INVALID_OFFSET;
-Int VGOFF_(helper_DAA) = INVALID_OFFSET;
-Int VGOFF_(helper_AAS) = INVALID_OFFSET;
-Int VGOFF_(helper_AAA) = INVALID_OFFSET;
-Int VGOFF_(helper_AAD) = INVALID_OFFSET;
-Int VGOFF_(helper_AAM) = INVALID_OFFSET;
-Int VGOFF_(helper_cmpxchg8b) = INVALID_OFFSET;
static Int extractDflag(UInt eflags)
@@ -161,13 +120,4 @@ void VGA_(init_low_baseBlock) ( Addr cli
/* 9,10,11 or 18,19,20... depends on number whether shadow regs are used
* and on compact helpers registered */
-
- /* Make these most-frequently-called specialised ones compact, if they
- are used. */
- if (VG_(defined_new_mem_stack_4)())
- VG_(register_compact_helper)( (Addr) VG_(tool_interface).track_new_mem_stack_4);
-
- if (VG_(defined_die_mem_stack_4)())
- VG_(register_compact_helper)( (Addr) VG_(tool_interface).track_die_mem_stack_4);
-
}
@@ -245,44 +195,4 @@ void VGA_(init_high_baseBlock)( Addr cli
asm ("movl %%ss, %0"
: "=m" (VG_(baseBlock)[VGOFF_(m_ss)]));
-
- VG_(register_noncompact_helper)( (Addr) & VG_(do_useseg) );
-
-# define HELPER(name) \
- VGOFF_(helper_##name) = VG_(alloc_BaB_1_set)( (Addr) & VG_(helper_##name))
-
- /* Helper functions. */
- HELPER(idiv_64_32); HELPER(div_64_32);
- HELPER(idiv_32_16); HELPER(div_32_16);
- HELPER(idiv_16_8); HELPER(div_16_8);
-
- HELPER(imul_32_64); HELPER(mul_32_64);
- HELPER(imul_16_32); HELPER(mul_16_32);
- HELPER(imul_8_16); HELPER(mul_8_16);
-
- HELPER(CLD); HELPER(STD);
- HELPER(get_dirflag);
-
- HELPER(CLC); HELPER(STC);
- HELPER(CMC);
-
- HELPER(shldl); HELPER(shldw);
- HELPER(shrdl); HELPER(shrdw);
-
- HELPER(RDTSC); HELPER(CPUID);
-
- HELPER(bsfw); HELPER(bsfl);
- HELPER(bsrw); HELPER(bsrl);
-
- HELPER(fstsw_AX);
- HELPER(SAHF); HELPER(LAHF);
- HELPER(DAS); HELPER(DAA);
- HELPER(AAS); HELPER(AAA);
- HELPER(AAD); HELPER(AAM);
- HELPER(IN); HELPER(OUT);
- HELPER(cmpxchg8b);
-
- HELPER(undefined_instruction);
-
-# undef HELPER
}
--- valgrind/coregrind/x86/core_arch.h #1.18:1.19
@@ -123,5 +123,4 @@ extern Int VGOFF_(tls_ptr);
/* Nb: Most helper offsets are in include/tool.h, for use by tools */
-extern Int VGOFF_(helper_undefined_instruction);
@@ -139,54 +138,56 @@ extern Int VGOFF_(helper_undefined_instr
------------------------------------------------------------------ */
+extern const Char VG_(helper_undefined_instruction)[];
+
/* Mul, div, etc, -- we don't codegen these directly. */
-extern void VG_(helper_idiv_64_32);
-extern void VG_(helper_div_64_32);
-extern void VG_(helper_idiv_32_16);
-extern void VG_(helper_div_32_16);
-extern void VG_(helper_idiv_16_8);
-extern void VG_(helper_div_16_8);
+extern const Char VG_(helper_idiv_64_32)[];
+extern const Char VG_(helper_div_64_32)[];
+extern const Char VG_(helper_idiv_32_16)[];
+extern const Char VG_(helper_div_32_16)[];
+extern const Char VG_(helper_idiv_16_8)[];
+extern const Char VG_(helper_div_16_8)[];
-extern void VG_(helper_imul_32_64);
-extern void VG_(helper_mul_32_64);
-extern void VG_(helper_imul_16_32);
-extern void VG_(helper_mul_16_32);
-extern void VG_(helper_imul_8_16);
-extern void VG_(helper_mul_8_16);
+extern const Char VG_(helper_imul_32_64)[];
+extern const Char VG_(helper_mul_32_64)[];
+extern const Char VG_(helper_imul_16_32)[];
+extern const Char VG_(helper_mul_16_32)[];
+extern const Char VG_(helper_imul_8_16)[];
+extern const Char VG_(helper_mul_8_16)[];
-extern void VG_(helper_CLD);
-extern void VG_(helper_STD);
-extern void VG_(helper_get_dirflag);
+extern const Char VG_(helper_CLD)[];
+extern const Char VG_(helper_STD)[];
+extern const Char VG_(helper_get_dirflag)[];
-extern void VG_(helper_CLC);
-extern void VG_(helper_STC);
-extern void VG_(helper_CMC);
+extern const Char VG_(helper_CLC)[];
+extern const Char VG_(helper_STC)[];
+extern const Char VG_(helper_CMC)[];
-extern void VG_(helper_shldl);
-extern void VG_(helper_shldw);
-extern void VG_(helper_shrdl);
-extern void VG_(helper_shrdw);
+extern const Char VG_(helper_shldl)[];
+extern const Char VG_(helper_shldw)[];
+extern const Char VG_(helper_shrdl)[];
+extern const Char VG_(helper_shrdw)[];
-extern void VG_(helper_IN);
-extern void VG_(helper_OUT);
+extern const Char VG_(helper_IN)[];
+extern const Char VG_(helper_OUT)[];
-extern void VG_(helper_RDTSC);
-extern void VG_(helper_CPUID);
+extern const Char VG_(helper_RDTSC)[];
+extern const Char VG_(helper_CPUID)[];
-extern void VG_(helper_bsfw);
-extern void VG_(helper_bsfl);
-extern void VG_(helper_bsrw);
-extern void VG_(helper_bsrl);
+extern const Char VG_(helper_bsfw)[];
+extern const Char VG_(helper_bsfl)[];
+extern const Char VG_(helper_bsrw)[];
+extern const Char VG_(helper_bsrl)[];
-extern void VG_(helper_fstsw_AX);
-extern void VG_(helper_SAHF);
-extern void VG_(helper_LAHF);
-extern void VG_(helper_DAS);
-extern void VG_(helper_DAA);
-extern void VG_(helper_AAS);
-extern void VG_(helper_AAA);
-extern void VG_(helper_AAD);
-extern void VG_(helper_AAM);
+extern const Char VG_(helper_fstsw_AX)[];
+extern const Char VG_(helper_SAHF)[];
+extern const Char VG_(helper_LAHF)[];
+extern const Char VG_(helper_DAS)[];
+extern const Char VG_(helper_DAA)[];
+extern const Char VG_(helper_AAS)[];
+extern const Char VG_(helper_AAA)[];
+extern const Char VG_(helper_AAD)[];
+extern const Char VG_(helper_AAM)[];
-extern void VG_(helper_cmpxchg8b);
+extern const Char VG_(helper_cmpxchg8b)[];
/* ---------------------------------------------------------------------
--- valgrind/memcheck/mc_from_ucode.c #1.15:1.16
@@ -232,12 +232,11 @@ static void synth_TESTV ( Int sz, Int ta
VG_(synth_call) (
- False,
( sz==4
- ? VG_(helper_offset)((Addr) & MC_(helper_value_check4_fail))
+ ? (Addr) & MC_(helper_value_check4_fail)
: ( sz==2
- ? VG_(helper_offset)((Addr) & MC_(helper_value_check2_fail))
+ ? (Addr) & MC_(helper_value_check2_fail)
: ( sz==1
- ? VG_(helper_offset)((Addr) & MC_(helper_value_check1_fail))
- : VG_(helper_offset)((Addr) & MC_(helper_value_check0_fail))))),
+ ? (Addr) & MC_(helper_value_check1_fail)
+ : (Addr) & MC_(helper_value_check0_fail)))),
False, FlagsEmpty, FlagsOSZACP /* helpers don't preserve flags */
);
--- valgrind/memcheck/mc_main.c #1.56:1.57
@@ -1989,20 +1989,4 @@ void SK_(pre_clo_init)(void)
VG_(init_post_reg_write_clientcall_return) ( & mc_post_reg_write_clientcall );
- /* Three compact slots taken up by stack memory helpers */
- VG_(register_compact_helper)((Addr) & MC_(helper_value_check4_fail));
- VG_(register_compact_helper)((Addr) & MC_(helper_value_check0_fail));
- VG_(register_compact_helper)((Addr) & MC_(helper_value_check2_fail));
- VG_(register_compact_helper)((Addr) & MC_(helperc_STOREV4));
- VG_(register_compact_helper)((Addr) & MC_(helperc_LOADV4));
-
- /* These two made non-compact because 2-byte transactions are rare. */
- VG_(register_noncompact_helper)((Addr) & MC_(helperc_STOREV2));
- VG_(register_noncompact_helper)((Addr) & MC_(helperc_STOREV1));
- VG_(register_noncompact_helper)((Addr) & MC_(helperc_LOADV2));
- VG_(register_noncompact_helper)((Addr) & MC_(helperc_LOADV1));
- VG_(register_noncompact_helper)((Addr) & MC_(fpu_write_check));
- VG_(register_noncompact_helper)((Addr) & MC_(fpu_read_check));
- VG_(register_noncompact_helper)((Addr) & MC_(helper_value_check1_fail));
-
VGP_(register_profile_event) ( VgpSetMem, "set-mem-perms" );
VGP_(register_profile_event) ( VgpCheckMem, "check-mem-perms" );
--- valgrind/addrcheck/ac_main.c #1.71:1.72
@@ -1309,13 +1309,4 @@ void SK_(pre_clo_init)(void)
VG_(init_post_mem_write) ( & ac_make_accessible );
- VG_(register_compact_helper)((Addr) & ac_helperc_LOAD4);
- VG_(register_compact_helper)((Addr) & ac_helperc_LOAD2);
- VG_(register_compact_helper)((Addr) & ac_helperc_LOAD1);
- VG_(register_compact_helper)((Addr) & ac_helperc_STORE4);
- VG_(register_compact_helper)((Addr) & ac_helperc_STORE2);
- VG_(register_compact_helper)((Addr) & ac_helperc_STORE1);
- VG_(register_noncompact_helper)((Addr) & ac_fpu_READ_check);
- VG_(register_noncompact_helper)((Addr) & ac_fpu_WRITE_check);
-
VGP_(register_profile_event) ( VgpSetMem, "set-mem-perms" );
VGP_(register_profile_event) ( VgpCheckMem, "check-mem-perms" );
--- valgrind/cachegrind/cg_main.c #1.82:1.83
@@ -1125,9 +1125,4 @@ void SK_(pre_clo_init)(void)
VG_(needs_command_line_options)();
- VG_(register_compact_helper)((Addr) & log_1I_0D_cache_access);
- VG_(register_compact_helper)((Addr) & log_1I_1Dr_cache_access);
- VG_(register_compact_helper)((Addr) & log_1I_1Dw_cache_access);
- VG_(register_compact_helper)((Addr) & log_1I_2D_cache_access);
-
/* Get working directory */
sk_assert( VG_(getcwd_alloc)(&base_dir) );
--- valgrind/helgrind/hg_main.c #1.92:1.93
@@ -3310,17 +3310,4 @@ void SK_(pre_clo_init)(void)
VG_(init_post_mutex_unlock) (& eraser_post_mutex_unlock);
- VG_(register_compact_helper)((Addr) & eraser_mem_help_read_1);
- VG_(register_compact_helper)((Addr) & eraser_mem_help_read_2);
- VG_(register_compact_helper)((Addr) & eraser_mem_help_read_4);
- VG_(register_noncompact_helper)((Addr) & eraser_mem_help_read_N);
-
- VG_(register_compact_helper)((Addr) & eraser_mem_help_write_1);
- VG_(register_compact_helper)((Addr) & eraser_mem_help_write_2);
- VG_(register_compact_helper)((Addr) & eraser_mem_help_write_4);
- VG_(register_noncompact_helper)((Addr) & eraser_mem_help_write_N);
-
- VG_(register_noncompact_helper)((Addr) & bus_lock);
- VG_(register_noncompact_helper)((Addr) & bus_unlock);
-
for(i = 0; i < LOCKSET_HASH_SZ; i++)
lockset_hash[i] = NULL;
--- valgrind/lackey/lk_main.c #1.25:1.26
@@ -82,11 +82,4 @@ void SK_(pre_clo_init)(void)
VG_(details_bug_reports_to) (VG_BUGS_TO);
VG_(details_avg_translation_sizeB) ( 175 );
-
- VG_(register_compact_helper)((Addr) & add_one_dlrr_call);
- VG_(register_compact_helper)((Addr) & add_one_BB);
- VG_(register_compact_helper)((Addr) & add_one_machine_instr);
- VG_(register_compact_helper)((Addr) & add_one_UInstr);
- VG_(register_compact_helper)((Addr) & add_one_Jcc);
- VG_(register_compact_helper)((Addr) & add_one_Jcc_untaken);
}
|