From 2fcae50af1b8049be029ecbaa3cee8f0e3bd3861 Mon Sep 17 00:00:00 2001 From: Matthew Duggan Date: Sat, 28 Mar 2020 20:48:46 +0900 Subject: [PATCH] ULTIMA8: Remove valgrind-specific code --- .../ultima/ultima8/kernel/segmented_pool.cpp | 28 ++--------- engines/ultima/ultima8/misc/pent_include.h | 4 -- engines/ultima/ultima8/misc/pent_valgrind.h | 50 ------------------- 3 files changed, 3 insertions(+), 79 deletions(-) delete mode 100644 engines/ultima/ultima8/misc/pent_valgrind.h diff --git a/engines/ultima/ultima8/kernel/segmented_pool.cpp b/engines/ultima/ultima8/kernel/segmented_pool.cpp index 443707cf4ee..9fda22865db 100644 --- a/engines/ultima/ultima8/kernel/segmented_pool.cpp +++ b/engines/ultima/ultima8/kernel/segmented_pool.cpp @@ -37,18 +37,9 @@ DEFINE_RUNTIME_CLASSTYPE_CODE(SegmentedPool, Pool) #define OFFSET_ALIGN(X) ( (X + sizeof(uintptr) - 1) & ~(sizeof(uintptr) - 1) ) -#ifdef USE_VALGRIND -const int redzoneSize = 8; -#else -const int redzoneSize = 0; -#endif - struct SegmentedPoolNode { SegmentedPool *pool; SegmentedPoolNode *nextFree; -#ifdef USE_VALGRIND - int valgrind_handle; -#endif size_t size; }; @@ -61,17 +52,15 @@ SegmentedPool::SegmentedPool(size_t nodeCapacity_, uint32 nodes) // Give it its real capacity. // One redzone is added after the memory block. - _nodeCapacity = OFFSET_ALIGN(nodeCapacity_ + redzoneSize); + _nodeCapacity = OFFSET_ALIGN(nodeCapacity_); // Node offsets are aligned to the next uintptr offset after the real size. // Another redzone is added between the node and the memory block. - _nodeOffset = OFFSET_ALIGN(sizeof(SegmentedPoolNode) + redzoneSize) + _nodeCapacity; + _nodeOffset = OFFSET_ALIGN(sizeof(SegmentedPoolNode)) + _nodeCapacity; _startOfPool = new uint8[_nodeOffset * nodes]; _endOfPool = _startOfPool + (_nodeOffset * nodes); - VALGRIND_CREATE_MEMPOOL(_startOfPool, redzoneSize, 0); - _firstFree = reinterpret_cast(_startOfPool); _firstFree->pool = this; _firstFree->size = 0; @@ -92,8 +81,6 @@ SegmentedPool::SegmentedPool(size_t nodeCapacity_, uint32 nodes) SegmentedPool::~SegmentedPool() { assert(isEmpty()); - VALGRIND_DESTROY_MEMPOOL(_startOfPool); - delete [] _startOfPool; } @@ -118,13 +105,7 @@ void *SegmentedPool::allocate(size_t size) { // debugN"Allocating Node 0x%08X\n", node); uint8 *p = reinterpret_cast(node) + - OFFSET_ALIGN(sizeof(SegmentedPoolNode) + redzoneSize); - - VALGRIND_MEMPOOL_ALLOC(_startOfPool, p, size); -#ifdef USE_VALGRIND - node->valgrind_handle = VALGRIND_CREATE_BLOCK(p, size, - "SegmentedPoolBlock"); -#endif + OFFSET_ALIGN(sizeof(SegmentedPoolNode)); return p; } @@ -137,9 +118,6 @@ void SegmentedPool::deallocate(void *ptr) { node->size = 0; assert(node->pool == this); - VALGRIND_MEMPOOL_FREE(_startOfPool, ptr); - VALGRIND_DISCARD(node->valgrind_handle); - // debugN"Free Node 0x%08X\n", node); if (isFull()) { _firstFree = node; diff --git a/engines/ultima/ultima8/misc/pent_include.h b/engines/ultima/ultima8/misc/pent_include.h index 1bd3a6c69f5..7ee2bb0a42b 100644 --- a/engines/ultima/ultima8/misc/pent_include.h +++ b/engines/ultima/ultima8/misc/pent_include.h @@ -94,10 +94,6 @@ // #define CANT_HAPPEN_MSG(msg) do { assert(msg && false); } while(0) -// -// Wrapper around valgrind functions. -#include "ultima/ultima8/misc/pent_valgrind.h" - namespace Ultima { namespace Ultima8 { diff --git a/engines/ultima/ultima8/misc/pent_valgrind.h b/engines/ultima/ultima8/misc/pent_valgrind.h deleted file mode 100644 index febab7fb419..00000000000 --- a/engines/ultima/ultima8/misc/pent_valgrind.h +++ /dev/null @@ -1,50 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - -#ifndef PENT_VALGRIND_H -#define PENT_VALGRIND_H - -#ifdef USE_VALGRIND - -#include - -#else - -#define VALGRIND_MAKE_MEM_NOACCESS(_qzz_addr,_qzz_len) -#define VALGRIND_MAKE_MEM_UNDEFINED(_qzz_addr,_qzz_len) -#define VALGRIND_MAKE_MEM_DEFINED(_qzz_addr,_qzz_len) - -#define VALGRIND_CHECK_MEM_IS_DEFINED(_qzz_addr,_qzz_len) -#define VALGRIND_CHECK_VALUE_IS_DEFINED(__lvalue) -#define VALGRIND_CHECK_MEM_IS_ADDRESSABLE(_qzz_addr,_qzz_len) - -#define VALGRIND_CREATE_MEMPOOL(pool,rzB,is_zeroed) -#define VALGRIND_DESTROY_MEMPOOL(pool) -#define VALGRIND_MEMPOOL_ALLOC(pool,addr,size) -#define VALGRIND_MEMPOOL_FREE(pool,addr) - -#define VALGRIND_CREATE_BLOCK(_qzz_addr,_qzz_len,_qzz_desc) 0 -#define VALGRIND_DISCARD(_qzz_blkindex) - -#endif - -#endif