@@ -27,7 +27,8 @@ import {
2727import {
2828 Type ,
2929 TypeKind ,
30- TypeFlags
30+ TypeFlags ,
31+ Signature
3132} from "./types" ;
3233
3334import {
@@ -3236,17 +3237,16 @@ export function compileCall(
32363237 }
32373238 let numOperands = operands . length - 1 ;
32383239 let operandExprs = new Array < ExpressionRef > ( numOperands ) ;
3239- let signatureParts = new Array < string > ( numOperands + 1 ) ;
32403240 let nativeReturnType = returnType . toNativeType ( ) ;
3241+ let parameterTypes = new Array < Type > ( numOperands ) ;
32413242 let nativeParamTypes = new Array < NativeType > ( numOperands ) ;
32423243 for ( let i = 0 ; i < numOperands ; ++ i ) {
32433244 operandExprs [ i ] = compiler . compileExpressionRetainType ( operands [ 1 + i ] , Type . i32 , WrapMode . NONE ) ;
32443245 let operandType = compiler . currentType ;
3245- signatureParts [ i ] = operandType . toSignatureString ( ) ;
3246+ parameterTypes [ i ] = operandType ;
32463247 nativeParamTypes [ i ] = operandType . toNativeType ( ) ;
32473248 }
3248- signatureParts [ numOperands ] = returnType . toSignatureString ( ) ;
3249- let typeName = signatureParts . join ( "" ) ;
3249+ let typeName = Signature . makeSignatureString ( parameterTypes , returnType ) ;
32503250 let typeRef = module . getFunctionTypeBySignature ( nativeReturnType , nativeParamTypes ) ;
32513251 if ( ! typeRef ) typeRef = module . addFunctionType ( typeName , nativeReturnType , nativeParamTypes ) ;
32523252 compiler . currentType = returnType ;
@@ -5952,7 +5952,7 @@ export function compileIterateRoots(compiler: Compiler): void {
59525952 ? module . createI64 ( i64_low ( value ) , i64_high ( value ) )
59535953 : module . createI32 ( i64_low ( value ) )
59545954 ] ,
5955- "i_ "
5955+ "FUNCSIG$vi "
59565956 )
59575957 ) ;
59585958 } else {
@@ -5965,7 +5965,7 @@ export function compileIterateRoots(compiler: Compiler): void {
59655965 compiler . options . nativeSizeType
59665966 )
59675967 ] ,
5968- "i_ "
5968+ "FUNCSIG$vi "
59695969 )
59705970 ) ;
59715971 }
@@ -6049,7 +6049,7 @@ export function ensureGCHook(
60496049 [
60506050 module . createGetLocal ( 0 , nativeSizeType )
60516051 ] ,
6052- nativeSizeType == NativeType . I64 ? "I_ " : "i_"
6052+ "FUNCSIG$" + ( nativeSizeType == NativeType . I64 ? "vj " : "vi" )
60536053 )
60546054 ) ;
60556055
0 commit comments