Skip to content

Commit

Permalink
- factor out index calculation into #indexFromIRFromScope:
Browse files Browse the repository at this point in the history
- add an assert as I think the parameter is not needed (we look up the var in the scope, those vars know the scope!)
- readFromContext:scope: should never be called on VectorTempVariable: add #isThisEverCalled:
  • Loading branch information
MarcusDenker committed Sep 19, 2019
1 parent e265582 commit cf79b37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/OpalCompiler-Core/OCTempVariable.class.st
Expand Up @@ -134,7 +134,8 @@ OCTempVariable >> markWrite [

{ #category : #debugging }
OCTempVariable >> readFromContext: aContext scope: contextScope [
^ aContext tempAt: (contextScope outerNotOptimizedScope node irInstruction indexForVarNamed: name)

^ aContext tempAt: (self indexFromIRFromScope: contextScope)
]

{ #category : #debugging }
Expand All @@ -146,6 +147,6 @@ OCTempVariable >> searchFromContext: aContext scope: contextScope [
{ #category : #debugging }
OCTempVariable >> writeFromContext: aContext scope: contextScope value: aValue [
^aContext
tempAt: (contextScope outerNotOptimizedScope node irInstruction indexForVarNamed: name)
tempAt: (self indexFromIRFromScope: contextScope)
put: aValue
]
1 change: 1 addition & 0 deletions src/OpalCompiler-Core/OCVectorTempVariable.class.st
Expand Up @@ -36,6 +36,7 @@ OCVectorTempVariable >> isTempVectorTemp [
OCVectorTempVariable >> readFromContext: aContext scope: contextScope [

| offset pairVariableVector |
self isThisEverCalled: 'this should never be called on vector temps'.
pairVariableVector := contextScope lookupTempVector: vectorName inContext: aContext.
offset := pairVariableVector first indexInTempVectorFromIR: name.
^pairVariableVector second at: offset.
Expand Down

0 comments on commit cf79b37

Please sign in to comment.