Displacement of the python2.7.13 opcode encountered some pits

Source: Internet
Author: User

There are two main pits

1.XXXSLICE related opcode

#define SLICE      #define slice_1    #define slice_2    #define slice_3    #define Store_slice#define store_slice_1  #define store_slice_2  #define store_ Slice_3  #define delete_slice   #define#define#define Delete_ Slice_3  

Because these macro definitions are continuous at compile and run time, the Python source code is operated in Slice+1,opcode-slice & 1.

If the permutation is discontinuous, there will be a problem.

2.call_functionxxx related opcode

/* The next 3 opcodes must be contiguous and satisfy   (call_function_var-call_function) & 3 = = 1  */#define CA Ll_function_var            /* #args + (#kwargs <<8) */#define CALL_FUNCTION_KW/           * #args + (#kwargs <<8) */# Define CALL_FUNCTION_VAR_KW        /* #args + (#kwargs <<8) */

Similar to the 1 issue, CEVAL.C (opcode-call_function) & 3, so it must also be guaranteed (call_function_var-call_function) & 3 = = 1, and these three macros are continuously

Other reference https://zhuanlan.zhihu.com/p/25850970 can be

Displacement of the python2.7.13 opcode encountered some pits

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.