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

commits at source.squeak.org commits at source.squeak.org
Sat Nov 2 03:31:12 UTC 2013


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

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

Name: VMMaker.oscog-eem.494
Author: eem
Time: 1 November 2013, 8:24:00.412 pm
UUID: 85c763bf-2961-4872-becd-77a7ca626a8a
Ancestors: VMMaker.oscog-eem.493

Improve dead-code elimination to exprs like false or: [false].

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

Item was changed:
  ----- Method: CCodeGenerator>>nilOrBooleanConstantReceiverOf: (in category 'utilities') -----
+ nilOrBooleanConstantReceiverOf: aNode
+ 	"Answer nil or the boolean constant that is the receiver of the given message send.
+ 	 Used to suppress conditional code when the condition is a translation-time constant."
- nilOrBooleanConstantReceiverOf: sendNode
- 	"Answer nil or the boolean constant that is the receiver of the given message send. Used to suppress conditional code when the condition is a translation-time constant."
  
+ 	| rcvr |
- 	| rcvr val |
  	generateDeadCode ifTrue:[^nil].
+ 	rcvr := aNode isSend ifTrue: [aNode receiver] ifFalse: [aNode].
+ 	(rcvr isConstant
+ 	 and: [#(true false) includes: rcvr value]) ifTrue:
+ 		[^rcvr value].
+ 	(rcvr isSend
+ 	 and: [(#(or: and:) includes: rcvr selector)
+ 	 and: [rcvr args last isStmtList
+ 	 and: [rcvr args last statements size = 1]]]) ifTrue:
+ 		[(self nilOrBooleanConstantReceiverOf: rcvr receiver) ifNotNil:
+ 			[:rcvrRcvr|
+ 			(self nilOrBooleanConstantReceiverOf: rcvr args last statements first) ifNotNil:
+ 				[:rcvrArg|
+ 				^rcvrRcvr perform: rcvr selector with: rcvrArg]]].
+ 	^nil
- 	rcvr := sendNode receiver.
- 	rcvr isConstant ifTrue: [
- 		val := rcvr value.
- 		((val == true) or: [val == false]) ifTrue: [^ val]].
- 	^ nil
  !



More information about the Vm-dev mailing list