Exemplo n.º 1
0
 public static PGenerator create(
     String name,
     RootCallTarget callTarget,
     FrameDescriptor frameDescriptor,
     MaterializedFrame declarationFrame,
     Object[] arguments,
     int numOfActiveFlags,
     int numOfGeneratorBlockNode,
     int numOfGeneratorForNode) {
   /** Setting up the persistent frame in {@link #arguments}. */
   GeneratorControlData generatorArgs =
       new GeneratorControlData(numOfActiveFlags, numOfGeneratorBlockNode, numOfGeneratorForNode);
   MaterializedFrame generatorFrame =
       Truffle.getRuntime().createMaterializedFrame(PArguments.create(), frameDescriptor);
   PArguments.setDeclarationFrame(arguments, declarationFrame);
   PArguments.setGeneratorFrame(arguments, generatorFrame);
   PArguments.setControlData(arguments, generatorArgs);
   return new PGenerator(name, callTarget, frameDescriptor, arguments);
 }
Exemplo n.º 2
0
 public Object send(Object value) throws StopIterationException {
   PArguments.setSpecialArgument(arguments, value);
   return callTarget.call(arguments);
 }