GH-118910: Less boilerplate in the tier 2 optimizer (#118913)

This commit is contained in:
Mark Shannon 2024-05-10 17:43:23 +01:00 committed by GitHub
parent 941eea0a27
commit f5c6b9977a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 275 additions and 473 deletions

View file

@ -84,14 +84,11 @@ def emit_default(out: CWriter, uop: Uop) -> None:
if var.is_array():
out.emit(f"for (int _i = {var.size}; --_i >= 0;) {{\n")
out.emit(f"{var.name}[_i] = sym_new_not_null(ctx);\n")
out.emit(f"if ({var.name}[_i] == NULL) goto out_of_space;\n")
out.emit("}\n")
elif var.name == "null":
out.emit(f"{var.name} = sym_new_null(ctx);\n")
out.emit(f"if ({var.name} == NULL) goto out_of_space;\n")
else:
out.emit(f"{var.name} = sym_new_not_null(ctx);\n")
out.emit(f"if ({var.name} == NULL) goto out_of_space;\n")
def write_uop(