[Pkg] SystemEditor: SystemEditor-Squeak-mtf.156.mcz

squeak-dev-noreply at lists.squeakfoundation.org squeak-dev-noreply at lists.squeakfoundation.org
Tue Nov 18 19:00:47 UTC 2008


A new version of SystemEditor-Squeak was added to project SystemEditor:
http://www.squeaksource.com/SystemEditor/SystemEditor-Squeak-mtf.156.mcz

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

Name: SystemEditor-Squeak-mtf.156
Author: mtf
Time: 18 November 2008, 12:00:30 pm
UUID: 382d9f0c-597d-4bfa-a96b-65519b370280
Ancestors: SystemEditor-Squeak-mtf.155

Greatly improved the smartness of finding the compiler for a given class. This should fix all loading problems in which the compiler changes during load. A good test would be to ensure that FFI and a dependent package can be loaded atomicly together

=============== Diff against SystemEditor-Squeak-mtf.155 ===============

Item was changed:
  ----- Method: MethodEditor>>compileFor: (in category 'building') -----
  compileFor: aClassEditor
+ 
+ 	^ self
+ 		compileForClass: aClassEditor product
+ 		using: aClassEditor ensuredCompilerClass new!
- [
- 	| node method |
- 	node := aClassEditor product compilerClass new
- 				compile: source
- 				in: aClassEditor product
- 				notifying: requestor
- 				ifFail: nil.
- 	node encoder requestor: self.
- 	method := node generate: #(0 0 0 0).
- 	(method respondsTo: #selector:) "set selector on 3.9 and above"
- 		ifTrue: [method selector: node selector].
- 	^ method
- ] on: SyntaxErrorNotification do: [:ex |
- 	"In 3.10, the class category needs to be set"
- 	ex instVarNamed: #category put: aClassEditor category.
- 	"Let the user fix and install the fixed code into the class's old or temporary MethodDictionary"
- 	ex outer.
- 	"Now fetch and use that code instead"
- 	source := aClassEditor product sourceCodeAt: self selector ifAbsent: [^ nil].
- 	^ aClassEditor product compiledMethodAt: self selector
- ]!

Item was added:
+ ----- Method: ClassDescriptionEditor>>lookupSelector: (in category 'debugging') -----
+ lookupSelector: aSelector
+ 	^ superclass lookupSelector: aSelector!

Item was added:
+ ----- Method: PureBehaviorEditor>>edUltimateMethodAt:ifAbsent: (in category 'editing') -----
+ edUltimateMethodAt: aSelector ifAbsent: aBlock
+ 	^ self edMethodAt: aSelector ifAbsent: aBlock!

Item was added:
+ ----- Method: RootMetaclassEditor>>edUltimateMethodAt:ifAbsent: (in category 'accessing') -----
+ edUltimateMethodAt: aSelector ifAbsent: aBlock
+ 	^ aBlock value!

Item was added:
+ ----- Method: ClassEditor>>ensuredCompilerClass (in category 'accessing') -----
+ ensuredCompilerClass
+ "Answer my  product's compilerClass, building it if necessary"
+ 
+ 	| methodEditor method |
+ 	compilerClass ifNotNil: [^ compilerClass].
+ 
+ 	"Normal case: the compiler is already in the system. Check to see if I have a newer version"
+ 	self product compilerClass ifNotNil: [
+ 		compilerClass := self system classOrEditorFor: self product compilerClass.
+ 		compilerClass edIsEditor ifTrue: [compilerClass := compilerClass product].
+ 		^ compilerClass].
+ 
+ 	"If we get here, this package is presumably using a compiler that does not yet exist in the system. 
+ 	Evil evil hackery. Get the method editor, compile it in the context of the system editor,
+ 	and run it to find the editor for the new compiler"
+ 	methodEditor := self class edUltimateMethodAt: #compilerClass ifAbsent: [^ self subject
+ 		ifNil: [Compiler]
+ 		ifNotNil: [self subject compilerClass]].
+ 	method := methodEditor compileForClass: self using: Compiler new.
+ 	compilerClass := (self new executeMethod: method) product.
+ 	compilerClass ifNil: [self error: 'Unknown compiler'].
+ 	^ compilerClass!

Item was added:
+ ----- Method: ClassDescriptionEditor>>edUltimateMethodAt:ifAbsent: (in category 'accessing') -----
+ edUltimateMethodAt: aSelector ifAbsent: aBlock
+ 	^ self edMethodAt: aSelector ifAbsent: [
+ 		self superclass edUltimateMethodAt: aSelector ifAbsent: aBlock]!

Item was added:
+ ----- Method: MethodEditor>>compileForClass:using: (in category 'building') -----
+ compileForClass: aClass using: aCompiler
+ [
+ 	| node method |
+ 	node := aCompiler
+ 				compile: source
+ 				in: aClass
+ 				notifying: requestor
+ 				ifFail: nil.
+ 	node encoder requestor: self.
+ 	method := node generate: #(0 0 0 0).
+ 	(method respondsTo: #selector:) "set selector on 3.9 and above"
+ 		ifTrue: [method selector: node selector].
+ 	^ method
+ ] on: SyntaxErrorNotification do: [:ex |
+ 	"In 3.10, the class category needs to be set"
+ 	ex instVarNamed: #category put: aClass category.
+ 	"Let the user fix and install the fixed code into the class's old or temporary MethodDictionary"
+ 	ex outer.
+ 	"Now fetch and use that code instead"
+ 	source := aClass sourceCodeAt: self selector ifAbsent: [^ nil].
+ 	^ aClass compiledMethodAt: self selector
+ ]!

Item was added:
+ ----- Method: MethodEditor>>source (in category 'accessing') -----
+ source
+ 	^ source!

Item was added:
+ ----- Method: RootClassEditor>>edUltimateMethodAt:ifAbsent: (in category 'accessing') -----
+ edUltimateMethodAt: aSelector ifAbsent: aBlock
+ 	^ aBlock value!

Item was added:
+ ----- Method: PureBehaviorEditor>>ensuredCompilerClass (in category 'accessing') -----
+ ensuredCompilerClass
+ "Answer the compiler for my methods, building it if necessary"
+ 
+ 	^ self product compilerClass!

Item was removed:
- ----- Method: MetaclassEditor>>lookupSelector: (in category 'debugging') -----
- lookupSelector: aSelector
- 	
- 	"Override the implementation in Behavior to make ClassEditor
- 	debuggable. The debugger calls this during simulated execution,
- 	and since we override #includesSelector and #superclass to 
- 	reflect on the subject, we get incorrect method dispatch."
- 
- 	| lookupClass dict |
- 	lookupClass := self.
- 	[lookupClass == nil] whileFalse: 
- 		[dict := lookupClass instVarAt: 2.
- 		(dict includesKey: aSelector)
- 			ifTrue: [^ dict at: aSelector].
- 		lookupClass := lookupClass instVarAt: 1].
- 	^ nil!



More information about the Packages mailing list