comparison src/share/vm/shark/sharkConstant.cpp @ 7195:2cd5e15048e6

8003868: fix shark for latest HotSpot and LLVM Reviewed-by: twisti Contributed-by: Roman Kennke <rkennke@redhat.com>
author twisti
date Tue, 27 Nov 2012 12:48:52 -0800
parents f95d63e2154a
children 606eada1bf86
comparison
equal deleted inserted replaced
7194:beebba0acc11 7195:2cd5e15048e6
35 SharkConstant* SharkConstant::for_ldc(ciBytecodeStream *iter) { 35 SharkConstant* SharkConstant::for_ldc(ciBytecodeStream *iter) {
36 ciConstant constant = iter->get_constant(); 36 ciConstant constant = iter->get_constant();
37 ciType *type = NULL; 37 ciType *type = NULL;
38 if (constant.basic_type() == T_OBJECT) { 38 if (constant.basic_type() == T_OBJECT) {
39 ciEnv *env = ciEnv::current(); 39 ciEnv *env = ciEnv::current();
40 if (constant.as_object()->is_klass()) 40 assert(constant.as_object()->klass() == env->String_klass() || constant.as_object()->klass() == env->Class_klass(), "should be");
41 type = env->Class_klass(); 41 type = constant.as_object()->klass();
42 else
43 type = env->String_klass();
44 } 42 }
45 return new SharkConstant(constant, type); 43 return new SharkConstant(constant, type);
46 } 44 }
47 45
48 SharkConstant* SharkConstant::for_field(ciBytecodeStream *iter) { 46 SharkConstant* SharkConstant::for_field(ciBytecodeStream *iter) {
106 // ciObjects are psuedo-objects that refer to oops which 104 // ciObjects are psuedo-objects that refer to oops which
107 // have yet to be created. We need to spot the unloaded 105 // have yet to be created. We need to spot the unloaded
108 // objects (which differ between ldc* and get*, thanks!) 106 // objects (which differ between ldc* and get*, thanks!)
109 ciObject *object = constant.as_object(); 107 ciObject *object = constant.as_object();
110 assert(type != NULL, "shouldn't be"); 108 assert(type != NULL, "shouldn't be");
111 if (object->is_klass()) { 109
112 // The constant returned for a klass is the ciKlass 110 if ((! object->is_null_object()) && object->klass() == ciEnv::current()->Class_klass()) {
113 // for the entry, but we want the java_mirror. 111 ciKlass *klass = object->klass();
114 ciKlass *klass = object->as_klass(); 112 if (! klass->is_loaded()) {
115 if (!klass->is_loaded()) {
116 _is_loaded = false; 113 _is_loaded = false;
117 return; 114 return;
118 } 115 }
119 object = klass->java_mirror();
120 } 116 }
121 if (object->is_null_object() || !object->can_be_constant()) { 117
118 if (object->is_null_object() || ! object->can_be_constant() || ! object->is_loaded()) {
122 _is_loaded = false; 119 _is_loaded = false;
123 return; 120 return;
124 } 121 }
125 122
126 _value = NULL; 123 _value = NULL;