(uop: Uop, emitter: Tier2Emitter, stack: Stack, cached_items: int = 0)
| 208 | |
| 209 | |
| 210 | def write_uop(uop: Uop, emitter: Tier2Emitter, stack: Stack, cached_items: int = 0) -> tuple[bool, Stack]: |
| 211 | locals: dict[str, Local] = {} |
| 212 | zero_regs = is_large(uop) or uop.properties.escapes |
| 213 | try: |
| 214 | emitter.out.start_line() |
| 215 | if uop.properties.oparg: |
| 216 | emitter.emit("oparg = CURRENT_OPARG();\n") |
| 217 | assert uop.properties.const_oparg < 0 |
| 218 | elif uop.properties.const_oparg >= 0: |
| 219 | emitter.emit(f"oparg = {uop.properties.const_oparg};\n") |
| 220 | emitter.emit(f"assert(oparg == CURRENT_OPARG());\n") |
| 221 | storage = Storage.for_uop(stack, uop, emitter.out) |
| 222 | idx = 0 |
| 223 | for cache in uop.caches: |
| 224 | if cache.name != "unused": |
| 225 | bits = cache.size*16 |
| 226 | if cache.size == 4: |
| 227 | type = cast = "PyObject *" |
| 228 | else: |
| 229 | type = f"uint{bits}_t " |
| 230 | cast = f"uint{bits}_t" |
| 231 | emitter.emit(f"{type}{cache.name} = ({cast})CURRENT_OPERAND{idx}_{bits}();\n") |
| 232 | idx += 1 |
| 233 | reachable, storage = emitter.emit_tokens(uop, storage, None, False) |
| 234 | if reachable: |
| 235 | storage.stack._print(emitter.out) |
| 236 | emitter.cache_items(storage.stack, cached_items, zero_regs) |
| 237 | storage.flush(emitter.out) |
| 238 | return reachable, storage.stack |
| 239 | except StackError as ex: |
| 240 | raise analysis_error(ex.args[0], uop.body.open) from None |
| 241 | |
| 242 | SKIPS = ("_EXTENDED_ARG",) |
| 243 |
no test coverage detected
searching dependent graphs…