-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[draft][wasm] JSImport/JSExport prototype #64493
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsThis steals many ideas from #60765 and also from conversation with @kg Design
Open questions
TODO
|
This comment was marked as resolved.
This comment was marked as resolved.
6530adb
to
8999809
Compare
...vaScript/src/System/Runtime/InteropServices/JavaScript/Private/JavaScriptMarshalImpl.Bind.cs
Outdated
Show resolved
Hide resolved
...vaScript/src/System/Runtime/InteropServices/JavaScript/Private/JavaScriptMarshalImpl.ToCs.cs
Outdated
Show resolved
Hide resolved
...vaScript/src/System/Runtime/InteropServices/JavaScript/Private/JavaScriptMarshalImpl.ToJs.cs
Outdated
Show resolved
Hide resolved
...es.JavaScript/src/System/Runtime/InteropServices/JavaScript/Private/JavaScriptMarshalImpl.cs
Outdated
Show resolved
Hide resolved
...es.JavaScript/src/System/Runtime/InteropServices/JavaScript/Private/JavaScriptMarshalImpl.cs
Outdated
Show resolved
Hide resolved
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
...vaScript/src/System/Runtime/InteropServices/JavaScript/Private/JavaScriptMarshalImpl.ToJs.cs
Outdated
Show resolved
Hide resolved
...ces.JavaScript/tests/System/Runtime/InteropServices/JavaScript/GeneratedInvokeJsTest.part.cs
Outdated
Show resolved
Hide resolved
a57b4e8
to
2c9d0aa
Compare
...ntime.InteropServices.JavaScript/gen/MarshalerGenerator/JavaScript.MarshalerGenerator.csproj
Outdated
Show resolved
Hide resolved
...ntime.InteropServices.JavaScript/gen/MarshalerGenerator/JavaScript.MarshalerGenerator.csproj
Outdated
Show resolved
Hide resolved
...time.InteropServices.JavaScript/src/System.Private.Runtime.InteropServices.JavaScript.csproj
Outdated
Show resolved
Hide resolved
...eropServices.JavaScript/tests/System.Private.Runtime.InteropServices.JavaScript.Tests.csproj
Outdated
Show resolved
Hide resolved
...ate.Runtime.InteropServices.JavaScript/System.Private.Runtime.InteropServices.JavaScript.sln
Outdated
Show resolved
Hide resolved
src/libraries/System.Private.Runtime.InteropServices.JavaScript/gen/Directory.Build.props
Outdated
Show resolved
Hide resolved
...eropServices.JavaScript/tests/System.Private.Runtime.InteropServices.JavaScript.Tests.csproj
Outdated
Show resolved
Hide resolved
...ript/src/System/Runtime/InteropServices/JavaScript/Private/JavaScriptMarshalImpl.JsInvoke.cs
Outdated
Show resolved
Hide resolved
...eropServices.JavaScript/tests/System.Private.Runtime.InteropServices.JavaScript.Tests.csproj
Outdated
Show resolved
Hide resolved
@@ -0,0 +1,6 @@ | |||
<Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd put .Private to the end so you can use same prefix for namespace aswell
...ntime.InteropServices.JavaScript/gen/MarshalerGenerator/JavaScript.MarshalerGenerator.csproj
Show resolved
Hide resolved
...ystem.Private.Runtime.InteropServices.JavaScript/gen/MarshalerGenerator/JsImportGenerator.cs
Outdated
Show resolved
Hide resolved
...ystem.Private.Runtime.InteropServices.JavaScript/gen/MarshalerGenerator/JsImportGenerator.cs
Outdated
Show resolved
Hide resolved
...Script/src/System/Runtime/InteropServices/JavaScript/Private/JavaScriptMarshalImpl.CsBind.cs
Outdated
Show resolved
Hide resolved
...Script/src/System/Runtime/InteropServices/JavaScript/Private/JavaScriptMarshalImpl.JsBind.cs
Outdated
Show resolved
Hide resolved
...ipt/src/System/Runtime/InteropServices/JavaScript/Private/JavaScriptMarshalImpl.Signature.cs
Outdated
Show resolved
Hide resolved
...ipt/src/System/Runtime/InteropServices/JavaScript/Private/JavaScriptMarshalImpl.Signature.cs
Outdated
Show resolved
Hide resolved
...ipt/src/System/Runtime/InteropServices/JavaScript/Private/JavaScriptMarshalImpl.Signature.cs
Outdated
Show resolved
Hide resolved
...teropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Private/Marshalers.cs
Outdated
Show resolved
Hide resolved
4f6886c
to
aacf17f
Compare
…_invoke_js3 # Conflicts: # src/libraries/System.Private.Runtime.InteropServices.JavaScript/src/System/Runtime/InteropServices/JavaScript/Runtime.cs # src/mono/wasm/runtime/corebindings.ts # src/mono/wasm/runtime/cwraps.ts # src/mono/wasm/runtime/exports.ts # src/mono/wasm/runtime/method-binding.ts # src/mono/wasm/runtime/startup.ts # src/mono/wasm/runtime/types.ts
This pull request has been automatically marked |
This pull request will now be closed since it had been marked |
Design
This steals many ideas from #60765 and also from conversations with @kg
stackalloc
MonoObject*
to user javaScriptMonoString*
is still used for strings and exception Messagetypeof(T).TypeHandle
as method signature[TRes,T1,T2,T3, ...]
[res,t1,t2,t3, ...]
Out of scope
TODO
JavaScript.MarshalerGenerator
JSImport
JSExport
JSImport
JSExport
Vector3
MarshalUsing
attributeIJSObject
, set property, get propertyJSExport
/JSImport
attributesSystem.Runtime.InteropServices.JavaScript
- dropPrivate
ref
assemblySystem\Runtime\InteropServices\JavaScript\Public\**
Int32, Int64, Double
<=>Number
System.String
<=>string
System.Object
,JSObject
<=>ManagerObject
,object
System.Exception
,JSException
<=>Error
,ManagedError
DateTime
<=>Date
DateTimeOffset
<=>Date
Task
,ValueTask
<=>Promise
IntPtr
<=>VoidPtr
void*
,byte*
<=> ??? by ref or by value ?Span<byte>
<=> ???byte[]
<=> ???URI
<=>string
as custom marshaller onlyDelegate
<=>function
do we really need it ? It opens us to dispatch to dynamic C# signatures on runtime.System.Private.Runtime.InteropServices.JavaScript
implementationTypedArray
,Map
andHostObject
InFlight
cwrap
+ccall
+mono_runtime_invoke
inBindCSFunctionByName
with something fasterassert
, viaterser
pipelinemono_wasm_new_root_buffer
with pool+stack based allocatorBINDING.bind_static_method
->JSExport
.JSExport
, otherwise we are open to dynamic C# signatures on runtime.BrowserWebSocket
implementationwrapped_cs_functions
JSImport
JSExport
ccall
sWasm.BrowserProfile.Sample