Skip to content

Commit fe34477

Browse files
committed
Use BitSet to represent JVM IsHllInit values
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.
1 parent fae6c62 commit fe34477

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/vm/jvm/runtime/org/perl6/nqp/runtime/CallFrame.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.perl6.nqp.runtime;
22

3+
import java.util.BitSet;
34
import java.util.HashMap;
45

56
import org.perl6.nqp.sixmodel.InvocationSpec;
@@ -149,7 +150,7 @@ public CallFrame(ThreadContext tc, CodeRef cr) {
149150
case 2:
150151
if (cr.oLexState == null) {
151152
cr.oLexState = new SixModelObject[sci.oLexStatic.length];
152-
cr.oLexStateIsHllInit = new boolean[sci.oLexStatic.length];
153+
cr.oLexStateIsHllInit = new BitSet(sci.oLexStatic.length);
153154
this.stateInit = true;
154155
}
155156
if (cr.oLexState[i] == null)

src/vm/jvm/runtime/org/perl6/nqp/runtime/CodeRef.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
package org.perl6.nqp.runtime;
22
import java.lang.invoke.MethodHandle;
33

4+
import java.util.BitSet;
5+
46
import org.perl6.nqp.sixmodel.SixModelObject;
57

68
/**
@@ -41,7 +43,7 @@ public class CodeRef extends SixModelObject {
4143
/**
4244
* Has the given statevar been assigned a value by the HLL?
4345
*/
44-
public boolean[] oLexStateIsHllInit;
46+
public BitSet oLexStateIsHllInit;
4547

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

0 commit comments

Comments
 (0)