--- a/hotspot/src/share/vm/ci/ciMethod.cpp Thu Dec 02 01:02:55 2010 -0800
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp Thu Dec 02 17:21:12 2010 -0800
@@ -797,12 +797,13 @@
// ------------------------------------------------------------------
-// ciMethod::build_method_data
+// ciMethod::ensure_method_data
//
// Generate new methodDataOop objects at compile time.
-void ciMethod::build_method_data(methodHandle h_m) {
+// Return true if allocation was successful or no MDO is required.
+bool ciMethod::ensure_method_data(methodHandle h_m) {
EXCEPTION_CONTEXT;
- if (is_native() || is_abstract() || h_m()->is_accessor()) return;
+ if (is_native() || is_abstract() || h_m()->is_accessor()) return true;
if (h_m()->method_data() == NULL) {
methodOopDesc::build_interpreter_method_data(h_m, THREAD);
if (HAS_PENDING_EXCEPTION) {
@@ -812,18 +813,22 @@
if (h_m()->method_data() != NULL) {
_method_data = CURRENT_ENV->get_object(h_m()->method_data())->as_method_data();
_method_data->load_data();
+ return true;
} else {
_method_data = CURRENT_ENV->get_empty_methodData();
+ return false;
}
}
// public, retroactive version
-void ciMethod::build_method_data() {
+bool ciMethod::ensure_method_data() {
+ bool result = true;
if (_method_data == NULL || _method_data->is_empty()) {
GUARDED_VM_ENTRY({
- build_method_data(get_methodOop());
+ result = ensure_method_data(get_methodOop());
});
}
+ return result;
}
@@ -839,11 +844,6 @@
Thread* my_thread = JavaThread::current();
methodHandle h_m(my_thread, get_methodOop());
- // Create an MDO for the inlinee
- if (TieredCompilation && is_c1_compile(env->comp_level())) {
- build_method_data(h_m);
- }
-
if (h_m()->method_data() != NULL) {
_method_data = CURRENT_ENV->get_object(h_m()->method_data())->as_method_data();
_method_data->load_data();
@@ -854,6 +854,15 @@
}
+// ------------------------------------------------------------------
+// ciMethod::method_data_or_null
+// Returns a pointer to ciMethodData if MDO exists on the VM side,
+// NULL otherwise.
+ciMethodData* ciMethod::method_data_or_null() {
+ ciMethodData *md = method_data();
+ if (md->is_empty()) return NULL;
+ return md;
+}
// ------------------------------------------------------------------
// ciMethod::will_link