src/cpu/sparc/vm/relocInfo_sparc.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File bug_8003424.4 Sdiff src/cpu/sparc/vm

src/cpu/sparc/vm/relocInfo_sparc.cpp

Print this page


   1 /*
   2  * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  80     guarantee(Assembler::inv_immed(inst), "must have a simm13 field");
  81     int simm13 = Assembler::low10((intptr_t)x) + o;
  82     guarantee(Assembler::is_simm13(simm13), "offset can't overflow simm13");
  83     inst &= ~Assembler::simm(    -1, 13);
  84     inst |=  Assembler::simm(simm13, 13);
  85     if (verify_only) {
  86       assert(ip->long_at(0) == inst, "instructions must match");
  87     } else {
  88       ip->set_long_at(0, inst);
  89     }
  90     }
  91     break;
  92 
  93   case Assembler::branch_op:
  94     {
  95 #ifdef _LP64
  96     jint inst2;
  97     guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi");
  98     if (format() != 0) {
  99       assert(type() == relocInfo::oop_type || type() == relocInfo::metadata_type, "only narrow oops or klasses case");
 100       jint np = type() == relocInfo::oop_type ? oopDesc::encode_heap_oop((oop)x) : oopDesc::encode_klass((Klass*)x);
 101       inst &= ~Assembler::hi22(-1);
 102       inst |=  Assembler::hi22((intptr_t)np);
 103       if (verify_only) {
 104         assert(ip->long_at(0) == inst, "instructions must match");
 105       } else {
 106         ip->set_long_at(0, inst);
 107       }
 108       inst2 = ip->long_at( NativeInstruction::nop_instruction_size );
 109       guarantee(Assembler::inv_op(inst2)==Assembler::arith_op, "arith op");
 110       if (verify_only) {
 111         assert(ip->long_at(NativeInstruction::nop_instruction_size) == NativeInstruction::set_data32_simm13( inst2, (intptr_t)np),
 112                "instructions must match");
 113       } else {
 114         ip->set_long_at(NativeInstruction::nop_instruction_size, NativeInstruction::set_data32_simm13( inst2, (intptr_t)np));
 115       }
 116       break;
 117     }
 118     if (verify_only) {
 119       ip->verify_data64_sethi( ip->addr_at(0), (intptr_t)x );
 120     } else {


   1 /*
   2  * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


  80     guarantee(Assembler::inv_immed(inst), "must have a simm13 field");
  81     int simm13 = Assembler::low10((intptr_t)x) + o;
  82     guarantee(Assembler::is_simm13(simm13), "offset can't overflow simm13");
  83     inst &= ~Assembler::simm(    -1, 13);
  84     inst |=  Assembler::simm(simm13, 13);
  85     if (verify_only) {
  86       assert(ip->long_at(0) == inst, "instructions must match");
  87     } else {
  88       ip->set_long_at(0, inst);
  89     }
  90     }
  91     break;
  92 
  93   case Assembler::branch_op:
  94     {
  95 #ifdef _LP64
  96     jint inst2;
  97     guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi");
  98     if (format() != 0) {
  99       assert(type() == relocInfo::oop_type || type() == relocInfo::metadata_type, "only narrow oops or klasses case");
 100       jint np = type() == relocInfo::oop_type ? oopDesc::encode_heap_oop((oop)x) : Klass::encode_klass((Klass*)x);
 101       inst &= ~Assembler::hi22(-1);
 102       inst |=  Assembler::hi22((intptr_t)np);
 103       if (verify_only) {
 104         assert(ip->long_at(0) == inst, "instructions must match");
 105       } else {
 106         ip->set_long_at(0, inst);
 107       }
 108       inst2 = ip->long_at( NativeInstruction::nop_instruction_size );
 109       guarantee(Assembler::inv_op(inst2)==Assembler::arith_op, "arith op");
 110       if (verify_only) {
 111         assert(ip->long_at(NativeInstruction::nop_instruction_size) == NativeInstruction::set_data32_simm13( inst2, (intptr_t)np),
 112                "instructions must match");
 113       } else {
 114         ip->set_long_at(NativeInstruction::nop_instruction_size, NativeInstruction::set_data32_simm13( inst2, (intptr_t)np));
 115       }
 116       break;
 117     }
 118     if (verify_only) {
 119       ip->verify_data64_sethi( ip->addr_at(0), (intptr_t)x );
 120     } else {


src/cpu/sparc/vm/relocInfo_sparc.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File