AOT call stack optimizations (#3773)
- Implement TINY / STANDARD frame modes - tiny mode is only able to keep track on the IP and func idx, STANDARD mode provides more capabilities (parameters, stack pointer etc.). - Implement FRAME_PER_FUNCTION / FRAME_PER_CALL modes - frame per function adds code at the beginning and at the end of each function for allocating / deallocating stack frame, whereas in per-call mode the frame is allocated before each call. The exception is call to the imported function, where frame-per-function mode also allocates the stack before the `call` instruction (as it can't instrument the imported function). At the moment TINY + FRAME_PER_FUNCTION is automatically enabled in case GC and perf profiling are disabled and `values` call stack feature is not requested. In all the other cases STANDARD + FRAME_PER_CALL is used. STANDARD + FRAME_PER_FUNCTION and TINY + FRAME_PER_CALL are currently not implemented but possible, and might be enabled in the future. ps. https://github.com/bytecodealliance/wasm-micro-runtime/issues/3758
This commit is contained in:
@ -21,8 +21,24 @@ typedef struct {
|
||||
|
||||
/* Enables or disables parameters, locals and stack operands. */
|
||||
bool values;
|
||||
|
||||
/* If enabled, stack frame is generated at the beginning of each
|
||||
* function (frame-per-function mode). Otherwise, stack frame is
|
||||
* generated before each call of a function (frame-per-call mode). */
|
||||
bool frame_per_function;
|
||||
} AOTCallStackFeatures;
|
||||
|
||||
void
|
||||
aot_call_stack_features_init_default(AOTCallStackFeatures *features);
|
||||
|
||||
typedef enum {
|
||||
AOT_STACK_FRAME_OFF = 0,
|
||||
/* Use a small stack frame data structure (AOTTinyFrame) */
|
||||
AOT_STACK_FRAME_TYPE_TINY,
|
||||
/* Use a regular stack frame data structure (AOTFrame) */
|
||||
AOT_STACK_FRAME_TYPE_STANDARD,
|
||||
} AOTStackFrameType;
|
||||
|
||||
typedef struct AOTCompOption {
|
||||
bool is_jit_mode;
|
||||
bool is_indirect_mode;
|
||||
@ -38,7 +54,7 @@ typedef struct AOTCompOption {
|
||||
bool enable_ref_types;
|
||||
bool enable_gc;
|
||||
bool enable_aux_stack_check;
|
||||
bool enable_aux_stack_frame;
|
||||
AOTStackFrameType aux_stack_frame_type;
|
||||
AOTCallStackFeatures call_stack_features;
|
||||
bool enable_perf_profiling;
|
||||
bool enable_memory_profiling;
|
||||
|
||||
Reference in New Issue
Block a user