Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

@pavelsavara
Copy link
Member

@pavelsavara pavelsavara commented Feb 5, 2022

  • capture updateGlobalBufferAndViews
  • remove setI64, getI64
  • add setI52, getI52, getU52, setU52
  • add getI64Big, setI64Big
  • change bind_static_method to use int52 with l signature.
  • inlined JS asserts
  • fixed existing binding for unsigned types
  • implemented range validations for all memory access and interop

@ghost
Copy link

ghost commented Feb 5, 2022

Tagging subscribers to 'arch-wasm': @lewing
See info in area-owners.md if you want to be subscribed.

Issue Details
  • capture updateGlobalBufferAndViews
  • improve setI64, getI64
  • add getI64Big, setI64Big
  • fix StringDecoder root and hashtable access
Author: pavelsavara
Assignees: -
Labels:

arch-wasm, area-System.Runtime.InteropServices.JavaScript

Milestone: 7.0.0

@ghost ghost assigned pavelsavara Feb 5, 2022
@pavelsavara pavelsavara requested review from kg and lewing February 5, 2022 11:38
@pavelsavara
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

src/mono/wasm/runtime/exports.ts Outdated Show resolved Hide resolved
src/mono/wasm/runtime/memory.ts Outdated Show resolved Hide resolved
@pavelsavara
Copy link
Member Author

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

src/mono/wasm/runtime/memory.ts Outdated Show resolved Hide resolved
@lewing
Copy link
Member

lewing commented Mar 25, 2022

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

src/mono/wasm/runtime/memory.ts Outdated Show resolved Hide resolved
@pavelsavara pavelsavara marked this pull request as draft March 31, 2022 17:10
@ghost ghost added the no-recent-activity label Apr 15, 2022
@ghost
Copy link

ghost commented Apr 15, 2022

This pull request has been automatically marked no-recent-activity because it has not had any activity for 14 days. It will be closed if no further activity occurs within 14 more days. Any new comment (by anyone, not necessarily the author) will remove no-recent-activity.

@ghost
Copy link

ghost commented Apr 30, 2022

This pull request will now be closed since it had been marked no-recent-activity but received no further activity in the past 14 days. It is still possible to reopen or comment on the pull request, but please note that it will be locked if it remains inactive for another 30 days.

* removed support for long form automatic marshaler. It has impact to mono_bind_static_method
@pavelsavara pavelsavara force-pushed the wasm_resize_and_int64 branch from 4238f0a to d119e50 Compare May 13, 2022 21:30
@kg
Copy link
Member

kg commented May 13, 2022

Big fan of the I52 / I64Big split, good idea

@pavelsavara
Copy link
Member Author

pavelsavara commented May 13, 2022

I implemented feedback from @kg about availability of BigInt and speed of BigInt allocation vs arithmetic.

I also had discussion with @lambdageek about 52 integral bits of Number vs Int64.
There are use-cases where 52 bits are useful, for example for Date.value.

We concluded that emscripten's silent usage of only lower 32 bit is bad.

I also realized that silent usage of lower 52bits could be similarly bad.
So I removed support for marshaling long signature form bind_static_method, which did silent 32bits till now.

This is breaking change, but failing fast should be better than silent data corruption on runtime.

@pavelsavara
Copy link
Member Author

pavelsavara commented May 19, 2022

I realized that all the other setXXX are also silently trimming bits and not throwing on overflow.
It's like option C) above.
Should I introduce range check to all of them ?

Or remove the range check from Int52 ?
C1) Store it as the memory bits were double ?
C2) Mask any exponent bits and store it as is ?
F) round it to next int, convert NaN to 0, Number.POSITIVE_INFINITY to long.MaxValue ?

@pavelsavara
Copy link
Member Author

This looks great, but we should make sure the C# -> JS path handles longs correctly (I think we just need to update the unbox primitive stuff to intentionally work in terms of I52 and throw an exception when unboxing if the long is too large)

I think we never had Number -> long conversion on mono_bind_static_method. I added test for it.

@pavelsavara pavelsavara changed the title [wasm] improve I64 memory access [wasm] improve memory access and marshaling range checks May 19, 2022
- implemented range check on all set memory operations
- implemented also uint52
- differentiated bool marshaling because it shoud have different validation and message
@pavelsavara
Copy link
Member Author

Should I introduce range check to all of them ?

We agreed with @kg to range-check them all.
That forced me to fix broken marshaling of unsigned types and bool.
I also implemented uint52.
And I implemented assert inlining, to make sure it doesn't allocate closure.

@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines failed to run 1 pipeline(s).

@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@pavelsavara pavelsavara requested a review from kg May 19, 2022 19:18
src/mono/wasm/runtime/rollup.config.js Outdated Show resolved Hide resolved
@pavelsavara pavelsavara requested a review from kg May 20, 2022 09:02
src/mono/wasm/runtime/memory.ts Show resolved Hide resolved
src/mono/wasm/runtime/memory.ts Show resolved Hide resolved
src/mono/wasm/runtime/rollup.config.js Show resolved Hide resolved
src/mono/wasm/runtime/rollup.config.js Show resolved Hide resolved
@kg kg merged commit e7886b2 into dotnet:main May 20, 2022
@pavelsavara
Copy link
Member Author

/azp run runtime-wasm

@ghost ghost locked as resolved and limited conversation to collaborators Jun 22, 2022
@pavelsavara pavelsavara deleted the wasm_resize_and_int64 branch July 14, 2022 20:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.