[Vm-dev] Pharo 2.0 and VM Simulator

Eliot Miranda eliot.miranda at gmail.com
Fri Apr 12 15:43:06 UTC 2013


On Fri, Apr 12, 2013 at 2:43 AM, phil at highoctane.be <phil at highoctane.be>wrote:

>
> This is what I do have:
>
> VMClass subclass: #InterpreterPrimitives
> VMClass subclass: #ObjectMemory
> ObjectMemory subclass: #Interpreter
>
> and also:
>
> InterpreterPrimitives subclass: #StackInterpreter
> StackInterpreter subclass: #StackInterpreterPrimitives
>
> I am interested in getting Interpreter to work at this point, not
> StackInterpreter, in the simulator.
>

Then I would either move to VMMaker or be prepared for a fair bit of work.
 I haven't worked on the Interpreter in the Cog branch for many years.


>
> StackIntepreter simulation has other problems:
>
> UndefinedObject(Object)>>doesNotUnderstand: #adaptToNumber:andSend:
> UndefinedObject(Object)>>adaptToInteger:andSend:
> SmallInteger(Integer)>>quo:
> SmallInteger>>quo:
> SmallInteger(Integer)>>//
> SmallInteger>>//
>
> StackInterpreterSimulatorLSB(StackInterpreter)>>interpreterAllocationReserveBytes
> StackInterpreterSimulatorLSB(StackInterpreterSimulator)>>openOn:extraMemory:
> in Block: [f := FileStream readOnlyFileNamed: fileName....
> BlockClosure>>ensure:
>
> StackInterpreterSimulatorLSB(StackInterpreterSimulator)>>openOn:extraMemory:
> StackInterpreterSimulatorLSB(StackInterpreterSimulator)>>openOn:
> UndefinedObject>>DoIt
>
> Looks like all of this needs some love... no problem doing that but I need
> to sort out these questions with your help :-)
>

This should be easy to solve.  Hmmm, works in e.g. VMMaker.oscog-eem.284.

Try launching it with

| vm |
StackInterpreter initializeWithOptions: (Dictionary newFromPairs: #()).
vm := StackInterpreterSimulator new.
vm openOn: 'some.image'.
vm openAsMorph; run


If it doesn't work then you need to reintegrate from VMMaker.oscog-eem.284.

HTH
Eliot


> Phil
>
>
>
>
>
>
> 2013/4/11 Eliot Miranda <eliot.miranda at gmail.com>
>
>>
>>
>>
>> On Thu, Apr 11, 2013 at 2:11 AM, phil at highoctane.be <phil at highoctane.be>wrote:
>>
>>>
>>> Hello,
>>>
>>> I've been working on getting the simulator to work from VMMaker.
>>>
>>> Now, I can load my 6505 formatted image inside the simulator and it
>>> looks okay (from what I can inspect).
>>>
>>> Then, I am now running the test of the sim:
>>>
>>> test
>>> transcript clear.
>>> byteCount := 0.
>>>  quitBlock := [^ self].
>>> self internalizeIPandSP.
>>> self fetchNextBytecode.
>>>  [true] whileTrue:
>>> [self dispatchOn: currentBytecode in: BytecodeTable.
>>> byteCount := byteCount + 1.
>>>  byteCount \\ 10000 = 0 ifTrue: [self fullDisplay]].
>>> self externalizeIPandSP.
>>>
>>>
>>> and I hit an issue:
>>>
>>> MNU: isInstanceOfClassFloat: oop.
>>> InterpreterSimulatorLSB(Interpreter)>>floatValueOf:
>>> InterpreterSimulatorLSB(Interpreter)>>loadFloatOrIntFrom:
>>> InterpreterSimulatorLSB(Interpreter)>>primitiveFloatEqual:toArg:
>>> InterpreterSimulatorLSB(Interpreter)>>bytecodePrimEqual
>>> InterpreterSimulatorLSB(InterpreterSimulator)>>dispatchOn:in:
>>> InterpreterSimulatorLSB(InterpreterSimulator)>>test
>>> UndefinedObject>>DoIt
>>>
>>> This happens here:
>>>
>>> floatValueOf: oop
>>>  "Answer the C double precision floating point value of the argument,
>>>  or fail if it is not a Float, and answer 0.
>>>  Note: May be called by translated primitive code."
>>>
>>> | isFloat result |
>>> <returnTypeC: #double>
>>>  <var: #result type: #double>
>>> isFloat := self isInstanceOfClassFloat: oop.
>>> isFloat ifTrue:
>>>  [self cCode: '' inSmalltalk: [result := Float new: 2].
>>>  self fetchFloatAt: oop + BaseHeaderSize into: result.
>>>  ^result].
>>> self primitiveFail.
>>> ^0.0
>>>
>>> There is such a method in IntepreterPrimitives, but not in the
>>> Interpreter itself nor parents.
>>>
>>> InterpreterPrimitives>>isInstanceOfClassFloat: oop
>>>  <inline: true>
>>> "N.B.  Because Slang always inlines is:instanceOf:compactClassIndex:
>>>  (because is:instanceOf:compactClassIndex: has an inline: pragma) the
>>>  phrase (objectMemory splObj: ClassFloat) is expanded in-place and is
>>>  _not_ evaluated if oop has a non-zero CompactClassIndex."
>>>  ^objectMemory
>>> is: oop
>>> instanceOf: (objectMemory splObj: ClassFloat)
>>>  compactClassIndex: ClassFloatCompactIndex
>>>
>>> Clues?
>>>
>>
>> Just copy the method into Interpreter and replace objectMemory with self.
>>  But I don't understand which VMMsker you're using.  In David Lewis' trunk,
>> e.g. VMMaker-dtl.316, Interpreter inherits from InterpreterPrimitives.
>>
>>
>>>
>>> Phil
>>>
>>>
>>
>>
>> --
>> best,
>> Eliot
>>
>>
>
>


-- 
best,
Eliot
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20130412/821142e9/attachment.htm


More information about the Vm-dev mailing list