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

pull/10944/head
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

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 100644

File diff suppressed because it is too large Load Diff

1081
thirdparty/libgc/gc.h vendored 100644

File diff suppressed because it is too large Load Diff

View File

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