1 /*
2 * Copyright (c) 2000, 2009, 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 *
110 }
111
112 public StackValueCollection getExpressions() {
113 if (getScope() == null)
114 return new StackValueCollection();
115 List scvList = getScope().getExpressions();
116 if (scvList == null)
117 return new StackValueCollection();
118
119 // scvList is the list of ScopeValues describing the JVM stack state.
120 // There is one scv_list entry for every JVM stack state in use.
121 int length = scvList.size();
122 StackValueCollection result = new StackValueCollection(length);
123 for( int i = 0; i < length; i++ )
124 result.add( createStackValue((ScopeValue) scvList.get(i)) );
125
126 return result;
127 }
128
129 /** Returns List<MonitorInfo> */
130 public List getMonitors() {
131 List monitors = getScope().getMonitors();
132 if (monitors == null) {
133 return new ArrayList();
134 }
135 List result = new ArrayList(monitors.size());
136 for (int i = 0; i < monitors.size(); i++) {
137 MonitorValue mv = (MonitorValue) monitors.get(i);
138 ScopeValue ov = mv.owner();
139 StackValue ownerSV = createStackValue(ov); // it is an oop
140 if (ov.isObject()) { // The owner object was scalar replaced
141 Assert.that(mv.eliminated() && ownerSV.objIsScalarReplaced(), "monitor should be eliminated for scalar replaced object");
142 // Put klass for scalar replaced object.
143 ScopeValue kv = ((ObjectValue)ov).getKlass();
144 Assert.that(kv.isConstantOop(), "klass should be oop constant for scalar replaced object");
145 OopHandle k = ((ConstantOopReadValue)kv).getValue();
146 result.add(new MonitorInfo(k, resolveMonitorLock(mv.basicLock()), mv.eliminated(), true));
147 } else {
148 result.add(new MonitorInfo(ownerSV.getObject(), resolveMonitorLock(mv.basicLock()), mv.eliminated(), false));
149 }
150 }
151 return result;
152 }
153
154 public int getBCI() {
155 int raw = getRawBCI();
|
1 /*
2 * Copyright (c) 2000, 2017, 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 *
110 }
111
112 public StackValueCollection getExpressions() {
113 if (getScope() == null)
114 return new StackValueCollection();
115 List scvList = getScope().getExpressions();
116 if (scvList == null)
117 return new StackValueCollection();
118
119 // scvList is the list of ScopeValues describing the JVM stack state.
120 // There is one scv_list entry for every JVM stack state in use.
121 int length = scvList.size();
122 StackValueCollection result = new StackValueCollection(length);
123 for( int i = 0; i < length; i++ )
124 result.add( createStackValue((ScopeValue) scvList.get(i)) );
125
126 return result;
127 }
128
129 /** Returns List<MonitorInfo> */
130 public List<MonitorInfo> getMonitors() {
131 List monitors = getScope().getMonitors();
132 if (monitors == null) {
133 return new ArrayList<>();
134 }
135 List<MonitorInfo> result = new ArrayList<>(monitors.size());
136 for (int i = 0; i < monitors.size(); i++) {
137 MonitorValue mv = (MonitorValue) monitors.get(i);
138 ScopeValue ov = mv.owner();
139 StackValue ownerSV = createStackValue(ov); // it is an oop
140 if (ov.isObject()) { // The owner object was scalar replaced
141 Assert.that(mv.eliminated() && ownerSV.objIsScalarReplaced(), "monitor should be eliminated for scalar replaced object");
142 // Put klass for scalar replaced object.
143 ScopeValue kv = ((ObjectValue)ov).getKlass();
144 Assert.that(kv.isConstantOop(), "klass should be oop constant for scalar replaced object");
145 OopHandle k = ((ConstantOopReadValue)kv).getValue();
146 result.add(new MonitorInfo(k, resolveMonitorLock(mv.basicLock()), mv.eliminated(), true));
147 } else {
148 result.add(new MonitorInfo(ownerSV.getObject(), resolveMonitorLock(mv.basicLock()), mv.eliminated(), false));
149 }
150 }
151 return result;
152 }
153
154 public int getBCI() {
155 int raw = getRawBCI();
|