> On 16 Oct 2014, at 17:26, Marcus Denker <[email protected]> wrote: > > >> On 16 Oct 2014, at 16:43, Marcus Denker <[email protected] >> <mailto:[email protected]>> wrote: >> >> >> >> >> 1. sometimes the debugger can not inspect a single tempvar (list of all >> temps is working) >> 2. number of temp vars (in method header) is wrong: >> >> | a b c | >> a := 1. >> b := 2. >> c := 3. >> [[a asString] >> on: Error >> do: [:ex | a >> value: a >> value: b >> value: c]. >> c < 0] whileTrue. >> >> method header numtemps 1 >> >> | a b c | >> a := 1. >> b := 2. >> c := 3. >> c < 0 >> ifTrue: [ >> [ a asString ] >> on: Error >> do: [ :ex | a value: a value: b value: c ]. >> c < 0 ]. >> ^ a >> >> method header numtemps 3 >> >> both methods define a block with a nested block. >> In the first method it is the receiver of #whileTrue: >> the second method it is the argument to #ifTrue: >> I think both blocks are optimized, but somehow the >> block receiving the whileTrue: message makes the computation >> for the number of tempvars wronng >> >> >> What is happening is that the variables are wrongly put in a temp vector... >> in the case >> of loops. >> >> the one temp is this vector. >> >> this should be fixed. >> > > I think the problem is that what we did is to mark a variables as escaping > when it > as *read* in an optimised block. > > But what we should do is to mark only all *writes* to a variable that happens > in a loop as > escaping vars even in the case when they happen in the same scope. > > this means the read is simpler: > > visitVariableNode: aVariableNode > | var | > var := (self lookupVariableForRead: aVariableNode) ifNil: [(self > undeclaredVariable: aVariableNode)]. > aVariableNode binding: var. > var isUninitialized ifTrue: [self uninitializedVariable: aVariableNode]. > > > While in the write we need to mark: > > lookupVariableForWrite: aVariableNode > > | var | > > var := scope lookupVar: aVariableNode name. > > var ifNil: [^var]. > var isSpecialVariable ifTrue: [ self storeIntoSpecialVariable: > aVariableNode ]. > var isWritable ifFalse: [ self storeIntoReadOnlyVariable: aVariableNode > ]. > > var isTemp ifTrue: [ > "when in a loop, all writes escape" > scope outerScope isInsideOptimizedLoop ifTrue: [ var > markEscapingWrite ]. > "else only escaping when they will end up in different closures" > (var scope outerNotOptimizedScope ~= scope > outerNotOptimizedScope) > ifTrue: [ var markEscapingWrite]]. > ^var > > > I checked that all Opal tests that are failing are actually testing wrong, > and I double checked > that all those methods are now compiled like with the old old compiler… > Now recompilng the image.
Hmm… nope…. something wrong. Marcus
