Mercurial > hg > graal-jvmci-8
comparison src/share/vm/runtime/deoptimization.cpp @ 2142:8012aa3ccede
4926272: methodOopDesc::method_from_bcp is unsafe
Reviewed-by: coleenp, jrose, kvn, dcubed
author | never |
---|---|
date | Thu, 13 Jan 2011 22:15:41 -0800 |
parents | f95d63e2154a |
children | 3582bf76420e |
comparison
equal
deleted
inserted
replaced
2130:34d64ad817f4 | 2142:8012aa3ccede |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
393 // Compute whether the root vframe returns a float or double value. | 393 // Compute whether the root vframe returns a float or double value. |
394 BasicType return_type; | 394 BasicType return_type; |
395 { | 395 { |
396 HandleMark hm; | 396 HandleMark hm; |
397 methodHandle method(thread, array->element(0)->method()); | 397 methodHandle method(thread, array->element(0)->method()); |
398 Bytecode_invoke* invoke = Bytecode_invoke_at_check(method, array->element(0)->bci()); | 398 Bytecode_invoke invoke = Bytecode_invoke_check(method, array->element(0)->bci()); |
399 return_type = (invoke != NULL) ? invoke->result_type(thread) : T_ILLEGAL; | 399 return_type = invoke.is_valid() ? invoke.result_type(thread) : T_ILLEGAL; |
400 } | 400 } |
401 | 401 |
402 // Compute information for handling adapters and adjusting the frame size of the caller. | 402 // Compute information for handling adapters and adjusting the frame size of the caller. |
403 int caller_adjustment = 0; | 403 int caller_adjustment = 0; |
404 | 404 |
598 Bytecodes::Code cur_code = str.next(); | 598 Bytecodes::Code cur_code = str.next(); |
599 if (cur_code == Bytecodes::_invokevirtual || | 599 if (cur_code == Bytecodes::_invokevirtual || |
600 cur_code == Bytecodes::_invokespecial || | 600 cur_code == Bytecodes::_invokespecial || |
601 cur_code == Bytecodes::_invokestatic || | 601 cur_code == Bytecodes::_invokestatic || |
602 cur_code == Bytecodes::_invokeinterface) { | 602 cur_code == Bytecodes::_invokeinterface) { |
603 Bytecode_invoke* invoke = Bytecode_invoke_at(mh, iframe->interpreter_frame_bci()); | 603 Bytecode_invoke invoke(mh, iframe->interpreter_frame_bci()); |
604 symbolHandle signature(thread, invoke->signature()); | 604 symbolHandle signature(thread, invoke.signature()); |
605 ArgumentSizeComputer asc(signature); | 605 ArgumentSizeComputer asc(signature); |
606 cur_invoke_parameter_size = asc.size(); | 606 cur_invoke_parameter_size = asc.size(); |
607 if (cur_code != Bytecodes::_invokestatic) { | 607 if (cur_code != Bytecodes::_invokestatic) { |
608 // Add in receiver | 608 // Add in receiver |
609 ++cur_invoke_parameter_size; | 609 ++cur_invoke_parameter_size; |
961 int bci = chunk->at(index)->raw_bci(); | 961 int bci = chunk->at(index)->raw_bci(); |
962 const char* code_name; | 962 const char* code_name; |
963 if (bci == SynchronizationEntryBCI) { | 963 if (bci == SynchronizationEntryBCI) { |
964 code_name = "sync entry"; | 964 code_name = "sync entry"; |
965 } else { | 965 } else { |
966 Bytecodes::Code code = Bytecodes::code_at(vf->method(), bci); | 966 Bytecodes::Code code = vf->method()->code_at(bci); |
967 code_name = Bytecodes::name(code); | 967 code_name = Bytecodes::name(code); |
968 } | 968 } |
969 tty->print(" - %s", code_name); | 969 tty->print(" - %s", code_name); |
970 tty->print_cr(" @ bci %d ", bci); | 970 tty->print_cr(" @ bci %d ", bci); |
971 if (Verbose) { | 971 if (Verbose) { |
1222 nmethod* nm = cvf->code(); | 1222 nmethod* nm = cvf->code(); |
1223 | 1223 |
1224 ScopeDesc* trap_scope = cvf->scope(); | 1224 ScopeDesc* trap_scope = cvf->scope(); |
1225 methodHandle trap_method = trap_scope->method(); | 1225 methodHandle trap_method = trap_scope->method(); |
1226 int trap_bci = trap_scope->bci(); | 1226 int trap_bci = trap_scope->bci(); |
1227 Bytecodes::Code trap_bc = Bytecode_at(trap_method->bcp_from(trap_bci))->java_code(); | 1227 Bytecodes::Code trap_bc = trap_method->java_code_at(trap_bci); |
1228 | 1228 |
1229 // Record this event in the histogram. | 1229 // Record this event in the histogram. |
1230 gather_statistics(reason, action, trap_bc); | 1230 gather_statistics(reason, action, trap_bc); |
1231 | 1231 |
1232 // Ensure that we can record deopt. history: | 1232 // Ensure that we can record deopt. history: |