Mercurial > hg > graal-jvmci-8
comparison src/share/vm/c1x/c1x_Compiler.cpp @ 1458:dc114f680d9c
Merge.
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Sat, 13 Nov 2010 08:15:52 +0100 |
parents | 9b22e3e5df8e |
children | a8f9f091c219 |
comparison
equal
deleted
inserted
replaced
1457:572d4c6d6ce6 | 1458:dc114f680d9c |
---|---|
43 JNIEnv *env = ((JavaThread *) Thread::current())->jni_environment(); | 43 JNIEnv *env = ((JavaThread *) Thread::current())->jni_environment(); |
44 jclass klass = env->FindClass("com/sun/hotspot/c1x/VMEntriesNative"); | 44 jclass klass = env->FindClass("com/sun/hotspot/c1x/VMEntriesNative"); |
45 assert(klass != NULL, "c1x VMEntries class not found"); | 45 assert(klass != NULL, "c1x VMEntries class not found"); |
46 env->RegisterNatives(klass, VMEntries_methods, VMEntries_methods_count()); | 46 env->RegisterNatives(klass, VMEntries_methods, VMEntries_methods_count()); |
47 | 47 |
48 check_pending_exception("Could not register natives"); | 48 { |
49 VM_ENTRY_MARK; | |
50 check_pending_exception("Could not register natives"); | |
51 } | |
49 | 52 |
50 c1x_compute_offsets(); | 53 c1x_compute_offsets(); |
51 | 54 |
52 { | 55 { |
53 VM_ENTRY_MARK; | 56 VM_ENTRY_MARK; |
81 // Print compilation timers and statistics | 84 // Print compilation timers and statistics |
82 void C1XCompiler::print_timers() { | 85 void C1XCompiler::print_timers() { |
83 TRACE_C1X_1("C1XCompiler::print_timers"); | 86 TRACE_C1X_1("C1XCompiler::print_timers"); |
84 } | 87 } |
85 | 88 |
86 oop C1XCompiler::get_RiType(ciType *type, klassOop accessor, TRAPS) { | 89 oop C1XCompiler::get_RiType(ciType *type, KlassHandle accessor, TRAPS) { |
87 if (type->is_loaded()) { | 90 if (type->is_loaded()) { |
88 if (type->is_primitive_type()) { | 91 if (type->is_primitive_type()) { |
89 return VMExits::createRiTypePrimitive((int) type->basic_type(), THREAD); | 92 return VMExits::createRiTypePrimitive((int) type->basic_type(), THREAD); |
90 } | 93 } |
91 KlassHandle klass = (klassOop) type->get_oop(); | 94 KlassHandle klass = (klassOop) type->get_oop(); |
92 Handle name = VmIds::toString<Handle>(klass->name(), THREAD); | 95 Handle name = VmIds::toString<Handle>(klass->name(), THREAD); |
93 return createHotSpotTypeResolved(klass, name, CHECK_NULL); | 96 return createHotSpotTypeResolved(klass, name, CHECK_NULL); |
94 } else { | 97 } else { |
95 symbolOop name = ((ciKlass *) type)->name()->get_symbolOop(); | 98 symbolOop name = ((ciKlass *) type)->name()->get_symbolOop(); |
96 return VMExits::createRiTypeUnresolved(VmIds::toString<Handle>(name, THREAD), VmIds::add<klassOop>(accessor), THREAD); | 99 return VMExits::createRiTypeUnresolved(VmIds::toString<Handle>(name, THREAD), VmIds::add<klassOop>(accessor()), THREAD); |
97 } | 100 } |
98 } | 101 } |
99 | 102 |
100 oop C1XCompiler::get_RiField(ciField *field, klassOop accessor, TRAPS) { | 103 oop C1XCompiler::get_RiField(ciField *field, KlassHandle accessor, Bytecodes::Code byteCode, TRAPS) { |
101 Handle field_holder = get_RiType(field->holder(), accessor, CHECK_0); | 104 Handle field_holder = get_RiType(field->holder(), accessor, CHECK_0); |
102 Handle field_type = get_RiType(field->type(), accessor, CHECK_0); | 105 Handle field_type = get_RiType(field->type(), accessor, CHECK_0); |
103 Handle field_name = VmIds::toString<Handle>(field->name()->get_symbolOop(), CHECK_0); | 106 Handle field_name = VmIds::toString<Handle>(field->name()->get_symbolOop(), CHECK_0); |
104 int offset = field->holder()->is_loaded() ? field->offset() : -1; | 107 |
108 ciInstanceKlass* accessor_klass = (ciInstanceKlass *) CURRENT_ENV->get_object(accessor()); | |
109 bool will_link; | |
110 { | |
111 ThreadToNativeFromVM trans((JavaThread*)THREAD); | |
112 will_link = field->will_link(accessor_klass, byteCode); | |
113 } | |
114 | |
115 int offset = (field->holder()->is_loaded() && will_link) ? field->offset() : -1; | |
105 | 116 |
106 // TODO: implement caching | 117 // TODO: implement caching |
107 return VMExits::createRiField(field_holder, field_name, field_type, offset, THREAD); | 118 return VMExits::createRiField(field_holder, field_name, field_type, offset, THREAD); |
108 } | 119 } |
109 | 120 |