Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add a way to take a type object and find out if its representation co…
…nsiders itself as representing a boxed primitive.
  • Loading branch information
jnthn committed Apr 27, 2011
1 parent cf88f9e commit 7aa35a5
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/ops/nqp.ops
Expand Up @@ -868,3 +868,23 @@ inline op is_invokable(out INT, in PMC) :base_core {
$1 = VTABLE_does(interp, $2, Parrot_str_new(interp, "invokable", 0));
}
}

/*

=item repr_get_primitive_type_spec

If the representation represents a primitive type that we can store access
unboxed, this will return what sort of primitive type it is.

=cut

*/
inline op repr_get_primitive_type_spec(out INT, in PMC) :base_core {
if ($2->vtable->base_type == smo_id) {
storage_spec ss = REPR($2)->get_storage_spec(interp, REPR_PMC($2));
$1 = ss.inlineable ? ss.boxed_primitive : STORAGE_SPEC_BP_NONE;
}
else {
$1 = STORAGE_SPEC_BP_NONE;
}
}

0 comments on commit 7aa35a5

Please sign in to comment.