Skip to content

Commit

Permalink
Optimize perl6_rpa_find_type to automatically skip containerized thin…
Browse files Browse the repository at this point in the history
…gies.
  • Loading branch information
pmichaud committed Jun 23, 2011
1 parent ce956a6 commit 1e975bf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/ops/perl6.ops
Expand Up @@ -761,9 +761,7 @@ index $4 and up through (but not including) index $5. Sets $1
to be the index of the first element matching type, otherwise
$1 is set to the highest index searched.

The RPA elements are not decontainerized during scanning,
and thus won't match type (unless you happen to be looking
for the container type).
Containerized elements are automatically skipped.

=cut

Expand All @@ -780,7 +778,9 @@ inline op perl6_rpa_find_type(out INT, in PMC, in PMC, in INT, in INT)

for (index = $4; index < last; index++) {
PMC *val = VTABLE_get_pmc_keyed_int(interp, rpa, index);
if (STABLE(val)->type_check(interp, val, type)) break;
if (val->vtable->base_type == smo_id
&& !STABLE(val)->container_spec
&& STABLE(val)->type_check(interp, val, type)) break;
}

$1 = index;
Expand Down

0 comments on commit 1e975bf

Please sign in to comment.