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

Fabien Romano <[email protected]>
Newsgroups gmane.os.openbsd.ports
Message-ID <[email protected]>
On 7/6/26 08:47, Fabien Romano wrote:
> 
> On 7/4/26 13:18, Volker Schlecht wrote:
>> Attached is your diff against 24.18.0 in -current. I don't see any wasm-related
>> tests failing here, but the failure cases that you mentioned seem to be the same
>> as or similar to random failures we're seeing while building the chromiums when
>> running the wasm version of rollup.
> 
> To reproduce, you need amd64(V8_ENABLE_CET_IBT) and a specific memory layout.
> When V8 patches a Wasm jump slot and has to fall back to the far jump table,
> it generates twice endbr ; nop, it emit insn before checking relative offset.
> 
> V8 WASM uses jump tables; thus, it overwrites an other function call slot.
> 

https://chromium-review.googlesource.com/c/v8/v8/+/8063803

> This got catched with dcheck enabled.
> CONFIGURE_ARGS += --v8-with-dchecks
> 
> That's why I include a patch for
> deps/v8/src/snapshot/embedded/platform-embedded-file-writer-generic.h
> 
> I'm still running with dcheck enabled, so I didn't actually test the final diff.
> More tests welcome.
> 
> I will run both node and node-v8 tests with dchecks.
> Maybe a separate commit related to dchecks only.

Still running with dcheck here, still fine.

There are a bunch of node tests failing that may be worthwhile checking.
fs.watch / watch-mode :
parallel/test-fs-promises-watch*
parallel/test-fs-watch*
parallel/test-watch*
sequential/test-watch-mode*

> 
>>
>> I'll test drive that for a bit, but what these patches do, or how they might fix
>> things is beyond my capabilities, so I hope that someone else will look over
>> them as well, particularly if this might improve things for other ports
>> including v8 (chromiums, deno, codex...)

find ./ -path */patches/*_v8_*
...

./devel/codex
./lang/deno
./lang/node
./www/chromium
./www/iridium
./www/ungoogled-chromium
./x11/qt5/qtwebengine
./x11/qt6/qtwebengine

Did I miss one?

I'm in a make & retry loop to make a lang/v8 test port.
Adding missing DEPS and patches ...

Again, it is just for testing purposes.
If I remember correctly, Google Source archives are not stable.
Thus, this port will not be reproducible at all.

> 
> There is also a regexp issue to fix.

For now, I think we have to disable regexp JIT.
I will further explain in a later email.

After testing the upstream WASM jump table fix.
After updating the node diff.

Index: deps/v8/src/flags/flag-definitions.h
--- deps/v8/src/flags/flag-definitions.h.orig
+++ deps/v8/src/flags/flag-definitions.h
@@ -2835,16 +2835,27 @@ 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")
 DEFINE_NEG_IMPLICATION(regexp_interpret_all, regexp_tier_up)
+#endif
 DEFINE_INT(regexp_tier_up_ticks, 1,
            "set the number of executions for the regexp interpreter before "
            "tiering-up to the compiler")

-- 
Fabien Romano
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.