[Vm-dev] VM Maker: VMMaker.oscog-eem.2091.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Jan 14 21:46:39 UTC 2017


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2091.mcz

==================== Summary ====================

Name: VMMaker.oscog-eem.2091
Author: eem
Time: 14 January 2017, 1:45:50.608303 pm
UUID: a19ba746-2bff-4be4-9ec9-a5048b46428e
Ancestors: VMMaker.oscog-eem.2090

Fix a bogus assert fail in the simulator/in-image compilation when jitting methods containing unreachable pops after case statements where all arms return.  StackDepthFinder must not be fooled by unreachable code.  (An example method is Squeak's HandMorph>>#filterEvent:for: mt 6/10/2016 14:39)

=============== Diff against VMMaker.oscog-eem.2090 ===============

Item was changed:
  InstructionStream subclass: #StackDepthFinder
+ 	instanceVariableNames: 'stackp joins encoderClass deadCode'
- 	instanceVariableNames: 'stackp joins encoderClass'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'VMMaker-Support'!

Item was changed:
  ----- Method: StackDepthFinder>>doJump: (in category 'stack depth') -----
  doJump: delta
+ 	deadCode ifTrue:
+ 		[^self].
  	delta < 0
  		ifTrue:
  			[(joins at: pc + delta) ~= stackp ifTrue: [(Notification new tag: #'bad join'; signal)]]
  		ifFalse:
  			[joins at: pc + delta put: stackp]!

Item was changed:
  ----- Method: StackDepthFinder>>doPop (in category 'instruction decoding') -----
  doPop
  	"Remove Top Of Stack bytecode."
+ 	deadCode ifFalse:
+ 		[self drop]!
- 	self drop!

Item was changed:
  ----- Method: StackDepthFinder>>interpretNextInstructionFor: (in category 'decoding') -----
  interpretNextInstructionFor: client
+ 	(deadCode and: [(joins at: pc) notNil]) ifTrue:
+ 		[deadCode := false].
  	joins at: pc put: stackp.
  	^encoderClass
  		ifNil: [super interpretNextInstructionFor: client]
  		ifNotNil: [encoderClass interpretNextInstructionFor: client in: self]!

Item was changed:
  ----- Method: StackDepthFinder>>method:pc: (in category 'private') -----
  method: method pc: startpc
  	super method: method pc: startpc.
  	"The + 1 is there for full blocks ending with non local return,
  	as the following pc is mapped and beyong endPC"
  	joins := Array new: method endPC + 1.
+ 	stackp := method numTemps.
+ 	deadCode := false!
- 	stackp := method numTemps!

Item was changed:
  ----- Method: StackDepthFinder>>resetStackAfterBranchOrReturn (in category 'stack depth') -----
  resetStackAfterBranchOrReturn
  	pc <= joins size ifTrue:
  		[(joins at: pc) ifNil:
  			["We would like to raise an error here, but we can't because the bytecode
  			  compiler doesn't remove dead code.  e.g. the following doesn't reach ^nil
  			  but is legal Smalltalk:
  				self foo
  					ifTrue: [^self bar]
  					ifFalse: [^self baz].
  				^nil"
+ 				deadCode := true.
  				^self].
  		 stackp := joins at: pc]!



More information about the Vm-dev mailing list