2015-04-06 10:38:11 +02:00
|
|
|
|
2015-04-08 19:24:50 +02:00
|
|
|
# A Frame is set up by functions that use local variables or temporary variables
|
|
|
|
# in fact temporary variables are local variables named by the system
|
|
|
|
|
2015-05-10 16:12:43 +02:00
|
|
|
# It allows for access to those variables basically
|
|
|
|
|
|
|
|
# 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
|
2015-07-01 18:27:18 +02:00
|
|
|
# PS: it turns out that both messages and frames are created at compile, not run-time, and
|
|
|
|
# just constantly reused. Each message has a frame object ready and ist also linked
|
|
|
|
# to the next message.
|
|
|
|
# The better way to say above is that a messages is *used* by the caller, and a frame by the callee.
|
2015-05-10 16:12:43 +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 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. Ie have layouts and so on.
|
|
|
|
# Which resolves the dichotomy of objects on the stack or heap. Sama sama.
|
2015-04-08 19:24:50 +02:00
|
|
|
|
2015-05-11 17:55:49 +02:00
|
|
|
module Parfait
|
2015-06-28 21:02:07 +02:00
|
|
|
class Frame < Object
|
2015-07-30 18:18:41 +02:00
|
|
|
attribute :next_frame
|
|
|
|
|
2015-10-22 10:02:46 +02:00
|
|
|
def self.offset
|
2015-10-22 10:48:03 +02:00
|
|
|
1 + Space.object_space.get_class_by_name(:Frame).object_layout.object_instance_length
|
2015-10-22 10:02:46 +02:00
|
|
|
end
|
|
|
|
|
2015-05-10 16:12:43 +02:00
|
|
|
end
|
2015-04-06 10:38:11 +02:00
|
|
|
end
|