MCPcopy Index your code
hub / github.com/RustPython/RustPython / Instruction

Class Instruction

Lib/dis.py:360–437  ·  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

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