-
Notifications
You must be signed in to change notification settings - Fork 132
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
Implement local calls in JIT/interpreter. #271
Conversation
c66637c
to
d2637df
Compare
@Alan-Jowett Although I have still labeled it as WIP, I would love your feedback. The JIT and interpreter are now able to handle local function calls. I am sure that there are probably things that I will need to clean up to meet your high standards, but I would really appreciate your input. Thanks for letting me participate! |
This looks like a good approach. You might want to consider adding support for local functions from ELF files? If I recall correctly, LLVM emits relocations for local calls and the ELF loader then needs to stitch re-assemble it into a single contiguous block of byte code. Feel free to punt this and file an issue to track it for later. |
You are, obviously, absolutely correct! I have a WIP for that (which I dropped when I realized that calls themselves were not even implemented). If it's okay, I will put that in a separate issue to track. I will track aarch64 separately, too, if that's okay!? |
@Alan-Jowett Thanks for the feedback! I believe that the latest version is ready for full review! I have a few PRs staged that I will fire off once I finalize your incredibly helpful feedback! Thank you again for everything! |
@Alan-Jowett I think that this updated PR will give us support for both x86_64 and aarch64 interpreted/jit'd calls for local functions. I have tested that all tests pass on aarch64 hardware running Ubuntu 22.04.2 LTS and on x86_64 hardware running Fedora Core 37 (Desktop). I will test on a local m2-based mac mini in a few. As always, it's awesome to work on this tool with you! |
@Alan-Jowett FYI: I have compiled/executed the tests for local calls on macOS and everything appears to work correctly. Sorry for the delay! Will |
@hawkinsw Do you know why the arm64 and macos changes are failing in this PR? |
I do not, unfortunately! When I run the PR on my mac everything passes. I will dig in and see why that test fails! Sorry! |
@hawkinsw The change is looking good. Seems like it's down to a single failure in the MacOS case? You can debug it by running the byte code directly in the ubpf_plugin under a debugger with:
I am curious as to what it is returning. The original C program was:
See: https://github.com/iovisor/ubpf/blob/main/tests/string-stack.data |
21c8867
to
6e62944
Compare
I spent additional time on the failure tonight. I spun up an x86-based macos host on AWS (to see if the problem was down to architecture) and couldn't reproduce the error there either. The only major difference that I saw was that the AppleClang compiler in the github runners is a full version behind the ones that I am using to test. I fail to see how that could possibly be the problem but I can't see anything else, either. I wonder if there is a way to ssh in to a github runner as it is executing and see what is happening. I will do some research and investigate further. Sorry again for the trouble! |
As a follow-up: It looks like debugging may be possible: https://github.com/marketplace/actions/debugging-with-ssh I will look further tomorrow! |
d5b2523
to
788b886
Compare
@Alan-Jowett We did it!! |
Awesome! Thanks for working on this! |
Signed-off-by: Will Hawkins <hawkinsw@obs.cr>
@Alan-Jowett Made a (final?) update that will remove an additional integer operation from the generated code. |
No description provided.