From 5af41951031ab79366dfec6c1a3922b0e37e60ab Mon Sep 17 00:00:00 2001 From: Florian Krohm Date: Mon, 29 Dec 2014 17:04:46 +0000 Subject: [PATCH] Remove the type AddrH. The code assumes in many places that the host and guest architecture are the same. So the type is really pointless nowadays. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@14834 --- coregrind/m_aspacemgr/aspacemgr-common.c | 2 +- coregrind/m_mallocfree.c | 6 +++--- coregrind/m_scheduler/scheduler.c | 4 ++-- coregrind/m_transtab.c | 18 +++++++++--------- coregrind/pub_core_transtab.h | 8 ++++---- include/pub_tool_basics.h | 6 +----- 6 files changed, 20 insertions(+), 24 deletions(-) diff --git a/coregrind/m_aspacemgr/aspacemgr-common.c b/coregrind/m_aspacemgr/aspacemgr-common.c index 2c099a9a23..ed663cd01e 100644 --- a/coregrind/m_aspacemgr/aspacemgr-common.c +++ b/coregrind/m_aspacemgr/aspacemgr-common.c @@ -376,7 +376,7 @@ VgStack* VG_(am_alloc_VgStack)( /*OUT*/Addr* initial_sp ) if (sr_isError(sres)) return NULL; - stack = (VgStack*)(AddrH)sr_Res(sres); + stack = (VgStack*)(Addr)sr_Res(sres); aspacem_assert(VG_IS_PAGE_ALIGNED(szB)); aspacem_assert(VG_IS_PAGE_ALIGNED(stack)); diff --git a/coregrind/m_mallocfree.c b/coregrind/m_mallocfree.c index 7349849f1e..a5b931798d 100644 --- a/coregrind/m_mallocfree.c +++ b/coregrind/m_mallocfree.c @@ -857,7 +857,7 @@ Superblock* newSuperblock ( Arena* a, SizeT cszB ) ( cszB, VKI_PROT_READ|VKI_PROT_WRITE|VKI_PROT_EXEC ); if (sr_isError(sres)) return 0; - sb = (Superblock*)(AddrH)sr_Res(sres); + sb = (Superblock*)(Addr)sr_Res(sres); // Mark this segment as containing client heap. The leak // checker needs to be able to identify such segments so as not // to use them as sources of roots during leak checks. @@ -870,7 +870,7 @@ Superblock* newSuperblock ( Arena* a, SizeT cszB ) /* NOTREACHED */ sb = NULL; /* keep gcc happy */ } else { - sb = (Superblock*)(AddrH)sr_Res(sres); + sb = (Superblock*)(Addr)sr_Res(sres); } } vg_assert(NULL != sb); @@ -1763,7 +1763,7 @@ void* VG_(arena_malloc) ( ArenaId aid, const HChar* cc, SizeT req_pszB ) a->sblocks_size * 2); /* NOTREACHED */ } - array = (Superblock**)(AddrH)sr_Res(sres); + array = (Superblock**)(Addr)sr_Res(sres); for (i = 0; i < a->sblocks_used; ++i) array[i] = a->sblocks[i]; a->sblocks_size *= 2; diff --git a/coregrind/m_scheduler/scheduler.c b/coregrind/m_scheduler/scheduler.c index 78369b3a7f..a424be61f5 100644 --- a/coregrind/m_scheduler/scheduler.c +++ b/coregrind/m_scheduler/scheduler.c @@ -876,7 +876,7 @@ void run_thread_for_a_while ( /*OUT*/HWord* two_words, if (LIKELY(VG_(tt_fast)[cno].guest == (Addr)tst->arch.vex.VG_INSTR_PTR)) host_code_addr = VG_(tt_fast)[cno].host; else { - AddrH res = 0; + Addr res = 0; /* not found in VG_(tt_fast). Searching here the transtab improves the performance compared to returning directly to the scheduler. */ @@ -1128,7 +1128,7 @@ void handle_noredir_jump ( /*OUT*/HWord* two_words, /* Clear return area. */ two_words[0] = two_words[1] = 0; - AddrH hcode = 0; + Addr hcode = 0; Addr ip = VG_(get_IP)(tid); Bool found = VG_(search_unredir_transtab)( &hcode, ip ); diff --git a/coregrind/m_transtab.c b/coregrind/m_transtab.c index e9cfd0260f..8477b48eba 100644 --- a/coregrind/m_transtab.c +++ b/coregrind/m_transtab.c @@ -1389,7 +1389,7 @@ static void initialiseSector ( Int sno ) 8 * tc_sector_szQ ); /*NOTREACHED*/ } - sec->tc = (ULong*)(AddrH)sr_Res(sres); + sec->tc = (ULong*)(Addr)sr_Res(sres); sres = VG_(am_mmap_anon_float_valgrind) ( N_TTES_PER_SECTOR * sizeof(TTEntry) ); @@ -1398,7 +1398,7 @@ static void initialiseSector ( Int sno ) N_TTES_PER_SECTOR * sizeof(TTEntry) ); /*NOTREACHED*/ } - sec->tt = (TTEntry*)(AddrH)sr_Res(sres); + sec->tt = (TTEntry*)(Addr)sr_Res(sres); for (i = 0; i < N_TTES_PER_SECTOR; i++) { sec->tt[i].status = Empty; @@ -1514,7 +1514,7 @@ static void initialiseSector ( Int sno ) */ void VG_(add_to_transtab)( const VexGuestExtents* vge, Addr64 entry, - AddrH code, + Addr code, UInt code_len, Bool is_self_checking, Int offs_profInc, @@ -1682,7 +1682,7 @@ void VG_(add_to_transtab)( const VexGuestExtents* vge, requested, a successful search can also cause the fast-caches to be updated. */ -Bool VG_(search_transtab) ( /*OUT*/AddrH* res_hcode, +Bool VG_(search_transtab) ( /*OUT*/Addr* res_hcode, /*OUT*/UInt* res_sNo, /*OUT*/UInt* res_tteNo, Addr64 guest_addr, @@ -1716,7 +1716,7 @@ Bool VG_(search_transtab) ( /*OUT*/AddrH* res_hcode, setFastCacheEntry( guest_addr, sectors[sno].tt[k].tcptr ); if (res_hcode) - *res_hcode = (AddrH)sectors[sno].tt[k].tcptr; + *res_hcode = (Addr)sectors[sno].tt[k].tcptr; if (res_sNo) *res_sNo = sno; if (res_tteNo) @@ -2076,7 +2076,7 @@ static void init_unredir_tt_tc ( void ) N_UNREDIR_TT * UNREDIR_SZB); /*NOTREACHED*/ } - unredir_tc = (ULong *)(AddrH)sr_Res(sres); + unredir_tc = (ULong *)(Addr)sr_Res(sres); } unredir_tc_used = 0; for (i = 0; i < N_UNREDIR_TT; i++) @@ -2107,7 +2107,7 @@ static Bool sanity_check_redir_tt_tc ( void ) */ void VG_(add_to_unredir_transtab)( const VexGuestExtents* vge, Addr64 entry, - AddrH code, + Addr code, UInt code_len ) { Int i, j, code_szQ; @@ -2160,7 +2160,7 @@ void VG_(add_to_unredir_transtab)( const VexGuestExtents* vge, vg_assert(&dstP[code_len] <= (HChar*)&unredir_tc[unredir_tc_used]); } -Bool VG_(search_unredir_transtab) ( /*OUT*/AddrH* result, +Bool VG_(search_unredir_transtab) ( /*OUT*/Addr* result, Addr64 guest_addr ) { Int i; @@ -2168,7 +2168,7 @@ Bool VG_(search_unredir_transtab) ( /*OUT*/AddrH* result, if (!unredir_tt[i].inUse) continue; if (unredir_tt[i].vge.base[0] == guest_addr) { - *result = (AddrH)unredir_tt[i].hcode; + *result = (Addr)unredir_tt[i].hcode; return True; } } diff --git a/coregrind/pub_core_transtab.h b/coregrind/pub_core_transtab.h index 2c91cfabd4..d079881125 100644 --- a/coregrind/pub_core_transtab.h +++ b/coregrind/pub_core_transtab.h @@ -83,7 +83,7 @@ extern void VG_(init_tt_tc) ( void ); extern void VG_(add_to_transtab)( const VexGuestExtents* vge, Addr64 entry, - AddrH code, + Addr code, UInt code_len, Bool is_self_checking, Int offs_profInc, @@ -95,7 +95,7 @@ void VG_(tt_tc_do_chaining) ( void* from__patch_addr, UInt to_tteNo, Bool to_fastEP ); -extern Bool VG_(search_transtab) ( /*OUT*/AddrH* res_hcode, +extern Bool VG_(search_transtab) ( /*OUT*/Addr* res_hcode, /*OUT*/UInt* res_sNo, /*OUT*/UInt* res_tteNo, Addr64 guest_addr, @@ -114,10 +114,10 @@ extern UInt VG_(get_bbs_translated) ( void ); extern void VG_(add_to_unredir_transtab)( const VexGuestExtents* vge, Addr64 entry, - AddrH code, + Addr code, UInt code_len ); extern -Bool VG_(search_unredir_transtab) ( /*OUT*/AddrH* result, +Bool VG_(search_unredir_transtab) ( /*OUT*/Addr* result, Addr64 guest_addr ); // SB profiling stuff diff --git a/include/pub_tool_basics.h b/include/pub_tool_basics.h index acc766b161..1bbabadf00 100644 --- a/include/pub_tool_basics.h +++ b/include/pub_tool_basics.h @@ -86,12 +86,8 @@ typedef unsigned long UWord; // 32 64 typedef signed long Word; // 32 64 -// Addr is for holding an address. AddrH was intended to be "Addr on the -// host", for the notional case where host word size != guest word size. -// But since the assumption that host arch == guest arch has become so -// deeply wired in, it's a pretty pointless distinction now. +// Addr is for holding an address. typedef UWord Addr; // 32 64 -typedef UWord AddrH; // 32 64 // Our equivalents of POSIX 'size_t' and 'ssize_t': // - size_t is an "unsigned integer type of the result of the sizeof operator". -- 2.47.3