mirror of
https://github.com/openai/codex.git
synced 2026-10-19 16:17:49 +00:00
## Why Optimized `Array.prototype.sort` can write objects into incompatible array element storage when receiver element kinds differ and the comparator mutates the array. ## What changed - Upgrade `v8` to `152.2.0`, the Bazel V8 source to `15.2.124.1`, and ICU data and initialization to version 78. - Backport element-kind agreement checks for sort inlining in TurboFan and Maglev. Apply the patch to Bazel builds and Windows MSVC source builds, and include it in source-build cache keys and canary triggers. - Refresh pinned sandbox archives and bindings, extend Bazel prebuilt coverage to musl Linux, and use matching sandbox bindings on Windows MSVC. - Update Bazel integration patches and runtime dependencies for the new V8 release, and download the pinned Windows build tools in source-build workflows. ## Testing Include the upstream sort regression test covering mixed element kinds, comparator mutation, and continued optimization for matching kinds. Add a test requiring canary and Windows source builds when the backport changes, and update artifact-fetch tests for the new version. GitOrigin-RevId: 138b7821cddd25466c10aced1dd22be24837caf0
278 lines
11 KiB
Diff
278 lines
11 KiB
Diff
# What: replace upstream V8 module dependency bootstrapping with repository
|
|
# declarations and dependency setup that match this Bazel workspace.
|
|
# Scope: upstream MODULE.bazel only; affects external repo resolution and Bazel
|
|
# module wiring, not V8 source files.
|
|
|
|
diff --git a/orig/v8-15.2.124.1/MODULE.bazel b/mod/v8-15.2.124.1/MODULE.bazel
|
|
--- a/orig/v8-15.2.124.1/MODULE.bazel
|
|
+++ b/mod/v8-15.2.124.1/MODULE.bazel
|
|
@@ -8,12 +8,65 @@
|
|
bazel_dep(name = "rules_python", version = "1.7.0")
|
|
bazel_dep(name = "platforms", version = "1.0.0")
|
|
bazel_dep(name = "abseil-cpp", version = "20250814.1")
|
|
-bazel_dep(name = "highway", version = "1.2.0")
|
|
+bazel_dep(name = "rules_license", version = "0.0.4")
|
|
+
|
|
+git_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
|
+http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
|
|
+
|
|
+http_archive(
|
|
+ name = "highway",
|
|
+ patch_args = ["-p1"],
|
|
+ patches = ["@v8//:bazel/highway.patch"],
|
|
+ sha256 = "741d705781e0b3e406beda8f1f994fbae01321237ce8023a1ad90fbaf7940c25",
|
|
+ strip_prefix = "highway-2607d3b5b0113992fe84d3848859eae13b3b52c1",
|
|
+ urls = ["https://github.com/google/highway/archive/2607d3b5b0113992fe84d3848859eae13b3b52c1.tar.gz"],
|
|
+)
|
|
+
|
|
+git_repository(
|
|
+ name = "icu",
|
|
+ build_file = "@v8//:bazel/BUILD.icu",
|
|
+ commit = "d578f2e8b7bd5938e21cfb6bf15c079e0aa5b738",
|
|
+ patch_cmds = ["find source -name BUILD.bazel | xargs rm"],
|
|
+ patch_cmds_win = ["Get-ChildItem -Path source -File -Include BUILD.bazel -Recurse | Remove-Item"],
|
|
+ remote = "https://chromium.googlesource.com/chromium/deps/icu.git",
|
|
+)
|
|
+
|
|
+http_archive(
|
|
+ name = "fast_float",
|
|
+ build_file_content = 'load("@rules_cc//cc:defs.bzl", "cc_library")\n\ncc_library(\n name = "fast_float",\n hdrs = glob(["include/fast_float/*.h"]),\n include_prefix = "third_party/fast_float/src/include",\n strip_include_prefix = "include",\n visibility = ["//visibility:public"],\n)\n',
|
|
+ sha256 = "76f958dd97b1cf4d8862d1f0986a47d4bdfa8845252bae15ef0f40de3b95961f",
|
|
+ strip_prefix = "fast_float-8.2.10",
|
|
+ urls = ["https://github.com/fastfloat/fast_float/archive/refs/tags/v8.2.10.tar.gz"],
|
|
+)
|
|
+
|
|
+http_archive(
|
|
+ name = "simdutf",
|
|
+ build_file_content = 'load("@rules_cc//cc:defs.bzl", "cc_library")\n\ncc_library(\n name = "simdutf",\n srcs = ["src/simdutf.cpp"],\n hdrs = glob(["include/**/*.h"]),\n textual_hdrs = glob(["src/**/*.h", "src/**/*.cpp"], exclude = ["src/simdutf.cpp"]),\n copts = ["-std=c++20"],\n include_prefix = "third_party/simdutf",\n includes = ["include", "src"],\n strip_include_prefix = "include",\n visibility = ["//visibility:public"],\n)\n',
|
|
+ sha256 = "0180de81a1dd48a87b8c0442ffa81734f3db91a7350914107a449935124e3c6f",
|
|
+ strip_prefix = "simdutf-7.7.0",
|
|
+ urls = ["https://github.com/simdutf/simdutf/archive/refs/tags/v7.7.0.tar.gz"],
|
|
+)
|
|
+
|
|
+git_repository(
|
|
+ name = "dragonbox",
|
|
+ build_file_content = 'load("@rules_cc//cc:defs.bzl", "cc_library")\n\ncc_library(\n name = "dragonbox",\n hdrs = ["include/dragonbox/dragonbox.h"],\n include_prefix = "third_party/dragonbox/src/include",\n strip_include_prefix = "include",\n visibility = ["//visibility:public"],\n)\n',
|
|
+ commit = "beeeef91cf6fef89a4d4ba5e95d47ca64ccb3a44",
|
|
+ remote = "https://chromium.googlesource.com/external/github.com/jk-jeon/dragonbox.git",
|
|
+)
|
|
+
|
|
+git_repository(
|
|
+ name = "fp16",
|
|
+ build_file_content = 'load("@rules_cc//cc:defs.bzl", "cc_library")\n\ncc_library(\n name = "fp16",\n hdrs = glob(["include/**/*.h"]),\n include_prefix = "third_party/fp16/src/include",\n includes = ["include"],\n strip_include_prefix = "include",\n visibility = ["//visibility:public"],\n)\n',
|
|
+ commit = "782eea126dc5c755827be751a099eb01826175cf",
|
|
+ remote = "https://chromium.googlesource.com/external/github.com/Maratyszcza/FP16.git",
|
|
+)
|
|
|
|
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
|
|
pip.parse(
|
|
hub_name = "v8_python_deps",
|
|
python_version = "3.11",
|
|
+ # Use the pip resolver to preserve V8's hashes and repository names.
|
|
+ simpleapi_skip = ["jinja2", "markupsafe"],
|
|
requirements_lock = "//:bazel/requirements.txt",
|
|
extra_pip_args = [
|
|
"--require-hashes",
|
|
@@ -21,180 +74,3 @@
|
|
],
|
|
)
|
|
use_repo(pip, "v8_python_deps")
|
|
-
|
|
-# Define the local LLVM toolchain repository
|
|
-llvm_toolchain_repository = use_repo_rule("//bazel/toolchain:llvm_repository.bzl", "llvm_toolchain_repository")
|
|
-
|
|
-llvm_toolchain_repository(
|
|
- name = "llvm_toolchain",
|
|
- path = "third_party/llvm-build/Release+Asserts",
|
|
- config_file_content = """
|
|
-load("@rules_cc//cc:defs.bzl", "CcToolchainConfigInfo", "cc_common")
|
|
-load("@bazel_tools//tools/cpp:cc_toolchain_config_lib.bzl", "feature", "flag_group", "flag_set", "tool_path")
|
|
-
|
|
-def _impl(ctx):
|
|
- tool_paths = [
|
|
- tool_path(name = "gcc", path = "bin/clang"),
|
|
- tool_path(name = "ld", path = "bin/lld"),
|
|
- tool_path(name = "ar", path = "bin/llvm-ar"),
|
|
- tool_path(name = "cpp", path = "bin/clang++"),
|
|
- tool_path(name = "gcov", path = "/bin/false"),
|
|
- tool_path(name = "nm", path = "bin/llvm-nm"),
|
|
- tool_path(name = "objdump", path = "bin/llvm-objdump"),
|
|
- tool_path(name = "strip", path = "bin/llvm-strip"),
|
|
- ]
|
|
-
|
|
- features = [
|
|
- feature(
|
|
- name = "default_compile_flags",
|
|
- enabled = True,
|
|
- flag_sets = [
|
|
- flag_set(
|
|
- actions = [
|
|
- "c-compile",
|
|
- "c++-compile",
|
|
- "c++-header-parsing",
|
|
- "c++-module-compile",
|
|
- "c++-module-codegen",
|
|
- "linkstamp-compile",
|
|
- "assemble",
|
|
- "preprocess-assemble",
|
|
- ],
|
|
- flag_groups = [
|
|
- flag_group(
|
|
- flags = [
|
|
- "--sysroot={WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot",
|
|
- "-nostdinc++",
|
|
- "-isystem",
|
|
- "{WORKSPACE_ROOT}/buildtools/third_party/libc++",
|
|
- "-isystem",
|
|
- "{WORKSPACE_ROOT}/third_party/libc++/src/include",
|
|
- "-isystem",
|
|
- "{WORKSPACE_ROOT}/third_party/libc++abi/src/include",
|
|
- "-isystem",
|
|
- "{WORKSPACE_ROOT}/third_party/libc++/src/src",
|
|
- "-isystem",
|
|
- "{WORKSPACE_ROOT}/third_party/llvm-libc/src",
|
|
- "-D_LIBCPP_HARDENING_MODE_DEFAULT=_LIBCPP_HARDENING_MODE_NONE",
|
|
- "-DLIBC_NAMESPACE=__llvm_libc_cr",
|
|
- ],
|
|
- ),
|
|
- ],
|
|
- ),
|
|
- ],
|
|
- ),
|
|
- feature(
|
|
- name = "default_linker_flags",
|
|
- enabled = True,
|
|
- flag_sets = [
|
|
- flag_set(
|
|
- actions = [
|
|
- "c++-link-executable",
|
|
- "c++-link-dynamic-library",
|
|
- "c++-link-nodeps-dynamic-library",
|
|
- ],
|
|
- flag_groups = [
|
|
- flag_group(
|
|
- flags = [
|
|
- "--sysroot={WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot",
|
|
- "-fuse-ld=lld",
|
|
- "-lm",
|
|
- "-lpthread",
|
|
- ],
|
|
- ),
|
|
- ],
|
|
- ),
|
|
- ],
|
|
- ),
|
|
- ]
|
|
-
|
|
- return cc_common.create_cc_toolchain_config_info(
|
|
- ctx = ctx,
|
|
- toolchain_identifier = "local_clang",
|
|
- features = features,
|
|
- cxx_builtin_include_directories = [
|
|
- "{WORKSPACE_ROOT}/buildtools/third_party/libc++",
|
|
- "{WORKSPACE_ROOT}/third_party/libc++/src/include",
|
|
- "{WORKSPACE_ROOT}/third_party/libc++abi/src/include",
|
|
- "{WORKSPACE_ROOT}/third_party/libc++/src/src",
|
|
- "{WORKSPACE_ROOT}/third_party/llvm-libc/src",
|
|
- "{WORKSPACE_ROOT}/third_party/llvm-build/Release+Asserts/lib/clang/22/include",
|
|
- "{WORKSPACE_ROOT}/third_party/llvm-build/Release+Asserts/lib/clang/23/include",
|
|
- "{WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot/usr/include",
|
|
- "{WORKSPACE_ROOT}/build/linux/debian_bullseye_amd64-sysroot/usr/local/include",
|
|
- ],
|
|
- host_system_name = "local",
|
|
- target_system_name = "local",
|
|
- target_cpu = "k8",
|
|
- target_libc = "unknown",
|
|
- compiler = "clang",
|
|
- abi_version = "unknown",
|
|
- abi_libc_version = "unknown",
|
|
- tool_paths = tool_paths,
|
|
- )
|
|
-
|
|
-cc_toolchain_config = rule(
|
|
- implementation = _impl,
|
|
- attrs = {},
|
|
- provides = [CcToolchainConfigInfo],
|
|
-)
|
|
-""",
|
|
- build_file_content = """
|
|
-load("@rules_cc//cc:defs.bzl", "cc_toolchain")
|
|
-load(":cc_toolchain_config.bzl", "cc_toolchain_config")
|
|
-
|
|
-package(default_visibility = ["//visibility:public"])
|
|
-
|
|
-filegroup(
|
|
- name = "all_files",
|
|
- srcs = glob(["**/*"]),
|
|
-)
|
|
-
|
|
-filegroup(name = "empty")
|
|
-
|
|
-cc_toolchain_config(name = "k8_toolchain_config")
|
|
-
|
|
-cc_toolchain(
|
|
- name = "k8_toolchain",
|
|
- all_files = ":all_files",
|
|
- ar_files = ":all_files",
|
|
- compiler_files = ":all_files",
|
|
- dwp_files = ":empty",
|
|
- linker_files = ":all_files",
|
|
- objcopy_files = ":all_files",
|
|
- strip_files = ":all_files",
|
|
- supports_param_files = 0,
|
|
- toolchain_config = ":k8_toolchain_config",
|
|
- toolchain_identifier = "local_clang",
|
|
-)
|
|
-
|
|
-toolchain(
|
|
- name = "cc_toolchain_k8",
|
|
- exec_compatible_with = [
|
|
- "@platforms//cpu:x86_64",
|
|
- "@platforms//os:linux",
|
|
- ],
|
|
- target_compatible_with = [
|
|
- "@platforms//cpu:x86_64",
|
|
- "@platforms//os:linux",
|
|
- ],
|
|
- toolchain = ":k8_toolchain",
|
|
- toolchain_type = "@bazel_tools//tools/cpp:toolchain_type",
|
|
-)
|
|
-""",
|
|
-)
|
|
-
|
|
-register_toolchains("@llvm_toolchain//:cc_toolchain_k8")
|
|
-
|
|
-# Define local repository for libc++ from third_party sources
|
|
-libcxx_repository = use_repo_rule("//bazel/toolchain:libcxx_repository.bzl", "libcxx_repository")
|
|
-
|
|
-libcxx_repository(
|
|
- name = "libcxx",
|
|
-)
|
|
-
|
|
-single_version_override(
|
|
- module_name = "highway",
|
|
- patches = ["//bazel/patches:highway_rules_cc.patch"],
|
|
- patch_strip = 1,
|
|
-)
|
|
diff --git a/orig/v8-15.2.124.1/bazel/highway.patch b/mod/v8-15.2.124.1/bazel/highway.patch
|
|
new file mode 100644
|
|
--- /dev/null
|
|
+++ b/mod/v8-15.2.124.1/bazel/highway.patch
|
|
@@ -0,0 +1,16 @@
|
|
+diff --git a/BUILD b/BUILD
|
|
+--- a/BUILD
|
|
++++ b/BUILD
|
|
+@@ -118,11 +118,7 @@
|
|
+ ],
|
|
+ })
|
|
+
|
|
+-DEFINES = select({
|
|
+- ":compiler_msvc": ["HWY_SHARED_DEFINE"],
|
|
+- ":compiler_clangcl": ["HWY_SHARED_DEFINE"],
|
|
+- "//conditions:default": [],
|
|
+-})
|
|
++DEFINES = []
|
|
+
|
|
+ # Unused on Bazel builds, where this is not defined/known; Copybara replaces
|
|
+ # usages with an empty list.
|