Fixed almost all but Interpreter
150 only failing, seems only 1 bug though and one in linker
This commit is contained in:
@ -1,5 +1,14 @@
|
||||
module RubyX
|
||||
# The RubyXCompiler provides the main interface to create binaries
|
||||
# The RubyXCompiler provides the main interface to create binaries, and also
|
||||
# give helper functions to create any intermediate layer.
|
||||
# Layers are:
|
||||
# - ruby , always needed as input, string
|
||||
# - vool - intermediate language layer
|
||||
# - mom - intermediate machine layer
|
||||
# - risc - "last" intermediate machine layer
|
||||
# - target - arm or interpreter binary code
|
||||
# - binary - "linked" code, everything need to create an elf binary
|
||||
#
|
||||
#
|
||||
# There are methods to go from ruby to any of the layers in the system
|
||||
# (mainly for testing). ruby_to_binary creates actual binary code
|
||||
@ -38,42 +47,59 @@ module RubyX
|
||||
to_binary(platform)
|
||||
end
|
||||
|
||||
# Process previously stored vool source to binary.
|
||||
# Binary code is generated byu calling to_risc, then positioning and calling
|
||||
# create_binary on the linker. The linker may then be used to creat a binary file.
|
||||
# The biary the method name refers to is binary code in memory, or in BinaryCode
|
||||
# objects to be precise.
|
||||
def to_binary(platform)
|
||||
linker = to_risc
|
||||
linker.position_all
|
||||
linker.create_binary(platform)
|
||||
linker
|
||||
# ruby_to_target creates Target instructions (but does not link)
|
||||
#
|
||||
# After creating vool, we call to_target
|
||||
# Return a Linker
|
||||
def ruby_to_target(ruby)
|
||||
ruby_to_vool(ruby)
|
||||
to_target()
|
||||
end
|
||||
|
||||
# ruby_to_risc creates Risc instructions (as the name implies), but also
|
||||
# translates those to the platform given
|
||||
# ruby_to_risc creates Risc instructions
|
||||
#
|
||||
# After creating vool, we call to_risc
|
||||
# Return a RiscCollection
|
||||
def ruby_to_risc(ruby)
|
||||
ruby_to_vool(ruby)
|
||||
to_risc()
|
||||
end
|
||||
|
||||
# Process previously stored vool source. First to mom, then to risc.
|
||||
def to_risc()
|
||||
mom = to_mom
|
||||
mom.to_risc()
|
||||
end
|
||||
|
||||
# ruby_to_mom does exactly that, it transform the incoming ruby source (string)
|
||||
# to mom
|
||||
# The vool is stored using ruby_to_vool, and if there was previous source,
|
||||
# this will also be momed
|
||||
# Transform the incoming ruby source (string) to mom
|
||||
#
|
||||
# The vool is stored using ruby_to_vool,the to_mom is called
|
||||
# Return Mom Statement
|
||||
def ruby_to_mom(ruby)
|
||||
ruby_to_vool(ruby)
|
||||
to_mom
|
||||
end
|
||||
|
||||
# Process previously stored vool source to binary.
|
||||
# Binary code is generated by calling to_risc, then positioning and calling
|
||||
# create_binary on the linker. The linker may then be used to creat a binary file.
|
||||
# The biary the method name refers to is binary code in memory, or in BinaryCode
|
||||
# objects to be precise.
|
||||
def to_binary(platform)
|
||||
linker = to_target(platform)
|
||||
linker.position_all
|
||||
linker.create_binary
|
||||
linker
|
||||
end
|
||||
|
||||
# transform stored vool to target code
|
||||
# return a linker
|
||||
def to_target(platform)
|
||||
collection = to_risc
|
||||
collection.translate(platform)
|
||||
end
|
||||
|
||||
# Process previously stored vool source to risc.
|
||||
# return a Risc::RiscCollection , a collection of MethodCompilers
|
||||
def to_risc()
|
||||
mom = to_mom
|
||||
mom.to_risc()
|
||||
end
|
||||
|
||||
# return mom for the previously stored vool source.
|
||||
def to_mom
|
||||
@vool.to_mom(nil)
|
||||
|
Reference in New Issue
Block a user