Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: ability to specify method table in methodinstance #532

Open
MasonProtter opened this issue Nov 11, 2023 · 1 comment
Open

Comments

@MasonProtter
Copy link

It'd be useful if methodinstance could work with any method table, not just the global default one.

The version that takes a worldage is easy, it just needs to become

function methodinstance(ft::Type, tt::Type, world::Integer; methodtable=nothing)
    sig = typed_signature(ft, tt)

    match, _ = CC._findsup(sig, methodtable, world)
    match === nothing && throw(MethodError(ft, tt, world))

    mi = CC.specialize_method(match)

    return mi::MethodInstance
end

but I tried to do it in the generated function version and I couldn't figure out how to get it to work properly without segfaulting, so any hints or help on making that work would be much appreciated.

@maleadt
Copy link
Member

maleadt commented Nov 13, 2023

We're likely to change the methodinstance implementation to re-use jl_lookup_generic, see #530, so a methodtable would need to be added there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants