-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Build box and arithmetic for other types #20
Conversation
da10b53
to
27851c6
Compare
7a04736
to
262e5be
Compare
src/ast_walk_interpreter.rs
Outdated
ref env, | ||
.. | ||
} => { | ||
Function::User { ref param_names, ref body, ref env, .. } => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, not wanting these rustfmt changes will require you to rebase on master (or at least copy rustfmt.toml) ensure that it's updated, and then run rustfmt.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh, I did rebase over upstream/master
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's odd. The rustfmt lint is failing on Travis is failing too.
I think this is your rustfmt version. Mine (and Travis') is currently 0.8.3.
@polybuildr merge? |
Looked through the code, ran some manual tests, looks good. :D Thanks again for great work, merging! |
int
&float
Note that while the IR may seem eccentric at first glance, I'm dividing the different kinds of additions into fine grained calls so I can take advantage of type inference.
Since I have:
main
may seem insanely wasteful, since there's a bunch of boxing and unboxing that's going on there. However, the cool part is that I'm basically compiling to a mini register based VM, with instructions such asbox_int
,unbox_int
,add_box_box
, etc.I can implement high level fusion of operations, such as removing boxing & unboxing between consecutive arithmetic operations as a LLVM pass. This is neat, since I can now gradually lower all my function calls.
If I have type information, which I may have in lots of cases, I can raise a call of
add_box_box
toadd_box_int_add_box_int
if both the parameters involved are known to be integers. Again, this can be a custom pass calledraiseArithOperations
or something.The aim is to have a
nanopass
style compiler that gradually applies high level transformations, and then opens this up to low level optimisations (eg. inlining), which again paves the way to further high level transformations.