Thu, 06 Jan 2011 16:03:20 -0800
7010618: C1: array length should be treated at int on 64bit during array allocation
Summary: Sign-extend the length argument during array allocation
Reviewed-by: never, kvn
src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp | file | annotate | diff | comparison | revisions | |
src/cpu/x86/vm/c1_LIRAssembler_x86.cpp | file | annotate | diff | comparison | revisions |
1.1 --- a/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Thu Dec 30 23:44:45 2010 -0800 1.2 +++ b/src/cpu/sparc/vm/c1_LIRAssembler_sparc.cpp Thu Jan 06 16:03:20 2011 -0800 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -2358,6 +2358,8 @@ 1.11 op->tmp3()->as_register() == G4 && 1.12 op->tmp4()->as_register() == O1 && 1.13 op->klass()->as_register() == G5, "must be"); 1.14 + 1.15 + LP64_ONLY( __ signx(op->len()->as_register()); ) 1.16 if (UseSlowPath || 1.17 (!UseFastNewObjectArray && (op->type() == T_OBJECT || op->type() == T_ARRAY)) || 1.18 (!UseFastNewTypeArray && (op->type() != T_OBJECT && op->type() != T_ARRAY))) {
2.1 --- a/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Thu Dec 30 23:44:45 2010 -0800 2.2 +++ b/src/cpu/x86/vm/c1_LIRAssembler_x86.cpp Thu Jan 06 16:03:20 2011 -0800 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -1641,12 +1641,14 @@ 2.11 } 2.12 2.13 void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) { 2.14 + Register len = op->len()->as_register(); 2.15 + LP64_ONLY( __ movslq(len, len); ) 2.16 + 2.17 if (UseSlowPath || 2.18 (!UseFastNewObjectArray && (op->type() == T_OBJECT || op->type() == T_ARRAY)) || 2.19 (!UseFastNewTypeArray && (op->type() != T_OBJECT && op->type() != T_ARRAY))) { 2.20 __ jmp(*op->stub()->entry()); 2.21 } else { 2.22 - Register len = op->len()->as_register(); 2.23 Register tmp1 = op->tmp1()->as_register(); 2.24 Register tmp2 = op->tmp2()->as_register(); 2.25 Register tmp3 = op->tmp3()->as_register();