Skip to content

Commit

Permalink
Merge pull request #321 from tonybaloney/dis_sequence
Browse files Browse the repository at this point in the history
Make the instruction dumps easier to read
  • Loading branch information
tonybaloney authored Jul 15, 2021
2 parents 71c6953 + 08f12e0 commit c1e4ccc
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Release notes

## 1.0.0 (master)
## 1.0.0 (beta6)

* Updated to .NET 6 preview 6
* Fixed a bug where `ord()` builtin would return the wrong type (#315)
Expand Down
4 changes: 2 additions & 2 deletions Tests/test_dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def test_f():
with contextlib.redirect_stdout(f):
dis(test_f, True)
self.assertIn("ldarg.1", f.getvalue())
self.assertIn("Instruction(", f.getvalue())
self.assertIn("; 0 LOAD_CONST - 1 (1)", f.getvalue())
dis(test_f, True)

def test_fat_static(self):
Expand Down Expand Up @@ -111,7 +111,7 @@ def test_f():
with contextlib.redirect_stdout(f):
dis_native(test_f, True)
self.assertIn("PUSH RBP", f.getvalue())
self.assertIn("Instruction(", f.getvalue())
self.assertIn("; 0 LOAD_CONST - 1 (1)", f.getvalue())
dis_native(test_f, True)


Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

setup(
name='pyjion',
version='1.0.0b5',
version='1.0.0b6',
description='A JIT compiler wrapper for CPython',
author='Anthony Shaw',
author_email='[email protected]',
Expand Down
2 changes: 1 addition & 1 deletion src/pyjion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import platform

__version__ = '1.0.0b5'
__version__ = '1.0.0b6'


def _no_dotnet(path):
Expand Down
6 changes: 4 additions & 2 deletions src/pyjion/dis.py
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,8 @@ def print_il(il, offsets=None, bytecodes=None):
for py_offset, il_offset, native_offset in offsets:
if il_offset == pc:
try:
print('; ', bytecodes[py_offset])
instruction = bytecodes[py_offset]
print(f'; {instruction.offset} {instruction.opname} - {instruction.arg} ({instruction.argval})', )
except KeyError:
warn("Invalid offset {0}".format(offsets))
first = next(i)
Expand Down Expand Up @@ -736,7 +737,8 @@ def dis_native(f, include_offsets=False):
for py_offset, il_offset, native_offset in jit_offsets:
if (position + native_offset) == offset:
try:
print('; ', python_instructions[py_offset])
instruction = python_instructions[py_offset]
print(f'; {instruction.offset} {instruction.opname} - {instruction.arg} ({instruction.argval})', )
except KeyError:
warn("Invalid offset {0}".format(offsets))

Expand Down

0 comments on commit c1e4ccc

Please sign in to comment.