GH-128939: Refactor JIT optimize structs (GH-128940)

This commit is contained in:
Mark Shannon 2025-01-20 15:49:15 +00:00 committed by GitHub
parent e1fa2fcc7c
commit f0f7b978be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 816 additions and 527 deletions

View file

@ -36,10 +36,10 @@ def validate_uop(override: Uop, uop: Uop) -> None:
def type_name(var: StackItem) -> str:
if var.is_array():
return f"_Py_UopsSymbol **"
return f"JitOptSymbol **"
if var.type:
return var.type
return f"_Py_UopsSymbol *"
return f"JitOptSymbol *"
def declare_variables(uop: Uop, out: CWriter, skip_inputs: bool) -> None:
@ -151,11 +151,11 @@ def write_uop(
var.defined = False
storage = emitter.emit_tokens(override, storage, None)
out.start_line()
storage.flush(out, cast_type="_Py_UopsSymbol *")
storage.flush(out, cast_type="JitOptSymbol *")
else:
emit_default(out, uop, stack)
out.start_line()
stack.flush(out, cast_type="_Py_UopsSymbol *")
stack.flush(out, cast_type="JitOptSymbol *")
except StackError as ex:
raise analysis_error(ex.args[0], prototype.body[0]) # from None