| 133 | } |
| 134 | |
| 135 | bool Lookup::fillJavaMethodInfo(MethodInfo* mi, jmethodID method, bool first_time) { |
| 136 | if (VMMethod::isStaleMethodId(method)) { |
| 137 | return false; |
| 138 | } |
| 139 | |
| 140 | jclass method_class = NULL; |
| 141 | char* class_name = NULL; |
| 142 | char* method_name = NULL; |
| 143 | char* method_sig = NULL; |
| 144 | |
| 145 | jvmtiEnv* jvmti = VM::jvmti(); |
| 146 | jvmtiError err; |
| 147 | |
| 148 | if ((err = jvmti->GetMethodName(method, &method_name, &method_sig, NULL)) == 0 && |
| 149 | (err = jvmti->GetMethodDeclaringClass(method, &method_class)) == 0) { |
| 150 | mi->_sig = _symbols->indexOf(method_sig); |
| 151 | mi->_name = _symbols->indexOf(method_name); |
| 152 | |
| 153 | if ((err = jvmti->GetClassSignature(method_class, &class_name, NULL)) == 0) { |
| 154 | mi->_class = _classes->lookup(class_name + 1, strlen(class_name) - 2); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | if (method_class) { |
| 159 | _jni->DeleteLocalRef(method_class); |
| 160 | } |
| 161 | jvmti->Deallocate((unsigned char*)method_sig); |
| 162 | jvmti->Deallocate((unsigned char*)method_name); |
| 163 | jvmti->Deallocate((unsigned char*)class_name); |
| 164 | |
| 165 | if (err != 0) { |
| 166 | return false; |
| 167 | } |
| 168 | |
| 169 | if (first_time && jvmti->GetMethodModifiers(method, &mi->_modifiers) != 0) { |
| 170 | mi->_modifiers = 0; |
| 171 | } |
| 172 | |
| 173 | if (first_time && jvmti->GetLineNumberTable(method, &mi->_line_number_table_size, &mi->_line_number_table) != 0) { |
| 174 | mi->_line_number_table_size = 0; |
| 175 | mi->_line_number_table = NULL; |
| 176 | } |
| 177 | |
| 178 | mi->_type = FRAME_INTERPRETED; |
| 179 | return true; |
| 180 | } |
| 181 | |
| 182 | void Lookup::fillJavaClassInfo(MethodInfo* mi, u32 class_id) { |
| 183 | mi->_class = class_id; |