70 lines
1.6 KiB
WebAssembly Text Format
70 lines
1.6 KiB
WebAssembly Text Format
(module
|
|
(type $heap-object (sub (struct (field (mut i32)))))
|
|
(type $open-procedure (func (param i32)))
|
|
(type $closure (sub $heap-object
|
|
(struct (field (mut i32))
|
|
(field (ref $open-procedure)))))
|
|
(type $cont-stack-type (array (mut (ref null $open-procedure))))
|
|
(type $arg-array-type (array (mut (ref null eq))))
|
|
(global $cont-stack-top (mut i32) (i32.const 0))
|
|
(global $cont-stack (ref $cont-stack-type)
|
|
(i32.const 128)
|
|
(array.new_default $cont-stack-type))
|
|
(global $arg-array (ref $arg-array-type)
|
|
(i32.const 32)
|
|
(array.new_default $arg-array-type))
|
|
(global (mut (ref null eq)) (ref.null eq))
|
|
(elem declare funcref (ref.func 1))
|
|
(func
|
|
(param i32)
|
|
(result)
|
|
(local (ref eq) (ref eq) (ref eq) (ref eq) (ref eq))
|
|
(global.get 2)
|
|
(i32.const 0)
|
|
(array.get 3)
|
|
ref.as_non_null
|
|
(global.set 3))
|
|
(func
|
|
(param i32)
|
|
(result)
|
|
(local (ref eq) (ref eq) (ref eq) (ref eq) (ref eq))
|
|
(global.get 2)
|
|
(i32.const 0)
|
|
(array.get 3)
|
|
ref.as_non_null
|
|
(local.set 1)
|
|
(global.get 2)
|
|
(i32.const 0)
|
|
(local.get 1)
|
|
(array.set 3)
|
|
(i32.const 1)
|
|
(global.get 1)
|
|
(global.get 0)
|
|
(array.get 2)
|
|
ref.as_non_null
|
|
(global.get 0)
|
|
(i32.const 1)
|
|
i32.sub
|
|
(global.set 0)
|
|
(return_call_ref 1))
|
|
(func
|
|
(param i32)
|
|
(result)
|
|
(local (ref eq) (ref eq) (ref eq) (ref eq) (ref eq))
|
|
(ref.func 1)
|
|
(local.set 1)
|
|
(global.get 2)
|
|
(i32.const 0)
|
|
(local.get 1)
|
|
(array.set 3)
|
|
(return_call 1))
|
|
(func
|
|
(param)
|
|
(result (ref eq))
|
|
(local (ref eq) (ref eq) (ref eq) (ref eq) (ref eq))
|
|
(i32.const 0)
|
|
(call 1)
|
|
(global.get 3)
|
|
ref.as_non_null)
|
|
(export "main" (func 3)))
|