#218: can't sort a PIR subclass of an RPA.
-------------------------+--------------------------------------------------
 Reporter:  coke         |        Owner:  whiteknight
     Type:  bug          |       Status:  reopened   
 Priority:  normal       |    Milestone:  1.1        
Component:  core         |      Version:             
 Severity:  high         |   Resolution:             
 Keywords:  tcl blocker  |         Lang:             
    Patch:               |     Platform:  all        
-------------------------+--------------------------------------------------

Comment(by whiteknight):

 Okay, I've looked back into a few of these issues, and I think that the
 tests added in r38234 are not good tests.

 ResizablePMCArray and FixedPMCArray do not supply get_pointer VTABLEs, and
 fall back to Default.get_pointer(). This, of course, simply returns SELF
 which is the behavior that these tests are probing for. However, returning
 a pointer to the PMC itself is far from the most common use of
 VTABLE_get_pointer. Hash PMCs for instance use get_pointer to return a
 pointer to the underlying Hash* structure. Sub PMCs use get_pointer to
 return the opcode_t* address of the PIR subroutine. So, it doesn't make
 sense to force the *Array PMC get_pointer VTABLEs to return the address of
 the PMC itself and not a pointer to it's underlying data structure, when
 other PMCs aren't held to this rule (and since it makes more sense to use
 get_pointer here in a different way).

 Now, that brings me to the issue of the get_addr opcode, which has
 problems. get_addr is used in two distinct ways from PIR (it is used in a
 variety of other ways internally):

 1) To retrieve opcode_t* addresses in things like Sub and Continuation
 PMCs
 2) To retrieve the actual location in memory of array PMCs (which is how
 pmichaud's tests use it)

 I would suggest that use #2 is not the right use of get_addr, and if
 people are looking to get the actual memory location of a PMC in a
 consistent way a new opcode for that purpose should be created.

 I suggest the creation of a get_memaddr opcode to return the actual
 location in memory of the PMC structure, and let get_addr be a wrapper
 around the get_pointer VTABLE (with the knowledge that it will return
 inconsistent results based on PMC type). Thoughts?

-- 
Ticket URL: <https://trac.parrot.org/parrot/ticket/218#comment:15>
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