rubyx/lib/risc
Torsten Ruger e6615d0a6a remove the old add_new_int and calls
last orrurences in syscalls replaced, 2 variants
- exit does not actually need the int
- all else, preallocate the int beforehand and in syscall assume the reg name (integer_tmp)

test missing
2018-11-22 09:16:56 +02:00
..
builtin remove the old add_new_int and calls 2018-11-22 09:16:56 +02:00
instructions First part of int allocation 2018-11-21 11:12:39 +02:00
position fix more of the changed names 2018-08-12 13:10:44 +03:00
assembler.rb generalize assemblers to use callables 2018-07-30 10:23:42 +03:00
binary_writer.rb jump was written off the end of binary code, fixed 2018-05-28 11:45:04 +03:00
block_compiler.rb move dynamic_call to builder 2018-08-16 10:43:41 +03:00
builder.rb remove the old add_new_int and calls 2018-11-22 09:16:56 +02:00
builtin.rb new get_type_by_class_name helper for space 2018-07-13 21:50:40 +03:00
callable_compiler.rb First part of int allocation 2018-11-21 11:12:39 +02:00
collector.rb remove the last_object from chain 2018-08-29 21:05:54 +03:00
fake_memory.rb cache index resolution 2018-08-12 13:09:34 +03:00
instruction.rb block test 2018-07-30 14:10:24 +03:00
interpreter_platform.rb fix platform derivation and some tests 2018-07-01 21:27:27 +03:00
interpreter.rb misc 2018-07-30 10:26:47 +03:00
linker.rb Move booting to RubyXCompiler init 2018-09-02 13:57:19 +03:00
method_compiler.rb move dynamic_call to builder 2018-08-16 10:43:41 +03:00
padding.rb fix opal error 2018-05-20 15:51:36 +03:00
parfait_adapter.rb cache index resolution 2018-08-12 13:09:34 +03:00
parfait_boot.rb let spce keep the messages in a factory #14 2018-09-01 11:24:16 +03:00
platform.rb platform helper 2018-07-02 09:36:29 +03:00
README.md litte bit of docs 2018-08-24 18:49:44 +03:00
register_value.rb add the addresses from labels as constants 2018-08-29 21:06:29 +03:00
text_writer.rb fix address nil values 2018-08-30 16:38:00 +03:00

Risc Machine

The Risc Machine, 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.

Our primary objective is to compile typed code to this level, so the register machine has:

  • object access instructions
  • object load
  • object oriented call semantics
  • extended (and extensible) branching
  • normal integer operators

All data is in objects.

The register machine is aware of Parfait objects, and specifically uses Message and Frame to express call semantics.

Calls and syscalls

The Risc Machine only uses 1 fixed register, the currently worked on Message. (and assumes a program counter and flags, neither of which are directly manipulated)

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.

Syscalls are implemented by one Syscall instruction. The Risc machine does not specify/limit the meaning or number of syscalls. This is implemented by the level below, eg the arm/interpreter.

Interpreter

There is an interpreter that can interpret programs compiled to the risc instruction set. This is very handy for debugging (and nothing else).

Even more handy is the graphical interface for the interpreter, which is in it's own repository: rubyx-debugger.

Arm / Elf

There is also a (very straightforward) transformation to arm instructions. Together with the also quite minimal elf module, arm binaries can be produced.

These binaries have no external dependencies and in fact can not even call c at the moment (only syscalls :-)).