Reduce cache field size outside of debug mode

This commit is contained in:
Fabian 2018-02-02 13:08:53 -05:00
parent 95f16561b8
commit 37ef4bd7f4
2 changed files with 14 additions and 2 deletions

View file

@ -17,7 +17,11 @@
#include "js_imports.h"
#include "cpu.h"
struct code_cache jit_cache_arr[WASM_TABLE_SIZE] = {{0, 0, {0}, 0, 0, 0, 0}};
#if DEBUG
struct code_cache jit_cache_arr[WASM_TABLE_SIZE] = {{0, 0, {0}, 0, 0, 0, false}};
#else
struct code_cache jit_cache_arr[WASM_TABLE_SIZE] = {{0, 0, 0, false}};
#endif
uint32_t jit_jump = 0;
int32_t hot_code_addresses[HASH_PRIME] = {0};
@ -644,9 +648,11 @@ static void jit_generate(int32_t address_hash, uint32_t phys_addr, struct code_c
assert(entry->is_32 == *is_32);
}
#if DEBUG
entry->opcode[0] = first_opcode;
entry->end_addr = end_addr;
entry->len = len;
#endif
jit_jump = false;

View file

@ -37,18 +37,24 @@ _Static_assert(sizeof(union reg64) == 8, "reg64 is 8 bytes");
struct code_cache {
// Address of the start of the basic block
uint32_t start_addr;
#if DEBUG
uint32_t end_addr;
// Address of the instruction immediately after the basic block ends
int32_t opcode[1]; // TODO: Remove in debug mode
int32_t len;
int32_t is_32;
#endif
// Cleanliness status of the entry's "group" (based on
// DIRTY_ARR_SHIFT). Value only has meaning in relation with the
// group_dirtiness value.
uint32_t group_status;
uint16_t wasm_table_index;
bool is_32;
};
#if DEBUG
#else
_Static_assert(sizeof(struct code_cache) == 12, "code_cache uses 12 bytes");
#endif
struct code_cache jit_cache_arr[WASM_TABLE_SIZE];
// Flag indicating whether the instruction that just ran was a jump of some sort