@@ -67,8 +67,12 @@ public func _bjs_release_swift_closure(_ pointer: UnsafeMutableRawPointer) {
6767
6868#if arch(wasm32)
6969@_extern ( wasm, module: " bjs " , name: " swift_js_closure_unregister " )
70- internal func _swift_js_closure_unregister ( _ id: Int32 )
70+ private func _swift_js_closure_unregister_extern ( _ id: Int32 )
7171#else
72+ private func _swift_js_closure_unregister_extern( _ id: Int32 ) {
73+ _onlyAvailableOnWasm ( )
74+ }
75+ #endif
7276/// Unregisters a Swift closure from the FinalizationRegistry
7377///
7478/// - Parameter id: The JavaScriptObjectRef of the JS closure object created by
@@ -82,10 +86,9 @@ internal func _swift_js_closure_unregister(_ id: Int32)
8286/// This means that the finalization callback should be tolerant of the
8387/// object being already collected.
8488/// See: https://tc39.es/ecma262/multipage/managing-memory.html#sec-finalization-registry.prototype.unregister
85- internal func _swift_js_closure_unregister( _ id: Int32 ) {
86- _onlyAvailableOnWasm ( )
89+ @ inline ( never ) internal func _swift_js_closure_unregister( _ id: Int32 ) {
90+ _swift_js_closure_unregister_extern ( id )
8791}
88- #endif
8992
9093// MARK: Type lowering/lifting
9194//
@@ -823,186 +826,243 @@ private func _swift_js_pop_f64_extern() -> Float64 {
823826
824827#if arch(wasm32)
825828@_extern ( wasm, module: " bjs " , name: " swift_js_make_js_string " )
826- func _swift_js_make_js_string ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) -> Int32
829+ private func _swift_js_make_js_string_extern ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) -> Int32
827830#else
828831/// Creates a JavaScript string from UTF-8 data in WebAssembly memory
829- func _swift_js_make_js_string ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) -> Int32 {
832+ private func _swift_js_make_js_string_extern ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) -> Int32 {
830833 _onlyAvailableOnWasm ( )
831834}
832835#endif
836+ @inline ( never) func _swift_js_make_js_string( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) -> Int32 {
837+ _swift_js_make_js_string_extern ( ptr, len)
838+ }
833839
834840#if arch(wasm32)
835841@_extern ( wasm, module: " bjs " , name: " swift_js_init_memory_with_result " )
836- func _swift_js_init_memory_with_result ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 )
842+ private func _swift_js_init_memory_with_result_extern ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 )
837843#else
838844/// Initializes WebAssembly memory with result data of JavaScript function call
839- func _swift_js_init_memory_with_result ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) {
845+ private func _swift_js_init_memory_with_result_extern ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) {
840846 _onlyAvailableOnWasm ( )
841847}
842848#endif
849+ @inline ( never) func _swift_js_init_memory_with_result( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) {
850+ _swift_js_init_memory_with_result_extern ( ptr, len)
851+ }
843852
844853#if arch(wasm32)
845854@_extern ( wasm, module: " bjs " , name: " swift_js_return_string " )
846- func _swift_js_return_string ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 )
855+ private func _swift_js_return_string_extern ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 )
847856#else
848857/// Write a string to reserved string storage to be returned to JavaScript
849- func _swift_js_return_string ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) {
858+ private func _swift_js_return_string_extern ( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) {
850859 _onlyAvailableOnWasm ( )
851860}
852861#endif
862+ @inline ( never) func _swift_js_return_string( _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) {
863+ _swift_js_return_string_extern ( ptr, len)
864+ }
853865
854866#if arch(wasm32)
855867@_extern ( wasm, module: " bjs " , name: " swift_js_retain " )
856- func _swift_js_retain ( _ id: Int32 ) -> Int32
868+ private func _swift_js_retain_extern ( _ id: Int32 ) -> Int32
857869#else
858870/// Retains a JavaScript object reference to ensure the object id
859871/// remains valid after the function returns
860- func _swift_js_retain ( _ id: Int32 ) -> Int32 {
872+ private func _swift_js_retain_extern ( _ id: Int32 ) -> Int32 {
861873 _onlyAvailableOnWasm ( )
862874}
863875#endif
876+ @inline ( never) func _swift_js_retain( _ id: Int32 ) -> Int32 {
877+ _swift_js_retain_extern ( id)
878+ }
864879
865880#if arch(wasm32)
866881@_extern ( wasm, module: " bjs " , name: " swift_js_return_optional_bool " )
867- func _swift_js_return_optional_bool ( _ isSome: Int32 , _ value: Int32 )
882+ private func _swift_js_return_optional_bool_extern ( _ isSome: Int32 , _ value: Int32 )
868883#else
869884/// Sets the optional bool for return value storage
870- func _swift_js_return_optional_bool ( _ isSome: Int32 , _ value: Int32 ) {
885+ private func _swift_js_return_optional_bool_extern ( _ isSome: Int32 , _ value: Int32 ) {
871886 _onlyAvailableOnWasm ( )
872887}
873888#endif
889+ @inline ( never) func _swift_js_return_optional_bool( _ isSome: Int32 , _ value: Int32 ) {
890+ _swift_js_return_optional_bool_extern ( isSome, value)
891+ }
874892
875893#if arch(wasm32)
876894@_extern ( wasm, module: " bjs " , name: " swift_js_get_optional_int_presence " )
877- func _swift_js_get_optional_int_presence ( ) -> Int32
895+ private func _swift_js_get_optional_int_presence_extern ( ) -> Int32
878896#else
879- func _swift_js_get_optional_int_presence ( ) -> Int32 {
897+ private func _swift_js_get_optional_int_presence_extern ( ) -> Int32 {
880898 _onlyAvailableOnWasm ( )
881899}
882900#endif
901+ @inline ( never) func _swift_js_get_optional_int_presence( ) -> Int32 {
902+ _swift_js_get_optional_int_presence_extern ( )
903+ }
883904
884905#if arch(wasm32)
885906@_extern ( wasm, module: " bjs " , name: " swift_js_get_optional_int_value " )
886- func _swift_js_get_optional_int_value ( ) -> Int32
907+ private func _swift_js_get_optional_int_value_extern ( ) -> Int32
887908#else
888- func _swift_js_get_optional_int_value ( ) -> Int32 {
909+ private func _swift_js_get_optional_int_value_extern ( ) -> Int32 {
889910 _onlyAvailableOnWasm ( )
890911}
891912#endif
913+ @inline ( never) func _swift_js_get_optional_int_value( ) -> Int32 {
914+ _swift_js_get_optional_int_value_extern ( )
915+ }
892916
893917#if arch(wasm32)
894918@_extern ( wasm, module: " bjs " , name: " swift_js_return_optional_int " )
895- func _swift_js_return_optional_int ( _ isSome: Int32 , _ value: Int32 )
919+ private func _swift_js_return_optional_int_extern ( _ isSome: Int32 , _ value: Int32 )
896920#else
897921/// Sets the optional int for return value storage
898- func _swift_js_return_optional_int ( _ isSome: Int32 , _ value: Int32 ) {
922+ private func _swift_js_return_optional_int_extern ( _ isSome: Int32 , _ value: Int32 ) {
899923 _onlyAvailableOnWasm ( )
900924}
901925#endif
926+ @inline ( never) func _swift_js_return_optional_int( _ isSome: Int32 , _ value: Int32 ) {
927+ _swift_js_return_optional_int_extern ( isSome, value)
928+ }
902929
903930#if arch(wasm32)
904931@_extern ( wasm, module: " bjs " , name: " swift_js_get_optional_string " )
905- func _swift_js_get_optional_string ( ) -> Int32
932+ private func _swift_js_get_optional_string_extern ( ) -> Int32
906933#else
907- func _swift_js_get_optional_string ( ) -> Int32 {
934+ private func _swift_js_get_optional_string_extern ( ) -> Int32 {
908935 _onlyAvailableOnWasm ( )
909936}
910937#endif
938+ @inline ( never) func _swift_js_get_optional_string( ) -> Int32 {
939+ _swift_js_get_optional_string_extern ( )
940+ }
911941
912942#if arch(wasm32)
913943@_extern ( wasm, module: " bjs " , name: " swift_js_return_optional_string " )
914- func _swift_js_return_optional_string ( _ isSome: Int32 , _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 )
944+ private func _swift_js_return_optional_string_extern ( _ isSome: Int32 , _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 )
915945#else
916946/// Write an optional string to reserved string storage to be returned to JavaScript
917- func _swift_js_return_optional_string ( _ isSome: Int32 , _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) {
947+ private func _swift_js_return_optional_string_extern ( _ isSome: Int32 , _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) {
918948 _onlyAvailableOnWasm ( )
919949}
920950#endif
951+ @inline ( never) func _swift_js_return_optional_string( _ isSome: Int32 , _ ptr: UnsafePointer < UInt8 > ? , _ len: Int32 ) {
952+ _swift_js_return_optional_string_extern ( isSome, ptr, len)
953+ }
921954
922955#if arch(wasm32)
923956@_extern ( wasm, module: " bjs " , name: " swift_js_return_optional_object " )
924- func _swift_js_return_optional_object ( _ isSome: Int32 , _ objectId: Int32 )
957+ private func _swift_js_return_optional_object_extern ( _ isSome: Int32 , _ objectId: Int32 )
925958#else
926959/// Write an optional JSObject to reserved storage to be returned to JavaScript
927- func _swift_js_return_optional_object ( _ isSome: Int32 , _ objectId: Int32 ) {
960+ private func _swift_js_return_optional_object_extern ( _ isSome: Int32 , _ objectId: Int32 ) {
928961 _onlyAvailableOnWasm ( )
929962}
930963#endif
964+ @inline ( never) func _swift_js_return_optional_object( _ isSome: Int32 , _ objectId: Int32 ) {
965+ _swift_js_return_optional_object_extern ( isSome, objectId)
966+ }
931967
932968#if arch(wasm32)
933969@_extern ( wasm, module: " bjs " , name: " swift_js_get_optional_heap_object_pointer " )
934- func _swift_js_get_optional_heap_object_pointer ( ) -> UnsafeMutableRawPointer
970+ private func _swift_js_get_optional_heap_object_pointer_extern ( ) -> UnsafeMutableRawPointer
935971#else
936- func _swift_js_get_optional_heap_object_pointer ( ) -> UnsafeMutableRawPointer {
972+ private func _swift_js_get_optional_heap_object_pointer_extern ( ) -> UnsafeMutableRawPointer {
937973 _onlyAvailableOnWasm ( )
938974}
939975#endif
976+ @inline ( never) func _swift_js_get_optional_heap_object_pointer( ) -> UnsafeMutableRawPointer {
977+ _swift_js_get_optional_heap_object_pointer_extern ( )
978+ }
940979
941980#if arch(wasm32)
942981@_extern ( wasm, module: " bjs " , name: " swift_js_return_optional_heap_object " )
943- func _swift_js_return_optional_heap_object ( _ isSome: Int32 , _ pointer: UnsafeMutableRawPointer ? )
982+ private func _swift_js_return_optional_heap_object_extern ( _ isSome: Int32 , _ pointer: UnsafeMutableRawPointer ? )
944983#else
945984/// Write an optional Swift heap object to reserved storage to be returned to JavaScript
946- func _swift_js_return_optional_heap_object ( _ isSome: Int32 , _ pointer: UnsafeMutableRawPointer ? ) {
985+ private func _swift_js_return_optional_heap_object_extern ( _ isSome: Int32 , _ pointer: UnsafeMutableRawPointer ? ) {
947986 _onlyAvailableOnWasm ( )
948987}
949988#endif
989+ @inline ( never) func _swift_js_return_optional_heap_object( _ isSome: Int32 , _ pointer: UnsafeMutableRawPointer ? ) {
990+ _swift_js_return_optional_heap_object_extern ( isSome, pointer)
991+ }
950992
951993#if arch(wasm32)
952994@_extern ( wasm, module: " bjs " , name: " swift_js_get_optional_float_presence " )
953- func _swift_js_get_optional_float_presence ( ) -> Int32
995+ private func _swift_js_get_optional_float_presence_extern ( ) -> Int32
954996#else
955- func _swift_js_get_optional_float_presence ( ) -> Int32 {
997+ private func _swift_js_get_optional_float_presence_extern ( ) -> Int32 {
956998 _onlyAvailableOnWasm ( )
957999}
9581000#endif
1001+ @inline ( never) func _swift_js_get_optional_float_presence( ) -> Int32 {
1002+ _swift_js_get_optional_float_presence_extern ( )
1003+ }
9591004
9601005#if arch(wasm32)
9611006@_extern ( wasm, module: " bjs " , name: " swift_js_get_optional_float_value " )
962- func _swift_js_get_optional_float_value ( ) -> Float32
1007+ private func _swift_js_get_optional_float_value_extern ( ) -> Float32
9631008#else
964- func _swift_js_get_optional_float_value ( ) -> Float32 {
1009+ private func _swift_js_get_optional_float_value_extern ( ) -> Float32 {
9651010 _onlyAvailableOnWasm ( )
9661011}
9671012#endif
1013+ @inline ( never) func _swift_js_get_optional_float_value( ) -> Float32 {
1014+ _swift_js_get_optional_float_value_extern ( )
1015+ }
9681016
9691017#if arch(wasm32)
9701018@_extern ( wasm, module: " bjs " , name: " swift_js_return_optional_float " )
971- func _swift_js_return_optional_float ( _ isSome: Int32 , _ value: Float32 )
1019+ private func _swift_js_return_optional_float_extern ( _ isSome: Int32 , _ value: Float32 )
9721020#else
9731021/// Sets the optional float for return value storage
974- func _swift_js_return_optional_float ( _ isSome: Int32 , _ value: Float32 ) {
1022+ private func _swift_js_return_optional_float_extern ( _ isSome: Int32 , _ value: Float32 ) {
9751023 _onlyAvailableOnWasm ( )
9761024}
9771025#endif
1026+ @inline ( never) func _swift_js_return_optional_float( _ isSome: Int32 , _ value: Float32 ) {
1027+ _swift_js_return_optional_float_extern ( isSome, value)
1028+ }
9781029
9791030#if arch(wasm32)
9801031@_extern ( wasm, module: " bjs " , name: " swift_js_get_optional_double_presence " )
981- func _swift_js_get_optional_double_presence ( ) -> Int32
1032+ private func _swift_js_get_optional_double_presence_extern ( ) -> Int32
9821033#else
983- func _swift_js_get_optional_double_presence ( ) -> Int32 {
1034+ private func _swift_js_get_optional_double_presence_extern ( ) -> Int32 {
9841035 _onlyAvailableOnWasm ( )
9851036}
9861037#endif
1038+ @inline ( never) func _swift_js_get_optional_double_presence( ) -> Int32 {
1039+ _swift_js_get_optional_double_presence_extern ( )
1040+ }
9871041
9881042#if arch(wasm32)
9891043@_extern ( wasm, module: " bjs " , name: " swift_js_get_optional_double_value " )
990- func _swift_js_get_optional_double_value ( ) -> Float64
1044+ private func _swift_js_get_optional_double_value_extern ( ) -> Float64
9911045#else
992- func _swift_js_get_optional_double_value ( ) -> Float64 {
1046+ private func _swift_js_get_optional_double_value_extern ( ) -> Float64 {
9931047 _onlyAvailableOnWasm ( )
9941048}
9951049#endif
1050+ @inline ( never) func _swift_js_get_optional_double_value( ) -> Float64 {
1051+ _swift_js_get_optional_double_value_extern ( )
1052+ }
9961053
9971054#if arch(wasm32)
9981055@_extern ( wasm, module: " bjs " , name: " swift_js_return_optional_double " )
999- func _swift_js_return_optional_double ( _ isSome: Int32 , _ value: Float64 )
1056+ private func _swift_js_return_optional_double_extern ( _ isSome: Int32 , _ value: Float64 )
10001057#else
10011058/// Sets the optional double for return value storage
1002- func _swift_js_return_optional_double ( _ isSome: Int32 , _ value: Float64 ) {
1059+ private func _swift_js_return_optional_double_extern ( _ isSome: Int32 , _ value: Float64 ) {
10031060 _onlyAvailableOnWasm ( )
10041061}
10051062#endif
1063+ @inline ( never) func _swift_js_return_optional_double( _ isSome: Int32 , _ value: Float64 ) {
1064+ _swift_js_return_optional_double_extern ( isSome, value)
1065+ }
10061066
10071067#if arch(wasm32)
10081068@_extern ( wasm, module: " bjs " , name: " swift_js_push_pointer " )
0 commit comments