@@ -705,7 +705,7 @@ export class Compiler extends DiagnosticEmitter {
705705 for ( let i = 0 , k = functionTable . length ; i < k ; ++ i ) {
706706 functionTableNames [ i ] = functionTable [ i ] . internalName ;
707707 }
708- module . setFunctionTable ( tableBase + functionTable . length , Module . UNLIMITED_TABLE , functionTableNames , module . i32 ( tableBase ) ) ;
708+ module . addFunctionTable ( "0" , tableBase + functionTable . length , Module . UNLIMITED_TABLE , functionTableNames , module . i32 ( tableBase ) ) ;
709709
710710 // expose the arguments length helper if there are varargs exports
711711 if ( this . runtimeFeatures & RuntimeFeatures . setArgumentsLength ) {
@@ -3604,14 +3604,14 @@ export class Compiler extends DiagnosticEmitter {
36043604
36053605 // f32 to f64
36063606 if ( toType . kind == TypeKind . F64 ) {
3607- expr = module . unary ( UnaryOp . PromoteF32 , expr ) ;
3607+ expr = module . unary ( UnaryOp . PromoteF32ToF64 , expr ) ;
36083608 }
36093609
36103610 // otherwise f32 to f32
36113611
36123612 // f64 to f32
36133613 } else if ( toType . kind == TypeKind . F32 ) {
3614- expr = module . unary ( UnaryOp . DemoteF64 , expr ) ;
3614+ expr = module . unary ( UnaryOp . DemoteF64ToF32 , expr ) ;
36153615 }
36163616
36173617 // otherwise f64 to f64
@@ -3626,16 +3626,16 @@ export class Compiler extends DiagnosticEmitter {
36263626 } else if ( toType . isSignedIntegerValue ) {
36273627 let saturating = this . options . hasFeature ( Feature . NONTRAPPING_F2I ) ;
36283628 if ( toType . isLongIntegerValue ) {
3629- expr = module . unary ( saturating ? UnaryOp . TruncF32ToI64Sat : UnaryOp . TruncF32ToI64 , expr ) ;
3629+ expr = module . unary ( saturating ? UnaryOp . TruncSatF32ToI64 : UnaryOp . TruncF32ToI64 , expr ) ;
36303630 } else {
3631- expr = module . unary ( saturating ? UnaryOp . TruncF32ToI32Sat : UnaryOp . TruncF32ToI32 , expr ) ;
3631+ expr = module . unary ( saturating ? UnaryOp . TruncSatF32ToI32 : UnaryOp . TruncF32ToI32 , expr ) ;
36323632 }
36333633 } else {
36343634 let saturating = this . options . hasFeature ( Feature . NONTRAPPING_F2I ) ;
36353635 if ( toType . isLongIntegerValue ) {
3636- expr = module . unary ( saturating ? UnaryOp . TruncF32ToU64Sat : UnaryOp . TruncF32ToU64 , expr ) ;
3636+ expr = module . unary ( saturating ? UnaryOp . TruncSatF32ToU64 : UnaryOp . TruncF32ToU64 , expr ) ;
36373637 } else {
3638- expr = module . unary ( saturating ? UnaryOp . TruncF32ToU32Sat : UnaryOp . TruncF32ToU32 , expr ) ;
3638+ expr = module . unary ( saturating ? UnaryOp . TruncSatF32ToU32 : UnaryOp . TruncF32ToU32 , expr ) ;
36393639 }
36403640 }
36413641
@@ -3646,16 +3646,16 @@ export class Compiler extends DiagnosticEmitter {
36463646 } else if ( toType . isSignedIntegerValue ) {
36473647 let saturating = this . options . hasFeature ( Feature . NONTRAPPING_F2I ) ;
36483648 if ( toType . isLongIntegerValue ) {
3649- expr = module . unary ( saturating ? UnaryOp . TruncF64ToI64Sat : UnaryOp . TruncF64ToI64 , expr ) ;
3649+ expr = module . unary ( saturating ? UnaryOp . TruncSatF64ToI64 : UnaryOp . TruncF64ToI64 , expr ) ;
36503650 } else {
3651- expr = module . unary ( saturating ? UnaryOp . TruncF64ToI32Sat : UnaryOp . TruncF64ToI32 , expr ) ;
3651+ expr = module . unary ( saturating ? UnaryOp . TruncSatF64ToI32 : UnaryOp . TruncF64ToI32 , expr ) ;
36523652 }
36533653 } else {
36543654 let saturating = this . options . hasFeature ( Feature . NONTRAPPING_F2I ) ;
36553655 if ( toType . isLongIntegerValue ) {
3656- expr = module . unary ( saturating ? UnaryOp . TruncF64ToU64Sat : UnaryOp . TruncF64ToU64 , expr ) ;
3656+ expr = module . unary ( saturating ? UnaryOp . TruncSatF64ToU64 : UnaryOp . TruncF64ToU64 , expr ) ;
36573657 } else {
3658- expr = module . unary ( saturating ? UnaryOp . TruncF64ToU32Sat : UnaryOp . TruncF64ToU32 , expr ) ;
3658+ expr = module . unary ( saturating ? UnaryOp . TruncSatF64ToU32 : UnaryOp . TruncF64ToU32 , expr ) ;
36593659 }
36603660 }
36613661 }
@@ -3715,13 +3715,13 @@ export class Compiler extends DiagnosticEmitter {
37153715 if ( toType . isBooleanValue ) {
37163716 expr = module . binary ( BinaryOp . NeI64 , expr , module . i64 ( 0 ) ) ;
37173717 } else if ( ! toType . isLongIntegerValue ) {
3718- expr = module . unary ( UnaryOp . WrapI64 , expr ) ; // discards upper bits
3718+ expr = module . unary ( UnaryOp . WrapI64ToI32 , expr ) ; // discards upper bits
37193719 }
37203720
37213721 // i32 or smaller to i64
37223722 } else if ( toType . isLongIntegerValue ) {
37233723 expr = module . unary (
3724- fromType . isSignedIntegerValue ? UnaryOp . ExtendI32 : UnaryOp . ExtendU32 ,
3724+ fromType . isSignedIntegerValue ? UnaryOp . ExtendI32ToI64 : UnaryOp . ExtendU32ToU64 ,
37253725 this . ensureSmallIntegerWrap ( expr , fromType ) // must clear garbage bits
37263726 ) ;
37273727
@@ -5013,7 +5013,7 @@ export class Compiler extends DiagnosticEmitter {
50135013 return module . binary ( BinaryOp . NeF64 , leftExpr , rightExpr ) ;
50145014 }
50155015 case TypeKind . V128 : {
5016- return module . unary ( UnaryOp . AnyTrueI8x16 ,
5016+ return module . unary ( UnaryOp . AnyTrueV128 ,
50175017 module . binary ( BinaryOp . NeI8x16 , leftExpr , rightExpr )
50185018 ) ;
50195019 }
@@ -9827,7 +9827,7 @@ export class Compiler extends DiagnosticEmitter {
98279827 case TypeKind . I8 : {
98289828 if ( flow . canOverflow ( expr , type ) ) {
98299829 expr = this . options . hasFeature ( Feature . SIGN_EXTENSION )
9830- ? module . unary ( UnaryOp . ExtendI8ToI32 , expr )
9830+ ? module . unary ( UnaryOp . Extend8I32 , expr )
98319831 : module . binary ( BinaryOp . ShrI32 ,
98329832 module . binary ( BinaryOp . ShlI32 ,
98339833 expr ,
@@ -9841,7 +9841,7 @@ export class Compiler extends DiagnosticEmitter {
98419841 case TypeKind . I16 : {
98429842 if ( flow . canOverflow ( expr , type ) ) {
98439843 expr = this . options . hasFeature ( Feature . SIGN_EXTENSION )
9844- ? module . unary ( UnaryOp . ExtendI16ToI32 , expr )
9844+ ? module . unary ( UnaryOp . Extend16I32 , expr )
98459845 : module . binary ( BinaryOp . ShrI32 ,
98469846 module . binary ( BinaryOp . ShlI32 ,
98479847 expr ,
@@ -10101,7 +10101,7 @@ export class Compiler extends DiagnosticEmitter {
1010110101 return module . binary ( BinaryOp . LeU32 ,
1010210102 module . binary ( BinaryOp . SubI32 ,
1010310103 module . binary ( BinaryOp . ShlI32 ,
10104- module . unary ( UnaryOp . ReinterpretF32 , expr ) ,
10104+ module . unary ( UnaryOp . ReinterpretF32ToI32 , expr ) ,
1010510105 module . i32 ( 1 )
1010610106 ) ,
1010710107 module . i32 ( 2 ) // 1 << 1
@@ -10118,7 +10118,7 @@ export class Compiler extends DiagnosticEmitter {
1011810118 return module . binary ( BinaryOp . LeU64 ,
1011910119 module . binary ( BinaryOp . SubI64 ,
1012010120 module . binary ( BinaryOp . ShlI64 ,
10121- module . unary ( UnaryOp . ReinterpretF64 , expr ) ,
10121+ module . unary ( UnaryOp . ReinterpretF64ToI64 , expr ) ,
1012210122 module . i64 ( 1 )
1012310123 ) ,
1012410124 module . i64 ( 2 ) // 1 << 1
0 commit comments