Expose public garbage collector API for C language

You can now do epic things like this:

    puts(_gc(xasprintf("%d", 123)));

The _gc() API is shorthand for _defer() which works like Go's keyword:

    const char *s = xasprintf("%d", 123);
    _defer(free, s);
    puts(s);

Be sure to always use -fno-omit-frame-pointer which makes code fast too.

Enjoy! See also #114
This commit is contained in:
Justine Tunney 2021-03-08 10:56:09 -08:00
parent 0ad609268f
commit 33e8fc8687
26 changed files with 192 additions and 182 deletions

View file

@ -23,7 +23,7 @@
//
// @param %rdi points to &(forcealign(16) uint8_t[256])[128]
// @note modern cpus have out-of-order execution engines
savexmm:
_savexmm:
.leafprologue
movaps %xmm0,-0x80(%rdi)
movaps %xmm1,-0x70(%rdi)
@ -42,5 +42,4 @@ savexmm:
movaps %xmm14,0x60(%rdi)
movaps %xmm15,0x70(%rdi)
.leafepilogue
.endfn savexmm,globl,hidden
.source __FILE__
.endfn _savexmm,globl,hidden