Skip to content

Commit

Permalink
Add flag indicating HLL init status in CodeRef
Browse files Browse the repository at this point in the history
Add a value that indicates whether the statevar associated with the
coderef has been assigned a value by the HLL (flag set via extop on HLL
side).

This change is being made to coincide with a Rakudo development
regarding statevar initialization.

See [RT#102994](https://rt.perl.org/Public/Bug/Display.html?id=102994)
  • Loading branch information
jstuder-gh committed Jul 21, 2018
1 parent 25dec5d commit fae6c62
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/vm/jvm/runtime/org/perl6/nqp/runtime/CallFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public CallFrame(ThreadContext tc, CodeRef cr) {
int numoLex = sci.oLexStatic.length;
this.oLex = new SixModelObject[numoLex];
for (int i = 0; i < numoLex; i++) {
// 0 = static, 1 = clone, 2 = state
switch (sci.oLexStaticFlags[i]) {
case 0:
this.oLex[i] = sci.oLexStatic[i];
Expand All @@ -148,6 +149,7 @@ public CallFrame(ThreadContext tc, CodeRef cr) {
case 2:
if (cr.oLexState == null) {
cr.oLexState = new SixModelObject[sci.oLexStatic.length];
cr.oLexStateIsHllInit = new boolean[sci.oLexStatic.length];
this.stateInit = true;
}
if (cr.oLexState[i] == null)
Expand Down
5 changes: 5 additions & 0 deletions src/vm/jvm/runtime/org/perl6/nqp/runtime/CodeRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public class CodeRef extends SixModelObject {
*/
public SixModelObject[] oLexState;

/**
* Has the given statevar been assigned a value by the HLL?
*/
public boolean[] oLexStateIsHllInit;

/**
* The (human-readable) name of the code-ref (not in staticInfo as a
* number of places want to tweak it per closure clone).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public class StaticCodeInfo implements Cloneable {

/**
* Flags for each static lexical usage.
* 0 = static, 1 = clone, 2 = state
*/
public byte[] oLexStaticFlags;

Expand Down

0 comments on commit fae6c62

Please sign in to comment.