diff options
author | Jo-Philipp Wich <jo@mein.io> | 2022-01-07 20:03:17 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2022-01-18 10:58:11 +0100 |
commit | 725bb75b7b66dd1e0a381908e831cede0402cb6e (patch) | |
tree | b8ee8c737198e5b5bad6b809457c59be2a7f8bb5 /vallist.c | |
parent | 6b2e79af9fe6e7d05d31245fc9049540a96d5d31 (diff) |
compiler, vm: use a program wide constant list
Instead of storing constant values per function, maintain a global program
wide list for all constant values within the current compilation unit.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'vallist.c')
-rw-r--r-- | vallist.c | 8 |
1 files changed, 3 insertions, 5 deletions
@@ -553,8 +553,7 @@ uc_value_t * uc_vallist_get(uc_value_list_t *list, size_t idx) { char str[sizeof(TAG_TYPE)]; - uc_function_t *func; - uc_chunk_t *chunk; + uc_program_t *program; size_t n, len; switch (uc_vallist_type(list, idx)) { @@ -593,10 +592,9 @@ uc_vallist_get(uc_value_list_t *list, size_t idx) return ucv_string_new_length(list->data + TAG_GET_OFFSET(list->index[idx]) + sizeof(uint32_t), len); case TAG_FUNC: - chunk = container_of(list, uc_chunk_t, constants); - func = container_of(chunk, uc_function_t, chunk); + program = container_of(list, uc_program_t, constants); - return uc_program_function_load(func->program, TAG_GET_NV(list->index[idx])); + return uc_program_function_load(program, TAG_GET_NV(list->index[idx])); default: return NULL; |