gt:         if (!cr.isCompilerStub && !shared) {
context: package org.perl6.nqp.runtime;
  
  import java.lang.invoke.*;
  import java.lang.invoke.MethodHandles.Lookup;
  
  import org.perl6.nqp.sixmodel.*;
  import org.perl6.nqp.sixmodel.reprs.LexoticInstance;
  
  public class IndyBootstrap {
      public static CallSite wval_noa(Lookup caller, String name, MethodType type) {
          try {
              /* Look up wval resolver method. */
              MethodType resType = MethodType.methodType(SixModelObject.class,
                      MutableCallSite.class, String.class, int.class, ThreadContext.class);
              MethodHandle res = caller.findStatic(IndyBootstrap.class, "wvalResolve_noa", resType);
  
              /* Create a mutable callsite, and curry the resolver with it. */
              MutableCallSite cs = new MutableCallSite(type);
              cs.setTarget(MethodHandles.insertArguments(res, 0, cs));
  
              /* Produce callsite; it'll be updated with the resolved WVal upon the
               * first invocation. */
              return cs;
          }
          catch (Exception e) {
              throw new RuntimeException(e);
          }
      }
  
      public static SixModelObject wvalResolve_noa(MutableCallSite cs, String sc, int idx, ThreadContext tc) {
          /* Look up the WVal. */
          SixModelObject res = tc.gc.scs.get(sc).getObject(idx);
  
          /* Update this callsite, so that we never run the lookup again and instead
           * just always use the resolved object. Discards incoming arguments, as
           * they are no longer needed. */
          if (!tc.curFrame.codeRef.staticInfo.compUnit.shared)
              cs.setTarget(MethodHandles.dropArguments(
                          MethodHandles.constant(SixModelObject.class, res),
                          0, String.class, int.class, ThreadContext.class));
  
          /* Hand back the resulting object, for this first call. */
          return res;
      }
  
      public static CallSite subcall_noa(Lookup caller, String s, MethodType type) {
          try {
              /* Look up subcall resolver method. */
              MethodType resType = MethodType.methodType(void.class,
                      Lookup.class, MutableCallSite.class, String.class,
                      int.class, ThreadContext.class, Object[].class);
              MethodHandle res = caller.findStatic(IndyBootstrap.class, "subcallResolve_noa", resType);
  
              /* Create a mutable callsite, and curry the resolver with it and
               * the sub name. */
              MutableCallSite cs = new MutableCallSite(type);
              cs.setTarget(MethodHandles
                  .insertArguments(res, 0, caller, cs)
                  .asCollector(Object[].class, type.parameterCount() - 3)
                  .asType(type));
  
              /* Produce callsite; it'll be updated with the resolved call upon the
               * first invocation. */
              return cs;
          }
          catch (Exception e) {
              throw new RuntimeException(e);
          }
      }
  
      public static void subcallResolve_noa(Lookup caller, MutableCallSite cs, String name, int csIdx, ThreadContext tc, Object... args) {
          /* Locate the thing to call. */
          SixModelObject invokee = Ops.getlex(name, tc);
          if (invokee == null)
              throw ExceptionHandling.dieInternal(tc, "Can not invoke object '" + name + "'");
  
          /* Don't update callsite in cases where it's not safe. */
          boolean shared = tc.curFrame.codeRef.staticInfo.compUnit.shared;
          if (invokee.st != null && invokee.st.ContainerSpec != null) {
              invokee = Ops.decont(invokee, tc);
              shared = true;
          }
  
          /* Resolve callsite descriptor. */
          CallSiteDescriptor csd = csIdx >= 0
              ? tc.curFrame.codeRef.staticInfo.compUnit.callSites[csIdx]
              : Ops.emptyCallSite;
          CallSiteDescriptor csdOrig = csd;
  
          /* If it's lexotic, then resolve to something to do the throwing. */
          if (invokee instanceof LexoticInstance)
              throw setLexoticTarget(caller, cs, tc, invokee, csd, args, shared);
  
          /* Otherwise, get the code ref. */
          CodeRef cr;
          if (invokee instanceof CodeRef) {
              cr = (CodeRef)invokee;
          }
          else {
              InvocationSpec is = invokee.st.InvocationSpec;
              if (is == null)
                  throw ExceptionHandling.dieInternal(tc, "Can not invoke this object");
              if (is.ClassHandle != null)
                  cr = (CodeRef)invokee.get_attribute_boxed(tc, is.ClassHandle, is.AttrName, is.Hint);
              else {
                  cr = (CodeRef)is.InvocationHandler;
                  csd = csd.injectInvokee(tc, args, invokee);
                  args = tc.flatArgs;
              }
          }
  
          /* Now need to adapt to the target callsite by binding the CodeRef
           * and callsite with what they've been resolved to. Don't do it if
           * it's a compiler stub, though. */
          if (!cr.isCompilerStub && !shared) {
              try {
                  MethodType invType = MethodType.methodType(void.class,
                      MethodHandle.class, String.class, CallSiteDescriptor.class,
                      ThreadContext.class, Object[].class);
                  MethodHandle inv = caller.findStatic(IndyBootstrap.class, "subInvoker", invType);
                  cs.setTarget(MethodHandles
                      .dropArguments(
                          MethodHandles.insertArguments(inv, 0, cr.staticInfo.mh, name, csdOrig),
                          0, String.class, int.class)
                      .asVarargsCollector(Object[].class)
                      .asType(cs.getTarget().type()));
              }
              catch (Throwable t) {
                  throw ExceptionHandling.dieInternal(tc, t);
              }
          }
  
          /* Make the sub call directly for this initial call. */
          try {
              ArgsExpectation.invokeByExpectation(tc, cr, csd, args);
          }
          catch (ControlException e) {
              throw e;
          }
          catch (Throwable e) {
              ExceptionHandling.dieInternal(tc, e);
          }
      }
  
      public static void subInvoker(MethodHandle mh, String name, CallSiteDescriptor csd, ThreadContext tc, Object[] args) throws Throwable {
          SixModelObject invokee = Ops.getlex(name, tc);
          if (invokee == null)
              throw ExceptionHandling.dieInternal(tc, "Can not invoke object '" + name + "'");
  
          CodeRef cr;
          if (invokee instanceof CodeRef) {
              cr = (CodeRef)invokee;
          }
          else {
              InvocationSpec is = invokee.st.InvocationSpec;
              if (is == null)
                  throw ExceptionHandling.dieInternal(tc, "Can not invoke this object");
              if (is.ClassHandle != null)
                  cr = (CodeRef)invokee.get_attribute_boxed(tc, is.ClassHandle, is.AttrName, is.Hint);
              else {
                  cr = (CodeRef)is.InvocationHandler;
                  csd = csd.injectInvokee(tc, args, invokee);
                  args = tc.flatArgs;
              }
          }
          ArgsExpectation.invokeByExpectation(tc, cr, csd, args);
      }
  
      public static CallSite subcallstatic_noa(Lookup caller, String s, MethodType type) {
          try {
              /* Look up subcall resolver method. */
              MethodType resType = MethodType.methodType(void.class,
                      Lookup.class, MutableCallSite.class, String.class,
                      int.class, ThreadContext.class, Object[].class);
              MethodHandle res = caller.findStatic(IndyBootstrap.class, "subcallstaticResolve_noa", resType);
  
              /* Create a mutable callsite, and curry the resolver with it and
               * the sub name. */
              MutableCallSite cs = new MutableCallSite(type);
              cs.setTarget(MethodHandles
                  .insertArguments(res, 0, caller, cs)
                  .asCollector(Object[].class, type.parameterCount() - 3)
                  .asType(type));
  
              /* Produce callsite; it'll be updated with the resolved call upon the
               * first invocation. */
              return cs;
          }
          catch (Exception e) {
              throw new RuntimeException(e);
          }
      }
  
      public static void subcallstaticResolve_noa(Lookup caller, MutableCallSite cs, String name, int csIdx, ThreadContext tc, Object... args) {
          /* Locate the thing to call. */
          SixModelObject invokee = Ops.getlex(name, tc);
          if (invokee == null)
              throw ExceptionHandling.dieInternal(tc, "Can not invoke object '" + name + "'");
  
          /* Don't update callsite in cases where it's not safe. */
          boolean shared = tc.curFrame.codeRef.staticInfo.compUnit.shared;
          if (invokee.st != null && invokee.st.ContainerSpec != null) {
              invokee = Ops.decont(invokee, tc);
              shared = true;
          }
  
          /* Resolve callsite descriptor. */
          CallSiteDescriptor csd = csIdx >= 0
              ? tc.curFrame.codeRef.staticInfo.compUnit.callSites[csIdx]
              : Ops.emptyCallSite;
          CallSiteDescriptor csdOrig = csd;
  
          /* If it's lexotic, then resolve to something to do the throwing. */
          if (invokee instanceof LexoticInstance)
              throw setLexoticTarget(caller, cs, tc, invokee, csd, args, shared);
  
          /* Otherwise, get the code ref. */
          CodeRef cr;
          if (invokee instanceof CodeRef) {
              cr = (CodeRef)invokee;
          }
          else {
              InvocationSpec is = invokee.st.InvocationSpec;
              if (is == null)
                  throw ExceptionHandling.dieInternal(tc, "Can not invoke this object");
              if (is.ClassHandle != null)
                  cr = (CodeRef)invokee.get_attribute_boxed(tc, is.ClassHandle, is.AttrName, is.Hint);
              else {
                  cr = (CodeRef)is.InvocationHandler;
                  csd = csd.injectInvokee(tc, args, invokee);
                  args = tc.flatArgs;
                  shared = true;
              }
          }
  
          /* Now need to adapt to the target callsite by binding the CodeRef
           * and callsite with what they've been resolved to. Don't do it if
           * it's a compiler stub, though. */
  