Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
1 result

nlrx86.c

Blame
    • Damien George's avatar
      11ecdf2e
      py/nlr: Use MP_UNREACHABLE at the end of arch-specific nlr_jump funcs. · 11ecdf2e
      Damien George authored
      Recent versions of gcc perform optimisations which can lead to the
      following code from the MP_NLR_JUMP_HEAD macro being omitted:
      
          top->ret_val = val; \
          MP_NLR_RESTORE_PYSTACK(top); \
          *_top_ptr = top->prev; \
      
      This is noticeable (at least) in the unix coverage on x86-64 built with gcc
      9.1.0.  This is because the nlr_jump function is marked as no-return, so
      gcc deduces that the above code has no effect.
      
      Adding MP_UNREACHABLE tells the compiler that the asm code may branch
      elsewhere, and so it cannot optimise away the code.
      11ecdf2e
      History
      py/nlr: Use MP_UNREACHABLE at the end of arch-specific nlr_jump funcs.
      Damien George authored
      Recent versions of gcc perform optimisations which can lead to the
      following code from the MP_NLR_JUMP_HEAD macro being omitted:
      
          top->ret_val = val; \
          MP_NLR_RESTORE_PYSTACK(top); \
          *_top_ptr = top->prev; \
      
      This is noticeable (at least) in the unix coverage on x86-64 built with gcc
      9.1.0.  This is because the nlr_jump function is marked as no-return, so
      gcc deduces that the above code has no effect.
      
      Adding MP_UNREACHABLE tells the compiler that the asm code may branch
      elsewhere, and so it cannot optimise away the code.