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

Class Stencil

Tools/jit/_stencils.py:201–218  ·  view source on GitHub ↗

A contiguous block of machine code or data to be copied-and-patched. Analogous to a section or segment in an object file.

Source from the content-addressed store, hash-verified

199
200@dataclasses.dataclass
201class Stencil:
202 """
203 A contiguous block of machine code or data to be copied-and-patched.
204
205 Analogous to a section or segment in an object file.
206 """
207
208 body: bytearray = dataclasses.field(default_factory=bytearray, init=False)
209 holes: list[Hole] = dataclasses.field(default_factory=list, init=False)
210 disassembly: list[str] = dataclasses.field(default_factory=list, init=False)
211
212 def pad(self, alignment: int) -> None:
213 """Pad the stencil to the given alignment."""
214 offset = len(self.body)
215 padding = -offset % alignment
216 if padding:
217 self.disassembly.append(f"{offset:x}: {' '.join(['00'] * padding)}")
218 self.body.extend([0] * padding)
219
220
221@dataclasses.dataclass

Callers

nothing calls this directly

Calls 1

fieldMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…