Mercurial > hg > truffle
comparison src/share/vm/graal/graalRuntime.cpp @ 13578:d8143c431d63
Add DynamicNewInstanceNode and use it to intrinsify Unsafe.allocateInstance
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Thu, 09 Jan 2014 11:29:56 +0100 |
parents | e27f3169460e |
children | 682fba1bcf95 |
comparison
equal
deleted
inserted
replaced
13577:6135e289d260 | 13578:d8143c431d63 |
---|---|
134 JRT_ENTRY(void, GraalRuntime::dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length)) | 134 JRT_ENTRY(void, GraalRuntime::dynamic_new_array(JavaThread* thread, oopDesc* element_mirror, jint length)) |
135 oop obj = Reflection::reflect_new_array(element_mirror, length, CHECK); | 135 oop obj = Reflection::reflect_new_array(element_mirror, length, CHECK); |
136 thread->set_vm_result(obj); | 136 thread->set_vm_result(obj); |
137 JRT_END | 137 JRT_END |
138 | 138 |
139 JRT_ENTRY(void, GraalRuntime::dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror)) | |
140 instanceKlassHandle klass(THREAD, java_lang_Class::as_Klass(type_mirror)); | |
141 | |
142 if (klass == NULL) { | |
143 ResourceMark rm(THREAD); | |
144 THROW(vmSymbols::java_lang_InstantiationException()); | |
145 } | |
146 | |
147 // Create new instance (the receiver) | |
148 klass->check_valid_for_instantiation(false, CHECK); | |
149 | |
150 // Make sure klass gets initialized | |
151 klass->initialize(CHECK); | |
152 | |
153 oop obj = klass->allocate_instance(CHECK); | |
154 thread->set_vm_result(obj); | |
155 JRT_END | |
156 | |
139 extern void vm_exit(int code); | 157 extern void vm_exit(int code); |
140 | 158 |
141 // Enter this method from compiled code handler below. This is where we transition | 159 // Enter this method from compiled code handler below. This is where we transition |
142 // to VM mode. This is done as a helper routine so that the method called directly | 160 // to VM mode. This is done as a helper routine so that the method called directly |
143 // from compiled code does not have to transition to VM. This allows the entry | 161 // from compiled code does not have to transition to VM. This allows the entry |