Mercurial > hg > graal-compiler
comparison src/share/vm/graal/graalRuntime.cpp @ 16628:d3fec84757ed
improved generated sources up-to-date check by using SHA1 digests
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Thu, 31 Jul 2014 13:42:56 +0200 |
parents | a7d9b88ecd68 |
children | 58622d6b1097 |
comparison
equal
deleted
inserted
replaced
16627:68deb37eed70 | 16628:d3fec84757ed |
---|---|
661 JavaValue result(T_OBJECT); | 661 JavaValue result(T_OBJECT); |
662 JavaCalls::call_static(&result, klass, makeInstance, sig, CHECK_NULL); | 662 JavaCalls::call_static(&result, klass, makeInstance, sig, CHECK_NULL); |
663 return JNIHandles::make_local((oop) result.get_jobject()); | 663 return JNIHandles::make_local((oop) result.get_jobject()); |
664 JVM_END | 664 JVM_END |
665 | 665 |
666 void GraalRuntime::check_generated_sources_sha1(TRAPS) { | |
667 TempNewSymbol name = SymbolTable::new_symbol("GeneratedSourcesSha1", CHECK_ABORT); | |
668 KlassHandle klass = load_required_class(name); | |
669 fieldDescriptor fd; | |
670 if (!InstanceKlass::cast(klass())->find_field(vmSymbols::value_name(), vmSymbols::string_signature(), true, &fd)) { | |
671 THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), "GeneratedSourcesSha1.value"); | |
672 } | |
673 | |
674 Symbol* value = java_lang_String::as_symbol(klass->java_mirror()->obj_field(fd.offset()), CHECK); | |
675 if (!value->equals(_generated_sources_sha1)) { | |
676 char buf[200]; | |
677 jio_snprintf(buf, sizeof(buf), "Generated sources SHA1 check failed (%s != %s) - need to rebuild the VM", value->as_C_string(), _generated_sources_sha1); | |
678 THROW_MSG(vmSymbols::java_lang_InternalError(), buf); | |
679 } | |
680 } | |
681 | |
666 Handle GraalRuntime::get_HotSpotGraalRuntime() { | 682 Handle GraalRuntime::get_HotSpotGraalRuntime() { |
667 if (JNIHandles::resolve(_HotSpotGraalRuntime_instance) == NULL) { | 683 if (JNIHandles::resolve(_HotSpotGraalRuntime_instance) == NULL) { |
668 Thread* THREAD = Thread::current(); | 684 Thread* THREAD = Thread::current(); |
685 check_generated_sources_sha1(CHECK_ABORT_(Handle())); | |
669 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotGraalRuntime", CHECK_ABORT_(Handle())); | 686 TempNewSymbol name = SymbolTable::new_symbol("com/oracle/graal/hotspot/HotSpotGraalRuntime", CHECK_ABORT_(Handle())); |
670 KlassHandle klass = load_required_class(name); | 687 KlassHandle klass = load_required_class(name); |
671 TempNewSymbol runtime = SymbolTable::new_symbol("runtime", CHECK_ABORT_(Handle())); | 688 TempNewSymbol runtime = SymbolTable::new_symbol("runtime", CHECK_ABORT_(Handle())); |
672 TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/graal/hotspot/HotSpotGraalRuntime;", CHECK_ABORT_(Handle())); | 689 TempNewSymbol sig = SymbolTable::new_symbol("()Lcom/oracle/graal/hotspot/HotSpotGraalRuntime;", CHECK_ABORT_(Handle())); |
673 JavaValue result(T_OBJECT); | 690 JavaValue result(T_OBJECT); |