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

AArch64: Implement PicBuilder.spp #5246

Merged
merged 1 commit into from
May 30, 2019

Conversation

knn-k
Copy link
Contributor

@knn-k knn-k commented Mar 26, 2019

This commit implements some functions in PicBuilder.spp for aarch64,
such as _interpreterUnresolvedStaticGlue and _interpreterVoidStaticGlue.

Signed-off-by: knn-k konno@jp.ibm.com

@knn-k
Copy link
Contributor Author

knn-k commented Apr 1, 2019

This depends on eclipse-omr/omr#3707

@0xdaryl
Copy link
Contributor

0xdaryl commented Apr 8, 2019

Is this a WIP only because it has a dependency on another PR, or are you still making changes to it? If it's ready for me to look at (even as a WIP) please let me know.

@0xdaryl 0xdaryl self-assigned this Apr 8, 2019
@knn-k
Copy link
Contributor Author

knn-k commented Apr 9, 2019

I am working to fill the unimplemented functions such as _interpreterUnresolvedClassGlue.
I can separate the work to a new PR, however, to have the committed code reviewed.

@knn-k knn-k changed the title WIP: AArch64: Implement PicBuilder.spp AArch64: Implement PicBuilder.spp Apr 10, 2019
@knn-k
Copy link
Contributor Author

knn-k commented Apr 10, 2019

I am separating unimplemented functions to a new PR.
This PR is ready for review.

@knn-k
Copy link
Contributor Author

knn-k commented Apr 11, 2019

Kicking the build again with no update in the commit.


// Encoding of CPIndex field in USC snippet (helperOffset: 8 bits, JVMPIEnabled: 1 bit, cpIndex: 23 bits)

.set J9TR_USCSnippet_JVMPIEnabled, 0x00800000
Copy link
Contributor

Choose a reason for hiding this comment

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

JVMPI was deprecated in Java 6. Why is JVMPI still relevant here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It was taken from the arm version. Removing the related code.

@@ -90,35 +242,101 @@ _virtualUnresolvedHelper:
_interfaceCallHelper:
hlt #0 // Not implemented yet

//
Copy link
Contributor

Choose a reason for hiding this comment

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

A comment describing the high-level purpose of this code would be helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comment.

// 00: 5 helpers
// 40: 5 sync helpers

.set J9TR_SyncJ2ITableOffset, 40
Copy link
Contributor

Choose a reason for hiding this comment

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

Why don't you move this (and its comment) down to where the table is actually defined? It feels out of place here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moved both the constant definition and the table.

// 00: 5 helpers
// 40: 5 sync helpers

.set J9TR_SyncJ2ITableOffset, 40
Copy link
Contributor

Choose a reason for hiding this comment

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

This symbol refers to an offset in the "J2ITable", however the table is not actually called that. This is a bit confusing. Why not call the "staticGlueTable" the "staticJ2IGlueTable" (or some variant) instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it as J9TR_staticGlueTableSyncOffset.

.text
.align 2

// in: x0 = address of branch instruction
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a comment describing what this function does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added comment.

.set J9TR_SCSnippet_returnAddress, 0
.set J9TR_SCSnippet_method, 8
.set J9TR_USCSnippet_CP, 16
.set J9TR_USCSnippet_CPIndex, 24
Copy link
Contributor

Choose a reason for hiding this comment

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

This doesn't match what the UnresolvedCallSnippet lays out. Please reconcile:

0 : code cache RA
8 : methodAddress (or 0 for unresolved)
16 : lock word
20 : cp address
28 : cp index

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I had overlooked the lock word. Corrected the offsets.


// Static/special call snippet (and additional fields for unresolved snippet)

.set J9TR_SCSnippet_returnAddress, 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you call this codeCacheReturnAddress to help identify it as the RA in the code cache? It's ambiguous whether this is the RA in the snippet or the RA in the CC.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed it as J9TR_SCSnippet_codeCacheReturnAddress.

lsr x1, x28, #J9TR_USCSnippet_HelperOffsetShift // get helper offset
mov x0, x2 // recover method
bl jitMethodIsSync // is method synchronized?
lsr x2, x28, #(J9TR_USCSnippet_HelperOffsetShift+1) // save helper offset for refreshHelper
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be +2 to get a division-by-four effect on the offset in the snippet (since the offsets are multiples of 8).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the shift amount.

ldr x3, [x27, #J9TR_SCSnippet_method]
tbnz x3, #1, L_USSGclinitCase // branch if the LSB (the "clinit" bit) was set in the resolved address
ldr x28, [x27, #J9TR_USCSnippet_CP] // get CP
ldr x8, [x27, #J9TR_USCSnippet_CPIndex] // get CP index & flags
Copy link
Contributor

Choose a reason for hiding this comment

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

The cpIndex is already in x28 from above and I don't believe any path has clobbered it yet. Why not use that instead of loading? You'll have to find a different register for the cpAddr since you just loaded it into x28.

tbnz x3, #1, L_USSGclinitCase // branch if the LSB (the "clinit" bit) was set in the resolved address
ldr x28, [x27, #J9TR_USCSnippet_CP] // get CP
ldr x8, [x27, #J9TR_USCSnippet_CPIndex] // get CP index & flags
and x8, x8, #(~J9TR_USCSnippet_HelperOffset) // remove helper offset from CP index
Copy link
Contributor

Choose a reason for hiding this comment

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

Previously you masked out the JVMPI bit on the offset as well. Notwithstanding my comment above about JVMPI support being deprecated, if for some reason it's needed then should you mask it off here too?

@knn-k
Copy link
Contributor Author

knn-k commented May 22, 2019

Updated a file reflecting the review comments, but not complete yet.
I am going to modify L_refreshHelper so that it works with both B (unconditional branch) and BL (branch and link), in a similar way as the function in the arm32 version.

@knn-k
Copy link
Contributor Author

knn-k commented May 28, 2019

I separated the flushICache change to PR #5908.

This commit implements some functions in PicBuilder.spp for aarch64,
such as _interpreterUnresolvedStaticGlue and _interpreterVoidStaticGlue.

Signed-off-by: knn-k <konno@jp.ibm.com>
@0xdaryl
Copy link
Contributor

0xdaryl commented May 30, 2019

This is an AArch64-specific change. A Jenkins build is pointless.

@0xdaryl 0xdaryl merged commit 69a4b27 into eclipse-openj9:master May 30, 2019
@knn-k knn-k deleted the aarch64runtime4 branch May 30, 2019 02:53
knn-k added a commit to knn-k/openj9 that referenced this pull request Jun 3, 2019
This commit adds a symbol missing in PicBuilder.spp for aarch64,
L_rewriteBranch.  eclipse-openj9#5246 added a reference to it but I forgot to
define the label.

Signed-off-by: knn-k <konno@jp.ibm.com>
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.

2 participants