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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "interpreter/bytecodeStream.hpp"
27 #include "logging/log.hpp"
28 #include "oops/generateOopMap.hpp"
29 #include "oops/oop.inline.hpp"
30 #include "oops/symbol.hpp"
31 #include "runtime/handles.inline.hpp"
32 #include "runtime/java.hpp"
33 #include "runtime/relocator.hpp"
34 #include "runtime/timerTrace.hpp"
35 #include "utilities/bitMap.inline.hpp"
36 #include "utilities/ostream.hpp"
37
38 //
39 //
40 // Compute stack layouts for each instruction in method.
41 //
42 // Problems:
43 // - What to do about jsr with different types of local vars?
44 // Need maps that are conditional on jsr path?
45 // - Jsr and exceptions should be done more efficiently (the retAddr stuff)
46 //
47 // Alternative:
1237 }
1238
1239 // We pessimistically assume that this exception can escape the
1240 // method. (It is possible that it will always be caught, but
1241 // we don't care to analyse the types of the catch clauses.)
1242
1243 // We don't set _monitor_top to bad_monitors because there are no successors
1244 // to this exceptional exit.
1245
1246 if (log_is_enabled(Info, monitormismatch) && _monitor_safe) {
1247 // We check _monitor_safe so that we only report the first mismatched
1248 // exceptional exit.
1249 report_monitor_mismatch("non-empty monitor stack at exceptional exit");
1250 }
1251 _monitor_safe = false;
1252
1253 }
1254
1255 void GenerateOopMap::report_monitor_mismatch(const char *msg) {
1256 ResourceMark rm;
1257 outputStream* out = Log(monitormismatch)::info_stream();
1258 out->print("Monitor mismatch in method ");
1259 method()->print_short_name(out);
1260 out->print_cr(": %s", msg);
1261 }
1262
1263 void GenerateOopMap::print_states(outputStream *os,
1264 CellTypeState* vec, int num) {
1265 for (int i = 0; i < num; i++) {
1266 vec[i].print(tty);
1267 }
1268 }
1269
1270 // Print the state values at the current bytecode.
1271 void GenerateOopMap::print_current_state(outputStream *os,
1272 BytecodeStream *currentBC,
1273 bool detailed) {
1274
1275 if (detailed) {
1276 os->print(" %4d vars = ", currentBC->bci());
1277 print_states(os, vars(), _max_locals);
1278 os->print(" %s", Bytecodes::name(currentBC->code()));
1279 switch(currentBC->code()) {
1280 case Bytecodes::_invokevirtual:
|
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 *
23 */
24
25 #include "precompiled.hpp"
26 #include "interpreter/bytecodeStream.hpp"
27 #include "logging/log.hpp"
28 #include "logging/logStream.hpp"
29 #include "oops/generateOopMap.hpp"
30 #include "oops/oop.inline.hpp"
31 #include "oops/symbol.hpp"
32 #include "runtime/handles.inline.hpp"
33 #include "runtime/java.hpp"
34 #include "runtime/relocator.hpp"
35 #include "runtime/timerTrace.hpp"
36 #include "utilities/bitMap.inline.hpp"
37 #include "utilities/ostream.hpp"
38
39 //
40 //
41 // Compute stack layouts for each instruction in method.
42 //
43 // Problems:
44 // - What to do about jsr with different types of local vars?
45 // Need maps that are conditional on jsr path?
46 // - Jsr and exceptions should be done more efficiently (the retAddr stuff)
47 //
48 // Alternative:
1238 }
1239
1240 // We pessimistically assume that this exception can escape the
1241 // method. (It is possible that it will always be caught, but
1242 // we don't care to analyse the types of the catch clauses.)
1243
1244 // We don't set _monitor_top to bad_monitors because there are no successors
1245 // to this exceptional exit.
1246
1247 if (log_is_enabled(Info, monitormismatch) && _monitor_safe) {
1248 // We check _monitor_safe so that we only report the first mismatched
1249 // exceptional exit.
1250 report_monitor_mismatch("non-empty monitor stack at exceptional exit");
1251 }
1252 _monitor_safe = false;
1253
1254 }
1255
1256 void GenerateOopMap::report_monitor_mismatch(const char *msg) {
1257 ResourceMark rm;
1258 LogStream ls(Log(monitormismatch)::info());
1259 ls.print("Monitor mismatch in method ");
1260 method()->print_short_name(&ls);
1261 ls.print_cr(": %s", msg);
1262 }
1263
1264 void GenerateOopMap::print_states(outputStream *os,
1265 CellTypeState* vec, int num) {
1266 for (int i = 0; i < num; i++) {
1267 vec[i].print(tty);
1268 }
1269 }
1270
1271 // Print the state values at the current bytecode.
1272 void GenerateOopMap::print_current_state(outputStream *os,
1273 BytecodeStream *currentBC,
1274 bool detailed) {
1275
1276 if (detailed) {
1277 os->print(" %4d vars = ", currentBC->bci());
1278 print_states(os, vars(), _max_locals);
1279 os->print(" %s", Bytecodes::name(currentBC->code()));
1280 switch(currentBC->code()) {
1281 case Bytecodes::_invokevirtual:
|