evmone
evmone copied to clipboard
Force aligned access for EVM stack
Compilers generate vector instructions with unaligned access to access elements on the EVM stack. Inform compiler that the stack memory is 32-byte aligned.
Would that mean hinting something like:
#ifdef __MSC_VER
StackTop* st = static_cast<StackTop*>(__builtin_assume_aligned(&state.stack, 256));
#else
StackTop* st = std::assume_aligned<256>(&state.stack);
#endif
CoreFn(*st);
state.adjust_stack_size(instr::traits[Op].stack_height_change);
?
I'm not sure whether there's a quick way to check on goldbolt or something.
You can solely rely on standard std::assume_aligned. But I was thinking if this can be done more elegantly by annotating the type with alignas.
I believe this was done in https://github.com/ipsilon/evmone/pull/1233.