FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-144540: Eliminate `_MAKE_HEAP_FUNCTION` for owned references by Sacul0457 · Pull Request #146320 · python/cpython · GitHub

/ cpython Public
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .c  (1) .h  (1) .py  (1) All 3 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 2 additions & 2 deletions Lib/test/test_capi/test_opt.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,7 @@ def testfunc(n):
self.assertNotIn("_MAKE_HEAP_SAFE", uops)
self.assertIn("_YIELD_VALUE", uops)

def test_make_heap_safe_not_optimized_for_owned(self):
def test_make_heap_safe_optimized_owned(self):
def returns_owned(x):
return x + 1
def testfunc(n):
Expand All @@ -1364,7 +1364,7 @@ def testfunc(n):
self.assertEqual(res, TIER2_THRESHOLD)
self.assertIsNotNone(ex)
uops = get_opnames(ex)
self.assertIn("_MAKE_HEAP_SAFE", uops)
self.assertNotIn("_MAKE_HEAP_SAFE", uops)
self.assertIn("_RETURN_VALUE", uops)

def test_for_iter(self):
Expand Down
2 changes: 1 addition & 1 deletion Python/optimizer_bytecodes.c
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ dummy_func(void) {

op(_MAKE_HEAP_SAFE, (value -- value)) {
// eliminate _MAKE_HEAP_SAFE when we *know* the value is immortal
if (sym_is_immortal(PyJitRef_Unwrap(value))) {
if (sym_is_immortal(PyJitRef_Unwrap(value)) || !PyJitRef_IsBorrowed(value)) {
ADD_OP(_NOP, 0, 0);
}
value = PyJitRef_StripBorrowInfo(value);
Expand Down
2 changes: 1 addition & 1 deletion Python/optimizer_cases.c.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

Back | FazBrowse Home | New Git URL