develooper Front page | perl.perl6.internals | Postings from July 2002

pmc RECALL command for preprocessor

Thread Next
Tanton Gibbs
July 20, 2002 19:25
pmc RECALL command for preprocessor
Message ID:
I implemented a RECALL preprocessor directive for the pmc classes.
Basically, if you have the following function

set_number_native(PMC* value) {
  CHANGE_TYPE(pmc, PerlNum);

it will change the function to:

set_number_native( PMC* value) {
  CHANGE_TYPE(pmc, PerlNum);
  SELF->vtable->set_number_native(INTERP, SELF, value);

Thus ensuring that the correct semantics always occur.  However, this extra
function call slows things down somewhat.  I looped over the following code
10,000,000 times:

new P0, .PerlInt
set P0, 3.75    # converts to PerlNum

without the recall it performs in: 16.055 seconds
with the recall it performs in: 16.722 seconds

So, it slowed it down 6.5 tenths of a second after 10,000,000 times.  That
is not too bad for ensuring correct semantics.

What do you all think, should we pursue the function call
and accept a minor slowdown, should we attempt to automatically inline the
call, or should we abandon the RECALL idea altogether as a waste of time?

I have attached a modified and a modified
perlint.pmc for your enjoyment.  I also attached
my mops_p2.pasm test program.


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About