From 2c46ba3bacc1053129ed4d00ff29b4e0a5d28ce3 Mon Sep 17 00:00:00 2001 From: Anthony Shaw Date: Thu, 15 Jul 2021 16:36:40 +1000 Subject: [PATCH 1/2] Make the instruction dumps easier to read --- src/pyjion/dis.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/pyjion/dis.py b/src/pyjion/dis.py index 27dcc5a8b..e6846dd96 100644 --- a/src/pyjion/dis.py +++ b/src/pyjion/dis.py @@ -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]) + i = bytecodes[py_offset] + print(f'; {i.offset} {i.opname} - {i.arg} ({i.argval})', ) except KeyError: warn("Invalid offset {0}".format(offsets)) first = next(i) @@ -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]) + i = python_instructions[py_offset] + print(f'; {i.offset} {i.opname} - {i.arg} ({i.argval})', ) except KeyError: warn("Invalid offset {0}".format(offsets)) From 08f12e0790d496be535e0616451dea924f6e0c78 Mon Sep 17 00:00:00 2001 From: Anthony Shaw Date: Thu, 15 Jul 2021 16:54:03 +1000 Subject: [PATCH 2/2] Update release notes. --- CHANGELOG.md | 2 +- Tests/test_dis.py | 4 ++-- setup.py | 2 +- src/pyjion/__init__.py | 2 +- src/pyjion/dis.py | 8 ++++---- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c89e2f9ba..48f4e02ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/Tests/test_dis.py b/Tests/test_dis.py index 2669c4c1e..b6418a094 100644 --- a/Tests/test_dis.py +++ b/Tests/test_dis.py @@ -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): @@ -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) diff --git a/setup.py b/setup.py index a638ec98b..9e91829ab 100644 --- a/setup.py +++ b/setup.py @@ -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='anthonyshaw@apache.org', diff --git a/src/pyjion/__init__.py b/src/pyjion/__init__.py index 059b952e7..e4d301379 100644 --- a/src/pyjion/__init__.py +++ b/src/pyjion/__init__.py @@ -3,7 +3,7 @@ import os import platform -__version__ = '1.0.0b5' +__version__ = '1.0.0b6' def _no_dotnet(path): diff --git a/src/pyjion/dis.py b/src/pyjion/dis.py index e6846dd96..e00eedea6 100644 --- a/src/pyjion/dis.py +++ b/src/pyjion/dis.py @@ -590,8 +590,8 @@ def print_il(il, offsets=None, bytecodes=None): for py_offset, il_offset, native_offset in offsets: if il_offset == pc: try: - i = bytecodes[py_offset] - print(f'; {i.offset} {i.opname} - {i.arg} ({i.argval})', ) + 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) @@ -737,8 +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: - i = python_instructions[py_offset] - print(f'; {i.offset} {i.opname} - {i.arg} ({i.argval})', ) + instruction = python_instructions[py_offset] + print(f'; {instruction.offset} {instruction.opname} - {instruction.arg} ({instruction.argval})', ) except KeyError: warn("Invalid offset {0}".format(offsets))