Skip to content

Commit

Permalink
small additional fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcusDenker committed Oct 4, 2019
1 parent 226c3d1 commit e48d036
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/OpalCompiler-Core/OCTempVariable.class.st
@@ -1,5 +1,5 @@
"
I model temp variables. With Closures, there are two kinds: Copying and those that are stores in a so called temp vector, a heap allocated array that itself is stored in a copying temp variable.
I model temp variables. With Closures, there are two kinds: Copying and those that are stored in a so called temp vector, a heap allocated array that itself is stored in a copying temp variable.
"
Class {
#name : #OCTempVariable,
Expand Down
9 changes: 4 additions & 5 deletions src/OpalCompiler-Core/OCVectorTempVariable.class.st
@@ -1,16 +1,15 @@
"
I model a temp variable that is stored in a temp vector.
My index variable has the index where I am stored in the temp vector (filled in lazily if requested, the index
is determined by the bytecode backend and thus the result of the compilation)
My ""index"" variable has the index where I am stored in the temp vector (filled in lazily if requested, the index is determined by the bytecode backend and thus the result of the compilation)
The temp vector itself is stored in a copied var (you can get it's name by sending #vectorName)
reading and writing thus is a multi step process:
1) get the semamtic variable that stores the temp vector by name
2) get the offset in the temp vector from it (cached in ""index"")
3) the temp vector semantic var know how to read / write the vector (which is an array)
3) the temp vector semantic var knows how to read / write the vector (which is an array)
4) use the index to access this array
"
Class {
Expand Down Expand Up @@ -57,10 +56,10 @@ OCVectorTempVariable >> readVectorFromContext: aContext scope: contextScope [
| tempVectorVar theVector |
tempVectorVar := contextScope lookupVar: vectorName.
theVector := tempVectorVar readFromLocalContext: aContext.
index := index ifNil: [ index := tempVectorVar indexInTempVectorFromIR: name ].
index := index ifNil: [ tempVectorVar indexInTempVectorFromIR: name ].

"If we don't find the temp vector (because it was nilled or not created), we
lookup in the outer context with the corresponding outer scope"
lookup in the outer context with the corresponding outer scope"
^ theVector ifNil: [ self readVectorFromContext: aContext outerContext scope: contextScope outerScope ]
]

Expand Down

0 comments on commit e48d036

Please sign in to comment.