2 comments

  • evomassiny 1 hour ago
    Could you duplicate `RECORD_INST` before each `INSTRUCTION_N`, so that:

    ```

       INSTRUCTION_1:
         // subroutine 1
         ip++;
         goto *dispatch_var[*ip];
    
       INSTRUCTION_2:
         // subroutine 2
         ip++;
         goto *dispatch_var[*ip];
    
    ```

    becomes: ```

       RECORD_INST_1:
         // record logic
       INSTRUCTION_1:
         // subroutine 1
         ip++;
         goto *dispatch_var[*ip];
    
       RECORD_INST_2:
         // record logic
       INSTRUCTION_2:
         // subroutine 2
         ip++;
         goto *dispatch_var[*ip];
    ```

    This way you could directly swap `dispatch_var` with an array populated with the `RECORD_INST_*` labels, and remove one step at runtime.

    Or maybe this is what you are trying to avoid to reduce the binary size ?

    • kzrdude 1 hour ago
      That sounds smart, maybe worth testing, but I think it bloats the instruction cache even when not tracing.
  • haeseong 1 hour ago
    [dead]