2016-01-08 23:20 GMT+01:00 Hilaire <hila...@drgeo.eu>:

> Le 08/01/2016 21:31, Nicolai Hess a écrit :
> >
> >
> >         The crashing image itself can be found there in case of
> usefulness
> >         https://www.dropbox.com/s/rur8ayt8eon6mab/drgeo.image.zip?dl=0
> >
> >
> > Do you have the changes file, too?
>
> Here: https://www.dropbox.com/s/dwg99xmvtgak10o/DrGeoCrashVM.zip?dl=0
>
> Thanks
>
>
Hi Hilaire,

I think this is the same bug as
https://pharo.fogbugz.com/f/cases/13854/frameSize-calculated-wrongly-for-lineSegmentsDo

this is fixed in pharo4.0 and pharo5.0 but not in pharo3.0
I modified the changeset for pharo4.0 to make it loadable in pharo3.0
But I did not looked further on the code changes, maybe it won't fully work.
Find attached the changeset. You have to switch compiler class before and
after loading this.

SmalltalkImage compilerClass: Compiler.
'opal_drgeo.cs' asFileReference fileIn.
SmalltalkImage compilerClass: OpalCompiler.




> --
> Dr. Geo
> http://drgeo.eu
>
>
>
>
'From Pharo3.0 of 18 March 2013 [Latest update: #30864] on 9 January 2016 at 12:23:34.657922 am'!
IRStackCount subclass: #IRClosureStackCount
	instanceVariableNames: 'numMethodTempVars'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'OpalCompiler-Core-Bytecode'!

!IRClosureStackCount commentStamp: '<historical>' prior: 0!
IRClosureStackCount is used to distinguish between a stack 
in the method scope and a stack within a closure block. The
closure stack size is independent of the number of tempvars from the compiled method, therefore that number is subtracted
from this stack size length.!


!IRBytecodeGenerator methodsFor: 'instructions' stamp: 'DrGeoUser 1/9/2016 00:03'!
pushClosureCopyNumCopiedValues: numCopied numArgs: numArgs2 to: toSeqId
	
	| blockSeqId |
	blockSeqId := self newDummySeqId.
	stack pop: numCopied. 
	stacks at: blockSeqId put: ((IRClosureStackCount new numMethodTempVars:(numberOfTemps)) startAt: (numArgs2+numCopied)).
	stack push.
	stacks at: toSeqId put: (stack linkTo: (stacks at: toSeqId ifAbsentPut: [nil])).
	self saveLastJump: (Message
		selector: #closureFrom:to:copyNumCopiedValues:numArgs:
		arguments: {currentSeqId.toSeqId. numCopied. numArgs2.}).

	self closureFrom: currentSeqId to: toSeqId copyNumCopiedValues: numCopied numArgs: numArgs2.
	self label: blockSeqId.
! !

!IRBytecodeGenerator methodsFor: 'instructions' stamp: 'DrGeoUser 1/9/2016 00:03'!
label: seqId
	lastSpecialReturn := nil.
	currentSeqId := seqId.
	currentSeqNum := currentSeqNum + 1.
	seqOrder at: seqId put: currentSeqNum.
	orderSeq at: currentSeqNum ifAbsentPut: [seqId].
	bytes := seqBytes at: seqId ifAbsentPut: [OrderedCollection new].
	jumps at: seqId ifAbsentPut: [nil].
	instrMap := instrMaps at: seqId ifAbsentPut: [OrderedCollection new].
	stack
		ifNil: [ stack := stacks at: currentSeqId ifAbsentPut: [ IRStackCount new ] ]
		ifNotNil: [stack := stacks at: currentSeqId ifAbsentPut: [ stack class newOn:stack ] ]! !


!IRStackCount methodsFor: 'results' stamp: 'NicolaiHess 11/8/2014 23:51'!
linkTo: stackOrNil

	stackOrNil ifNil: [^ self class newOn: self].
	^ self position = stackOrNil start
		ifTrue: [stackOrNil]
		ifFalse: [self error: 'stack out of sync in bytecode generator']! !


!IRClosureStackCount methodsFor: 'accessing' stamp: 'NicolaiHess 11/8/2014 23:47'!
numMethodTempVars
	^ numMethodTempVars! !

!IRClosureStackCount methodsFor: 'accessing' stamp: 'NicolaiHess 11/9/2014 00:05'!
numMethodTempVars: nilOrNumber
	numMethodTempVars := nilOrNumber ifNil:[0]! !

!IRClosureStackCount methodsFor: 'accessing' stamp: 'NicolaiHess 11/8/2014 23:47'!
length

	^ super length - self numMethodTempVars! !

!IRClosureStackCount methodsFor: 'initialize' stamp: 'NicolaiHess 11/8/2014 23:47'!
initialize

	super initialize.

	numMethodTempVars := 0.! !


!IRStackCount class methodsFor: 'instance creation' stamp: 'NicolaiHess 11/8/2014 23:50'!
newOn: stack

	^ self startAt: stack position! !


!IRClosureStackCount class methodsFor: 'instance creation' stamp: 'NicolaiHess 11/8/2014 23:54'!
newOn: stack
	^ (self startAt: stack position)
		numMethodTempVars: stack numMethodTempVars;
		yourself! !

Reply via email to