Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Get multi-dim object arrays working on JVM.
- Loading branch information
Showing
3 changed files
with
67 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/MultiDimArrayInstance.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.perl6.nqp.sixmodel.reprs; | ||
|
||
import java.lang.System; | ||
|
||
import org.perl6.nqp.runtime.ExceptionHandling; | ||
import org.perl6.nqp.runtime.ThreadContext; | ||
import org.perl6.nqp.sixmodel.SixModelObject; | ||
|
||
public class MultiDimArrayInstance extends MultiDimArrayInstanceBase { | ||
public SixModelObject[] slots; | ||
|
||
public void set_dimensions(ThreadContext tc, long[] dims) { | ||
super.set_dimensions(tc, dims); | ||
if (slots == null) | ||
slots = new SixModelObject[numSlots()]; | ||
else | ||
duplicateSetDimensions(tc); | ||
} | ||
|
||
public SixModelObject at_pos_multidim_boxed(ThreadContext tc, long[] indices) { | ||
return slots[indicesToFlatIndex(tc, indices)]; | ||
} | ||
|
||
public void bind_pos_multidim_boxed(ThreadContext tc, long[] indices, SixModelObject value) { | ||
slots[indicesToFlatIndex(tc, indices)] = value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters