[oe] [meta-java][PATCH 2/2] openjdk-8: better interface invocations
Attie Grande
attie.grande at argentum-systems.co.uk
Fri Nov 30 13:10:23 UTC 2018
Fixes a SEGFAULT when OpenJDK 8 is build for an i.MX6 platform, possibly
others.
The original patch (below) has been modified to work with jdk8.
Further information:
https://bugs.openjdk.java.net/browse/JDK-8194739
http://hg.openjdk.java.net/jdk/jdk10/rev/69d1a1590485
Signed-off-by: Attie Grande <attie.grande at argentum-systems.co.uk>
---
recipes-core/openjdk/openjdk-8-release-16xbyy.inc | 1 +
.../JDK-8194739-better-interface-invocations.patch | 62 ++++++++++++++++++++++
2 files changed, 63 insertions(+)
create mode 100644
recipes-core/openjdk/patches-openjdk-8/JDK-8194739-better-interface-invocations.patch
diff --git a/recipes-core/openjdk/openjdk-8-release-16xbyy.inc
b/recipes-core/openjdk/openjdk-8-release-16xbyy.inc
index 23c99fe..b7cdede 100644
--- a/recipes-core/openjdk/openjdk-8-release-16xbyy.inc
+++ b/recipes-core/openjdk/openjdk-8-release-16xbyy.inc
@@ -17,6 +17,7 @@ PATCHES_URI = "\
file://0009-jdk-disable-backtrace-musl-build-fix.patch \
file://0010-build-fix-build-on-as-needed-toolchains-generic.patch \
file://JDK-8202600-undefined-behaviour-in-os_linux_zero.cpp.patch \
+ file://JDK-8194739-better-interface-invocations.patch \
"
# some patches extracted from
http://cr.openjdk.java.net/~rkennke/shark-build-hotspot/webrev.01/hotspot.patch
# reported via
http://mail.openjdk.java.net/pipermail/build-dev/2015-January/013972.html
diff --git a/recipes-core/openjdk/patches-openjdk-8/JDK-8194739-better-interface-invocations.patch
b/recipes-core/openjdk/patches-openjdk-8/JDK-8194739-better-interface-invocations.patch
new file mode 100644
index 0000000..a185dac
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/JDK-8194739-better-interface-invocations.patch
@@ -0,0 +1,62 @@
+--- a/hotspot/src/cpu/zero/vm/methodHandles_zero.cpp Tue Dec 19
17:31:53 2017 -0500
++++ b/hotspot/src/cpu/zero/vm/methodHandles_zero.cpp Mon Jan 22
15:19:02 2018 +0000
+@@ -180,3 +180,9 @@
+ return NULL;
+ }
+ }
++
++#ifndef PRODUCT
++void MethodHandles::trace_method_handle(MacroAssembler* _masm, const
char* adaptername) {
++ // This is just a stub.
++}
++#endif //PRODUCT
+--- a/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp Tue
Dec 19 17:31:53 2017 -0500
++++ b/hotspot/src/share/vm/interpreter/bytecodeInterpreter.cpp Mon
Jan 22 15:19:02 2018 +0000
+@@ -2569,13 +2569,35 @@
+
+ // this could definitely be cleaned up QQQ
+ Method* callee;
+- Klass* iclass = cache->f1_as_klass();
+- // InstanceKlass* interface = (InstanceKlass*) iclass;
++ Method *interface_method = cache->f2_as_interface_method();
++ InstanceKlass* iclass = interface_method->method_holder();
++
+ // get receiver
+ int parms = cache->parameter_size();
+ oop rcvr = STACK_OBJECT(-parms);
+ CHECK_NULL(rcvr);
+ InstanceKlass* int2 = (InstanceKlass*) rcvr->klass();
++
++ // Receiver subtype check against resolved interface klass (REFC).
++ {
++ Klass* refc = cache->f1_as_klass();
++ itableOffsetEntry* scan;
++ for (scan = (itableOffsetEntry*) int2->start_of_itable();
++ scan->interface_klass() != NULL;
++ scan++) {
++ if (scan->interface_klass() == refc) {
++ break;
++ }
++ }
++ // Check that the entry is non-null. A null entry means
++ // that the receiver class doesn't implement the
++ // interface, and wasn't the same as when the caller was
++ // compiled.
++ if (scan->interface_klass() == NULL) {
++ VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(),
"", note_no_trap);
++ }
++ }
++
+ itableOffsetEntry* ki = (itableOffsetEntry*) int2->start_of_itable();
+ int i;
+ for ( i = 0 ; i < int2->itable_length() ; i++, ki++ ) {
+@@ -2587,7 +2608,8 @@
+ if (i == int2->itable_length()) {
+ VM_JAVA_ERROR(vmSymbols::java_lang_IncompatibleClassChangeError(),
"", note_no_trap);
+ }
+- int mindex = cache->f2_as_index();
++ int mindex = interface_method->itable_index();
++
+ itableMethodEntry* im = ki->first_method_entry(rcvr->klass());
+ callee = im[mindex].method();
+ if (callee == NULL) {
--
2.7.4
More information about the Openembedded-devel
mailing list