1
1
From bc2a85e39fd55879b9baed51429c08b27d5514c8 Mon Sep 17 00:00:00 2001
2
2
From: Matt Leon <
[email protected] >
3
3
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
5
5
6
6
Pointer compression limits the maximum number of WasmVMs.
7
7
@@ -30,7 +30,7 @@ index 3f5a87d054e..0a693b7ee10 100644
30
30
From 61898e9a63ac89a37261c081b84714cfc400a4b1 Mon Sep 17 00:00:00 2001
31
31
From: Matt Leon <
[email protected] >
32
32
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
34
34
35
35
Reverts v8 commit b26554ec368e9553782012c96aa5e99b163eaff2, which removed use of
36
36
_allowlist_function_transition from v8 bazel/defs.bzl, since it is still required
@@ -85,7 +85,7 @@ index 8c929454840..57336154cf7 100644
85
85
From 4a6e7158fd4ca48c75c8e33ea15760c9beea1d2f Mon Sep 17 00:00:00 2001
86
86
From: Matt Leon <
[email protected] >
87
87
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).
89
89
90
90
Signed-off-by: Matt Leon <
[email protected] >
91
91
---
@@ -118,7 +118,7 @@ index 05e4029f183..d705be96a16 100644
118
118
From 7b593eb8086dcfe9012d4fa694d622f21dadb731 Mon Sep 17 00:00:00 2001
119
119
From: Matt Leon <
[email protected] >
120
120
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
122
122
123
123
Signed-off-by: Matt Leon <
[email protected] >
124
124
---
@@ -145,7 +145,7 @@ index 0a693b7ee10..eafd9dad20c 100644
145
145
From b442d34b12dd513946f509d9db86839ce8aa4d7f Mon Sep 17 00:00:00 2001
146
146
From: Matt Leon <
[email protected] >
147
147
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
149
149
150
150
Signed-off-by: Matt Leon <
[email protected] >
151
151
---
@@ -177,7 +177,7 @@ index eafd9dad20c..ce36666e36e 100644
177
177
From e0b8f32cc057a3c0875437d5d54d012cabcab458 Mon Sep 17 00:00:00 2001
178
178
From: Matt Leon <
[email protected] >
179
179
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
181
181
182
182
Signed-off-by: Matt Leon <
[email protected] >
183
183
---
@@ -201,3 +201,143 @@ index 14d7ace5e59..c7a48d4e805 100644
201
201
- -
202
202
2.50.0.727.gbf7dc18ff4-goog
203
203
204
+
205
+ From 9ae93dd8bccd0519a3b16498af0191693ea5a670 Mon Sep 17 00:00:00 2001
206
+ From: Matt Leon <
[email protected] >
207
+ Date: Fri, 18 Jul 2025 17:28:42 -0400
208
+ Subject: [PATCH 7/7] Hack out atomic simd support in V8.
209
+
210
+ Atomic simdutf requires __cpp_lib_atomic_ref >= 201806, which is only
211
+ supported in clang libc++ 19+. The version of LLVM used in Envoy as of
212
+ 2025-07-18 is libc++ 18, so this is not supported.
213
+
214
+ The simdutf documentation indicates this atomic form is not tested and
215
+ is not recommended for use:
216
+ https://github.com/simdutf/simdutf/blob/5d1b6248f29a8ed0eb90f79be268be41730e39f8/include/simdutf/implementation.h#L3066-L3068
217
+
218
+ In addition, this is in the implementation of a JS array buffer. Since
219
+ proxy-wasm-cpp-host does not make use of JS array buffers or shared
220
+ memory between web workers, we're stubbing it out.
221
+
222
+ Mostly reverts
223
+ https://github.com/v8/v8/commit/6d6c1e680c7b8ea5f62a76e9c3d88d3fb0a88df0.
224
+
225
+ Signed-off-by: Matt Leon <
[email protected] >
226
+ ---
227
+ src/builtins/builtins-typed-array.cc | 8 ++++++++
228
+ src/objects/simd.cc | 14 ++++++++++++++
229
+ 2 files changed, 22 insertions(+)
230
+
231
+ diff --git a/src/builtins/builtins-typed-array.cc b/src/builtins/builtins-typed-array.cc
232
+ index 918cb873481..a71cb7d70e0 100644
233
+ --- a/src/builtins/builtins-typed-array.cc
234
+ +++ b/src/builtins/builtins-typed-array.cc
235
+ @@ -520,17 +520,21 @@ simdutf::result ArrayBufferSetFromBase64(
236
+ DirectHandle<JSTypedArray> typed_array, size_t& output_length) {
237
+ output_length = array_length;
238
+ simdutf::result simd_result;
239
+ + #ifdef __cpp_lib_atomic_ref
240
+ if (typed_array->buffer()->is_shared()) {
241
+ simd_result = simdutf::atomic_base64_to_binary_safe(
242
+ reinterpret_cast<const T>(input_vector), input_length,
243
+ reinterpret_cast<char*>(typed_array->DataPtr()), output_length,
244
+ alphabet, last_chunk_handling, /*decode_up_to_bad_char*/ true);
245
+ } else {
246
+ + #endif
247
+ simd_result = simdutf::base64_to_binary_safe(
248
+ reinterpret_cast<const T>(input_vector), input_length,
249
+ reinterpret_cast<char*>(typed_array->DataPtr()), output_length,
250
+ alphabet, last_chunk_handling, /*decode_up_to_bad_char*/ true);
251
+ + #ifdef __cpp_lib_atomic_ref
252
+ }
253
+ + #endif
254
+
255
+ return simd_result;
256
+ }
257
+ @@ -833,15 +837,19 @@ BUILTIN(Uint8ArrayPrototypeToBase64) {
258
+ // 11. Return CodePointsToString(outAscii).
259
+
260
+ size_t simd_result_size;
261
+ + #ifdef __cpp_lib_atomic_ref
262
+ if (uint8array->buffer()->is_shared()) {
263
+ simd_result_size = simdutf::atomic_binary_to_base64(
264
+ std::bit_cast<const char*>(uint8array->DataPtr()), length,
265
+ reinterpret_cast<char*>(output->GetChars(no_gc)), alphabet);
266
+ } else {
267
+ + #endif
268
+ simd_result_size = simdutf::binary_to_base64(
269
+ std::bit_cast<const char*>(uint8array->DataPtr()), length,
270
+ reinterpret_cast<char*>(output->GetChars(no_gc)), alphabet);
271
+ + #ifdef __cpp_lib_atomic_ref
272
+ }
273
+ + #endif
274
+ DCHECK_EQ(simd_result_size, output_length);
275
+ USE(simd_result_size);
276
+ }
277
+ diff --git a/src/objects/simd.cc b/src/objects/simd.cc
278
+ index 0ef570ceb7d..01f5cb0d5c9 100644
279
+ --- a/src/objects/simd.cc
280
+ +++ b/src/objects/simd.cc
281
+ @@ -32,6 +32,10 @@
282
+ #include <arm_neon.h>
283
+ #endif
284
+
285
+ + #ifdef __cpp_lib_atomic_ref
286
+ + #define HAS_ATOMIC_REF
287
+ + #endif
288
+ +
289
+ namespace v8 {
290
+ namespace internal {
291
+
292
+ @@ -477,6 +481,7 @@ void Uint8ArrayToHexSlow(const char* bytes, size_t length,
293
+ }
294
+ }
295
+
296
+ + #ifdef HAS_ATOMIC_REF
297
+ void AtomicUint8ArrayToHexSlow(const char* bytes, size_t length,
298
+ DirectHandle<SeqOneByteString> string_output) {
299
+ int index = 0;
300
+ @@ -492,6 +497,7 @@ void AtomicUint8ArrayToHexSlow(const char* bytes, size_t length,
301
+ index += 2;
302
+ }
303
+ }
304
+ + #endif
305
+
306
+ inline uint16_t ByteToHex(uint8_t byte) {
307
+ const uint16_t correction = (('a' - '0' - 10) << 8) + ('a' - '0' - 10);
308
+ @@ -645,11 +651,15 @@ Tagged<Object> Uint8ArrayToHex(const char* bytes, size_t length, bool is_shared,
309
+ }
310
+ #endif
311
+
312
+ + #ifdef HAS_ATOMIC_REF
313
+ if (is_shared) {
314
+ AtomicUint8ArrayToHexSlow(bytes, length, string_output);
315
+ } else {
316
+ + #endif
317
+ Uint8ArrayToHexSlow(bytes, length, string_output);
318
+ + #ifdef HAS_ATOMIC_REF
319
+ }
320
+ + #endif
321
+ return *string_output;
322
+ }
323
+
324
+ @@ -1082,12 +1092,16 @@ bool ArrayBufferFromHex(const base::Vector<T>& input_vector, bool is_shared,
325
+ for (uint32_t i = 0; i < output_length * 2; i += 2) {
326
+ result = HandleRemainingHexValues(input_vector, i);
327
+ if (result.has_value()) {
328
+ + #ifdef HAS_ATOMIC_REF
329
+ if (is_shared) {
330
+ std::atomic_ref<uint8_t>(buffer[index++])
331
+ .store(result.value(), std::memory_order_relaxed);
332
+ } else {
333
+ + #endif
334
+ buffer[index++] = result.value();
335
+ + #ifdef HAS_ATOMIC_REF
336
+ }
337
+ + #endif
338
+ } else {
339
+ return false;
340
+ }
341
+ - -
342
+ 2.50.0.727.gbf7dc18ff4-goog
343
+
0 commit comments