[Vm-dev] VM Maker: VMMaker.oscog-eem.3188.mcz

commits at source.squeak.org commits at source.squeak.org
Tue Jun 14 00:59:08 UTC 2022


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

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

Name: VMMaker.oscog-eem.3188
Author: eem
Time: 13 June 2022, 5:58:51.981113 pm
UUID: 010bab73-d814-4c05-b0f1-f2da78c1568f
Ancestors: VMMaker.oscog-eem.3187

Refactor CoInterpreter>>#followForwardedFieldsInCurrentMethod to avoid the (albeit rare) possibility of failing to reenable method zone executability after a send fault. Move the pruneYoungReferrers into Cogit>>followForwardedLiteralsIn: and use followForwardedLiteralsImplementationIn: within followMovableLiteralsAndUpdateYoungReferrers instead of the refactored followForwardedLiteralsIn:. Fix a slip in freeUnmarkedMachineCode.

=============== Diff against VMMaker.oscog-eem.3187 ===============

Item was changed:
  ----- Method: CoInterpreter>>followForwardedFieldsInCurrentMethod (in category 'message sending') -----
  followForwardedFieldsInCurrentMethod
- 	| cogMethod wasInYoungReferrers |
  	<var: #cogMethod type: #'CogMethod *'>
  	<inline: false>
  	(self isMachineCodeFrame: framePointer)
  		ifTrue:
+ 			[| cogMethod |
+ 			 cogMethod := self mframeHomeMethod: framePointer.
- 			[cogMethod := self mframeHomeMethod: framePointer.
  			 objectMemory
  				followForwardedObjectFields: cogMethod methodObject
  				toDepth: 0.
+ 			 cogit followForwardedLiteralsIn: cogMethod]
- 			 wasInYoungReferrers := cogMethod cmRefersToYoung.
- 			 cogit followForwardedLiteralsIn: cogMethod.
- 			 (wasInYoungReferrers and: [cogMethod cmRefersToYoung not]) ifTrue:
- 				[cogit pruneYoungReferrers]]
  		ifFalse:
  			[objectMemory
  				followForwardedObjectFields: method
  				toDepth: 0]!

Item was changed:
  ----- Method: Cogit>>followForwardedLiteralsIn: (in category 'garbage collection') -----
  followForwardedLiteralsIn: cogMethod
  	<api>
  	<option: #SpurObjectMemory>
  	<var: #cogMethod type: #'CogMethod *'>
+ 	| wasInYoungReferrers |
  	self ensureWritableCodeZone.
+ 	wasInYoungReferrers := cogMethod cmRefersToYoung.
  	self followForwardedLiteralsImplementationIn: cogMethod.
+ 	(wasInYoungReferrers and: [cogMethod cmRefersToYoung not]) ifTrue:
+ 		[self pruneYoungReferrers].
  	self ensureExecutableCodeZone!

Item was changed:
  ----- Method: Cogit>>followMovableLiteralsAndUpdateYoungReferrers (in category 'garbage collection') -----
  followMovableLiteralsAndUpdateYoungReferrers
  	"To avoid runtime checks on literal variable and literal accesses in == and ~~, 
  	 we follow literals in methods having movable literals in the postBecome action.
  	 To avoid scanning every method, we annotate cogMethods with the 
  	 cmHasMovableLiteral flag."
  	<option: #SpurObjectMemory>
  	<api>
  	<returnTypeC: #void>
  	| cogMethod |
  	<var: #cogMethod type: #'CogMethod *'>
  	self assert: methodZone kosherYoungReferrers.
  	"methodZone firstBogusYoungReferrer"
  	"methodZone occurrencesInYoungReferrers: methodZone firstBogusYoungReferrer"
  	codeModified := false.
+ 	self ensureWritableCodeZone.
  	cogMethod := self cCoerceSimple: methodZoneBase to: #'CogMethod *'.
  	[cogMethod < methodZone limitZony] whileTrue:
  		[cogMethod cmType ~= CMFree ifTrue:
  			[cogMethod cmHasMovableLiteral ifTrue:
+ 				[self followForwardedLiteralsImplementationIn: cogMethod]].
+ 		 cogMethod := methodZone methodAfter: cogMethod].
- 				[self followForwardedLiteralsIn: cogMethod]].
- 		 cogMethod := methodZone methodAfter: cogMethod]..
  	methodZone pruneYoungReferrers.
  	codeModified ifTrue: "After updating oops in inline caches we need to flush the icache."
  		[backEnd flushICacheFrom: codeBase asUnsignedInteger to: methodZone freeStart].
  	"And ensure code zone is executable.  May have pruned young referrers..."
  	self ensureExecutableCodeZone!

Item was changed:
  ----- Method: Cogit>>freeUnmarkedMachineCode (in category 'jit - api') -----
  freeUnmarkedMachineCode
  	"Free machine-code methods whose compiled methods are unmarked
  	 and open PICs whose selectors are not marked, and closed PICs that
  	 refer to unmarked objects."
  	<api>
  	<option: #SpurObjectMemory>
  	| cogMethod freedMethod |
  	self moveProfileToMethods. "simulation only..."
  
  	freedMethod := false.
  	cogMethod := self cCoerceSimple: methodZoneBase to: #'CogMethod *'.
  	[cogMethod < methodZone limitZony] whileTrue:
  		[(cogMethod cmType = CMMethod
  		  and: [(objectMemory isMarked: cogMethod methodObject) not]) ifTrue:
  			[freedMethod := true.
  			 methodZone freeMethod: cogMethod].
  		 (cogMethod cmType = CMOpenPIC
  		  and: [(objectMemory isImmediate: cogMethod selector) not
  		  and: [(objectMemory isMarked: cogMethod selector) not]]) ifTrue:
  			[freedMethod := true.
  			 methodZone freeMethod: cogMethod].
  		 (cogMethod cmType = CMClosedPIC
  		  and: [self closedPICRefersToUnmarkedObject: cogMethod]) ifTrue:
  			[freedMethod := true.
  			 methodZone freeMethod: cogMethod].
  		 cogMethod := methodZone methodAfter: cogMethod].
  	freedMethod ifTrue:
  		[self unlinkSendsToFree].
+ 	self ensureExecutableCodeZone!
- 	backEnd ensureExecutableCodeZone!



More information about the Vm-dev mailing list