Skip to content

Preference hash ignores load_preference usage from other packages #86

@topolarity

Description

@topolarity

If you want to load a preference associated with a dependency:

const _format = load_preference(MPIPreferences, "_format") # access 'third-party' preference

This access does not end up recorded in the preferences hash for the pkgimage, so changes to the preference due not trigger re-compilation properly.

The problem is that it will end up in Base.COMPILETIME_PREFERENCES, but the entries will be ignored since Julia only queries for the preferences associated with the "top-level" module:

// call get_compiletime_prefs(__toplevel__)
jl_value_t *args[3] = {get_compiletime_prefs_func, (jl_value_t*)toplevel, NULL};
prefs_list = (jl_value_t*)jl_apply(args, 2);
JL_TYPECHK(write_dependency_list, array, prefs_list);

// Call get_preferences_hash(__toplevel__, prefs_list)
args[0] = prefs_hash_func;
args[2] = prefs_list;
prefs_hash = (jl_value_t*)jl_apply(args, 3);
JL_TYPECHK(write_dependency_list, uint64, prefs_hash);

https://github.com/JuliaLang/julia/blob/e0d49ac51b8e8253b94723e4945fca224cd6437f/src/staticdata_utils.c#L810

It seems like this code is confused about the package associated with the definition vs. the usage - the key in Base.COMPILETIME_PREFERENCES is the module associated with the preference definition, not the usage / dependency.

(fwiw, Base.COMPILETIME_PREFERENCES should only ever include preferences accessed during the current pre-compilation run - iiuc, keying / filtering should not be necessary at all)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions