-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Simplify GROWABLE_HEAP transform #24295
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
RReverser
merged 14 commits into
emscripten-core:main
from
RReverser:simplify-growable-heap
May 16, 2025
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
a18d699
Add codesize for pthread + memory growth
RReverser d7962d9
Simplify GROWABLE_HEAP transform
RReverser e87c034
fmt
RReverser e44cfde
Rebaseline
RReverser bc5a82f
Remove GROWABLE_HEAP from runtimeElements as per review
RReverser 20e052c
Remove forcible updateMemoryViews in establishStackSpace
RReverser dc93fa4
Make pthread growth tests more rigorous against racy heap updates
RReverser 20e10ec
Fix GROWABLE_HEAP with new rigorous tests
RReverser 7f62384
Format
RReverser cc25a48
Rename helper
RReverser 625e320
Rename again
RReverser aad946d
Address review comments
RReverser bdee9d8
Address few more review concerns
RReverser a9354cf
Rebaseline
RReverser 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
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 |
|---|---|---|
| @@ -1,13 +1,13 @@ | ||
| function f() { | ||
| var $2 = 0; | ||
| GROWABLE_HEAP_I32()[$0 >> 2] = $2 + 1; | ||
| $9 = GROWABLE_HEAP_U8()[$2 >> 0] | 0; | ||
| +GROWABLE_HEAP_F64()[x >> 3]; | ||
| GROWABLE_HEAP_I64()[x >> 3] = GROWABLE_HEAP_I64()[y >> 3]; | ||
| (growMemViews(), HEAP32)[$0 >> 2] = $2 + 1; | ||
| $9 = (growMemViews(), HEAPU8)[$2 >> 0] | 0; | ||
| +(growMemViews(), HEAPF64)[x >> 3]; | ||
| (growMemViews(), HEAP64)[x >> 3] = (growMemViews(), HEAP64)[y >> 3]; | ||
| } | ||
|
|
||
| function libraryFunc(ptr, val) { | ||
| if (ptr < GROWABLE_HEAP_I8().length) { | ||
| Atomics.wait(GROWABLE_HEAP_I32(), ptr, val); | ||
| if (ptr < (growMemViews(), HEAP8).length) { | ||
| Atomics.wait((growMemViews(), HEAP32), ptr, val); | ||
| } | ||
| } |
17 changes: 17 additions & 0 deletions
17
test/other/codesize/test_codesize_minimal_pthreads_memgrowth.exports
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,17 @@ | ||
| A (_emscripten_thread_exit) | ||
| B (_emscripten_check_mailbox) | ||
| C (emscripten_stack_set_limits) | ||
| D (_emscripten_stack_restore) | ||
| E (_emscripten_stack_alloc) | ||
| F (emscripten_stack_get_current) | ||
| p (__wasm_call_ctors) | ||
| q (add) | ||
| r (main) | ||
| s (__indirect_function_table) | ||
| t (_emscripten_tls_init) | ||
| u (pthread_self) | ||
| v (_emscripten_proxy_main) | ||
| w (_emscripten_thread_init) | ||
| x (_emscripten_thread_crashed) | ||
| y (_emscripten_run_on_main_thread_js) | ||
| z (_emscripten_thread_free_data) |
91 changes: 91 additions & 0 deletions
91
test/other/codesize/test_codesize_minimal_pthreads_memgrowth.funcs
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,91 @@ | ||
| $__emscripten_stdout_seek | ||
| $__errno_location | ||
| $__memcpy | ||
| $__memset | ||
| $__pthread_getspecific | ||
| $__pthread_mutex_lock | ||
| $__pthread_mutex_trylock | ||
| $__pthread_mutex_unlock | ||
| $__pthread_rwlock_timedrdlock | ||
| $__pthread_rwlock_tryrdlock | ||
| $__pthread_rwlock_trywrlock | ||
| $__pthread_rwlock_unlock | ||
| $__pthread_self_internal | ||
| $__pthread_setcancelstate | ||
| $__set_thread_state | ||
| $__stdio_write | ||
| $__timedwait | ||
| $__timedwait_cp | ||
| $__tl_lock | ||
| $__tl_unlock | ||
| $__wait | ||
| $__wake | ||
| $__wake | ||
| $__wasi_syscall_ret | ||
| $__wasm_call_ctors | ||
| $__wasm_init_memory | ||
| $__wasm_init_tls | ||
| $_emscripten_check_mailbox | ||
| $_emscripten_proxy_main | ||
| $_emscripten_run_on_main_thread_js | ||
| $_emscripten_stack_alloc | ||
| $_emscripten_stack_restore | ||
| $_emscripten_thread_crashed | ||
| $_emscripten_thread_exit | ||
| $_emscripten_thread_free_data | ||
| $_emscripten_thread_init | ||
| $_emscripten_thread_mailbox_init | ||
| $_emscripten_tls_init | ||
| $_emscripten_yield | ||
| $_main_thread | ||
| $a_cas | ||
| $a_cas | ||
| $a_cas_p | ||
| $a_dec | ||
| $a_fetch_add | ||
| $a_fetch_add | ||
| $a_inc | ||
| $a_store | ||
| $a_swap | ||
| $add | ||
| $call_callback_then_free_ctx | ||
| $call_cancel_then_free_ctx | ||
| $call_then_finish_task | ||
| $call_with_ctx | ||
| $cancel_active_ctxs | ||
| $cancel_ctx | ||
| $cancel_notification | ||
| $dispose_chunk | ||
| $do_proxy | ||
| $em_proxying_ctx_deinit | ||
| $em_task_queue_cancel | ||
| $em_task_queue_create | ||
| $em_task_queue_dequeue | ||
| $em_task_queue_enqueue | ||
| $em_task_queue_execute | ||
| $em_task_queue_free | ||
| $em_task_queue_is_empty | ||
| $emscripten_builtin_free | ||
| $emscripten_builtin_malloc | ||
| $emscripten_futex_wait | ||
| $emscripten_futex_wake | ||
| $emscripten_stack_get_current | ||
| $emscripten_stack_set_limits | ||
| $free_ctx | ||
| $get_tasks_for_thread | ||
| $init_active_ctxs | ||
| $init_file_lock | ||
| $init_mparams | ||
| $lock | ||
| $main | ||
| $nodtor | ||
| $pthread_attr_destroy | ||
| $pthread_cond_signal | ||
| $pthread_mutex_destroy | ||
| $pthread_setspecific | ||
| $receive_notification | ||
| $remove_active_ctx | ||
| $run_js_func | ||
| $sbrk | ||
| $undo | ||
| $unlock |
1 change: 1 addition & 0 deletions
1
test/other/codesize/test_codesize_minimal_pthreads_memgrowth.gzsize
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 @@ | ||
| 3991 |
15 changes: 15 additions & 0 deletions
15
test/other/codesize/test_codesize_minimal_pthreads_memgrowth.imports
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,15 @@ | ||
| a (memory) | ||
| b (emscripten_get_now) | ||
| c (exit) | ||
| d (_emscripten_thread_set_strongref) | ||
| e (fd_write) | ||
| f (emscripten_runtime_keepalive_check) | ||
| g (emscripten_resize_heap) | ||
| h (emscripten_exit_with_live_runtime) | ||
| i (emscripten_check_blocking_allowed) | ||
| j (_emscripten_thread_mailbox_await) | ||
| k (_emscripten_thread_cleanup) | ||
| l (_emscripten_receive_on_main_thread_js) | ||
| m (_emscripten_notify_mailbox_postmessage) | ||
| n (_emscripten_init_main_thread_js) | ||
| o (__pthread_create_js) |
1 change: 1 addition & 0 deletions
1
test/other/codesize/test_codesize_minimal_pthreads_memgrowth.jssize
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 @@ | ||
| 8263 |
15 changes: 15 additions & 0 deletions
15
test/other/codesize/test_codesize_minimal_pthreads_memgrowth.sent
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,15 @@ | ||
| a (memory) | ||
| b (emscripten_get_now) | ||
| c (exit) | ||
| d (_emscripten_thread_set_strongref) | ||
| e (fd_write) | ||
| f (emscripten_runtime_keepalive_check) | ||
| g (emscripten_resize_heap) | ||
| h (emscripten_exit_with_live_runtime) | ||
| i (emscripten_check_blocking_allowed) | ||
| j (_emscripten_thread_mailbox_await) | ||
| k (_emscripten_thread_cleanup) | ||
| l (_emscripten_receive_on_main_thread_js) | ||
| m (_emscripten_notify_mailbox_postmessage) | ||
| n (_emscripten_init_main_thread_js) | ||
| o (__pthread_create_js) |
1 change: 1 addition & 0 deletions
1
test/other/codesize/test_codesize_minimal_pthreads_memgrowth.size
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 @@ | ||
| 19397 |
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.