Skip to content

Commit

Permalink
Fixed a bug that was causing the debugger to display the wrong methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamSpitz committed Jul 16, 2009
1 parent 45c13f0 commit 5597818
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 27 deletions.
7 changes: 7 additions & 0 deletions doc/Adam - working notes.txt
Expand Up @@ -85,3 +85,10 @@ Not sure what to do. There's a bug where it fails to find a klein locations cons

----

On the debugger bug:

Hey, I get it. The first labelNode is always unresolved. Can I just make sure to resolve it?

Hmm, but for some reason the labelNode at index 0 in irNodesByBCI is NOT part of the nodes to be generated. Maybe it's never branched to? Hmm, it has a controlFlowPred, but that seems to be left over, because the pred points to someone different as his destination.

Maybe it's getting eliminated because the BB is empty or something.
18 changes: 5 additions & 13 deletions objects/applications/klein/kleinC1_BCI.self
Expand Up @@ -435,9 +435,10 @@ SlotsToOmit: parent.
'Category: building scope descs for nmethods\x7fModuleInfo: Module: kleinC1_BCI InitialContents: FollowSlot\x7fVisibility: private'

findPCOffsetsByBCI = ( |
previousPCO <- -1.
r.
|
r: irNodesByBCI mapBy: [|:n| n pcOffsetIfPresent: [|:o| o] IfAbsent: -1]
r: irNodesByBCI mapBy: [|:n. :i| n pcOffsetIfPresent: [|:o| previousPCO: o. o] IfAbsent: [i = 0 ifTrue: [[aaaaaaa]. halt]. previousPCO]]
Into: myScopeDesc pcOffsetVector copySize: irNodesByBCI size.
r ifNone: myScopeDesc pcOffsetVector).
} | )
Expand Down Expand Up @@ -863,6 +864,7 @@ SlotsToOmit: parent.
] IfNotNil: [|:lbl|
irNodeGenerator bindLabel: lbl.
].
(irNodesByBCI at: bci) marksStartOfBC: true.

self).
} | )
Expand Down Expand Up @@ -2524,18 +2526,8 @@ included before at least one of its preds is.\x7fModuleInfo: Module: kleinC1_BCI
i currentBC: i nonexistentBCAt: 0.
rcvrAndArgValues with: sla incomingRcvrAndArgValues Do: [|:srcV. :dstV| move: srcV To: dstV].
interpretCurrentSlot.
case
if: nodeToInsertAfter isLocalReturn Then: [
move: nodeToInsertAfter outgoingResultValue To: resultValue.
]
If: [nodeToInsertAfter sourcePred isMove] Then: [
halt. [aaaaaaa].
nodeToInsertAfter: nodeToInsertAfter sourcePred.
move: nodeToInsertAfter destinationValue To: resultValue.
nodeToInsertAfter: nodeToInsertAfter sourceSucc.
] Else: [
error: 'what is going on here?'.
].
[nodeToInsertAfter isLocalReturn] assert.
move: nodeToInsertAfter outgoingResultValue To: resultValue.
interpreterFinished.
i).
} | )
Expand Down
4 changes: 2 additions & 2 deletions objects/applications/klein/kleinC1_Gens.self
Expand Up @@ -46,13 +46,13 @@ See the LICENSE file for license information.
bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'klein' -> 'compiler1' -> 'parent' -> 'prototypes' -> 'codeGenerators' -> 'abstract' -> () From: ( | {
'ModuleInfo: Module: kleinC1_Gens InitialContents: InitializeToExpression: (nil)'

nodeToBeGeneratedAfterThisOne.
nodeBeingGenerated.
} | )

bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'klein' -> 'compiler1' -> 'parent' -> 'prototypes' -> 'codeGenerators' -> 'abstract' -> () From: ( | {
'ModuleInfo: Module: kleinC1_Gens InitialContents: InitializeToExpression: (nil)'

nodeToGenerate.
nodeToBeGeneratedAfterThisOne.
} | )

bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'klein' -> 'compiler1' -> 'parent' -> 'prototypes' -> 'codeGenerators' -> 'abstract' -> () From: ( | {
Expand Down
26 changes: 16 additions & 10 deletions objects/applications/klein/kleinC1_IRNodes.self
Expand Up @@ -410,16 +410,6 @@ from the bytecode interpreter.\x7fModuleInfo: Module: kleinC1_IRNodes InitialCon
parent* = bootstrap stub -> 'traits' -> 'orderedClonable' -> ().
} | )

bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'klein' -> 'compiler1' -> 'parent' -> 'prototypes' -> 'irNodes' -> 'abstract' -> 'parent' -> () From: ( | {
'Category: accessing\x7fModuleInfo: Module: kleinC1_IRNodes InitialContents: FollowSlot\x7fVisibility: public'

pcOffsetIfPresent: pb IfAbsent: ab = ( |
|
label isResolved
ifTrue: [pb value: label resolvedValue - codeGenerator origin]
False: ab).
} | )

bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'klein' -> 'compiler1' -> 'parent' -> 'prototypes' -> 'irNodes' -> 'abstract' -> 'parent' -> () From: ( | {
'Category: deferring other nodes\x7fModuleInfo: Module: kleinC1_IRNodes InitialContents: FollowSlot\x7fVisibility: public'

Expand Down Expand Up @@ -3292,6 +3282,12 @@ SlotsToOmit: parent sourcePred.
controlFlowPreds <- set copyRemoveAll.
} | )

bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'klein' -> 'compiler1' -> 'parent' -> 'prototypes' -> 'irNodes' -> 'label' -> () From: ( | {
'ModuleInfo: Module: kleinC1_IRNodes InitialContents: InitializeToExpression: (false)'

marksStartOfBC <- bootstrap stub -> 'globals' -> 'false' -> ().
} | )

bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'klein' -> 'compiler1' -> 'parent' -> 'prototypes' -> 'irNodes' -> 'label' -> () From: ( | {
'ModuleInfo: Module: kleinC1_IRNodes InitialContents: FollowSlot\x7fVisibility: private'

Expand Down Expand Up @@ -3374,6 +3370,16 @@ SlotsToOmit: parent sourcePred.
parent* = bootstrap stub -> 'globals' -> 'klein' -> 'compiler1' -> 'parent' -> 'prototypes' -> 'irNodes' -> 'abstract' -> 'parent' -> ().
} | )

bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'klein' -> 'compiler1' -> 'parent' -> 'prototypes' -> 'irNodes' -> 'label' -> 'parent' -> () From: ( | {
'Category: accessing\x7fModuleInfo: Module: kleinC1_IRNodes InitialContents: FollowSlot\x7fVisibility: public'

pcOffsetIfPresent: pb IfAbsent: ab = ( |
|
label isResolved
ifTrue: [pb value: label resolvedValue - codeGenerator origin]
False: ab).
} | )

bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'klein' -> 'compiler1' -> 'parent' -> 'prototypes' -> 'irNodes' -> 'label' -> 'parent' -> () From: ( | {
'Category: control flow\x7fModuleInfo: Module: kleinC1_IRNodes InitialContents: FollowSlot\x7fVisibility: public'

Expand Down
12 changes: 10 additions & 2 deletions objects/applications/klein/kleinCompiler1.self
Expand Up @@ -525,7 +525,7 @@ can\'t) do eager relocation. -- Adam, 3/05\x7fModuleInfo: Creator: globals klein
codeGenerator: protoCodeGenForMyPlatform copyForCompiler: self.
ns: irNodesInOrderForCodeGeneration asVector.
ns do: [|:n. :i|
codeGenerator nodeToGenerate: n.
codeGenerator nodeBeingGenerated: n.
codeGenerator nodeToBeGeneratedAfterThisOne: ns at: i succ IfAbsent: nil.
n generateCode.
].
Expand Down Expand Up @@ -1010,6 +1010,14 @@ can\'t) do eager relocation. -- Adam, 3/05\x7fModuleInfo: Creator: globals klein
bbs).
} | )

bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'klein' -> 'compiler1' -> 'parent' -> 'prototypes' -> 'basicBlock' -> 'parent' -> () From: ( | {
'Category: eliminating\x7fModuleInfo: Module: kleinCompiler1 InitialContents: FollowSlot\x7fVisibility: private'

canBeSafelyEliminated = ( |
|
containsNothingButABranch && [labelNode marksStartOfBC not]).
} | )

bootstrap addSlotsTo: bootstrap stub -> 'globals' -> 'klein' -> 'compiler1' -> 'parent' -> 'prototypes' -> 'basicBlock' -> 'parent' -> () From: ( | {
'Category: invariants\x7fModuleInfo: Module: kleinCompiler1 InitialContents: FollowSlot\x7fVisibility: public'

Expand Down Expand Up @@ -1156,7 +1164,7 @@ can\'t) do eager relocation. -- Adam, 3/05\x7fModuleInfo: Creator: globals klein

eliminateIfPossible = ( |
|
containsNothingButABranch ifTrue: [| anyFailed <- false |
canBeSafelyEliminated ifTrue: [| anyFailed <- false |
labelNode controlFlowPreds do: [|:pred|
pred replaceControlFlowSucc: labelNode
With: endNode destinationNode
Expand Down

0 comments on commit 5597818

Please sign in to comment.