[squeak-dev] The Trunk: Compiler-eem.287.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Aug 10 20:01:12 UTC 2014

Eliot Miranda uploaded a new version of Compiler to project The Trunk:

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

Name: Compiler-eem.287
Author: eem
Time: 10 August 2014, 1:00:51.952 pm
UUID: 3d4cff37-addb-4d6e-9a1f-d54e365d4e6c
Ancestors: Compiler-eem.286

Quick methods may need schematic temps too...

=============== Diff against Compiler-eem.286 ===============

Item was changed:
  ----- Method: MethodNode>>generate:using: (in category 'code generation') -----
  generate: trailer using: aCompiledMethodClass
  	"The receiver is the root of a parse tree. Answer an instance of aCompiledMethodClass.
  	 The argument, trailer, is arbitrary but is typically either the reference to the source code
  	 that is stored with every CompiledMethod, or an encoding of the method's temporary names."
  	| primErrNode blkSize nLits literals stack method |
  	self generate: trailer
  		using: aCompiledMethodClass
  			[:m |
+ 			 encoder noteBlockExtent: (0 to: 2) hasLocals: arguments.
+ 			 m	literalAt: 2 put: encoder associationForClass;
- 			  m	literalAt: 2 put: encoder associationForClass;
  				properties: properties.
+ 			 ^m].
- 			^m].
  	primErrNode := self primitiveErrorVariableName ifNotNil:
  						[encoder fixTemp: self primitiveErrorVariableName].
  	encoder supportsClosureOpcodes ifTrue:
  		[self ensureClosureAnalysisDone.
  		 encoder rootNode: self. "this is for BlockNode>>sizeCodeForClosureValue:"].
  	blkSize := (block sizeCodeForEvaluatedValue: encoder)
  				+ (primErrNode
  					ifNil: [0]
  							index: arguments size + temporaries size;
  							sizeCodeForStore: encoder "The VM relies on storeIntoTemp: (129)"]).
  	method := aCompiledMethodClass
  				newBytes: blkSize
  				trailerBytes: trailer 
  				nArgs: arguments size
  				nTemps: (encoder supportsClosureOpcodes
  							ifTrue: [| locals |
  									locals := arguments,
  												ifNil: [#()]
  												ifNotNil: [{primErrNode}]).
  										noteBlockExtent: block blockExtent
  										hasLocals: locals.
  									locals size]
  							ifFalse: [encoder maxTemp])
  				nStack: 0
  				nLits: (nLits := (literals := encoder allLiterals) size)
  				primitive: primitive.
  	nLits > 255 ifTrue:
  		[^self error: 'Too many literals referenced'].
  	1 to: nLits do: [:lit | method literalAt: lit put: (literals at: lit)].
  	encoder streamToMethod: method.
  	stack := ParseStack new init.
  	primErrNode ifNotNil: [primErrNode emitCodeForStore: stack encoder: encoder].
  	stack position: method numTemps.
  	[block emitCodeForEvaluatedValue: stack encoder: encoder]
  		on: Error "If an attempt is made to write too much code the method will be asked"
  		do: [:ex|  "to grow, and the grow attempt will fail in CompiledMethod class>>#new:"
  			ex signalerContext sender method = (CompiledMethod class>>#new:)
  				ifTrue: [^self error: 'Compiler code size discrepancy']
  				ifFalse: [ex pass]].
  	stack position ~= (method numTemps + 1) ifTrue:
  		[^self error: 'Compiler stack discrepancy'].
  	encoder methodStreamPosition ~= (method size - trailer size) ifTrue:
  		[^self error: 'Compiler code size discrepancy'].
  	method needsFrameSize: stack size - method numTemps.
  	method properties: properties.

More information about the Squeak-dev mailing list