MCPcopy Create free account
hub / github.com/RustPython/RustPython / _get_jump_target

Function _get_jump_target

Lib/dis.py:342–358  ·  view source on GitHub ↗

Gets the bytecode offset of the jump target if this is a jump instruction. Otherwise return None.

(op, arg, offset)

Source from the content-addressed store, hash-verified

340 return _inline_cache_entries.get(opname, 0)
341
342def _get_jump_target(op, arg, offset):
343 """Gets the bytecode offset of the jump target if this is a jump instruction.
344
345 Otherwise return None.
346 """
347 deop = _deoptop(op)
348 caches = _get_cache_size(_all_opname[deop])
349 if deop in hasjrel:
350 if _is_backward_jump(deop):
351 arg = -arg
352 target = offset + 2 + arg*2
353 target += 2 * caches
354 elif deop in hasjabs:
355 target = arg*2
356 else:
357 target = None
358 return target
359
360class Instruction(_Instruction):
361 """Details for a bytecode operation.

Callers 2

jump_targetMethod · 0.85
findlabelsFunction · 0.85

Calls 3

_deoptopFunction · 0.85
_get_cache_sizeFunction · 0.85
_is_backward_jumpFunction · 0.85

Tested by

no test coverage detected