opcode_311pypy.py 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. # (C) Copyright 2025 by Rocky Bernstein
  2. """
  3. PYPY 3.11 opcodes
  4. This is a like Python's 3.10's opcode.py with some classification
  5. of stack usage and information for formatting instructions.
  6. """
  7. import xdis.opcodes.opcode_310 as opcode_310
  8. from xdis.opcodes.base import (
  9. def_op,
  10. finalize_opcodes,
  11. init_opdata,
  12. jrel_op,
  13. nargs_op,
  14. rm_op,
  15. update_pj3,
  16. varargs_op,
  17. )
  18. from xdis.opcodes.opcode_311 import opcode_arg_fmt311, opcode_extended_fmt311
  19. version_tuple = (3, 11)
  20. python_implementation = "PyPy"
  21. loc = locals()
  22. init_opdata(loc, opcode_310, version_tuple, is_pypy=True)
  23. # fmt: off
  24. # Changed opcodes
  25. # ----------------------
  26. # Removed from Python 3.10
  27. # ----------------
  28. rm_op(loc, "GEN_START", 129)
  29. rm_op(loc, "LIST_EXTEND", 162)
  30. rm_op(loc, "SET_UPDATE", 163)
  31. rm_op(loc, "DICT_MERGE", 164)
  32. rm_op(loc, "DICT_UPDATE", 165)
  33. # Added in PyPy 3.11
  34. # --------------------
  35. def_op(loc, "CHECK_EG_MATCH", 37, 0, 0)
  36. jrel_op(loc, "PREP_RERAISE_STAR", 88, 1, 0)
  37. def_op(loc, "LIST_EXTEND", 164, 1, 1)
  38. def_op(loc, "SET_UPDATE", 165, 2, 1)
  39. def_op(loc, "DICT_MERGE", 166, 2, 1)
  40. def_op(loc, "DICT_UPDATE", 167, 2, 1)
  41. loc["hasvargs"].append(202)
  42. nargs_op(loc, "CALL_METHOD_KW", 204, -1, 1)
  43. # Used only in single-mode compilation list-comprehension generators
  44. jrel_op(loc, 'SETUP_EXCEPT', 120, 0, 6, conditional=True) # ""
  45. varargs_op(loc, "BUILD_LIST_FROM_ARG", 203)
  46. def_op(loc, "LOAD_REVDB_VAR", 205)
  47. # fmt: on
  48. opcode_arg_fmt = opcode_arg_fmt311pypy = opcode_arg_fmt311.copy()
  49. opcode_extended_fmt = opcode_extended_fmt311pypy = opcode_extended_fmt311.copy()
  50. update_pj3(globals(), loc, True)
  51. finalize_opcodes(loc)