From ad66b74ba9ecb1cd012664dc5ec41e99f9963aac Mon Sep 17 00:00:00 2001 From: Nazim Uddin Bhuiyan Date: Fri, 12 Oct 2018 10:53:56 -0400 Subject: [PATCH 1/4] Fold code guarded by flag that is never defined J9VM_OPT_TEMP_NEW_INTERFACE_INVOCATION is not defined in any build spec, and therefore can be removed from X86PicBuilder with the assumption that it is never defined. Signed-off-by: Nazim Uddin Bhuiyan --- .../compiler/x/runtime/X86PicBuilder.pnasm | 26 +++---------------- 1 file changed, 3 insertions(+), 23 deletions(-) diff --git a/runtime/compiler/x/runtime/X86PicBuilder.pnasm b/runtime/compiler/x/runtime/X86PicBuilder.pnasm index 49ac0ed74d3..3922e589b7d 100644 --- a/runtime/compiler/x/runtime/X86PicBuilder.pnasm +++ b/runtime/compiler/x/runtime/X86PicBuilder.pnasm @@ -18,8 +18,6 @@ ; ; SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception - -#include "j9cfg.h" %ifndef TR_HOST_64BIT ; -------------------------------------------------------------------------------- @@ -30,8 +28,8 @@ CPU PPRO - %include jilconsts.inc - %include x/runtime/X86PicBuilder_nasm.inc + %include "jilconsts.inc" + %include "x/runtime/X86PicBuilder_nasm.inc" segment .text @@ -247,9 +245,6 @@ typeCheckAndDirectDispatchIPic: throwOnFailedTypeCheckIPic: mov eax, [esp] ; receiver (saved eax) -#ifdef J9VM_OPT_TEMP_NEW_INTERFACE_INVOCATION - push edx ; p) push the address of the constant pool and cpIndex -#endif lea edx, [edx+eq_IPicData_interfaceClass] ; EA of IClass in data block push edi ; p) jit EIP push edx ; p) EA of resolved interface class @@ -298,9 +293,6 @@ mergePopulateIPicClass: -#ifdef J9VM_OPT_TEMP_NEW_INTERFACE_INVOCATION - push edx ; p) push the address of the constant pool and cpIndex -#endif lea edx, [edx+eq_IPicData_interfaceClass] ; EA of IClass in data block push edi ; p) jit EIP push edx ; p) EA of resolved interface class @@ -371,7 +363,7 @@ mergePopulateIPicClass: LoadClassPointerFromObjectHeader eax, edx, edx ; receiver class mov eax, dword [edx+J9TR_J9Class_classLoader] ; receivers class loader - mov ebx, dword [esi+eq_IPicData_interfaceClass] ; ebx == IClass from IPic data area + mov ebx, dword [esi+eq_IPicData_interfaceClass] cmp eax, dword [ebx+J9TR_J9Class_classLoader] ; compare class loaders jz short IPicClassSlotUpdateFailed ; class loaders are the same--do nothing @@ -442,9 +434,6 @@ mergeIPicSlotCall: -#ifdef J9VM_OPT_TEMP_NEW_INTERFACE_INVOCATION - push edx ; p) push the address of the constant pool and cpIndex -#endif lea edx, [edx+eq_IPicData_interfaceClass] ; EA of IClass in data block push edi ; p) jit EIP @@ -523,10 +512,6 @@ mergeIPicInterpretedDispatch: ; +0 saved eax (receiver) ; -#ifdef J9VM_OPT_TEMP_NEW_INTERFACE_INVOCATION - push edx ; p) push the address of the constant pool and cpIndex -#endif - lea edx, [edx+eq_IPicData_interfaceClass] ; EA of IClass in data block ; 18 = 5 (CALL) + 5 (JMP) + 8 (cpAddr,cpIndex) @@ -596,10 +581,6 @@ _IPicLookupDispatch: ; +0 saved eax (receiver) ; -#ifdef J9VM_OPT_TEMP_NEW_INTERFACE_INVOCATION - push edi ; p) push the address of the constant pool and cpIndex -#endif - lea edi, [edi+eq_IPicData_interfaceClass] ; EA of IClass in data block ; 13 = 5 (JMP) + 8 (cpAddr,cpIndex) @@ -1001,7 +982,6 @@ interpretedLastVPicSlot: vtableCallNotPatched: lea edx, [edx-eq_VPicData_size] ; edx = EA of VPic data - ; -9 = (DB + cpAddr,cpIndex) push dword [esp+12] ; p) jit valid EIP push edx ; p) push the address of the constant pool and cpIndex CallHelperUseReg _jitResolveVirtualMethod,eax ; eax = compiler vtable index From 9cde363de40b2c556d01b89afbf32efbafecdfde Mon Sep 17 00:00:00 2001 From: Nazim Uddin Bhuiyan Date: Fri, 12 Oct 2018 10:59:25 -0400 Subject: [PATCH 2/4] Remove C preprocessor directives from NASM file NASM's preprocessor is capable of handling the ifdef check the C preprocessor was doing. The macro NASM preproceesor will use, ASM_J9VM_INTERP_COMPRESSED_OBJECT_HEADER is defined in jilconsts.inc. Signed-off-by: Nazim Uddin Bhuiyan --- runtime/compiler/x/runtime/X86Unresolveds.pnasm | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/runtime/compiler/x/runtime/X86Unresolveds.pnasm b/runtime/compiler/x/runtime/X86Unresolveds.pnasm index 01446a7bac8..6effa23bf96 100644 --- a/runtime/compiler/x/runtime/X86Unresolveds.pnasm +++ b/runtime/compiler/x/runtime/X86Unresolveds.pnasm @@ -18,8 +18,6 @@ ; ; SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 OR LicenseRef-GPL-2.0 WITH Assembly-exception -#include "j9cfg.h" - %ifndef TR_HOST_64BIT ; -------------------------------------------------------------------------------- @@ -1114,16 +1112,16 @@ retn ; -------------------------------------------------------------------------------- + %include "jilconsts.inc" + %include "x/runtime/X86PicBuilder_nasm.inc" - -#ifdef J9VM_INTERP_COMPRESSED_OBJECT_HEADER +%ifdef ASM_J9VM_INTERP_COMPRESSED_OBJECT_HEADER eq_offsetof_J9Object_clazz equ 8 ; offset of class pointer in a J9Object -#else +%else eq_offsetof_J9Object_clazz equ 16 ; offset of class pointer in a J9Object -#endif +%endif + - %include "jilconsts.inc" - %include "x/runtime/X86PicBuilder_nasm.inc" segment .text From db78db3e930bc2fc5188c73fd331310ab1c80b5e Mon Sep 17 00:00:00 2001 From: Nazim Uddin Bhuiyan Date: Fri, 12 Oct 2018 11:14:42 -0400 Subject: [PATCH 3/4] Rename .pnasm files to .nasm X86PicBuilder.pnasm and X86Unresolveds.pnasm no longer need to go through the C preprocessor. Also updated the filenames in the makefiles. Signed-off-by: Nazim Uddin Bhuiyan --- runtime/compiler/build/files/host/x.mk | 4 ++-- .../x/runtime/{X86PicBuilder.pnasm => X86PicBuilder.nasm} | 0 .../x/runtime/{X86Unresolveds.pnasm => X86Unresolveds.nasm} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename runtime/compiler/x/runtime/{X86PicBuilder.pnasm => X86PicBuilder.nasm} (100%) rename runtime/compiler/x/runtime/{X86Unresolveds.pnasm => X86Unresolveds.nasm} (100%) diff --git a/runtime/compiler/build/files/host/x.mk b/runtime/compiler/build/files/host/x.mk index 4ca2da04d41..e2bc8d2dc21 100644 --- a/runtime/compiler/build/files/host/x.mk +++ b/runtime/compiler/build/files/host/x.mk @@ -28,10 +28,10 @@ ifeq ($(OS),osx) compiler/x/runtime/X86Codert.nasm \ compiler/x/runtime/X86EncodeUTF16.nasm \ compiler/x/runtime/X86LockReservation.nasm \ - compiler/x/runtime/X86PicBuilder.pnasm \ + compiler/x/runtime/X86PicBuilder.nasm \ compiler/x/runtime/X86PicBuilderC.cpp \ compiler/x/runtime/X86RelocationTarget.cpp \ - compiler/x/runtime/X86Unresolveds.pnasm + compiler/x/runtime/X86Unresolveds.nasm else diff --git a/runtime/compiler/x/runtime/X86PicBuilder.pnasm b/runtime/compiler/x/runtime/X86PicBuilder.nasm similarity index 100% rename from runtime/compiler/x/runtime/X86PicBuilder.pnasm rename to runtime/compiler/x/runtime/X86PicBuilder.nasm diff --git a/runtime/compiler/x/runtime/X86Unresolveds.pnasm b/runtime/compiler/x/runtime/X86Unresolveds.nasm similarity index 100% rename from runtime/compiler/x/runtime/X86Unresolveds.pnasm rename to runtime/compiler/x/runtime/X86Unresolveds.nasm From c8f5b02ee9ce4ef7c14f347b8956c27f56533431 Mon Sep 17 00:00:00 2001 From: Nazim Uddin Bhuiyan Date: Fri, 12 Oct 2018 11:21:23 -0400 Subject: [PATCH 4/4] Remove rule to handle .pnasm files NASM files no longer need to to go through the C Preprocessor. Signed-off-by: Nazim Uddin Bhuiyan --- runtime/compiler/build/rules/gnu/filetypes.mk | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/runtime/compiler/build/rules/gnu/filetypes.mk b/runtime/compiler/build/rules/gnu/filetypes.mk index 8f745284a34..7893055c128 100644 --- a/runtime/compiler/build/rules/gnu/filetypes.mk +++ b/runtime/compiler/build/rules/gnu/filetypes.mk @@ -156,23 +156,6 @@ endef # DEF_RULE.nasm RULE.nasm=$(eval $(DEF_RULE.nasm)) -# -# Preprocess pnasm into nasm and then assemble into .o -# -define DEF_RULE.pnasm -$(1).nasm: $(2) | jit_createdirs - $$(PASM_CMD) $$(PASM_FLAGS) $$(patsubst %,-I'%',$$(PASM_INCLUDES)) -o $$@ -x assembler-with-cpp -E -P $$< - -JIT_DIR_LIST+=$(dir $(1)) - -jit_cleanobjs:: - rm -f $(1).nasm - -$(call RULE.nasm,$(1),$(1).nasm) -endef # DEF_RULE.pnasm - -RULE.pnasm=$(eval $(DEF_RULE.pnasm)) - endif # ($(HOST_ARCH),x) ##### END X SPECIFIC RULES #####