Mercurial > hg > graal-compiler
diff src/share/vm/graal/graalCompiler.cpp @ 5129:51111665eda6
Support for recording a leaf graph id for each deoptimization point in the debug info.
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Wed, 21 Mar 2012 10:47:02 +0100 |
parents | 5e9f38419819 |
children | ab038e0d6b43 |
line wrap: on
line diff
--- a/src/share/vm/graal/graalCompiler.cpp Fri Mar 16 11:03:54 2012 +0100 +++ b/src/share/vm/graal/graalCompiler.cpp Wed Mar 21 10:47:02 2012 +0100 @@ -47,6 +47,8 @@ JavaThread* THREAD = JavaThread::current(); TRACE_graal_1("GraalCompiler::initialize"); + _deopted_leaf_graph_count = 0; + initialize_buffer_blob(); Runtime1::initialize(THREAD->get_buffer_blob()); @@ -91,6 +93,47 @@ } } +void GraalCompiler::deopt_leaf_graph(jlong leaf_graph_id) { + assert(leaf_graph_id != -1, "unexpected leaf graph id"); + + if (_deopted_leaf_graph_count < LEAF_GRAPH_ARRAY_SIZE) { + MutexLockerEx y(GraalDeoptLeafGraphIds_lock, Mutex::_no_safepoint_check_flag); + if (_deopted_leaf_graph_count < LEAF_GRAPH_ARRAY_SIZE) { + _deopted_leaf_graphs[_deopted_leaf_graph_count++] = leaf_graph_id; + } + } +} + +oop GraalCompiler::dump_deopted_leaf_graphs(TRAPS) { + if (_deopted_leaf_graph_count == 0) { + return NULL; + } + jlong* elements; + int length; + { + MutexLockerEx y(GraalDeoptLeafGraphIds_lock, Mutex::_no_safepoint_check_flag); + if (_deopted_leaf_graph_count == 0) { + return NULL; + } + if (_deopted_leaf_graph_count == LEAF_GRAPH_ARRAY_SIZE) { + length = 0; + } else { + length = _deopted_leaf_graph_count; + } + elements = new jlong[length]; + for (int i = 0; i < length; i++) { + elements[i] = _deopted_leaf_graphs[i]; + } + _deopted_leaf_graph_count = 0; + } + typeArrayOop array = oopFactory::new_longArray(length, CHECK_NULL); + for (int i = 0; i < length; i++) { + array->long_at_put(i, elements[i]); + } + delete elements; + return array; +} + void GraalCompiler::initialize_buffer_blob() { JavaThread* THREAD = JavaThread::current();