From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: LLVM 16 (opaque pointers) |
Date: | 2023-08-11 18:09:37 |
Message-ID: | 20230811180937.brhee3wgbwcmpkvh@awork3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2023-05-21 15:01:41 +1200, Thomas Munro wrote:
> *For anyone working with this type of IR generation code and
> questioning their sanity, I can pass on some excellent advice I got
> from Andres: build LLVM yourself with assertions enabled, as they
> catch some classes of silly mistake that otherwise just segfault
> inscrutably on execution.
Hm. I think we need a buildfarm animal with an assertion enabled llvm 16 once
we merge this. I think after an upgrade my buildfarm machine has the necessary
resources.
> @@ -150,7 +150,7 @@ llvm_compile_expr(ExprState *state)
>
> /* create function */
> eval_fn = LLVMAddFunction(mod, funcname,
> - llvm_pg_var_func_type("TypeExprStateEvalFunc"));
> + llvm_pg_var_func_type("ExecInterpExprStillValid"));
Hm, that's a bit ugly. But ...
> @@ -77,9 +80,44 @@ extern Datum AttributeTemplate(PG_FUNCTION_ARGS);
> Datum
> AttributeTemplate(PG_FUNCTION_ARGS)
> {
> + PGFunction fp PG_USED_FOR_ASSERTS_ONLY;
> +
> + fp = &AttributeTemplate;
> PG_RETURN_NULL();
> }
Other parts of the file do this by putting the functions into
referenced_functions[], i'd copy that here and below.
> +void
> +ExecEvalSubroutineTemplate(ExprState *state,
> + struct ExprEvalStep *op,
> + ExprContext *econtext)
> +{
> + ExecEvalSubroutine fp PG_USED_FOR_ASSERTS_ONLY;
> +
> + fp = &ExecEvalSubroutineTemplate;
> +}
> +
> +extern bool ExecEvalBoolSubroutineTemplate(ExprState *state,
> + struct ExprEvalStep *op,
> + ExprContext *econtext);
> +bool
> +ExecEvalBoolSubroutineTemplate(ExprState *state,
> + struct ExprEvalStep *op,
> + ExprContext *econtext)
> +{
> + ExecEvalBoolSubroutine fp PG_USED_FOR_ASSERTS_ONLY;
> +
> + fp = &ExecEvalBoolSubroutineTemplate;
> + return false;
> +}
> +
Thanks for working on this!
Greetings,
Andres Freund
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2023-08-11 18:13:40 | Re: [PATCH] Support static linking against LLVM |
Previous Message | Bruce Momjian | 2023-08-11 18:08:39 | Re: [PoC] pg_upgrade: allow to upgrade publisher node |