RFR(XS): 8187669: [MVT] ValueTypeHolder::unreflectWithers fails with ClassFormatError: Illegal method name
Lois Foltan
lois.foltan at oracle.com
Tue Sep 19 15:23:52 UTC 2017
On 9/19/2017 7:52 AM, Tobias Hartmann wrote:
> Hi,
>
> I noticed that initialization of
> test/compiler/valhalla/valuetypes/ValueCapableClass2.java fails with
> "ClassFormatError: Illegal method name
> "compiler.valhalla.valuetypes.ValueCapableClass2_unreflectWithers"" if
> the verifier is enabled.
>
> The problem is that ValueCapableClass2 is declared in a package and
> ValueTypeHolder::getOrLoad uses sourceClass().getName() for the method
> name which contains the package path.
Hi Tobias,
Test hotspot/test/runtime/valhalla/valuetypes/ValueOops.java is hitting
this issue as well and I was unable to remove the "-noverify" option for
it. I entered a bug suggesting that the fully qualified binary name
should be translated from '.' to '/' before reaching the JVM. See
bug, https://bugs.openjdk.java.net/browse/JDK-8186874. Due to JVM
access checks that now involve checks for readability/exportability of a
module & package a class is defined to, I suspect that it is important
for the JVM to have the fully qualified name and not the simple name.
Thanks,
Lois
>
> We should use "getSimpleName":
>
> --- a/src/java.base/share/classes/valhalla/shady/ValueTypeHolder.java
> Fri Sep 15 13:49:03 2017 -0700
> +++ b/src/java.base/share/classes/valhalla/shady/ValueTypeHolder.java
> Tue Sep 19 13:51:32 2017 +0200
> @@ -495,7 +495,7 @@
> private MethodHandle getOrLoad(Lookup lookup, ValueHandleKey key,
> Supplier<MethodType> typeSupplier, Consumer<? super
> MethodHandleCodeBuilder<?>> codeBuilder) {
> MethodHandle result = handleMap.get(key);
> if (result == null) {
> - String handleDebugName = sourceClass().getName() + "_" +
> key.kind.handleName();
> + String handleDebugName = sourceClass().getSimpleName() +
> "_" + key.kind.handleName();
> result = MethodHandleBuilder.loadCode(lookup,
> handleDebugName, typeSupplier.get(), codeBuilder);
> handleMap.put(key, result);
> }
>
> Thanks,
> Tobias
More information about the valhalla-dev
mailing list