grigory-rechistov / interpreters-comparison Goto Github PK
View Code? Open in Web Editor NEWSample programs for comparison of different VM interpretation techniques
License: BSD 3-Clause "New" or "Revised" License
Sample programs for comparison of different VM interpretation techniques
License: BSD 3-Clause "New" or "Revised" License
Currently the VM lacks any procedure mechanism. The task is to add implementation and tests:
call imm
- pushes current PC on return stack and jumps to PC+immret
- pops new PC value from stackCurently mprotect()
used in translated fails when attempted to be executed in Cygwin build. The task is to understand why it fails and fix it, possibly by rewriting the procedure for allocation of write-executable memory.
Write a separate program that takes an assembler listing and generates a raw machine code program for the VM from it.
It should be able to:
Add a mechanism to count how many times each of simulated opcode got executed.
Requirements for a solution
INSTR_STAT
macro is defined. I.e., it should be conditionally built in. Opcode Count
-------------------
Nop 1000
Halt 1
Push 1234
...
After the implementation is ready, it will be nice to compare performance of two builds - interpreter with stats enabled and disabled, to see the performance overhead such collection creates.
Add a mechanism to count how often the simulated CPU visits different program addresses by counting PC
register values.
Requirements for a solution
0x0 1000
0x2 1000
0x6 1234
...
*It can be implemented in a generic manner to support all variants of interpreters
After the implementation is ready, it will be nice to compare performance of two builds - interpreter with stats enabled and disabled, to see the performance overhead such collection creates.
Add one to three programs to the suite.
Additionally, any other computationally-intensive algorithm will be good as well
Currently the VM has 18 instructions. The task is to add and test implementation of new instructions:
And
(a b -- a & b) - logical ANDOr
(a b -- a | b) - logical ORXor
(a b -- a ^ b) - logical Exsclusive ORSHL
(a shift -- a << shift) - Shift leftSHR
(a shift -- a >> shift) - Shift rightSQRT
(x -- √x̅) - find integer square rootRot
( a b c -- b c a ) - rotate three top items on the stackPick
( a0 .. an n -- a0 .. an a0 ) - pick n-th item from the stackCurrently any "unexpected" situation inside the VM (division by zero, PC address out of range etc) puts it into the Break state. This is convenient for a software VM but unrealistic for a hardware one. For some events, an exception handling mechanism can be used to give target software a chance to correct the state.
The task is to design and implement the exception handling mechanism:
ret
to pop PC from return stackUltimately, the ISR should be capable to detect what particular interrupt happened and to correct it by either changing data state and/or emulating the instruction and skipping it in the original flow.
Currently translated
variant uses MOV; CALL
generated sequences to drive simulation to individual service routines. A fully inlined variant should insert copies of service routines in the generated code section. This will save a pair of call/return.
The steps required to complete the task:
translated
to copy capsules instead of CALL
machine code.Currently the project is only buildable/runnable on Linux GCC/ICC (possibly Clang) toolchain and buildable (with limited operation supported) on Cygwin on Windows. Native Windows support is needed.
The task is:
From the article:
Наверное, эту идею можно развить и дальше — помочь предсказателю переходов правильно запоминать историю исполнения троек, четвёрок и т.д. за счёт соответствующего «разбухания» кода. Например, иметь по две копии всех сервисных процедур, и внутри DISPATCH выбирать только одну из них, в зависимости от кода предыдущей инструкции и её адреса, или какого-то другого критерия. Однако оставлю это в качестве упражнения заинтересовавшимся исследователям.
The task is to implement this mode: double-threaded interpreter
At the moment the only program the simulator can execute is statically defined as Program
array during compilation. It would be great to be able to load external programs from files. That would add a lot of flexibility to the simulator.
Steps required:
argc, argv
parsing for optional file name, like ./switched 1000 file.raw
The file loading functionality is generic, i.e., it does not depend on used interpreter mode, so it can/should be done for all variants of the interpreter/translator
The code already demonstrates threaded interpreter, and subroutined one. The task is to combine both techniques and make a threaded-subroutined one.
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.