The Trunk: Compiler-eem.166.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Compiler-eem.166.mcz

commits-2
Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.166.mcz

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

Name: Compiler-eem.166
Author: eem
Time: 17 August 2010, 2:34:59.272 pm
UUID: 04c47990-84b1-4832-ac47-c0c16ae18b71
Ancestors: Compiler-eem.165

Third and final stage of old parse node emitters and sizers cleanup.
Merges BytecodeAgnosticMethodNode into MethodNode and
deletes BytecodeAgnosticMethodNode.

=============== Diff against Compiler-eem.165 ===============

Item was removed:
- ----- Method: BytecodeAgnosticMethodNode>>generateWithTempNames (in category 'code generation') -----
- generateWithTempNames
- "Answer a CompiledMethod with temps names encoded in trailer"
- ^ self generate: (CompiledMethodTrailer new tempNames: self schematicTempNamesString).
- !

Item was removed:
- ----- Method: BytecodeAgnosticMethodNode>>noteBlockEntry: (in category 'code generation (closures)') -----
- noteBlockEntry: aBlock
- "Evaluate aBlock with the numbering for the block entry."
- locationCounter isNil ifTrue:
- [locationCounter := -1].
- aBlock value: locationCounter + 1.
- locationCounter := locationCounter + 2!

Item was removed:
- ----- Method: BytecodeAgnosticMethodNode>>noteBlockExit: (in category 'code generation (closures)') -----
- noteBlockExit: aBlock
- "Evaluate aBlock with the numbering for the block exit."
- aBlock value: locationCounter + 1.
- locationCounter := locationCounter + 2!

Item was removed:
- ----- Method: BytecodeAgnosticMethodNode>>schematicTempNamesString (in category 'debugger support') -----
- schematicTempNamesString
- "Answer the temp names for the current method node in a form that captures
- temp structure.  The temps at each method and block scope level occur
- space-separated, with any indirect temps enclosed in parentheses.  Each block
- level is enclosed in square brackets.  e.g.
- 'method level temps (indirect temp)[block args and temps (indirect)]'
- This representation can be reconstituted into a blockExtentsToTempsMap
- by a CompiledMethod that has been copied with the schematicTempNamesString."
- encoder hasGeneratedMethod ifFalse:
- ["create the encoder's blockExtentsToLoals map, except if the method is quick
-  in which case it has no temps."
- (self generate) isQuick ifTrue:
- [^'']].
- ^encoder schematicTempNamesString!

Item was removed:
- ----- Method: BytecodeAgnosticMethodNode>>printWithClosureAnalysisOn: (in category 'printing') -----
- printWithClosureAnalysisOn: aStream
- self ensureClosureAnalysisDone.
- super printWithClosureAnalysisOn: aStream!

Item was removed:
- ----- Method: BytecodeAgnosticMethodNode>>referencedValuesWithinBlockExtent: (in category 'code generation (closures)') -----
- referencedValuesWithinBlockExtent: anInterval
- ^(localsPool select:
- [:temp|
- temp isReferencedWithinBlockExtent: anInterval]) collect:
- [:temp|
- temp isRemote ifTrue: [temp remoteNode] ifFalse: [temp]]!

Item was removed:
- ----- Method: BytecodeAgnosticMethodNode>>ensureClosureAnalysisDone (in category 'code generation (closures)') -----
- ensureClosureAnalysisDone
- block blockExtent ifNil:
- [temporaries := block analyseArguments: arguments temporaries: temporaries rootNode: self]!

Item was removed:
- MethodNode subclass: #BytecodeAgnosticMethodNode
- instanceVariableNames: 'locationCounter localsPool'
- classVariableNames: ''
- poolDictionaries: ''
- category: 'Compiler-ParseNodes'!
-
- !BytecodeAgnosticMethodNode commentStamp: '<historical>' prior: 0!
- I am a version of MethodNode that is able to work with different BytecodeEncoders, and is hence able to generate methods using different bytecode sets.!

Item was removed:
- ----- Method: BytecodeAgnosticMethodNode>>hasGeneratedMethod (in category 'debugger support') -----
- hasGeneratedMethod
- ^encoder hasGeneratedMethod!

Item was removed:
- ----- Method: BytecodeAgnosticMethodNode>>blockExtentsToTempsMap (in category 'debugger support') -----
- blockExtentsToTempsMap
- "Answer a Dictionary of blockExtent to temp locations for the current method.
- This is used by the debugger to locate temp vars in contexts.  A temp map
- entry is a pair of the temp's name and its index, where an index is either an
- integer for a normal temp or a pair of the index of the indirect temp vector
- containing  the temp and the index of the temp in its indirect temp vector."
-
- ^encoder blockExtentsToTempsMap ifNil:
- [| methNode |
- methNode := encoder classEncoding parserClass new
- encoderClass: encoder class;
- parse: (sourceText ifNil: [self decompileString])
- class: self methodClass.
- "As a side effect generate: creates data needed for the map."
- methNode generate.
- methNode encoder blockExtentsToTempsMap]!

Item was removed:
- ----- Method: BytecodeEncoder>>methodNodeClass (in category 'accessing') -----
- methodNodeClass
- ^BytecodeAgnosticMethodNode!

Item was removed:
- ----- Method: BytecodeAgnosticMethodNode>>generate: (in category 'code generation') -----
- generate: trailer
- "The receiver is the root of a parse tree. Answer a CompiledMethod.
- 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 ifQuick:
- [:m |
-  m literalAt: 2 put: encoder associationForClass;
- properties: properties.
- ^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]
- ifNotNil: [primErrNode sizeCodeForStore: encoder "The VM relies on storeIntoTemp: (129)"]).
- method := CompiledMethod
- newBytes: blkSize
- trailerBytes: trailer
- nArgs: arguments size
- nTemps: (encoder supportsClosureOpcodes
- ifTrue: [| locals |
- locals := arguments,
-  temporaries,
-  (primErrNode
- ifNil: [#()]
- ifNotNil: [{primErrNode}]).
- encoder
- 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.
- 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.
- ^method!

Item was removed:
- ----- Method: BytecodeAgnosticMethodNode>>locationCounter (in category 'code generation (closures)') -----
- locationCounter
- ^locationCounter!

Item was removed:
- ----- Method: BytecodeAgnosticMethodNode>>addLocalsToPool: (in category 'code generation (closures)') -----
- addLocalsToPool: locals "<Set of: TempVariableNode>"
- localsPool isNil ifTrue:
- [localsPool := IdentitySet new].
- localsPool addAll: locals!