Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

int literals, int exprs and endianness #38

Merged
merged 2 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@
load.wast,
address.wast,
const.wast,
align.wast</wastToProcess>
align.wast,
int_literals.wast,
int_exprs.wast,
endianness.wast</wastToProcess>
<excludedTests>
<!-- Assertion failures -->
<!-- Errors -->
Expand Down
38 changes: 37 additions & 1 deletion runtime/src/main/java/com/dylibso/chicory/runtime/Machine.java
Original file line number Diff line number Diff line change
Expand Up @@ -1084,7 +1084,7 @@ void eval(List<Instruction> code) throws ChicoryException {
case F64_REINTERPRET_I64:
{
var tos = this.stack.pop();
this.stack.push(Value.i64(tos.asLong()));
this.stack.push(Value.f64(tos.asLong()));
break;
}
case I64_TRUNC_F64_S:
Expand All @@ -1093,6 +1093,42 @@ void eval(List<Instruction> code) throws ChicoryException {
this.stack.push(Value.i64(Double.valueOf(tos.asDouble()).longValue()));
break;
}
case I32_WRAP_I64:
{
var tos = this.stack.pop();
this.stack.push(Value.i32(tos.asInt()));
break;
}
case I64_EXTEND_I32_S:
{
var tos = this.stack.pop();
this.stack.push(Value.i64(Integer.valueOf(tos.asInt()).longValue()));
break;
}
case I64_EXTEND_I32_U:
{
var tos = this.stack.pop();
this.stack.push(Value.i64(tos.asUInt()));
break;
}
case I32_REINTERPRET_F32:
{
var tos = this.stack.pop();
this.stack.push(Value.i32(tos.asInt()));
break;
}
case I64_REINTERPRET_F64:
{
var tos = this.stack.pop();
this.stack.push(Value.i64(tos.asLong()));
break;
}
case F32_REINTERPRET_I32:
{
var tos = this.stack.pop();
this.stack.push(Value.f32(tos.asInt()));
break;
}
default:
throw new RuntimeException(
"Machine doesn't recognize Instruction " + instruction);
Expand Down