Ejemplo n.º 1
0
 @Override
 @AvailMethod
 int o_PrimitiveNumber(final AvailObject object) {
   // Answer the primitive number I should try before falling back on
   // the Avail code.  Zero indicates not-a-primitive.
   return object.slot(PRIMITIVE);
 }
Ejemplo n.º 2
0
 @Override
 void o_WriteSummaryTo(final AvailObject object, final JSONWriter writer) {
   writer.startObject();
   writer.write("kind");
   writer.write("function implementation");
   writer.write("outers");
   writer.write(object.slot(NUM_OUTERS));
   writer.write("arguments");
   writer.write(object.slot(NUM_ARGS));
   writer.write("locals");
   writer.write(object.slot(NUM_LOCALS));
   writer.write("maximum stack depth");
   writer.write(object.slot(FRAME_SLOTS));
   writer.write("nybbles");
   object.slot(NYBBLES).writeTo(writer);
   writer.write("function type");
   object.slot(FUNCTION_TYPE).writeSummaryTo(writer);
   writer.write("method");
   object.methodName().writeTo(writer);
   writer.write("module");
   object.module().moduleName().writeTo(writer);
   writer.write("starting line number");
   writer.write(object.startingLineNumber());
   writer.write("literals");
   writer.startArray();
   for (int i = 1, limit = object.variableObjectSlotsCount(); i <= limit; i++) {
     A_BasicObject literal = object.slot(LITERAL_AT_, i);
     if (literal.equalsNil()) {
       literal = IntegerDescriptor.zero();
     }
     literal.writeSummaryTo(writer);
   }
   writer.endArray();
   writer.endObject();
 }
Ejemplo n.º 3
0
 @Override
 @AvailMethod
 @Nullable
 Primitive o_Primitive(final AvailObject object) {
   return Primitive.byNumber(object.slot(PRIMITIVE));
 }
Ejemplo n.º 4
0
 @Override
 @AvailMethod
 int o_NumLocals(final AvailObject object) {
   return object.slot(NUM_LOCALS);
 }
Ejemplo n.º 5
0
 @Override
 @AvailMethod
 int o_NumOuters(final AvailObject object) {
   return object.slot(NUM_OUTERS);
 }
Ejemplo n.º 6
0
 @Override
 @AvailMethod
 int o_NumArgs(final AvailObject object) {
   return object.slot(NUM_ARGS);
 }
Ejemplo n.º 7
0
 /**
  * {@inheritDoc}
  *
  * <p>Answer the number of arguments + locals + stack slots to reserve in my continuations.
  */
 @Override
 @AvailMethod
 int o_NumArgsAndLocalsAndStack(final AvailObject object) {
   return object.slot(FRAME_SLOTS);
 }
Ejemplo n.º 8
0
 @Override
 @AvailMethod
 A_Tuple o_Nybbles(final AvailObject object) {
   return object.slot(NYBBLES);
 }
Ejemplo n.º 9
0
 @Override
 @AvailMethod
 int o_Hash(final AvailObject object) {
   return object.slot(HASH);
 }
Ejemplo n.º 10
0
 @Override
 @AvailMethod
 A_Type o_FunctionType(final AvailObject object) {
   return object.slot(FUNCTION_TYPE);
 }
Ejemplo n.º 11
0
 @Override
 @AvailMethod
 AvailObject o_LiteralAt(final AvailObject object, final int subscript) {
   return object.slot(LITERAL_AT_, subscript);
 }
Ejemplo n.º 12
0
 /**
  * Answer the {@link InvocationStatistic} associated with the specified {@link
  * CompiledCodeDescriptor raw function}.
  *
  * @param object The {@link A_RawFunction} from which to extract the invocation statistics helper.
  * @return The code's invocation statistics.
  */
 static InvocationStatistic getInvocationStatistic(final AvailObject object) {
   final AvailObject pojo = object.slot(INVOCATION_STATISTIC);
   return (InvocationStatistic) pojo.javaObject();
 }