[squeak-dev] The Trunk: Tools-eem.377.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Sep 8 17:46:35 UTC 2011


Eliot Miranda uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-eem.377.mcz

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

Name: Tools-eem.377
Author: eem
Time: 8 September 2011, 10:46:07.752 am
UUID: 620788e4-8d15-41bd-af90-58b26f705630
Ancestors: Tools-bf.376

Replace use of private indexForInserting: with public
findNearbyBinaryIndex: in DebuggerMethodMap>>rangeForPC:contextIsActiveContext:.
N.B. Requires at least Collections-eem.455

=============== Diff against Tools-bf.376 ===============

Item was changed:
  ----- Method: DebuggerMethodMap>>rangeForPC:contextIsActiveContext: (in category 'source mapping') -----
  rangeForPC: contextsConcretePC contextIsActiveContext: contextIsActiveContext
  	"Answer the indices in the source code for the supplied pc.
  	 If the context is the actve context (is at the hot end of the stack)
  	 then its pc is the current pc.  But if the context isn't, because it is
  	 suspended sending a message, then its current pc is the previous pc."
  
  	| pc i end |
  	pc := self method abstractPCForConcretePC: (contextIsActiveContext
  													ifTrue: [contextsConcretePC]
  													ifFalse: [(self method pcPreviousTo: contextsConcretePC)
  																ifNotNil: [:prevpc| prevpc]
  																ifNil: [contextsConcretePC]]).
  	(self abstractSourceMap includesKey: pc) ifTrue:
  		[^self abstractSourceMap at: pc].
  	sortedSourceMap ifNil:
  		[sortedSourceMap := self abstractSourceMap.
  		 sortedSourceMap := (sortedSourceMap keys collect: 
  								[:key| key -> (sortedSourceMap at: key)]) asSortedCollection].
  	(sortedSourceMap isNil or: [sortedSourceMap isEmpty]) ifTrue: [^1 to: 0].
+ 	i := sortedSourceMap findNearbyBinaryIndex: [:assoc| pc - assoc key].
- 	i := sortedSourceMap indexForInserting: (pc -> nil).
  	i < 1 ifTrue: [^1 to: 0].
  	i > sortedSourceMap size ifTrue:
  		[end := sortedSourceMap inject: 0 into:
  			[:prev :this | prev max: this value last].
  		^end+1 to: end].
  	^(sortedSourceMap at: i) value
  
  	"| method source scanner map |
  	 method := DebuggerMethodMap compiledMethodAt: #rangeForPC:contextIsActiveContext:.
  	 source := method getSourceFromFile asString.
  	 scanner := InstructionStream on: method.
  	 map := method debuggerMap.
  	 Array streamContents:
  		[:ranges|
  		[scanner atEnd] whileFalse:
  			[| range |
  			 range := map rangeForPC: scanner pc contextIsActiveContext: true.
  			 ((map abstractSourceMap includesKey: scanner abstractPC)
  			  and: [range first ~= 0]) ifTrue:
  				[ranges nextPut: (source copyFrom: range first to: range last)].
  			scanner interpretNextInstructionFor: InstructionClient new]]"!




More information about the Squeak-dev mailing list