Skip to content

Commit

Permalink
checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaTP committed Sep 18, 2024
1 parent 5c171e6 commit cf3c868
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ public ValueType readGlobalType(int idx) {
if (idx < importedGlobalsOffset) {
return imports.global(idx).instance().getType();
}
var i = idx - importedGlobalsOffset;
return globals[idx - importedGlobalsOffset].getType();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -738,10 +738,10 @@ static void eval(MStack stack, Instance instance, Deque<StackFrame> callStack)
TABLE_GROW(stack, instance, operands);
break;
case REF_FUNC:
stack.push((int) operands.get(0));
stack.push(operands.get(0));
break;
case REF_NULL:
REF_NULL(stack, operands);
REF_NULL(stack);
break;
case REF_IS_NULL:
REF_IS_NULL(stack);
Expand Down Expand Up @@ -862,8 +862,8 @@ private static void I64_SUB(MStack stack) {
}

private static void I32_MUL(MStack stack) {
var a = (int) stack.pop();
var b = (int) stack.pop();
var a = stack.pop();
var b = stack.pop();
stack.push(a * b);
}

Expand Down Expand Up @@ -1288,13 +1288,13 @@ private static void F64_REINTERPRET_I64(MStack stack) {
}

private static void I32_WRAP_I64(MStack stack) {
var tos = stack.pop();
stack.push((int) tos);
int tos = (int) stack.pop();
stack.push(tos);
}

private static void I64_EXTEND_I32_S(MStack stack) {
var tos = stack.pop();
stack.push((int) tos);
int tos = (int) stack.pop();
stack.push(tos);
}

private static void I64_EXTEND_I32_U(MStack stack) {
Expand Down Expand Up @@ -1424,8 +1424,7 @@ private static void F32_CONVERT_I64_S(MStack stack) {
stack.push(Value.floatToLong(OpcodeImpl.F32_CONVERT_I64_S(tos)));
}

private static void REF_NULL(MStack stack, Operands operands) {
var type = ValueType.forId((int) operands.get(0));
private static void REF_NULL(MStack stack) {
stack.push(REF_NULL_VALUE);
}

Expand Down Expand Up @@ -1944,27 +1943,6 @@ static long[] extractArgsForParams(MStack stack, List<ValueType> params) {
var args = new long[params.size()];
for (var i = params.size(); i > 0; i--) {
var p = stack.pop();
var t = params.get(i - 1);
// TODO: re-enable the check and verify the boxing/unboxing
// This section and checks can be moved in Instance.export!
//
// if (p.type() != t) {
// // Similar to what is happening in WaZero
// //
// https://github.com/tetratelabs/wazero/blob/36676928d22ab92c34299eb0dca7608c92c94b22/internal/wasm/gofunc.go#L109
// switch (t) {
// case I32:
// case I64:
// case F32:
// case F64:
// p = new Value(t, p);
// break;
// default:
// throw new RuntimeException("Type error when extracting args.
// Found: " + t);
// }
// }
// args[i - 1] = new Value(t, p);
args[i - 1] = p;
}
return args;
Expand Down

0 comments on commit cf3c868

Please sign in to comment.