rrthomas / mijit-beetle Goto Github PK
View Code? Open in Web Editor NEWAn implementation of the Beetle VM with the Mijit JIT compiler generator
An implementation of the Beetle VM with the Mijit JIT compiler generator
Caused by rust-lang/compiler-builtins#443, fixed in Rust 1.59 (with a bit of luck!).
Importing from Mijit #5.
The code()
method of vm::machine::Machine
has unnecessary complexity in a number of ways:
The code for Lshift
and Rshift
differs only in one BinaryOp
.
The following code sequence is common, and could be abbreviated:
b.load_global(<reg>, <global>);
b.const_binary(<op>, <reg>, <reg>, <constant>);
b.store_global(<reg>, <global>);
Usually, <op>
is Add
and <constant>
is cell_bytes(<int>)
.
The following code sequence is common, and could be abbreviated:
b.const_binary(Add, <reg>, <value>, cell_bytes(<n>));
b.load(RD, <reg>);
Code to increment B_EP
and jump to Root
is common. It occurs in: Qbranch
, Loop
.
The code for Ploopp
and Ploopm
appears to be identical.
The code for Ploopip
and Ploopim
appears to be identical.
The code for Ploop
and Ploopi
differs only in the State
s they jump to.
The difference between instructions and their i
variant are very small and could be parametrized. This occurs in: Qbranch
, Loop
, Ploop
.
The difference between 0
, 1
, -1
, CELL
and -CELL
could be parametrized.
The difference between the various unary operators could be parametrized.
The difference between the various binary operators could be parametrized.
The difference between the various item op constant
operators could be parametrized.
The difference between the various constant op item
operators could be parametrized.
The difference between the various <reg>@
operators could be parametrized.
The difference between the various <reg>!
operators could be parametrized.
Currently Mijit Beetle can be used as a stand-alone virtual machine. However, it is limited and possibly buggy, and nobody is using it that way. Maybe in the future we will want to write Rust Beetle, but for now the main use of Mijit Beetle is as part of C Beetle. Therefore, focus on that use case.
main.rs
.M0
and the pointer to the register struct as extra arguments to mijit_beetle_run()
or mijit_beetle_init()
.struct AllRegisters
(leaving only struct Registers
) and use three extra Global
s e.g. as follows:
M0
.R2
.R3
.lib.rs
on struct VM
, by reimplementing it in terms of machine
directly. This basically involves inlining the methods of VM
into their callers.mod vm
and mod machine
and annotate mod vm
with #[cfg(test)]
.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.