Hi Igor,<div><br></div><div> which shared pool and which constant(s)? I suspect the problem is in initializing the shared pools constants, and should not be hacked around in VMMaker.<br><br><div class="gmail_quote">On Thu, Jun 30, 2011 at 7:30 AM, Igor Stasenko <span dir="ltr"><<a href="mailto:siguctua@gmail.com">siguctua@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> <br>I found the problem.<br>
Its in #buildCodeGeneratorForInterpreter<br>
<br>
i put a halt in<br>
addPoolVarsFor: aClass<br>
"Add the pool variables for the given class to the code base as constants."<br>
<br>
(aClass sharedPools reject: [:pool| pools includes: pool]) do:<br>
[:pool |<br>
pools add: pool.<br>
pool bindingsDo: [:assoc | | val node |<br>
self halt.<br>
val := assoc value.<br>
node := (useSymbolicConstants and:[self isCLiteral: val])<br>
ifTrue:[TDefineNode new setName: assoc key asString value: assoc value]<br>
ifFalse:[TConstantNode new setValue: assoc value].<br>
constants at: assoc key asString put: node]].<br>
<br>
and it triggered before the halt in:<br>
<br>
ObjectMemory>>initializeWithOptions: optionsDictionary<br>
"ObjectMemory initializeWithOptions: Dictionary new"<br>
self halt.<br>
self initBytesPerWord: (optionsDictionary at: #BytesPerWord ifAbsent: [4])..<br>
...<br>
<br>
<br>
The #initBytesPerWord: initializing VMBasicConstants pool vars.<br>
But they are already added to codegenerator (with nil values) before<br>
#initBytesPerWord: are sent.<br>
<br>
This is because in #buildCodeGeneratorForInterpreter the<br>
#addStructClass: adds given shared pool before it get initialized:<br>
<br>
....<br>
(ChangeSet superclassOrder: structClasses asArray) do:<br>
[:structClass|<br>
structClass initialize.<br>
a)>>>> cg addStructClass: structClass].<br>
<br>
interpreterClasses do:<br>
[:ic|<br>
(ic respondsTo: #initializeWithOptions:)<br>
b)>>>> ifTrue: [ic initializeWithOptions: optionsDictionary]<br>
ifFalse: [ic initialize]].<br>
<br>
interpreterClasses do: [:ic| cg addClass: ic].<br>
^cg<br>
<br>
apparently, for correct initialization (b) should precede (a) ,<br>
because once you adding class to code generator it automatically sucks<br>
all pools vars in, and converts them into TDefineNode before their<br>
values are properly initialized.<br>
<br>
Here the proposed fix (in attachment). I just split the #initialize<br>
from adding to code generator.<br>
So, initialization order will remain the same (first a struct classes<br>
are initialized , and then interpreterClasses),<br>
because i don't know if its important to initialize struct classes<br>
before initializing interpreter class(es).<br>
<br>
<br>
<br>
--<br>
Best regards,<br>
Igor Stasenko AKA sig.<br>
<br></blockquote></div><br><br clear="all"><br>-- <br>best,<div>Eliot</div><br>
</div>