From 2d0d4a0be9732b58d796809f5b6ad4e00d536861 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Thu, 16 Nov 2023 19:48:06 +0900 Subject: [PATCH] Remove unused JitBitmap (#2775) Fixes: https://github.com/bytecodealliance/wasm-micro-runtime/issues/2754 --- core/iwasm/fast-jit/jit_utils.c | 19 ------- core/iwasm/fast-jit/jit_utils.h | 94 --------------------------------- 2 files changed, 113 deletions(-) delete mode 100644 core/iwasm/fast-jit/jit_utils.c diff --git a/core/iwasm/fast-jit/jit_utils.c b/core/iwasm/fast-jit/jit_utils.c deleted file mode 100644 index 57a3e8f6..00000000 --- a/core/iwasm/fast-jit/jit_utils.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (C) 2021 Intel Corporation. All rights reserved. - * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception - */ - -#include "jit_utils.h" - -JitBitmap * -jit_bitmap_new(uintptr_t begin_index, unsigned bitnum) -{ - JitBitmap *bitmap; - - if ((bitmap = jit_calloc(offsetof(JitBitmap, map) + (bitnum + 7) / 8))) { - bitmap->begin_index = begin_index; - bitmap->end_index = begin_index + bitnum; - } - - return bitmap; -} diff --git a/core/iwasm/fast-jit/jit_utils.h b/core/iwasm/fast-jit/jit_utils.h index c165b7a3..a533c70b 100644 --- a/core/iwasm/fast-jit/jit_utils.h +++ b/core/iwasm/fast-jit/jit_utils.h @@ -12,20 +12,6 @@ extern "C" { #endif -/** - * A simple fixed size bitmap. - */ -typedef struct JitBitmap { - /* The first valid bit index. */ - uintptr_t begin_index; - - /* The last valid bit index plus one. */ - uintptr_t end_index; - - /* The bitmap. */ - uint8 map[1]; -} JitBitmap; - static inline void * jit_malloc(unsigned int size) { @@ -49,86 +35,6 @@ jit_free(void *ptr) wasm_runtime_free(ptr); } -/** - * Create a new bitmap. - * - * @param begin_index the first valid bit index - * @param bitnum maximal bit number of the bitmap. - * - * @return the new bitmap if succeeds, NULL otherwise. - */ -JitBitmap * -jit_bitmap_new(uintptr_t begin_index, unsigned bitnum); - -/** - * Delete a bitmap. - * - * @param bitmap the bitmap to be deleted - */ -static inline void -jit_bitmap_delete(JitBitmap *bitmap) -{ - jit_free(bitmap); -} - -/** - * Check whether the given index is in the range of the bitmap. - * - * @param bitmap the bitmap - * @param n the bit index - * - * @return true if the index is in range, false otherwise - */ -static inline bool -jit_bitmap_is_in_range(JitBitmap *bitmap, unsigned n) -{ - return n >= bitmap->begin_index && n < bitmap->end_index; -} - -/** - * Get a bit in the bitmap - * - * @param bitmap the bitmap - * @param n the n-th bit to be get - * - * @return value of the bit - */ -static inline int -jit_bitmap_get_bit(JitBitmap *bitmap, unsigned n) -{ - unsigned idx = n - bitmap->begin_index; - bh_assert(n >= bitmap->begin_index && n < bitmap->end_index); - return (bitmap->map[idx / 8] >> (idx % 8)) & 1; -} - -/** - * Set a bit in the bitmap. - * - * @param bitmap the bitmap - * @param n the n-th bit to be set - */ -static inline void -jit_bitmap_set_bit(JitBitmap *bitmap, unsigned n) -{ - unsigned idx = n - bitmap->begin_index; - bh_assert(n >= bitmap->begin_index && n < bitmap->end_index); - bitmap->map[idx / 8] |= 1 << (idx % 8); -} - -/** - * Clear a bit in the bitmap. - * - * @param bitmap the bitmap - * @param n the n-th bit to be cleared - */ -static inline void -jit_bitmap_clear_bit(JitBitmap *bitmap, unsigned n) -{ - unsigned idx = n - bitmap->begin_index; - bh_assert(n >= bitmap->begin_index && n < bitmap->end_index); - bitmap->map[idx / 8] &= ~(1 << (idx % 8)); -} - #ifdef __cplusplus } #endif