comparison src/share/vm/jvmci/jvmciCodeInstaller.cpp @ 22535:ca418f35d728

Use wordKind instead of Kind.Object in backend.
author Roland Schatz <roland.schatz@oracle.com>
date Tue, 08 Sep 2015 17:43:41 +0200
parents df053711614b
children dc1aeef79e7e
comparison
equal deleted inserted replaced
22534:bab91f9ae795 22535:ca418f35d728
175 175
176 static void record_metadata_in_patch(Handle& constant, OopRecorder* oop_recorder) { 176 static void record_metadata_in_patch(Handle& constant, OopRecorder* oop_recorder) {
177 record_metadata_reference(HotSpotMetaspaceConstantImpl::metaspaceObject(constant), HotSpotMetaspaceConstantImpl::primitive(constant), HotSpotMetaspaceConstantImpl::compressed(constant), oop_recorder); 177 record_metadata_reference(HotSpotMetaspaceConstantImpl::metaspaceObject(constant), HotSpotMetaspaceConstantImpl::primitive(constant), HotSpotMetaspaceConstantImpl::compressed(constant), oop_recorder);
178 } 178 }
179 179
180 static Location::Type get_oop_type(oop value) { 180 Location::Type CodeInstaller::get_oop_type(oop value) {
181 oop lirKind = Value::lirKind(value); 181 oop lirKind = Value::lirKind(value);
182 oop platformKind = LIRKind::platformKind(lirKind); 182 oop platformKind = LIRKind::platformKind(lirKind);
183 assert(LIRKind::referenceMask(lirKind) == 1, "unexpected referenceMask"); 183 assert(LIRKind::referenceMask(lirKind) == 1, "unexpected referenceMask");
184 184
185 if (JVMCIRuntime::kindToBasicType(Kind::typeChar(platformKind)) == T_INT) { 185 if (platformKind == word_kind()) {
186 return Location::oop;
187 } else {
186 return Location::narrowoop; 188 return Location::narrowoop;
187 } else {
188 return Location::oop;
189 } 189 }
190 } 190 }
191 191
192 ScopeValue* CodeInstaller::get_scope_value(oop value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second) { 192 ScopeValue* CodeInstaller::get_scope_value(oop value, BasicType type, GrowableArray<ScopeValue*>* objects, ScopeValue* &second) {
193 second = NULL; 193 second = NULL;
402 // Get instructions and constants CodeSections early because we need it. 402 // Get instructions and constants CodeSections early because we need it.
403 _instructions = buffer.insts(); 403 _instructions = buffer.insts();
404 _constants = buffer.consts(); 404 _constants = buffer.consts();
405 405
406 { 406 {
407 initialize_fields(JNIHandles::resolve(compiled_code_obj)); 407 jobject target_obj = JNIHandles::make_local(target());
408 initialize_fields(JNIHandles::resolve(target_obj), JNIHandles::resolve(compiled_code_obj));
408 if (!initialize_buffer(buffer)) { 409 if (!initialize_buffer(buffer)) {
409 return JVMCIEnv::code_too_large; 410 return JVMCIEnv::code_too_large;
410 } 411 }
411 process_exception_handlers(); 412 process_exception_handlers();
412 } 413 }
447 guarantee((cb->code_begin() - cb->content_begin()) >= _constants_size, err_msg("%d < %d", (int)(cb->code_begin() - cb->content_begin()), _constants_size)); 448 guarantee((cb->code_begin() - cb->content_begin()) >= _constants_size, err_msg("%d < %d", (int)(cb->code_begin() - cb->content_begin()), _constants_size));
448 } 449 }
449 return result; 450 return result;
450 } 451 }
451 452
452 void CodeInstaller::initialize_fields(oop compiled_code) { 453 void CodeInstaller::initialize_fields(oop target, oop compiled_code) {
453 if (compiled_code->is_a(HotSpotCompiledNmethod::klass())) { 454 if (compiled_code->is_a(HotSpotCompiledNmethod::klass())) {
454 Handle hotspotJavaMethod = HotSpotCompiledNmethod::method(compiled_code); 455 Handle hotspotJavaMethod = HotSpotCompiledNmethod::method(compiled_code);
455 methodHandle method = getMethodFromHotSpotMethod(hotspotJavaMethod()); 456 methodHandle method = getMethodFromHotSpotMethod(hotspotJavaMethod());
456 _parameter_count = method->size_of_parameters(); 457 _parameter_count = method->size_of_parameters();
457 TRACE_jvmci_2("installing code for %s", method->name_and_sig_as_C_string()); 458 TRACE_jvmci_2("installing code for %s", method->name_and_sig_as_C_string());
480 #endif 481 #endif
481 482
482 _next_call_type = INVOKE_INVALID; 483 _next_call_type = INVOKE_INVALID;
483 484
484 _has_wide_vector = false; 485 _has_wide_vector = false;
486
487 oop arch = TargetDescription::arch(target);
488 _word_kind_handle = JNIHandles::make_local(Architecture::wordKind(arch));
485 } 489 }
486 490
487 int CodeInstaller::estimate_stub_entries() { 491 int CodeInstaller::estimate_stub_entries() {
488 // Estimate the number of static call stubs that might be emitted. 492 // Estimate the number of static call stubs that might be emitted.
489 int static_call_stubs = 0; 493 int static_call_stubs = 0;