changeset 21115:db96f9915540

Merge
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Thu, 23 Apr 2015 22:09:27 -0700
parents 2daf39328194 (diff) 905d93bb3d31 (current diff)
children bf8cbbfabdcf
files graal/com.oracle.graal.compiler/src/META-INF/services/javax.annotation.processing.Processor graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/match/MatchProcessor.java graal/com.oracle.graal.hotspotvmconfig/src/META-INF/services/javax.annotation.processing.Processor graal/com.oracle.graal.hotspotvmconfig/src/com/oracle/graal/hotspotvmconfig/HotSpotVMConfigProcessor.java graal/com.oracle.graal.options/src/META-INF/services/javax.annotation.processing.Processor graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionProcessor.java
diffstat 5 files changed, 106 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/code/dependencies.cpp	Thu Apr 23 17:25:04 2015 -0700
+++ b/src/share/vm/code/dependencies.cpp	Thu Apr 23 22:09:27 2015 -0700
@@ -1029,7 +1029,13 @@
     assert((uint)n <= (uint)_num_participants, "oob");
     Method* fm = _found_methods[n];
     assert(n == _num_participants || fm != NULL, "proper usage");
-    assert(fm == NULL || fm->method_holder() == _participants[n], "sanity");
+    if (fm != NULL && fm->method_holder() != _participants[n]) {
+      // Default methods from interfaces can be added to classes. In
+      // that case the holder of the method is not the class but the
+      // interface where it's defined.
+      assert(fm->is_default_method(), "sanity");
+      return NULL;
+    }
     return fm;
   }
 
--- a/src/share/vm/graal/graalJavaAccess.hpp	Thu Apr 23 17:25:04 2015 -0700
+++ b/src/share/vm/graal/graalJavaAccess.hpp	Thu Apr 23 22:09:27 2015 -0700
@@ -273,8 +273,8 @@
 class name : AllStatic {                                                                                                                                       \
   private:                                                                                                                                                     \
     friend class GraalCompiler;                                                                                                                                \
-    static void check(oop obj) {                                                                                                                               \
-        assert(obj != NULL, "NULL field access of class " #name);                                                                                              \
+    static void check(oop obj, const char* field_name) {                                                                                                       \
+        assert(obj != NULL, err_msg("NULL field access of %s.%s", #name, field_name));                                                                         \
         assert(obj->is_a(SystemDictionary::name##_klass()), "wrong class, " #name " expected");                                                                \
     }                                                                                                                                                          \
     static void compute_offsets();                                                                                                                             \
@@ -283,14 +283,14 @@
 
 #define END_CLASS };
 
-#define FIELD(name, type, accessor, cast)                                                                                                                      \
-    static int _##name##_offset;                                                                                                                               \
-    static type name(oop obj)                   { check(obj); return cast obj->accessor(_##name##_offset); } \
-    static type name(Handle& obj)                { check(obj()); return cast obj->accessor(_##name##_offset); } \
-    static type name(jobject obj)               { check(JNIHandles::resolve(obj)); return cast JNIHandles::resolve(obj)->accessor(_##name##_offset); }              \
-    static void set_##name(oop obj, type x)     { check(obj); obj->accessor##_put(_##name##_offset, x); }                                                      \
-    static void set_##name(Handle& obj, type x)  { check(obj()); obj->accessor##_put(_##name##_offset, x); }                                                   \
-    static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj)); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); }
+#define FIELD(name, type, accessor, cast)                                                                                                                         \
+    static int _##name##_offset;                                                                                                                                  \
+    static type name(oop obj)                   { check(obj, #name); return cast obj->accessor(_##name##_offset); }                                               \
+    static type name(Handle& obj)                { check(obj(), #name); return cast obj->accessor(_##name##_offset); }                                            \
+    static type name(jobject obj)               { check(JNIHandles::resolve(obj), #name); return cast JNIHandles::resolve(obj)->accessor(_##name##_offset); }     \
+    static void set_##name(oop obj, type x)     { check(obj, #name); obj->accessor##_put(_##name##_offset, x); }                                                  \
+    static void set_##name(Handle& obj, type x)  { check(obj(), #name); obj->accessor##_put(_##name##_offset, x); }                                               \
+    static void set_##name(jobject obj, type x) { check(JNIHandles::resolve(obj), #name); JNIHandles::resolve(obj)->accessor##_put(_##name##_offset, x); }
 
 #define EMPTY_CAST 
 #define CHAR_FIELD(klass, name) FIELD(name, jchar, char_field, EMPTY_CAST)
--- a/src/share/vm/memory/cardTableRS.cpp	Thu Apr 23 17:25:04 2015 -0700
+++ b/src/share/vm/memory/cardTableRS.cpp	Thu Apr 23 22:09:27 2015 -0700
@@ -352,15 +352,22 @@
                    "[_begin, _end) = [" PTR_FORMAT "," PTR_FORMAT ")",
                    p2i(jp), p2i(_begin), p2i(_end)));
     oop obj = oopDesc::load_decode_heap_oop(p);
-    guarantee(obj == NULL || (HeapWord*)obj >= _boundary,
-              err_msg("pointer " PTR_FORMAT " at " PTR_FORMAT " on "
-                      "clean card crosses boundary" PTR_FORMAT,
-                      p2i((HeapWord*)obj), p2i(jp), p2i(_boundary)));
+    if (!(obj == NULL || (HeapWord*)obj >= _boundary)) {
+      tty->print_cr("pointer " PTR_FORMAT " at " PTR_FORMAT " on "
+                    "clean card crosses boundary" PTR_FORMAT,
+                    p2i((HeapWord*)obj), p2i(jp), p2i(_boundary));
+#ifndef PRODUCT
+      obj->print();
+#endif
+      had_error = true;
+    }
   }
 
 public:
+  bool had_error;
+  
   VerifyCleanCardClosure(HeapWord* b, HeapWord* begin, HeapWord* end) :
-    _boundary(b), _begin(begin), _end(end) {
+    _boundary(b), _begin(begin), _end(end), had_error(false) {
     assert(b <= begin,
            err_msg("Error: boundary " PTR_FORMAT " should be at or below begin " PTR_FORMAT,
                    p2i(b), p2i(begin)));
@@ -400,6 +407,7 @@
   // We don't need to do young-gen spaces.
   if (s->end() <= gen_boundary) return;
   MemRegion used = s->used_region();
+  bool had_error = false;
 
   jbyte* cur_entry = byte_for(used.start());
   jbyte* limit = byte_after(used.last());
@@ -438,6 +446,13 @@
         for (HeapWord* cur = start_block; cur < end; cur += s->block_size(cur)) {
           if (s->block_is_obj(cur) && s->obj_is_alive(cur)) {
             oop(cur)->oop_iterate_no_header(&verify_blk, mr);
+            had_error |= verify_blk.had_error;
+            if (verify_blk.had_error) {
+              verify_blk.had_error = false;
+#ifndef PRODUCT
+              oop(cur)->print();
+#endif
+            }
           }
         }
       }
@@ -598,6 +613,7 @@
       cur_entry++;
     }
   }
+  guarantee(!had_error, "Card table errors found");
 }
 
 void CardTableRS::verify() {
--- a/src/share/vm/memory/referenceProcessor.cpp	Thu Apr 23 17:25:04 2015 -0700
+++ b/src/share/vm/memory/referenceProcessor.cpp	Thu Apr 23 22:09:27 2015 -0700
@@ -57,8 +57,11 @@
   java_lang_ref_SoftReference::set_clock(_soft_ref_timestamp_clock);
 
   _always_clear_soft_ref_policy = new AlwaysClearPolicy();
-  _default_soft_ref_policy      = new COMPILER2_PRESENT(LRUMaxHeapPolicy())
-                                      NOT_COMPILER2(LRUCurrentHeapPolicy());
+#if defined(COMPILER2) || defined(GRAAL)
+  _default_soft_ref_policy      = new LRUMaxHeapPolicy();
+#else
+  _default_soft_ref_policy      = new LRUCurrentHeapPolicy();
+#endif
   if (_always_clear_soft_ref_policy == NULL || _default_soft_ref_policy == NULL) {
     vm_exit_during_initialization("Could not allocate reference policy object");
   }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/inlining/DefaultMethodsDependencies.java	Thu Apr 23 22:09:27 2015 -0700
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2015, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8069263
+ * @summary Deoptimization between array allocation and arraycopy may result in non initialized array
+ * @run main/othervm -XX:-BackgroundCompilation -XX:CompileOnly=DefaultMethodsDependencies::test -XX:CompileOnly=DefaultMethodsDependencies$I2::m1 DefaultMethodsDependencies
+ *
+ */
+
+public class DefaultMethodsDependencies {
+
+    interface I1 {
+        void m1();
+        // triggers processing of default methods in C1
+        default void m2() {
+        }
+    }
+
+    interface I2 extends I1 {
+        // added to C2 as default method
+        default void m1() {
+        }
+    }
+
+    static abstract class C1 implements I1 {
+    }
+
+    static class C2 extends C1 implements I2 {
+    }
+
+    static void test(C1 obj) {
+        obj.m1();
+    }
+
+    static public void main(String[] args) {
+        C2 obj = new C2();
+        for (int i = 0; i < 20000; i++) {
+            test(obj);
+        }
+    }
+}