-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
for example, set the stack height limit to 64, but local.get $i will not be charged
(module
(func $f (export "f")
;; 128 args in thunk func
(param
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
i32 i32 i32 i32 i32 i32 i32 i32
)
i32.const 0
drop
)
)after instrumentation:
(module
(type (;0;) (func (param i32 i32 i32 ))) ;; ... *i32 (128 times)*
(func $f (;0;) (type 0) (param i32 i32 i32) ;; ... *i32 (128 times)*
i32.const 0
drop
)
(func (;1;) (type 0) (param i32 i32 i32) ;; ... *i32 (128 times)*
local.get 0
local.get 1
local.get 2
;; ...
local.get 127
;; ^^^ not charged
global.get 0
i32.const 3 ;; callee_stack_cost
i32.add
global.set 0
global.get 0
i32.const 64 ;; stack_limit
i32.gt_u
if ;; label = @1
unreachable
end
call $f
global.get 0
i32.const 3 ;; callee_stack_cost
i32.sub
global.set 0
)
(global (;0;) (mut i32) i32.const 0)
(export "f" (func 1))
)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels