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
wasm-only memset #5245
Closed
Closed
wasm-only memset #5245
Changes from 4 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f98dc0a
support '-' prefixing of passes in BINARYEN_PASSES list, making it si…
kripken 6796808
pass WASM_ONLY into the js compiler, and use that to use i64 operatio…
kripken 47f7203
fix order of setting WASM_ONLY
kripken 1cdd9c4
memcpy too, and note the proper alignment
kripken 74a99fa
work with 8-byte aligned data in wasm-only memcpy/memset
kripken 7f03fac
work with 8-byte aligned data in wasm-only memcpy/memset
kripken a0c1965
fix order of use of WASM_ONLY in emcc.py
kripken 7b6d026
clarify which settings.js settings are internal use only
kripken 521179e
Merge branch 'incoming' into wasm-only-memset
kripken File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -823,8 +823,12 @@ LibraryManager.library = { | |
if ((num|0) >= | ||
#if SIMD | ||
196608 | ||
#else | ||
#if WASM_ONLY | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This pattern seems to come up a fair bit. Might be worth extending the preprocessor to handle something like
Wouldn't belong to this PR but might be worth doing. |
||
16384 | ||
#else | ||
8192 | ||
#endif | ||
#endif | ||
) { | ||
return _emscripten_memcpy_big(dest|0, src|0, num|0)|0; | ||
|
@@ -849,6 +853,16 @@ LibraryManager.library = { | |
SIMD_Int32x4_store(HEAPU8, dest+16, SIMD_Int32x4_load(HEAPU8, src+16)); | ||
SIMD_Int32x4_store(HEAPU8, dest+32, SIMD_Int32x4_load(HEAPU8, src+32)); | ||
SIMD_Int32x4_store(HEAPU8, dest+48, SIMD_Int32x4_load(HEAPU8, src+48)); | ||
#else | ||
#if WASM_ONLY | ||
store8(dest, load8(src, 4), 4); | ||
store8(dest + 8 | 0, load8(src + 8 | 0, 4), 4); | ||
store8(dest + 16 | 0, load8(src + 16 | 0, 4), 4); | ||
store8(dest + 24 | 0, load8(src + 24 | 0, 4), 4); | ||
store8(dest + 32 | 0, load8(src + 32 | 0, 4), 4); | ||
store8(dest + 40 | 0, load8(src + 40 | 0, 4), 4); | ||
store8(dest + 48 | 0, load8(src + 48 | 0, 4), 4); | ||
store8(dest + 56 | 0, load8(src + 56 | 0, 4), 4); | ||
#else | ||
{{{ makeSetValueAsm('dest', 0, makeGetValueAsm('src', 0, 'i32'), 'i32') }}}; | ||
{{{ makeSetValueAsm('dest', 4, makeGetValueAsm('src', 4, 'i32'), 'i32') }}}; | ||
|
@@ -866,6 +880,7 @@ LibraryManager.library = { | |
{{{ makeSetValueAsm('dest', 52, makeGetValueAsm('src', 52, 'i32'), 'i32') }}}; | ||
{{{ makeSetValueAsm('dest', 56, makeGetValueAsm('src', 56, 'i32'), 'i32') }}}; | ||
{{{ makeSetValueAsm('dest', 60, makeGetValueAsm('src', 60, 'i32'), 'i32') }}}; | ||
#endif | ||
#endif | ||
dest = (dest+64)|0; | ||
src = (src+64)|0; | ||
|
@@ -939,6 +954,10 @@ LibraryManager.library = { | |
var end = 0, aligned_end = 0, block_aligned_end = 0, value4 = 0; | ||
#if SIMD | ||
var value16 = SIMD_Int32x4(0,0,0,0); | ||
#else | ||
#if WASM_ONLY | ||
var value8 = i64(); | ||
#endif | ||
#endif | ||
end = (ptr + num)|0; | ||
|
||
|
@@ -954,6 +973,10 @@ LibraryManager.library = { | |
value4 = value | (value << 8) | (value << 16) | (value << 24); | ||
#if SIMD | ||
value16 = SIMD_Int32x4_splat(value4); | ||
#else | ||
#if WASM_ONLY | ||
value8 = i64_or(i64_zext(value4), i64_shl(i64_zext(value4), i64(32))); | ||
#endif | ||
#endif | ||
|
||
while((ptr|0) <= (block_aligned_end|0)) { | ||
|
@@ -962,6 +985,16 @@ LibraryManager.library = { | |
SIMD_Int32x4_store(HEAPU8, ptr+16, value16); | ||
SIMD_Int32x4_store(HEAPU8, ptr+32, value16); | ||
SIMD_Int32x4_store(HEAPU8, ptr+48, value16); | ||
#else | ||
#if WASM_ONLY | ||
store8(ptr , value8, 4); | ||
store8(ptr + 8 | 0, value8, 4); | ||
store8(ptr + 16 | 0, value8, 4); | ||
store8(ptr + 24 | 0, value8, 4); | ||
store8(ptr + 32 | 0, value8, 4); | ||
store8(ptr + 40 | 0, value8, 4); | ||
store8(ptr + 48 | 0, value8, 4); | ||
store8(ptr + 56 | 0, value8, 4); | ||
#else | ||
{{{ makeSetValueAsm('ptr', 0, 'value4', 'i32') }}}; | ||
{{{ makeSetValueAsm('ptr', 4, 'value4', 'i32') }}}; | ||
|
@@ -979,6 +1012,7 @@ LibraryManager.library = { | |
{{{ makeSetValueAsm('ptr', 52, 'value4', 'i32') }}}; | ||
{{{ makeSetValueAsm('ptr', 56, 'value4', 'i32') }}}; | ||
{{{ makeSetValueAsm('ptr', 60, 'value4', 'i32') }}}; | ||
#endif | ||
#endif | ||
ptr = (ptr + 64)|0; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Wait, so we add a
WASM_ONLY
flag that we assert gets set when we unsetLEGALIZE_JS_FFI
, but then we clobber it with our autodetectedshared.Building.is_wasm_only()
regardless?We've promoted
WASM_ONLY
to a Setting so it's available to the js compiler, not because it's something users should be setting. Because of that I think we should move this to before the assert, and just always have it autodetected. Maybe add a note to settings.js, saying we ignore this if you try to set it.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.
emcc.py order was a little wrong, thanks, fixed.
And clarified in settings.js what is internal use only.