Add --target=pbc and use for build #102

wants to merge 4 commits into


None yet

2 participants

gerdr commented Feb 17, 2013

Adds a new option --target=pbc to the frontend. This is the first tiny step on the way to direct bytecode generation as envisioned by whiteknight.

The corresponding NQP changes can be found in the branch target-pbc of the main NQP repository, and the old Parrot-side infrastructure has been removed in whiteknight's branch eval_pmc.

Should not be merged into nom: please create a new branch instead.

Once someone pulls the trigger on parrot/parrot#934 , the code can be tested via perl --gen-parrot=eval_pmc --gen-nqp=target-pbc.


Are you certain that $precomp.main_sub() is always the same as the previous $precomp[0] ?


I'm not 100% certain, no. In my defense:

  • that's how whiteknight did it, and he hopefully knew what he was doing (instead of just cargo-coding like myself).
  • the build succeeds and all tests pass

Spectesting on Cygwin seems to result in additional failures with message

Dubious, test returned 1 (wstat 256, 0x100)

which is why I'm asking for a branch to be created so others can check I did not mess up.


@pmichaud Note that we're now always calling the main sub instead of invoking an eval PMC. As the eval PMC implicitly called the sub at index 0 as well, the change is at least consistent.

The main_sub member of the bytecode structure apparently gets initialized to -1, so somewhere some code gets executed that fixes it to return the first sub in absence of an explicit annotation.

I'll look into it some more tomorrow.


@pmichaud found it - see parrot-dev

gerdr commented Feb 19, 2013

@pmichaud I believe I've taken care of all of your complaints, so please take another look if you have a free minute.

The PackfileView PMC now comes with 2 additional methods first_sub_in_const_table() and single_sub_by_tag(). The former is the drop-in replacement for the old logic, is used right now but imo should go away long-term. The latter can only be used after tag generation has been added to the code generator. Right now, it's implemented in terms of subs_by_tag(), which should be fixed once it becomes more heavily used.

I don't think it's an immediate concern: I'd wait with switching to the new tag-based system until someone takes a shot at direct bytecode generation.

gerdr commented Feb 22, 2013

Now obsolete - see #106

@gerdr gerdr closed this Feb 22, 2013
@zoffixznet zoffixznet added a commit that referenced this pull request Jul 16, 2016
@zoffixznet zoffixznet List Zoffix Znet as release manager for #102 August release
Unless someone else who wants to learn how to do a release wishes
to have a go.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment