Mercurial > hg > truffle
diff 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 |
line wrap: on
line diff
--- a/src/share/vm/graal/graalRuntime.cpp Tue Dec 31 17:23:54 2013 +0100 +++ b/src/share/vm/graal/graalRuntime.cpp Thu Jan 09 11:29:56 2014 +0100 @@ -136,6 +136,24 @@ thread->set_vm_result(obj); JRT_END +JRT_ENTRY(void, GraalRuntime::dynamic_new_instance(JavaThread* thread, oopDesc* type_mirror)) + instanceKlassHandle klass(THREAD, java_lang_Class::as_Klass(type_mirror)); + + if (klass == NULL) { + ResourceMark rm(THREAD); + THROW(vmSymbols::java_lang_InstantiationException()); + } + + // Create new instance (the receiver) + klass->check_valid_for_instantiation(false, CHECK); + + // Make sure klass gets initialized + klass->initialize(CHECK); + + oop obj = klass->allocate_instance(CHECK); + thread->set_vm_result(obj); +JRT_END + extern void vm_exit(int code); // Enter this method from compiled code handler below. This is where we transition