2014-06-29 18:05:35 +02:00
|
|
|
module Virtual
|
2014-07-16 23:53:19 +02:00
|
|
|
# A Message and a Frame make up the two sides of message passing:
|
|
|
|
# A Message (see details there) is created by the sender and control is transferred
|
|
|
|
# A Frame is created by the receiver
|
2014-07-10 16:14:38 +02:00
|
|
|
|
2014-07-16 23:53:19 +02:00
|
|
|
# In static languages these two objects are one, because the method is known at compile time.
|
|
|
|
# In that case the whole frame is usually on the stack, for leaves even omitted and all data is held in registers
|
|
|
|
#
|
|
|
|
# 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
|
2014-07-24 20:56:31 +02:00
|
|
|
# make it, to say the very least, unsensibly tricky to store them on the stack. So we don't.
|
2014-07-10 16:14:38 +02:00
|
|
|
|
2014-07-24 20:56:31 +02:00
|
|
|
# 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.
|
2014-07-14 20:28:21 +02:00
|
|
|
|
2014-07-16 23:53:19 +02:00
|
|
|
class Frame
|
2014-07-24 20:56:31 +02:00
|
|
|
def initialize locals , temps
|
|
|
|
@locals = locals
|
|
|
|
@tmps = tmps
|
2014-07-14 20:28:21 +02:00
|
|
|
end
|
2014-07-24 20:56:31 +02:00
|
|
|
attr_accessor :locals , :tmps
|
2014-06-29 18:05:35 +02:00
|
|
|
end
|
|
|
|
end
|