add a statistics command to compiler

just to see how many objects make up a binary
This commit is contained in:
2019-09-05 13:25:40 +03:00
parent 91995dc1b3
commit 7d92ee9e6a
4 changed files with 59 additions and 15 deletions

View File

@ -3,11 +3,17 @@ require_relative "binary_writer"
module Risc
# From code, the next step down is Vool, then Mom (in two steps)
#
# The next step transforms to the register machine layer, which is quite close to what actually
# executes. The step after transforms to Arm, which creates executables.
# A RiscCollection is the last virtual stop on the way to binary.
# It creates a Linker to go to binary. The name linker came in analogy to
# "normal" (ie c world) lingo, because there too the linker is all about
# positioning code and data.
#
# Here we also do the assembling, which (at least in arm) creates this mess
# of dependencies. As a simple example imagine a branch, a load and the label
# to which we jump. The brnahc needs the address, but the load may be 4 or 8
# instructions, and thus the label address is only known after the load.
# Exrapolate times 10, that's why this works with listeners and a sort
# of self organizing aproach (see class Position).
class Linker
include Util::Logging

View File

@ -7,7 +7,7 @@ module Risc
# into one stream or binary text object. This is then written to an ELF text section.
#
# A word about positions: The c world has a thing called position independent code, and
# baically we follw that idea. Code (ie jumps and constant loads) are all relative.
# basically we follw that idea. Code (ie jumps and constant loads) are all relative.
# But we have pointers. In C the linker takes care of bending those, we have to
# do that ourselves, in write_ref. That's why we need the load adddess and basically
# we just add it to pointers.