@@ -772,13 +772,6 @@ var LibraryEmbind = {
772
772
#if ASSERTIONS && ASYNCIFY != 2
773
773
assert ( ! isAsync , 'Async bindings are only supported with JSPI.' ) ;
774
774
#endif
775
-
776
- #if ASYNCIFY == 2
777
- if ( isAsync ) {
778
- cppInvokerFunc = Asyncify . makeAsyncFunction ( cppInvokerFunc ) ;
779
- }
780
- #endif
781
-
782
775
var isClassMethodFunc = ( argTypes [ 1 ] !== null && classType !== null ) ;
783
776
784
777
// Free functions with signature "void function()" do not need an invoker that marshalls between wire types.
@@ -894,11 +887,15 @@ var LibraryEmbind = {
894
887
} ,
895
888
896
889
$embind__requireFunction__deps : [ '$readLatin1String' , '$throwBindingError'
897
- #if DYNCALLS || ! WASM_BIGINT || MEMORY64
890
+ #if DYNCALLS || ! WASM_BIGINT || MEMORY64 || CAN_ADDRESS_2GB
898
891
, '$getDynCaller'
899
892
#endif
900
893
] ,
901
- $embind__requireFunction : ( signature , rawFunction ) = > {
894
+ $embind__requireFunction : ( signature , rawFunction , isAsync = false ) = > {
895
+ #if ASSERTIONS && ASYNCIFY != 2
896
+ assert ( ! isAsync , 'Async bindings are only supported with JSPI.' ) ;
897
+ #endif
898
+
902
899
signature = readLatin1String ( signature ) ;
903
900
904
901
function makeDynCaller ( ) {
@@ -912,10 +909,16 @@ var LibraryEmbind = {
912
909
#endif
913
910
#if MEMORY64 || CAN_ADDRESS_2GB
914
911
if ( signature . includes ( 'p' ) ) {
915
- return getDynCaller ( signature , rawFunction ) ;
912
+ return getDynCaller ( signature , rawFunction , isAsync ) ;
913
+ }
914
+ #endif
915
+ var rtn = getWasmTableEntry ( rawFunction ) ;
916
+ #if JSPI
917
+ if ( isAsync ) {
918
+ rtn = WebAssembly . promising ( rtn ) ;
916
919
}
917
920
#endif
918
- return getWasmTableEntry ( rawFunction ) ;
921
+ return rtn ;
919
922
#endif
920
923
}
921
924
@@ -935,7 +938,7 @@ var LibraryEmbind = {
935
938
name = readLatin1String ( name ) ;
936
939
name = getFunctionName ( name ) ;
937
940
938
- rawInvoker = embind__requireFunction ( signature , rawInvoker ) ;
941
+ rawInvoker = embind__requireFunction ( signature , rawInvoker , isAsync ) ;
939
942
940
943
exposePublicSymbol ( name , function ( ) {
941
944
throwUnboundTypeError ( `Cannot call ${ name } due to unbound types` , argTypes ) ;
@@ -1938,7 +1941,7 @@ var LibraryEmbind = {
1938
1941
var rawArgTypes = heap32VectorToArray ( argCount , rawArgTypesAddr ) ;
1939
1942
methodName = readLatin1String ( methodName ) ;
1940
1943
methodName = getFunctionName ( methodName ) ;
1941
- rawInvoker = embind__requireFunction ( invokerSignature , rawInvoker ) ;
1944
+ rawInvoker = embind__requireFunction ( invokerSignature , rawInvoker , isAsync ) ;
1942
1945
1943
1946
whenDependentTypesAreResolved ( [ ] , [ rawClassType ] , ( classType ) => {
1944
1947
classType = classType [ 0 ] ;
@@ -2075,7 +2078,7 @@ var LibraryEmbind = {
2075
2078
var rawArgTypes = heap32VectorToArray ( argCount , rawArgTypesAddr ) ;
2076
2079
methodName = readLatin1String ( methodName ) ;
2077
2080
methodName = getFunctionName ( methodName ) ;
2078
- rawInvoker = embind__requireFunction ( invokerSignature , rawInvoker ) ;
2081
+ rawInvoker = embind__requireFunction ( invokerSignature , rawInvoker , isAsync ) ;
2079
2082
whenDependentTypesAreResolved ( [ ] , [ rawClassType ] , ( classType ) => {
2080
2083
classType = classType [ 0 ] ;
2081
2084
var humanName = `${ classType . name } .${ methodName } ` ;
0 commit comments