Skip to content

Commit f00f107

Browse files
author
rocky
committed
Another pass over RustPython
Add 3.14 testing into mix.
1 parent efdfd05 commit f00f107

14 files changed

+108
-89
lines changed

admin-tools/pyenv-newest-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ if [[ $0 == ${BASH_SOURCE[0]} ]] ; then
77
fi
88

99
# export PYVERSIONS='3.11 pypy3.11 pypy3.11 3.12 3.13'
10-
export PYVERSIONS='3.11 pypy3.11 graalpy-24.2.2 pypy3.11 3.12 graalpy-community-25.0.0 3.13'
10+
export PYVERSIONS='3.11 pypy3.11 graalpy-24.2.2 pypy3.11 3.12 graalpy-community-25.0.0 3.13 3.14'

test/bytecode_graal310/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/.python-version
622 Bytes
Binary file not shown.
1.02 KB
Binary file not shown.
825 Bytes
Binary file not shown.
1.14 KB
Binary file not shown.
1.04 KB
Binary file not shown.
1.51 KB
Binary file not shown.

xdis/opcodes/base.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -450,11 +450,11 @@ def fix_opcode_names(opmap: dict[str, int]):
450450
return dict([(k.replace("+", "_"), v) for (k, v) in opmap.items()])
451451

452452

453-
def update_pj3(g, loc, is_pypy: bool=False) -> None:
453+
def update_pj3(g, loc, is_pypy: bool=False, is_rust: bool=False) -> None:
454454
if loc["version_tuple"] < (3, 11):
455455
g.update({"PJIF": loc["opmap"]["POP_JUMP_IF_FALSE"]})
456456
g.update({"PJIT": loc["opmap"]["POP_JUMP_IF_TRUE"]})
457-
update_sets(loc, is_pypy)
457+
update_sets(loc, is_pypy, is_rust)
458458

459459

460460
def update_pj2(g, loc, is_pypy: bool=False) -> None:
@@ -463,7 +463,7 @@ def update_pj2(g, loc, is_pypy: bool=False) -> None:
463463
update_sets(loc, is_pypy)
464464

465465

466-
def update_sets(loc, is_pypy) -> None:
466+
def update_sets(loc, is_pypy: bool, is_rust=False) -> None:
467467
"""
468468
Updates various category sets all opcode have been defined.
469469
"""
@@ -482,7 +482,7 @@ def update_sets(loc, is_pypy) -> None:
482482
[loc["opmap"]["JUMP_ABSOLUTE"], loc["opmap"]["JUMP_FORWARD"]]
483483
)
484484
elif python_version:
485-
if not is_pypy:
485+
if not is_pypy and not is_rust:
486486
loc["JUMP_UNCONDITIONAL"] = frozenset(
487487
[
488488
loc["opmap"]["JUMP_FORWARD"],
@@ -498,9 +498,10 @@ def update_sets(loc, is_pypy) -> None:
498498
loc["LOOP_OPS"] = frozenset()
499499

500500
loc["LOCAL_OPS"] = frozenset(loc["haslocal"])
501-
loc["JUMP_OPS"] = (
502-
loc["JABS_OPS"] | loc["JREL_OPS"] | loc["LOOP_OPS"] | loc["JUMP_UNCONDITIONAL"]
503-
)
501+
if not is_rust:
502+
loc["JUMP_OPS"] = (
503+
loc["JABS_OPS"] | loc["JREL_OPS"] | loc["LOOP_OPS"] | loc["JUMP_UNCONDITIONAL"]
504+
)
504505
loc["NAME_OPS"] = frozenset(loc["hasname"])
505506
loc["NARGS_OPS"] = frozenset(loc["hasnargs"])
506507
loc["VARGS_OPS"] = frozenset(loc["hasvargs"])

xdis/opcodes/opcode_1x.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,19 +63,22 @@
6363
# Instruction opcodes for compiled code
6464
# Blank lines correspond to available opcodes
6565

66-
# If the POP field is -1 and the opcode is var args operation
66+
# Obsolete: If the POP field is -1 and the opcode is var args operation
6767
# (hasvargs | hasnargs) operation, then
6868
# the operand holds the size.
6969

70+
# If an argument is VARYING_STACK_INT, then the number of items
71+
# pushed or popped varies in stack-dependent data way.
72+
7073
# fmt: off
7174

7275
# OP NAME OPCODE POP PUSH
7376
#-----------------------------------------------
7477
def_op(loc, "STOP_CODE", 0, 0, 0, fallthrough=False)
75-
def_op(loc, "POP_TOP", 1)
76-
def_op(loc, "ROT_TWO", 2)
77-
def_op(loc, "ROT_THREE", 3)
78-
def_op(loc, "DUP_TOP", 4)
78+
def_op(loc, "POP_TOP", 1, 1, 0)
79+
def_op(loc, "ROT_TWO", 2, 2, 3)
80+
def_op(loc, "ROT_THREE", 3, 3, 3)
81+
def_op(loc, "DUP_TOP", 4, 0, 1)
7982

8083
def_op(loc, "UNARY_POSITIVE", 10)
8184
unary_op(loc, "UNARY_NEGATIVE", 11)

0 commit comments

Comments
 (0)