Monday, May 14, 2012

Label chains and Rowop adoption

Those are actually two separate operations I've added for the benefits of the joins.

To check if there are any labels chained from this one, use:

$result = $label->hasChained();

The same check can be done with

@chain = $label->getChain();

if ($#chain >= 0) { ... }

but the hasChained() is more efficient since it doesn't have to construct that intermediate array.

The adoption is a way to pass the row and opcode from one rowop to another new one, with a different label:

$rowop2 = $label->adopt($rowop1);

Very convenient for building the label handlers that pass the rowops to the other labels unchanged. It also can be done with

$rowop2 = $label->makeRowop($rowop1->getOpcode(), $rowop1->getRow());

But adopt() is easier to call and also more efficient, because less of the intermediate data surfaces from the C++ level to the Perl level. A more extended usage example will be shown momentarily.

No comments:

Post a Comment