src/share/vm/runtime/stackValueCollection.cpp

Thu, 24 May 2018 19:24:53 +0800

author
aoqi
date
Thu, 24 May 2018 19:24:53 +0800
changeset 8861
2a33b32dd03c
parent 6876
710a3c8b516e
permissions
-rw-r--r--

#7046 Disable the compilation when branch offset is beyond short branch
Contributed-by: fujie, aoqi

aoqi@0 1 /*
aoqi@0 2 * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 *
aoqi@0 5 * This code is free software; you can redistribute it and/or modify it
aoqi@0 6 * under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 * published by the Free Software Foundation.
aoqi@0 8 *
aoqi@0 9 * This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 * version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 * accompanied this code).
aoqi@0 14 *
aoqi@0 15 * You should have received a copy of the GNU General Public License version
aoqi@0 16 * 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 *
aoqi@0 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 * or visit www.oracle.com if you need additional information or have any
aoqi@0 21 * questions.
aoqi@0 22 *
aoqi@0 23 */
aoqi@0 24
aoqi@1 25 /*
aoqi@1 26 * This file has been modified by Loongson Technology in 2015. These
aoqi@1 27 * modifications are Copyright (c) 2015 Loongson Technology, and are made
aoqi@1 28 * available on the same license terms set forth above.
aoqi@1 29 */
aoqi@1 30
aoqi@0 31 #include "precompiled.hpp"
aoqi@0 32 #include "runtime/stackValueCollection.hpp"
aoqi@0 33 #ifdef TARGET_ARCH_x86
aoqi@0 34 # include "jniTypes_x86.hpp"
aoqi@0 35 #endif
aoqi@0 36 #ifdef TARGET_ARCH_sparc
aoqi@0 37 # include "jniTypes_sparc.hpp"
aoqi@0 38 #endif
aoqi@0 39 #ifdef TARGET_ARCH_zero
aoqi@0 40 # include "jniTypes_zero.hpp"
aoqi@0 41 #endif
aoqi@0 42 #ifdef TARGET_ARCH_arm
aoqi@0 43 # include "jniTypes_arm.hpp"
aoqi@0 44 #endif
aoqi@0 45 #ifdef TARGET_ARCH_ppc
aoqi@0 46 # include "jniTypes_ppc.hpp"
aoqi@0 47 #endif
aoqi@1 48 #ifdef TARGET_ARCH_mips
aoqi@1 49 # include "jniTypes_mips.hpp"
aoqi@1 50 #endif
aoqi@0 51
aoqi@0 52 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
aoqi@0 53
aoqi@0 54 jint StackValueCollection::int_at(int slot) const {
aoqi@0 55 intptr_t val = at(slot)->get_int();
aoqi@0 56 jint ival = *((jint*) (&val));
aoqi@0 57 return ival;
aoqi@0 58 }
aoqi@0 59
aoqi@0 60 jlong StackValueCollection::long_at(int slot) const {
aoqi@0 61 #ifdef _LP64
aoqi@0 62 return at(slot+1)->get_int();
aoqi@0 63 #else
aoqi@0 64 union {
aoqi@0 65 jlong jl;
aoqi@0 66 jint array[2];
aoqi@0 67 } value;
aoqi@0 68 // Interpreter stack is reversed in memory:
aoqi@0 69 // low memory location is in higher java local slot.
aoqi@0 70 value.array[0] = at(slot+1)->get_int();
aoqi@0 71 value.array[1] = at(slot )->get_int();
aoqi@0 72 return value.jl;
aoqi@0 73 #endif
aoqi@0 74 }
aoqi@0 75
aoqi@0 76 Handle StackValueCollection::obj_at(int slot) const {
aoqi@0 77 return at(slot)->get_obj();
aoqi@0 78 }
aoqi@0 79
aoqi@0 80 jfloat StackValueCollection::float_at(int slot) const {
aoqi@0 81 intptr_t res = at(slot)->get_int();
aoqi@0 82 return *((jfloat*) (&res));
aoqi@0 83 }
aoqi@0 84
aoqi@0 85 jdouble StackValueCollection::double_at(int slot) const {
aoqi@0 86 #ifdef _LP64
aoqi@0 87 intptr_t res = at(slot+1)->get_int();
aoqi@0 88 return *((jdouble*) (&res));
aoqi@0 89 #else
aoqi@0 90 union {
aoqi@0 91 jdouble jd;
aoqi@0 92 jint array[2];
aoqi@0 93 } value;
aoqi@0 94 // Interpreter stack is reversed in memory:
aoqi@0 95 // low memory location is in higher java local slot.
aoqi@0 96 value.array[0] = at(slot+1)->get_int();
aoqi@0 97 value.array[1] = at(slot )->get_int();
aoqi@0 98 return value.jd;
aoqi@0 99 #endif
aoqi@0 100 }
aoqi@0 101
aoqi@0 102 void StackValueCollection::set_int_at(int slot, jint value) {
aoqi@0 103 intptr_t val;
aoqi@0 104 *((jint*) (&val)) = value;
aoqi@0 105 at(slot)->set_int(val);
aoqi@0 106 }
aoqi@0 107
aoqi@0 108 void StackValueCollection::set_long_at(int slot, jlong value) {
aoqi@0 109 #ifdef _LP64
aoqi@0 110 at(slot+1)->set_int(value);
aoqi@0 111 #else
aoqi@0 112 union {
aoqi@0 113 jlong jl;
aoqi@0 114 jint array[2];
aoqi@0 115 } x;
aoqi@0 116 // Interpreter stack is reversed in memory:
aoqi@0 117 // low memory location is in higher java local slot.
aoqi@0 118 x.jl = value;
aoqi@0 119 at(slot+1)->set_int(x.array[0]);
aoqi@0 120 at(slot+0)->set_int(x.array[1]);
aoqi@0 121 #endif
aoqi@0 122 }
aoqi@0 123
aoqi@0 124 void StackValueCollection::set_obj_at(int slot, Handle value) {
aoqi@0 125 at(slot)->set_obj(value);
aoqi@0 126 }
aoqi@0 127
aoqi@0 128 void StackValueCollection::set_float_at(int slot, jfloat value) {
aoqi@0 129 #ifdef _LP64
aoqi@0 130 union {
aoqi@0 131 intptr_t jd;
aoqi@0 132 jint array[2];
aoqi@0 133 } val;
aoqi@0 134 // Interpreter stores 32 bit floats in first half of 64 bit word.
aoqi@0 135 val.array[0] = *(jint*)(&value);
aoqi@0 136 val.array[1] = 0;
aoqi@0 137 at(slot)->set_int(val.jd);
aoqi@0 138 #else
aoqi@0 139 at(slot)->set_int(*(jint*)(&value));
aoqi@0 140 #endif
aoqi@0 141 }
aoqi@0 142
aoqi@0 143 void StackValueCollection::set_double_at(int slot, jdouble value) {
aoqi@0 144 #ifdef _LP64
aoqi@0 145 at(slot+1)->set_int(*(intptr_t*)(&value));
aoqi@0 146 #else
aoqi@0 147 union {
aoqi@0 148 jdouble jd;
aoqi@0 149 jint array[2];
aoqi@0 150 } x;
aoqi@0 151 // Interpreter stack is reversed in memory:
aoqi@0 152 // low memory location is in higher java local slot.
aoqi@0 153 x.jd = value;
aoqi@0 154 at(slot+1)->set_int(x.array[0]);
aoqi@0 155 at(slot+0)->set_int(x.array[1]);
aoqi@0 156 #endif
aoqi@0 157 }
aoqi@0 158
aoqi@0 159 #ifndef PRODUCT
aoqi@0 160 void StackValueCollection::print() {
aoqi@0 161 for(int index = 0; index < size(); index++) {
aoqi@0 162 tty->print("\t %2d ", index);
aoqi@0 163 at(index)->print_on(tty);
aoqi@0 164 if( at(index )->type() == T_INT &&
aoqi@0 165 index+1 < size() &&
aoqi@0 166 at(index+1)->type() == T_INT ) {
aoqi@0 167 tty->print(" " INT64_FORMAT " (long)", long_at(index));
aoqi@0 168 tty->cr();
aoqi@0 169 tty->print("\t %.15e (double)", double_at(index));
aoqi@0 170 tty->print(" " PTR64_FORMAT " (longhex)", long_at(index));
aoqi@0 171 }
aoqi@0 172 tty->cr();
aoqi@0 173 }
aoqi@0 174 }
aoqi@0 175 #endif

mercurial