comparison src/share/vm/graal/graalCodeInstaller.cpp @ 3667:e755289380e3

Removed a safepoint possibility in the code installer when creating CiVirtualObject objects.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 18 Nov 2011 13:07:25 +0100
parents 6e1abd79e7c8
children 46f211fe010c
comparison
equal deleted inserted replaced
3664:6e1abd79e7c8 3667:e755289380e3
184 } 184 }
185 tty->print("%i", type); 185 tty->print("%i", type);
186 } else if (value->is_a(CiVirtualObject::klass())) { 186 } else if (value->is_a(CiVirtualObject::klass())) {
187 oop type = CiVirtualObject::type(value); 187 oop type = CiVirtualObject::type(value);
188 int id = CiVirtualObject::id(value); 188 int id = CiVirtualObject::id(value);
189 ciKlass* klass = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type))); 189 instanceKlass* klass = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)));
190 assert(klass->is_instance_klass() || klass->is_array_klass(), "Not supported allocation."); 190 assert(klass->is_instance_klass() || klass->is_array_klass(), "Not supported allocation.");
191 191
192 for (jint i = 0; i < objects->length(); i++) { 192 for (jint i = 0; i < objects->length(); i++) {
193 ObjectValue* obj = (ObjectValue*) objects->at(i); 193 ObjectValue* obj = (ObjectValue*) objects->at(i);
194 if (obj->id() == id) { 194 if (obj->id() == id) {
195 return obj; 195 return obj;
196 } 196 }
197 } 197 }
198 198
199 ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(klass->constant_encoding())); 199 ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), klass->as_klassOop())));
200 200
201 arrayOop values = (arrayOop) CiVirtualObject::values(value); 201 arrayOop values = (arrayOop) CiVirtualObject::values(value);
202 for (jint i = 0; i < values->length(); i++) { 202 for (jint i = 0; i < values->length(); i++) {
203 ((oop*) values->base(T_OBJECT))[i]; 203 ((oop*) values->base(T_OBJECT))[i];
204 } 204 }
229 ShouldNotReachHere(); 229 ShouldNotReachHere();
230 return NULL; 230 return NULL;
231 } 231 }
232 232
233 // constructor used to create a method 233 // constructor used to create a method
234 CodeInstaller::CodeInstaller(Handle target_method, nmethod*& nm, bool install_code) { 234 CodeInstaller::CodeInstaller(Handle& target_method, nmethod*& nm, bool install_code) {
235 _env = CURRENT_ENV; 235 _env = CURRENT_ENV;
236 GraalCompiler::initialize_buffer_blob(); 236 GraalCompiler::initialize_buffer_blob();
237 CodeBuffer buffer(JavaThread::current()->get_buffer_blob()); 237 CodeBuffer buffer(JavaThread::current()->get_buffer_blob());
238 238
239 _oop_recorder = new OopRecorder(_env->arena()); 239 _oop_recorder = new OopRecorder(_env->arena());
273 } 273 }
274 method->clear_queued_for_compilation(); 274 method->clear_queued_for_compilation();
275 } 275 }
276 276
277 // constructor used to create a stub 277 // constructor used to create a stub
278 CodeInstaller::CodeInstaller(Handle target_method, jlong& id) { 278 CodeInstaller::CodeInstaller(Handle& target_method, jlong& id) {
279 No_Safepoint_Verifier no_safepoint; 279 No_Safepoint_Verifier no_safepoint;
280 _env = CURRENT_ENV; 280 _env = CURRENT_ENV;
281 281
282 _oop_recorder = new OopRecorder(_env->arena()); 282 _oop_recorder = new OopRecorder(_env->arena());
283 _env->set_oop_recorder(_oop_recorder); 283 _env->set_oop_recorder(_oop_recorder);