mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-12 14:09:12 +00:00
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:
parent
0ad609268f
commit
33e8fc8687
26 changed files with 192 additions and 182 deletions
|
@ -40,14 +40,14 @@ __nt2sysv:
|
|||
pushf
|
||||
ezlea _base,bx
|
||||
lea -0x80(%rbp),%rdi
|
||||
call savexmm
|
||||
call _savexmm
|
||||
mov %rcx,%rdi
|
||||
mov %rdx,%rsi
|
||||
mov %r8,%rdx
|
||||
mov %r9,%rcx
|
||||
call *%rax
|
||||
lea -0x80(%rbp),%rdi
|
||||
call loadxmm
|
||||
call _loadxmm
|
||||
popf
|
||||
pop %rsi
|
||||
pop %rdi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue