Skip to content
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

Initial new INITIAL_HEAP setting #21071

Merged
merged 29 commits into from
Mar 1, 2024
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b43181e
Initial INITIAL_HEAP support
SingleAccretion Jan 12, 2024
79bf8d7
Comment out the memory size assert
SingleAccretion Jan 13, 2024
4def2c7
Adjust a couple tests
SingleAccretion Jan 13, 2024
5ddd199
Rebaseline a couple code size tests
SingleAccretion Jan 13, 2024
d893b4d
A better INITIAL_HEAP description
SingleAccretion Jan 28, 2024
79958b2
Remove the INITIAL_MEMORY assert
SingleAccretion Jan 28, 2024
a4e3cfc
Single quotes in python
SingleAccretion Jan 28, 2024
f994f46
Prettify the code a little
SingleAccretion Jan 28, 2024
1433dd8
Make test_sysconf_phys_pages the default initial memory test
SingleAccretion Jan 28, 2024
c8b285e
Add a change log entry
SingleAccretion Jan 28, 2024
eae41e0
Recommend INITIAL_HEAP
SingleAccretion Jan 28, 2024
3da94a8
Also update the doc
SingleAccretion Jan 28, 2024
0906505
Merge branch 'main' into Initial-Heap
SingleAccretion Jan 28, 2024
a3786ec
Merge fix...
SingleAccretion Jan 28, 2024
3c76f5b
Merge branch 'main' into Initial-Heap
SingleAccretion Jan 30, 2024
db45ed2
Rebaseline once more
SingleAccretion Jan 30, 2024
d71d239
More rebaselining
SingleAccretion Jan 30, 2024
47ec651
Work around the WASM2JS regression
SingleAccretion Jan 30, 2024
b443e06
Better comments and documentation
SingleAccretion Jan 30, 2024
0dc6457
Merge branch 'main' into Initial-Heap
SingleAccretion Feb 15, 2024
9a885f1
Fix up the change log
SingleAccretion Feb 15, 2024
d2cdd4e
Use @parameterized for the test
SingleAccretion Feb 15, 2024
a37cafe
Brush-ups
SingleAccretion Feb 15, 2024
1ce8cd6
Delete some files commited by mistake
SingleAccretion Feb 17, 2024
a36cf25
Merge branch 'main' into Initial-Heap
SingleAccretion Mar 1, 2024
d89c454
Use --no-growable-memory when memory growth is not allowed
SingleAccretion Mar 1, 2024
ea3b557
Change log fixup
SingleAccretion Mar 1, 2024
d688893
Rebaseline a test
SingleAccretion Mar 1, 2024
37eeea5
Test nits and fixes
SingleAccretion Mar 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 21 additions & 21 deletions test/test_other.py
Original file line number Diff line number Diff line change
Expand Up @@ -8132,29 +8132,29 @@ def test_binaryen_warn_mem(self):
self.run_process([EMCC, test_file('hello_world.c'), '-sINITIAL_MEMORY=' + str(16 * 1024 * 1024), '--pre-js', 'pre.js', '-sALLOW_MEMORY_GROWTH', '-sWASM_ASYNC_COMPILATION=0', '-sIMPORTED_MEMORY'])
self.assertContained('hello, world!', self.run_js('a.out.js'))

def test_initial_heap(self):
for args, expected_initial_heap in [
([], 16 * 1024 * 1024), # Default behavior: 16MB initial heap
(['-sINITIAL_MEMORY=40MB'], 0), # Backwards compatibility: no initial heap (we can't tell if it'll fit)
(['-sMAXIMUM_MEMORY=40MB'], 0), # Backwards compatibility: no initial heap (we can't tell if it'll fit)
(['-sINITIAL_HEAP=64KB'], 64 * 1024), # Explicitly set initial heap is passed
(['-sINITIAL_HEAP=128KB', '-sINITIAL_MEMORY=20MB', '-sMAXIMUM_MEMORY=40MB'], 128 * 1024),
(['-sINITIAL_HEAP=10MB', '-sINITIAL_MEMORY=10MB'], -1), # Not enough space for stack
(['-sINITIAL_HEAP=5MB', '-sMAXIMUM_MEMORY=5MB'], -1), # Not enough space for stack
]:
cmd = [EMCC, test_file('hello_world.c'), '-v'] + args
print(' '.join(cmd))
@parameterized({
'': ([], 16 * 1024 * 1024), # Default behavior: 16MB initial heap
'with_initial_memory': (['-sINITIAL_MEMORY=40MB'], 0), # Backwards compatibility: no initial heap (we can't tell if it'll fit)
'with_maximum_memory': (['-sMAXIMUM_MEMORY=40MB'], 0), # Backwards compatibility: no initial heap (we can't tell if it'll fit)
'with_initial_heap': (['-sINITIAL_HEAP=64KB'], 64 * 1024), # Explicitly set initial heap is passed
SingleAccretion marked this conversation as resolved.
Show resolved Hide resolved
'with_all': (['-sINITIAL_HEAP=128KB', '-sINITIAL_MEMORY=20MB', '-sMAXIMUM_MEMORY=40MB'], 128 * 1024),
'limited_by_initial_memory': (['-sINITIAL_HEAP=10MB', '-sINITIAL_MEMORY=10MB'], -1), # Not enough space for stack
'limited_by_maximum_memory': (['-sINITIAL_HEAP=5MB', '-sMAXIMUM_MEMORY=5MB'], -1), # Not enough space for stack
})
def test_initial_heap(self, args, expected_initial_heap):
cmd = [EMCC, test_file('hello_world.c'), '-v'] + args
print(' '.join(cmd))
SingleAccretion marked this conversation as resolved.
Show resolved Hide resolved

if expected_initial_heap < 0:
out = self.expect_fail(cmd)
self.assertContained('wasm-ld: error:', out)
continue
if expected_initial_heap < 0:
SingleAccretion marked this conversation as resolved.
Show resolved Hide resolved
out = self.expect_fail(cmd)
self.assertContained('wasm-ld: error:', out)
return

out = self.run_process(cmd, stderr=PIPE)
if expected_initial_heap != 0:
self.assertContained('--initial-heap=' + str(expected_initial_heap), out.stderr)
else:
self.assertNotContained('--initial-heap=', out.stderr)
out = self.run_process(cmd, stderr=PIPE)
if expected_initial_heap != 0:
self.assertContained('--initial-heap=' + str(expected_initial_heap), out.stderr)
SingleAccretion marked this conversation as resolved.
Show resolved Hide resolved
else:
self.assertNotContained('--initial-heap=', out.stderr)

def test_memory_size(self):
for args, expect_initial, expect_max in [
Expand Down