Dan Sugalski <[EMAIL PROTECTED]> wrote:
> On Fri, 10 Oct 2003, Leopold Toetsch wrote:

>> - the opcode numbers are assigned dynamically:
>>   When you load an oplib containing 100 ops, they get op numbers
>>   e.g. 1206 ... 1305. Next oplib starts at 1306 ...
>> - on load all runcores are notified to use the new oplib function
>>   or address table

> I've been thinking about this, and I've decided that loading oplibs and
> installing those oplib functions in the current table should be separate
> things. The load can do whatever it wants to initialize, but when the
> functions are installed in the opcode dispatch table that's when the
> interpreter says where the functions should go.

How or from where is the second stage then done?

Currently it would look like this:

   loadlb P1, "myops_ops"
   fortytwo I0

C<loadlib> calls F<Parrot_load_lib> which calls F<Parrot_lib_<%s>_load>.
This would call back and run C<oplib_register>. That installs the opcode
dispatch tables.

The assembler must do the same thing (as it does with dynamic PMCs) to
get the same opcode numbers (or class enums respectively).

We could actually defer installing the opcode dispatch table at runtime,
but we must reserve the opcode number range, and the assembler must
at least be able to query the dynamic lib for valid opcode names. When
the first unknown opcode is to be run, then the real functions could be
put in place.

>                                       Dan

leo

Reply via email to