Table of Contents

Method AllocateCodeSection

Namespace
Ubiquity.NET.Llvm.OrcJITv2
Assembly
Ubiquity.NET.Llvm.dll

AllocateCodeSection(nuint, uint, uint, LazyEncodedString)

Allocate a block of contiguous memory for use as code execution by the native code JIT engine

public abstract nuint AllocateCodeSection(nuint size, uint alignment, uint sectionId, LazyEncodedString sectionName)

Parameters

size nuint

Size of the block

alignment uint

alignment requirements of the block

sectionId uint

ID for the section

sectionName LazyEncodedString

Name of the section

Returns

nuint

Address of the first byte of the allocated memory

Remarks

If the memory is allocated from the managed heap then the returned address MUST remain pinned until Dispose() is called on this allocator

important

The Execute only page setting and any other page properties is not applied to the returned address (or entire memory of the allocated section) until FinalizeMemory(out LazyEncodedString?) is called. This allows the JIT to write code into the memory area even if it is ultimately Execute-Only.