How to add a new opcode?

0 views
Skip to first unread message

Gerd Pokorra

unread,
Aug 9, 2005, 3:41:16 AM8/9/05
to perl6-i...@perl.org
For tests I want to add a new opcode to Parrot. I created a file
ops/my.ops and do the configuration and make again, but I don't find my
opcode in the file lib/Parrot/OpLib/core.pm. How to add a new opcode?
Can you give me an example.

Gerd Pokorra

pokorra[at]uni-siegen.de

Klaas-Jan Stol

unread,
Aug 9, 2005, 6:52:21 AM8/9/05
to pok...@uni-siegen.de, perl6-i...@perl.org
Gerd Pokorra wrote:

I think the easiest thing to do is have a look at the dynoplibs
directory. In this directory are a few test files with user-defined ops.
read the README file. It doesn't quite work for me as it is described
there, but that's probably something with my path settings.

Anyhow, this works for me:

according to the readme file, type this: (in the parrot root dir, not in
the dynoplibs directory)

parrot$ export LD_LIBRARY_PATH=.:blib/lib
parrot$ make -s
parrot$ make shared
parrot$ make -C dynoplibs

Then, I have to edit the test.pasm file in the dynoplibs directory a
bit: instead of loading "myops_ops", I write:

loadlib P1, "dynoplibs/myops_ops"

The same is true for the ohter loadlib instructions in the file.
And I run the test.pasm file from the parrot root dir, not from the
dynoplibs directory. So:

parrot$ parrot dynoplibs/test.pasm

Hope this helps,

klaas-jan

Leopold Toetsch

unread,
Aug 9, 2005, 7:10:09 AM8/9/05
to pok...@uni-siegen.de, perl6-i...@perl.org
Gerd Pokorra wrote:
> For tests I want to add a new opcode to Parrot. I created a file
> ops/my.ops and do the configuration and make again, but I don't find my
> opcode in the file lib/Parrot/OpLib/core.pm. How to add a new opcode?

As Klaas-Jan describes, you can create a dynamic oplib. If this isn't an
option, you can add an opcode to ops/experimental.ops. Other ops files
are checked against ops/ops.num.

> Gerd Pokorra

leo

Reply all
Reply to author
Forward
0 new messages