MCPcopy Index your code
hub / github.com/python/cpython / Instruction

Class Instruction

Lib/dis.py:361–438  ·  view source on GitHub ↗

Details for a bytecode operation. Defined fields: opname - human readable name for operation opcode - numeric code for operation arg - numeric argument to operation (if any), otherwise None argval - resolved arg value (if known), otherwise same as arg

Source from the content-addressed store, hash-verified

359 return target
360
361class Instruction(_Instruction):
362 """Details for a bytecode operation.
363
364 Defined fields:
365 opname - human readable name for operation
366 opcode - numeric code for operation
367 arg - numeric argument to operation (if any), otherwise None
368 argval - resolved arg value (if known), otherwise same as arg
369 argrepr - human readable description of operation argument
370 offset - start index of operation within bytecode sequence
371 start_offset - start index of operation within bytecode sequence including extended args if present;
372 otherwise equal to Instruction.offset
373 starts_line - True if this opcode starts a source line, otherwise False
374 line_number - source line number associated with this opcode (if any), otherwise None
375 label - A label if this instruction is a jump target, otherwise None
376 positions - Optional dis.Positions object holding the span of source code
377 covered by this instruction
378 cache_info - information about the format and content of the instruction's cache
379 entries (if any)
380 """
381
382 @staticmethod
383 def make(
384 opname, arg, argval, argrepr, offset, start_offset, starts_line,
385 line_number, label=None, positions=None, cache_info=None
386 ):
387 return Instruction(opname, _all_opmap[opname], arg, argval, argrepr, offset,
388 start_offset, starts_line, line_number, label, positions, cache_info)
389
390 @property
391 def oparg(self):
392 """Alias for Instruction.arg."""
393 return self.arg
394
395 @property
396 def baseopcode(self):
397 """Numeric code for the base operation if operation is specialized.
398
399 Otherwise equal to Instruction.opcode.
400 """
401 return _deoptop(self.opcode)
402
403 @property
404 def baseopname(self):
405 """Human readable name for the base operation if operation is specialized.
406
407 Otherwise equal to Instruction.opname.
408 """
409 return opname[self.baseopcode]
410
411 @property
412 def cache_offset(self):
413 """Start index of the cache entries following the operation."""
414 return self.offset + 2
415
416 @property
417 def end_offset(self):
418 """End index of the cache entries following the operation."""

Callers 3

makeMethod · 0.70
print_instructionMethod · 0.70
_get_instructions_bytesFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…