mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-22 21:32:31 +00:00
Add The LISP Challenge
This change introduces a 2.5kb program that's comes pretty close so far to bootstrapping John McCarthy's metacircular evaluator on bare metal.
This commit is contained in:
parent
fd22e55b42
commit
b6793d42d5
34 changed files with 1056 additions and 358 deletions
|
@ -238,7 +238,7 @@ static void __asan_deallocate(char *p, int kind) {
|
|||
if ((*s < 0 && *s != kAsanHeapOverrun) || *s >= 8) {
|
||||
__asan_report_deallocate_fault(p, *s);
|
||||
}
|
||||
for (; *s >= 0; ++s) *s = kind;
|
||||
memset(s, kind, dlmalloc_usable_size(p) >> 3);
|
||||
dlfree(__asan_morgue_add(p));
|
||||
}
|
||||
|
||||
|
|
|
@ -69,8 +69,6 @@ o/$(MODE)/libc/runtime/winmain.greg.o: \
|
|||
DEFAULT_CPPFLAGS += \
|
||||
-DSTACK_FRAME_UNLIMITED
|
||||
|
||||
o/$(MODE)/libc/runtime/main-gcc.asm: OVERRIDE_CFLAGS += -ffixed-r12 -ffixed-r13 -ffixed-r14 -ffixed-r15
|
||||
|
||||
LIBC_RUNTIME_LIBS = $(foreach x,$(LIBC_RUNTIME_ARTIFACTS),$($(x)))
|
||||
LIBC_RUNTIME_SRCS = $(foreach x,$(LIBC_RUNTIME_ARTIFACTS),$($(x)_SRCS))
|
||||
LIBC_RUNTIME_HDRS = $(foreach x,$(LIBC_RUNTIME_ARTIFACTS),$($(x)_HDRS))
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#include "libc/nexgen32e/bsr.h"
|
||||
|
||||
#define ThomPikeCont(x) ((x & 0b11000000) == 0b10000000)
|
||||
#define ThomPikeByte(x) (x & (((1 << (x < 252 ? bsr(~x & 0xff) : 1)) - 1) | 3))
|
||||
#define ThomPikeByte(x) (x & (((1 << ThomPikeMsb(x)) - 1) | 3))
|
||||
#define ThomPikeLen(x) (7 - ThomPikeMsb(x))
|
||||
#define ThomPikeMsb(x) (x < 252 ? bsr(~x & 0xff) : 1)
|
||||
|
||||
#endif /* COSMOPOLITAN_LIBC_STR_THOMPIKE_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue