mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: enable -gc boehm
by default (#14577)
This commit is contained in:
parent
e6580fefaa
commit
4ed9780b80
4
.github/workflows/ci_cross.yml
vendored
4
.github/workflows/ci_cross.yml
vendored
@ -45,7 +45,7 @@ jobs:
|
||||
- name: Compile to raw Android (non-graphic) compatible
|
||||
run: |
|
||||
# Test that V can compile non-graphic app to Android compatible code *without* using the -apk flag
|
||||
./v -os android examples/toml.v
|
||||
./v -os android -gc none examples/toml.v
|
||||
|
||||
linux-cross:
|
||||
runs-on: ubuntu-20.04
|
||||
@ -98,7 +98,7 @@ jobs:
|
||||
- name: toml.v can be compiled to raw Android C
|
||||
run: |
|
||||
# Test that V can compile non-graphic app to Android compatible code *without* using the -apk flag
|
||||
./v -os android examples/toml.v
|
||||
./v -os android -gc none examples/toml.v
|
||||
|
||||
|
||||
windows-cross:
|
||||
|
2
.github/workflows/ci_sanitized.yml
vendored
2
.github/workflows/ci_sanitized.yml
vendored
@ -228,7 +228,7 @@ jobs:
|
||||
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
|
||||
timeout-minutes: 180
|
||||
env:
|
||||
VFLAGS: -cc clang
|
||||
VFLAGS: -cc clang -gc none
|
||||
VJOBS: 1
|
||||
VTEST_SHOW_START: 1
|
||||
steps:
|
||||
|
4
.github/workflows/containers_ci.yml
vendored
4
.github/workflows/containers_ci.yml
vendored
@ -17,7 +17,7 @@ jobs:
|
||||
alpine-docker-musl-gcc:
|
||||
runs-on: ubuntu-20.04
|
||||
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
|
||||
timeout-minutes: 121
|
||||
timeout-minutes: 181
|
||||
container:
|
||||
# Alpine docker pre-built container
|
||||
image: thevlang/vlang:alpine-build
|
||||
@ -58,7 +58,7 @@ jobs:
|
||||
env:
|
||||
V_CI_MUSL: 1
|
||||
V_CI_UBUNTU_MUSL: 1
|
||||
VFLAGS: -cc musl-gcc
|
||||
VFLAGS: -cc musl-gcc -gc none
|
||||
volumes:
|
||||
- ${{github.workspace}}:/opt/vlang
|
||||
|
||||
|
1
.github/workflows/vab_ci.yml
vendored
1
.github/workflows/vab_ci.yml
vendored
@ -14,6 +14,7 @@ jobs:
|
||||
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
|
||||
timeout-minutes: 121
|
||||
env:
|
||||
VFLAGS: -gc none
|
||||
VAB_FLAGS: --api 30 --build-tools 29.0.0 -v 3
|
||||
steps:
|
||||
- uses: actions/setup-java@v2
|
||||
|
2
.github/workflows/vinix-kernel.yml
vendored
2
.github/workflows/vinix-kernel.yml
vendored
@ -14,6 +14,8 @@ jobs:
|
||||
vinix-build:
|
||||
runs-on: ubuntu-20.04
|
||||
if: github.event_name != 'push' || github.event.ref == 'refs/heads/master' || github.event.repository.full_name != 'vlang/v'
|
||||
env:
|
||||
VFLAGS: -gc none
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
|
@ -28,6 +28,9 @@ endif
|
||||
ifeq ($(_SYS),Linux)
|
||||
LINUX := 1
|
||||
TCCOS := linux
|
||||
ifneq ($(shell ldd /bin/ls | grep musl),)
|
||||
TCCOS := linuxmusl
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(_SYS),Darwin)
|
||||
|
@ -93,6 +93,13 @@ fn (mut v Builder) post_process_c_compiler_output(res os.Result) {
|
||||
}
|
||||
return
|
||||
}
|
||||
if res.exit_code != 0 && v.pref.gc_mode != .no_gc && res.output.contains('libgc.a') {
|
||||
$if windows {
|
||||
verror(r'Your V installation may be out-of-date. Try removing `thirdparty\tcc\` and running `.\make.bat`')
|
||||
} $else {
|
||||
verror('Your V installation may be out-of-date. Try removing `thirdparty/tcc/` and running `make`')
|
||||
}
|
||||
}
|
||||
for emsg_marker in [builder.c_verror_message_marker, 'error: include file '] {
|
||||
if res.output.contains(emsg_marker) {
|
||||
emessage := res.output.all_after(emsg_marker).all_before('\n').all_before('\r').trim_right('\r\n')
|
||||
|
@ -117,10 +117,14 @@ pub fn (cflags []CFlag) defines_others_libs() ([]string, []string, []string) {
|
||||
mut others := []string{}
|
||||
mut libs := []string{}
|
||||
for copt in copts_without_obj_files {
|
||||
if copt.starts_with('-l') || copt.ends_with('.a') {
|
||||
if copt.starts_with('-l') {
|
||||
libs << copt
|
||||
continue
|
||||
}
|
||||
if copt.ends_with('.a') {
|
||||
libs << '"$copt"'
|
||||
continue
|
||||
}
|
||||
if copt.starts_with('-D') {
|
||||
defines << copt
|
||||
continue
|
||||
|
@ -85,6 +85,18 @@ pub fn (mut p Preferences) fill_with_defaults() {
|
||||
}
|
||||
rpath_name := os.file_name(rpath)
|
||||
p.building_v = !p.is_repl && (rpath_name == 'v' || rpath_name == 'vfmt.v')
|
||||
if p.gc_mode == .unknown {
|
||||
if p.backend != .c || p.building_v || p.is_bare || p.ccompiler == 'msvc' {
|
||||
p.gc_mode = .no_gc
|
||||
p.build_options << ['-gc', 'none']
|
||||
} else {
|
||||
// enable the GC by default
|
||||
p.gc_mode = .boehm_full_opt
|
||||
p.parse_define('gcboehm')
|
||||
p.parse_define('gcboehm_full')
|
||||
p.parse_define('gcboehm_opt')
|
||||
}
|
||||
}
|
||||
if p.os == ._auto {
|
||||
// No OS specifed? Use current system
|
||||
p.os = get_host_os()
|
||||
|
@ -24,6 +24,7 @@ pub enum AssertFailureMode {
|
||||
}
|
||||
|
||||
pub enum GarbageCollectionMode {
|
||||
unknown
|
||||
no_gc
|
||||
boehm_full // full garbage collection mode
|
||||
boehm_incr // incremental garbage colletion mode
|
||||
@ -204,7 +205,7 @@ pub mut:
|
||||
cleanup_files []string // list of temporary *.tmp.c and *.tmp.c.rsp files. Cleaned up on successfull builds.
|
||||
build_options []string // list of options, that should be passed down to `build-module`, if needed for -usecache
|
||||
cache_manager vcache.CacheManager
|
||||
gc_mode GarbageCollectionMode = .no_gc // .no_gc, .boehm, .boehm_leak, ...
|
||||
gc_mode GarbageCollectionMode = .unknown // .no_gc, .boehm, .boehm_leak, ...
|
||||
assert_failure_mode AssertFailureMode // whether to call abort() or print_backtrace() after an assertion failure
|
||||
message_limit int = 100 // the maximum amount of warnings/errors/notices that will be accumulated
|
||||
nofloat bool // for low level code, like kernels: replaces f32 with u32 and f64 with u64
|
||||
@ -327,9 +328,15 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin
|
||||
'-gc' {
|
||||
gc_mode := cmdline.option(current_args, '-gc', '')
|
||||
match gc_mode {
|
||||
'', 'none' {
|
||||
'none' {
|
||||
res.gc_mode = .no_gc
|
||||
}
|
||||
'', 'boehm' {
|
||||
res.gc_mode = .boehm_full_opt // default mode
|
||||
res.parse_define('gcboehm')
|
||||
res.parse_define('gcboehm_full')
|
||||
res.parse_define('gcboehm_opt')
|
||||
}
|
||||
'boehm_full' {
|
||||
res.gc_mode = .boehm_full
|
||||
res.parse_define('gcboehm')
|
||||
@ -352,12 +359,6 @@ pub fn parse_args_and_show_errors(known_external_commands []string, args []strin
|
||||
res.parse_define('gcboehm_incr')
|
||||
res.parse_define('gcboehm_opt')
|
||||
}
|
||||
'boehm' {
|
||||
res.gc_mode = .boehm_full_opt // default mode
|
||||
res.parse_define('gcboehm')
|
||||
res.parse_define('gcboehm_full')
|
||||
res.parse_define('gcboehm_opt')
|
||||
}
|
||||
'boehm_leak' {
|
||||
res.gc_mode = .boehm_leak
|
||||
res.parse_define('gcboehm')
|
||||
|
@ -86,7 +86,7 @@ fn test_all() {
|
||||
base_filename := os.file_name(test).replace('.v', '')
|
||||
exe_filename := '$wrkdir/$base_filename'
|
||||
full_path_to_source_file := os.join_path(vroot, test)
|
||||
compile_cmd := '${os.quoted_path(vexe)} -o ${os.quoted_path(exe_filename)} -cg -cflags "-w" -experimental -autofree ${os.quoted_path(full_path_to_source_file)}'
|
||||
compile_cmd := '${os.quoted_path(vexe)} -o ${os.quoted_path(exe_filename)} -cg -cflags "-w" -experimental -gc none -autofree ${os.quoted_path(full_path_to_source_file)}'
|
||||
vprintln('compile cmd: ${bold(compile_cmd)}')
|
||||
res := os.execute(compile_cmd)
|
||||
if res.exit_code != 0 {
|
||||
|
@ -55,7 +55,14 @@ pub fn new_cache_manager(opts []string) CacheManager {
|
||||
os.write_file(readme_file, readme_content) or { panic(err) }
|
||||
dlog(@FN, 'created readme_file:\n $readme_file')
|
||||
}
|
||||
original_vopts := opts.join('|')
|
||||
mut deduped_opts := map[string]bool{}
|
||||
for o in opts {
|
||||
deduped_opts[o] = true
|
||||
}
|
||||
deduped_opts_keys := deduped_opts.keys().filter(it != '' && !it.starts_with("['gcboehm', "))
|
||||
// TODO: do not filter the gcboehm options here, instead just start `v build-module vlib/builtin` without the -d gcboehm etc.
|
||||
// Note: the current approach of filtering the gcboehm keys may interfere with (potential) other gc modes.
|
||||
original_vopts := deduped_opts_keys.join('|')
|
||||
return CacheManager{
|
||||
basepath: vcache_basepath
|
||||
vopts: original_vopts
|
||||
|
Loading…
Reference in New Issue
Block a user