src/share/vm/runtime/stackValueCollection.cpp

Mon, 12 Aug 2019 18:30:40 +0300

author
apetushkov
date
Mon, 12 Aug 2019 18:30:40 +0300
changeset 9858
b985cbb00e68
parent 6680
78bbf4d43a14
child 6876
710a3c8b516e
permissions
-rw-r--r--

8223147: JFR Backport
8199712: Flight Recorder
8203346: JFR: Inconsistent signature of jfr_add_string_constant
8195817: JFR.stop should require name of recording
8195818: JFR.start should increase autogenerated name by one
8195819: Remove recording=x from jcmd JFR.check output
8203921: JFR thread sampling is missing fixes from JDK-8194552
8203929: Limit amount of data for JFR.dump
8203664: JFR start failure after AppCDS archive created with JFR StartFlightRecording
8003209: JFR events for network utilization
8207392: [PPC64] Implement JFR profiling
8202835: jfr/event/os/TestSystemProcess.java fails on missing events
Summary: Backport JFR from JDK11. Initial integration
Reviewed-by: neugens

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

mercurial