Skip to content

Commit

Permalink
Add missing ops related to FIRST handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
jnthn committed Jun 30, 2013
1 parent e0bb438 commit 60d2986
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/vm/jvm/runtime/org/perl6/rakudo/Ops.java
Expand Up @@ -15,7 +15,7 @@ public final class Ops {
public static final boolean DEBUG_MODE = false;

public static class ThreadExt {
// not currently used
public SixModelObject firstPhaserCodeBlock;
public ThreadExt(ThreadContext tc) { }
}

Expand Down Expand Up @@ -576,4 +576,19 @@ public int compare(SixModelObject a, SixModelObject b) {
public static long p6stateinit(ThreadContext tc) {
return tc.curFrame.stateInit ? 1 : 0;
}

public static SixModelObject p6setfirstflag(SixModelObject codeObj, ThreadContext tc) {
GlobalExt gcx = key.getGC(tc);
ThreadExt tcx = key.getTC(tc);
tcx.firstPhaserCodeBlock = codeObj.get_attribute_boxed(tc,
gcx.Code, "$!do", HINT_CODE_DO);
return codeObj;
}

public static long p6takefirstflag(ThreadContext tc) {
ThreadExt tcx = key.getTC(tc);
boolean matches = tcx.firstPhaserCodeBlock == tc.curFrame.codeRef;
tcx.firstPhaserCodeBlock = null;
return matches ? 1 : 0;
}
}

0 comments on commit 60d2986

Please sign in to comment.