1# (C) Copyright 2017, 2020 by Rocky Bernstein 2""" 3PYPY 3.5 opcodes 4 5This is a like Python 3.5's opcode.py with some classification 6of stack usage. 7""" 8 9from xdis.opcodes.base import ( 10 def_op, 11 extended_format_ATTR, 12 extended_format_RETURN_VALUE, 13 finalize_opcodes, 14 init_opdata, 15 jrel_op, 16 name_op, 17 nargs_op, 18 varargs_op, 19 update_pj3, 20) 21 22version = 3.5 23python_implementation = "PyPy" 24 25import xdis.opcodes.opcode_35 as opcode_35 26 27l = locals() 28init_opdata(l, opcode_35, version, is_pypy=True) 29 30## FIXME: DRY common PYPY opcode additions 31 32# PyPy only 33# ---------- 34def_op(l, "FORMAT_VALUE", 155) 35def_op(l, "BUILD_STRING", 157) 36name_op(l, "LOOKUP_METHOD", 201, 1, 2) 37nargs_op(l, "CALL_METHOD", 202, -1, 1) 38l["hasvargs"].append(202) 39 40# Used only in single-mode compilation list-comprehension generators 41varargs_op(l, "BUILD_LIST_FROM_ARG", 203) 42 43# Used only in assert statements 44jrel_op(l, "JUMP_IF_NOT_DEBUG", 204, conditional=True) 45 46# There are no opcodes to remove or change. 47# If there were, they'd be listed below. 48 49# FIXME remove (fix uncompyle6) 50update_pj3(globals(), l) 51 52finalize_opcodes(l) 53 54opcode_extended_fmt = { 55 "LOAD_ATTR": extended_format_ATTR, 56 "RETURN_VALUE": extended_format_RETURN_VALUE, 57 "STORE_ATTR": extended_format_ATTR, 58} 59