Skip to content

Commit 590ec35

Browse files
committed
v3: key cold cache objects by program wrappers
1 parent cefad10 commit 590ec35

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

vlib/v3/driver/driver.v

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10546,8 +10546,9 @@ fn prepare_v3_module_cache(generated_source string, cache_used_fns &map[string]b
1054610546
''
1054710547
}
1054810548
declarations := cache_source_without_cached_native_inputs(raw_declarations, state, false)
10549-
compile_signature := v3_cached_object_compile_signature(c_standard, opt_flag, pic_flag,
10550-
warning_flags, generated_c_flags, objective_c, interface_impl_signature)
10549+
compile_signature := v3_cached_object_wrapper_compile_signature(v3_cached_object_compile_signature(c_standard,
10550+
opt_flag, pic_flag, warning_flags, generated_c_flags, objective_c, interface_impl_signature),
10551+
generated_source)
1055110552
if resolve_flag_specific_cache_objects(mut state, compile_signature) {
1055210553
os.setenv('V3_CACHE_FORCE_SOURCE', '1', true)
1055310554
restart_v3_after_cache_invalidation()

vlib/v3/tests/module_cache_test.v

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,9 @@ fn main() {
11071107
first_output := os.join_path(root, 'first')
11081108
compile_module_cache_project(v3_bin, cache_dir, first_main, first_output)
11091109
assert run_module_cache_binary(first_output) == '42'
1110+
first_builtin_objects :=
1111+
module_cache_object_hashes(cache_dir).keys().filter(it.starts_with('builtin_'))
1112+
assert first_builtin_objects.len > 0
11101113

11111114
second_main := os.join_path(root, 'second_main.v')
11121115
write_module_cache_file(root, 'second_main.v', 'module main
@@ -1118,6 +1121,9 @@ fn main() {
11181121
second_output := os.join_path(root, 'second')
11191122
compile_module_cache_project(v3_bin, cache_dir, second_main, second_output)
11201123
assert run_module_cache_binary(second_output) == '42'
1124+
second_builtin_objects :=
1125+
module_cache_object_hashes(cache_dir).keys().filter(it.starts_with('builtin_'))
1126+
assert second_builtin_objects.len > first_builtin_objects.len
11211127
}
11221128

11231129
fn test_module_cache_static_inline_attributes_are_not_storage() {

0 commit comments

Comments
 (0)