<br><br><div class="gmail_quote">On Fri, Apr 12, 2013 at 2:43 AM, <a href="mailto:phil@highoctane.be">phil@highoctane.be</a> <span dir="ltr">&lt;<a href="mailto:phil@highoctane.be" target="_blank">phil@highoctane.be</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div dir="ltr"><div>This is what I do have:</div><div><br></div>VMClass subclass: #InterpreterPrimitives<div>VMClass subclass: #ObjectMemory<br>
<div>ObjectMemory subclass: #Interpreter</div></div><div><br></div>

<div>and also:</div><div><br></div><div>InterpreterPrimitives subclass: #StackInterpreter<br></div><div>StackInterpreter subclass: #StackInterpreterPrimitives<br></div><div><br></div><div>

I am interested in getting Interpreter to work at this point, not StackInterpreter, in the simulator.</div></div></blockquote><div><br></div><div>Then I would either move to VMMaker or be prepared for a fair bit of work.  I haven&#39;t worked on the Interpreter in the Cog branch for many years.  </div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>StackIntepreter simulation has other problems:</div><div><br></div><div>


<div>UndefinedObject(Object)&gt;&gt;doesNotUnderstand: #adaptToNumber:andSend:</div><div>UndefinedObject(Object)&gt;&gt;adaptToInteger:andSend:</div><div>SmallInteger(Integer)&gt;&gt;quo:</div><div>SmallInteger&gt;&gt;quo:</div>


<div>SmallInteger(Integer)&gt;&gt;//</div><div>SmallInteger&gt;&gt;//</div><div>StackInterpreterSimulatorLSB(StackInterpreter)&gt;&gt;interpreterAllocationReserveBytes</div><div>StackInterpreterSimulatorLSB(StackInterpreterSimulator)&gt;&gt;openOn:extraMemory: in Block: [f := FileStream readOnlyFileNamed: fileName....</div>


<div>BlockClosure&gt;&gt;ensure:</div><div>StackInterpreterSimulatorLSB(StackInterpreterSimulator)&gt;&gt;openOn:extraMemory:</div><div>StackInterpreterSimulatorLSB(StackInterpreterSimulator)&gt;&gt;openOn:</div><div>UndefinedObject&gt;&gt;DoIt</div>


<div><br></div><div>Looks like all of this needs some love... no problem doing that but I need to sort out these questions with your help :-)</div></div></div></blockquote><div><br></div><div>This should be easy to solve.  Hmmm, works in e.g. VMMaker.oscog-eem.284.</div>
<div><br></div><div>Try launching it with</div><div><br></div><div><div>| vm |</div><div>StackInterpreter initializeWithOptions: (Dictionary newFromPairs: #()).</div><div>vm := StackInterpreterSimulator new.</div><div>vm openOn: &#39;some.image&#39;.</div>
<div>vm openAsMorph; run</div></div><div><br></div><div><br></div><div>If it doesn&#39;t work then you need to reintegrate from VMMaker.oscog-eem.284.</div><div><br></div><div>HTH</div><div>Eliot</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div><div><br></div><div>Phil</div><div><br></div></div><div>

<br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/4/11 Eliot Miranda <span dir="ltr">&lt;<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>&gt;</span><br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><br><br><div class="gmail_quote">On Thu, Apr 11, 2013 at 2:11 AM, <a href="mailto:phil@highoctane.be" target="_blank">phil@highoctane.be</a> <span dir="ltr">&lt;<a href="mailto:phil@highoctane.be" target="_blank">phil@highoctane.be</a>&gt;</span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> <br><div dir="ltr">Hello,<div><br></div><div>I&#39;ve been working on getting the simulator to work from VMMaker.</div>



<div><br></div><div>Now, I can load my 6505 formatted image inside the simulator and it looks okay (from what I can inspect).</div>

<div><br></div><div>Then, I am now running the test of the sim:</div><div><br></div><div><div>test</div><div><span style="white-space:pre-wrap">        </span>transcript clear.</div><div><span style="white-space:pre-wrap">        </span>byteCount := 0.</div>





<div><span style="white-space:pre-wrap">        </span>quitBlock := [^ self].</div><div><span style="white-space:pre-wrap">        </span>self internalizeIPandSP.</div><div><span style="white-space:pre-wrap">        </span>self fetchNextBytecode.</div>





<div><span style="white-space:pre-wrap">        </span>[true] whileTrue:</div><div><span style="white-space:pre-wrap">                </span>[self dispatchOn: currentBytecode in: BytecodeTable.</div><div><span style="white-space:pre-wrap">                </span>byteCount := byteCount + 1.</div>





<div><span style="white-space:pre-wrap">                </span>byteCount \\ 10000 = 0 ifTrue: [self fullDisplay]].</div><div><span style="white-space:pre-wrap">        </span>self externalizeIPandSP.</div><div><br></div><div><br></div>

<div>and I hit an issue:</div><div><br></div><div>MNU: isInstanceOfClassFloat: oop.</div><div><div><div>InterpreterSimulatorLSB(Interpreter)&gt;&gt;floatValueOf:</div><div>InterpreterSimulatorLSB(Interpreter)&gt;&gt;loadFloatOrIntFrom:</div>





<div>InterpreterSimulatorLSB(Interpreter)&gt;&gt;primitiveFloatEqual:toArg:</div><div>InterpreterSimulatorLSB(Interpreter)&gt;&gt;bytecodePrimEqual</div><div>InterpreterSimulatorLSB(InterpreterSimulator)&gt;&gt;dispatchOn:in:</div>





<div>InterpreterSimulatorLSB(InterpreterSimulator)&gt;&gt;test</div><div>UndefinedObject&gt;&gt;DoIt</div><div><br></div></div><div>This happens here:</div><div><br></div><div><div>floatValueOf: oop</div><div>

<span style="white-space:pre-wrap">        </span>&quot;Answer the C double precision floating point value of the argument,</div><div><span style="white-space:pre-wrap">        </span> or fail if it is not a Float, and answer 0.</div>





<div><span style="white-space:pre-wrap">        </span> Note: May be called by translated primitive code.&quot;</div><div><br></div><div><span style="white-space:pre-wrap">        </span>| isFloat result |</div><div><span style="white-space:pre-wrap">        </span>&lt;returnTypeC: #double&gt;</div>





<div><span style="white-space:pre-wrap">        </span>&lt;var: #result type: #double&gt;</div><div><span style="white-space:pre-wrap">        </span>isFloat := self isInstanceOfClassFloat: oop.</div><div><span style="white-space:pre-wrap">        </span>isFloat ifTrue:</div>





<div><span style="white-space:pre-wrap">                </span>[self cCode: &#39;&#39; inSmalltalk: [result := Float new: 2].</div><div><span style="white-space:pre-wrap">                </span> self fetchFloatAt: oop + BaseHeaderSize into: result.</div>





<div><span style="white-space:pre-wrap">                </span> ^result].</div><div><span style="white-space:pre-wrap">        </span>self primitiveFail.</div><div><span style="white-space:pre-wrap">        </span>^0.0</div></div><div><br>

</div><div>There is such a method in IntepreterPrimitives, but not in the Interpreter itself nor parents.</div><div><br></div><div><div>InterpreterPrimitives&gt;&gt;isInstanceOfClassFloat: oop</div><div>

<span style="white-space:pre-wrap">        </span>&lt;inline: true&gt;</div><div><span style="white-space:pre-wrap">        </span>&quot;N.B.  Because Slang always inlines is:instanceOf:compactClassIndex:</div><div><span style="white-space:pre-wrap">        </span> (because is:instanceOf:compactClassIndex: has an inline: pragma) the</div>





<div><span style="white-space:pre-wrap">        </span> phrase (objectMemory splObj: ClassFloat) is expanded in-place and is</div><div><span style="white-space:pre-wrap">        </span> _not_ evaluated if oop has a non-zero CompactClassIndex.&quot;</div>





<div><span style="white-space:pre-wrap">        </span>^objectMemory</div><div><span style="white-space:pre-wrap">                </span>is: oop</div><div><span style="white-space:pre-wrap">                </span>instanceOf: (objectMemory splObj: ClassFloat) </div>





<div><span style="white-space:pre-wrap">                </span>compactClassIndex: ClassFloatCompactIndex</div><div><br></div><div>Clues?</div></div></div></div></div></blockquote><div><br></div><div>Just copy the method into Interpreter and replace objectMemory with self.  But I don&#39;t understand which VMMsker you&#39;re using.  In David Lewis&#39; trunk, e.g. VMMaker-dtl.316, Interpreter inherits from InterpreterPrimitives.</div>



<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><br></div><div>Phil</div></div></div></div></div>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>
<br></blockquote></div><br></div>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br>best,<div>Eliot</div>