Skip to content

Commit

Permalink
Use BitSet to represent JVM IsHllInit values
Browse files Browse the repository at this point in the history
It would be really inefficient to use an array to record whether the hll
statevar is init when only one bit is needed (per lexical), especially
when there are a large amount of lexicals. Record in a BitSet instead.
  • Loading branch information
jstuder-gh committed Jul 21, 2018
1 parent fae6c62 commit fe34477
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/vm/jvm/runtime/org/perl6/nqp/runtime/CallFrame.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.perl6.nqp.runtime;

import java.util.BitSet;
import java.util.HashMap;

import org.perl6.nqp.sixmodel.InvocationSpec;
Expand Down Expand Up @@ -149,7 +150,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];
cr.oLexStateIsHllInit = new BitSet(sci.oLexStatic.length);
this.stateInit = true;
}
if (cr.oLexState[i] == null)
Expand Down
4 changes: 3 additions & 1 deletion src/vm/jvm/runtime/org/perl6/nqp/runtime/CodeRef.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package org.perl6.nqp.runtime;
import java.lang.invoke.MethodHandle;

import java.util.BitSet;

import org.perl6.nqp.sixmodel.SixModelObject;

/**
Expand Down Expand Up @@ -41,7 +43,7 @@ public class CodeRef extends SixModelObject {
/**
* Has the given statevar been assigned a value by the HLL?
*/
public boolean[] oLexStateIsHllInit;
public BitSet oLexStateIsHllInit;

/**
* The (human-readable) name of the code-ref (not in staticInfo as a
Expand Down

0 comments on commit fe34477

Please sign in to comment.