Skip to content

Commit

Permalink
Merge branch 'main' into fix-memory-grow-and-size
Browse files Browse the repository at this point in the history
  • Loading branch information
bhelx committed Oct 13, 2023
2 parents 088868c + 6a99ee2 commit 2811dd3
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
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>
<orderedWastToProcess>memory_grow.wast,
memory_size.wast</orderedWastToProcess>
<excludedTests>
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 @@ -1087,7 +1087,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 @@ -1096,6 +1096,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

0 comments on commit 2811dd3

Please sign in to comment.