Skip to content

Commit b8831d3

Browse files
authored
Fix sbrk tracing (#22787)
This effectively reverts #19174 Fixes: #21223
1 parent 519f81b commit b8831d3

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

test/code_size/hello_wasm_worker_wasm.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"a.js.gz": 455,
66
"a.ww.js": 115,
77
"a.ww.js.gz": 127,
8-
"a.wasm": 1879,
9-
"a.wasm.gz": 1066,
10-
"total": 3277,
11-
"total_gz": 2032
8+
"a.wasm": 1881,
9+
"a.wasm.gz": 1065,
10+
"total": 3279,
11+
"total_gz": 2031
1212
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9789
1+
9784

tools/system_libs.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,7 +1053,6 @@ def get_libcall_files(self):
10531053
filenames=['emscripten_memcpy.c', 'emscripten_memset.c',
10541054
'emscripten_scan_stack.c',
10551055
'emscripten_get_heap_size.c', # needed by malloc
1056-
'sbrk.c', # needed by malloc
10571056
'emscripten_memmove.c'])
10581057
# Calls to iprintf can be generated during codegen. Ideally we wouldn't
10591058
# compile these with -O2 like we do the rest of compiler-rt since its
@@ -1300,7 +1299,6 @@ def get_files(self):
13001299
'sigaction.c',
13011300
'sigtimedwait.c',
13021301
'wasi-helpers.c',
1303-
'sbrk.c',
13041302
'system.c',
13051303
])
13061304

@@ -1733,7 +1731,9 @@ def get_files(self):
17331731
malloc = utils.path_from_root('system/lib', {
17341732
'dlmalloc': 'dlmalloc.c', 'emmalloc': 'emmalloc.c',
17351733
}[malloc_base])
1736-
return [malloc]
1734+
# Include sbrk.c in libc, it uses tracing and libc itself doesn't have a tracing variant.
1735+
sbrk = utils.path_from_root('system/lib/libc/sbrk.c')
1736+
return [malloc, sbrk]
17371737

17381738
def get_cflags(self):
17391739
cflags = super().get_cflags()
@@ -1818,13 +1818,10 @@ class libmimalloc(MTLibrary):
18181818
# mimalloc includes some files at the source level, so exclude them here.
18191819
excludes=['alloc-override.c', 'page-queue.c', 'static.c']
18201820
)
1821-
src_files += files_in_path(
1822-
path='system/lib/mimalloc/src/prim',
1823-
filenames=['prim.c']
1824-
)
1825-
src_files += files_in_path(
1826-
path='system/lib/',
1827-
filenames=['emmalloc.c'])
1821+
src_files += [utils.path_from_root('system/lib/mimalloc/src/prim/prim.c')]
1822+
src_files += [utils.path_from_root('system/lib/emmalloc.c')]
1823+
# Include sbrk.c in libc, it uses tracing and libc itself doesn't have a tracing variant.
1824+
src_files += [utils.path_from_root('system/lib/libc/sbrk.c')]
18281825

18291826
def can_use(self):
18301827
return super().can_use() and settings.MALLOC == 'mimalloc'

0 commit comments

Comments
 (0)