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 />

Byteco<strong>de</strong>s The byteco<strong>de</strong> set used by the RoarVM is very similar to the<br />

Smalltalk-80 byteco<strong>de</strong> set <strong>de</strong>picted in Tab. 4.2. It enco<strong>de</strong>s common operations<br />

with single bytes, directly encoding a small range of parameters. Supposedly,<br />

this encoding was chosen to keep the co<strong>de</strong> size of Smalltalk methods small<br />

and enable efficient implementation based on C’s switch/case statement that<br />

will be mapped on a dispatch table by most compilers. The RoarVM also still<br />

uses switch/case instead of direct or indirect threading. While the RoarVM<br />

supports the closure extension that was introduced by the CogVM, it is not<br />

consi<strong>de</strong>red in this dissertation. Another difference in the used byteco<strong>de</strong> set is<br />

the changed meaning of byteco<strong>de</strong> 132. It has been changed to the unequivocal<br />

name: doubleExten<strong>de</strong>dDoAnythingByteco<strong>de</strong>. Three bits of the second byte are<br />

used to enco<strong>de</strong> the operation, and the remaining 5 bits enco<strong>de</strong> an argument.<br />

The third byte enco<strong>de</strong>s a literal to be used.<br />

The byteco<strong>de</strong>s for arithmetic and special methods are essentially shortcut<br />

byteco<strong>de</strong>s that reduce the number of bytes nee<strong>de</strong>d to enco<strong>de</strong> presumably<br />

common message sends. Besi<strong>de</strong>s arithmetic operations such as add, subtract,<br />

and multiply, this inclu<strong>de</strong>s comparisons such as less than, greater or equal, and<br />

equal. The special methods inclu<strong>de</strong> for instance #at:, #at:put:, and class.<br />

The implementation of these byteco<strong>de</strong>s will first set the corresponding symbol<br />

for the message send, and then issue the actual message send. However,<br />

if possible the addition is executed directly without doing an actual message<br />

send, for instance if the receiver and the argument of the #+ message are<br />

integers.<br />

4.4.2. Memory Systems Design<br />

The memory system of the RoarVM has been <strong>de</strong>signed with simplicity in<br />

mind, facilitating the experimentation on manycore platforms like the Tilera<br />

TILE64 [Wentzlaff et al., 2007]. T<strong>here</strong>fore, the RoarVM uses a simple compacting<br />

mark-and-sweep GC that relies on a stop-the-world mechanism for safe<br />

memory reclamation. Besi<strong>de</strong> the SmallInt immediate tagged integers, all objects<br />

are garbage collected.<br />

One important artifact of Ungar and Adams’ research that became part of<br />

the RoarVM is an additional memory word that is prepen<strong>de</strong>d to every object.<br />

For their implementation of the Ly and Sly language prototypes [Ungar and<br />

Adams, 2010], they changed the semantics of message dispatching. In Sly, an<br />

object can be part of an ensemble, i. e., a collection. If a message is sent to such<br />

an object, the message is reified and sent to the ensemble instead. This technique<br />

allows Ungar and Adams to unify to a certain <strong>de</strong>gree the treatment of<br />

104

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

Saved successfully!

Ooh no, something went wrong!