2015-07-03 19:13:03 +02:00
|
|
|
Register Machine
|
2015-10-22 16:38:49 +02:00
|
|
|
================
|
2014-04-25 12:29:12 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
The RegisterMachine, is an abstract machine with registers. Think of it as an arm machine with
|
|
|
|
normal instruction names. It is not however an abstraction of existing hardware, but only
|
|
|
|
of that subset that we need.
|
2014-04-25 12:29:12 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
Our primary objective is to compile Phisol to this level, so the register machine has:
|
|
|
|
- object access instructions
|
|
|
|
- object load
|
|
|
|
- object oriented call semantics
|
|
|
|
- extended (and extensible) branching
|
|
|
|
- normal integer operators (but no sub word instructions)
|
2014-04-25 12:29:12 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
All data is in objects.
|
2014-05-25 09:57:56 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
The register machine is aware of Parfait objects, and specifically uses Message and Frame to
|
|
|
|
express call semantics.
|
2014-05-25 09:57:56 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
Calls and syscalls
|
|
|
|
------------------
|
2014-05-25 09:57:56 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
The RegisterMachine only uses 1 fixed register, the currently worked on Message.
|
2014-05-25 09:57:56 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
There is no stack, rather messages form a linked list, and preparing to call, the data is pre-filled
|
|
|
|
into the next message. Calling then means moving the new message to the current one and jumping
|
|
|
|
to the address of the method. Returning is the somewhat reverse process.
|
2014-05-25 09:57:56 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
Syscalls are implemented by *one* Syscall instruction. The Register machine does not specify/limit
|
|
|
|
the meaning or number of syscalls. This is implemented by the level below, eg the arm/interpreter.
|
2014-05-25 09:57:56 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
Interpreter
|
|
|
|
===========
|
2014-05-25 09:57:56 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
There is an interpreter that can interpret compiled register machine programs.
|
|
|
|
This is very handy for debugging (an nothing else).
|
2014-05-25 09:57:56 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
Even more handy is the graphical interface for the interpreter, which is in it's own repository:
|
|
|
|
salama-debugger.
|
2014-08-28 18:12:46 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
Arm / Elf
|
|
|
|
=========
|
2014-08-28 18:12:46 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
There is also a (very strightforward) transformation to arm instructions.
|
|
|
|
Together with the also quite minimal elf module, arm binaries can be produced.
|
2014-08-28 18:12:46 +02:00
|
|
|
|
2015-10-22 16:38:49 +02:00
|
|
|
These binaries have no external dependencies and in fact can not even call c at the moment
|
|
|
|
(only syscalls :-)).
|