Skip to content

Commit

Permalink
int literals and int exprs
Browse files Browse the repository at this point in the history
  • Loading branch information
andreaTP committed Oct 13, 2023
1 parent 5d9cc17 commit a585ce3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
load.wast,
address.wast,
const.wast,
align.wast</wastToProcess>
align.wast,
int_literals.wast,
int_exprs.wast</wastToProcess>
<excludedTests>
<!-- Assertion failures -->
<!-- Errors -->
Expand Down
18 changes: 18 additions & 0 deletions runtime/src/main/java/com/dylibso/chicory/runtime/Machine.java
Original file line number Diff line number Diff line change
Expand Up @@ -1093,6 +1093,24 @@ 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;
}
default:
throw new RuntimeException(
"Machine doesn't recognize Instruction " + instruction);
Expand Down

0 comments on commit a585ce3

Please sign in to comment.