Ticket #218: new_label_ops.patch

File new_label_ops.patch, 0.9 KB (added by whiteknight, 5 years ago)

Basic implementation of new ops that can be used to get/set label values in a PMC that needs it

  • src/ops/core.ops

     
    749749    $1        = (INTVAL)ptr; 
    750750} 
    751751 
     752inline op get_label(out INT, invar PMC) { 
     753    void *ptr = VTABLE_get_pointer(interp, $2); 
     754    $1        = PTR2OPCODE_T(ptr); 
     755} 
     756 
     757=item B<set_label>(invar PMC, inconst LABEL) 
     758 
     759Sets the target label for PMCs that need an opcode_t label destination. 
     760 
     761=item B<set_label(invar PMC, invar LABEL) 
     762 
     763Sets the target label for PMCs that need an opcode_t label destination. 
     764 
     765=item B<get_label(out INT, invar PMC) 
     766 
     767Gets the label from the given PMC 
     768 
     769=cut 
     770 
     771inline op set_label(invar PMC, inconst LABEL) { 
     772    VTABLE_set_pointer(interp, $1, (CUR_OPCODE + 2)); 
     773} 
     774 
     775inline op set_label(invar PMC, invar LABEL) { 
     776    VTABLE_set_pointer(interp, $1, (void*)$2); 
     777} 
     778 
     779 
    752780=back 
    753781 
    754782=cut