Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf37b9c3

Browse files
committed
Add _POP_CALL_LOAD_CONST_INLINE_BORROW
1 parent3744da4 commitf37b9c3

File tree

8 files changed

+104
-50
lines changed

8 files changed

+104
-50
lines changed

‎Include/internal/pycore_uop_ids.h

Lines changed: 46 additions & 45 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Include/internal/pycore_uop_metadata.h

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Lib/test/test_capi/test_opt.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1958,7 +1958,7 @@ def testfunc(n):
19581958
self.assertNotIn("_CALL_ISINSTANCE",uops)
19591959
self.assertNotIn("_GUARD_THIRD_NULL",uops)
19601960
self.assertNotIn("_GUARD_CALLABLE_ISINSTANCE",uops)
1961-
self.assertIn("_POP_TWO_LOAD_CONST_INLINE_BORROW",uops)
1961+
self.assertIn("_POP_CALL_LOAD_CONST_INLINE_BORROW",uops)
19621962

19631963
deftest_call_list_append(self):
19641964
deftestfunc(n):
@@ -1991,7 +1991,7 @@ def testfunc(n):
19911991
self.assertNotIn("_CALL_ISINSTANCE",uops)
19921992
self.assertNotIn("_TO_BOOL_BOOL",uops)
19931993
self.assertNotIn("_GUARD_IS_TRUE_POP",uops)
1994-
self.assertIn("_POP_TWO_LOAD_CONST_INLINE_BORROW",uops)
1994+
self.assertIn("_POP_CALL_LOAD_CONST_INLINE_BORROW",uops)
19951995

19961996
deftest_call_isinstance_is_false(self):
19971997
deftestfunc(n):
@@ -2009,7 +2009,7 @@ def testfunc(n):
20092009
self.assertNotIn("_CALL_ISINSTANCE",uops)
20102010
self.assertNotIn("_TO_BOOL_BOOL",uops)
20112011
self.assertNotIn("_GUARD_IS_FALSE_POP",uops)
2012-
self.assertIn("_POP_TWO_LOAD_CONST_INLINE_BORROW",uops)
2012+
self.assertIn("_POP_CALL_LOAD_CONST_INLINE_BORROW",uops)
20132013

20142014
deftest_call_isinstance_subclass(self):
20152015
deftestfunc(n):
@@ -2027,7 +2027,7 @@ def testfunc(n):
20272027
self.assertNotIn("_CALL_ISINSTANCE",uops)
20282028
self.assertNotIn("_TO_BOOL_BOOL",uops)
20292029
self.assertNotIn("_GUARD_IS_TRUE_POP",uops)
2030-
self.assertIn("_POP_TWO_LOAD_CONST_INLINE_BORROW",uops)
2030+
self.assertIn("_POP_CALL_LOAD_CONST_INLINE_BORROW",uops)
20312031

20322032
deftest_call_isinstance_unknown_object(self):
20332033
deftestfunc(n):

‎Python/bytecodes.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5353,6 +5353,13 @@ dummy_func(
53535353
PyStackRef_CLOSE(pop1);
53545354
}
53555355

5356+
tier2pureop(_POP_CALL_LOAD_CONST_INLINE_BORROW, (ptr/4,callable,null--value)) {
5357+
(void)null;// Silence compiler warnings about unused variables
5358+
DEAD(null);
5359+
PyStackRef_CLOSE(callable);
5360+
value=PyStackRef_FromPyObjectImmortal(ptr);
5361+
}
5362+
53565363
tier2pureop(_POP_CALL_ONE_LOAD_CONST_INLINE_BORROW, (ptr/4,callable,null,pop--value)) {
53575364
PyStackRef_CLOSE(pop);
53585365
(void)null;// Silence compiler warnings about unused variables

‎Python/executor_cases.c.h

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎Python/optimizer_analysis.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,7 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
557557
case_POP_TOP_LOAD_CONST_INLINE:
558558
case_POP_TOP_LOAD_CONST_INLINE_BORROW:
559559
case_POP_TWO_LOAD_CONST_INLINE_BORROW:
560+
case_POP_CALL_LOAD_CONST_INLINE_BORROW:
560561
case_POP_CALL_ONE_LOAD_CONST_INLINE_BORROW:
561562
case_POP_CALL_TWO_LOAD_CONST_INLINE_BORROW:
562563
optimize_pop_top_again:
@@ -572,6 +573,9 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
572573
case_POP_CALL_ONE_LOAD_CONST_INLINE_BORROW:
573574
last->opcode=_POP_TWO;
574575
break;
576+
case_POP_CALL_LOAD_CONST_INLINE_BORROW:
577+
last->opcode=_POP_TOP;
578+
break;
575579
case_POP_TWO_LOAD_CONST_INLINE_BORROW:
576580
last->opcode=_POP_TOP;
577581
break;
@@ -605,8 +609,12 @@ remove_unneeded_uops(_PyUOpInstruction *buffer, int buffer_size)
605609
opcode=buffer[pc].opcode=_POP_TOP_LOAD_CONST_INLINE_BORROW;
606610
gotooptimize_pop_top_again;
607611
}
612+
elseif (opcode==_POP_CALL_LOAD_CONST_INLINE_BORROW) {
613+
opcode=buffer[pc].opcode=_POP_TOP_LOAD_CONST_INLINE_BORROW;
614+
gotooptimize_pop_top_again;
615+
}
608616
elseif (opcode==_POP_CALL_ONE_LOAD_CONST_INLINE_BORROW) {
609-
opcode=buffer[pc].opcode=_POP_TWO_LOAD_CONST_INLINE_BORROW;
617+
opcode=buffer[pc].opcode=_POP_CALL_LOAD_CONST_INLINE_BORROW;
610618
gotooptimize_pop_top_again;
611619
}
612620
else {

‎Python/optimizer_bytecodes.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,10 @@ dummy_func(void) {
550550
value=sym_new_const(ctx,ptr);
551551
}
552552

553+
op(_POP_CALL_LOAD_CONST_INLINE_BORROW, (ptr/4,unused,unused--value)) {
554+
value=sym_new_const(ctx,ptr);
555+
}
556+
553557
op(_POP_CALL_ONE_LOAD_CONST_INLINE_BORROW, (ptr/4,unused,unused,unused--value)) {
554558
value=sym_new_const(ctx,ptr);
555559
}

‎Python/optimizer_cases.c.h

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp