Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions system/lib/dlmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2917,7 +2917,7 @@ static size_t traverse_and_check(mstate m);
#define treebin_at(M,i) (&((M)->treebins[i]))

/* assign tree index for size S to variable I. Use x86 asm if possible */
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__))
#define compute_tree_index(S, I)\
{\
unsigned int X = S >> TREEBIN_SHIFT;\
Expand Down Expand Up @@ -3020,7 +3020,7 @@ I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\

/* index corresponding to given bit. Use x86 asm if possible */

#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
#if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__) || defined(__EMSCRIPTEN__))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder this doesn't use #if __has_builtin(__builtin_ctz) .. I guess maybe dlmalloc was written before such a macro existed?

I also wonder if we should use __wasm__ here instead of __EMSCRIPTEN__? I guess it doesn't matter much since if there is almost no chance of upstreaming these chagnes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, __wasm__ probably is a better choice; I used __EMSCRIPTEN__ since that was used by other modifications in that file.

#define compute_bit2idx(X, I)\
{\
unsigned int J;\
Expand Down
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_cxx_ctors1.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
123858
123606
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_cxx_ctors2.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
123778
123525
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_cxx_except.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
165031
164813
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_cxx_except_wasm.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
137169
136926
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_cxx_mangle.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
220199
219926
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_cxx_noexcept.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
126598
126359
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_mem_O3.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5894
5381
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_mem_O3_grow.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5895
5382
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6208
5689
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_mem_O3_standalone.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6131
5612
2 changes: 1 addition & 1 deletion test/other/metadce/test_metadce_mem_O3_standalone_lib.size
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5911
5384
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5941
5414
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4525
4224
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, nice improvements!