public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andres Freund <[email protected]>
To: Thomas Munro <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: LLVM 16 (opaque pointers)
Date: Fri, 11 Aug 2023 11:09:37 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CA+hUKGKNX_=f+1C4r06WETKTq0G4Z_7q4L4Fxn5WWpMycDj9Fw@mail.gmail.com>
References: <CA+hUKGKNX_=f+1C4r06WETKTq0G4Z_7q4L4Fxn5WWpMycDj9Fw@mail.gmail.com>

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






view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: LLVM 16 (opaque pointers)
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox