Skip to content

[Feature] - Update to remove use of SafeHandle #318

@smaillet

Description

@smaillet

Is your feature request related to a problem? Please describe.
SafeHandle has a number of issues with respect to marshalling. In particular an array of handles from LLVM is NOT marshalable as a simple span. Instead, the wrapped handle must be extracted for each element as an nint and then placed into an array before it can be marshalled. Thus, calling any native API that accepts an array of references for perf is defeated as there's a LOT of marshaling overhead required.

Describe the solution you'd like
A representation of references that allows for zero copy marshaling of arrays.

Describe alternatives you've considered
Obviously leaving it as-is is plausible but not ideal for performance

Additional context
SafeHandles are a bit of an overkill for these as they only refer to things allocated and owned by the native layer. All of which go away as soon as the process exits. They don't really fall into the category of externally held resources that SafeHandles were intended to solve.

Metadata

Metadata

Assignees

No one assigned

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions