Changes between Version 4 and Version 5 of RewritingPMCsInNQP

Show
Ignore:
Timestamp:
06/27/09 00:44:43 (13 years ago)
Author:
bacek
Comment:

Add some more ideas about PMC, NQP and L1

Legend:

Unmodified
Added
Removed
Modified
  • RewritingPMCsInNQP

    v4 v5  
    1616/* possible equivalent nqp-like code */ 
    1717$nextkey :=       key_next($INTERP, $key); 
    18 $nextkey := cfunc:key_next($INTERP, $key); /* possible alternative syntax */ 
     18 
     19/* possible alternative syntax */ 
     20$nextkey := cfunc:key_next($INTERP, $key); 
     21 
     22/* Another alternative syntax. Doesn't require parsing adjustment, iiuc. Any function in "C" namespace */ 
     23$nextkey :=    c::key_next($INTERP, $key); 
    1924}}} 
    2025 
     
    3338}}} 
    3439 
     40 
     41Another possible L1 code: 
     42{{{ 
     43# NOTE: See above 
     44# NOTE2: We use some kind of C-function-proxy object to encapsulate call. 
     45find_cfunc $P0, 'next_key'   #find the function or get it from a cache or something 
     46push_c_arg $P0, INTERP       #set INTERP as the first arg to whatever function is called next 
     47push_c_arg $P0, key          #set key to the second arg 
     48c_return   $P0, nextkey      #stick the return value into nextkey 
     49call_cfunc $P0               #call it! 
     50}}} 
     51 
    3552The equivalent L1 code will need to deal with C calling conventions and efficiently looking up (and caching) the appropriate symbol.