diff --git a/.github/workflows/test-shared.yml b/.github/workflows/test-shared.yml index 8a04fe4d74fc..0810f1828c27 100644 --- a/.github/workflows/test-shared.yml +++ b/.github/workflows/test-shared.yml @@ -33,6 +33,7 @@ on: - deps/sqlite/** - deps/uv/** - deps/uvwasi/** + - deps/v8/third_party/highway/** - deps/zlib/** - deps/zstd/** - doc/** @@ -86,6 +87,7 @@ on: - deps/sqlite/** - deps/uv/** - deps/uvwasi/** + - deps/v8/third_party/highway/** - deps/zlib/** - deps/zstd/** - doc/** diff --git a/Makefile b/Makefile index ed049893a243..6cc1ea6e53d0 100644 --- a/Makefile +++ b/Makefile @@ -1316,6 +1316,7 @@ ifeq ($(SKIP_SHARED_DEPS), 1) $(RM) -r $(TARNAME)/deps/sqlite $(RM) -r $(TARNAME)/deps/uv $(RM) -r $(TARNAME)/deps/uvwasi + $(RM) -r $(TARNAME)/deps/v8/third_party/highway $(RM) -r $(TARNAME)/deps/zlib $(RM) -r $(TARNAME)/deps/zstd else diff --git a/configure.py b/configure.py index b11c4e3284d0..61a9af9218c8 100755 --- a/configure.py +++ b/configure.py @@ -326,6 +326,28 @@ dest='shared_hdr_histogram_libpath', help='a directory to search for the shared HdrHistogram DLL') +shared_optgroup.add_argument('--shared-highway', + action='store_true', + dest='shared_highway', + default=None, + help='link to a shared Highway (hwy) DLL instead of static linking') + +shared_optgroup.add_argument('--shared-highway-includes', + action='store', + dest='shared_highway_includes', + help='directory containing Highway header files') + +shared_optgroup.add_argument('--shared-highway-libname', + action='store', + dest='shared_highway_libname', + default='hwy', + help='alternative lib name to link to [default: %(default)s]') + +shared_optgroup.add_argument('--shared-highway-libpath', + action='store', + dest='shared_highway_libpath', + help='a directory to search for the shared Highway DLL') + shared_optgroup.add_argument('--shared-http-parser', action='store_true', dest='shared_http_parser', @@ -2821,6 +2843,7 @@ def make_bin_override(): configure_library('cares', output, pkgname='libcares') configure_library('gtest', output) configure_library('hdr_histogram', output) +configure_library('highway', output, pkgname='libhwy') configure_library('merve', output) configure_library('nbytes', output) configure_library('nghttp2', output, pkgname='libnghttp2') diff --git a/node.gyp b/node.gyp index 8cf405215249..f4ac22dc82fb 100644 --- a/node.gyp +++ b/node.gyp @@ -19,6 +19,7 @@ 'node_shared_cares%': 'false', 'node_shared_gtest%': 'false', 'node_shared_hdr_histogram%': 'false', + 'node_shared_highway%': 'false', 'node_shared_http_parser%': 'false', 'node_shared_libuv%': 'false', 'node_shared_lief%': 'false', diff --git a/shell.nix b/shell.nix index 96fcccbc1914..83ad9de9a39d 100644 --- a/shell.nix +++ b/shell.nix @@ -63,6 +63,7 @@ let ]; buildInputs = pkgs.lib.optional useSharedICU icu + ++ pkgs.lib.optional (builtins.hasAttr "highway" sharedLibDeps) sharedLibDeps.highway ++ pkgs.lib.optional (withTemporal && useSharedTemporal) sharedLibDeps.temporal_capi; # Put here only the configure flags that affect the V8 build @@ -75,6 +76,7 @@ let ) "--v8-${if withTemporal then "enable" else "disable"}-temporal-support" ] + ++ pkgs.lib.optional (builtins.hasAttr "highway" sharedLibDeps) "--shared-highway" ++ pkgs.lib.optional (withTemporal && useSharedTemporal) "--shared-temporal_capi" ++ pkgs.lib.optional withPerfetto "--with-perfetto"; in @@ -132,6 +134,7 @@ pkgs.mkShell { builtins.attrNames ( if (useSeparateDerivationForV8 != false) then builtins.removeAttrs sharedLibDeps [ + "highway" "simdutf" "temporal_capi" ] diff --git a/tools/nix/sharedLibDeps.nix b/tools/nix/sharedLibDeps.nix index 788e9efedeb8..8cc875d9c173 100644 --- a/tools/nix/sharedLibDeps.nix +++ b/tools/nix/sharedLibDeps.nix @@ -23,6 +23,7 @@ ; cares = pkgs.c-ares; hdr-histogram = pkgs.hdrhistogram_c; + highway = pkgs.libhwy; http-parser = pkgs.llhttp; nghttp2 = pkgs.nghttp2.overrideAttrs { version = "1.69.0"; diff --git a/tools/nix/v8.nix b/tools/nix/v8.nix index 90dadd336c8d..b912075c43dd 100644 --- a/tools/nix/v8.nix +++ b/tools/nix/v8.nix @@ -23,6 +23,7 @@ }: let + useSharedHighway = builtins.elem "--shared-highway" configureFlags; src = let inherit (lib) fileset; @@ -63,12 +64,15 @@ let potentiallyAlreadyRemovedFiles = # Files that are removed in the release tarball (see Makefile $(TARBALL) target) [ (fileset.difference ../../deps/v8/test ../../deps/v8/test/torque) ] - ++ (builtins.filter builtins.pathExists [ - ../../deps/v8/samples - ../../deps/v8/tools/profviz - ../../deps/v8/tools/run-tests.py - ../../deps/v8/third_party/ittapi - ]); + ++ (builtins.filter builtins.pathExists ( + [ + ../../deps/v8/samples + ../../deps/v8/tools/profviz + ../../deps/v8/tools/run-tests.py + ../../deps/v8/third_party/ittapi + ] + ++ lib.optional useSharedHighway ../../deps/v8/third_party/highway + )); trackedFiles = ({ # This line is being modified by Makefile $(TARBALL) target, any change to it should be sync diff --git a/tools/v8_gypfiles/v8.gyp b/tools/v8_gypfiles/v8.gyp index 32fc99e2af9f..262be5e88647 100644 --- a/tools/v8_gypfiles/v8.gyp +++ b/tools/v8_gypfiles/v8.gyp @@ -2444,10 +2444,35 @@ 'target_name': 'highway', 'type': 'static_library', 'toolsets': ['host', 'target'], - 'variables': { - 'HIGHWAY_ROOT': '../../deps/v8/third_party/highway', - }, - 'all_dependent_settings': { + 'conditions': [['node_shared_highway=="false"', { + 'variables': { + 'HIGHWAY_ROOT': '../../deps/v8/third_party/highway', + }, + 'all_dependent_settings': { + 'include_dirs': [ + '<(HIGHWAY_ROOT)/src', + ], + 'conditions': [ + ['v8_target_arch=="ia32"', { + 'defines': ['HWY_BROKEN_TARGETS=(HWY_AVX2|HWY_AVX3)',], + }], + ['v8_target_arch=="arm64"', { + 'defines': ['HWY_BROKEN_TARGETS=HWY_ALL_SVE',], + }], + ['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', { + 'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',], + }], + ['v8_target_arch=="s390x"', { + 'defines': ['HWY_BROKEN_EMU128=0',], + }], + ['OS in "aix os400"', { + 'defines': ['HWY_BROKEN_EMU128=0',], + }], + ['v8_target_arch=="arm" and arm_version==7', { + 'defines': ['HWY_BROKEN_EMU128=0',], + }], + ], + }, 'include_dirs': [ '<(HIGHWAY_ROOT)/src', ], @@ -2461,34 +2486,11 @@ ['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', { 'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',], }], - ['v8_target_arch=="s390x"', { - 'defines': ['HWY_BROKEN_EMU128=0',], - }], - ['OS in "aix os400"', { - 'defines': ['HWY_BROKEN_EMU128=0',], - }], - ['v8_target_arch=="arm" and arm_version==7', { - 'defines': ['HWY_BROKEN_EMU128=0',], - }], ], - }, - 'include_dirs': [ - '<(HIGHWAY_ROOT)/src', - ], - 'conditions': [ - ['v8_target_arch=="ia32"', { - 'defines': ['HWY_BROKEN_TARGETS=(HWY_AVX2|HWY_AVX3)',], - }], - ['v8_target_arch=="arm64"', { - 'defines': ['HWY_BROKEN_TARGETS=HWY_ALL_SVE',], - }], - ['v8_target_arch=="ppc64" or v8_target_arch=="s390x"', { - 'defines': ['TOOLCHAIN_MISS_ASM_HWCAP_H',], - }], - ], - 'sources': [ - '