Skip to content

Commit 79da9f9

Browse files
authored
Remove makeStaticAlloc/String (#12174)
We no longer need or allow static allocations from JS. See WebAssembly/binaryen#3043
1 parent 81544d9 commit 79da9f9

File tree

3 files changed

+0
-41
lines changed

3 files changed

+0
-41
lines changed

src/library.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
// object. For convenience, the short name appears here. Note that if you add a
2121
// new function with an '_', it will not be found.
2222

23-
// Memory allocated during startup, in postsets, should only be static
24-
// (using makeStaticAlloc)
25-
2623
LibraryManager.library = {
2724
// ==========================================================================
2825
// getTempRet0/setTempRet0: scratch space handling i64 return

src/parseTools.js

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,19 +1481,6 @@ function makeEval(code) {
14811481
return ret;
14821482
}
14831483

1484-
function makeStaticAlloc(size) {
1485-
size = alignMemory(size);
1486-
var ret = alignMemory(GLOBAL_BASE + STATIC_BUMP);
1487-
STATIC_BUMP = ret + size - GLOBAL_BASE;
1488-
return ret;
1489-
}
1490-
1491-
function makeStaticString(string) {
1492-
var len = lengthBytesUTF8(string) + 1;
1493-
var ptr = makeStaticAlloc(len);
1494-
return '(stringToUTF8("' + string + '", ' + ptr + ', ' + len + '), ' + ptr + ')';
1495-
}
1496-
14971484
var ATINITS = [];
14981485

14991486
function addAtInit(code) {

tests/test_core.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4190,31 +4190,6 @@ def test_dylink_jslib(self):
41904190
}
41914191
''', expected='other says 45.2', main_emcc_args=['--js-library', 'lib.js'])
41924192

4193-
@needs_dlfcn
4194-
def test_dylink_global_var_jslib(self):
4195-
create_test_file('lib.js', r'''
4196-
mergeInto(LibraryManager.library, {
4197-
jslib_x: '{{{ makeStaticAlloc(4) }}}',
4198-
jslib_x__postset: 'HEAP32[_jslib_x>>2] = 148;',
4199-
});
4200-
''')
4201-
self.dylink_test(main=r'''
4202-
#include <stdio.h>
4203-
extern "C" int jslib_x;
4204-
extern void call_side();
4205-
int main() {
4206-
printf("main: jslib_x is %d.\n", jslib_x);
4207-
call_side();
4208-
return 0;
4209-
}
4210-
''', side=r'''
4211-
#include <stdio.h>
4212-
extern "C" int jslib_x;
4213-
void call_side() {
4214-
printf("side: jslib_x is %d.\n", jslib_x);
4215-
}
4216-
''', expected=['main: jslib_x is 148.\nside: jslib_x is 148.\n'], main_emcc_args=['--js-library', 'lib.js'])
4217-
42184193
@needs_dlfcn
42194194
def test_dylink_many_postsets(self):
42204195
NUM = 1234

0 commit comments

Comments
 (0)