Hi,
Below was from Windows. I also build on Linux but need to check what's being generated there.
Btw the register calling conventions for Windows and Linux are not the same on x64.
Regards Dibyendu
Sent from my BlackBerry 10 smartphone on the EE network. From: Samolisov Pavel Sent: Thursday, 28 June 2018 09:57 To: omr developer discussions Reply To: omr developer discussions Subject: Re: [omr-dev] Codegen question |
Hello everyone.
Dibyendu, are you making your experiments on Linux? While I've heard the ABI on Windows x64 and Linux is the same, I would like to double check for myself. суббота, 23 июня 2018 г. пользователь Dibyendu Majumdar написал: Okay - found the issue - it was a stupid mistake where I had the wrong
C signature for the compiled function so that the argument was getting
truncated to a char. It now works.
However I am still trying to understand why I don't see the RDI/EDI
register being used in the generated code.
On 23 June 2018 at 18:24, Dibyendu Majumdar <mobile@xxxxxxxxxxxxxxx> wrote:
> Well I tried creating new shadow symbol for each load/store but that
> didn't make a difference and broke another test.
>
> On 23 June 2018 at 16:45, Dibyendu Majumdar <mobile@xxxxxxxxxxxxxxx> wrote:
>> I think (I am not sure) that the problem might be related to the same
>> array show being used to reference two different symbols?
>>
>> I am using :
>> TR::SymbolReference *symRef =
>> injector->symRefTab()->findOrCreateArrayShadowSymbolRef(type, base);
>>
>> On 23 June 2018 at 16:22, Dibyendu Majumdar <mobile@xxxxxxxxxxxxxxx> wrote:
>>> Hi,
>>>
>>> I am trying to debug what appears to be incorrect code gen.
>>>
>>> The code being compiled is something very simple:
>>>
>>> int not(int v) {return ~v; }
>>>
>>> The output from trace log is:
>>>
>>> 0x00007FF406D70034 00000000 [0x000001BBE7664110]
>>> ProcEntry ; PROCENTRY
>>> 0x00007FF406D70034 00000000 [0x000001BBE7666870] 48 83 ec 10
>>> sub rsp, 0x00000010 ; SUB8RegImms
>>> 0x00007FF406D70038 00000004 [0x000001BBE76667F0]
>>> vfpSave ; AdjustFramePtr
>>> 0x00007FF406D70038 00000004 [0x000001BBE7664670]
>>> assocRegs ; ASSOCREGS
>>> 0x00007FF406D70038 00000004 [0x000001BBE7664430]
>>> Label L0016: ; LABEL
>>> 0x00007FF406D70038 00000004 [0x000001BBE7665DD0] 48 8b c1
>>> mov rax, rcx ; MOV8RegReg
>>> ========================================
>>> 0x00007FF406D7003B 00000007 [0x000001BBE76646E0]
>>> Fence Relative [ 0x000001BBE75E63E0 ] ; FENCE BBStart
>>> <block_2> (frequency 10000)
>>> 0x00007FF406D7003B 00000007 [0x000001BBE7664AC0] 89 44 24 08
>>> mov dword ptr [rsp+0x8], eax ; S4MemReg, SymRef
>>> <array-shadow>[#480 Auto +8] [flags 0x6001000e 0x0 ]
>>> 0x00007FF406D7003F 0000000b [0x000001BBE7664E20] f7 d0
>>> not eax ; NOT4Reg
>>> 0x00007FF406D70041 0000000d [0x000001BBE7664F30] 89 04 24
>>> mov dword ptr [rsp], eax ; S4MemReg, SymRef
>>> <array-shadow>[#480 Auto] [flags 0x6001000e 0x0 ]
>>> 0x00007FF406D70044 00000010 [0x000001BBE7665440]
>>> assocRegs ; ASSOCREGS
>>> 0x00007FF406D70044 00000010 [0x000001BBE76668F0] 48 83 c4 10
>>> add rsp, 0x00000010 ; ADD8RegImms
>>> 0x00007FF406D70048 00000014 [0x000001BBE7665220] c3
>>> ret
>>>
>>>
>>> I do not understand above - I am expecting that the parameter being
>>> passed will be accessed via register RDI/EDI (first arg). But I don't
>>> see that ... and this code when executed doesn't give the right
>>> results.
>>>
>>> The IL is:
>>>
>>> n2n BBStart <block_2>
>>> [0x000001BBE75C3900] bci=[-1,0,-] rc=0 vc=0
>>> vn=- li=- udi=- nc=0
>>> n9n istorei <array-shadow>[#480 Shadow] [flags 0x80000603 0x0
>>> ] [0x000001BBE75C3AC0] bci=[-1,0,-] rc=0 vc=0
>>> vn=- li=- udi=- nc=2
>>> n8n aladd
>>> [0x000001BBE75C3A80] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=2
>>> n5n loadaddr <temp slot 3>[#592 Auto] [flags 0x6001000e
>>> 0x0 ] [0x000001BBE75C39C0] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=0
>>> n7n lconst 0
>>> [0x000001BBE75C3A40] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=0
>>> n6n iload Parm 0<parm 0 I>[#590 Parm] [flags 0x40000103 0x0
>>> ] [0x000001BBE75C3A00] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=0
>>> n19n istorei <array-shadow>[#480 Shadow] [flags 0x80000603 0x0
>>> ] [0x000001BBE75C3D40] bci=[-1,0,-] rc=0 vc=0
>>> vn=- li=- udi=- nc=2
>>> n18n aladd
>>> [0x000001BBE75C3D00] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=2
>>> n17n loadaddr <temp slot 2>[#591 Auto] [flags 0x6001000e
>>> 0x0 ] [0x000001BBE75C3CC0] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=0
>>> n16n lconst 0
>>> [0x000001BBE75C3C80] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=0
>>> n15n ixor
>>> [0x000001BBE75C3C40] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=2
>>> n13n iloadi <array-shadow>[#480 Shadow] [flags 0x80000603
>>> 0x0 ] [0x000001BBE75C3BC0] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=1
>>> n12n aladd
>>> [0x000001BBE75C3B80] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=2
>>> n10n loadaddr <temp slot 3>[#592 Auto] [flags
>>> 0x6001000e 0x0 ] [0x000001BBE75C3B00] bci=[-1,0,-]
>>> rc=1 vc=0 vn=- li=- udi=- nc=0
>>> n11n lconst 0
>>> [0x000001BBE75C3B40] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=0
>>> n14n iconst -1
>>> [0x000001BBE75C3C00] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=0
>>> n20n goto --> block_3 BBStart at n4n
>>> [0x000001BBE75C3D80] bci=[-1,0,-] rc=0 vc=0
>>> vn=- li=- udi=- nc=0
>>> n1n BBEnd </block_2> =====
>>> [0x000001BBE75C38C0] bci=[-1,0,-] rc=0 vc=0
>>> vn=- li=- udi=- nc=0
>>>
>>> n4n BBStart <block_3>
>>> [0x000001BBE75C3980] bci=[-1,0,-] rc=0 vc=0
>>> vn=- li=- udi=- nc=0
>>> n25n ireturn
>>> [0x000001BBE75C3EC0] bci=[-1,0,-] rc=0 vc=0
>>> vn=- li=- udi=- nc=1
>>> n24n iloadi <array-shadow>[#480 Shadow] [flags 0x80000603 0x0
>>> ] [0x000001BBE75C3E80] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=1
>>> n23n aladd
>>> [0x000001BBE75C3E40] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=2
>>> n22n loadaddr <temp slot 2>[#591 Auto] [flags 0x6001000e
>>> 0x0 ] [0x000001BBE75C3E00] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=0
>>> n21n lconst 0
>>> [0x000001BBE75C3DC0] bci=[-1,0,-] rc=1 vc=0
>>> vn=- li=- udi=- nc=0
>>> n3n BBEnd </block_3>
>>> [0x000001BBE75C3940] bci=[-1,0,-] rc=0 vc=0
>>> vn=- li=- udi=- nc=0
>>>
>>>
>>> I must be doing something wrong but I can't see what...
>>>
>>> Regards
>>> Dibyendu
_______________________________________________
omr-dev mailing list
omr-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/omr-dev
|