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

Method cache_items

Tools/cases_generator/tier2_generator.py:192–207  ·  view source on GitHub ↗
(self, stack: Stack, cached_items: int, zero_regs: bool)

Source from the content-addressed store, hash-verified

190 return not always_true(first_tkn)
191
192 def cache_items(self, stack: Stack, cached_items: int, zero_regs: bool) -> None:
193 self.out.start_line()
194 i = cached_items
195 while i > 0:
196 self.out.start_line()
197 item = StackItem(f"_tos_cache{i-1}", "", False, True)
198 stack.pop(item, self.out)
199 i -= 1
200 if zero_regs:
201 # TO DO -- For compilers that support it,
202 # replace this with a "clobber" to tell
203 # the compiler that these values are unused
204 # without having to emit any code.
205 for i in range(cached_items, MAX_CACHED_REGISTER):
206 self.out.emit(f"_tos_cache{i} = PyStackRef_ZERO_BITS;\n")
207 self.emit(f"SET_CURRENT_CACHED_VALUES({cached_items});\n")
208
209
210def write_uop(uop: Uop, emitter: Tier2Emitter, stack: Stack, cached_items: int = 0) -> tuple[bool, Stack]:

Callers 4

exit_ifMethod · 0.95
tier2_to_tier2Method · 0.95
exit_if_afterMethod · 0.95
write_uopFunction · 0.80

Calls 4

StackItemClass · 0.90
start_lineMethod · 0.80
popMethod · 0.45
emitMethod · 0.45

Tested by

no test coverage detected