[Vm-dev] VM Maker: Cog-eem.178.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Aug 1 17:43:12 UTC 2014


Eliot Miranda uploaded a new version of Cog to project VM Maker:
http://source.squeak.org/VMMaker/Cog-eem.178.mcz

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

Name: Cog-eem.178
Author: eem
Time: 1 August 2014, 7:42:55.562 am
UUID: ad922a94-347a-4388-a3ba-b7909353c4b9
Ancestors: Cog-eem.177

Avoid assigning to ifNotNil: block args in some SpurBootstap
methods

=============== Diff against Cog-eem.177 ===============

Item was changed:
  ----- Method: SpurBootstrap>>addNewMethods (in category 'bootstrap methods') -----
  addNewMethods
  	"Get the simulator to add any and all missing methods immediately."
  	| cmaiaSym basSym |
  	cmaiaSym := self findSymbol: #compiledMethodAt:ifAbsent:.
  	basSym := self findSymbol: #basicAddSelector:withMethod:.
  	basSym ifNil:
  		[basSym := self findSymbol: #addSelectorSilently:withMethod:].
  	self allPrototypeClassNamesDo:
  		[:sym :symIsMeta|
  		(self findClassNamed: (literalMap at: sym))
  			ifNil: [Transcript
  					cr;
  					nextPutAll: 'not installing any methods for ';
  					nextPutAll: sym;
  					nextPutAll: '; class not found in image';
  					flush.]
  			ifNotNil:
+ 				[:theClass| | class |
+ 				class := symIsMeta ifTrue: [oldHeap fetchClassOfNonImm: theClass] ifFalse: [theClass].
- 				[:class|
- 				symIsMeta ifTrue: [class := oldHeap fetchClassOfNonImm: class].
  				self prototypeClassNameMetaSelectorMethodDo:
  					[:className :isMeta :selector :method| | methodOrNil |
  					(className = sym
  					 and: [symIsMeta = isMeta]) ifTrue:
  						["probe method dictionary of the class for each method, installing a dummy if not found."
  						 "Transcript cr; nextPutAll: 'checking for '; nextPutAll: selector; flush."
  						 methodOrNil := self interpreter: oldInterpreter
  											object: class
  											perform: cmaiaSym
  											withArguments: {literalMap at: selector. oldHeap nilObject}.
  						 methodOrNil = oldHeap nilObject
  							ifTrue: "no method.  install the real thing now"
  								[Transcript
  									cr;
  									nextPutAll: 'installing ';
  									nextPutAll: className;
  									nextPutAll: (isMeta ifTrue: [' class>>'] ifFalse: ['>>']);
  									store: selector;
  									flush.
  								 self interpreter: oldInterpreter
  									object: class
  									perform: basSym
  									withArguments: { literalMap at: selector.
  													   self installableMethodFor: method
  														selector: selector
  														className: className
  														isMeta: isMeta}.
  								installedPrototypes add: method selector]
  							ifFalse: "existing method; collect the methodClassAssociation; its needed later"
  								[methodClasses add: (oldInterpreter methodClassAssociationOf: methodOrNil)]]]]]!

Item was changed:
  ----- Method: SpurBootstrap>>replaceMethods (in category 'bootstrap methods') -----
  replaceMethods
  	"Replace all the modified method prototypes."
  	self allPrototypeClassNamesDo:
  		[:sym :symIsMeta|
  		(self findClassNamed: (literalMap at: sym))
  			ifNil: [Transcript
  					cr;
  					nextPutAll: 'not replacing any methods for ';
  					nextPutAll: sym;
  					nextPutAll: '; class not found in image';
  					flush.]
  			ifNotNil:
+ 				[:theClass| | class |
+ 				class := symIsMeta ifTrue: [oldHeap fetchClassOfNonImm: theClass] ifFalse: [theClass].
- 				[:class|
- 				symIsMeta ifTrue: [class := oldHeap fetchClassOfNonImm: class].
  				self prototypeClassNameMetaSelectorMethodDo:
  					[:className :isMeta :selector :method| | replacement methodDict index |
  					(className = sym
  					 and: [symIsMeta = isMeta]) ifTrue:
  						[(installedPrototypes includes: method selector) ifFalse:
  							["probe method dictionary of the class for each method, installing a dummy if not found."
  							Transcript
  								cr;
  								nextPutAll: 'replacing ';
  								nextPutAll: className;
  								nextPutAll: (isMeta ifTrue: [' class>>'] ifFalse: ['>>']);
  								store: selector;
  								flush.
  							replacement := self installableMethodFor: method
  												selector: selector
  												className: className
  												isMeta: isMeta.
  							methodDict := oldHeap fetchPointer: MethodDictionaryIndex ofObject: class.
  							index := self indexOfSelector: (literalMap at: selector) in: methodDict.
  							oldHeap
  								storePointer: index - SelectorStart
  								ofObject: (oldHeap fetchPointer: MethodArrayIndex ofObject: methodDict)
  								withValue: replacement.
  							installedPrototypes add: method selector]]]]]!



More information about the Vm-dev mailing list