Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.299.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.299 Author: eem Time: 14 June 2013, 4:47:32.815 pm UUID: e51057f5-4de2-4c2b-82ce-844d130e2f33 Ancestors: VMMaker.oscog-eem.298
Fix bad performance regression that on certain platforms (linux) results in all send misses causing a discarded PIC creation followed by a slow hash lookup.
=============== Diff against VMMaker.oscog-eem.298 ===============
Item was changed: ----- Method: Cogit>>ceSICMiss: (in category 'in-line cacheing') ----- ceSICMiss: receiver "An in-line cache check in a method has failed. The failing entry check has jumped to the ceMethodAbort abort call at the start of the method which has called this routine. If possible allocate a closed PIC for the current and existing classes. The stack looks like: receiver args sender return address sp=> ceMethodAbort call return address So we can find the method that did the failing entry check at ceMethodAbort call return address - missOffset and we can find the send site from the outer return address." <api> | pic innerReturn outerReturn entryPoint targetMethod newTargetMethodOrNil errorSelectorOrNil cacheTag extent result | <var: #pic type: #'CogMethod *'> <var: #targetMethod type: #'CogMethod *'> "Whether we can relink to a PIC or not we need to pop off the inner return and identify the target method." innerReturn := coInterpreter popStack. targetMethod := self cCoerceSimple: innerReturn - missOffset to: #'CogMethod *'. outerReturn := coInterpreter stackTop. self assert: (outerReturn between: methodZoneBase and: methodZone freeStart). entryPoint := backEnd callTargetFromReturnAddress: outerReturn.
self assert: targetMethod selector ~= objectMemory nilObject. self cppIf: NewspeakVM ifTrue: [self assert: (targetMethod asInteger + cmEntryOffset = entryPoint or: [targetMethod asInteger + cmDynSuperEntryOffset = entryPoint]). "Avoid the effort of implementing PICs for the relatively low dynamic frequency dynamic super send and simply rebind the send site." targetMethod asInteger + cmDynSuperEntryOffset = entryPoint ifTrue: [^coInterpreter ceDynamicSuperSend: targetMethod selector to: receiver numArgs: targetMethod cmNumArgs]]. self assert: targetMethod asInteger + cmEntryOffset = entryPoint.
self lookup: targetMethod selector for: receiver methodAndErrorSelectorInto: [:method :errsel| newTargetMethodOrNil := method. errorSelectorOrNil := errsel]. "We assume lookupAndCog:for: will *not* reclaim the method zone" self assert: outerReturn = coInterpreter stackTop. cacheTag := objectRepresentation inlineCacheTagForInstance: receiver. ((errorSelectorOrNil notNil and: [errorSelectorOrNil ~= SelectorDoesNotUnderstand]) or: [(objectRepresentation inlineCacheTagIsYoung: cacheTag) or: [newTargetMethodOrNil isNil or: [objectMemory isYoung: newTargetMethodOrNil]]]) ifTrue: [result := self patchToOpenPICFor: targetMethod selector numArgs: targetMethod cmNumArgs receiver: receiver. self assert: result not. "If patchToOpenPICFor:.. returns we're out of code memory" ^coInterpreter ceSendFromInLineCacheMiss: targetMethod]. "See if an Open PIC is already available." pic := methodZone openPICWithSelector: targetMethod selector. pic isNil ifTrue: ["otherwise attempt to create a closed PIC for the two cases." pic := self cogPICSelector: targetMethod selector numArgs: targetMethod cmNumArgs Case0Method: targetMethod Case1Method: newTargetMethodOrNil tag: cacheTag isMNUCase: errorSelectorOrNil = SelectorDoesNotUnderstand. + (pic asInteger between: MaxNegativeErrorCode and: -1) ifTrue: - pic asInteger < 0 ifTrue: ["For some reason the PIC couldn't be generated, most likely a lack of code memory. Continue as if this is an unlinked send." pic asInteger = InsufficientCodeSpace ifTrue: [coInterpreter callForCogCompiledCodeCompaction]. ^coInterpreter ceSendFromInLineCacheMiss: targetMethod]. processor flushICacheFrom: pic asInteger to: pic asInteger + closedPICSize]. "Relink the send site to the pic." extent := backEnd rewriteCallAt: outerReturn target: pic asInteger + cmEntryOffset. processor flushICacheFrom: outerReturn - 1 - extent to: outerReturn - 1. "Jump back into the pic at its entry in case this is an MNU (newTargetMethodOrNil is nil)" coInterpreter executeCogMethodFromLinkedSend: pic withReceiver: receiver andCacheTag: (backEnd inlineCacheTagAt: outerReturn). "NOTREACHED" ^nil!
vm-dev@lists.squeakfoundation.org