Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

give exec_instruction_desc arrays larger alignment #58

Merged
merged 2 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions lib/insn.c
Original file line number Diff line number Diff line change
Expand Up @@ -638,23 +638,28 @@ static int fetch_exec_next_insn_fe(const uint8_t *p, struct cell *stack,
.fetch_exec = fetch_exec_next_insn_##n, \
},

const static struct exec_instruction_desc exec_instructions_fc[] = {
#define __exec_table_align __aligned(64)

const static struct exec_instruction_desc
exec_instructions_fc[] __exec_table_align = {
#include "insn_list_fc.h"
};

#if defined(TOYWASM_ENABLE_WASM_SIMD)
const static struct exec_instruction_desc exec_instructions_fd[] = {
const static struct exec_instruction_desc
exec_instructions_fd[] __exec_table_align = {
#include "insn_list_simd.h"
};
#endif

#if defined(TOYWASM_ENABLE_WASM_THREADS)
const static struct exec_instruction_desc exec_instructions_fe[] = {
const static struct exec_instruction_desc
exec_instructions_fe[] __exec_table_align = {
#include "insn_list_threads.h"
};
#endif

const struct exec_instruction_desc exec_instructions[] = {
const struct exec_instruction_desc exec_instructions[] __exec_table_align = {
#include "insn_list_base.h"
#if defined(TOYWASM_ENABLE_WASM_TAILCALL)
#include "insn_list_tailcall.h"
Expand Down
8 changes: 8 additions & 0 deletions lib/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,11 @@
#define __constfunc
#endif /* defined(__GNUC__) */
#endif /* !defined(__constfunc) */

#if !defined(__aligned)
#if defined(__GNUC__)
#define __aligned(N) __attribute__((aligned(N)))
#else
#define __aligned(N)
#endif /* defined(__GNUC__) */
#endif /* !defined(__aligned) */