-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Big Endian Support (using extra acorn AST pass) #13413
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
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
7468b03
Big Endian Support (using extra acorn AST pass)
35f541e
Added to AUTHORS
3b9fb2d
Added command line option
1f1194d
Style
V-for-Vasili e032595
Typo
V-for-Vasili 5576c7e
Minimal runtime code test fix
V-for-Vasili 5997479
Rename LE_HEAP option
V-for-Vasili c67b719
Guard all accesses to HEAP_DATA_VIEW with macros
V-for-Vasili 0969f0b
File and variable naming
V-for-Vasili 2ac1f0d
Break up LE_HEAP_STORE & LE_HEAP_LOAD functions
V-for-Vasili 17590e3
Revert unneeded test declaration
V-for-Vasili a099773
Proper library structure for library_little_endian_heap.js
V-for-Vasili 841e180
Added tests
V-for-Vasili af048c0
Merge branch 'master' into BE-port
V-for-Vasili 13a3741
Improve endianness check
V-for-Vasili 39184d4
Merge branch 'main' into BE-port
kripken File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -550,4 +550,5 @@ a license to everyone to use it as detailed in LICENSE.) | |
* Camil Staps <[email protected]> | ||
* Michael Kircher <[email protected]> | ||
* Sharad Saxena <[email protected]> (copyright owned by Autodesk, Inc.) | ||
* Vasili Skurydzin <[email protected]> | ||
* Jakub Nowakowski <[email protected]> |
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
var LibraryLittleEndianHeap = { | ||
$LE_HEAP_STORE_U16: function(byteOffset, value) { | ||
HEAP_DATA_VIEW.setUint16(byteOffset, value, true); | ||
}, | ||
|
||
$LE_HEAP_STORE_I16: function(byteOffset, value) { | ||
HEAP_DATA_VIEW.setInt16(byteOffset, value, true); | ||
}, | ||
|
||
$LE_HEAP_STORE_U32: function(byteOffset, value) { | ||
HEAP_DATA_VIEW.setUint32(byteOffset, value, true); | ||
}, | ||
|
||
$LE_HEAP_STORE_I32: function(byteOffset, value) { | ||
HEAP_DATA_VIEW.setInt32(byteOffset, value, true); | ||
}, | ||
|
||
$LE_HEAP_STORE_F32: function(byteOffset, value) { | ||
HEAP_DATA_VIEW.setFloat32(byteOffset, value, true); | ||
}, | ||
|
||
$LE_HEAP_STORE_F64: function(byteOffset, value) { | ||
HEAP_DATA_VIEW.setFloat64(byteOffset, value, true); | ||
}, | ||
|
||
$LE_HEAP_LOAD_U16: function(byteOffset) { | ||
return HEAP_DATA_VIEW.getUint16(byteOffset, true); | ||
}, | ||
|
||
$LE_HEAP_LOAD_I16: function(byteOffset) { | ||
return HEAP_DATA_VIEW.getInt16(byteOffset, true); | ||
}, | ||
|
||
$LE_HEAP_LOAD_U32: function(byteOffset) { | ||
return HEAP_DATA_VIEW.getUint32(byteOffset, true); | ||
}, | ||
|
||
$LE_HEAP_LOAD_I32: function(byteOffset) { | ||
return HEAP_DATA_VIEW.getInt32(byteOffset, true); | ||
}, | ||
|
||
$LE_HEAP_LOAD_F32: function(byteOffset) { | ||
return HEAP_DATA_VIEW.getFloat32(byteOffset, true); | ||
}, | ||
|
||
$LE_HEAP_LOAD_F64: function(byteOffset) { | ||
return HEAP_DATA_VIEW.getFloat64(byteOffset, true); | ||
} | ||
} | ||
|
||
mergeInto(LibraryManager.library, LibraryLittleEndianHeap); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
a = HEAP8[x]; | ||
HEAP8[x] = a; | ||
a = HEAPU8[x]; | ||
HEAPU8[x] = a; | ||
a = LE_HEAP_LOAD_I16(x * 2); | ||
LE_HEAP_STORE_I16(x * 2, a); | ||
a = LE_HEAP_LOAD_U16(x * 2); | ||
LE_HEAP_STORE_U16(x * 2, a); | ||
a = LE_HEAP_LOAD_I32(x * 4); | ||
LE_HEAP_STORE_I32(x * 4, a); | ||
a = LE_HEAP_LOAD_U32(x * 4); | ||
LE_HEAP_STORE_U32(x * 4, a); | ||
a = LE_HEAP_LOAD_F32(x * 4); | ||
LE_HEAP_STORE_F32(x * 4, a); | ||
a = LE_HEAP_LOAD_F64(x * 8); | ||
LE_HEAP_STORE_F64(x * 8, a); | ||
HEAP[x]; | ||
HeAp[x]; |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
a = HEAP8[x]; // HEAP8 | ||
HEAP8[x] = a; | ||
a = HEAPU8[x]; // HEAPU8 | ||
HEAPU8[x] = a; | ||
a = HEAP16[x]; // HEAP16 | ||
HEAP16[x] = a; | ||
a = HEAPU16[x]; // HEAPU16 | ||
HEAPU16[x] = a; | ||
a = HEAP32[x]; // HEAPI32 | ||
HEAP32[x] = a; | ||
a = HEAPU32[x]; // HEAPU32 | ||
HEAPU32[x] = a; | ||
a = HEAPF32[x]; // HEAPF32 | ||
HEAPF32[x] = a; | ||
a = HEAPF64[x]; // HEAPF64 | ||
HEAPF64[x] = a; | ||
HEAP[x]; // should not be changed | ||
HeAp[x]; |
This file contains hidden or 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 hidden or 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 hidden or 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.
Nice work overall!
Instead of doing the multiplies here, I would recommend placing the multiplies inside the
LE_HEAP_LOAD_
andLE_HEAP_STORE_
functions for a nice code size win. (only one multiply per function versus once for each call) - unless there is some reason they need to be here?