Real native machine code via mmap(PROT_EXEC). No exec(). No strings. Raw x86_64 bytes: mov, add, sub, imul, cmp, je, jne, call, ret, jmp. ack(3,4): 0.12ms JIT vs 1.5ms CPython vs 28ms interpreter fib-rec(20): 0.16ms JIT vs 3.4ms CPython vs 40ms interpreter Added cond support to JIT (cascaded comparisons → conditional jumps). Fixed JIT cache: sentinel value prevents retry on unjittable functions. System V AMD64 ABI: args in rdi/rsi/rdx, callee-saved r12-r15. Tail calls use jmp (true TCO at machine code level). 691 lines of jit.c. 114 functional tests pass. All C tests pass.
39 lines
880 B
Makefile
39 lines
880 B
Makefile
# Makefile for uncommonlisp C interpreter
|
|
# Targets: all, test, bench, clean
|
|
|
|
CC = gcc
|
|
CFLAGS = -O2 -Wall -Wextra -Wno-unused-parameter -std=c11 -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE
|
|
LDFLAGS = -lm
|
|
|
|
# Optional: Boehm GC support
|
|
# Uncomment the next two lines if libgc-dev is installed
|
|
# CFLAGS += -DUSE_BOEHM_GC
|
|
# LDFLAGS += -lgc
|
|
|
|
SRCS = types.c reader.c printer.c eval.c builtins.c vm.c jit.c
|
|
OBJS = $(SRCS:.c=.o)
|
|
|
|
.PHONY: all clean test bench
|
|
|
|
all: uncommonlisp
|
|
|
|
uncommonlisp: main.o $(OBJS)
|
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
|
|
|
test: test_runner
|
|
./test_runner
|
|
|
|
test_runner: test.c $(OBJS)
|
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
|
|
|
bench: bench_runner uncommonlisp
|
|
ulimit -s 65536 && ./bench_runner
|
|
|
|
bench_runner: bench.c $(OBJS)
|
|
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
|
|
|
|
%.o: %.c uncommonlisp.h
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
clean:
|
|
rm -f *.o uncommonlisp test_runner bench_runner
|