mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-136183: Deal with escapes in JIT optimizer's constant evaluator (GH-136184)
Some checks failed
Tests / Docs (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Undefined behavior sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
JIT / Interpreter (Debug) (push) Has been cancelled
JIT / x86_64-apple-darwin/clang (Release) (push) Has been cancelled
JIT / x86_64-unknown-linux-gnu/gcc (Release) (push) Has been cancelled
JIT / x86_64-apple-darwin/clang (Debug) (push) Has been cancelled
JIT / x86_64-unknown-linux-gnu/gcc (Debug) (push) Has been cancelled
JIT / aarch64-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / aarch64-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
JIT / i686-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / i686-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
JIT / aarch64-apple-darwin/clang (Release) (push) Has been cancelled
JIT / aarch64-unknown-linux-gnu/gcc (Release) (push) Has been cancelled
JIT / aarch64-apple-darwin/clang (Debug) (push) Has been cancelled
JIT / aarch64-unknown-linux-gnu/gcc (Debug) (push) Has been cancelled
JIT / x86_64-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / x86_64-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
Some checks failed
Tests / Docs (push) Blocked by required conditions
Tests / Address sanitizer (push) Blocked by required conditions
Tests / (push) Blocked by required conditions
Tests / Undefined behavior sanitizer (push) Blocked by required conditions
Tests / Cross build Linux (push) Blocked by required conditions
Tests / Windows MSI (push) Blocked by required conditions
Tests / Ubuntu SSL tests with OpenSSL (push) Blocked by required conditions
Tests / WASI (push) Blocked by required conditions
Tests / Hypothesis tests on Ubuntu (push) Blocked by required conditions
Tests / Change detection (push) Waiting to run
Tests / Check if Autoconf files are up to date (push) Blocked by required conditions
Tests / Check if generated files are up to date (push) Blocked by required conditions
Tests / CIFuzz (push) Blocked by required conditions
Tests / All required checks pass (push) Blocked by required conditions
Lint / lint (push) Waiting to run
mypy / Run mypy on Lib/_pyrepl (push) Waiting to run
mypy / Run mypy on Lib/test/libregrtest (push) Waiting to run
mypy / Run mypy on Lib/tomllib (push) Waiting to run
mypy / Run mypy on Tools/build (push) Waiting to run
mypy / Run mypy on Tools/cases_generator (push) Waiting to run
mypy / Run mypy on Tools/clinic (push) Waiting to run
mypy / Run mypy on Tools/jit (push) Waiting to run
mypy / Run mypy on Tools/peg_generator (push) Waiting to run
JIT / Interpreter (Debug) (push) Has been cancelled
JIT / x86_64-apple-darwin/clang (Release) (push) Has been cancelled
JIT / x86_64-unknown-linux-gnu/gcc (Release) (push) Has been cancelled
JIT / x86_64-apple-darwin/clang (Debug) (push) Has been cancelled
JIT / x86_64-unknown-linux-gnu/gcc (Debug) (push) Has been cancelled
JIT / aarch64-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / aarch64-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
JIT / i686-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / i686-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
JIT / aarch64-apple-darwin/clang (Release) (push) Has been cancelled
JIT / aarch64-unknown-linux-gnu/gcc (Release) (push) Has been cancelled
JIT / aarch64-apple-darwin/clang (Debug) (push) Has been cancelled
JIT / aarch64-unknown-linux-gnu/gcc (Debug) (push) Has been cancelled
JIT / x86_64-pc-windows-msvc/msvc (Release) (push) Has been cancelled
JIT / x86_64-pc-windows-msvc/msvc (Debug) (push) Has been cancelled
This commit is contained in:
parent
f41e9c750e
commit
b3308973e3
6 changed files with 77 additions and 7 deletions
|
@ -106,8 +106,9 @@ class Emitter:
|
|||
out: CWriter
|
||||
labels: dict[str, Label]
|
||||
_replacers: dict[str, ReplacementFunctionType]
|
||||
cannot_escape: bool
|
||||
|
||||
def __init__(self, out: CWriter, labels: dict[str, Label]):
|
||||
def __init__(self, out: CWriter, labels: dict[str, Label], cannot_escape: bool = False):
|
||||
self._replacers = {
|
||||
"EXIT_IF": self.exit_if,
|
||||
"DEOPT_IF": self.deopt_if,
|
||||
|
@ -127,6 +128,7 @@ class Emitter:
|
|||
}
|
||||
self.out = out
|
||||
self.labels = labels
|
||||
self.cannot_escape = cannot_escape
|
||||
|
||||
def dispatch(
|
||||
self,
|
||||
|
@ -238,7 +240,8 @@ class Emitter:
|
|||
next(tkn_iter)
|
||||
self._print_storage("DECREF_INPUTS", storage)
|
||||
try:
|
||||
storage.close_inputs(self.out)
|
||||
if not self.cannot_escape:
|
||||
storage.close_inputs(self.out)
|
||||
except StackError as ex:
|
||||
raise analysis_error(ex.args[0], tkn)
|
||||
except Exception as ex:
|
||||
|
@ -476,7 +479,7 @@ class Emitter:
|
|||
reachable = True
|
||||
tkn = stmt.contents[-1]
|
||||
try:
|
||||
if stmt in uop.properties.escaping_calls:
|
||||
if stmt in uop.properties.escaping_calls and not self.cannot_escape:
|
||||
escape = uop.properties.escaping_calls[stmt]
|
||||
if escape.kills is not None:
|
||||
self.stackref_kill(escape.kills, storage, True)
|
||||
|
@ -513,7 +516,7 @@ class Emitter:
|
|||
self.out.emit(tkn)
|
||||
else:
|
||||
self.out.emit(tkn)
|
||||
if stmt in uop.properties.escaping_calls:
|
||||
if stmt in uop.properties.escaping_calls and not self.cannot_escape:
|
||||
self.emit_reload(storage)
|
||||
return reachable, None, storage
|
||||
except StackError as ex:
|
||||
|
|
|
@ -245,6 +245,7 @@ class OptimizerConstantEmitter(OptimizerEmitter):
|
|||
outp.name: self.emit_stackref_override for outp in self.original_uop.stack.outputs
|
||||
}
|
||||
self._replacers = {**self._replacers, **overrides}
|
||||
self.cannot_escape = True
|
||||
|
||||
def emit_to_with_replacement(
|
||||
self,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue