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 arm64cinterp.m4 and arm64helpers.m4 #3559

Merged
merged 1 commit into from
Feb 21, 2019

Conversation

knn-k
Copy link
Contributor

@knn-k knn-k commented Nov 6, 2018

This commit adds two asm files for aarch64, implementing c_cInterpreter.

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

@knn-k
Copy link
Contributor Author

knn-k commented Nov 6, 2018

Should the file names be arm64* or aarch64*?

@pshipton
Copy link
Member

pshipton commented Nov 6, 2018

@gacholio @DanHeidinga ^ do you have a preference?

@gacholio
Copy link
Contributor

gacholio commented Nov 6, 2018

I'd prefer this not be in another file - will it not be 99% similar to the 32-bit implementation? I was hoping not to generate another branch of files for 64-bit (we haven't needed to do it on any other platforms).

I'd prefer to see ifdefs on our existing 64-bit flag (the poorly-name ENV_DATA64) in ARM files rather than calling out AARCH64 as an entirely different entity.

@knn-k See if you can fix/ifdef the existing m4 files.

@knn-k
Copy link
Contributor Author

knn-k commented Nov 6, 2018

AArch64 instruction set is not an extension of existing 32-bit ARM instruction set. The implementation of those *.m4 files for AArch64 will be completely different from the 32-bit ARM version.
I believe it is natural to separate the 64-bit ARM code to another file from the 32-bit ARM code.

See #3502 for the case of unsafeHelper.s.

I have already wrote the full version of arm64cinterp.m4, which is not built nor tested yet.

@gacholio
Copy link
Contributor

gacholio commented Nov 7, 2018

Can this difference be resolved by way of alias (in much the same way that _rbx on X is EBX or RBX on different bitness)? 99% of all of the instructions in the m4 files are fullword-sized.

@knn-k
Copy link
Contributor Author

knn-k commented Nov 8, 2018

@gacholio It won't be simple instruction/register aliases. I guess I will have to define more macros to put both 32-bit and 64-bit ARM.

From the existing armcinterp.m4:

START_PROC(c_cInterpreter)
	sub r13,r13,{#}CINTERP_STACK_SIZE
	stmia r13,{{ r4,r5,r6,r7,r8,r9,r10,r11,r14 }}
	add r3,r13,{#}FPR_SAVE_OFFSET(0)
	vstmia.64 r3,{{ D8-D15 }}
	mov J9VMTHREAD,r0
	ldr r4,[J9VMTHREAD,{#}J9TR_VMThread_entryLocalStorage]	
	add r3,r13,{#}JIT_GPR_SAVE_OFFSET(0)
	str r3,[r4,{#}J9TR_ELS_jitGlobalStorageBase]

AArch64 version (in preparation):

START_PROC(c_cInterpreter)
	sub sp, sp, {#}CINTERP_STACK_SIZE
	stp x29, x30, [sp, GPR_SAVE_OFFSET(29)]
	stp x27, x28, [sp, GPR_SAVE_OFFSET(27)]
	stp x25, x26, [sp, GPR_SAVE_OFFSET(25)]
	stp x23, x24, [sp, GPR_SAVE_OFFSET(23)]
	stp x21, x22, [sp, GPR_SAVE_OFFSET(21)]
	stp x19, x20, [sp, GPR_SAVE_OFFSET(19)]
	stp d14, d15, [sp, FPR_SAVE_OFFSET(14)]
	stp d12, d13, [sp, FPR_SAVE_OFFSET(12)]
	stp d10, d11, [sp, FPR_SAVE_OFFSET(10)]
	stp d8, d9, [sp, FPR_SAVE_OFFSET(8)]
	mov J9VMTHREAD, x0
	ldr x27, [J9VMTHREAD,{#}J9TR_VMThread_entryLocalStorage]
	add x28, sp, {#}JIT_GPR_SAVE_OFFSET(0)
	str x28, [x27,{#}J9TR_ELS_jitGlobalStorageBase]

Copy link
Contributor

@gacholio gacholio left a comment

Choose a reason for hiding this comment

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

Fair enough. Once the implementation is complete, we can look at commonizing things if it's worth it.

@gacholio
Copy link
Contributor

gacholio commented Nov 8, 2018

jenkins compile xlinux jdk8

Copy link
Contributor

@gacholio gacholio left a comment

Choose a reason for hiding this comment

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

Compile fails for the non-cmake xa64 build - I suspect it will fail elsewhere as well. I think you need to update the module.xml to exclude your new C interp file on non-AARCH64 platforms.

@knn-k
Copy link
Contributor Author

knn-k commented Nov 8, 2018

Updated module.xml.

@gacholio
Copy link
Contributor

gacholio commented Nov 8, 2018

jenkins compile xlinux jdk8

@gacholio
Copy link
Contributor

gacholio commented Nov 8, 2018

spec.flags.arch_aarch64 is not defined. I suggest you use arch_arm and J9VM_ENV_DATA64.

@gacholio
Copy link
Contributor

gacholio commented Nov 8, 2018

While you're at it, you may as well exclude the 32-bit file on 64-bit builds in preparation for having a build.

@knn-k
Copy link
Contributor Author

knn-k commented Jan 22, 2019

How is the spec.flags determined during the OpenJ9 build process?

@knn-k
Copy link
Contributor Author

knn-k commented Jan 29, 2019

I updated the files a little.
Not working yet, of course, but libj9vm29.so and vmtest are built successfully for aarch64 in my build environment.

@knn-k knn-k force-pushed the aarch64cinterp1 branch 2 times, most recently from 4d5af08 to 3396d28 Compare February 1, 2019 09:45
@knn-k knn-k changed the title AArch64: Initial version of arm64cinterp.m4 and arm64helpers.m4 WIP: AArch64: Implement arm64cinterp.m4 and arm64helpers.m4 Feb 1, 2019
@knn-k
Copy link
Contributor Author

knn-k commented Feb 1, 2019

Updated the files adding actual code to c_cInterpreter.
It depends on the changes in oti/j9nonbuilder.h and jilgen/jilconsts.c in #4447.

@knn-k knn-k changed the title WIP: AArch64: Implement arm64cinterp.m4 and arm64helpers.m4 AArch64: Implement arm64cinterp.m4 and arm64helpers.m4 Feb 4, 2019
@knn-k
Copy link
Contributor Author

knn-k commented Feb 4, 2019

I can run HelloWorld on aarch64 Linux in the interpreter mode now.

This commit adds two asm files for aarch64, implementing c_cInterpreter.

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

knn-k commented Feb 6, 2019

Removed unnecessary comments from the .m4 files.
Some macros in arm64helpers.m4, marked as "To be filled", are not implemented yet. I am going to write their code later in a separate PR along with the JIT work.

@DanHeidinga
Copy link
Member

@gacholio can you give this another review?

@knn-k
Copy link
Contributor Author

knn-k commented Feb 21, 2019

I would like this PR to be merged if the code is OK.
The aarch64 VM runs fine in the interpreter mode with the c_cInterpreter in this PR.

@gacholio
Copy link
Contributor

Sorry, I will get to this soon.

@gacholio
Copy link
Contributor

jenkins compile xlinux jdk8

@gacholio gacholio merged commit 89e9039 into eclipse-openj9:master Feb 21, 2019
@knn-k knn-k deleted the aarch64cinterp1 branch February 21, 2019 22:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants