Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [omr-dev] ResolvedMethod question

On 14 June 2018 at 18:43, Mark Stoodley <mstoodle@xxxxxxxxxx> wrote:
>
> Note that a MethodBuilder object can live longer than a compilation (it's the thing being compiled,
> after all).

But if ResolvedMethods are cached in MethodBuilder - how are
externally defined functions resolved? Sorry I am being lazy here
because I can figure this out by checking the code.

>
> I would actually prefer that TR::ResolvedMethods be confined to a compilation rather than being
> "cached" in the MethodBuilder object. It would *probably* be better if function name lookup worked
> exclusively on demand using the RequestFunction callback which is only called during a compilation.
>

My mental model is based around what happens in LLVM. The way I am
modelling this is that:

1) You register a function with the JIT context - either when you JIT
compile a function or an external function.
2) The JIT context provides an API to query a function by name - you
get back the ResolvedMethod when you query.
3) The JIT context is a shared context (but not global) so that all
compilations in a given context can access the registered methods.
4) Therefore I don't cache ResolvedMethods at the MethodBuilder
(actually I am using ILInjector) level.


> But callbacks aren't popular with everyone, I'm discovering :) .

Well, no callbacks needed above! I don't understand why a
RequestFunction is a callback. Who is calling whom?

Regards
Dibyendu


Back to the top