opcode_33pypy.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. # (C) Copyright 2019-2021, 2023-2024 by Rocky Bernstein
  2. """
  3. PYPY 3.3 opcodes
  4. This is a like Python 3.3's opcode.py with some classification
  5. of stack usage.
  6. """
  7. import xdis.opcodes.opcode_33 as opcode_33
  8. from xdis.opcodes.base import (
  9. call_op,
  10. finalize_opcodes,
  11. init_opdata,
  12. jrel_op,
  13. name_op,
  14. update_pj3,
  15. varargs_op,
  16. )
  17. from xdis.opcodes.format.extended import (
  18. extended_format_ATTR,
  19. extended_format_CALL_METHOD,
  20. extended_format_RETURN_VALUE,
  21. )
  22. version_tuple = (3, 3)
  23. python_implementation = "PyPy"
  24. loc = locals()
  25. init_opdata(loc, opcode_33, version_tuple, is_pypy=True)
  26. ## FIXME: DRY common PYPY opcode additions
  27. # PyPy only
  28. # ----------
  29. name_op(loc, "LOOKUP_METHOD", 201, 1, 2)
  30. call_op(loc, "CALL_METHOD", 202, -1, 1)
  31. loc["hasvargs"].append(202)
  32. # Used only in single-mode compilation list-comprehension generators
  33. varargs_op(loc, "BUILD_LIST_FROM_ARG", 203)
  34. # Used only in assert statements
  35. jrel_op(loc, "JUMP_IF_NOT_DEBUG", 204, conditional=True)
  36. # There are no opcodes to remove or change.
  37. # If there were, they'd be listed below.
  38. # FIXME remove (fix uncompyle6)
  39. opcode_extended_fmt = {
  40. "CALL_METHOD": extended_format_CALL_METHOD,
  41. "LOAD_ATTR": extended_format_ATTR,
  42. "RETURN_VALUE": extended_format_RETURN_VALUE,
  43. "STORE_ATTR": extended_format_ATTR,
  44. }
  45. update_pj3(globals(), loc)
  46. finalize_opcodes(loc)