Mercurial > hg > graal-jvmci-8
comparison src/share/vm/c1x/c1x_Compiler.cpp @ 1414:e1a275dbc8cd
Executing a+b with C1X on HotSpot ;-) !
author | Thomas Wuerthinger <thomas.wuerthinger@gmail.com> |
---|---|
date | Tue, 18 May 2010 21:53:05 +0200 |
parents | 1ecc8f0aad00 |
children | 55ac38887415 |
comparison
equal
deleted
inserted
replaced
1413:1ecc8f0aad00 | 1414:e1a275dbc8cd |
---|---|
27 # include "incls/_c1x_Compiler.cpp.incl" | 27 # include "incls/_c1x_Compiler.cpp.incl" |
28 | 28 |
29 | 29 |
30 // Initialization | 30 // Initialization |
31 void C1XCompiler::initialize() { | 31 void C1XCompiler::initialize() { |
32 if (_initialized) return; | |
33 _initialized = true; | |
32 TRACE_C1X_1("initialize"); | 34 TRACE_C1X_1("initialize"); |
33 | 35 |
34 JNIEnv *env = ((JavaThread *)Thread::current())->jni_environment(); | 36 JNIEnv *env = ((JavaThread *)Thread::current())->jni_environment(); |
35 jclass klass = env->FindClass("com/sun/hotspot/c1x/VMEntries"); | 37 jclass klass = env->FindClass("com/sun/hotspot/c1x/VMEntries"); |
36 env->RegisterNatives(klass, VMEntries_methods, VMEntries_methods_count() ); | 38 env->RegisterNatives(klass, VMEntries_methods, VMEntries_methods_count() ); |
49 | 51 |
50 VM_ENTRY_MARK; | 52 VM_ENTRY_MARK; |
51 | 53 |
52 | 54 |
53 ResourceMark rm; | 55 ResourceMark rm; |
54 HandleMark hm; | 56 //HandleMark hm; |
55 | 57 |
56 CompilerThread::current()->set_compiling(true); | 58 CompilerThread::current()->set_compiling(true); |
57 oop rimethod = get_RiMethod(target); | 59 oop rimethod = get_RiMethod(target); |
58 VMExits::compileMethod(rimethod, entry_bci); | 60 VMExits::compileMethod(rimethod, entry_bci); |
59 CompilerThread::current()->set_compiling(false); | 61 CompilerThread::current()->set_compiling(false); |
104 // TODO: implement caching | 106 // TODO: implement caching |
105 return VMExits::createRiConstantPool(cp); | 107 return VMExits::createRiConstantPool(cp); |
106 } | 108 } |
107 | 109 |
108 oop C1XCompiler::get_RiType(symbolOop klass, klassOop accessingType) { | 110 oop C1XCompiler::get_RiType(symbolOop klass, klassOop accessingType) { |
111 if (klass == vmSymbols::byte_signature()) { | |
112 return VMExits::createRiTypePrimitive((int)T_BYTE); | |
113 } else if (klass == vmSymbols::char_signature()) { | |
114 return VMExits::createRiTypePrimitive((int)T_CHAR); | |
115 } else if (klass == vmSymbols::double_signature()) { | |
116 return VMExits::createRiTypePrimitive((int)T_DOUBLE); | |
117 } else if (klass == vmSymbols::float_signature()) { | |
118 return VMExits::createRiTypePrimitive((int)T_FLOAT); | |
119 } else if (klass == vmSymbols::int_signature()) { | |
120 return VMExits::createRiTypePrimitive((int)T_INT); | |
121 } else if (klass == vmSymbols::long_signature()) { | |
122 return VMExits::createRiTypePrimitive((int)T_LONG); | |
123 } else if (klass == vmSymbols::bool_signature()) { | |
124 return VMExits::createRiTypePrimitive((int)T_BOOLEAN); | |
125 } | |
109 klassOop resolved_type = SystemDictionary::resolve_or_null(klass, accessingType->klass_part()->class_loader(), accessingType->klass_part()->protection_domain(), Thread::current()); | 126 klassOop resolved_type = SystemDictionary::resolve_or_null(klass, accessingType->klass_part()->class_loader(), accessingType->klass_part()->protection_domain(), Thread::current()); |
110 if (resolved_type == NULL) { | 127 if (resolved_type != NULL) { |
111 return get_RiType(resolved_type); | 128 return get_RiType(resolved_type); |
112 } else { | 129 } else { |
113 return get_unresolved_RiType(klass, accessingType); | 130 return get_unresolved_RiType(klass, accessingType); |
114 } | 131 } |
115 } | 132 } |