MCPcopy Index your code
hub / github.com/python/cpython / deopt_if

Method deopt_if

Tools/cases_generator/generators_common.py:169–192  ·  view source on GitHub ↗
(
        self,
        tkn: Token,
        tkn_iter: TokenIterator,
        uop: CodeSection,
        storage: Storage,
        inst: Instruction | None,
    )

Source from the content-addressed store, hash-verified

167 return False
168
169 def deopt_if(
170 self,
171 tkn: Token,
172 tkn_iter: TokenIterator,
173 uop: CodeSection,
174 storage: Storage,
175 inst: Instruction | None,
176 ) -> bool:
177 self.out.start_line()
178 self.out.emit("if (")
179 lparen = next(tkn_iter)
180 assert lparen.kind == "LPAREN"
181 first_tkn = tkn_iter.peek()
182 emit_to(self.out, tkn_iter, "RPAREN")
183 self.emit(") {\n")
184 next(tkn_iter) # Semi colon
185 assert inst is not None
186 assert inst.family is not None
187 family_name = inst.family.name
188 self.emit(f"UPDATE_MISS_STATS({family_name});\n")
189 self.emit(f"assert(_PyOpcode_Deopt[opcode] == ({family_name}));\n")
190 self.emit(f"JUMP_TO_PREDICTED({self.jump_prefix}{family_name});\n")
191 self.emit("}\n")
192 return not always_true(first_tkn)
193
194 exit_if = deopt_if
195

Callers

nothing calls this directly

Calls 5

emitMethod · 0.95
emit_toFunction · 0.85
always_trueFunction · 0.85
start_lineMethod · 0.80
peekMethod · 0.45

Tested by

no test coverage detected