Skip to content

Commit aa76216

Browse files
committed
fix: remove suimdutf atomic requirement
Signed-off-by: Matt Leon <[email protected]>
1 parent 828f791 commit aa76216

File tree

1 file changed

+48
-6
lines changed

1 file changed

+48
-6
lines changed

bazel/external/v8.patch

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
From bc2a85e39fd55879b9baed51429c08b27d5514c8 Mon Sep 17 00:00:00 2001
22
From: Matt Leon <[email protected]>
33
Date: Wed, 16 Jul 2025 16:55:02 -0400
4-
Subject: [PATCH 1/6] Disable pointer compression
4+
Subject: [PATCH 1/7] Disable pointer compression
55

66
Pointer compression limits the maximum number of WasmVMs.
77

@@ -30,7 +30,7 @@ index 3f5a87d054e..0a693b7ee10 100644
3030
From 61898e9a63ac89a37261c081b84714cfc400a4b1 Mon Sep 17 00:00:00 2001
3131
From: Matt Leon <[email protected]>
3232
Date: Wed, 16 Jul 2025 16:56:31 -0400
33-
Subject: [PATCH 2/6] Restore _allowlist_function_transition
33+
Subject: [PATCH 2/7] Restore _allowlist_function_transition
3434

3535
Reverts v8 commit b26554ec368e9553782012c96aa5e99b163eaff2, which removed use of
3636
_allowlist_function_transition from v8 bazel/defs.bzl, since it is still required
@@ -85,7 +85,7 @@ index 8c929454840..57336154cf7 100644
8585
From 4a6e7158fd4ca48c75c8e33ea15760c9beea1d2f Mon Sep 17 00:00:00 2001
8686
From: Matt Leon <[email protected]>
8787
Date: Wed, 16 Jul 2025 16:56:52 -0400
88-
Subject: [PATCH 3/6] Don't expose Wasm C API (only Wasm C++ API).
88+
Subject: [PATCH 3/7] Don't expose Wasm C API (only Wasm C++ API).
8989

9090
Signed-off-by: Matt Leon <[email protected]>
9191
---
@@ -118,7 +118,7 @@ index 05e4029f183..d705be96a16 100644
118118
From 7b593eb8086dcfe9012d4fa694d622f21dadb731 Mon Sep 17 00:00:00 2001
119119
From: Matt Leon <[email protected]>
120120
Date: Wed, 16 Jul 2025 16:58:02 -0400
121-
Subject: [PATCH 4/6] Stub out fast_float for bazel-supplied version
121+
Subject: [PATCH 4/7] Stub out fast_float for bazel-supplied version
122122

123123
Signed-off-by: Matt Leon <[email protected]>
124124
---
@@ -145,7 +145,7 @@ index 0a693b7ee10..eafd9dad20c 100644
145145
From b442d34b12dd513946f509d9db86839ce8aa4d7f Mon Sep 17 00:00:00 2001
146146
From: Matt Leon <[email protected]>
147147
Date: Wed, 16 Jul 2025 20:04:05 -0400
148-
Subject: [PATCH 5/6] Stub out vendored dependencies for bazel-sourced versions
148+
Subject: [PATCH 5/7] Stub out vendored dependencies for bazel-sourced versions
149149

150150
Signed-off-by: Matt Leon <[email protected]>
151151
---
@@ -177,7 +177,7 @@ index eafd9dad20c..ce36666e36e 100644
177177
From e0b8f32cc057a3c0875437d5d54d012cabcab458 Mon Sep 17 00:00:00 2001
178178
From: Matt Leon <[email protected]>
179179
Date: Wed, 16 Jul 2025 20:29:10 -0400
180-
Subject: [PATCH 6/6] Add build flags to make V8 compile with GCC
180+
Subject: [PATCH 6/7] Add build flags to make V8 compile with GCC
181181

182182
Signed-off-by: Matt Leon <[email protected]>
183183
---
@@ -201,3 +201,45 @@ index 14d7ace5e59..c7a48d4e805 100644
201201
--
202202
2.50.0.727.gbf7dc18ff4-goog
203203

204+
205+
From 3c442140741446722c95ba3466195d0091395c02 Mon Sep 17 00:00:00 2001
206+
From: Matt Leon <[email protected]>
207+
Date: Fri, 18 Jul 2025 12:49:10 -0400
208+
Subject: [PATCH 7/7] Hack out atomic simdutf requirement.
209+
210+
Atomic simdutf requires __cpp_lib_atomic_ref >= 201806, which is only supported in clang libc++ 19+. The version of LLVM used in Envoy as of 2025-07-18 is libc++ 18, so this is not supported.
211+
212+
The simdutf documentation indicates this atomic form is not tested and is not recommended for use: https://github.com/simdutf/simdutf/blob/5d1b6248f29a8ed0eb90f79be268be41730e39f8/include/simdutf/implementation.h#L3066-L3068
213+
214+
In addition, this is in the implementation of a JS array buffer. Since proxy-wasm-cpp-host does not make use of JS array buffers or shared memory between web workers, we're stubbing it out.
215+
216+
Signed-off-by: Matt Leon <[email protected]>
217+
---
218+
src/builtins/builtins-typed-array.cc | 4 ++--
219+
1 file changed, 2 insertions(+), 2 deletions(-)
220+
221+
diff --git a/src/builtins/builtins-typed-array.cc b/src/builtins/builtins-typed-array.cc
222+
index 918cb873481..1da38e4cf54 100644
223+
--- a/src/builtins/builtins-typed-array.cc
224+
+++ b/src/builtins/builtins-typed-array.cc
225+
@@ -521,7 +521,7 @@ simdutf::result ArrayBufferSetFromBase64(
226+
output_length = array_length;
227+
simdutf::result simd_result;
228+
if (typed_array->buffer()->is_shared()) {
229+
- simd_result = simdutf::atomic_base64_to_binary_safe(
230+
+ simd_result = simdutf::base64_to_binary_safe(
231+
reinterpret_cast<const T>(input_vector), input_length,
232+
reinterpret_cast<char*>(typed_array->DataPtr()), output_length,
233+
alphabet, last_chunk_handling, /*decode_up_to_bad_char*/ true);
234+
@@ -834,7 +834,7 @@ BUILTIN(Uint8ArrayPrototypeToBase64) {
235+
236+
size_t simd_result_size;
237+
if (uint8array->buffer()->is_shared()) {
238+
- simd_result_size = simdutf::atomic_binary_to_base64(
239+
+ simd_result_size = simdutf::binary_to_base64(
240+
std::bit_cast<const char*>(uint8array->DataPtr()), length,
241+
reinterpret_cast<char*>(output->GetChars(no_gc)), alphabet);
242+
} else {
243+
--
244+
2.50.0.727.gbf7dc18ff4-goog
245+

0 commit comments

Comments
 (0)