[Vm-dev] VM Maker: VMMaker.oscog-eem.669.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Apr 8 16:12:11 UTC 2014
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.669.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.669
Author: eem
Time: 8 April 2014, 9:09:52.873 am
UUID: bb746b04-e032-4c6f-9a28-e67a3987c898
Ancestors: VMMaker.oscog-eem.668
Fix bug in unlinkSendsOf:isMNUSelector: (primitiveFlushCacheBySelector)
where old code could free the method of an active frame.
=============== Diff against VMMaker.oscog-eem.668 ===============
Item was changed:
----- Method: Cogit>>unlinkSendsOf:isMNUSelector: (in category 'jit - api') -----
unlinkSendsOf: selector isMNUSelector: isMNUSelector
<api>
+ "Unlink all sends in cog methods. Free all Closed PICs with the selector,
+ or with an MNU case if isMNUSelector. First check if any method actually
+ has the selector; if not there can't be any linked send to it. This routine
+ (including descendents) is performance critical. It contributes perhaps
+ 30% of entire execution time in Compiler recompileAll."
+ | cogMethod mustScanAndUnlink |
- "Unlink all sends in cog methods."
- | freeSpace cogMethod |
<var: #cogMethod type: #'CogMethod *'>
methodZoneBase isNil ifTrue: [^self].
cogMethod := self cCoerceSimple: methodZoneBase to: #'CogMethod *'.
+ mustScanAndUnlink := false.
+ isMNUSelector
+ ifTrue:
+ [[cogMethod < methodZone limitZony] whileTrue:
+ [cogMethod cpicHasMNUCase
+ ifTrue:
+ [self assert: cogMethod cmType = CMClosedPIC.
+ methodZone freeMethod: cogMethod.
+ mustScanAndUnlink := true]
+ ifFalse:
+ [cogMethod selector = selector ifTrue:
+ [mustScanAndUnlink := true.
+ cogMethod cmType = CMClosedPIC ifTrue:
+ [methodZone freeMethod: cogMethod]]].
+ cogMethod := methodZone methodAfter: cogMethod]]
+ ifFalse:
+ [[cogMethod < methodZone limitZony] whileTrue:
+ [cogMethod selector = selector ifTrue:
+ [mustScanAndUnlink := true.
+ cogMethod cmType = CMClosedPIC ifTrue:
+ [methodZone freeMethod: cogMethod]].
+ cogMethod := methodZone methodAfter: cogMethod]].
+ mustScanAndUnlink ifFalse:
- freeSpace := methodZone methodBytesFreedSinceLastCompaction.
- "First check if any method actually has the selector; if not there can't
- be any linked send to it."
- [cogMethod < methodZone limitZony
- and: [cogMethod selector ~= selector]] whileTrue:
- [(cogMethod cmType ~= CMFree
- and: [(isMNUSelector and: [cogMethod cpicHasMNUCase])
- or: [cogMethod selector = selector]]) ifTrue:
- [methodZone freeMethod: cogMethod].
- cogMethod := methodZone methodAfter: cogMethod].
- (cogMethod >= methodZone limitZony
- and: [freeSpace = methodZone methodBytesFreedSinceLastCompaction]) ifTrue:
[^self].
codeModified := false.
cogMethod := self cCoerceSimple: methodZoneBase to: #'CogMethod *'.
[cogMethod < methodZone limitZony] whileTrue:
[cogMethod cmType = CMMethod ifTrue:
[self mapFor: cogMethod
performUntil: #unlinkIfFreeOrLinkedSend:pc:of:
arg: selector].
cogMethod := methodZone methodAfter: cogMethod].
codeModified ifTrue: "After possibly updating inline caches we need to flush the icache."
[processor flushICacheFrom: methodZoneBase to: methodZone limitZony asInteger]!
More information about the Vm-dev
mailing list