#681: Cannot use a PIR object for IO
--------------------+-------------------------------------------------------
 Reporter:  flh     |       Owner:  whiteknight
     Type:  bug     |      Status:  assigned   
 Priority:  normal  |   Milestone:             
Component:  none    |     Version:  trunk      
 Severity:  medium  |    Keywords:             
     Lang:          |       Patch:             
 Platform:          |  
--------------------+-------------------------------------------------------

Comment(by whiteknight):

 Okay, I've figured out the problem. I'm sorry that it's taken me so long
 to do it! The problem, in a nutshell, is that the IO system currently uses
 Parrot_PCCINVOKE to perform the sub call instead of calling the more
 versatile Parrot_invoke_from_sig_object() family of functions.
 Parrot_PCCINVOKE is designed to run methods which are written in C, not
 methods which are written in PIR. You can see around line
 src/call/pcc.c:2870 that Parrot_PCCINVOKE calls the invoke vtable method
 on the Sub PMC, but never calls runops. For NCI subs, invoke executes the
 function directly. However, for PIR-defined Subs, it only sets up the
 execution environment for later execution by the current runcore (if we're
 using the invokecc opcode) or from the runops* family of functions.

 The short answer is that if we switch the call in Parrot_io_reads from
 Parrot_PCCINVOKE to Parrot_pcc_invoke_method_from_c_args, the example code
 you posted magically works. I'm attaching a patch to that affect in a
 moment.

 The long answer is that this function is considered "experimental", and it
 likely won't work perfectly until Allison's pcc_rewiring branch gets
 merged into trunk. In fact, I can tell you for certain that if we switch
 over all the calls in src/io/api.c, it will cause unexplained segfaults
 and test failures, so most of the API functions cannot be used with PIR-
 defined objects. Since Allison is converting all the Parrot_PCCINVOKE
 calls as part of her branch work, this ticket should be resolved as soon
 as she merges.

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/681#comment:3>
Parrot <https://trac.parrot.org/parrot/>
Parrot Development
_______________________________________________
parrot-tickets mailing list
[email protected]
http://lists.parrot.org/mailman/listinfo/parrot-tickets

Reply via email to