Mercurial > hg > graal-jvmci-8
comparison 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 |
comparison
equal
deleted
inserted
replaced
5128:e2da6471a9a1 | 5129:51111665eda6 |
---|---|
45 | 45 |
46 ThreadToNativeFromVM trans(JavaThread::current()); | 46 ThreadToNativeFromVM trans(JavaThread::current()); |
47 JavaThread* THREAD = JavaThread::current(); | 47 JavaThread* THREAD = JavaThread::current(); |
48 TRACE_graal_1("GraalCompiler::initialize"); | 48 TRACE_graal_1("GraalCompiler::initialize"); |
49 | 49 |
50 _deopted_leaf_graph_count = 0; | |
51 | |
50 initialize_buffer_blob(); | 52 initialize_buffer_blob(); |
51 Runtime1::initialize(THREAD->get_buffer_blob()); | 53 Runtime1::initialize(THREAD->get_buffer_blob()); |
52 | 54 |
53 JNIEnv *env = ((JavaThread *) Thread::current())->jni_environment(); | 55 JNIEnv *env = ((JavaThread *) Thread::current())->jni_environment(); |
54 jclass klass = env->FindClass("com/oracle/graal/hotspot/bridge/CompilerToVMImpl"); | 56 jclass klass = env->FindClass("com/oracle/graal/hotspot/bridge/CompilerToVMImpl"); |
87 if (BootstrapGraal) { | 89 if (BootstrapGraal) { |
88 VMToCompiler::bootstrap(); | 90 VMToCompiler::bootstrap(); |
89 } | 91 } |
90 } | 92 } |
91 } | 93 } |
94 } | |
95 | |
96 void GraalCompiler::deopt_leaf_graph(jlong leaf_graph_id) { | |
97 assert(leaf_graph_id != -1, "unexpected leaf graph id"); | |
98 | |
99 if (_deopted_leaf_graph_count < LEAF_GRAPH_ARRAY_SIZE) { | |
100 MutexLockerEx y(GraalDeoptLeafGraphIds_lock, Mutex::_no_safepoint_check_flag); | |
101 if (_deopted_leaf_graph_count < LEAF_GRAPH_ARRAY_SIZE) { | |
102 _deopted_leaf_graphs[_deopted_leaf_graph_count++] = leaf_graph_id; | |
103 } | |
104 } | |
105 } | |
106 | |
107 oop GraalCompiler::dump_deopted_leaf_graphs(TRAPS) { | |
108 if (_deopted_leaf_graph_count == 0) { | |
109 return NULL; | |
110 } | |
111 jlong* elements; | |
112 int length; | |
113 { | |
114 MutexLockerEx y(GraalDeoptLeafGraphIds_lock, Mutex::_no_safepoint_check_flag); | |
115 if (_deopted_leaf_graph_count == 0) { | |
116 return NULL; | |
117 } | |
118 if (_deopted_leaf_graph_count == LEAF_GRAPH_ARRAY_SIZE) { | |
119 length = 0; | |
120 } else { | |
121 length = _deopted_leaf_graph_count; | |
122 } | |
123 elements = new jlong[length]; | |
124 for (int i = 0; i < length; i++) { | |
125 elements[i] = _deopted_leaf_graphs[i]; | |
126 } | |
127 _deopted_leaf_graph_count = 0; | |
128 } | |
129 typeArrayOop array = oopFactory::new_longArray(length, CHECK_NULL); | |
130 for (int i = 0; i < length; i++) { | |
131 array->long_at_put(i, elements[i]); | |
132 } | |
133 delete elements; | |
134 return array; | |
92 } | 135 } |
93 | 136 |
94 void GraalCompiler::initialize_buffer_blob() { | 137 void GraalCompiler::initialize_buffer_blob() { |
95 | 138 |
96 JavaThread* THREAD = JavaThread::current(); | 139 JavaThread* THREAD = JavaThread::current(); |