RFR(XS): 8155735: use strings instead of Symbol* in JVMCI exception stubs
Tom Rodriguez
tom.rodriguez at oracle.com
Fri Apr 29 19:49:22 UTC 2016
> On Apr 29, 2016, at 8:55 AM, Roland Schatz <roland.schatz at oracle.com> wrote:
>
> On 04/29/2016 05:27 PM, Tom Rodriguez wrote:
>> I think you need to handle the case where the symbol doesn’t exist. lookup_symbol will return NULL if there’s no currently loaded symbol with that name which will lead to a SEGV later. So you either need to throw an exception here or you should use
>>
>> TempNewSymbol symbol = SymbolTable::new_symbol
>
> SymbolTable::lookup should add it if it doesn't exist.
Sorry I was looking at the comment below lookup instead of above it. It’s very odd that both of these exist though and new_symbol just forwards to lookup.
static Symbol* new_symbol(const char* utf8_buffer, int length, TRAPS) {
static Symbol* lookup(const char* name, int len, TRAPS);
I do think you want the TempNewSymbol though.
>
>> and let new_exception throw an exception if the class named by symbol doesn’t exist.
>
> throw_and_post_jvmti_exception will throw a `NoClassDefFoundError` when the exception class doesn't exist.
>
>
> Just to be sure, I tested this using graal. Temporarily passing in a wrong class name into the stub results in:
>> java.lang.NoClassDefFoundError: bla/java/lang/NullPointerException
>> at com.oracle.graal.replacements.test.CompiledNullPointerExceptionTest.testSnippet(CompiledNullPointerExceptionTest.java:93)
>> at jdk.vm.ci.hotspot.CompilerToVM.executeInstalledCode(Native Method)
>> at jdk.vm.ci.hotspot.HotSpotNmethod.executeVarargs(HotSpotNmethod.java:100)
>> at com.oracle.graal.compiler.test.GraalCompilerTest.executeActual(GraalCompilerTest.java:578)
>> […]
Thanks for checking.
tom
>
>
> - Roland
>
More information about the hotspot-compiler-dev
mailing list