Skip to content

Commit 658b859

Browse files
VolkerVolker
authored andcommitted
Fix the signum of compare operations in the text format.
1 parent a07e7fe commit 658b859

File tree

6 files changed

+28
-24
lines changed

6 files changed

+28
-24
lines changed

src/de/inetsoftware/jwebassembly/binary/BinaryModuleWriter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ protected void writeNumericOperator( NumericOperator numOp, @Nullable ValueType
605605
break;
606606
}
607607
break;
608-
case lt_s:
608+
case lt:
609609
switch( valueType ) {
610610
case i32:
611611
op = I32_LT_S;
@@ -621,7 +621,7 @@ protected void writeNumericOperator( NumericOperator numOp, @Nullable ValueType
621621
break;
622622
}
623623
break;
624-
case le_s:
624+
case le:
625625
switch( valueType ) {
626626
case i32:
627627
op = I32_LE_S;
@@ -637,7 +637,7 @@ protected void writeNumericOperator( NumericOperator numOp, @Nullable ValueType
637637
break;
638638
}
639639
break;
640-
case ge_s:
640+
case ge:
641641
switch( valueType ) {
642642
case i32:
643643
op = I32_GE_S;

src/de/inetsoftware/jwebassembly/module/BranchManger.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -646,16 +646,16 @@ private void negateCompare() {
646646
newOp = NumericOperator.eq;
647647
break;
648648
case gt:
649-
newOp = NumericOperator.le_s;
649+
newOp = NumericOperator.le;
650650
break;
651-
case lt_s:
652-
newOp = NumericOperator.ge_s;
651+
case lt:
652+
newOp = NumericOperator.ge;
653653
break;
654-
case le_s:
654+
case le:
655655
newOp = NumericOperator.gt;
656656
break;
657-
case ge_s:
658-
newOp = NumericOperator.lt_s;
657+
case ge:
658+
newOp = NumericOperator.lt;
659659
break;
660660
default:
661661
throw new WasmException( "Not a compare operation: " + instr.numOp, null, lineNumber );

src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -581,16 +581,16 @@ private void writeCode( CodeInputStream byteCode, ConstantPool constantPool ) t
581581
opIfCondition( NumericOperator.ne, byteCode, codePos );
582582
break;
583583
case 155: // iflt
584-
opIfCondition( NumericOperator.lt_s, byteCode, codePos );
584+
opIfCondition( NumericOperator.lt, byteCode, codePos );
585585
break;
586586
case 156: // ifge
587-
opIfCondition( NumericOperator.ge_s, byteCode, codePos );
587+
opIfCondition( NumericOperator.ge, byteCode, codePos );
588588
break;
589589
case 157: // ifgt
590590
opIfCondition( NumericOperator.gt, byteCode, codePos );
591591
break;
592592
case 158: // ifle
593-
opIfCondition( NumericOperator.le_s, byteCode, codePos );
593+
opIfCondition( NumericOperator.le, byteCode, codePos );
594594
break;
595595
case 159: // if_icmpeq
596596
opIfCompareCondition( NumericOperator.eq, byteCode, codePos );
@@ -599,16 +599,16 @@ private void writeCode( CodeInputStream byteCode, ConstantPool constantPool ) t
599599
opIfCompareCondition( NumericOperator.ne, byteCode, codePos );
600600
break;
601601
case 161: // if_icmplt
602-
opIfCompareCondition( NumericOperator.lt_s, byteCode, codePos );
602+
opIfCompareCondition( NumericOperator.lt, byteCode, codePos );
603603
break;
604604
case 162: // if_icmpge
605-
opIfCompareCondition( NumericOperator.ge_s, byteCode, codePos );
605+
opIfCompareCondition( NumericOperator.ge, byteCode, codePos );
606606
break;
607607
case 163: // if_icmpgt
608608
opIfCompareCondition( NumericOperator.gt, byteCode, codePos );
609609
break;
610610
case 164: // if_icmple
611-
opIfCompareCondition( NumericOperator.le_s, byteCode, codePos );
611+
opIfCompareCondition( NumericOperator.le, byteCode, codePos );
612612
break;
613613
//TODO case 165: // if_acmpeq
614614
//TODO case 166: // if_acmpne
@@ -903,16 +903,16 @@ private void opCompare( ValueType valueType, CodeInputStream byteCode, int codeP
903903
numOp = NumericOperator.ne;
904904
break;
905905
case 155: // iflt
906-
numOp = NumericOperator.lt_s;
906+
numOp = NumericOperator.lt;
907907
break;
908908
case 156: // ifge
909-
numOp = NumericOperator.ge_s;
909+
numOp = NumericOperator.ge;
910910
break;
911911
case 157: // ifgt
912912
numOp = NumericOperator.gt;
913913
break;
914914
case 158: // ifle
915-
numOp = NumericOperator.le_s;
915+
numOp = NumericOperator.le;
916916
break;
917917
default:
918918
throw new WasmException( "Unexpected compare sub operation: " + nextOp, null, -1 );

src/de/inetsoftware/jwebassembly/module/NumericOperator.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public enum NumericOperator {
3434
eq,
3535
ne,
3636
gt,
37-
lt_s,
38-
le_s,
39-
ge_s,
37+
lt,
38+
le,
39+
ge,
4040
}

src/de/inetsoftware/jwebassembly/module/WasmNumericInstruction.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ ValueType getPushValueType() {
6464
case eq:
6565
case ne:
6666
case gt:
67-
case lt_s:
68-
case le_s:
69-
case ge_s:
67+
case lt:
68+
case le:
69+
case ge:
7070
return null;
7171
default:
7272
return valueType;

src/de/inetsoftware/jwebassembly/text/TextModuleWriter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,10 @@ protected void writeNumericOperator( NumericOperator numOp, @Nullable ValueType
194194
switch( numOp ) {
195195
case div:
196196
case rem:
197+
case gt:
198+
case lt:
199+
case le:
200+
case ge:
197201
op += "_s";
198202
}
199203
}

0 commit comments

Comments
 (0)