Acme-Perl-VM

 view release on metacpan or  search on metacpan

MANIFEST.SKIP  view on Meta::CPAN


#!start included /usr/local/lib/perl5/5.10.0/ExtUtils/MANIFEST.SKIP
# Avoid version control files.
\bRCS\b
\bCVS\b
\bSCCS\b
,v$
\B\.svn\b
\b_darcs\b

# Avoid Makemaker generated and utility files.
\bMANIFEST\.bak

lib/Acme/Perl/VM.pm  view on Meta::CPAN

    return;
}

sub PAD_SV{
    #my($targ) = @_;

    return $PL_curpad[ $_[0] ];
}

sub dopoptosub{
    my($startingblock) = @_;

    for(my $i = $startingblock; $i >= 0; $i--){
        my $type = $PL_cxstack[$i]->type;

        if($type eq 'EVAL' or $type eq 'SUB'){
            return $i;
        }
    }
    return -1;
}

my %loop;
@loop{qw(SUBST SUB EVAL NULL)} = ();
$loop{LOOP}    = TRUE;

sub dopoptoloop{
    my($startingblock) = @_;

    for(my $i = $startingblock; $i >= 0; --$i){
        my $cx   = $PL_cxstack[$i];
        my $type = $cx->type;

        if(exists $loop{$type}){
            if(!$loop{$type}){
                apvm_warn 'Exsiting %s via %s', $type, $PL_op->name;
                $i = -1 if $type eq 'NULL';
            }
            return $i;
        }

lib/Acme/Perl/VM.pm  view on Meta::CPAN

And you'll get a list of opcodes as the code runs:

    .entersub(&__ANON__) VOID
    .nextstate(main -:4) VOID
    .pushmark SCALAR
    .const("Hello, APVM world!\n") SCALAR
    .print SCALAR KIDS
    Hello, APVM world!
    .leavesub KIDS

The first C<entersub> is the start of the block. The next C<nextstate>
indicates the statement that says hello. C<pushmark>, C<const>, and
C<print> are opcodes which runs on the statement. The last C<leavesub> is
the end of the block. This is a future of the module.

In short, the module has no purpose :)

=head1 DEPENDENCIES

Perl 5.8.1 or later.

lib/Acme/Perl/VM/Run.pm  view on Meta::CPAN

package Acme::Perl::VM::Run;

use strict;
use warnings;
use Acme::Perl::VM    qw(:perl_h);
use B qw(main_start comppadlist);

no warnings 'void';
INIT{
    return if APVM_DUMMY;

    if(is_not_null(main_start)){
        ENTER;
        SAVETMPS;

        $PL_curcop ||= bless \do{ my $addr = 0 }, 'B::COP'; # dummy cop

        $PL_op = main_start;
        PAD_SET_CUR(comppadlist, 1);

        $PL_runops->();

        FREETMPS;
        LEAVE;
    }
    exit;
}



( run in 0.551 second using v1.01-cache-2.11-cpan-0d8aa00de5b )