From: peter.noreply@tin.it   
      
   On Mon, 19 Jan 2026 15:22:07 -0800   
   Paul Rubin wrote:   
      
   > peter writes:   
   > > for the tail call version it was changed to   
   > >   
   > > RELOAD() opcode func=(opcode)tbl[*ip++]; __attribute__((musttail))   
   > > return func(ip, tbl, TOP, FTOP, sp, rp, fp, lp)   
   >   
   >   
   > You could possibly use "inline RELOAD() { .... ;}" instead of the macro.   
      
   No that did not work. I also do not want the compiler to mess with this.   
   The pre-processor expansion does exactly what I want.   
   Musttail requires the parameters to exactly match on the incoming and   
   outgoing calls. Like if it is a recursive call.   
      
      
   >   
   > > and for the tailcall version   
   > > mov rax, qword ptr [r13 + 8*rax]   
   > > rex64 jmp rax   
   >   
   > I wonder why the tailcall version didn't combine the mov with the jmp   
   > like the other version did.   
      
   I do also wonder about that! From my previous testing it will not make a   
   difference speed-wise.   
      
   >   
   > > It also turns out that the musttail attribute is not necessary   
   > > It will generate a tailcall aanyway. The difference is that with   
   > > musttail it will report an error if it cannot do the tailcall.   
   >   
   > Yes, TCO has been present since the beginning but it's been   
   > opportunistic rather than something you can rely on.   
   >   
   > > Unfortunately GCC does not recognize preserve_none and uses the stack   
   > > for some parameters   
      
   It looks like it recognizes it but choose to ignore it.   
   That is what the warning messages say.   
      
      
   > Oh that's interesting. I half remember there being some other feature   
   > for that, but who knows. Does -fwhole-program help?   
      
   I will for sure continue to use the computed goto also in the future.   
   The complete VM8 function containing 157 opcodes is about 1200   
   lines of code. 255 are for the function-array. that leaves 945 lines   
   for 157 opcode, about 6 lines per opcode!   
      
   BR   
   Peter   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|