[squeak-dev] The Trunk: Kernel-ul.880.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Oct 21 22:05:42 UTC 2014


Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.880.mcz

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

Name: Kernel-ul.880
Author: ul
Time: 21 October 2014, 4:56:17.427 pm
UUID: 4b600072-456c-413f-8b7e-e3f1ae8340f3
Ancestors: Kernel-eem.879

Compile methods with the right trailer to avoid a #becomeForward: when the actual trailer is added.

=============== Diff against Kernel-eem.879 ===============

Item was changed:
  ----- Method: Behavior>>compile:notifying: (in category 'compiling') -----
  compile: code notifying: requestor 
  	"Compile the argument, code, as source code in the context of the 
  	receiver and insEtall the result in the receiver's method dictionary. The 
  	second argument, requestor, is to be notified if an error occurs. The 
  	argument code is either a string or an object that converts to a string or 
  	a PositionableStream. This method also saves the source code."
  	
  	| methodAndNode |
  	methodAndNode  := self
  		compile: code "a Text"
  		notifying: requestor
+ 		trailer: (self defaultMethodTrailerIfLogSource: true)
- 		trailer: self defaultMethodTrailer
  		ifFail: [^nil].
  	methodAndNode method putSource: code fromParseNode: methodAndNode node inFile: 2
  			withPreamble: [:f | f cr; nextPut: $!!; nextChunkPut: 'Behavior method'; cr].
  	self addSelector: methodAndNode selector withMethod: methodAndNode method notifying: requestor.
  	^ methodAndNode selector!

Item was added:
+ ----- Method: Behavior>>defaultMethodTrailerIfLogSource: (in category 'compiling') -----
+ defaultMethodTrailerIfLogSource: logSource
+ 
+ 	logSource ifFalse: [ ^self defaultMethodTrailer ].
+ 	^CompiledMethodTrailer sourcePointerInFile: 2!

Item was changed:
  ----- Method: ClassDescription>>compile:classified:withStamp:notifying:logSource: (in category 'compiling') -----
  compile: text classified: category withStamp: changeStamp notifying: requestor logSource: logSource
+ 
+ 	| methodAndNode selector |
+ 	methodAndNode := self
+ 		compile: text asString
+ 		notifying: requestor
+ 		trailer: (self defaultMethodTrailerIfLogSource: logSource)
+ 		ifFail: [ ^nil ].
+ 	selector := methodAndNode selector.
- 	| methodAndNode |
- 	methodAndNode := self compile: text asString notifying: requestor
- 							trailer: self defaultMethodTrailer ifFail: [^nil].
  	logSource ifTrue: [
  		self logMethodSource: text forMethodWithNode: methodAndNode 
  			inCategory: category withStamp: changeStamp notifying: requestor.
  	].
+ 	self addAndClassifySelector: selector withMethod: methodAndNode 
- 	self addAndClassifySelector: methodAndNode selector withMethod: methodAndNode 
  		method inProtocol: category notifying: requestor.
+ 	self instanceSide noteCompilationOf: selector meta: self isClassSide.
+ 	^selector!
- 	self instanceSide noteCompilationOf: methodAndNode selector meta: self isClassSide.
- 	^ methodAndNode selector!

Item was changed:
  ----- Method: ClassDescription>>compile:environment:classified:withStamp:notifying:logSource: (in category 'compiling') -----
  compile: text environment: anEnvironment classified: category withStamp: changeStamp notifying: requestor logSource: logSource
  	| methodAndNode context methodNode |
  	context := CompilationCue
  		source: text
  		class: self
  		environment: anEnvironment
  		requestor: requestor.
  	methodNode := self newCompiler compile: context ifFail: [^ nil].
  	methodAndNode := CompiledMethodWithNode 
  		generateMethodFromNode: methodNode 
+ 		trailer: (self defaultMethodTrailerIfLogSource: logSource).
- 		trailer: self defaultMethodTrailer.
  
  	logSource ifTrue: [
  		self logMethodSource: text forMethodWithNode: methodAndNode 
  			inCategory: category withStamp: changeStamp notifying: requestor.
  	].
  	self addAndClassifySelector: methodAndNode selector withMethod: methodAndNode 
  		method inProtocol: category notifying: requestor.
  	self instanceSide noteCompilationOf: methodAndNode selector meta: self isClassSide.
  	^ methodAndNode selector!

Item was changed:
  ----- Method: CompiledMethod>>decompileWithTemps (in category 'decompiling') -----
  decompileWithTemps
  	"Return the decompiled parse tree that represents self, but with the temp names obtained
  	 either by compiling the sourcecode, or directly if the method has temps in its trailer."
  
  	| class selector tempNames source |
  	class := self methodClass ifNil: [Object].
  	selector := self selector ifNil: [self defaultSelector].
  
  	self holdsTempNames
  		ifTrue: [tempNames := self tempNamesString]
  		ifFalse:
  			["No source file or no source (e.g. doits) and no temp names
  			 -- decompile without temp names "
  			((self fileIndex > 0 and: [(SourceFiles at: self fileIndex) isNil])
  			or: [(source := self getSourceFromFile) isNil]) ifTrue:
  				[^self decompile].
  			tempNames := (class newCompiler
  									parse: source asString
  									in: class
  									notifying: nil)
+ 										generate: CompiledMethodTrailer empty;
- 										generate: CompiledMethodTrailer defaultMethodTrailer;
  										schematicTempNamesString].
  
  	^(self decompilerClass new withTempNames: tempNames)
  		decompile: selector
  		in: class
  		method: self methodForDecompile!

Item was added:
+ ----- Method: CompiledMethodTrailer class>>sourcePointerInFile: (in category 'as yet unclassified') -----
+ sourcePointerInFile: fileIndex
+ 
+ 	^self new
+ 		sourcePointer: (SourceFiles
+ 			sourcePointerFromFileIndex: fileIndex
+ 			andPosition: (SourceFiles at: fileIndex) position);
+ 		yourself
+ 		!



More information about the Squeak-dev mailing list