mirror of
https://github.com/python/cpython.git
synced 2025-11-01 02:38:53 +00:00
gh-112519: Make it possible to specify instruction flags for pseudo instructions in bytecodes.c (#112520)
This commit is contained in:
parent
7eeea13403
commit
07ebd46f9e
6 changed files with 76 additions and 12 deletions
|
|
@ -466,6 +466,44 @@ class TestGeneratedCases(unittest.TestCase):
|
|||
"""
|
||||
self.run_cases_test(input, output)
|
||||
|
||||
def test_pseudo_instruction_no_flags(self):
|
||||
input = """
|
||||
pseudo(OP) = {
|
||||
OP1,
|
||||
};
|
||||
|
||||
inst(OP1, (--)) {
|
||||
}
|
||||
"""
|
||||
output = """
|
||||
TARGET(OP1) {
|
||||
frame->instr_ptr = next_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(OP1);
|
||||
DISPATCH();
|
||||
}
|
||||
"""
|
||||
self.run_cases_test(input, output)
|
||||
|
||||
def test_pseudo_instruction_with_flags(self):
|
||||
input = """
|
||||
pseudo(OP, (HAS_ARG, HAS_JUMP)) = {
|
||||
OP1,
|
||||
};
|
||||
|
||||
inst(OP1, (--)) {
|
||||
}
|
||||
"""
|
||||
output = """
|
||||
TARGET(OP1) {
|
||||
frame->instr_ptr = next_instr;
|
||||
next_instr += 1;
|
||||
INSTRUCTION_STATS(OP1);
|
||||
DISPATCH();
|
||||
}
|
||||
"""
|
||||
self.run_cases_test(input, output)
|
||||
|
||||
def test_array_input(self):
|
||||
input = """
|
||||
inst(OP, (below, values[oparg*2], above --)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue