All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-java][sumo][PATCH] openjdk-8-16xbyy: port better interface invocation from aarch32
@ 2019-02-04 21:37 Kyle Russell
  0 siblings, 0 replies; only message in thread
From: Kyle Russell @ 2019-02-04 21:37 UTC (permalink / raw)
  To: openembedded-devel

Fixes regression from new interface invocation implementation.  In one
crash, cache->f2_as_index() returns a Method* instead of an index into
the itable during static initialization of sun.reflect.Reflection when
attempting an invokeinterface on Map.put().

Upstream-Status: Backport
[OpenJDK: https://bugs.openjdk.java.net/browse/JDK-8194739]

Signed-off-by: Kyle Russell <bkylerussell@gmail.com>
---
 .../openjdk/openjdk-8-release-16xbyy.inc      |  3 +
 ...arch32-interface-invocation-segv-fix.patch | 74 +++++++++++++++++++
 2 files changed, 77 insertions(+)
 create mode 100644 recipes-core/openjdk/patches-openjdk-8/openjdk8-aarch32-interface-invocation-segv-fix.patch

diff --git a/recipes-core/openjdk/openjdk-8-release-16xbyy.inc b/recipes-core/openjdk/openjdk-8-release-16xbyy.inc
index bd4a349..cffc7c2 100644
--- a/recipes-core/openjdk/openjdk-8-release-16xbyy.inc
+++ b/recipes-core/openjdk/openjdk-8-release-16xbyy.inc
@@ -17,6 +17,9 @@ PATCHES_URI = "\
     file://0009-jdk-disable-backtrace-musl-build-fix.patch \
     file://0010-build-fix-build-on-as-needed-toolchains-generic.patch \
 "
+PATCHES_URI_append_class-target_arm = "\
+    file://openjdk8-aarch32-interface-invocation-segv-fix.patch;patchdir=${S}/hotspot \
+"
 # 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
 # by Roman Kennke (rkennke at redhat.com)
diff --git a/recipes-core/openjdk/patches-openjdk-8/openjdk8-aarch32-interface-invocation-segv-fix.patch b/recipes-core/openjdk/patches-openjdk-8/openjdk8-aarch32-interface-invocation-segv-fix.patch
new file mode 100644
index 0000000..249db17
--- /dev/null
+++ b/recipes-core/openjdk/patches-openjdk-8/openjdk8-aarch32-interface-invocation-segv-fix.patch
@@ -0,0 +1,74 @@
+
+# HG changeset patch
+# User aph
+# Date 1516634342 0
+# Node ID 56123fdca84a3b253b8ea6f72be85bd2ebf39fd0
+# Parent  1252eaaa2c8bc3493038e87483ac08ccadbbdf51
+8194739: Zero port of 8174962: Better interface invocations
+Reviewed-by: adinn, coleenp
+
+diff -r 1252eaaa2c8b -r 56123fdca84a src/cpu/zero/vm/methodHandles_zero.cpp
+--- a/src/cpu/zero/vm/methodHandles_zero.cpp	Thu Feb 22 21:28:07 2018 -0800
++++ b/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
+diff -r 1252eaaa2c8b -r 56123fdca84a src/share/vm/interpreter/bytecodeInterpreter.cpp
+--- a/src/share/vm/interpreter/bytecodeInterpreter.cpp	Thu Feb 22 21:28:07 2018 -0800
++++ b/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 +2609,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.20.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-02-04 21:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-04 21:37 [meta-java][sumo][PATCH] openjdk-8-16xbyy: port better interface invocation from aarch32 Kyle Russell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.