Add disable_optimization JLLWrappers preference#89
Merged
topolarity merged 6 commits intoMay 8, 2026
Merged
Conversation
Adds a module-level const read from Preferences (default true) and gates JLLWrappers' own @compiler_options on it. Default behavior unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
When the JLLWrappers preference disable_optimization is false, generate_compiler_options returns nothing, suppressing the per-JLL @compiler_options / @optlevel emission. excat already filters nothing out, so no caller-side changes are needed. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
JLLWrappers.disable_optimization is fixed at module load time, so exercising the false branch requires a fresh Julia subprocess with the preference set in LocalPreferences.toml before JLLWrappers is loaded. The subprocess loads JLLWrappers and HelloWorldC_jll and verifies they work correctly with optimization gating turned off. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous version interpolated Windows paths (with backslashes) into
a script string passed via -e, where Windows command-line quoting
mangled the backslashes ('syntax: "\\" is not a unary operator' on
Julia 1.7 Windows). Write the script to a file instead and use
repr(path) for portable Julia string literals; this sidesteps all
shell quoting on every platform.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
vchuravy
reviewed
Apr 30, 2026
Per review feedback, replace the chain of println() calls with a single """...""" string. repr() still quotes the interpolated paths so Windows backslashes stay escaped. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
FreeBSD CI failures are the same as on main. |
asinghvi17
commented
May 6, 2026
topolarity
approved these changes
May 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using a system image generated by package compiler (that of course contains some JLLs) to perform JuliaC-based compilation with
--trim, it turned out that the changing of the compile mode in JLL wrappers was causing issues. This introduces a preference to fix that.Summary
disable_optimizationPreference (defaulttrue) that gates every optimization-disabling compiler directive JLLWrappers emits — both inJLLWrappers.jlitself and in each generated*_jllviagenerate_compiler_options.false, no@compiler_options compile=min optimize=0 infer=false(or older@optlevel 0) directive is emitted, so JLLs and JLLWrappers compile at the user's normal optimization level.true.Motivation
There was no way to opt JLL packages into normal compiler optimization. Users with hot JLL-resident code or those benchmarking JLL-loaded libraries want to be able to do so. This PR adds a single boolean preference scoped to
JLLWrappersthat controls all of JLLWrappers' optimization-disabling emissions in one place.Set it via
Preferences.set_preferences!:Preferences.jl invalidates the JLLWrappers precompile cache on change, which cascades to all
*_jllpackages.Test plan
disable_optimization=truepath).@test JLLWrappers.disable_optimization === trueasserts the const default.@testset "disable_optimization=false"exercises the false branch in a subprocess (since the const is fixed at module load time, can't be flipped within the same Julia session): writesLocalPreferences.tomlwithdisable_optimization = false, develops JLLWrappers andHelloWorldC_jllin a fresh project, verifies the const reflects the override and that the JLL still loads and resolves binaries.🤖 Generated with Claude Code