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 15:32, Irwin D'Souza <dsouzai@xxxxxxxxxx> wrote:
>>Okay. I am not 100% sure of the lifetime of a ResolvedMethod. I see
>>that in JitBuilder the ResolvedMethod instances are put into a map -
>>presumably these are tied to the lifetime of the Code Cache?
>
> I assume you're referring to
>
> typedef TR::typed_allocator<std::pair<const char * const, TR::ResolvedMethod
> *>, TR::Region &> FunctionMapAllocator;
> typedef std::map<const char *, TR::ResolvedMethod *, StrComparator,
> FunctionMapAllocator> FunctionMap;
> FunctionMap _functions;
>

Yes I was.

> in which case, the TR::ResolvedMethod is allocated using
> trMemory()->heapMemoryRegion()
>
> TR::ResolvedMethod *method = new (trMemory()->heapMemoryRegion())
> TR::ResolvedMethod(
> (char*)fileName,
> (char*)lineNumber,
> (char*)name,
> numParms,
> parmTypes,
> returnType,
> entryPoint,
> 0);
>
> where
> trMemory()
> returns a pointr to a member of
> MemoryManager memoryManager
>
> which gets destroyed when the MethodBuilder object is destroyed. So, the
> lifetime of a ResolvedMethod, AFAICT, is within the scope of the compile.
>

Right. I saw Mark's subsequent email so will reply to that - but this
is very helpful. Thank you.

Regards
Dibyendu


Back to the top