Skip to content

SubstrateVM on AArch64 - #910

Closed
sanzinger wants to merge 3 commits into
oracle:masterfrom
sanzinger:svm/aarch64
Closed

sanzinger wants to merge 3 commits into
oracle:masterfrom
sanzinger:svm/aarch64

Conversation

@sanzinger

@sanzinger sanzinger commented Jan 14, 2019 •

Copy link
Copy Markdown
Contributor

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:

cd substratevm
mx build

echo "public class HelloWorld { public static void main(String[] args) { System.out.println(\"Hello World\"); } }" > HelloWorld.java
$JAVA_HOME/bin/javac HelloWorld.java
mx native-image HelloWorld -H:-SpawnIsolates
./helloworld

The command mx native-image HelloWorld fails currently with following error:

fatal error: com.oracle.svm.core.util.VMError$HostedError: currently only implemented on AMD64
	at com.oracle.svm.core.util.VMError.guarantee(VMError.java:85)
	at com.oracle.svm.jni.hosted.JNICallTrampolineMethod.lambda$createCustomCompileFunction$1(JNICallTrampolineMethod.java:111)
	at com.oracle.svm.hosted.code.CompileQueue.doCompile(CompileQueue.java:883)
	at com.oracle.svm.hosted.code.CompileQueue$CompileTask.run(CompileQueue.java:259)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:174)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)

@bobmcwhirter

bobmcwhirter commented Jan 14, 2019 •

Copy link
Copy Markdown

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):

fatal error: java.lang.NullPointerException
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:603)
	at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
	at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:442)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:282)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:400)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:106)
Caused by: java.lang.NullPointerException
	at com.oracle.svm.core.graal.code.InstructionPatcher.findPatchData(InstructionPatcher.java:88)
	at com.oracle.svm.hosted.image.LIRNativeImageCodeCache.patchMethods(LIRNativeImageCodeCache.java:271)
	at com.oracle.svm.hosted.image.NativeBootImage$NativeTextSectionImpl.writeTextSection(NativeBootImage.java:820)
	at com.oracle.svm.hosted.image.NativeBootImage.build(NativeBootImage.java:410)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:916)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:425)
	at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Error: Image building with exit status 1

While the latest commit on InstructionPatcher indicates removing arch-specific code, it clearly still is specific:

https://github.com/sanzinger/graal/blob/svm/aarch64/substratevm/src/com.oracle.svm.core.graal/src/com/oracle/svm/core/graal/code/InstructionPatcher.java#L31

We need to be annotating the direct calls from AArch64Assembler but also need to refactor the patching. Could be additionally trouble-some since it seems the unconditional branching encodes the instruction plus target address within a 4-byte blob, 28 bits of which are the address, possibly breaking any byte-oriented instruction patching.

@sanzinger

sanzinger commented Jan 14, 2019 •

Copy link
Copy Markdown
Contributor Author

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 PatchData and OperandDataAnnotation. Instead we let the annotation object patch the actual code. It only gets an input the eventual position of the code to be able to calculate the concrete offset. The OperandDataAnnotation comes from the assembler, which knows best how to patch the generated code.

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)

@bobmcwhirter

Copy link
Copy Markdown

That makes sense.

I've noticed if we don't SpawnIsolates then we quickly hit compressed-pointer-related things.

I'll try to work up a PR against your branch/PR to maybe bring those in.

@sanzinger

sanzinger commented Jan 14, 2019 •

Copy link
Copy Markdown
Contributor Author

I just updated the PR with my intermediate status where I started to consolidate the PatchData and OperandDataAnnotation. It is incomplete and not compiling. I also add the ELF relocation definitions. Feel free to push on this branch and throw out this latest change.

I am leaving for the day.

@bobmcwhirter

Copy link
Copy Markdown

Beyond the patching, got any pointers of bits'n'bobs I could take a look at? Both with and without SpawnIsolates I now hit the InstructionPatcher stuff, with my compressed-pointers work in the tree.

@sanzinger

Copy link
Copy Markdown
Contributor Author

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.

@sanzinger

sanzinger commented Jan 15, 2019 •

Copy link
Copy Markdown
Contributor Author

@bobmcwhirter I have pushed a second branch which is based on latest master. It begins with refactoring of LIRNativeImageCodeCache.patchMethods.

The idea is that we encapsulate the relocation generating code into platform specific classes such as com.oracle.svm.hosted.amd64.AMD64PatchingAnnotation.

If you have some time you can look at it and try to move the code from LIRNativeImageCodeCache.patchMethods into AMD64PatchingAnnotation. This branch is only for AMD64. But if the AMD64 version is encapsualted, we can continue with AArch64. I'll continue with it tomorrow morning (CET).

@bobmcwhirter

Copy link
Copy Markdown

Perfect, I'll look at that. I was thinking a base abstract PatchingAnnotation would be useful for an applyPatch(...) that previously lived on PatchData.apply(...) might make sense. As you said, the annotation-creation location has the best knowledge for patching.

@bobmcwhirter

Copy link
Copy Markdown

I had to shuffle some bits'n'bobs around to accomodate both the LIRNativeImageCodeCache and the InstalledCodeBuilder code-paths, regarding visibility of InstructionPatcher, PatchingAnnotation and more specifically how RelocatableBuffer is visible to LIR but not InstalledCodeBuilder, etc.

I've dump it on the (shared) repo, same branch:

https://github.com/projectodd/graal/tree/svm_refactor_patching

Current bit that doesn't even compile is in InstalledCodeBuilder where there's SubstrateObjectConstant and friends operating. The code breaks there, plus I've added a TODO FIX ME in the code if you feel like grepping.

@sanzinger

Copy link
Copy Markdown
Contributor Author

Nice work, let me continue with this.

@bobmcwhirter

Copy link
Copy Markdown

@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 master#HEAD to make a future PR less of a headache.

Once we're happy, then we can maybe PR the entire thing back to oracle/graal.git in one fell swoop?

@sanzinger

sanzinger commented Jan 16, 2019 •

Copy link
Copy Markdown
Contributor Author

Good Moring (CET),

I am currently progressing and testing the refactoring of the relocation stuff on AMD64. I hope I can finish this today.
So the plain refactoring of AMD64 should go into the master branch without AArch64 related stuff.
This has the advantage that we keep the AArch64 PR smaller. This avoids unnecessary conflicts when we want to rebase in the future. (Substrate codebase is under heavy development)

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 NativeImageGenerator which must be reflected then ...

@sanzinger

Copy link
Copy Markdown
Contributor Author

If you don't mind, I would like to squash the changes you provided yesterday with my changes into one commit.

@bobmcwhirter

Copy link
Copy Markdown

Yep that’s fine.

@sanzinger

sanzinger commented Jan 16, 2019 •

Copy link
Copy Markdown
Contributor Author

@bobmcwhirter I have pushed the latest changes for AMD64 relocation patching to my repo. I have commented out the code in InstalledCodeBuilder.patchData for now. It is not crucial for continuing with AArch64.

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 suite.py files: Please run mx ideinit to recreate the IDE project files and then reload the projects in the IDE. This makes sure that the code completion and compilation in the IDE works.

@bobmcwhirter

Copy link
Copy Markdown

Cool, thanks.

@bobmcwhirter

Copy link
Copy Markdown

Latest update:

https://github.com/projectodd/graal/tree/aarch64-rebase

That's your aarch64 branch, my compressed-pointer addendum, all stuffed on top of your instruction-patching branch.

I've involved aarch64 patching annotations and consumers, but I'm clearly not annotating enough things, and the currently patch(...) impl is a no-op.

Considering we wrap the various OperandDataAnnotation with a PatchingAnnotation it seems like we don't need patch(...) defined on ODA. I'm not confident enough to just delete that yet though.

So I hand the baton back over to you for CET morning.

@sanzinger

Copy link
Copy Markdown
Contributor Author

Thank you for your update. I haven't had time today to look at it. I am currently working to get InstalledCodeBuilder.patchData working, which is required to get it into the master branch.

@sanzinger

Copy link
Copy Markdown
Contributor Author

FYI, I have pushed my current version which fixes InstalledCodeBuilder.patchData to my repository. Its working partially but there are some tests still failing.

@bobmcwhirter

Copy link
Copy Markdown

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.

@bobmcwhirter

bobmcwhirter commented Jan 18, 2019 •

Copy link
Copy Markdown

No code to push today but on my (not yet pushed) branch I've been working on:

  • LIRNativeImageCodeCache patching (codepaths work, annotations added, but too no-op-ish at the moment)
  • ELFObjectFile, ELFMachine and other friends for ELF-level relocations and magic.

There's a lot of architecture assumptions in the ELF* tree that I'm working through. I plan to try to back these out of the branch into a simpler PR, since they could/should be merged prior to further work on aarch64.

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)

@bobmcwhirter
bobmcwhirter force-pushed the svm/aarch64 branch 2 times, most recently from 20c181e to f8d1aea Compare March 13, 2019 14:21
@bobmcwhirter

Copy link
Copy Markdown

I think we're happy to have a review/merge now on this.

@bobmcwhirter

bobmcwhirter commented Mar 13, 2019 •

Copy link
Copy Markdown
[bob@linux substratevm]$ mx vm --version
WARNING: No platform-specific definition is available for distribution POLYGLOT_NATIVE_API_SUPPORT for your architecture (aarch64)
WARNING: No platform-specific definition is available for distribution SVM_GRAALVM_AGENT_SUPPORT for your architecture (aarch64)
WARNING: No platform-specific definition is available for project com.oracle.svm.native.agent for your architecture (aarch64)
WARNING: No platform-specific definition is available for project com.oracle.svm.native.jvm.posix for your architecture (aarch64)
openjdk 11 2018-09-25
OpenJDK Runtime Environment (build 11+0-adhoc.bob.jdk11)
OpenJDK 64-Bit Server VM (build 11+0-adhoc.bob.jdk11, mixed mode)
[bob@linux substratevm]$ mx native-image -cp ~/test/ Foo
WARNING: No platform-specific definition is available for distribution POLYGLOT_NATIVE_API_SUPPORT for your architecture (aarch64)
WARNING: No platform-specific definition is available for distribution SVM_GRAALVM_AGENT_SUPPORT for your architecture (aarch64)
WARNING: No platform-specific definition is available for project com.oracle.svm.native.agent for your architecture (aarch64)
WARNING: No platform-specific definition is available for project com.oracle.svm.native.jvm.posix for your architecture (aarch64)
[foo:29608]    classlist:   3,942.44 ms
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.oracle.svm.core.jdk.FileTypeDetectorFeature (file:/home/bob/repos/graal/substratevm/mxbuild/dists/jdk9/svm.jar) to field java.nio.file.Files$FileTypeDetectors.installedDetectors
WARNING: Please consider reporting this to the maintainers of com.oracle.svm.core.jdk.FileTypeDetectorFeature
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[foo:29608]        (cap):   2,615.95 ms
[foo:29608]        setup:   6,021.76 ms
Warning: RecomputeFieldValue.FieldOffset automatic substitution failed. The automatic substitution registration was attempted because a call to jdk.internal.misc.Unsafe.objectFieldOffset(Class, String) was detected in the static initializer of jdk.internal.misc.InnocuousThread. Detailed failure reason(s): Could not determine the field where the value produced by the call to jdk.internal.misc.Unsafe.objectFieldOffset(Class, String) for the field offset computation is stored. The call is not directly followed by a field store or by a sign extend node followed directly by a field store.
Warning: RecomputeFieldValue.FieldOffset automatic substitution failed. The automatic substitution registration was attempted because a call to jdk.internal.misc.Unsafe.objectFieldOffset(Class, String) was detected in the static initializer of jdk.internal.misc.InnocuousThread. Detailed failure reason(s): Could not determine the field where the value produced by the call to jdk.internal.misc.Unsafe.objectFieldOffset(Class, String) for the field offset computation is stored. The call is not directly followed by a field store or by a sign extend node followed directly by a field store.
[foo:29608]   (typeflow):  22,850.47 ms
[foo:29608]    (objects):  23,780.50 ms
[foo:29608]   (features):     849.60 ms
[foo:29608]     analysis:  48,364.33 ms
[foo:29608]     universe:   1,092.50 ms
[foo:29608]      (parse):   7,155.00 ms
[foo:29608]     (inline):   4,936.58 ms
[foo:29608]    (compile):  34,700.04 ms
[foo:29608]      compile:  48,916.18 ms
[foo:29608]        image:   3,841.25 ms
[foo:29608]        write:     414.66 ms
[foo:29608]      [total]: 112,951.48 ms
[bob@linux substratevm]$ du -sh foo
9.8M	foo
[bob@linux substratevm]$ time ./foo
Hello World!

real	0m0.004s
user	0m0.004s
sys	0m0.000s
[bob@linux substratevm]$ uname -a
Linux linux.localdomain 4.18.16-300.fc29.aarch64 #1 SMP Sat Oct 20 23:12:22 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux```

* 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]>
@graalvmbot

Copy link
Copy Markdown
Collaborator

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may start the process later, right before while( ... br.readline())

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just removed this assertion because it was causing issues with the null values. We should think of a refined version.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should inline this code and doublecheck whether the nonNull || baseReg == null matches up with CompressPointerOp

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We must reenable this math plugins. They had some problems with SVM and I disabled them for the time being.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused code and throw an VMError.shouldNotReachHere

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this import

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this debug code

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to rethink this assertion on AArch64 or just disable it on AArch64.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to double check on which side we are doing wrong and either fix the generating code or this assertion.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our relocations aren’t byte-aligned sizes so it’s not valid for aarch64

@bobmcwhirter

Copy link
Copy Markdown

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.

@bobmcwhirter

bobmcwhirter commented Mar 15, 2019 via email

Copy link
Copy Markdown

@bobmcwhirter

Copy link
Copy Markdown

Still working on stuff, but wanted a sanity-check.

I have a testcase that tries to Math.pow(2.0,2.1).

The 2.0 can be directly references in-line as an immediate value loaded into a register.

The 2.1 cannot be directly represented as an in-line constant, so instead it seems AArch64Move#const2reg then emits it as a data item ultimately in .rodata with the expectation that i'll get patched up later.

But the ELF relocation for 19 or 21 bits isn't sufficient to address an address as far away as the .rodata section ends up.

So, I've tentatively changed to a mov/movk sequence, which can be relocated with the _G0 through G3 (optionally _NC_ relocations, against a scratchRegister and then loading that into the target register.

AArch64Move seems like it was written with confidence, so I'm wondering if I'm just doing something wrong, or does this seem to be completely off-base?

@theRealAph

Copy link
Copy Markdown
Contributor

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.

@bobmcwhirter

bobmcwhirter commented Mar 20, 2019 via email

Copy link
Copy Markdown

@theRealAph

Copy link
Copy Markdown
Contributor

Okay. Oddly ld complains of truncation to the rodata during native image creation.

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.
@bobmcwhirter

Copy link
Copy Markdown

Well, heck, that worked.

Just added another commit that does:

  • Better relocations got the G0-G3 for mov sequences
  • Renamed the mov-sequence-based annotations/patchers to be a bit more obvious
  • Altered AArch64Move's double handling for the non-inline case.

@sanzinger

Copy link
Copy Markdown
Contributor Author

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.

@bobmcwhirter

Copy link
Copy Markdown

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.

@sanzinger

Copy link
Copy Markdown
Contributor Author

Very good. I am planning to get it in by end of today. Wish you a nice holiday. 🍹

@sanzinger

Copy link
Copy Markdown
Contributor Author

So I am going to squash the changes and mention you contributor, is that good for you?

@bobmcwhirter

Copy link
Copy Markdown

Perfectly fine.

@bobmcwhirter

Copy link
Copy Markdown

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));

@bobmcwhirter bobmcwhirter Mar 22, 2019 •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh, while not currently used, this MRS should be MSR prior to pushing,

@sanzinger

Copy link
Copy Markdown
Contributor Author

Merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants