Leopold Toetsch <[EMAIL PROTECTED]> writes:

> JüRgen" "BöMmels <[EMAIL PROTECTED]> wrote:
> > QUESTION: The calling convention for methods states that P2 should be
> > the object the sub was called on. The current build_call_frames pushes
> > the object starting at P5. How can the NCI-Interface be extended to
> > pass objects in P2 down to the c-functions?
> 
> This calling convention is AFAIK for PASM object code only. I would
> just pass the object itself with your 'P' signature in P5,6,...

Using P5 is the way it's handled now. This works quite well.

But this way the calling code has to know if the called code is a sub
or a nci. If its a sub it has to put the object in P2, if its a nci it
has to put the object in P5. Two possible solutions:
* Fix the calling convention to use P5 for the SELF object
* Allow the passing of registers in non-consecutive order

My idea is to extend the signature to (optionally) append the
registernumber in signature:
build_call_func(interp, pmc, "iP2pPp31")
for calling a function
int func(PMC_REG(2), PMC_REG(5)->data, PMC_REG(6), PMC_REG(31)->data)
How does this sound

> > QUESTION: The class initialisation code seems strange to me. Will the
> > class initialisation be called once for each interpreter (there are
> > interpreter variables in there) or once for each program start (the
> > classes are entered in a static array Parrot_base_vtables)?
> 
> It should probably done only once. We have to sort interpreter->iglobals
> into 2 such lists: per interpreter globals and global globals. When
> that's done, interpreter init can check if the previous interpreter
> already had the real globals and when yes, just sets a pointer to these.
> 
> The make_interpreter() should then be:
>     make_interpreter(prev_interpreter);

No need to chain the interpreters. Have a function like this

void* get_globals ()
{
  static void *globals = NULL;

  if (!globals) {
    globals = mem_sys_allocate(42);
    ...
  }

  return globals;
}

This way there is one and only one global data structure. get_globals
can be called anytime in Parrot_init or make_interpreter.

bye
boe
-- 
Juergen Boemmels                        [EMAIL PROTECTED]
Fachbereich Physik                      Tel: ++49-(0)631-205-2817
Universitaet Kaiserslautern             Fax: ++49-(0)631-205-3906
PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F  23 F6 C7 2F 85 93 DD 47

Reply via email to