05.08.2014 Views

here - Stefan-Marr.de

here - Stefan-Marr.de

here - Stefan-Marr.de

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

4. Experimentation Platform<br />

for the currently executing method and block. The POP_FIELD byteco<strong>de</strong> implemented<br />

by #doPopField in line 6, modifies the current object at the field in<strong>de</strong>x<br />

indicated by the byteco<strong>de</strong>. It stores the current top element of the stack into<br />

that field, and pops the top off the stack. The reverse operation is realized in<br />

line 11 by the PUSH_FIELD byteco<strong>de</strong>, which reads the field of an object and<br />

pushes the result onto the operand stack. The implementations of the SEND<br />

and SUPER_SEND byteco<strong>de</strong> given in lines 16 and 24 first <strong>de</strong>termine the object<br />

that receives the message send, based on the number of arguments on the<br />

stack, and will then <strong>de</strong>termine the class w<strong>here</strong> the lookup starts to eventually<br />

<strong>de</strong>legate to the #performSend:to:lookupCls: method.<br />

How the invocation is implemented <strong>de</strong>pends on whether the message leads<br />

to an application of a SOM method representing byteco<strong>de</strong>s, or a primitive<br />

that is implemented in the implementation language. The application of a<br />

method, as shown in line 6 of Lst. 4.6, will result in the creation of a new<br />

frame (cf. line 29) that will be initialized with the receiver and the arguments.<br />

The invocation of a primitive on the other hand, is performed in AweSOM by<br />

taking arguments from the operand stack, executing the primitive with these<br />

arguments and pushing the result value back onto the stack. In other SOM<br />

implementations, and in typical Smalltalk VMs like the CogVM or RoarVM,<br />

primitives will obtain a reference to the context object, i. e., frame instead<br />

and will manipulate it directly, because it gives primitives more freedom and<br />

power in terms of what they can implement. AweSOM optimizes for the common<br />

case, reducing the bur<strong>de</strong>n on the primitive implementer.<br />

The remaining byteco<strong>de</strong>s of SOM complement the ones already discussed.<br />

Since their <strong>de</strong>tails are beyond the scope of this dissertation, this section only<br />

gives a brief <strong>de</strong>scription of the operation each byteco<strong>de</strong> represents. Note however<br />

that byteco<strong>de</strong>s represent access to object fields and local variables with<br />

in<strong>de</strong>xes. This is a typical optimization known as lexical addressing [Abelson<br />

et al., 1996].<br />

96

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!