porglezomp / scheme-jit Goto Github PK
View Code? Open in Web Editor NEWA JIT compiler for a small scheme dialect, as a project for Advanced Compilers.
A JIT compiler for a small scheme dialect, as a project for Advanced Compilers.
We need an instruction that will let us do a fast verification that a function is the same as before, PTR_EQ
still seems like the correct one here.
Currently running typeof fn
will raise a ValueError
.
Builtin functions should include error-checking instructions where appropriate
Type and array bounds checks need to be able to terminate the program on failure
This gives us a way to hard-code function addresses in trace specialization code, ensuring that we are getting the same function, which lets us skip the dynamic checks.
For debugging!
(trace x) ; prints x
(breakpoint) ; calls the python breakpoint() function
We need a way to check that a function has a compatible arity before we call it. This is made more complex by the desire to make sure that our approach supports variadic functions. Even if we don't implement them, we should generate bytecode that checks variadic compatibility, for more realistic bounds check elimination.
Variadic handling:
Possibly return -1
for variadic arguments, -2
for variadic arguments with 1 required parameter, etc? If we use this scheme, then:
(define (func2 v0)
(func v0))
Compiles to:
function (v0) entry=bb0
bb0:
v1 = lookup 'func
v2 = typeof v1
v3 = sym_eq v2 'function
brn v3 bb3
v4 = arity v1
v5 = num_lt v4 0
br v5 bb1
v6 = num_eq v4 1
br v6 bb2
trap "Arity mismatch"
bb1:
v7 = sub -1 v4
v8 = num_lt 1 v7
brn v8 bb4
trap "Not enough parameters"
bb2:
v9 = call v1 (v0)
return v9
bb3:
trap "Called non-function"
Currently, there's an assertion it the interpreter that makes sure the branch is given a bool. We should either:
We need a special form for sequencing multiple things, because I need to do multiple things in an if
block.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.