Re: lang/node, wip v8-wasm support for yarn berry

Volker Schlecht <[email protected]>
Newsgroups gmane.os.openbsd.ports
Message-ID <[email protected]>
On 7/10/26 10:43 AM, Fabien Romano wrote:
[...]
> https://chromium-review.googlesource.com/c/v8/v8/+/8063803
[...]

> For now, I think we have to disable regexp JIT.
Attached is the diff I'm currently testing. Did I get it right?
I am inclined to commit this sooner rather than later, because it
looks like this will fix the build issues we've been seeing for the
chromiums.
> ./devel/codex
> ./lang/deno
> ./lang/node
> ./www/chromium
> ./www/iridium
> ./www/ungoogled-chromium
> ./x11/qt5/qtwebengine
> ./x11/qt6/qtwebengine
> 
> Did I miss one?
Don't think so. lang/deno and devel/codex are chasing the latest v8
and are typically very close to the chromiums. I don't know about
qtwebengine, but lang/node is much more conservative however.
node-v24.18.0p0.diff (text/x-patch, 4.7 KB)
Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/node/Makefile,v
retrieving revision 1.169
diff -u -p -r1.169 Makefile
--- Makefile	30 Jun 2026 18:46:22 -0000	1.169
+++ Makefile	11 Jul 2026 11:58:19 -0000
@@ -13,6 +13,7 @@ DIST_TUPLE =		github qbit node-pledge 1.
 DISTNAME =		node-${NODE_VERSION}
 PKGNAME =		${DISTNAME:S/v//g}
 EPOCH =			0
+REVISION =		0
 
 CATEGORIES =		lang devel
 
Index: patches/patch-deps_v8_src_flags_flag-definitions_h
===================================================================
RCS file: patches/patch-deps_v8_src_flags_flag-definitions_h
diff -N patches/patch-deps_v8_src_flags_flag-definitions_h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-deps_v8_src_flags_flag-definitions_h	11 Jul 2026 11:58:19 -0000
@@ -0,0 +1,32 @@
+Disable regexp JIT
+
+Index: deps/v8/src/flags/flag-definitions.h
+--- deps/v8/src/flags/flag-definitions.h.orig
++++ deps/v8/src/flags/flag-definitions.h
+@@ -2835,15 +2835,26 @@ DEFINE_BOOL(serialization_statistics, false,
+             "Collect statistics on serialized objects.")
+ // Regexp
+ DEFINE_BOOL(regexp_optimization, true, "generate optimized regexp code")
++#ifdef V8_OS_OPENBSD
++// OpenBSD: Irregexp JIT rewrites a C++ return address, which conflicts with
++// retguard. Force bytecode interpretation and make the choice immutable.
++DEFINE_BOOL_READONLY(regexp_interpret_all, true, "interpret all regexp code")
++#else
+ DEFINE_BOOL(regexp_interpret_all, false, "interpret all regexp code")
++#endif
+ #ifdef V8_TARGET_BIG_ENDIAN
+ #define REGEXP_PEEPHOLE_OPTIMIZATION_BOOL false
+ #else
+ #define REGEXP_PEEPHOLE_OPTIMIZATION_BOOL true
+ #endif
++#ifdef V8_OS_OPENBSD
++DEFINE_BOOL_READONLY(regexp_tier_up, false,
++                     "enable regexp interpreter and tier up to the compiler")
++#else
+ DEFINE_BOOL(regexp_tier_up, true,
+             "enable regexp interpreter and tier up to the compiler after the "
+             "number of executions set by the tier up ticks flag")
++#endif
+ DEFINE_NEG_IMPLICATION(regexp_interpret_all, regexp_tier_up)
+ DEFINE_INT(regexp_tier_up_ticks, 1,
+            "set the number of executions for the regexp interpreter before "
Index: patches/patch-deps_v8_src_wasm_jump-table-assembler_cc
===================================================================
RCS file: patches/patch-deps_v8_src_wasm_jump-table-assembler_cc
diff -N patches/patch-deps_v8_src_wasm_jump-table-assembler_cc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-deps_v8_src_wasm_jump-table-assembler_cc	11 Jul 2026 11:58:19 -0000
@@ -0,0 +1,28 @@
+See https://chromium-review.googlesource.com/c/v8/v8/+/8063803
+Index: deps/v8/src/wasm/jump-table-assembler.cc
+--- deps/v8/src/wasm/jump-table-assembler.cc.orig
++++ deps/v8/src/wasm/jump-table-assembler.cc
+@@ -114,6 +114,10 @@ void JumpTableAssembler::EmitLazyCompileJumpSlot(uint3
+ }
+ 
+ bool JumpTableAssembler::EmitJumpSlot(Address target) {
++  intptr_t displacement = target - (pc_ + kJumpTableSlotEntryMarkerSize +
++                                    MacroAssembler::kIntraSegmentJmpInstrSize);
++  if (!is_int32(displacement)) return false;
++
+ #ifdef V8_ENABLE_CET_IBT
+   uint32_t endbr_insn = 0xfa1e0ff3;
+   uint32_t nop = 0x00401f0f;
+@@ -122,11 +126,7 @@ bool JumpTableAssembler::EmitJumpSlot(Address target) 
+   emit<uint32_t>(nop, kRelaxedStore);
+ #endif
+ 
+-  intptr_t displacement =
+-      target - (pc_ + MacroAssembler::kIntraSegmentJmpInstrSize);
+-  if (!is_int32(displacement)) return false;
+-
+-  uint8_t inst[kJumpTableSlotSize] = {
++  uint8_t inst[8] = {
+       0xe9, 0,    0,    0, 0,  // near_jmp displacement
+       0xcc, 0xcc, 0xcc,        // int3 * 3
+   };
Index: patches/patch-deps_v8_src_wasm_jump-table-assembler_h
===================================================================
RCS file: patches/patch-deps_v8_src_wasm_jump-table-assembler_h
diff -N patches/patch-deps_v8_src_wasm_jump-table-assembler_h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ patches/patch-deps_v8_src_wasm_jump-table-assembler_h	11 Jul 2026 11:58:19 -0000
@@ -0,0 +1,15 @@
+See https://chromium-review.googlesource.com/c/v8/v8/+/8063803
+Index: deps/v8/src/wasm/jump-table-assembler.h
+--- deps/v8/src/wasm/jump-table-assembler.h.orig
++++ deps/v8/src/wasm/jump-table-assembler.h
+@@ -184,8 +184,10 @@ class V8_EXPORT_PRIVATE JumpTableAssembler {
+ #if V8_TARGET_ARCH_X64
+ #ifdef V8_ENABLE_CET_IBT
+   static constexpr int kJumpTableSlotSize = 16;
++  static constexpr int kJumpTableSlotEntryMarkerSize = 8;
+ #else  // V8_ENABLE_CET_IBT
+   static constexpr int kJumpTableSlotSize = 8;
++  static constexpr int kJumpTableSlotEntryMarkerSize = 0;
+ #endif
+   static constexpr int kJumpTableLineSize = kJumpTableSlotSize;
+   static constexpr int kFarJumpTableSlotSize = 16;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.