Mercurial > hg > graal-jvmci-8
diff src/share/vm/graal/graalEnv.cpp @ 3653:6aef50c6d967
Handlize to fix GC issue.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 17 Nov 2011 00:01:56 +0100 |
parents | 0e8a2a629afb |
children | 4123781869da |
line wrap: on
line diff
--- a/src/share/vm/graal/graalEnv.cpp Wed Nov 16 23:35:10 2011 +0100 +++ b/src/share/vm/graal/graalEnv.cpp Thu Nov 17 00:01:56 2011 +0100 @@ -297,14 +297,12 @@ // // Perform an appropriate method lookup based on accessor, holder, // name, signature, and bytecode. -methodOop GraalEnv::lookup_method(instanceKlass* accessor, - instanceKlass* holder, +methodHandle GraalEnv::lookup_method(instanceKlassHandle h_accessor, + instanceKlassHandle h_holder, Symbol* name, Symbol* sig, Bytecodes::Code bc) { EXCEPTION_CONTEXT; - KlassHandle h_accessor(THREAD, accessor); - KlassHandle h_holder(THREAD, holder); LinkResolver::check_klass_accessability(h_accessor, h_holder, KILL_COMPILE_ON_FATAL_(NULL)); methodHandle dest_method; switch (bc) { @@ -329,7 +327,7 @@ default: ShouldNotReachHere(); } - return dest_method(); + return dest_method; } @@ -337,25 +335,25 @@ // ciEnv::get_method_by_index_impl methodHandle GraalEnv::get_method_by_index_impl(constantPoolHandle cpool, int index, Bytecodes::Code bc, - instanceKlass* accessor) { + instanceKlassHandle accessor) { int holder_index = cpool->klass_ref_index_at(index); bool holder_is_accessible; - KlassHandle holder = get_klass_by_index_impl(cpool, holder_index, holder_is_accessible, KlassHandle(Thread::current(), accessor)); + KlassHandle holder = get_klass_by_index_impl(cpool, holder_index, holder_is_accessible, accessor); // Get the method's name and signature. Symbol* name_sym = cpool->name_ref_at(index); Symbol* sig_sym = cpool->signature_ref_at(index); if (holder_is_accessible) { // Our declared holder is loaded. - instanceKlass* lookup = get_instance_klass_for_declared_method_holder(holder); - methodOop m = lookup_method(accessor, lookup, name_sym, sig_sym, bc); - if (m != NULL && + instanceKlassHandle lookup = get_instance_klass_for_declared_method_holder(holder); + methodHandle m = lookup_method(accessor, lookup, name_sym, sig_sym, bc); + if (!m.is_null() && (bc == Bytecodes::_invokestatic ? instanceKlass::cast(m->method_holder())->is_not_initialized() : !instanceKlass::cast(m->method_holder())->is_loaded())) { m = NULL; } - if (m != NULL) { + if (!m.is_null()) { // We found the method. return m; } @@ -370,7 +368,7 @@ // ------------------------------------------------------------------ // ciEnv::get_instance_klass_for_declared_method_holder -instanceKlass* GraalEnv::get_instance_klass_for_declared_method_holder(KlassHandle method_holder) { +instanceKlassHandle GraalEnv::get_instance_klass_for_declared_method_holder(KlassHandle method_holder) { // For the case of <array>.clone(), the method holder can be a ciArrayKlass // instead of a ciInstanceKlass. For that case simply pretend that the // declared holder is Object.clone since that's where the call will bottom out. @@ -380,9 +378,9 @@ // only occurs for clone() the more extensive fix seems like overkill so // instead we simply smear the array type into Object. if (method_holder->oop_is_instance()) { - return instanceKlass::cast(method_holder()); + return instanceKlassHandle(method_holder()); } else if (method_holder->oop_is_array()) { - return instanceKlass::cast(SystemDictionary::Object_klass()); + return instanceKlassHandle(SystemDictionary::Object_klass()); } else { ShouldNotReachHere(); } @@ -394,7 +392,7 @@ // ciEnv::get_method_by_index methodHandle GraalEnv::get_method_by_index(constantPoolHandle cpool, int index, Bytecodes::Code bc, - instanceKlass* accessor) { + instanceKlassHandle accessor) { ResourceMark rm; assert(bc != Bytecodes::_invokedynamic, "invokedynamic not yet supported"); return get_method_by_index_impl(cpool, index, bc, accessor);