You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Pavel Pervov (JIRA)" <ji...@apache.org> on 2007/10/25 14:49:53 UTC

[jira] Created: (HARMONY-5021) [drlvm][encoder] native methods returning jchar can't return values greater than 255 on x86-64 platforms

[drlvm][encoder] native methods returning jchar can't return values greater than 255 on x86-64 platforms
--------------------------------------------------------------------------------------------------------

                 Key: HARMONY-5021
                 URL: https://issues.apache.org/jira/browse/HARMONY-5021
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
         Environment: x86-64
            Reporter: Pavel Pervov


I managed to trace the problem to encoder.
It is not possible to encode "movzx r64, r16" operation on x86-64.

Here is the stack trace from encoding JNI jnvocation stub.

harmonyvm.dll!EncoderBase::lookup(Mnemonic mn=Mnemonic_MOVZX, const EncoderBase::Operands & opnds={...})  Line 731	C++
harmonyvm.dll!EncoderBase::encode(char * stream=0x000000000529fdf1, Mnemonic mn=Mnemonic_MOVZX, const EncoderBase::Operands & opnds={...})  Line 291 + 0x14 bytes	C++
harmonyvm.dll!movzx(char * stream=0x000000000529fdf1, const R_Opnd & r={...}, const RM_Opnd & rm={...}, Opnd_Size sz=size_16)  Line 363	C++
>harmonyvm.dll!LcgEM64TCodeGen::un_op_rm(LilOperation o=LO_Zx2, const LcgEM64TLoc * dest=0x00000000052a9e80, const LcgEM64TLoc * src=0x00000000052a9e90)  Line 852 + 0x34 bytes	C++
harmonyvm.dll!LcgEM64TCodeGen::asgn(LilVariable * dest=0x0000000005280e74, LilOperation o=LO_Zx2, LilOperand * op1=0x0000000005280e80, LilOperand * op2=0x0000000005280e98)  Line 1267	C++
harmonyvm.dll!lil_visit_instruction(LilInstruction * i=0x0000000005280e68, LilInstructionVisitor * v=0x000000000012d410)  Line 1697	C++
harmonyvm.dll!LcgEM64TCodeGen::LcgEM64TCodeGen(LilCodeStub * cs=0x00000000052802b8, LcgEM64TContext & c={...}, tl::MemoryPool & m={...})  Line 1095	C++
harmonyvm.dll!LilCodeGeneratorEM64T::compile_main(LilCodeStub * cs=0x00000000052802b8, unsigned __int64 * stub_size=0x000000000012d518, PoolManager * code_pool=0x0000000005136d90)  Line 1721	C++
harmonyvm.dll!LilCodeGenerator::compile(LilCodeStub * cs=0x00000000052802b8, PoolManager * code_pool=0x0000000005136d90)  Line 61 + 0x1e bytes	C++
harmonyvm.dll!compile_create_lil_jni_stub(Method * method=0x00000000052d3020, void * func=0x0000000005e910b4, LilCodeStub * (LilCodeStub *, Method *)* nso=0x0000000000000000)  Line 525 + 0x37 bytes	C++
harmonyvm.dll!compile_create_jni_stub(Method * method=0x00000000052d3020, void (void)* func=0x0000000005e910b4, LilCodeStub * (LilCodeStub *, Method *)* nso=0x0000000000000000)  Line 594	C++
harmonyvm.dll!compile_prepare_native_method(Method * method=0x00000000052d3020)  Line 617 + 0x1d bytes	C++
harmonyvm.dll!compile_do_compilation(Method * method=0x00000000052d3020)  Line 763 + 0xa bytes	C++
harmonyvm.dll!compile_me(Method * method=0x00000000052d3020)  Line 799 + 0xd bytes	C++

EncoderBase::lookup returns "movzx r64, r8" match for this operation. It is illegal though as high 8 bits are lost from jchar.

I'll attach simple test which illustrates the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-5021) [drlvm][encoder] native methods returning jchar can't return values greater than 255 on x86-64 platforms

Posted by "Pavel Pervov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5021?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel Pervov updated HARMONY-5021:
----------------------------------

    Attachment: char16.zip

Here is the simplest test to reproduce the problem.

> [drlvm][encoder] native methods returning jchar can't return values greater than 255 on x86-64 platforms
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5021
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5021
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: x86-64
>            Reporter: Pavel Pervov
>         Attachments: char16.zip
>
>
> I managed to trace the problem to encoder.
> It is not possible to encode "movzx r64, r16" operation on x86-64.
> Here is the stack trace from encoding JNI jnvocation stub.
> harmonyvm.dll!EncoderBase::lookup(Mnemonic mn=Mnemonic_MOVZX, const EncoderBase::Operands & opnds={...})  Line 731	C++
> harmonyvm.dll!EncoderBase::encode(char * stream=0x000000000529fdf1, Mnemonic mn=Mnemonic_MOVZX, const EncoderBase::Operands & opnds={...})  Line 291 + 0x14 bytes	C++
> harmonyvm.dll!movzx(char * stream=0x000000000529fdf1, const R_Opnd & r={...}, const RM_Opnd & rm={...}, Opnd_Size sz=size_16)  Line 363	C++
> >harmonyvm.dll!LcgEM64TCodeGen::un_op_rm(LilOperation o=LO_Zx2, const LcgEM64TLoc * dest=0x00000000052a9e80, const LcgEM64TLoc * src=0x00000000052a9e90)  Line 852 + 0x34 bytes	C++
> harmonyvm.dll!LcgEM64TCodeGen::asgn(LilVariable * dest=0x0000000005280e74, LilOperation o=LO_Zx2, LilOperand * op1=0x0000000005280e80, LilOperand * op2=0x0000000005280e98)  Line 1267	C++
> harmonyvm.dll!lil_visit_instruction(LilInstruction * i=0x0000000005280e68, LilInstructionVisitor * v=0x000000000012d410)  Line 1697	C++
> harmonyvm.dll!LcgEM64TCodeGen::LcgEM64TCodeGen(LilCodeStub * cs=0x00000000052802b8, LcgEM64TContext & c={...}, tl::MemoryPool & m={...})  Line 1095	C++
> harmonyvm.dll!LilCodeGeneratorEM64T::compile_main(LilCodeStub * cs=0x00000000052802b8, unsigned __int64 * stub_size=0x000000000012d518, PoolManager * code_pool=0x0000000005136d90)  Line 1721	C++
> harmonyvm.dll!LilCodeGenerator::compile(LilCodeStub * cs=0x00000000052802b8, PoolManager * code_pool=0x0000000005136d90)  Line 61 + 0x1e bytes	C++
> harmonyvm.dll!compile_create_lil_jni_stub(Method * method=0x00000000052d3020, void * func=0x0000000005e910b4, LilCodeStub * (LilCodeStub *, Method *)* nso=0x0000000000000000)  Line 525 + 0x37 bytes	C++
> harmonyvm.dll!compile_create_jni_stub(Method * method=0x00000000052d3020, void (void)* func=0x0000000005e910b4, LilCodeStub * (LilCodeStub *, Method *)* nso=0x0000000000000000)  Line 594	C++
> harmonyvm.dll!compile_prepare_native_method(Method * method=0x00000000052d3020)  Line 617 + 0x1d bytes	C++
> harmonyvm.dll!compile_do_compilation(Method * method=0x00000000052d3020)  Line 763 + 0xa bytes	C++
> harmonyvm.dll!compile_me(Method * method=0x00000000052d3020)  Line 799 + 0xd bytes	C++
> EncoderBase::lookup returns "movzx r64, r8" match for this operation. It is illegal though as high 8 bits are lost from jchar.
> I'll attach simple test which illustrates the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (HARMONY-5021) [drlvm][encoder] native methods returning jchar can't return values greater than 255 on x86-64 platforms

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5021?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Varlamov resolved HARMONY-5021.
--------------------------------------

    Resolution: Fixed

Yep, need to add 'movzx r64,rm16' opcode to the encoder table. I guess it was missed intially due to confusion around typo in Intel Architecture manual, which does not list this opcode; but AMD64 manual and practice proves it's OK. 

As for incorrect opcode lookup in encoder, seems it is intentionally softened to be tolerant to Jitrino's bugs or peculiarities, e.g. HARMONY-5037. Nothing to be fixed there for now.

Fixed and added reg test at revision: 591290, please verify.

> [drlvm][encoder] native methods returning jchar can't return values greater than 255 on x86-64 platforms
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5021
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5021
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: x86-64
>            Reporter: Pavel Pervov
>            Assignee: Alexey Varlamov
>         Attachments: char16.zip
>
>
> I managed to trace the problem to encoder.
> It is not possible to encode "movzx r64, r16" operation on x86-64.
> Here is the stack trace from encoding JNI jnvocation stub.
> harmonyvm.dll!EncoderBase::lookup(Mnemonic mn=Mnemonic_MOVZX, const EncoderBase::Operands & opnds={...})  Line 731	C++
> harmonyvm.dll!EncoderBase::encode(char * stream=0x000000000529fdf1, Mnemonic mn=Mnemonic_MOVZX, const EncoderBase::Operands & opnds={...})  Line 291 + 0x14 bytes	C++
> harmonyvm.dll!movzx(char * stream=0x000000000529fdf1, const R_Opnd & r={...}, const RM_Opnd & rm={...}, Opnd_Size sz=size_16)  Line 363	C++
> >harmonyvm.dll!LcgEM64TCodeGen::un_op_rm(LilOperation o=LO_Zx2, const LcgEM64TLoc * dest=0x00000000052a9e80, const LcgEM64TLoc * src=0x00000000052a9e90)  Line 852 + 0x34 bytes	C++
> harmonyvm.dll!LcgEM64TCodeGen::asgn(LilVariable * dest=0x0000000005280e74, LilOperation o=LO_Zx2, LilOperand * op1=0x0000000005280e80, LilOperand * op2=0x0000000005280e98)  Line 1267	C++
> harmonyvm.dll!lil_visit_instruction(LilInstruction * i=0x0000000005280e68, LilInstructionVisitor * v=0x000000000012d410)  Line 1697	C++
> harmonyvm.dll!LcgEM64TCodeGen::LcgEM64TCodeGen(LilCodeStub * cs=0x00000000052802b8, LcgEM64TContext & c={...}, tl::MemoryPool & m={...})  Line 1095	C++
> harmonyvm.dll!LilCodeGeneratorEM64T::compile_main(LilCodeStub * cs=0x00000000052802b8, unsigned __int64 * stub_size=0x000000000012d518, PoolManager * code_pool=0x0000000005136d90)  Line 1721	C++
> harmonyvm.dll!LilCodeGenerator::compile(LilCodeStub * cs=0x00000000052802b8, PoolManager * code_pool=0x0000000005136d90)  Line 61 + 0x1e bytes	C++
> harmonyvm.dll!compile_create_lil_jni_stub(Method * method=0x00000000052d3020, void * func=0x0000000005e910b4, LilCodeStub * (LilCodeStub *, Method *)* nso=0x0000000000000000)  Line 525 + 0x37 bytes	C++
> harmonyvm.dll!compile_create_jni_stub(Method * method=0x00000000052d3020, void (void)* func=0x0000000005e910b4, LilCodeStub * (LilCodeStub *, Method *)* nso=0x0000000000000000)  Line 594	C++
> harmonyvm.dll!compile_prepare_native_method(Method * method=0x00000000052d3020)  Line 617 + 0x1d bytes	C++
> harmonyvm.dll!compile_do_compilation(Method * method=0x00000000052d3020)  Line 763 + 0xa bytes	C++
> harmonyvm.dll!compile_me(Method * method=0x00000000052d3020)  Line 799 + 0xd bytes	C++
> EncoderBase::lookup returns "movzx r64, r8" match for this operation. It is illegal though as high 8 bits are lost from jchar.
> I'll attach simple test which illustrates the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-5021) [drlvm][encoder] native methods returning jchar can't return values greater than 255 on x86-64 platforms

Posted by "Pavel Pervov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-5021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12537586 ] 

Pavel Pervov commented on HARMONY-5021:
---------------------------------------

This issue is the reason of failure of the following 9 VTSVM tests on x86-64:

vm.jni.object_methods.CallCharMethodATest
vm.jni.object_methods.CallCharMethodTest
vm.jni.object_methods.CallCharMethodVTest
vm.jni.object_methods.CallNonvirtualCharMethodATest
vm.jni.object_methods.CallNonvirtualCharMethodTest
vm.jni.object_methods.CallNonvirtualCharMethodVTest
vm.jni.static_methods.CallStaticCharMethodATest
vm.jni.static_methods.CallStaticCharMethodTest
vm.jni.static_methods.CallStaticCharMethodVTest


> [drlvm][encoder] native methods returning jchar can't return values greater than 255 on x86-64 platforms
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5021
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5021
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: x86-64
>            Reporter: Pavel Pervov
>         Attachments: char16.zip
>
>
> I managed to trace the problem to encoder.
> It is not possible to encode "movzx r64, r16" operation on x86-64.
> Here is the stack trace from encoding JNI jnvocation stub.
> harmonyvm.dll!EncoderBase::lookup(Mnemonic mn=Mnemonic_MOVZX, const EncoderBase::Operands & opnds={...})  Line 731	C++
> harmonyvm.dll!EncoderBase::encode(char * stream=0x000000000529fdf1, Mnemonic mn=Mnemonic_MOVZX, const EncoderBase::Operands & opnds={...})  Line 291 + 0x14 bytes	C++
> harmonyvm.dll!movzx(char * stream=0x000000000529fdf1, const R_Opnd & r={...}, const RM_Opnd & rm={...}, Opnd_Size sz=size_16)  Line 363	C++
> >harmonyvm.dll!LcgEM64TCodeGen::un_op_rm(LilOperation o=LO_Zx2, const LcgEM64TLoc * dest=0x00000000052a9e80, const LcgEM64TLoc * src=0x00000000052a9e90)  Line 852 + 0x34 bytes	C++
> harmonyvm.dll!LcgEM64TCodeGen::asgn(LilVariable * dest=0x0000000005280e74, LilOperation o=LO_Zx2, LilOperand * op1=0x0000000005280e80, LilOperand * op2=0x0000000005280e98)  Line 1267	C++
> harmonyvm.dll!lil_visit_instruction(LilInstruction * i=0x0000000005280e68, LilInstructionVisitor * v=0x000000000012d410)  Line 1697	C++
> harmonyvm.dll!LcgEM64TCodeGen::LcgEM64TCodeGen(LilCodeStub * cs=0x00000000052802b8, LcgEM64TContext & c={...}, tl::MemoryPool & m={...})  Line 1095	C++
> harmonyvm.dll!LilCodeGeneratorEM64T::compile_main(LilCodeStub * cs=0x00000000052802b8, unsigned __int64 * stub_size=0x000000000012d518, PoolManager * code_pool=0x0000000005136d90)  Line 1721	C++
> harmonyvm.dll!LilCodeGenerator::compile(LilCodeStub * cs=0x00000000052802b8, PoolManager * code_pool=0x0000000005136d90)  Line 61 + 0x1e bytes	C++
> harmonyvm.dll!compile_create_lil_jni_stub(Method * method=0x00000000052d3020, void * func=0x0000000005e910b4, LilCodeStub * (LilCodeStub *, Method *)* nso=0x0000000000000000)  Line 525 + 0x37 bytes	C++
> harmonyvm.dll!compile_create_jni_stub(Method * method=0x00000000052d3020, void (void)* func=0x0000000005e910b4, LilCodeStub * (LilCodeStub *, Method *)* nso=0x0000000000000000)  Line 594	C++
> harmonyvm.dll!compile_prepare_native_method(Method * method=0x00000000052d3020)  Line 617 + 0x1d bytes	C++
> harmonyvm.dll!compile_do_compilation(Method * method=0x00000000052d3020)  Line 763 + 0xa bytes	C++
> harmonyvm.dll!compile_me(Method * method=0x00000000052d3020)  Line 799 + 0xd bytes	C++
> EncoderBase::lookup returns "movzx r64, r8" match for this operation. It is illegal though as high 8 bits are lost from jchar.
> I'll attach simple test which illustrates the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HARMONY-5021) [drlvm][encoder] native methods returning jchar can't return values greater than 255 on x86-64 platforms

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-5021?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Varlamov reassigned HARMONY-5021:
----------------------------------------

    Assignee: Alexey Varlamov

> [drlvm][encoder] native methods returning jchar can't return values greater than 255 on x86-64 platforms
> --------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-5021
>                 URL: https://issues.apache.org/jira/browse/HARMONY-5021
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: x86-64
>            Reporter: Pavel Pervov
>            Assignee: Alexey Varlamov
>         Attachments: char16.zip
>
>
> I managed to trace the problem to encoder.
> It is not possible to encode "movzx r64, r16" operation on x86-64.
> Here is the stack trace from encoding JNI jnvocation stub.
> harmonyvm.dll!EncoderBase::lookup(Mnemonic mn=Mnemonic_MOVZX, const EncoderBase::Operands & opnds={...})  Line 731	C++
> harmonyvm.dll!EncoderBase::encode(char * stream=0x000000000529fdf1, Mnemonic mn=Mnemonic_MOVZX, const EncoderBase::Operands & opnds={...})  Line 291 + 0x14 bytes	C++
> harmonyvm.dll!movzx(char * stream=0x000000000529fdf1, const R_Opnd & r={...}, const RM_Opnd & rm={...}, Opnd_Size sz=size_16)  Line 363	C++
> >harmonyvm.dll!LcgEM64TCodeGen::un_op_rm(LilOperation o=LO_Zx2, const LcgEM64TLoc * dest=0x00000000052a9e80, const LcgEM64TLoc * src=0x00000000052a9e90)  Line 852 + 0x34 bytes	C++
> harmonyvm.dll!LcgEM64TCodeGen::asgn(LilVariable * dest=0x0000000005280e74, LilOperation o=LO_Zx2, LilOperand * op1=0x0000000005280e80, LilOperand * op2=0x0000000005280e98)  Line 1267	C++
> harmonyvm.dll!lil_visit_instruction(LilInstruction * i=0x0000000005280e68, LilInstructionVisitor * v=0x000000000012d410)  Line 1697	C++
> harmonyvm.dll!LcgEM64TCodeGen::LcgEM64TCodeGen(LilCodeStub * cs=0x00000000052802b8, LcgEM64TContext & c={...}, tl::MemoryPool & m={...})  Line 1095	C++
> harmonyvm.dll!LilCodeGeneratorEM64T::compile_main(LilCodeStub * cs=0x00000000052802b8, unsigned __int64 * stub_size=0x000000000012d518, PoolManager * code_pool=0x0000000005136d90)  Line 1721	C++
> harmonyvm.dll!LilCodeGenerator::compile(LilCodeStub * cs=0x00000000052802b8, PoolManager * code_pool=0x0000000005136d90)  Line 61 + 0x1e bytes	C++
> harmonyvm.dll!compile_create_lil_jni_stub(Method * method=0x00000000052d3020, void * func=0x0000000005e910b4, LilCodeStub * (LilCodeStub *, Method *)* nso=0x0000000000000000)  Line 525 + 0x37 bytes	C++
> harmonyvm.dll!compile_create_jni_stub(Method * method=0x00000000052d3020, void (void)* func=0x0000000005e910b4, LilCodeStub * (LilCodeStub *, Method *)* nso=0x0000000000000000)  Line 594	C++
> harmonyvm.dll!compile_prepare_native_method(Method * method=0x00000000052d3020)  Line 617 + 0x1d bytes	C++
> harmonyvm.dll!compile_do_compilation(Method * method=0x00000000052d3020)  Line 763 + 0xa bytes	C++
> harmonyvm.dll!compile_me(Method * method=0x00000000052d3020)  Line 799 + 0xd bytes	C++
> EncoderBase::lookup returns "movzx r64, r8" match for this operation. It is illegal though as high 8 bits are lost from jchar.
> I'll attach simple test which illustrates the problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.