[Pkg] The Trunk: Compiler-nice.260.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Apr 5 20:10:09 UTC 2013

Nicolas Cellier uploaded a new version of Compiler to project The Trunk:

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

Name: Compiler-nice.260
Author: nice
Time: 5 April 2013, 2:35:00.651 am
UUID: 82f1b6fa-9e25-43ac-823e-03ca6ea6971c
Ancestors: Compiler-eem.259

When we assign a special binding just for effect, the binding seems to be pushed twice on the stack
1) once in emitCodeForLoad: stack forValue: false encoder: encoder.
2) then in emitCodeForStore: stack encoder: encoder
and IMHO it's a bug because the binding is popped only once...

I suggest a different and simpler implementation for emitCodeForStorePop:encoder: we don't have to dup the value on the stack in this case.

=============== Diff against Compiler-eem.259 ===============

Item was changed:
  ----- Method: LiteralVariableNode>>emitCodeForStorePop:encoder: (in category 'code generation') -----
  emitCodeForStorePop: stack encoder: encoder
  	writeNode ifNil:
  		[stack pop: 1.
  		 ^encoder genStorePopLiteralVar: index].
+ 	writeNode
+ 		emitCode: stack
+ 		args: 1
+ 		encoder: encoder
+ 		super: false.
+ 	stack pop: 1.
+ 	encoder genPop!
- 	self emitCodeForStore: stack encoder: encoder.
- 	encoder genPop.
- 	stack pop: 1.!

Item was changed:
  ----- Method: LiteralVariableNode>>sizeCodeForStorePop: (in category 'code generation') -----
  sizeCodeForStorePop: encoder
  	self reserve: encoder.
  	^(key isVariableBinding and: [key isSpecialWriteBinding])
+ 		ifTrue: [	writeNode := encoder encodeSelector: #value:.
+ 				^ (writeNode sizeCode: encoder args: 1 super: false)
+ 	  			+ encoder sizePop]
- 		ifTrue: [(self sizeCodeForStore: encoder) + encoder sizePop]
  		ifFalse: [encoder sizeStorePopLiteralVar: index]!

More information about the Packages mailing list