* @throws UnresolvedObjectRefException
*/
protected void createInitialStack(NativeStream os, Label stackLabel,
Label stackPtrLabel) throws BuildException, ClassNotFoundException,
UnresolvedObjectRefException {
final ObjectInfo objectInfo = os
.startObject(loadClass(VmSystemObject.class));
final int stackOffset = os.setObjectRef(stackLabel).getOffset();
final int stackAddr = stackOffset + (int) os.getBaseAddr();
final int slotSize = arch.getReferenceSize();
// Low stack address
os.writeWord(stackAddr + VmThread.STACK_OVERFLOW_LIMIT_SLOTS * slotSize);
// High stack address
os.writeWord(stackAddr + VmThread.DEFAULT_STACK_SLOTS * slotSize);
// The actual stack space
for (int i = 2; i < VmThread.DEFAULT_STACK_SLOTS; i++) {
os.writeWord(0);
}
os.setObjectRef(stackPtrLabel);
objectInfo.markEnd();
}