comments and cosmetics
This commit is contained in:
parent
e427bcef43
commit
13a05e7b72
@ -8,7 +8,7 @@ module Ast
|
||||
end
|
||||
r = receiver ? receiver.compile(method,frame) : Virtual::SelfReference.new
|
||||
method = Virtual::MethodDefinition.new(name , args , r )
|
||||
frame = frame.new_frame
|
||||
#frame = frame.new_frame
|
||||
return_type = nil
|
||||
body.each do |ex|
|
||||
return_type = ex.compile(method,frame )
|
||||
|
@ -8,14 +8,16 @@ module Virtual
|
||||
#
|
||||
# In a dynamic language the method is dynamically resolved, and so the size of the frame is not know to the caller
|
||||
# Also exceptions (with the possibility of retry) and the idea of being able to take and store bindings
|
||||
# make it to say the very least unsensibly tricky to store them on the stack. So we don't.
|
||||
# make it, to say the very least, unsensibly tricky to store them on the stack. So we don't.
|
||||
|
||||
# Also at runtime Messages and frames remain completely "normal" objects
|
||||
# Also at runtime Messages and Frames remain completely "normal" objects. Ie have layouts and so on. Which resolves the
|
||||
# dichotomy of objects on the stack or heap. Sama sama.
|
||||
|
||||
class Frame
|
||||
def initialize variables
|
||||
@variables = variables
|
||||
def initialize locals , temps
|
||||
@locals = locals
|
||||
@tmps = tmps
|
||||
end
|
||||
attr_accessor :variables
|
||||
attr_accessor :locals , :tmps
|
||||
end
|
||||
end
|
||||
|
@ -1,5 +1,5 @@
|
||||
module Virtual
|
||||
# So when an object calls a method, or sends a message, this is what a sends: a Message
|
||||
# So when an object calls a method, or sends a message, this is what it sends: a Message
|
||||
|
||||
# A message contains the sender, return and exceptional return addresses,the arguments, and a slot for the frame.
|
||||
|
||||
@ -24,14 +24,15 @@ module Virtual
|
||||
@me = me
|
||||
@next_normal = normal
|
||||
@next_exception = exceptional
|
||||
@arguments = arguments
|
||||
# a frame represents the local and temporary variables at a point in the program.
|
||||
@frame = []
|
||||
@frame = nil
|
||||
end
|
||||
attr_reader :me, :next_normal, :next_exception, :frame
|
||||
attr_reader :me, :next_normal, :next_exception, :arguments , :frame
|
||||
|
||||
# dummy for the eventual
|
||||
def new_frame
|
||||
self
|
||||
raise self.inspect
|
||||
end
|
||||
#
|
||||
def compile_get method , name
|
||||
|
Loading…
Reference in New Issue
Block a user