Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Replace an op and a dozen C lines with 1 NQP line.
  • Loading branch information
jnthn committed Apr 9, 2013
1 parent 003d5cf commit 4402426
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 30 deletions.
2 changes: 1 addition & 1 deletion src/Perl6/World.pm
Expand Up @@ -1158,7 +1158,7 @@ class Perl6::World is HLL::World {
# Creates a new container descriptor and adds it to the SC.
method create_container_descriptor($of, $rw, $name) {
my $cd_type := self.find_symbol(['ContainerDescriptor']);
my $cd := pir::perl6_create_container_descriptor__PPPis($cd_type, $of, $rw, $name);
my $cd := $cd_type.new(:$of, :$rw, :$name);
self.add_object($cd);
$cd
}
Expand Down
12 changes: 0 additions & 12 deletions src/binder/container.c
Expand Up @@ -169,15 +169,3 @@ PMC * Rakudo_cont_scalar_with_value_no_descriptor(PARROT_INTERP, PMC *value) {
PARROT_GC_WRITE_BARRIER(interp, new_scalar);
return new_scalar;
}

/* Creates and populates a new container descriptor. */
PMC * Rakudo_create_container_descriptor(PARROT_INTERP, PMC *type, PMC *of, INTVAL rw, STRING *name) {
PMC *result = REPR(type)->allocate(interp, STABLE(type));
Rakudo_ContainerDescriptor *desc = (Rakudo_ContainerDescriptor *)PMC_data(result);
REPR(result)->initialize(interp, STABLE(result), OBJECT_BODY(result));
desc->of = of;
desc->rw = rw;
desc->name = name;
PARROT_GC_WRITE_BARRIER(interp, result);
return result;
}
1 change: 0 additions & 1 deletion src/binder/container.h
Expand Up @@ -23,4 +23,3 @@ void Rakudo_cont_store(PARROT_INTERP, PMC *cont, PMC *value, INTVAL type_check,
PMC * Rakudo_cont_scalar_from_descriptor(PARROT_INTERP, PMC *container_descriptor);
PMC * Rakudo_cont_scalar_with_value_no_descriptor(PARROT_INTERP, PMC *value);
INTVAL Rakudo_cont_is_rw_scalar(PARROT_INTERP, PMC *check);
PMC * Rakudo_create_container_descriptor(PARROT_INTERP, PMC *type, PMC *of, INTVAL rw, STRING *name);
16 changes: 0 additions & 16 deletions src/ops/perl6.ops
Expand Up @@ -934,22 +934,6 @@ inline op perl6_container_store_unchecked(in PMC, in PMC) :base_core {
}


/*

=item perl6_create_container_descriptor

Creates a container descriptor and puts in in $1. $2 is the type of the
descriptor to create. $3 is the 'of' type, $4 is the rw flag and $5 is
the name.

=cut

*/
inline op perl6_create_container_descriptor(out PMC, in PMC, in PMC, in INT, in STR) :base_core {
$1 = Rakudo_create_container_descriptor(interp, $2, $3, $4, $5);
}


/*

=item perl6_assert_bind_ok(in PMC, in PMC)
Expand Down

0 comments on commit 4402426

Please sign in to comment.