Skip to content

Commit

Permalink
Fix disassembler and a code generation bug
Browse files Browse the repository at this point in the history
  • Loading branch information
vddCore committed May 21, 2024
1 parent 7ec8660 commit fafd139
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VirtualMachine/Ceres/Ceres.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Nullable>enable</Nullable>
<LangVersion>11.0</LangVersion>

<Version>7.4.0</Version>
<Version>7.4.1</Version>
<AssemblyName>Ceres</AssemblyName>
<AssemblyTitle>Ceres</AssemblyTitle>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,14 @@ public static void Disassemble(Chunk chunk, TextWriter output, DisassemblyOption
output.Write($"{indent} {ip:X8}: ");
switch (opCode)
{
case OpCode.INVOKE:
case OpCode.YIELD:
case OpCode.NEXT:
output.Write(opCode);
output.Write(" ");
output.WriteLine(reader.ReadInt32());
break;

case OpCode.INVOKE:
output.Write(opCode);
output.Write(" ");
output.Write(reader.ReadInt32());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public override void Visit(ByExpression byExpression)

Chunk.CodeGenerator.Emit(arms[i].DeepEquality ? OpCode.DEQ : OpCode.CEQ);
Chunk.CodeGenerator.Emit(OpCode.FJMP, labels[i]);

Chunk.CodeGenerator.Emit(OpCode.POP);

Visit(arms[i].ValueArm);

if (arms[i].ValueArm is Expression)
Expand Down

0 comments on commit fafd139

Please sign in to comment.