opcode_38pypy.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. # (C) Copyright 2021, 2023 by Rocky Bernstein
  2. """
  3. PYPY 3.8 opcodes
  4. This is a like PyPy 3.8's opcode.py with some classification
  5. of stack usage and information for formatting instructions..
  6. """
  7. import xdis.opcodes.opcode_38 as opcode_38
  8. from xdis.opcodes.base import (
  9. call_op,
  10. def_op,
  11. finalize_opcodes,
  12. init_opdata,
  13. jrel_op,
  14. name_op,
  15. rm_op,
  16. update_pj3,
  17. varargs_op,
  18. )
  19. from xdis.opcodes.opcode_37pypy import opcode_arg_fmt37pypy, opcode_extended_fmt37pypy
  20. version_tuple = (3, 8)
  21. python_implementation = "PyPy"
  22. loc = locals()
  23. init_opdata(loc, opcode_38, version_tuple, is_pypy=True)
  24. # fmt: off
  25. rm_op(loc, "ROT_FOUR", 6)
  26. rm_op(loc, "BUILD_TUPLE_UNPACK_WITH_CALL", 158)
  27. rm_op(loc, "LOAD_METHOD", 160)
  28. # PyPy only
  29. # ----------
  30. name_op(loc, "LOOKUP_METHOD", 201, 1, 2)
  31. loc["hasvargs"].append(202)
  32. call_op(loc, "CALL_METHOD_KW", 204, -1, 1)
  33. # Used only in single-mode compilation list-comprehension generators
  34. jrel_op(loc, 'SETUP_EXCEPT', 121, 0, 6, conditional=True) # ""
  35. varargs_op(loc, "BUILD_LIST_FROM_ARG", 203)
  36. def_op(loc, "LOAD_REVDB_VAR", 205)
  37. # fmt: on
  38. opcode_arg_fmt = opcode_arg_fmt38pypy = opcode_arg_fmt37pypy.copy()
  39. opcode_extended_fmt = opcode_extended_fmt38pypy = opcode_extended_fmt37pypy.copy()
  40. update_pj3(globals(), loc)
  41. finalize_opcodes(loc)