summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2025-03-11 17:01:13 +0200
committerEfraim Flashner <efraim@flashner.co.il>2025-03-13 14:34:59 +0200
commit735fe0eea86fc0bec70e2a9180a329c1f76b5ddc (patch)
tree6d5a6af05a8733e1510ae00d16a6e9b450e6aa7b
parentec78708653a09d79723f18b435412797a4b95406 (diff)
fixup node-12 riscv64 support
Change-Id: I059bd5af5a2279f8c0040055a290fc02e0861fe7
-rw-r--r--gnu/packages/node.scm84
-rw-r--r--gnu/packages/patches/node-12-riscv64-support.patch91
2 files changed, 118 insertions, 57 deletions
diff --git a/gnu/packages/node.scm b/gnu/packages/node.scm
index edaaa74993b..e672c5b01c3 100644
--- a/gnu/packages/node.scm
+++ b/gnu/packages/node.scm
@@ -398,6 +398,7 @@ devices.")
398 "--shared-openssl" 398 "--shared-openssl"
399 "--shared-zlib" 399 "--shared-zlib"
400 "--verbose" 400 "--verbose"
401 "--ninja"
401 "--without-snapshot" 402 "--without-snapshot"
402 "--without-inspector" ; build without llhttp 403 "--without-inspector" ; build without llhttp
403 "--with-intl=system-icu") 404 "--with-intl=system-icu")
@@ -534,59 +535,39 @@ devices.")
534 (delete-file "test/parallel/test-worker-nearheaplimit-deadlock.js")) 535 (delete-file "test/parallel/test-worker-nearheaplimit-deadlock.js"))
535 (,(target-aarch64?) 536 (,(target-aarch64?)
536 ;; These tests timeout even with an extended timeout. 537 ;; These tests timeout even with an extended timeout.
537 (with-directory-excursion "test/parallel" 538 (with-directory-excursion "test"
538 (for-each 539 (for-each
539 delete-file 540 delete-file
540 '( 541 (cons*
541 "test-async-hooks-worker-asyncfn-terminate-1.js" 542 "parellel/test-async-hooks-worker-asyncfn-terminate-1.js"
542 "test-async-hooks-worker-asyncfn-terminate-2.js" 543 "parellel/test-async-hooks-worker-asyncfn-terminate-2.js"
543 "test-async-hooks-worker-asyncfn-terminate-3.js" 544 "parellel/test-async-hooks-worker-asyncfn-terminate-3.js"
544 "test-async-hooks-worker-asyncfn-terminate-4.js" 545 "parellel/test-async-hooks-worker-asyncfn-terminate-4.js"
545 "test-cli-node-options.js" 546 "parellel/test-cli-node-options.js"
546 "test-crypto-key-objects-messageport.js" 547 "parellel/test-crypto-key-objects-messageport.js"
547 "test-crypto-worker-thread.js" 548 "parellel/test-crypto-worker-thread.js"
548 "test-disable-proto-delete.js" 549 "parellel/test-disable-proto-delete.js"
549 "test-disable-proto-throw.js" 550 "parellel/test-disable-proto-throw.js"
550 "test-performance-eventlooputil.js" 551 "parellel/test-performance-eventlooputil.js"
551 "test-preload.js" 552 "parellel/test-preload.js"
552 "test-process-exec-argv.js" 553 "parellel/test-process-exec-argv.js"
553 "test-require-symlink.js" 554 "parellel/test-require-symlink.js"
554 "test-trace-events-api-worker-disabled.js" 555 "parellel/test-trace-events-api-worker-disabled.js"
555 "test-trace-events-async-hooks-worker.js" 556 "parellel/test-trace-events-async-hooks-worker.js"
556 "test-trace-events-worker-metadata.js" 557 "parellel/test-trace-events-worker-metadata.js"
557 "test-trace-exit.js" 558 "parellel/test-trace-exit.js"
558 "test-worker.js" 559 "wasi/test-wasi-worker-terminate.js"
559 "test-worker-abort-on-uncaught-exception.js" 560 "wpt/test-console.js"
560 "test-worker-abort-on-uncaught-exception-terminate.js" 561 "wpt/test-encoding.js"
561 "test-worker-arraybuffer-zerofill.js" 562 "wpt/test-hr-time.js"
562 "test-worker-cjs-workerdata.js" 563 "wpt/test-microtask-queuing.js"
563 "test-worker-cleanexit-with-js.js" 564 "wpt/test-timers.js"
564 "test-worker-cleanexit-with-moduleload.js" 565 "wpt/test-url.js"
565 "test-worker-cleanup-handles.js" 566 "report/test-report-worker.js"
566 "test-worker-console-listeners.js" 567 "es-module/test-esm-loader-side-effect.js"
567 "test-worker-crypto-sign-transfer-result.js" 568 "sequential/test-worker-prof.js"
568 "test-worker-dns-terminate.js" 569 "abort/test-worker-abort-uncaught-exception.js"
569 "test-worker-dns-terminate-during-query.js" 570 (find-files "parallel" "^test-worker")))))
570 "test-worker-error-stack-getter-throws.js"
571 "test-worker-esm-exit.js"
572 "test-worker-esm-missing-main.js"
573 "test-worker-esmodule.js"
574 "test-worker-eventlooputil.js"
575 "test-worker-execargv.js"
576 "test-worker-exit-code.js"
577 "test-worker-exit-event-error.js"
578 "test-worker-exit-from-uncaught-exception.js"
579 "test-worker-fs-stat-watcher.js"
580 "test-worker-heapdump-failure.js"
581 "test-worker-http2-generic-streams-terminate.js"
582 "test-worker-init-failure.js"
583 "test-worker-memory.js"
584 "test-worker-message-channel.js"
585 "test-worker-message-channel-sharedarraybuffer.js"
586 "test-worker-message-not-serializable.js"
587 "test-worker-message-port-drain.js"
588 "test-worker-message-port-message-before-close.js"
589 ))))
590 (else #t)) 571 (else #t))
591 572
592 ;; These tests have an expiry date: they depend on the validity of 573 ;; These tests have an expiry date: they depend on the validity of
@@ -716,6 +697,7 @@ devices.")
716 http-parser 697 http-parser
717 icu4c 698 icu4c
718 libuv 699 libuv
700 (@ (gnu packages ninja) ninja)
719 `(,nghttp2 "lib") 701 `(,nghttp2 "lib")
720 openssl-1.1 702 openssl-1.1
721 zlib 703 zlib
diff --git a/gnu/packages/patches/node-12-riscv64-support.patch b/gnu/packages/patches/node-12-riscv64-support.patch
index d977fb6a14c..493ce45f8ca 100644
--- a/gnu/packages/patches/node-12-riscv64-support.patch
+++ b/gnu/packages/patches/node-12-riscv64-support.patch
@@ -483,10 +483,10 @@ index 8ae89187ecb..aa74f6d4aac 100644
483 } // namespace internal 483 } // namespace internal
484diff --git a/deps/v8/src/builtins/riscv64/builtins-riscv64.cc b/deps/v8/src/builtins/riscv64/builtins-riscv64.cc 484diff --git a/deps/v8/src/builtins/riscv64/builtins-riscv64.cc b/deps/v8/src/builtins/riscv64/builtins-riscv64.cc
485new file mode 100644 485new file mode 100644
486index 00000000000..685f575598f 486index 00000000000..ebdf1d46ba1
487--- /dev/null 487--- /dev/null
488+++ b/deps/v8/src/builtins/riscv64/builtins-riscv64.cc 488+++ b/deps/v8/src/builtins/riscv64/builtins-riscv64.cc
489@@ -0,0 +1,3316 @@ 489@@ -0,0 +1,3320 @@
490+// Copyright 2021 the V8 project authors. All rights reserved. 490+// Copyright 2021 the V8 project authors. All rights reserved.
491+// Use of this source code is governed by a BSD-style license that can be 491+// Use of this source code is governed by a BSD-style license that can be
492+// found in the LICENSE file. 492+// found in the LICENSE file.
@@ -1266,6 +1266,7 @@ index 00000000000..685f575598f
1266+ __ Lw(params_size, 1266+ __ Lw(params_size,
1267+ FieldMemOperand(params_size, BytecodeArray::kParameterSizeOffset)); 1267+ FieldMemOperand(params_size, BytecodeArray::kParameterSizeOffset));
1268+ 1268+
1269+ /*
1269+ Register actual_params_size = scratch2; 1270+ Register actual_params_size = scratch2;
1270+ Label L1; 1271+ Label L1;
1271+ // Compute the size of the actual parameters + receiver (in bytes). 1272+ // Compute the size of the actual parameters + receiver (in bytes).
@@ -1279,6 +1280,7 @@ index 00000000000..685f575598f
1279+ __ Branch(&L1, le, actual_params_size, Operand(params_size)); 1280+ __ Branch(&L1, le, actual_params_size, Operand(params_size));
1280+ __ Move(params_size, actual_params_size); 1281+ __ Move(params_size, actual_params_size);
1281+ __ bind(&L1); 1282+ __ bind(&L1);
1283+ */
1282+ 1284+
1283+ // Leave the frame (also dropping the register file). 1285+ // Leave the frame (also dropping the register file).
1284+ __ LeaveFrame(StackFrame::INTERPRETED); 1286+ __ LeaveFrame(StackFrame::INTERPRETED);
@@ -1293,7 +1295,7 @@ index 00000000000..685f575598f
1293+ OptimizationMarker expected_marker, 1295+ OptimizationMarker expected_marker,
1294+ Runtime::FunctionId function_id) { 1296+ Runtime::FunctionId function_id) {
1295+ Label no_match; 1297+ Label no_match;
1296+ __ Branch(&no_match, ne, actual_marker, Operand(expected_marker)); 1298+ __ Branch(&no_match, ne, actual_marker, Operand(Smi::FromEnum(expected_marker)));
1297+ GenerateTailCallToReturnedCode(masm, function_id); 1299+ GenerateTailCallToReturnedCode(masm, function_id);
1298+ __ bind(&no_match); 1300+ __ bind(&no_match);
1299+} 1301+}
@@ -1339,7 +1341,7 @@ index 00000000000..685f575598f
1339+ // optimized code marker isn't updated. Evict the code, update the marker 1341+ // optimized code marker isn't updated. Evict the code, update the marker
1340+ // and re-enter the closure's code. 1342+ // and re-enter the closure's code.
1341+ __ bind(&heal_optimized_code_slot); 1343+ __ bind(&heal_optimized_code_slot);
1342+ GenerateTailCallToReturnedCode(masm, Runtime::kHealOptimizedCodeSlot); 1344+ GenerateTailCallToReturnedCode(masm, Runtime::kEvictOptimizedCodeSlot);
1343+} 1345+}
1344+ 1346+
1345+static void MaybeOptimizeCode(MacroAssembler* masm, Register feedback_vector, 1347+static void MaybeOptimizeCode(MacroAssembler* masm, Register feedback_vector,
@@ -1503,13 +1505,13 @@ index 00000000000..685f575598f
1503+ // is optimized code or an optimization marker, call that instead. 1505+ // is optimized code or an optimization marker, call that instead.
1504+ Register optimization_state = a4; 1506+ Register optimization_state = a4;
1505+ __ Lw(optimization_state, 1507+ __ Lw(optimization_state,
1506+ FieldMemOperand(feedback_vector, FeedbackVector::kFlagsOffset)); 1508+ FieldMemOperand(feedback_vector, FeedbackVector::kInvocationCountOffset));
1507+ 1509+
1508+ // Check if the optimized code slot is not empty or has a optimization marker. 1510+ // Check if the optimized code slot is not empty or has a optimization marker.
1509+ Label has_optimized_code_or_marker; 1511+ Label has_optimized_code_or_marker;
1510+ 1512+
1511+ __ And(t0, optimization_state, 1513+ __ And(t0, optimization_state,
1512+ FeedbackVector::kHasOptimizedCodeOrCompileOptimizedMarkerMask); 1514+ FeedbackVector::kOptimizedCodeWeakOrSmiOffset);
1513+ __ Branch(&has_optimized_code_or_marker, ne, t0, Operand(zero_reg)); 1515+ __ Branch(&has_optimized_code_or_marker, ne, t0, Operand(zero_reg));
1514+ 1516+
1515+ Label not_optimized; 1517+ Label not_optimized;
@@ -1634,6 +1636,7 @@ index 00000000000..685f575598f
1634+ LeaveInterpreterFrame(masm, t0, t1); 1636+ LeaveInterpreterFrame(masm, t0, t1);
1635+ __ Jump(ra); 1637+ __ Jump(ra);
1636+ 1638+
1639+ /*
1637+ __ bind(&stack_check_interrupt); 1640+ __ bind(&stack_check_interrupt);
1638+ // Modify the bytecode offset in the stack to be kFunctionEntryBytecodeOffset 1641+ // Modify the bytecode offset in the stack to be kFunctionEntryBytecodeOffset
1639+ // for the call to the StackGuard. 1642+ // for the call to the StackGuard.
@@ -1677,6 +1680,7 @@ index 00000000000..685f575598f
1677+ FeedbackVector::kMaybeOptimizedCodeOffset)); 1680+ FeedbackVector::kMaybeOptimizedCodeOffset));
1678+ 1681+
1679+ TailCallOptimizedCodeSlot(masm, optimized_code_entry, t4, a5); 1682+ TailCallOptimizedCodeSlot(masm, optimized_code_entry, t4, a5);
1683+ */
1680+ 1684+
1681+ __ bind(&compile_lazy); 1685+ __ bind(&compile_lazy);
1682+ GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy); 1686+ GenerateTailCallToReturnedCode(masm, Runtime::kCompileLazy);
@@ -24789,6 +24793,53 @@ index 00000000000..b2923001509
24789+} // namespace v8 24793+} // namespace v8
24790+ 24794+
24791+#endif // V8_TARGET_ARCH_RISCV64 24795+#endif // V8_TARGET_ARCH_RISCV64
24796diff --git a/deps/v8/src/deoptimizer/riscv64/deoptimizer-riscv64.cc b/deps/v8/src/deoptimizer/riscv64/deoptimizer-riscv64.cc
24797new file mode 100644
24798index 00000000000..1cbe85ba5df
24799--- /dev/null
24800+++ b/deps/v8/src/deoptimizer/riscv64/deoptimizer-riscv64.cc
24801@@ -0,0 +1,41 @@
24802+// Copyright 2021 the V8 project authors. All rights reserved.
24803+// Use of this source code is governed by a BSD-style license that can be
24804+// found in the LICENSE file.
24805+
24806+#include "src/deoptimizer/deoptimizer.h"
24807+
24808+namespace v8 {
24809+namespace internal {
24810+
24811+const bool Deoptimizer::kSupportsFixedDeoptExitSizes = true;
24812+const int Deoptimizer::kNonLazyDeoptExitSize = 5 * kInstrSize;
24813+const int Deoptimizer::kLazyDeoptExitSize = 5 * kInstrSize;
24814+const int Deoptimizer::kEagerWithResumeBeforeArgsSize = 6 * kInstrSize;
24815+const int Deoptimizer::kEagerWithResumeDeoptExitSize =
24816+ kEagerWithResumeBeforeArgsSize + 4 * kInstrSize;
24817+const int Deoptimizer::kEagerWithResumeImmedArgs1PcOffset = kInstrSize;
24818+const int Deoptimizer::kEagerWithResumeImmedArgs2PcOffset =
24819+ kInstrSize + kSystemPointerSize;
24820+
24821+Float32 RegisterValues::GetFloatRegister(unsigned n) const {
24822+ return Float32::FromBits(
24823+ static_cast<uint32_t>(double_registers_[n].get_bits()));
24824+}
24825+
24826+void FrameDescription::SetCallerPc(unsigned offset, intptr_t value) {
24827+ SetFrameSlot(offset, value);
24828+}
24829+
24830+void FrameDescription::SetCallerFp(unsigned offset, intptr_t value) {
24831+ SetFrameSlot(offset, value);
24832+}
24833+
24834+void FrameDescription::SetCallerConstantPool(unsigned offset, intptr_t value) {
24835+ // No embedded constant pool support.
24836+ UNREACHABLE();
24837+}
24838+
24839+void FrameDescription::SetPc(intptr_t pc) { pc_ = pc; }
24840+
24841+} // namespace internal
24842+} // namespace v8
24792diff --git a/deps/v8/src/diagnostics/perf-jit.h b/deps/v8/src/diagnostics/perf-jit.h 24843diff --git a/deps/v8/src/diagnostics/perf-jit.h b/deps/v8/src/diagnostics/perf-jit.h
24793index 36ab8441100..e3a28ce65b9 100644 24844index 36ab8441100..e3a28ce65b9 100644
24794--- a/deps/v8/src/diagnostics/perf-jit.h 24845--- a/deps/v8/src/diagnostics/perf-jit.h
@@ -36074,3 +36125,31 @@ index 0876b16b46a..df96d605d41 100644
36074 ['v8_target_arch=="s390x"', { 36125 ['v8_target_arch=="s390x"', {
36075 'defines': [ 36126 'defines': [
36076 'V8_TARGET_ARCH_S390', 36127 'V8_TARGET_ARCH_S390',
36128diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp
36129index 26b8e56e834..2e36827d412 100644
36130--- a/tools/v8_gypfiles/v8.gyp
36131+++ b/tools/v8_gypfiles/v8.gyp
36132@@ -364,6 +364,11 @@
36133 '<(V8_ROOT)/src/builtins/ppc/builtins-ppc.cc',
36134 ],
36135 }],
36136+ ['v8_target_arch=="riscv64"', {
36137+ 'sources': [
36138+ '<(V8_ROOT)/src/builtins/riscv64/builtins-riscv64.cc',
36139+ ],
36140+ }],
36141 ['v8_target_arch=="s390x"', {
36142 'sources': [
36143 '<(V8_ROOT)/src/builtins/s390/builtins-s390.cc',
36144@@ -749,6 +754,11 @@
36145 '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_current_cpu == \\"ppc.*?sources \+= ")',
36146 ],
36147 }],
36148+ ['v8_target_arch=="riscv64"', {
36149+ 'sources': [ ### gcmole(arch:riscv64) ###
36150+ '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_current_cpu == \\"riscv64.*?sources \+= ")',
36151+ ],
36152+ }],
36153 ['v8_target_arch=="s390x"', {
36154 'sources': [ ### gcmole(arch:s390) ###
36155 '<!@pymod_do_main(GN-scraper "<(V8_ROOT)/BUILD.gn" "\\"v8_base_without_compiler.*?v8_current_cpu == \\"s390.*?sources \+= ")',