Skip to content

Commit 4597c74

Browse files
committed
markused: fix v -gc boehm -skip-unused cmd/vls
1 parent 727c9fb commit 4597c74

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -829,6 +829,8 @@ jobs:
829829
run: pushd vls; v cmd/vls ; popd
830830
- name: Build VLS with -prod
831831
run: pushd vls; v -prod cmd/vls; popd
832+
- name: Build VLS with -gc boehm -skip-unused
833+
run: pushd vls; v -gc boehm -skip-unused cmd/vls; popd
832834

833835
## vsl
834836
- name: Clone VSL
@@ -863,6 +865,8 @@ jobs:
863865
run: git clone --depth 1 https://github.com/vlang/vab
864866
- name: Build vab
865867
run: cd vab; ../v ./vab.v ; cd ..
868+
- name: Build vab with -gc boehm -skip-unused
869+
run: cd vab; ../v -gc boehm -skip-unused ./vab.v ; cd ..
866870

867871
## gitly
868872
- name: Install markdown
@@ -885,6 +889,8 @@ jobs:
885889
run: mkdir -p ~/.vmodules/nedpals; git clone https://github.com/nedpals/vex ~/.vmodules/nedpals/vex
886890
- name: Compile the simple Vex example
887891
run: ./v ~/.vmodules/nedpals/vex/examples/simple_example.v
892+
- name: Compile the simple Vex example with -gc boehm -skip-unused
893+
run: ./v -gc boehm -skip-unused ~/.vmodules/nedpals/vex/examples/simple_example.v
888894
- name: Run Vex Tests
889895
run: ./v test ~/.vmodules/nedpals/vex
890896

vlib/v/markused/markused.v

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -131,34 +131,17 @@ pub fn mark_used(mut table ast.Table, pref &pref.Preferences, ast_files []&ast.F
131131
]
132132
}
133133

134-
if pref.gc_mode in [.boehm_full_opt, .boehm_incr_opt] {
135-
all_fn_root_names << [
136-
'memdup_noscan',
137-
'__new_array_noscan',
138-
'__new_array_with_default_noscan',
139-
'__new_array_with_array_default_noscan',
140-
'new_array_from_c_array_noscan',
141-
'22.clone_static_to_depth_noscan',
142-
'22.clone_to_depth_noscan',
143-
'22.reverse_noscan',
144-
'22.repeat_to_depth_noscan',
145-
'65558.pop_noscan',
146-
'65558.push_noscan',
147-
'65558.push_many_noscan',
148-
'65558.insert_noscan',
149-
'65558.insert_many_noscan',
150-
'65558.prepend_noscan',
151-
'65558.prepend_many_noscan',
152-
'65558.reverse_noscan',
153-
'65558.grow_cap_noscan',
154-
'65558.grow_len_noscan',
155-
]
156-
}
134+
is_noscan_whitelisted := pref.gc_mode in [.boehm_full_opt, .boehm_incr_opt]
157135

158136
for k, mut mfn in all_fns {
159137
$if trace_skip_unused_all_fns ? {
160138
println('k: $k | mfn: $mfn.name')
161139
}
140+
// _noscan functions/methods are selected when the `-gc boehm` is on:
141+
if is_noscan_whitelisted && mfn.name.ends_with('_noscan') {
142+
all_fn_root_names << k
143+
continue
144+
}
162145
mut method_receiver_typename := ''
163146
if mfn.is_method {
164147
method_receiver_typename = table.type_to_str(mfn.receiver.typ)

0 commit comments

Comments
 (0)