Skip to content

Commit 15b5a39

Browse files
committed
Minor improvements
1 parent 33c97b9 commit 15b5a39

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

source/execution/runtime.d

+9-14
Original file line numberDiff line numberDiff line change
@@ -97,21 +97,19 @@ private:
9797
stack_unwind(this.stack, frame.sp, frame.arity);
9898
},
9999
(I32Store i32store) {
100-
const value_ = this.stack.back;
101-
this.stack.popBack();
102-
const valueAddr = this.stack.back;
100+
const value = this.stack.back.match!(
101+
(I32 i32) => i32.i,
102+
_ => assert(false)
103+
);
103104
this.stack.popBack();
104-
const addr = cast(size_t) valueAddr.match!(
105-
(I32 value) => value.i,
105+
const addr = this.stack.back.match!(
106+
(I32 value) => size_t(value.i),
106107
_ => assert(false)
107108
);
108-
const offset = cast(size_t) i32store.offset;
109+
this.stack.popBack();
110+
const offset = size_t(i32store.offset);
109111
const at = addr + offset;
110112
auto memory = this.store.memories[0];
111-
const int value = value_.match!(
112-
(I32 i32) => i32.i,
113-
_ => assert(false)
114-
);
115113
memory.data.write!(int, Endian.littleEndian)(value, at);
116114
},
117115
(I32Const i32const) {
@@ -283,10 +281,7 @@ public:
283281
(binary.types.Func func) => func.idx
284282
);
285283
const funcInst = this.store.funcs[idx];
286-
foreach (arg; args)
287-
{
288-
this.stack ~= arg;
289-
}
284+
this.stack ~= args;
290285
return funcInst.match!(
291286
(InternalFuncInst func) => invokeInternal(func),
292287
(ExternalFuncInst func) => invokeExternal(func),

0 commit comments

Comments
 (0)