Eliot Miranda uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-eem.991.mcz ==================== Summary ==================== Name: Tools-eem.991 Author: eem Time: 1 October 2020, 7:29:41.598058 pm UUID: 23455dc2-125f-4fab-8e33-75f63177cb63 Ancestors: Tools-mt.990 Simplify the horribly complex DebuggerMethodMap by removing DebuggerMethodMapForBlueBookMethods and moving opublic protocol up to DebuggerMethodMap from DebuggerMethodMapForClosureCompiledMethods =============== Diff against Tools-mt.990 =============== Item was changed: Object subclass: #DebuggerMethodMap instanceVariableNames: 'timestamp methodReference methodNode abstractSourceRanges sortedSourceMap' classVariableNames: 'AccessLock MapCache MapCacheEntries' poolDictionaries: '' category: 'Tools-Debugger'! + !DebuggerMethodMap commentStamp: 'eem 10/1/2020 19:08' prior: 0! + I am a place-holder for information needed by the Debugger to inspect method activations. I insulate the debugger from details of code generation such as exact bytecode offsets and temporary variable locations. I have two concrete subclasses, one for methods where block bytecodes are embedded in the home method and one for methods where blocks are separate objects (CompiledBlock). These classes deal with temporary variable access. My function is to abstract the source map away from actual bytecode pcs to abstract bytecode pcs. I used to have a subclass for "BlueBook" compiled methods, with non-closure blocks, but this was removed in October 2020 for simplicity's sake. - !DebuggerMethodMap commentStamp: '<historical>' prior: 0! - I am a place-holder for information needed by the Debugger to inspect method activations. I insulate the debugger from details of code generation such as exact bytecode offsets and temporary variable locations. I have two concreate subclasses, one for methods compiled using BlueBook blocks and one for methods compiled using Closures. These classes deal with temporary variable access. My function is to abstract the source map away from actual bytecode pcs to abstract bytecode pcs. To reduce compilation time I try and defer as much computation to access time as possible as instances of me will be created after each compilation. I maintain a WeakIdentityDictionary of method to DebuggerMethodMap to cache maps. I refer to my method through a WeakArray to keep the map cache functional. If the reference from a DebuggerMethodMap to its method were strong then the method would never be dropped from the cache because the reference from its map would keep it alive.! Item was changed: ----- Method: DebuggerMethodMap class>>forMethod:methodNode: (in category 'instance creation') ----- forMethod: aMethod "<CompiledCode>" methodNode: methodNode "<MethodNode>" "Uncached instance creation method for private use or for tests. Please consider using forMethod: instead." + ^(aMethod encoderClass supportsFullBlocks + ifTrue: [DebuggerMethodMapForFullBlockCompiledMethods] + ifFalse: [DebuggerMethodMapForClosureCompiledMethods]) new - ^(aMethod isBlueBookCompiled - ifTrue: [DebuggerMethodMapForBlueBookMethods] - ifFalse: - [aMethod encoderClass supportsFullBlocks - ifTrue: [DebuggerMethodMapForFullBlockCompiledMethods] - ifFalse: [DebuggerMethodMapForClosureCompiledMethods]]) new forMethod: aMethod homeMethod methodNode: methodNode! Item was changed: + ----- Method: DebuggerMethodMap>>markRecentlyUsed (in category 'private') ----- - ----- Method: DebuggerMethodMap>>markRecentlyUsed (in category 'accessing') ----- markRecentlyUsed timestamp := Time totalSeconds! Item was changed: ----- Method: DebuggerMethodMap>>namedTempAt:in: (in category 'accessing') ----- namedTempAt: index in: aContext "Answer the value of the temp at index in aContext where index is relative to the array of temp names answered by tempNamesForContext:" + ^self + privateTempAt: index + in: aContext + startKeysToBlockExtents: aContext method startKeysToBlockExtents! - self subclassResponsibility! Item was changed: ----- Method: DebuggerMethodMap>>namedTempAt:put:in: (in category 'accessing') ----- namedTempAt: index put: aValue in: aContext "Assign the value of the temp at index in aContext where index is relative + to the array of temp names answered by tempNamesForContext:. + If the value is a copied value we also need to set it along the lexical chain." + ^self + privateTempAt: index + in: aContext + put: aValue + startKeysToBlockExtents: aContext method startKeysToBlockExtents! - to the array of temp names answered by tempNamesForContext:" - self subclassResponsibility! Item was changed: ----- Method: DebuggerMethodMap>>tempNamesForContext: (in category 'accessing') ----- tempNamesForContext: aContext "Answer an Array of all the temp names in scope in aContext starting with the home's first local (the first argument or first temporary if no arguments)." + ^(self + privateTempRefsForContext: aContext + startKeysToBlockExtents: aContext method startKeysToBlockExtents) collect: + [:pair| pair first]! - self subclassResponsibility! Item was added: + ----- Method: DebuggerMethodMap>>tempNamesForMethod: (in category 'accessing') ----- + tempNamesForMethod: aMethod + "Answer an Array of all the temp names in scope in aMethod starting with + the home's first local (the first argument or first temporary if no arguments)." + ^(self + privateTempRefsForMethod: aMethod + startKeysToBlockExtents: aMethod startKeysToBlockExtents) collect: + [:pair| pair first]! Item was changed: ----- Method: DebuggerMethodMap>>tempsAndValuesForContext: (in category 'accessing') ----- tempsAndValuesForContext: aContext + "Return a string of the temporary variables and their current values" - "Return a string of the temporary variabls and their current values" | aStream | aStream := WriteStream on: (String new: 100). (self tempNamesForContext: aContext) doWithIndex: [:title :index | aStream nextPutAll: title; nextPut: $:; space; tab. aContext print: (self namedTempAt: index in: aContext) on: aStream. aStream cr]. ^aStream contents! Item was changed: + ----- Method: DebuggerMethodMap>>timestamp (in category 'private') ----- - ----- Method: DebuggerMethodMap>>timestamp (in category 'accessing') ----- timestamp ^timestamp! Item was removed: - DebuggerMethodMap subclass: #DebuggerMethodMapForBlueBookMethods - instanceVariableNames: 'tempNames' - classVariableNames: '' - poolDictionaries: '' - category: 'Tools-Debugger'! - - !DebuggerMethodMapForBlueBookMethods commentStamp: 'eem 1/6/2018 16:57' prior: 0! - I am a place-holder for information needed by the Debugger to inspect method activations. See my superclass's comment. I map methods compiled using BlueBook blocks.! Item was removed: - ----- Method: DebuggerMethodMapForBlueBookMethods>>forMethod:methodNode: (in category 'initialize-release') ----- - forMethod: aMethod "<CompiledMethod>" methodNode: aMethodNode "<MethodNode>" - super forMethod: aMethod methodNode: aMethodNode. - tempNames := methodNode encoder tempNames! Item was removed: - ----- Method: DebuggerMethodMapForBlueBookMethods>>namedTempAt:in: (in category 'accessing') ----- - namedTempAt: index in: aContext - "Answer the value of the temp at index in aContext where index is relative - to the array of temp names answered by tempNamesForContext:" - ^aContext tempAt: index! Item was removed: - ----- Method: DebuggerMethodMapForBlueBookMethods>>namedTempAt:put:in: (in category 'accessing') ----- - namedTempAt: index put: aValue in: aContext - "Assign the value of the temp at index in aContext where index is relative - to the array of temp names answered by tempNamesForContext:" - ^aContext tempAt: index put: aValue! Item was removed: - ----- Method: DebuggerMethodMapForBlueBookMethods>>tempNamesForContext: (in category 'accessing') ----- - tempNamesForContext: aContext - "Answer an Array of all the temp names in scope in aContext starting with - the home's first local (the first argument or first temporary if no arguments)." - ^tempNames! Item was changed: DebuggerMethodMap subclass: #DebuggerMethodMapForClosureCompiledMethods instanceVariableNames: 'blockExtentsToTempRefs startpcsToTempRefs startKeysToTempRefs' classVariableNames: 'FirstTime' poolDictionaries: '' category: 'Tools-Debugger'! + !DebuggerMethodMapForClosureCompiledMethods commentStamp: 'eem 10/1/2020 19:19' prior: 0! + I am a place-holder for information needed by the Debugger to inspect method activations. See my superclass's comment. I map methods compiled using closures whose bytecodes are embedded within the home CompiledMethod, as is the case for the V3PlusClosures bytecode set. - !DebuggerMethodMapForClosureCompiledMethods commentStamp: 'eem 1/8/2018 12:42' prior: 0! - I am a place-holder for information needed by the Debugger to inspect method activations. See my superclass's comment. I map methods compiled using closures. Instance variables blockExtentsToTempsRefs <Dictionary of: Interval -> Array of: (Array with: String with: (Integer | (Array with: Integer with: Integer)))> maps a block extent to an Array of temp references for that block/method. Each reference is a pair of temp name and index, where the index can itself be a pair for a remote temp. startKeysToTempRefs <Dictionary of: Integer startpc -> Array of: (Array with: String with: temp reference)> where temp reference ::= Integer | (Array with: Integer with: Integer) | (Array with: #outer with: temp reference)! Item was removed: - ----- Method: DebuggerMethodMapForClosureCompiledMethods>>namedTempAt:in: (in category 'accessing') ----- - namedTempAt: index in: aContext - "Answer the value of the temp at index in aContext where index is relative - to the array of temp names answered by tempNamesForContext:" - ^self - privateTempAt: index - in: aContext - startKeysToBlockExtents: aContext method startKeysToBlockExtents! Item was removed: - ----- Method: DebuggerMethodMapForClosureCompiledMethods>>namedTempAt:put:in: (in category 'accessing') ----- - namedTempAt: index put: aValue in: aContext - "Assign the value of the temp at index in aContext where index is relative - to the array of temp names answered by tempNamesForContext:. - If the value is a copied value we also need to set it along the lexical chain." - ^self - privateTempAt: index - in: aContext - put: aValue - startKeysToBlockExtents: aContext method startKeysToBlockExtents! Item was removed: - ----- Method: DebuggerMethodMapForClosureCompiledMethods>>tempNamesForContext: (in category 'accessing') ----- - tempNamesForContext: aContext - "Answer an Array of all the temp names in scope in aContext starting with - the home's first local (the first argument or first temporary if no arguments)." - ^(self - privateTempRefsForContext: aContext - startKeysToBlockExtents: aContext method startKeysToBlockExtents) collect: - [:pair| pair first]! Item was removed: - ----- Method: DebuggerMethodMapForClosureCompiledMethods>>tempNamesForMethod: (in category 'accessing') ----- - tempNamesForMethod: aMethod - "Answer an Array of all the temp names in scope in aMethod starting with - the home's first local (the first argument or first temporary if no arguments)." - ^(self - privateTempRefsForMethod: aMethod - startKeysToBlockExtents: aMethod startKeysToBlockExtents) collect: - [:pair| pair first]! Item was changed: DebuggerMethodMapForClosureCompiledMethods subclass: #DebuggerMethodMapForFullBlockCompiledMethods instanceVariableNames: 'sortedSourceMaps' classVariableNames: '' poolDictionaries: '' category: 'Tools-Debugger'! + !DebuggerMethodMapForFullBlockCompiledMethods commentStamp: 'eem 10/1/2020 19:20' prior: 0! + I am a place-holder for information needed by the Debugger to inspect method activations. See DebuggerMethodMap's comment. I map methods compiled using full block closures, where block methods are objects separate from the home mehtod, as is the case with the SistaV1 bytecode set. - !DebuggerMethodMapForFullBlockCompiledMethods commentStamp: 'eem 1/10/2018 16:28' prior: 0! - I am a place-holder for information needed by the Debugger to inspect method activations. See DebuggerMethodMap's comment. I map methods compiled using full block closures. Instance variables (inherited) abstractSourceRanges <Dictionary of: CompiledCode -> (Dictionary of: Integer-> Interval) startKeysToTempRefs <Dictionary of: CompiledCode -> Array of: (Array with: String with: temp reference)> where temp reference ::= Integer | (Array with: Integer with: Integer) | (Array with: #outer with: temp reference) (locally defined) sortedSourceMaps <Dictionary of: CompiledCode -> (Dictionary of: Integer-> Interval)! |
Free forum by Nabble | Edit this page |