New , simpler architecture picture
and misc
This commit is contained in:
parent
f58cc40735
commit
6e8864b238
BIN
app/assets/images/architecture.png
Normal file
BIN
app/assets/images/architecture.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
@ -58,6 +58,9 @@ main , header , footer
|
||||
.full_width
|
||||
img
|
||||
width: 100%
|
||||
.three_width
|
||||
img
|
||||
width: 67%
|
||||
.debug_pic
|
||||
border-color: white
|
||||
border-width: 8px
|
||||
|
@ -1,10 +1,11 @@
|
||||
= render "pages/project/menu"
|
||||
|
||||
%h1= title "Ruby in Ruby"
|
||||
%p
|
||||
%h1.center= title "Ruby in Ruby"
|
||||
%p.center
|
||||
%span
|
||||
RubyX hopes make the the mysterious more accessible, shed light in the farthest (ruby) corners, and above all,
|
||||
%em empower you
|
||||
RubyX hopes to make the the mysterious more accessible, shed light in the farthest (ruby) corners, and above all,
|
||||
%em empower
|
||||
you.
|
||||
.row
|
||||
.tripple
|
||||
%h2.center A better tool, a better job
|
||||
@ -14,8 +15,8 @@
|
||||
better in almost every way.
|
||||
The only downside is speed and we argue that with cheap resources.
|
||||
%p
|
||||
Why it has taken this long to even seriously attempt a ruby implementation in ruby is due to the overwhelming
|
||||
influence of C (folks), especially at the time.
|
||||
Why it has taken this long to even seriously attempt a ruby implementation in ruby is
|
||||
due to the overwhelming influence of C (folks), especially at the time.
|
||||
%p
|
||||
Just a short and subjective list of why ruby is the better tool:
|
||||
%ul
|
||||
@ -30,50 +31,53 @@
|
||||
Rails has evolved tremendously from what was already a good start. All the development
|
||||
%em around
|
||||
it has nurtured
|
||||
ruby developement in all areas. Rails and all those parts make up a most mature and advanced software system.
|
||||
%p The "rails effect" is due to the accessibility of the system, imho. Ie it is written in ruby.
|
||||
ruby developement in all areas. Rails and all those parts make up a most mature and
|
||||
advanced software system.
|
||||
%p
|
||||
Ruby itself has not enjoyed this rails effect, and that is because it is written in C
|
||||
Crystal, Rust, Go Julia etc, have, for the exact same reason.
|
||||
The "rails effect" is due to the accessibility of the system, imho.
|
||||
Ie it is open source, and written in ruby.
|
||||
%p
|
||||
It is my firm belief that given a vm in ruby, ruby development will "take off" too. In other words, given an
|
||||
easy way to improve his tools, a developer will do so. Easy means understandable and that means ruby for a
|
||||
ruby developer
|
||||
Ruby itself has not enjoyed this rails effect, and that is because it is written in C.
|
||||
Crystal, Rust, Go, Julia etc, have, for the exact same reason.
|
||||
%p
|
||||
It is my firm belief that given a vm in ruby, ruby development will "take off" too.
|
||||
In other words, given an easy way to improve his tools, a developer will do so.
|
||||
Easy means understandable and that means ruby for a ruby developer.
|
||||
.tripple
|
||||
%h2.center Step to Indepencance
|
||||
%p
|
||||
The first thing any decent compiler does, is compile itself. It is the maturity test of a language to implement
|
||||
itself in itself, and the time has come for ruby. The mark of growing up is being independant, in ruby's case of C.
|
||||
The first thing any decent compiler does, is compile itself.
|
||||
It is the maturity test of a language to implement itself in itself,
|
||||
and the time has come for ruby.
|
||||
The mark of growing up is being independant, in ruby's case of C.
|
||||
%p
|
||||
Having just learned Assembler, i can attest what a great improvement C is over Assembler.
|
||||
But that was then and it is not just chance that developemnt has been slow in the last 50 years.
|
||||
%p
|
||||
There is this attitude C believers elude and since they are the gatekeepers of the os,
|
||||
everyone is fooled into believing only c is fast. Whereas what is true is that
|
||||
= succeed "is" do
|
||||
%em complied (binary) code
|
||||
%em complied (binary) code
|
||||
is.
|
||||
%p
|
||||
On a very similar note we are lead to believe that os features must be used from c. Whereas system calls
|
||||
are software interrupts, not really
|
||||
On a very similar note we are lead to believe that os features must be used from c.
|
||||
Whereas system calls are software interrupts, not really
|
||||
%em
|
||||
calls
|
||||
%em
|
||||
at all.
|
||||
Only the c std library makes them look like c functions, but they are not.
|
||||
at all.
|
||||
Only the c std library makes them look like c functions, but they are not.
|
||||
.row
|
||||
%p.center
|
||||
%span
|
||||
%b So what does empowerment mean.
|
||||
%h3.center So what does empowerment mean.
|
||||
%p
|
||||
For me it is means owning your tools.
|
||||
For everyone to really be able to unfold their ideas and potential.
|
||||
Not to be stuck, rather to be able to change anything one wishes.
|
||||
We usually own the code we write, and we have seen amazing progress in opening up new ideas.
|
||||
%p
|
||||
So it is hard to even think of ruby holding us back, and it isn't off course, only current implementations of it are.
|
||||
So it is hard to even think of ruby holding us back, and it isn't off course,
|
||||
only the current implementations of it are.
|
||||
%p
|
||||
Concretely what does this mean: Well i don't know do i! That's the whole point, that anyone can improve it beyond
|
||||
the original creators horizon.
|
||||
Concretely what does this mean: Well i don't know do i!
|
||||
That's the whole point, that anyone can improve it beyond the original creators horizon.
|
||||
%p
|
||||
But to mention a few things that have crossed my mind (and that i will most certainly not implement)
|
||||
%ul
|
||||
|
@ -13,8 +13,8 @@
|
||||
just push more functionality into the “virtual machine” and it is in fact only the
|
||||
compilation to binaries that gives static languages their speed. This is the reason
|
||||
to compile ruby.
|
||||
%p.center.full_width
|
||||
= image_tag "layers.jpg" , alt: "Architectural layers"
|
||||
%p.center.three_width
|
||||
= image_tag "architecture.png" , alt: "Architectural layers"
|
||||
|
||||
%h3#ruby Ast + Ruby
|
||||
%p
|
||||
@ -61,26 +61,30 @@
|
||||
%h3#minimal-object-machine Minimal Object machine
|
||||
%p
|
||||
We compile Vool statements into Mom instructions. Mom is a machine, which means it has
|
||||
instructions. But unlike a cpu (or the risc layer below) it does not have memory, only objects.
|
||||
It also has no registers, and together these two things mean that all information is stored in
|
||||
objects. Also the calling convention is object based and uses Frame and Message instances to
|
||||
save state.
|
||||
instructions. But unlike a cpu (or the risc layer below) it does not have memory, only
|
||||
objects.
|
||||
It also has no registers, and together these two things mean that all information is
|
||||
stored in objects. Also the calling convention is object based and uses Frame and
|
||||
Message instances to save state.
|
||||
%p
|
||||
Objects are typed, and are in fact the same objects the language operates on. Just the
|
||||
functionality is expressed through instructions. While source methods are in defined on
|
||||
functionality is expressed through instructions. While source methods are defined on
|
||||
classes as Vool, when they are compiled to binary, they are made type specific. These
|
||||
TypedMethods hold the binary and are stored in the Type.
|
||||
%p
|
||||
The Mom level exists to make the transition to Risc easier. It has a very abstract,
|
||||
high level instruction set, where each single instruction may resolve to many (even tens of)
|
||||
lower level instructions. But it breaks down Vool's tree into an instruction
|
||||
high level instruction set, where each single instruction may resolve to many (even
|
||||
tens of) lower level instructions. But it breaks down Vool's tree into an instruction
|
||||
list, which is conceptually a much easier input for the next layer.
|
||||
%p
|
||||
Mom instruction may also be used to extend the systm functionality. This feature is used
|
||||
in the Builtin layer of functions. These functions are coded at the Mom level, as they
|
||||
can not be expressed in ruby. Examples include instance variable access, integer ops...
|
||||
|
||||
%h3#risc Risc
|
||||
%p
|
||||
The Register machine layer is a relatively close abstraction of risc hardware, but without the
|
||||
quirks.
|
||||
%p
|
||||
The Register machine layer is a relatively close abstraction of risc hardware,
|
||||
but without the quirks that for example arm has.
|
||||
The Risc machine has registers, indexed addressing, operators, branches and everything
|
||||
needed to implement Mom. It does not try to abstract every possible machine feature
|
||||
(like llvm), but rather “objectifies” the general risc view to provide what is needed for
|
||||
@ -91,23 +95,25 @@
|
||||
instructions may be defined and used later, as long as translation is provided for them too.
|
||||
In other words the instruction set is extensible (unlike cpu instruction sets).
|
||||
%p
|
||||
Basic object oriented concepts are needed already at this level, to be able to generate a whole
|
||||
self contained system. Ie what an object is, a class, a method etc. This minimal runtime is called
|
||||
parfait, and the same objects will be used at runtime and compile time.
|
||||
Basic object oriented concepts are needed already at this level, to be able to generate
|
||||
a whole self contained system. Ie what an object is, a class, a method etc.
|
||||
This minimal runtime is called parfait, and the same objects will be used at runtime
|
||||
and compile time.
|
||||
%p
|
||||
Since working with at this low machine level (essentially assembler) is not easy to follow for
|
||||
everyone (me :-), an interpreter was created (by me:-). Later a graphical interface, a kind of
|
||||
Since working with at this low machine level (essentially assembler) is not easy to
|
||||
follow for everyone (me :-), an interpreter was created (by me:-). Later a graphical
|
||||
interface, a kind of
|
||||
%a{:href => "https://github.com/ruby-x/rubyx-debugger"} visual debugger
|
||||
was added.
|
||||
Visualizing the control flow and being able to see values updated immediately helped
|
||||
tremendously in creating this layer. And the interpreter helps in testing, ie keeping it
|
||||
working in the face of developer change.
|
||||
|
||||
%h3#binary--arm-and-elf Binary , Arm and Elf
|
||||
%h3 Target assembler
|
||||
%p
|
||||
A physical machine will run binaries containing instructions that the cpu understands, in a
|
||||
format the operating system understands (elf). Arm and elf subdirectories hold the code for
|
||||
these layers.
|
||||
Risc is the last abstract layer, it is then translated into machine dependent code.
|
||||
This is not binary yet, more an oo version of assembler, where each instruction
|
||||
is represented by an object.
|
||||
%p
|
||||
Arm is a risc architecture, but anyone who knows it will attest, with it’s own quirks.
|
||||
For example any instruction may be executed conditionally, ie
|
||||
@ -116,5 +122,14 @@
|
||||
is no 32bit register load instruction. It is possible to create very dense code using
|
||||
all the arm special features, but this is not implemented yet.
|
||||
%p
|
||||
The Arm::Translator translates that translates RegisterInstructions to ArmInstructions,
|
||||
The Arm::Translator translates RegisterInstructions to ArmInstructions.
|
||||
|
||||
%h3#binary-and-elf Elf and Binary
|
||||
%p
|
||||
A physical machine will run binaries containing instructions that the cpu understands,
|
||||
in a format the operating system understands (elf).
|
||||
%p
|
||||
The previously generated objects must be able to convert themselves to binary.
|
||||
These binary codes are wrapped and stored into binary files of elf format.
|
||||
Arm and elf subdirectories hold the code for these layers.
|
||||
and the Elf::ObjectWriter creates Linux binaries.
|
||||
|
Loading…
x
Reference in New Issue
Block a user