1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

builtin: add bdwgc to thirdparty, statically link it on Windows (#10542)

This commit is contained in:
spaceface 2021-07-24 15:04:26 +02:00 committed by GitHub
parent 42bf385ff9
commit a621149fc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31377 additions and 9 deletions

7
thirdparty/libgc/amalgamation.txt vendored Normal file
View File

@ -0,0 +1,7 @@
The libgc source is distributed here as an amalgamation (https://sqlite.org/amalgamation.html).
This means that, rather than mirroring the entire bdwgc repo here,
[this script](https://gist.github.com/spaceface777/34d25420f2dc4953fb7864f44a211105) was used
to bundle all local includes together into a single C file, which is much easier to handle.
Furthermore, the script above was also used to minify (i.e. remove comments and whitespace in)
the garbage collector source. Together, these details help keep the V source distribution small,
can reduce compile times by 3%-15%, and can help C compilers generate more optimized code.

30266
thirdparty/libgc/gc.c vendored Normal file

File diff suppressed because it is too large Load Diff

1081
thirdparty/libgc/gc.h vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
module builtin
#define GC_THREADS 1
#flag -DGC_THREADS=1
$if static_boehm ? {
$if macos {
@ -13,10 +13,16 @@ $if static_boehm ? {
#flag /usr/local/lib/libgc.a
#flag -lpthread
} $else $if windows {
#define GC_NOT_DLL 1
#flag -DGC_NOT_DLL=1
$if tinyc {
#flag -I@VEXEROOT/thirdparty/libgc/include
#flag -L@VEXEROOT/thirdparty/libgc
#flag -lgc
} $else {
#flag -DGC_BUILTIN_ATOMIC=1
#flag -I@VEXEROOT/thirdparty/libgc
#flag @VEXEROOT/thirdparty/libgc/gc.o
}
} $else {
#flag -lgc
}
@ -28,14 +34,22 @@ $if static_boehm ? {
#flag -L/usr/local/lib
}
$if windows {
$if tinyc {
#flag -I@VEXEROOT/thirdparty/libgc/include
#flag -L@VEXEROOT/thirdparty/libgc
}
#flag -lgc
} $else {
#flag -DGC_BUILTIN_ATOMIC=1
#flag -I@VEXEROOT/thirdparty/libgc
#flag @VEXEROOT/thirdparty/libgc/gc.o
}
} $else {
#flag -lgc
}
}
$if gcboehm_leak ? {
#define GC_DEBUG
#flag -DGC_DEBUG=1
}
#include <gc.h>