mntmn a49016959d big cleanup, fix imx233 and rpi2 build processes. 9 years ago
..
legacy 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
tests 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
.#fib.l 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
README.md 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
alloc.c 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
alloc.h 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
build_rpi.sh 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
build_x64.sh 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
compiler_arm_hosted.c 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
compiler_new.c 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
compiler_new.h a49016959d big cleanup, fix imx233 and rpi2 build processes. 9 years ago
compiler_x64_hosted.c 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
jit_arm_raw.c 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
jit_x64.c 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
machine.h 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
minilisp.h 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
reader.c 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
reader.h a49016959d big cleanup, fix imx233 and rpi2 build processes. 9 years ago
sledge.c 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
stream.c 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
stream.h 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
strmap.c 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
strmap.h 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
utf8.c 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
utf8.h 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
writer.c 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago
writer.h 906ac43063 cleanup stage 1 for standalone sledge build 9 years ago

README.md

mnt sledge

sledge JIT-compiles a minimal subset of LISP to a minimal subset of x64 or armv5 machine code.

dependencies

  • gcc (for building and for x64 JIT. not required for ARM JIT.)
  • optionally SDL or SDL2 for windowed framebuffer.

building (x64)

  1. Build using ./build.sh

building (rpi/ARM)

  1. Build using ./build_rpi.sh

usage

./sledge

sledge> (def my-function (fn a b (* a (+ a b))))

JIT ---------------------
push %rdi
jmp f1_0x7f6a0144ca98
f0_0x7f6a0144ca98:
push %rdi
movq %r12, %rdi
mov (%rdi), %rdi
movq %r13, %rsi
mov (%rsi), %rsi
addq %rsi, %rdi
movq %rdi, %rsi
pop %rdi
movq %r12, %rdi
mov (%rdi), %rdi
imulq %rsi, %rdi
mov $0x406f02, %rax
callq *%rax # alloc_int
ret
f1_0x7f6a0144ca98:
mov $0x7f6a0144ca98, %rax
movq %rax, %rsi
pop %rdi
movq %rax, %rsi
mov $0x7f6a0144c750, %rdi
mov $0x401b21, %rax
callq *%rax # insert_global_symbol
ret
-------------------------

sledge> (my-function 35 36)

JIT ---------------------
mov $0x7f6a0144cb28, %r12
mov $0x7f6a0144cb58, %r13
mov $0x7f6a16a8b003, %rax
callq *%rax # lambda
ret
-------------------------

2485