view patches/hotspot/aarch64/20140715-8032536-jvm_resolves_wrong_method.patch @ 2739:bbcd7fc7d5c3

Bump aarch64 port to latest tip and add security patches. AArch64 C2 instruct for smull Add a constructor as a conversion from Register - RegSet. Use it. Add RegSet::operator+=. Add support for a few simple intrinsics Add support for builtin crc32 instructions Add support for CRC32 intrinsic Add support for Neon implementation of CRC32 All address constants are 48 bits in size. C1: Fix offset overflow when profiling. Common frame handling for C1/C2 which correctly handle all frame sizes Correct costs for operations with shifts. Correct OptoAssembly for prologs and epilogs. Delete useless instruction. Don't use any form of _call_VM_leaf when we're calling a stub. Fast string comparison Fast String.equals() Fix a tonne of bogus comments. Fix biased locking and enable as default Fix instruction size from 8 to 4 Fix opto assembly for shifts. Fix register misuse in verify_method_data_pointer Fix register usage in generate_verify_oop(). Implement various locked memory operations. Improve C1 performance improvements in ic_cache checks Improve code generation for pop(), as suggested by Edward Nevill. Improvements to safepoint polling Make code entry alignment 64 for C2 Minor optimisation for divide by 2 New cost model for instruction selection. Offsets in lookupswitch instructions should be signed. Optimise addressing of card table byte map base Optimise C2 entry point verification Optimise long divide by 2 Performance improvement and ease of use changes pulled from upstream Preserve callee save FP registers around call to java code Remove obsolete C1 patching code. Remove special-case handling of division arguments. AArch64 doesn't need it. Remove unnecessary memory barriers around CAS operations Restore sp from sender sp, r13 in crc32 code Restrict default ReservedCodeCacheSize to 128M Rewrite CAS operations to be more conservative Save intermediate state before removing C1 patching code. Tidy up register usage in push/pop instructions. Tidy up stack frame handling. Use 2- and 3-instruction immediate form of movoop and mov_metadata in C2-generated code. Use an explicit set of registers rather than a bitmap for psh and pop operations. Use explicit barrier instructions in C1. Use gcc __clear_cache instead of doing it ourselves 2014-07-16 Andrew John Hughes <gnu.andrew@member.fsf.org> * patches/hotspot/aarch64/20140415-8029858-enhance_array_copies.patch, * patches/hotspot/aarch64/20140415-8034926-attribute_classes_properly.patch: Removed, as applied upstream. * Makefile.am: (ICEDTEA_PATCHES): Updated. * NEWS: Likewise. * hotspot.map: Bump aarch64 port to latest tip. * patches/hotspot/aarch64/20140715-8030763-validate_global_memory_allocation.patch, * patches/hotspot/aarch64/20140715-8032536-jvm_resolves_wrong_method.patch, * patches/hotspot/aarch64/20140715-8035119-fix_exceptions_to_bytecode_verification.patch, * patches/hotspot/aarch64/20140715-8036800-attribute_oom_to_right_code.patch, * patches/hotspot/aarch64/20140715-8037076-check_constant_pool_constants.patch, * patches/hotspot/aarch64/20140715-8037157-verify_init_call.patch, * patches/hotspot/aarch64/20140715-8037167-better_method_signature_resolution.patch, * patches/hotspot/aarch64/20140715-8043454-8037157_test_case_fix.patch: July 2014 security patches for AArch64 HotSpot.
author Andrew John Hughes <gnu_andrew@member.fsf.org>
date Wed, 23 Jul 2014 03:20:14 +0100
parents
children
line wrap: on
line source

# HG changeset patch
# User hseigel
# Date 1393965993 18000
#      Tue Mar 04 15:46:33 2014 -0500
# Node ID c02077c4b79c0e7a29f439a1e6eb753a6c314b00
# Parent  c28dffbb1d7489ba206e80a3be0a954a9df6277e
8032536: JVM resolves wrong method in some unusual cases
Summary: Handle package private case
Reviewed-by: coleenp, acorn, jdn

diff -r c28dffbb1d74 -r c02077c4b79c src/share/vm/oops/klassVtable.cpp
--- openjdk/hotspot/src/share/vm/oops/klassVtable.cpp	Wed Feb 26 22:07:40 2014 -0800
+++ openjdk/hotspot/src/share/vm/oops/klassVtable.cpp	Tue Mar 04 15:46:33 2014 -0500
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -249,6 +249,17 @@
 // For bytecodes not produced by javac together it is possible that a method does not override
 // the superclass's method, but might indirectly override a super-super class's vtable entry
 // If none found, return a null superk, else return the superk of the method this does override
+// For public and protected methods: if they override a superclass, they will
+// also be overridden themselves appropriately.
+// Private methods do not override and are not overridden.
+// Package Private methods are trickier:
+// e.g. P1.A, pub m
+// P2.B extends A, package private m
+// P1.C extends B, public m
+// P1.C.m needs to override P1.A.m and can not override P2.B.m
+// Therefore: all package private methods need their own vtable entries for
+// them to be the root of an inheritance overriding decision
+// Package private methods may also override other vtable entries
 InstanceKlass* klassVtable::find_transitive_override(InstanceKlass* initialsuper, methodHandle target_method,
                             int vtable_index, Handle target_loader, Symbol* target_classname, Thread * THREAD) {
   InstanceKlass* superk = initialsuper;
@@ -396,8 +407,11 @@
                              target_classname, THREAD))
                              != (InstanceKlass*)NULL))))
         {
-        // overriding, so no new entry
-        allocate_new = false;
+        // Package private methods always need a new entry to root their own
+        // overriding. They may also override other methods.
+        if (!target_method()->is_package_private()) {
+          allocate_new = false;
+        }
 
         if (checkconstraints) {
         // Override vtable entry if passes loader constraint check
@@ -541,8 +555,9 @@
                                          AccessFlags class_flags,
                                          TRAPS) {
   if (class_flags.is_interface()) {
-    // Interfaces do not use vtables, so there is no point to assigning
-    // a vtable index to any of their methods.  If we refrain from doing this,
+    // Interfaces do not use vtables, except for java.lang.Object methods,
+    // so there is no point to assigning
+    // a vtable index to any of their local methods.  If we refrain from doing this,
     // we can use Method::_vtable_index to hold the itable index
     return false;
   }
@@ -580,6 +595,12 @@
     return true;
   }
 
+  // Package private methods always need a new entry to root their own
+  // overriding. This allows transitive overriding to work.
+  if (target_method()->is_package_private()) {
+    return true;
+  }
+
   // search through the super class hierarchy to see if we need
   // a new entry
   ResourceMark rm;