Repository navigation
Conversation
519ff85 to
e5d84e0
Compare
e5d84e0 to
d8ed699
Compare
|
just gave this PR a try. A few things: The first error I come across is not related to the JNITrampoline (which appears you've already fixed): While the latest commit on We need to be annotating the direct calls from |
|
Yes, I am currently looking into the patching stuff. This is clearly not right at the moment and is programmed towards AMD64. Patching addresses on AArch64 is different. For the calls we have two different kinds of instructions to be patched. Either we load an offset into a register or an 22bit immediate. AArch64Call.java:218. My intention would be to toss the separation of Edit: It isn't that simple. It all works together with the OS Loader/ELF format. I need to get my head around how this all works. This document describes how the AArch64 ELF format looks like. Especially the relocation types are interesting for patching. (Section 4.6.3 and group relocations 4.6.8) |
|
That makes sense. I've noticed if we don't I'll try to work up a PR against your branch/PR to maybe bring those in. |
|
I just updated the PR with my intermediate status where I started to consolidate the I am leaving for the day. |
|
Beyond the patching, got any pointers of bits'n'bobs I could take a look at? Both with and without |
|
How to proceed is a good question. Right now I am trying to refactor the patching code for AMD64. This will be a different PR which could be integrated into master independent of the AArch64. However, without this change, we can hardly continue with AArch64. I'll open a second PR later today, which contains my current work status. |
|
@bobmcwhirter I have pushed a second branch which is based on latest master. It begins with refactoring of The idea is that we encapsulate the relocation generating code into platform specific classes such as If you have some time you can look at it and try to move the code from |
|
Perfect, I'll look at that. I was thinking a base abstract |
|
I had to shuffle some bits'n'bobs around to accomodate both the I've dump it on the (shared) repo, same branch: Current bit that doesn't even compile is in |
|
Nice work, let me continue with this. |
|
@sanzinger Morning! (I'm US-Eastern). How's that progressing? If you agree (and accept the github invite) to collaborate on the projectodd/graal.git repo, once you push your latest, I'll try to create an omnibus branch with this work, the other aarch64 PR and the compressed-pointer PR to give us a stable cohesive/conglomerate branch to work against. Once we have all of our work smooshed together, I may try to rebase (and keep it rebased) upon Once we're happy, then we can maybe PR the entire thing back to oracle/graal.git in one fell swoop? |
|
Good Moring (CET), I am currently progressing and testing the refactoring of the relocation stuff on AMD64. I hope I can finish this today. I'll try to share the current status of the AMD64 refactoring with you later today. Then you can setup the branch and do the rebasing stuff. But as I am writing we get some refactoring in the |
|
If you don't mind, I would like to squash the changes you provided yesterday with my changes into one commit. |
|
Yep that’s fine. |
|
@bobmcwhirter I have pushed the latest changes for AMD64 relocation patching to my repo. I have commented out the code in You may rebase the changes from this PR onto this branch. Then we should be able to continue with the AArch64 relocations. FYI, I forgot to mention about the dependency problems: There are changes in the |
|
Cool, thanks. |
|
Latest update: That's your I've involved aarch64 patching annotations and consumers, but I'm clearly not annotating enough things, and the currently Considering we wrap the various So I hand the baton back over to you for CET morning. |
|
Thank you for your update. I haven't had time today to look at it. I am currently working to get |
|
FYI, I have pushed my current version which fixes |
|
Thanks for the update. I'm still working on the tip of the merged/rebased branch at projectodd. Making progress patching calls for aarch64, and now looking at patching immediate constants in LIRNativeImageCodeCache via the aarch64 annotations. Hopefully further work tomorrow. |
|
No code to push today but on my (not yet pushed) branch I've been working on:
There's a lot of architecture assumptions in the Relatedly, I will try to work on this to someday support cross-compilation in the future, selecting the ELF format that's being targeted, not necessarily the host (defaulting to host, of course, if not crossing) |
20c181e to
f8d1aea
Compare
|
I think we're happy to have a review/merge now on this. |
|
f8d1aea to
d0a2374
Compare
* cpuid.c no-op for non-AMD64 machine (via sanzinger; cherry-picked) * ELFMachine expansion for AArch64 type and elf_machine magic. * Provides direct relocation types for AArch64. * Allows ELFMachine selection based on os.arch system property * (unused) provides for ELFMachine to be specified in the ELFObjectFile constructor anticipating a future cross-compilation support, instead of determining the type based upon the host architecture. * Mostly transliterating the Hotspot variant of compressed-pointers. * Improve HotSpotDisassemblerProvider to use objdump to disassemble compiled code. * Introduce patching annotations for SVM/AArch64. * Implement toString for CGlobalDataInfo * Implement first ELF relocation on aarch64. * Enable memory management debug logging. * Add another relocation for AArch64CGlobalDataLoadAddressOp. * Sign extend compressed pointers. * SVM CE uses QWORD for narrow oops. * Fix nullpointer comparison for isolates in SVM. * Fix base pointer comparison for SVM on AArch64 Isolates. * SVM/AArch64: Fix issues found with -ea -esa * AArch64: Compare compressed null pointer against 0 * AArch64: Exclude r8 and r9 from register allocation in SVM * Remove unnecessary opcode annotation from AArch64DecrementingSafepointCheckOp * Bring back the Darwin register-dumper for SegfaultHandler usage. Co-authored-by: Stefan Anzinger <[email protected]>
d0a2374 to
9d78bfa
Compare
|
Hello Stefan Anzinger, thanks for contributing a PR to our project! We use the Oracle Contributor Agreement to make the copyright of contributions clear. We don't have a record of you having signed this yet, based on your email address sanzinger -(at)- users -(dot)- noreply -(dot)- github -(dot)- com. You can sign it at that link. If you think you've already signed it, please comment below and we'll check. |
There was a problem hiding this comment.
I still don't like this complex if cascade with eventual fallthrough. There must be something more clear structure. I changed it in a rush to get some progress.
There was a problem hiding this comment.
We may start the process later, right before while( ... br.readline())
There was a problem hiding this comment.
I just removed this assertion because it was causing issues with the null values. We should think of a refined version.
There was a problem hiding this comment.
We should inline this code and doublecheck whether the nonNull || baseReg == null matches up with CompressPointerOp
There was a problem hiding this comment.
We must reenable this math plugins. They had some problems with SVM and I disabled them for the time being.
There was a problem hiding this comment.
So, looking at implementing AArch64MathPowOp by emitting libm#pow and I immediately run into an issue:
000000000000c2c0 <pow10l@GLIBC_2.17>:
c2c0: 9e660000 fmov x0, d0
c2c4: 9eae0001 fmov x1, v0.d[1]
Our assembler does not seem to have a way to represent v0.d[1] which should take the top 64-bits from the 128-bit v0 SIMD register.
I could certainly figure out how to augment the assembler, but it I suspect I simply don't know what I'm doing. If @theRealAph or @adinn or someone can confirm that the AArch64Assembler lacks this specific variant of of fmov, I'd be glad to truck along and give it a go.
Additionally, is it even correct to assume we need to transcode the libm.so implementation? It seems to be what the AMD64 variant of MathPowOp is doing.
There was a problem hiding this comment.
Likewise, log10:
cc30: 6f00e401 movi v1.2d, #0x0
I dunno if we support the v1.2d style register. I think that's all 128 bits of the v1 register? Any reason we wouldn't just call it `v1' though?
There was a problem hiding this comment.
Yes, you should call it v1. But I don't quite understand what you are trying to do here. It makes sense for the time being to call the routine in libm, because we are at present working on a custom AArch64 implementation of Math.pow() in HotSpot. When that's done you can import it.
There was a problem hiding this comment.
Remove unused code and throw an VMError.shouldNotReachHere
There was a problem hiding this comment.
Remove this import
There was a problem hiding this comment.
Remove this debug code
There was a problem hiding this comment.
We need to rethink this assertion on AArch64 or just disable it on AArch64.
There was a problem hiding this comment.
We have to double check on which side we are doing wrong and either fix the generating code or this assertion.
There was a problem hiding this comment.
Our relocations aren’t byte-aligned sizes so it’s not valid for aarch64
|
For clarity— are you in flight with any of these or should I try to tick them off today? Don’t want to work at cross purposes. |
|
That also makes sense and I was wondering...
AMD64MathPowOp seems to generate inline ASM for pow() so that seemed like
precedent.
If we can just use libm that seems terrible easier.
…On Fri, Mar 15, 2019 at 5:32 AM Andrew Haley ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In
compiler/src/org.graalvm.compiler.replacements.aarch64/src/org/graalvm/compiler/replacements/aarch64/AArch64GraphBuilderPlugins.java
<#910 (comment)>:
> - b.push(JavaKind.Double, b.append(UnaryMathIntrinsicNode.create(value, operation)));
- return true;
- }
- });
- }
-
- private static void registerRound(Registration r, String name, RoundingMode mode) {
- r.register1(name, Double.TYPE, new InvocationPlugin() {
- @OverRide
- public boolean apply(GraphBuilderContext b, ResolvedJavaMethod targetMethod, Receiver receiver, ValueNode arg) {
- b.push(JavaKind.Double, b.append(new AArch64RoundNode(arg, mode)));
- return true;
- }
- });
- }
+ /*
Yes, you should call it v1. But I don't quite understand what you are
trying to do here. It makes sense for the time being to call the routine in
libm, because we are at present working on a custom AArch64 implementation
of Math.pow() in HotSpot. When that's done you can import it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#910 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAA-Ty_3yH3DSR18j6GmYFfMcTEKYAPgks5vW2jJgaJpZM4Z9zJ8>
.
|
|
Still working on stuff, but wanted a sanity-check. I have a testcase that tries to The The But the ELF relocation for 19 or 21 bits isn't sufficient to address an address as far away as the So, I've tentatively changed to a mov/movk sequence, which can be relocated with the
|
|
AArch64Move works fine in HotSpot, and in AOT-compiled code for HotSpot because there is a local constant pool. This is a standard assumption in Arm code: that it's always possible to load data from some read-only data section nearby. |
|
Okay. Oddly ld complains of truncation to the rodata during native image
creation.
…On Wed, Mar 20, 2019 at 4:21 PM Andrew Haley ***@***.***> wrote:
AArch64Move works fine in HotSpot, and in AOT-compiled code for HotSpot
because there is a local constant pool. This is a standard assumption in
Arm code: that it's always possible to load data from some read-only data
section nearby.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#910 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAA-T0fCcH7SkVc3q913h3YP59WAx-PQks5vYpgvgaJpZM4Z9zJ8>
.
|
Oh, sure. Don't get me wrong, this has to be fixed, and your fix sounds OK. Using adrp/ld would be a bit more efficient, but it's probably not important. |
* MSR and MRS instructions should we need them for Math.pow in the future. * Improve relocations to actually work. * Alter AArch64Move to emit doubles in a relocatable fashion.
|
Well, heck, that worked. Just added another commit that does:
|
|
I am now working over this PR and want to get it to a state where we can merge it for now. So we get then smaller incremental updates. |
|
Right on. I fixed quite a few of the comments until I got distracted by Math and the doubles and then relocations. I’m traveling next 2 weeks so it’s all yours now. |
|
Very good. I am planning to get it in by end of today. Wish you a nice holiday. 🍹 |
|
So I am going to squash the changes and mention you contributor, is that good for you? |
|
Perfectly fine. |
|
GH officially supports the co-authored-by syntax I used in the first squash. |
|
|
||
| void annotatePatchingImmediate(int pos, int operandSizeBits, int offsetBits, int shift) { | ||
| public void msr(SystemRegister systemRegister, Register src) { | ||
| emitInt(MRS.encoding | systemRegister.encoding() | rt(src)); |
There was a problem hiding this comment.
Ahhh, while not currently used, this MRS should be MSR prior to pushing,
|
Merged |
Current status:
The state of this PR is in progress. Native-image command cannot produce any working binary for now.
Testing
For testing I use the simple hello world example from substrate/README.md quickstart:
The command
mx native-image HelloWorldfails currently with following error: