comparison src/share/vm/graal/graalCodeInstaller.cpp @ 3668:46f211fe010c

Removed global handle usage in ci interface.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 18 Nov 2011 13:30:47 +0100
parents e755289380e3
children 53636e2c9d03
comparison
equal deleted inserted replaced
3667:e755289380e3 3668:46f211fe010c
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 instanceKlass* klass = instanceKlass::cast(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.");
191 190
192 for (jint i = 0; i < objects->length(); i++) { 191 for (jint i = 0; i < objects->length(); i++) {
193 ObjectValue* obj = (ObjectValue*) objects->at(i); 192 ObjectValue* obj = (ObjectValue*) objects->at(i);
194 if (obj->id() == id) { 193 if (obj->id() == id) {
195 return obj; 194 return obj;
228 } 227 }
229 ShouldNotReachHere(); 228 ShouldNotReachHere();
230 return NULL; 229 return NULL;
231 } 230 }
232 231
233 // constructor used to create a method 232 void CodeInstaller::initialize_assumptions(Handle& target_method) {
234 CodeInstaller::CodeInstaller(Handle& target_method, nmethod*& nm, bool install_code) {
235 _env = CURRENT_ENV;
236 GraalCompiler::initialize_buffer_blob();
237 CodeBuffer buffer(JavaThread::current()->get_buffer_blob());
238
239 _oop_recorder = new OopRecorder(_env->arena()); 233 _oop_recorder = new OopRecorder(_env->arena());
240 _env->set_oop_recorder(_oop_recorder); 234 _env->set_oop_recorder(_oop_recorder);
241 _env->set_dependencies(_dependencies); 235 _env->set_dependencies(_dependencies);
242 _dependencies = new Dependencies(_env); 236 _dependencies = new Dependencies(_env);
243 Handle assumptions_handle = CiTargetMethod::assumptions(HotSpotTargetMethod::targetMethod(target_method)); 237 Handle assumptions_handle = CiTargetMethod::assumptions(HotSpotTargetMethod::targetMethod(target_method));
255 fatal("unexpected Assumption subclass"); 249 fatal("unexpected Assumption subclass");
256 } 250 }
257 } 251 }
258 } 252 }
259 } 253 }
254 }
255
256 // constructor used to create a method
257 CodeInstaller::CodeInstaller(Handle& target_method, nmethod*& nm, bool install_code) {
258 _env = CURRENT_ENV;
259 GraalCompiler::initialize_buffer_blob();
260 CodeBuffer buffer(JavaThread::current()->get_buffer_blob());
261 initialize_assumptions(target_method);
260 262
261 { 263 {
262 No_Safepoint_Verifier no_safepoint; 264 No_Safepoint_Verifier no_safepoint;
263 initialize_fields(target_method); 265 initialize_fields(target_method);
264 initialize_buffer(buffer); 266 initialize_buffer(buffer);
293 BufferBlob* blob = BufferBlob::create(strdup(cname), &buffer); // this is leaking strings... but only a limited number of stubs will be created 295 BufferBlob* blob = BufferBlob::create(strdup(cname), &buffer); // this is leaking strings... but only a limited number of stubs will be created
294 IF_TRACE_graal_3 Disassembler::decode((CodeBlob*) blob); 296 IF_TRACE_graal_3 Disassembler::decode((CodeBlob*) blob);
295 id = VmIds::addStub(blob->code_begin()); 297 id = VmIds::addStub(blob->code_begin());
296 } 298 }
297 299
298 void CodeInstaller::initialize_fields(Handle target_method) { 300 void CodeInstaller::initialize_fields(Handle& target_method) {
299 _citarget_method = HotSpotTargetMethod::targetMethod(target_method); 301 _citarget_method = HotSpotTargetMethod::targetMethod(target_method);
300 _hotspot_method = HotSpotTargetMethod::method(target_method); 302 _hotspot_method = HotSpotTargetMethod::method(target_method);
301 if (_hotspot_method != NULL) { 303 if (_hotspot_method != NULL) {
302 _parameter_count = getMethodFromHotSpotMethod(_hotspot_method)->size_of_parameters(); 304 _parameter_count = getMethodFromHotSpotMethod(_hotspot_method)->size_of_parameters();
303 } 305 }