Skip to content

Commit

Permalink
Merge pull request #3243 from nbhuiyan/no-cpp-nasm
Browse files Browse the repository at this point in the history
Remove the use of the C Preprocessor on NASM assembly files
  • Loading branch information
0xdaryl committed Oct 12, 2018
2 parents 338a312 + c8f5b02 commit 2f039d8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 50 deletions.
4 changes: 2 additions & 2 deletions runtime/compiler/build/files/host/x.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 0 additions & 17 deletions runtime/compiler/build/rules/gnu/filetypes.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 #####

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

; --------------------------------------------------------------------------------
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

; --------------------------------------------------------------------------------
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 2f039d8

Please sign in to comment.