Skip to content

Commit 0f88675

Browse files
committed
gh-148646: Add --enable-prebuilt-jit-stencils configure flag
1 parent 0fcf2b7 commit 0f88675

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-1
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Add a new ``--enable-prebuilt-jit-stencils`` configure flag that forces the
2+
build to use the existing provided JIT stencils even when the digest at the
3+
beginning of the file does not match expectations. That allows
4+
redistributors who prebuilt the JIT stencils on a system with a different
5+
autoconf version to still use them even when ``pyconfig.h`` is slightly
6+
different.

Tools/jit/_targets.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ def build(
235235
*,
236236
comment: str = "",
237237
force: bool = False,
238+
prebuilt: bool = False,
238239
jit_stencils: pathlib.Path,
239240
) -> None:
240241
"""Build jit_stencils.h in the given directory."""
@@ -250,7 +251,7 @@ def build(
250251
if (
251252
not force
252253
and jit_stencils.exists()
253-
and jit_stencils.read_text().startswith(digest)
254+
and (prebuilt or jit_stencils.read_text().startswith(digest))
254255
):
255256
return
256257
stencil_groups = ASYNCIO_RUNNER.run(self._build_stencils())

Tools/jit/build.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
"--cflags", help="additional flags to pass to the compiler", default=""
4444
)
4545
parser.add_argument("--llvm-version", help="LLVM version to use")
46+
parser.add_argument(
47+
"--prebuilt",
48+
action="store_true",
49+
help="accept prebuilt stencils even if the digest does not match",
50+
)
4651
args = parser.parse_args()
4752
for target in args.target:
4853
target.debug = args.debug
@@ -55,6 +60,7 @@
5560
target.build(
5661
comment=comment,
5762
force=args.force,
63+
prebuilt=args.prebuilt,
5864
jit_stencils=args.output_dir / f"jit_stencils-{target.triple}.h",
5965
)
6066
jit_stencils_h = args.output_dir / "jit_stencils.h"

configure

Lines changed: 26 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

configure.ac

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2836,6 +2836,19 @@ AS_VAR_IF([jit_flags],
28362836
AC_SUBST([REGEN_JIT_COMMAND])
28372837
AC_MSG_RESULT([$tier2_flags $jit_flags])
28382838

2839+
# Check for --enable-prebuilt-jit-stencils:
2840+
AC_MSG_CHECKING([for --enable-prebuilt-jit-stencils])
2841+
AC_ARG_ENABLE([prebuilt-jit-stencils],
2842+
[AS_HELP_STRING([--enable-prebuilt-jit-stencils],
2843+
[accept prebuilt JIT stencils even if the digest does not match (default is no)])],
2844+
[],
2845+
[enable_prebuilt_jit_stencils=no])
2846+
AS_VAR_IF([enable_prebuilt_jit_stencils],
2847+
[no],
2848+
[],
2849+
[AS_VAR_APPEND([REGEN_JIT_COMMAND], [" --prebuilt"])])
2850+
AC_MSG_RESULT([$enable_prebuilt_jit_stencils])
2851+
28392852
if test "$disable_gil" = "yes" -a "$enable_experimental_jit" != "no"; then
28402853
# GH-133171: This configuration builds the JIT but never actually uses it,
28412854
# which is surprising (and strictly worse than not building it at all):

0 commit comments

Comments
 (0)