-
Notifications
You must be signed in to change notification settings - Fork 21
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
Argument-free ABI-agnostic wrappers #55
Comments
This idea is also probably of interest to @daboehme |
I don't know how one can actually ignore arguments. We don't actually ignore arguments; we simply pass them along uninterpreted. Specifically, with some of our MPI wrappers, we use type "long" for arguments without any regard for what the actual type is. We receive them as "long" in a register and pass them along to the underlying call without trying to interpret them. This works with MPI communicators represented as integers as well as those represented by pointers. |
You could use the same long/pointer same-size tricks to pass through arguments without interpreting them in current gotcha. It's playing a little loose with ABI safety, but would likely work well on at least x86_64 and most MPIs. The idea here was that we could create a safer arbitrary function wrappings using trampolines. They would likely have signatures like "void pre_call(char *funcname, void *target_fptr)" and "void post_call(char *funcname, void *target_fptr)". Rather than have the wrappers call the target and copy args, like in normal gotcha, the pre_call returns and lets gotcha recreate the original call and function arguments. There's still details to be worked out--implementing the post_call would involve replacing the return address used by the target, which would break exception handlers and stack unwinders like yours (unless we side-channel communicate the correct info to you). But I think you could implement a wrap-any-MPI-implementation with this. |
I see. I didn't realize that you intended to have pre_call and post_call callbacks rather than entering a wrapping function. |
Many tools want to do simple wrappers which don't care about the arguments of the functions being wrapped. Caring about arguments is a source of ABI problems. Gotcha should support as a configuration option the creation of such wrappers rather than the current argument-requiring ones. A common use case would be MPI wrappers.
Issue originally reported by @jmellorcrummey , who can feel free to tell me if we got anything wrong from those requirements, or if there's anything else we'd need to support
The text was updated successfully, but these errors were encountered: