You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Mikhail Fursov (JIRA)" <ji...@apache.org> on 2007/04/04 11:56:32 UTC

[jira] Created: (HARMONY-3571) [drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode

[drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode
-----------------------------------------------------------------------

                 Key: HARMONY-3571
                 URL: https://issues.apache.org/jira/browse/HARMONY-3571
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
            Reporter: Mikhail Fursov


For the example below:
    static int foo2(String name, String defaultValue) {
        Object result = get(name);
        String property = result instanceof String ? (String) result : null;
        return property.hashCode();

  Code:
   0:	aload_0
   1:	invokestatic	#9; //Method get:(Ljava/lang/String;)Ljava/lang/Object;
   4:	astore_2
   5:	aload_2
   6:	instanceof	#8; //class java/lang/String
   9:	ifeq	19
   12:	aload_2
   13:	checkcast	#8; //class java/lang/String
   16:	goto	20
   19:	aconst_null
   20:	astore_3
   21:	aload_3
   22:	invokevirtual	#10; //Method java/lang/String.hashCode:()I
   25:	ireturn



Jitrino generates the following code
Block ENTRY:  
  Predecessors:
  Successors: L11 UNWIND
  I0:--- MethodEntry(java/util/Properties::getProperty): ()
  I9:defarg.ths -) t1:cls:java/util/Properties
  I10:tauisnonnull      t1 -) t2:tau
  I11:tauhastype      t1,cls:java/util/Properties -) t3:tau
  I12:defarg -) t4:cls:java/lang/String
  I13:tauhastype      t4,cls:java/lang/String -) t5:tau
  I14:defarg -) t6:cls:java/lang/String
  I15:tauhastype      t6,cls:java/lang/String -) t7:tau
  I16:tauunsafe() -) t8:tau
  I17:call      java/util/Hashtable::get(t1, t4) ((t2,t8)) -) t9:cls:java/lang/Object
  GOTO L11

Block L11:  
  Predecessors: ENTRY
  Successors: L9 L12
  I20:L11:
  I21:ldci4     #0 -) t10:int32
  I22:if ceq.i   t10, t9 goto L9
  GOTO L12
....

The I22 is nullcheck  caused by instanceof bytecode processing.
Because of the numeric type the NULL is not converted to MANAGED_NULL in CG:

	00000000033B9F40 I118: (ID:v12(EFLGS):uint32) =XOR t93(ECX):int32,t93(ECX):int32 
	00000000033B9F42 I2: MOVSX t11(RCX):int64,t93(ECX):int32 
	00000000033B9F45 I3: (ID:v12(EFLGS):uint32) =CMP t11(RCX):int64,v9(RAX):cls:java/lang/Object 
	00000000033B9F48 I4: JZ BB_4 t13(318):int32 (IU:v12(EFLGS):uint32) 



I'm not sure if this issue can affect any of scenarios, but it must be fixed anyway.


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


[jira] Updated: (HARMONY-3571) [drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode

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

Mikhail Fursov updated HARMONY-3571:
------------------------------------

    Attachment: instanceof.fix

the fix
(this fix also includes msvc2005 project file update for vmcore project)

> [drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode
> -----------------------------------------------------------------------
>
>                 Key: HARMONY-3571
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3571
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Mikhail Fursov
>         Attachments: instanceof.fix
>
>
> For the example below:
>     static int foo2(String name, String defaultValue) {
>         Object result = get(name);
>         String property = result instanceof String ? (String) result : null;
>         return property.hashCode();
>   Code:
>    0:	aload_0
>    1:	invokestatic	#9; //Method get:(Ljava/lang/String;)Ljava/lang/Object;
>    4:	astore_2
>    5:	aload_2
>    6:	instanceof	#8; //class java/lang/String
>    9:	ifeq	19
>    12:	aload_2
>    13:	checkcast	#8; //class java/lang/String
>    16:	goto	20
>    19:	aconst_null
>    20:	astore_3
>    21:	aload_3
>    22:	invokevirtual	#10; //Method java/lang/String.hashCode:()I
>    25:	ireturn
> Jitrino generates the following code
> Block ENTRY:  
>   Predecessors:
>   Successors: L11 UNWIND
>   I0:--- MethodEntry(java/util/Properties::getProperty): ()
>   I9:defarg.ths -) t1:cls:java/util/Properties
>   I10:tauisnonnull      t1 -) t2:tau
>   I11:tauhastype      t1,cls:java/util/Properties -) t3:tau
>   I12:defarg -) t4:cls:java/lang/String
>   I13:tauhastype      t4,cls:java/lang/String -) t5:tau
>   I14:defarg -) t6:cls:java/lang/String
>   I15:tauhastype      t6,cls:java/lang/String -) t7:tau
>   I16:tauunsafe() -) t8:tau
>   I17:call      java/util/Hashtable::get(t1, t4) ((t2,t8)) -) t9:cls:java/lang/Object
>   GOTO L11
> Block L11:  
>   Predecessors: ENTRY
>   Successors: L9 L12
>   I20:L11:
>   I21:ldci4     #0 -) t10:int32
>   I22:if ceq.i   t10, t9 goto L9
>   GOTO L12
> ....
> The I22 is nullcheck  caused by instanceof bytecode processing.
> Because of the numeric type the NULL is not converted to MANAGED_NULL in CG:
> 	00000000033B9F40 I118: (ID:v12(EFLGS):uint32) =XOR t93(ECX):int32,t93(ECX):int32 
> 	00000000033B9F42 I2: MOVSX t11(RCX):int64,t93(ECX):int32 
> 	00000000033B9F45 I3: (ID:v12(EFLGS):uint32) =CMP t11(RCX):int64,v9(RAX):cls:java/lang/Object 
> 	00000000033B9F48 I4: JZ BB_4 t13(318):int32 (IU:v12(EFLGS):uint32) 
> I'm not sure if this issue can affect any of scenarios, but it must be fixed anyway.

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


[jira] Closed: (HARMONY-3571) [drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode

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

Alexey Varlamov closed HARMONY-3571.
------------------------------------

    Resolution: Fixed

Applied at r526728, thanks!

> [drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode
> -----------------------------------------------------------------------
>
>                 Key: HARMONY-3571
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3571
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Mikhail Fursov
>         Assigned To: Alexey Varlamov
>         Attachments: instanceof.fix
>
>
> For the example below:
>     static int foo2(String name, String defaultValue) {
>         Object result = get(name);
>         String property = result instanceof String ? (String) result : null;
>         return property.hashCode();
>   Code:
>    0:	aload_0
>    1:	invokestatic	#9; //Method get:(Ljava/lang/String;)Ljava/lang/Object;
>    4:	astore_2
>    5:	aload_2
>    6:	instanceof	#8; //class java/lang/String
>    9:	ifeq	19
>    12:	aload_2
>    13:	checkcast	#8; //class java/lang/String
>    16:	goto	20
>    19:	aconst_null
>    20:	astore_3
>    21:	aload_3
>    22:	invokevirtual	#10; //Method java/lang/String.hashCode:()I
>    25:	ireturn
> Jitrino generates the following code
> Block ENTRY:  
>   Predecessors:
>   Successors: L11 UNWIND
>   I0:--- MethodEntry(java/util/Properties::getProperty): ()
>   I9:defarg.ths -) t1:cls:java/util/Properties
>   I10:tauisnonnull      t1 -) t2:tau
>   I11:tauhastype      t1,cls:java/util/Properties -) t3:tau
>   I12:defarg -) t4:cls:java/lang/String
>   I13:tauhastype      t4,cls:java/lang/String -) t5:tau
>   I14:defarg -) t6:cls:java/lang/String
>   I15:tauhastype      t6,cls:java/lang/String -) t7:tau
>   I16:tauunsafe() -) t8:tau
>   I17:call      java/util/Hashtable::get(t1, t4) ((t2,t8)) -) t9:cls:java/lang/Object
>   GOTO L11
> Block L11:  
>   Predecessors: ENTRY
>   Successors: L9 L12
>   I20:L11:
>   I21:ldci4     #0 -) t10:int32
>   I22:if ceq.i   t10, t9 goto L9
>   GOTO L12
> ....
> The I22 is nullcheck  caused by instanceof bytecode processing.
> Because of the numeric type the NULL is not converted to MANAGED_NULL in CG:
> 	00000000033B9F40 I118: (ID:v12(EFLGS):uint32) =XOR t93(ECX):int32,t93(ECX):int32 
> 	00000000033B9F42 I2: MOVSX t11(RCX):int64,t93(ECX):int32 
> 	00000000033B9F45 I3: (ID:v12(EFLGS):uint32) =CMP t11(RCX):int64,v9(RAX):cls:java/lang/Object 
> 	00000000033B9F48 I4: JZ BB_4 t13(318):int32 (IU:v12(EFLGS):uint32) 
> I'm not sure if this issue can affect any of scenarios, but it must be fixed anyway.

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


[jira] Commented: (HARMONY-3571) [drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode

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

Alexey Varlamov commented on HARMONY-3571:
------------------------------------------

What about adding regression test?

> [drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode
> -----------------------------------------------------------------------
>
>                 Key: HARMONY-3571
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3571
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Mikhail Fursov
>         Attachments: instanceof.fix
>
>
> For the example below:
>     static int foo2(String name, String defaultValue) {
>         Object result = get(name);
>         String property = result instanceof String ? (String) result : null;
>         return property.hashCode();
>   Code:
>    0:	aload_0
>    1:	invokestatic	#9; //Method get:(Ljava/lang/String;)Ljava/lang/Object;
>    4:	astore_2
>    5:	aload_2
>    6:	instanceof	#8; //class java/lang/String
>    9:	ifeq	19
>    12:	aload_2
>    13:	checkcast	#8; //class java/lang/String
>    16:	goto	20
>    19:	aconst_null
>    20:	astore_3
>    21:	aload_3
>    22:	invokevirtual	#10; //Method java/lang/String.hashCode:()I
>    25:	ireturn
> Jitrino generates the following code
> Block ENTRY:  
>   Predecessors:
>   Successors: L11 UNWIND
>   I0:--- MethodEntry(java/util/Properties::getProperty): ()
>   I9:defarg.ths -) t1:cls:java/util/Properties
>   I10:tauisnonnull      t1 -) t2:tau
>   I11:tauhastype      t1,cls:java/util/Properties -) t3:tau
>   I12:defarg -) t4:cls:java/lang/String
>   I13:tauhastype      t4,cls:java/lang/String -) t5:tau
>   I14:defarg -) t6:cls:java/lang/String
>   I15:tauhastype      t6,cls:java/lang/String -) t7:tau
>   I16:tauunsafe() -) t8:tau
>   I17:call      java/util/Hashtable::get(t1, t4) ((t2,t8)) -) t9:cls:java/lang/Object
>   GOTO L11
> Block L11:  
>   Predecessors: ENTRY
>   Successors: L9 L12
>   I20:L11:
>   I21:ldci4     #0 -) t10:int32
>   I22:if ceq.i   t10, t9 goto L9
>   GOTO L12
> ....
> The I22 is nullcheck  caused by instanceof bytecode processing.
> Because of the numeric type the NULL is not converted to MANAGED_NULL in CG:
> 	00000000033B9F40 I118: (ID:v12(EFLGS):uint32) =XOR t93(ECX):int32,t93(ECX):int32 
> 	00000000033B9F42 I2: MOVSX t11(RCX):int64,t93(ECX):int32 
> 	00000000033B9F45 I3: (ID:v12(EFLGS):uint32) =CMP t11(RCX):int64,v9(RAX):cls:java/lang/Object 
> 	00000000033B9F48 I4: JZ BB_4 t13(318):int32 (IU:v12(EFLGS):uint32) 
> I'm not sure if this issue can affect any of scenarios, but it must be fixed anyway.

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


[jira] Assigned: (HARMONY-3571) [drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode

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

Alexey Varlamov reassigned HARMONY-3571:
----------------------------------------

    Assignee: Alexey Varlamov

> [drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode
> -----------------------------------------------------------------------
>
>                 Key: HARMONY-3571
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3571
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Mikhail Fursov
>         Assigned To: Alexey Varlamov
>         Attachments: instanceof.fix
>
>
> For the example below:
>     static int foo2(String name, String defaultValue) {
>         Object result = get(name);
>         String property = result instanceof String ? (String) result : null;
>         return property.hashCode();
>   Code:
>    0:	aload_0
>    1:	invokestatic	#9; //Method get:(Ljava/lang/String;)Ljava/lang/Object;
>    4:	astore_2
>    5:	aload_2
>    6:	instanceof	#8; //class java/lang/String
>    9:	ifeq	19
>    12:	aload_2
>    13:	checkcast	#8; //class java/lang/String
>    16:	goto	20
>    19:	aconst_null
>    20:	astore_3
>    21:	aload_3
>    22:	invokevirtual	#10; //Method java/lang/String.hashCode:()I
>    25:	ireturn
> Jitrino generates the following code
> Block ENTRY:  
>   Predecessors:
>   Successors: L11 UNWIND
>   I0:--- MethodEntry(java/util/Properties::getProperty): ()
>   I9:defarg.ths -) t1:cls:java/util/Properties
>   I10:tauisnonnull      t1 -) t2:tau
>   I11:tauhastype      t1,cls:java/util/Properties -) t3:tau
>   I12:defarg -) t4:cls:java/lang/String
>   I13:tauhastype      t4,cls:java/lang/String -) t5:tau
>   I14:defarg -) t6:cls:java/lang/String
>   I15:tauhastype      t6,cls:java/lang/String -) t7:tau
>   I16:tauunsafe() -) t8:tau
>   I17:call      java/util/Hashtable::get(t1, t4) ((t2,t8)) -) t9:cls:java/lang/Object
>   GOTO L11
> Block L11:  
>   Predecessors: ENTRY
>   Successors: L9 L12
>   I20:L11:
>   I21:ldci4     #0 -) t10:int32
>   I22:if ceq.i   t10, t9 goto L9
>   GOTO L12
> ....
> The I22 is nullcheck  caused by instanceof bytecode processing.
> Because of the numeric type the NULL is not converted to MANAGED_NULL in CG:
> 	00000000033B9F40 I118: (ID:v12(EFLGS):uint32) =XOR t93(ECX):int32,t93(ECX):int32 
> 	00000000033B9F42 I2: MOVSX t11(RCX):int64,t93(ECX):int32 
> 	00000000033B9F45 I3: (ID:v12(EFLGS):uint32) =CMP t11(RCX):int64,v9(RAX):cls:java/lang/Object 
> 	00000000033B9F48 I4: JZ BB_4 t13(318):int32 (IU:v12(EFLGS):uint32) 
> I'm not sure if this issue can affect any of scenarios, but it must be fixed anyway.

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


[jira] Updated: (HARMONY-3571) [drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode

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

Mikhail Fursov updated HARMONY-3571:
------------------------------------

    Patch Info: [Patch Available]

> [drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode
> -----------------------------------------------------------------------
>
>                 Key: HARMONY-3571
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3571
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Mikhail Fursov
>         Attachments: instanceof.fix
>
>
> For the example below:
>     static int foo2(String name, String defaultValue) {
>         Object result = get(name);
>         String property = result instanceof String ? (String) result : null;
>         return property.hashCode();
>   Code:
>    0:	aload_0
>    1:	invokestatic	#9; //Method get:(Ljava/lang/String;)Ljava/lang/Object;
>    4:	astore_2
>    5:	aload_2
>    6:	instanceof	#8; //class java/lang/String
>    9:	ifeq	19
>    12:	aload_2
>    13:	checkcast	#8; //class java/lang/String
>    16:	goto	20
>    19:	aconst_null
>    20:	astore_3
>    21:	aload_3
>    22:	invokevirtual	#10; //Method java/lang/String.hashCode:()I
>    25:	ireturn
> Jitrino generates the following code
> Block ENTRY:  
>   Predecessors:
>   Successors: L11 UNWIND
>   I0:--- MethodEntry(java/util/Properties::getProperty): ()
>   I9:defarg.ths -) t1:cls:java/util/Properties
>   I10:tauisnonnull      t1 -) t2:tau
>   I11:tauhastype      t1,cls:java/util/Properties -) t3:tau
>   I12:defarg -) t4:cls:java/lang/String
>   I13:tauhastype      t4,cls:java/lang/String -) t5:tau
>   I14:defarg -) t6:cls:java/lang/String
>   I15:tauhastype      t6,cls:java/lang/String -) t7:tau
>   I16:tauunsafe() -) t8:tau
>   I17:call      java/util/Hashtable::get(t1, t4) ((t2,t8)) -) t9:cls:java/lang/Object
>   GOTO L11
> Block L11:  
>   Predecessors: ENTRY
>   Successors: L9 L12
>   I20:L11:
>   I21:ldci4     #0 -) t10:int32
>   I22:if ceq.i   t10, t9 goto L9
>   GOTO L12
> ....
> The I22 is nullcheck  caused by instanceof bytecode processing.
> Because of the numeric type the NULL is not converted to MANAGED_NULL in CG:
> 	00000000033B9F40 I118: (ID:v12(EFLGS):uint32) =XOR t93(ECX):int32,t93(ECX):int32 
> 	00000000033B9F42 I2: MOVSX t11(RCX):int64,t93(ECX):int32 
> 	00000000033B9F45 I3: (ID:v12(EFLGS):uint32) =CMP t11(RCX):int64,v9(RAX):cls:java/lang/Object 
> 	00000000033B9F48 I4: JZ BB_4 t13(318):int32 (IU:v12(EFLGS):uint32) 
> I'm not sure if this issue can affect any of scenarios, but it must be fixed anyway.

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


[jira] Commented: (HARMONY-3571) [drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode

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

Mikhail Fursov commented on HARMONY-3571:
-----------------------------------------

It's impossible to write regression test for this bug. 
Because NULL and MANAGED_NULL are always not equal to any managed non-null object.

> [drlvm][em64t] Jitrino.OPT emits incorrect code for instanceof bytecode
> -----------------------------------------------------------------------
>
>                 Key: HARMONY-3571
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3571
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Mikhail Fursov
>         Attachments: instanceof.fix
>
>
> For the example below:
>     static int foo2(String name, String defaultValue) {
>         Object result = get(name);
>         String property = result instanceof String ? (String) result : null;
>         return property.hashCode();
>   Code:
>    0:	aload_0
>    1:	invokestatic	#9; //Method get:(Ljava/lang/String;)Ljava/lang/Object;
>    4:	astore_2
>    5:	aload_2
>    6:	instanceof	#8; //class java/lang/String
>    9:	ifeq	19
>    12:	aload_2
>    13:	checkcast	#8; //class java/lang/String
>    16:	goto	20
>    19:	aconst_null
>    20:	astore_3
>    21:	aload_3
>    22:	invokevirtual	#10; //Method java/lang/String.hashCode:()I
>    25:	ireturn
> Jitrino generates the following code
> Block ENTRY:  
>   Predecessors:
>   Successors: L11 UNWIND
>   I0:--- MethodEntry(java/util/Properties::getProperty): ()
>   I9:defarg.ths -) t1:cls:java/util/Properties
>   I10:tauisnonnull      t1 -) t2:tau
>   I11:tauhastype      t1,cls:java/util/Properties -) t3:tau
>   I12:defarg -) t4:cls:java/lang/String
>   I13:tauhastype      t4,cls:java/lang/String -) t5:tau
>   I14:defarg -) t6:cls:java/lang/String
>   I15:tauhastype      t6,cls:java/lang/String -) t7:tau
>   I16:tauunsafe() -) t8:tau
>   I17:call      java/util/Hashtable::get(t1, t4) ((t2,t8)) -) t9:cls:java/lang/Object
>   GOTO L11
> Block L11:  
>   Predecessors: ENTRY
>   Successors: L9 L12
>   I20:L11:
>   I21:ldci4     #0 -) t10:int32
>   I22:if ceq.i   t10, t9 goto L9
>   GOTO L12
> ....
> The I22 is nullcheck  caused by instanceof bytecode processing.
> Because of the numeric type the NULL is not converted to MANAGED_NULL in CG:
> 	00000000033B9F40 I118: (ID:v12(EFLGS):uint32) =XOR t93(ECX):int32,t93(ECX):int32 
> 	00000000033B9F42 I2: MOVSX t11(RCX):int64,t93(ECX):int32 
> 	00000000033B9F45 I3: (ID:v12(EFLGS):uint32) =CMP t11(RCX):int64,v9(RAX):cls:java/lang/Object 
> 	00000000033B9F48 I4: JZ BB_4 t13(318):int32 (IU:v12(EFLGS):uint32) 
> I'm not sure if this issue can affect any of scenarios, but it must be fixed anyway.

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