Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update Rakudo scalar to handle native cont API.
  • Loading branch information
jnthn committed Feb 26, 2015
1 parent b6f8fb5 commit ba2beff
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/vm/jvm/runtime/org/perl6/rakudo/RakudoContainerSpec.java
Expand Up @@ -17,6 +17,15 @@ public class RakudoContainerSpec extends ContainerSpec {
public SixModelObject fetch(ThreadContext tc, SixModelObject cont) {
return cont.get_attribute_boxed(tc, RakOps.key.getGC(tc).Scalar, "$!value", HINT_value);
}
public long fetch_i(ThreadContext tc, SixModelObject cont) {
return fetch(tc, cont).get_int(tc);
}
public double fetch_n(ThreadContext tc, SixModelObject cont) {
return fetch(tc, cont).get_num(tc);
}
public String fetch_s(ThreadContext tc, SixModelObject cont) {
return fetch(tc, cont).get_str(tc);
}

/* Stores a value in a container. Used for assignment. */
private static final CallSiteDescriptor storeThrower = new CallSiteDescriptor(
Expand Down Expand Up @@ -63,6 +72,15 @@ public void store(ThreadContext tc, SixModelObject cont, SixModelObject value) {

cont.bind_attribute_boxed(tc, gcx.Scalar, "$!value", HINT_value, value);
}
public void store_i(ThreadContext tc, SixModelObject cont, long value) {
store(tc, cont, RakOps.p6box_i(value, tc));
}
public void store_n(ThreadContext tc, SixModelObject cont, double value) {
store(tc, cont, RakOps.p6box_n(value, tc));
}
public void store_s(ThreadContext tc, SixModelObject cont, String value) {
store(tc, cont, RakOps.p6box_s(value, tc));
}

/* Stores a value in a container, without any checking of it (this
* assumes an optimizer or something else already did it). Used for
Expand Down

0 comments on commit ba2beff

Please sign in to comment.