Merge

Mon, 15 Sep 2014 16:39:00 -0400

author
jiangli
date
Mon, 15 Sep 2014 16:39:00 -0400
changeset 7241
8cb56c8cb30d
parent 7125
fe1f65b0a2d8
parent 6875
28b50d07f6f8
child 7242
f0bedf980c65

Merge

.hgtags file | annotate | diff | comparison | revisions
make/hotspot_version file | annotate | diff | comparison | revisions
src/share/vm/classfile/classFileParser.cpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/classLoader.cpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/classLoader.hpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/stackMapFrame.cpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/stackMapFrame.hpp file | annotate | diff | comparison | revisions
src/share/vm/classfile/verifier.cpp file | annotate | diff | comparison | revisions
src/share/vm/memory/filemap.cpp file | annotate | diff | comparison | revisions
src/share/vm/memory/filemap.hpp file | annotate | diff | comparison | revisions
src/share/vm/memory/metaspaceShared.cpp file | annotate | diff | comparison | revisions
src/share/vm/oops/arrayKlass.cpp file | annotate | diff | comparison | revisions
src/share/vm/oops/arrayKlass.hpp file | annotate | diff | comparison | revisions
src/share/vm/oops/klass.cpp file | annotate | diff | comparison | revisions
src/share/vm/oops/klass.hpp file | annotate | diff | comparison | revisions
src/share/vm/prims/jvm.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/arguments.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/globals.hpp file | annotate | diff | comparison | revisions
     1.1 --- a/make/bsd/makefiles/mapfile-vers-debug	Wed Sep 10 09:05:31 2014 -0700
     1.2 +++ b/make/bsd/makefiles/mapfile-vers-debug	Mon Sep 15 16:39:00 2014 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  #
     1.5 -# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
     1.6 +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
     1.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8  #
     1.9  # This code is free software; you can redistribute it and/or modify it
    1.10 @@ -82,6 +82,7 @@
    1.11                  _JVM_EnableCompiler
    1.12                  _JVM_Exit
    1.13                  _JVM_FillInStackTrace
    1.14 +                _JVM_FindClassFromCaller
    1.15                  _JVM_FindClassFromClass
    1.16                  _JVM_FindClassFromClassLoader
    1.17                  _JVM_FindClassFromBootLoader
     2.1 --- a/make/bsd/makefiles/mapfile-vers-product	Wed Sep 10 09:05:31 2014 -0700
     2.2 +++ b/make/bsd/makefiles/mapfile-vers-product	Mon Sep 15 16:39:00 2014 -0400
     2.3 @@ -1,5 +1,5 @@
     2.4  #
     2.5 -# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
     2.6 +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
     2.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8  #
     2.9  # This code is free software; you can redistribute it and/or modify it
    2.10 @@ -82,6 +82,7 @@
    2.11                  _JVM_EnableCompiler
    2.12                  _JVM_Exit
    2.13                  _JVM_FillInStackTrace
    2.14 +                _JVM_FindClassFromCaller
    2.15                  _JVM_FindClassFromClass
    2.16                  _JVM_FindClassFromClassLoader
    2.17                  _JVM_FindClassFromBootLoader
     3.1 --- a/make/linux/makefiles/mapfile-vers-debug	Wed Sep 10 09:05:31 2014 -0700
     3.2 +++ b/make/linux/makefiles/mapfile-vers-debug	Mon Sep 15 16:39:00 2014 -0400
     3.3 @@ -1,5 +1,5 @@
     3.4  #
     3.5 -# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
     3.6 +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
     3.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8  #
     3.9  # This code is free software; you can redistribute it and/or modify it
    3.10 @@ -84,6 +84,7 @@
    3.11                  JVM_EnableCompiler;
    3.12                  JVM_Exit;
    3.13                  JVM_FillInStackTrace;
    3.14 +                JVM_FindClassFromCaller;
    3.15                  JVM_FindClassFromClass;
    3.16                  JVM_FindClassFromClassLoader;
    3.17                  JVM_FindClassFromBootLoader;
     4.1 --- a/make/linux/makefiles/mapfile-vers-product	Wed Sep 10 09:05:31 2014 -0700
     4.2 +++ b/make/linux/makefiles/mapfile-vers-product	Mon Sep 15 16:39:00 2014 -0400
     4.3 @@ -1,5 +1,5 @@
     4.4  #
     4.5 -# Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
     4.6 +# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
     4.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8  #
     4.9  # This code is free software; you can redistribute it and/or modify it
    4.10 @@ -84,6 +84,7 @@
    4.11                  JVM_EnableCompiler;
    4.12                  JVM_Exit;
    4.13                  JVM_FillInStackTrace;
    4.14 +                JVM_FindClassFromCaller;
    4.15                  JVM_FindClassFromClass;
    4.16                  JVM_FindClassFromClassLoader;
    4.17                  JVM_FindClassFromBootLoader;
     5.1 --- a/make/solaris/makefiles/mapfile-vers	Wed Sep 10 09:05:31 2014 -0700
     5.2 +++ b/make/solaris/makefiles/mapfile-vers	Mon Sep 15 16:39:00 2014 -0400
     5.3 @@ -1,5 +1,5 @@
     5.4  #
     5.5 -# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
     5.6 +# Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
     5.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.8  #
     5.9  # This code is free software; you can redistribute it and/or modify it
    5.10 @@ -84,6 +84,7 @@
    5.11                  JVM_EnableCompiler;
    5.12                  JVM_Exit;
    5.13                  JVM_FillInStackTrace;
    5.14 +                JVM_FindClassFromCaller;
    5.15                  JVM_FindClassFromClass;
    5.16                  JVM_FindClassFromClassLoader;
    5.17                  JVM_FindClassFromBootLoader;
     6.1 --- a/src/share/vm/classfile/classFileParser.cpp	Wed Sep 10 09:05:31 2014 -0700
     6.2 +++ b/src/share/vm/classfile/classFileParser.cpp	Mon Sep 15 16:39:00 2014 -0400
     6.3 @@ -2830,6 +2830,11 @@
     6.4        "bootstrap_method_index %u has bad constant type in class file %s",
     6.5        bootstrap_method_index,
     6.6        CHECK);
     6.7 +
     6.8 +    guarantee_property((operand_fill_index + 1 + argument_count) < operands->length(),
     6.9 +      "Invalid BootstrapMethods num_bootstrap_methods or num_bootstrap_arguments value in class file %s",
    6.10 +      CHECK);
    6.11 +
    6.12      operands->at_put(operand_fill_index++, bootstrap_method_index);
    6.13      operands->at_put(operand_fill_index++, argument_count);
    6.14  
    6.15 @@ -2847,7 +2852,6 @@
    6.16    }
    6.17  
    6.18    assert(operand_fill_index == operands->length(), "exact fill");
    6.19 -  assert(ConstantPool::operand_array_length(operands) == attribute_array_length, "correct decode");
    6.20  
    6.21    u1* current_end = cfs->current();
    6.22    guarantee_property(current_end == current_start + attribute_byte_length,
     7.1 --- a/src/share/vm/classfile/classLoader.cpp	Wed Sep 10 09:05:31 2014 -0700
     7.2 +++ b/src/share/vm/classfile/classLoader.cpp	Mon Sep 15 16:39:00 2014 -0400
     7.3 @@ -90,6 +90,7 @@
     7.4  typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf);
     7.5  typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf);
     7.6  typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n);
     7.7 +typedef jint     (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len);
     7.8  
     7.9  static ZipOpen_t         ZipOpen            = NULL;
    7.10  static ZipClose_t        ZipClose           = NULL;
    7.11 @@ -98,6 +99,7 @@
    7.12  static ReadMappedEntry_t ReadMappedEntry    = NULL;
    7.13  static GetNextEntry_t    GetNextEntry       = NULL;
    7.14  static canonicalize_fn_t CanonicalizeEntry  = NULL;
    7.15 +static Crc32_t           Crc32              = NULL;
    7.16  
    7.17  // Globals
    7.18  
    7.19 @@ -810,9 +812,11 @@
    7.20    ReadEntry    = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry"));
    7.21    ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry"));
    7.22    GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry"));
    7.23 +  Crc32        = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32"));
    7.24  
    7.25    // ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL
    7.26 -  if (ZipOpen == NULL || FindEntry == NULL || ReadEntry == NULL || GetNextEntry == NULL) {
    7.27 +  if (ZipOpen == NULL || FindEntry == NULL || ReadEntry == NULL ||
    7.28 +      GetNextEntry == NULL || Crc32 == NULL) {
    7.29      vm_exit_during_initialization("Corrupted ZIP library", path);
    7.30    }
    7.31  
    7.32 @@ -822,6 +826,11 @@
    7.33    // This lookup only works on 1.3. Do not check for non-null here
    7.34  }
    7.35  
    7.36 +int ClassLoader::crc32(int crc, const char* buf, int len) {
    7.37 +  assert(Crc32 != NULL, "ZIP_CRC32 is not found");
    7.38 +  return (*Crc32)(crc, (const jbyte*)buf, len);
    7.39 +}
    7.40 +
    7.41  // PackageInfo data exists in order to support the java.lang.Package
    7.42  // class.  A Package object provides information about a java package
    7.43  // (version, vendor, etc.) which originates in the manifest of the jar
     8.1 --- a/src/share/vm/classfile/classLoader.hpp	Wed Sep 10 09:05:31 2014 -0700
     8.2 +++ b/src/share/vm/classfile/classLoader.hpp	Mon Sep 15 16:39:00 2014 -0400
     8.3 @@ -228,6 +228,7 @@
     8.4    // to avoid confusing the zip library
     8.5    static bool get_canonical_path(const char* orig, char* out, int len);
     8.6   public:
     8.7 +  static int crc32(int crc, const char* buf, int len);
     8.8    static bool update_class_path_entry_list(const char *path,
     8.9                                             bool check_for_duplicates,
    8.10                                             bool throw_exception=true);
     9.1 --- a/src/share/vm/classfile/stackMapFrame.cpp	Wed Sep 10 09:05:31 2014 -0700
     9.2 +++ b/src/share/vm/classfile/stackMapFrame.cpp	Mon Sep 15 16:39:00 2014 -0400
     9.3 @@ -148,7 +148,7 @@
     9.4      VerificationType* from, VerificationType* to, int32_t len, TRAPS) const {
     9.5    int32_t i = 0;
     9.6    for (i = 0; i < len; i++) {
     9.7 -    if (!to[i].is_assignable_from(from[i], verifier(), THREAD)) {
     9.8 +    if (!to[i].is_assignable_from(from[i], verifier(), false, THREAD)) {
     9.9        break;
    9.10      }
    9.11    }
    9.12 @@ -245,7 +245,7 @@
    9.13    }
    9.14    VerificationType top = _stack[--_stack_size];
    9.15    bool subtype = type.is_assignable_from(
    9.16 -    top, verifier(), CHECK_(VerificationType::bogus_type()));
    9.17 +    top, verifier(), false, CHECK_(VerificationType::bogus_type()));
    9.18    if (!subtype) {
    9.19      verifier()->verify_error(
    9.20          ErrorContext::bad_type(_offset, stack_top_ctx(),
    9.21 @@ -265,7 +265,7 @@
    9.22      return VerificationType::bogus_type();
    9.23    }
    9.24    bool subtype = type.is_assignable_from(_locals[index],
    9.25 -    verifier(), CHECK_(VerificationType::bogus_type()));
    9.26 +    verifier(), false, CHECK_(VerificationType::bogus_type()));
    9.27    if (!subtype) {
    9.28      verifier()->verify_error(
    9.29          ErrorContext::bad_type(_offset,
    9.30 @@ -288,14 +288,14 @@
    9.31          "get long/double overflows locals");
    9.32      return;
    9.33    }
    9.34 -  bool subtype = type1.is_assignable_from(_locals[index], verifier(), CHECK);
    9.35 +  bool subtype = type1.is_assignable_from(_locals[index], verifier(), false, CHECK);
    9.36    if (!subtype) {
    9.37      verifier()->verify_error(
    9.38          ErrorContext::bad_type(_offset,
    9.39              TypeOrigin::local(index, this), TypeOrigin::implicit(type1)),
    9.40          "Bad local variable type");
    9.41    } else {
    9.42 -    subtype = type2.is_assignable_from(_locals[index + 1], verifier(), CHECK);
    9.43 +    subtype = type2.is_assignable_from(_locals[index + 1], verifier(), false, CHECK);
    9.44      if (!subtype) {
    9.45        /* Unreachable? All local store routines convert a split long or double
    9.46         * into a TOP during the store.  So we should never end up seeing an
    10.1 --- a/src/share/vm/classfile/stackMapFrame.hpp	Wed Sep 10 09:05:31 2014 -0700
    10.2 +++ b/src/share/vm/classfile/stackMapFrame.hpp	Mon Sep 15 16:39:00 2014 -0400
    10.3 @@ -234,7 +234,7 @@
    10.4      if (_stack_size != 0) {
    10.5        VerificationType top = _stack[_stack_size - 1];
    10.6        bool subtype = type.is_assignable_from(
    10.7 -        top, verifier(), CHECK_(VerificationType::bogus_type()));
    10.8 +        top, verifier(), false, CHECK_(VerificationType::bogus_type()));
    10.9        if (subtype) {
   10.10          --_stack_size;
   10.11          return top;
   10.12 @@ -249,9 +249,9 @@
   10.13      assert(type2.is_long() || type2.is_double(), "must be long/double_2");
   10.14      if (_stack_size >= 2) {
   10.15        VerificationType top1 = _stack[_stack_size - 1];
   10.16 -      bool subtype1 = type1.is_assignable_from(top1, verifier(), CHECK);
   10.17 +      bool subtype1 = type1.is_assignable_from(top1, verifier(), false, CHECK);
   10.18        VerificationType top2 = _stack[_stack_size - 2];
   10.19 -      bool subtype2 = type2.is_assignable_from(top2, verifier(), CHECK);
   10.20 +      bool subtype2 = type2.is_assignable_from(top2, verifier(), false, CHECK);
   10.21        if (subtype1 && subtype2) {
   10.22          _stack_size -= 2;
   10.23          return;
    11.1 --- a/src/share/vm/classfile/verificationType.cpp	Wed Sep 10 09:05:31 2014 -0700
    11.2 +++ b/src/share/vm/classfile/verificationType.cpp	Mon Sep 15 16:39:00 2014 -0400
    11.3 @@ -1,5 +1,5 @@
    11.4  /*
    11.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
    11.6 + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
    11.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.8   *
    11.9   * This code is free software; you can redistribute it and/or modify it
   11.10 @@ -42,7 +42,8 @@
   11.11  }
   11.12  
   11.13  bool VerificationType::is_reference_assignable_from(
   11.14 -    const VerificationType& from, ClassVerifier* context, TRAPS) const {
   11.15 +    const VerificationType& from, ClassVerifier* context,
   11.16 +    bool from_field_is_protected, TRAPS) const {
   11.17    instanceKlassHandle klass = context->current_class();
   11.18    if (from.is_null()) {
   11.19      // null is assignable to any reference
   11.20 @@ -62,9 +63,11 @@
   11.21          Handle(THREAD, klass->protection_domain()), true, CHECK_false);
   11.22      KlassHandle this_class(THREAD, obj);
   11.23  
   11.24 -    if (this_class->is_interface()) {
   11.25 -      // We treat interfaces as java.lang.Object, including
   11.26 -      // java.lang.Cloneable and java.io.Serializable
   11.27 +    if (this_class->is_interface() && (!from_field_is_protected ||
   11.28 +        from.name() != vmSymbols::java_lang_Object())) {
   11.29 +      // If we are not trying to access a protected field or method in
   11.30 +      // java.lang.Object then we treat interfaces as java.lang.Object,
   11.31 +      // including java.lang.Cloneable and java.io.Serializable.
   11.32        return true;
   11.33      } else if (from.is_object()) {
   11.34        Klass* from_class = SystemDictionary::resolve_or_fail(
   11.35 @@ -76,7 +79,8 @@
   11.36      VerificationType comp_this = get_component(context, CHECK_false);
   11.37      VerificationType comp_from = from.get_component(context, CHECK_false);
   11.38      if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
   11.39 -      return comp_this.is_assignable_from(comp_from, context, CHECK_false);
   11.40 +      return comp_this.is_assignable_from(comp_from, context,
   11.41 +                                          from_field_is_protected, CHECK_false);
   11.42      }
   11.43    }
   11.44    return false;
    12.1 --- a/src/share/vm/classfile/verificationType.hpp	Wed Sep 10 09:05:31 2014 -0700
    12.2 +++ b/src/share/vm/classfile/verificationType.hpp	Mon Sep 15 16:39:00 2014 -0400
    12.3 @@ -265,7 +265,8 @@
    12.4    // is assignable to another.  Returns true if one can assign 'from' to
    12.5    // this.
    12.6    bool is_assignable_from(
    12.7 -      const VerificationType& from, ClassVerifier* context, TRAPS) const {
    12.8 +      const VerificationType& from, ClassVerifier* context,
    12.9 +      bool from_field_is_protected, TRAPS) const {
   12.10      if (equals(from) || is_bogus()) {
   12.11        return true;
   12.12      } else {
   12.13 @@ -286,7 +287,9 @@
   12.14            return from.is_integer();
   12.15          default:
   12.16            if (is_reference() && from.is_reference()) {
   12.17 -            return is_reference_assignable_from(from, context, CHECK_false);
   12.18 +            return is_reference_assignable_from(from, context,
   12.19 +                                                from_field_is_protected,
   12.20 +                                                CHECK_false);
   12.21            } else {
   12.22              return false;
   12.23            }
   12.24 @@ -308,7 +311,8 @@
   12.25   private:
   12.26  
   12.27    bool is_reference_assignable_from(
   12.28 -    const VerificationType&, ClassVerifier*, TRAPS) const;
   12.29 +    const VerificationType&, ClassVerifier*, bool from_field_is_protected,
   12.30 +    TRAPS) const;
   12.31  };
   12.32  
   12.33  #endif // SHARE_VM_CLASSFILE_VERIFICATIONTYPE_HPP
    13.1 --- a/src/share/vm/classfile/verifier.cpp	Wed Sep 10 09:05:31 2014 -0700
    13.2 +++ b/src/share/vm/classfile/verifier.cpp	Mon Sep 15 16:39:00 2014 -0400
    13.3 @@ -1734,7 +1734,7 @@
    13.4        VerificationType throwable =
    13.5          VerificationType::reference_type(vmSymbols::java_lang_Throwable());
    13.6        bool is_subclass = throwable.is_assignable_from(
    13.7 -        catch_type, this, CHECK_VERIFY(this));
    13.8 +        catch_type, this, false, CHECK_VERIFY(this));
    13.9        if (!is_subclass) {
   13.10          // 4286534: should throw VerifyError according to recent spec change
   13.11          verify_error(ErrorContext::bad_type(handler_pc,
   13.12 @@ -2189,7 +2189,7 @@
   13.13          stack_object_type = current_type();
   13.14        }
   13.15        is_assignable = target_class_type.is_assignable_from(
   13.16 -        stack_object_type, this, CHECK_VERIFY(this));
   13.17 +        stack_object_type, this, false, CHECK_VERIFY(this));
   13.18        if (!is_assignable) {
   13.19          verify_error(ErrorContext::bad_type(bci,
   13.20              current_frame->stack_top_ctx(),
   13.21 @@ -2216,7 +2216,7 @@
   13.22          // It's protected access, check if stack object is assignable to
   13.23          // current class.
   13.24          is_assignable = current_type().is_assignable_from(
   13.25 -          stack_object_type, this, CHECK_VERIFY(this));
   13.26 +          stack_object_type, this, true, CHECK_VERIFY(this));
   13.27          if (!is_assignable) {
   13.28            verify_error(ErrorContext::bad_type(bci,
   13.29                current_frame->stack_top_ctx(),
   13.30 @@ -2489,7 +2489,7 @@
   13.31          instanceKlassHandle mh(THREAD, m->method_holder());
   13.32          if (m->is_protected() && !mh->is_same_class_package(_klass())) {
   13.33            bool assignable = current_type().is_assignable_from(
   13.34 -            objectref_type, this, CHECK_VERIFY(this));
   13.35 +            objectref_type, this, true, CHECK_VERIFY(this));
   13.36            if (!assignable) {
   13.37              verify_error(ErrorContext::bad_type(bci,
   13.38                  TypeOrigin::cp(new_class_index, objectref_type),
   13.39 @@ -2664,11 +2664,11 @@
   13.40      bool have_imr_indirect = cp->tag_at(index).value() == JVM_CONSTANT_InterfaceMethodref;
   13.41      if (!current_class()->is_anonymous()) {
   13.42        subtype = ref_class_type.is_assignable_from(
   13.43 -                 current_type(), this, CHECK_VERIFY(this));
   13.44 +                 current_type(), this, false, CHECK_VERIFY(this));
   13.45      } else {
   13.46        VerificationType host_klass_type =
   13.47                          VerificationType::reference_type(current_class()->host_klass()->name());
   13.48 -      subtype = ref_class_type.is_assignable_from(host_klass_type, this, CHECK_VERIFY(this));
   13.49 +      subtype = ref_class_type.is_assignable_from(host_klass_type, this, false, CHECK_VERIFY(this));
   13.50  
   13.51        // If invokespecial of IMR, need to recheck for same or
   13.52        // direct interface relative to the host class
   13.53 @@ -2712,7 +2712,7 @@
   13.54            VerificationType top = current_frame->pop_stack(CHECK_VERIFY(this));
   13.55            VerificationType hosttype =
   13.56              VerificationType::reference_type(current_class()->host_klass()->name());
   13.57 -          bool subtype = hosttype.is_assignable_from(top, this, CHECK_VERIFY(this));
   13.58 +          bool subtype = hosttype.is_assignable_from(top, this, false, CHECK_VERIFY(this));
   13.59            if (!subtype) {
   13.60              verify_error( ErrorContext::bad_type(current_frame->offset(),
   13.61                current_frame->stack_top_ctx(),
   13.62 @@ -2737,7 +2737,7 @@
   13.63                // It's protected access, check if stack object is
   13.64                // assignable to current class.
   13.65                bool is_assignable = current_type().is_assignable_from(
   13.66 -                stack_object_type, this, CHECK_VERIFY(this));
   13.67 +                stack_object_type, this, true, CHECK_VERIFY(this));
   13.68                if (!is_assignable) {
   13.69                  if (ref_class_type.name() == vmSymbols::java_lang_Object()
   13.70                      && stack_object_type.is_array()
   13.71 @@ -2920,7 +2920,7 @@
   13.72          "Method expects a return value");
   13.73      return;
   13.74    }
   13.75 -  bool match = return_type.is_assignable_from(type, this, CHECK_VERIFY(this));
   13.76 +  bool match = return_type.is_assignable_from(type, this, false, CHECK_VERIFY(this));
   13.77    if (!match) {
   13.78      verify_error(ErrorContext::bad_type(bci,
   13.79          current_frame->stack_top_ctx(), TypeOrigin::signature(return_type)),
    14.1 --- a/src/share/vm/interpreter/linkResolver.cpp	Wed Sep 10 09:05:31 2014 -0700
    14.2 +++ b/src/share/vm/interpreter/linkResolver.cpp	Mon Sep 15 16:39:00 2014 -0400
    14.3 @@ -246,6 +246,12 @@
    14.4    // Ignore overpasses so statics can be found during resolution
    14.5    Method* result_oop = klass->uncached_lookup_method(name, signature, Klass::skip_overpass);
    14.6  
    14.7 +  if (klass->oop_is_array()) {
    14.8 +    // Only consider klass and super klass for arrays
    14.9 +    result = methodHandle(THREAD, result_oop);
   14.10 +    return;
   14.11 +  }
   14.12 +
   14.13    // JDK 8, JVMS 5.4.3.4: Interface method resolution should
   14.14    // ignore static and non-public methods of java.lang.Object,
   14.15    // like clone, finalize, registerNatives.
   14.16 @@ -290,6 +296,11 @@
   14.17      result = methodHandle(THREAD, super_klass->uncached_lookup_method(name, signature, Klass::normal));
   14.18    }
   14.19  
   14.20 +  if (klass->oop_is_array()) {
   14.21 +    // Only consider klass and super klass for arrays
   14.22 +    return;
   14.23 +  }
   14.24 +
   14.25    if (result.is_null()) {
   14.26      Array<Method*>* default_methods = InstanceKlass::cast(klass())->default_methods();
   14.27      if (default_methods != NULL) {
   14.28 @@ -546,7 +557,7 @@
   14.29    // 2. lookup method in resolved klass and its super klasses
   14.30    lookup_method_in_klasses(resolved_method, resolved_klass, method_name, method_signature, true, false, CHECK);
   14.31  
   14.32 -  if (resolved_method.is_null()) { // not found in the class hierarchy
   14.33 +  if (resolved_method.is_null() && !resolved_klass->oop_is_array()) { // not found in the class hierarchy
   14.34      // 3. lookup method in all the interfaces implemented by the resolved klass
   14.35      lookup_method_in_interfaces(resolved_method, resolved_klass, method_name, method_signature, CHECK);
   14.36  
   14.37 @@ -559,16 +570,16 @@
   14.38          CLEAR_PENDING_EXCEPTION;
   14.39        }
   14.40      }
   14.41 +  }
   14.42  
   14.43 -    if (resolved_method.is_null()) {
   14.44 -      // 4. method lookup failed
   14.45 -      ResourceMark rm(THREAD);
   14.46 -      THROW_MSG_CAUSE(vmSymbols::java_lang_NoSuchMethodError(),
   14.47 -                      Method::name_and_sig_as_C_string(resolved_klass(),
   14.48 -                                                              method_name,
   14.49 -                                                              method_signature),
   14.50 -                      nested_exception);
   14.51 -    }
   14.52 +  if (resolved_method.is_null()) {
   14.53 +    // 4. method lookup failed
   14.54 +    ResourceMark rm(THREAD);
   14.55 +    THROW_MSG_CAUSE(vmSymbols::java_lang_NoSuchMethodError(),
   14.56 +                    Method::name_and_sig_as_C_string(resolved_klass(),
   14.57 +                                                            method_name,
   14.58 +                                                            method_signature),
   14.59 +                    nested_exception);
   14.60    }
   14.61  
   14.62    // 5. access checks, access checking may be turned off when calling from within the VM.
   14.63 @@ -634,17 +645,18 @@
   14.64    // JDK8: also look for static methods
   14.65    lookup_method_in_klasses(resolved_method, resolved_klass, method_name, method_signature, false, true, CHECK);
   14.66  
   14.67 -  if (resolved_method.is_null()) {
   14.68 +  if (resolved_method.is_null() && !resolved_klass->oop_is_array()) {
   14.69      // lookup method in all the super-interfaces
   14.70      lookup_method_in_interfaces(resolved_method, resolved_klass, method_name, method_signature, CHECK);
   14.71 -    if (resolved_method.is_null()) {
   14.72 -      // no method found
   14.73 -      ResourceMark rm(THREAD);
   14.74 -      THROW_MSG(vmSymbols::java_lang_NoSuchMethodError(),
   14.75 -                Method::name_and_sig_as_C_string(resolved_klass(),
   14.76 -                                                        method_name,
   14.77 -                                                        method_signature));
   14.78 -    }
   14.79 +  }
   14.80 +
   14.81 +  if (resolved_method.is_null()) {
   14.82 +    // no method found
   14.83 +    ResourceMark rm(THREAD);
   14.84 +    THROW_MSG(vmSymbols::java_lang_NoSuchMethodError(),
   14.85 +              Method::name_and_sig_as_C_string(resolved_klass(),
   14.86 +                                                      method_name,
   14.87 +                                                      method_signature));
   14.88    }
   14.89  
   14.90    if (check_access) {
   14.91 @@ -776,7 +788,7 @@
   14.92    }
   14.93  
   14.94    // Resolve instance field
   14.95 -  KlassHandle sel_klass(THREAD, InstanceKlass::cast(resolved_klass())->find_field(field, sig, &fd));
   14.96 +  KlassHandle sel_klass(THREAD, resolved_klass->find_field(field, sig, &fd));
   14.97    // check if field exists; i.e., if a klass containing the field def has been selected
   14.98    if (sel_klass.is_null()) {
   14.99      ResourceMark rm(THREAD);
    15.1 --- a/src/share/vm/memory/filemap.cpp	Wed Sep 10 09:05:31 2014 -0700
    15.2 +++ b/src/share/vm/memory/filemap.cpp	Mon Sep 15 16:39:00 2014 -0400
    15.3 @@ -314,7 +314,6 @@
    15.4      fail_continue("The shared archive file has the wrong version.");
    15.5      return false;
    15.6    }
    15.7 -  _file_offset = (long)n;
    15.8  
    15.9    size_t info_size = _header->_paths_misc_info_size;
   15.10    _paths_misc_info = NEW_C_HEAP_ARRAY_RETURN_NULL(char, info_size, mtClass);
   15.11 @@ -330,6 +329,14 @@
   15.12      return false;
   15.13    }
   15.14  
   15.15 +  size_t len = lseek(fd, 0, SEEK_END);
   15.16 +  struct FileMapInfo::FileMapHeader::space_info* si =
   15.17 +    &_header->_space[MetaspaceShared::mc];
   15.18 +  if (si->_file_offset >= len || len - si->_file_offset < si->_used) {
   15.19 +    fail_continue("The shared archive file has been truncated.");
   15.20 +    return false;
   15.21 +  }
   15.22 +
   15.23    _file_offset += (long)n;
   15.24    return true;
   15.25  }
   15.26 @@ -430,6 +437,7 @@
   15.27    si->_capacity = capacity;
   15.28    si->_read_only = read_only;
   15.29    si->_allow_exec = allow_exec;
   15.30 +  si->_crc = ClassLoader::crc32(0, base, (jint)size);
   15.31    write_bytes_aligned(base, (int)size);
   15.32  }
   15.33  
   15.34 @@ -454,14 +462,15 @@
   15.35  // Align file position to an allocation unit boundary.
   15.36  
   15.37  void FileMapInfo::align_file_position() {
   15.38 -  long new_file_offset = align_size_up(_file_offset, os::vm_allocation_granularity());
   15.39 +  size_t new_file_offset = align_size_up(_file_offset,
   15.40 +                                         os::vm_allocation_granularity());
   15.41    if (new_file_offset != _file_offset) {
   15.42      _file_offset = new_file_offset;
   15.43      if (_file_open) {
   15.44        // Seek one byte back from the target and write a byte to insure
   15.45        // that the written file is the correct length.
   15.46        _file_offset -= 1;
   15.47 -      if (lseek(_fd, _file_offset, SEEK_SET) < 0) {
   15.48 +      if (lseek(_fd, (long)_file_offset, SEEK_SET) < 0) {
   15.49          fail_stop("Unable to seek.", NULL);
   15.50        }
   15.51        char zero = 0;
   15.52 @@ -568,6 +577,19 @@
   15.53    return base;
   15.54  }
   15.55  
   15.56 +bool FileMapInfo::verify_region_checksum(int i) {
   15.57 +  if (!VerifySharedSpaces) {
   15.58 +    return true;
   15.59 +  }
   15.60 +  const char* buf = _header->_space[i]._base;
   15.61 +  size_t sz = _header->_space[i]._used;
   15.62 +  int crc = ClassLoader::crc32(0, buf, (jint)sz);
   15.63 +  if (crc != _header->_space[i]._crc) {
   15.64 +    fail_continue("Checksum verification failed.");
   15.65 +    return false;
   15.66 +  }
   15.67 +  return true;
   15.68 +}
   15.69  
   15.70  // Unmap a memory region in the address space.
   15.71  
   15.72 @@ -628,13 +650,31 @@
   15.73    return true;
   15.74  }
   15.75  
   15.76 +int FileMapInfo::FileMapHeader::compute_crc() {
   15.77 +  char* header = data();
   15.78 +  // start computing from the field after _crc
   15.79 +  char* buf = (char*)&_crc + sizeof(int);
   15.80 +  size_t sz = data_size() - (buf - header);
   15.81 +  int crc = ClassLoader::crc32(0, buf, (jint)sz);
   15.82 +  return crc;
   15.83 +}
   15.84 +
   15.85 +int FileMapInfo::compute_header_crc() {
   15.86 +  return _header->compute_crc();
   15.87 +}
   15.88 +
   15.89  bool FileMapInfo::FileMapHeader::validate() {
   15.90 +  if (_magic != (int)0xf00baba2) {
   15.91 +    FileMapInfo::fail_continue("The shared archive file has a bad magic number.");
   15.92 +    return false;
   15.93 +  }
   15.94 +  if (VerifySharedSpaces && compute_crc() != _crc) {
   15.95 +    fail_continue("Header checksum verification failed.");
   15.96 +    return false;
   15.97 +  }
   15.98    if (_version != current_version()) {
   15.99      FileMapInfo::fail_continue("The shared archive file is the wrong version.");
  15.100 -    return false;
  15.101 -  }
  15.102 -  if (_magic != (int)0xf00baba2) {
  15.103 -    FileMapInfo::fail_continue("The shared archive file has a bad magic number.");
  15.104 +
  15.105      return false;
  15.106    }
  15.107    char header_version[JVM_IDENT_MAX];
    16.1 --- a/src/share/vm/memory/filemap.hpp	Wed Sep 10 09:05:31 2014 -0700
    16.2 +++ b/src/share/vm/memory/filemap.hpp	Mon Sep 15 16:39:00 2014 -0400
    16.3 @@ -61,7 +61,7 @@
    16.4  
    16.5    bool  _file_open;
    16.6    int   _fd;
    16.7 -  long  _file_offset;
    16.8 +  size_t  _file_offset;
    16.9  
   16.10  private:
   16.11    static SharedClassPathEntry* _classpath_entry_table;
   16.12 @@ -87,12 +87,14 @@
   16.13      }
   16.14  
   16.15      int    _magic;                    // identify file type.
   16.16 +    int    _crc;                      // header crc checksum.
   16.17      int    _version;                  // (from enum, above.)
   16.18      size_t _alignment;                // how shared archive should be aligned
   16.19      int    _obj_alignment;            // value of ObjectAlignmentInBytes
   16.20  
   16.21      struct space_info {
   16.22 -      int    _file_offset;   // sizeof(this) rounded to vm page size
   16.23 +      int    _crc;           // crc checksum of the current space
   16.24 +      size_t _file_offset;   // sizeof(this) rounded to vm page size
   16.25        char*  _base;          // copy-on-write base address
   16.26        size_t _capacity;      // for validity checking
   16.27        size_t _used;          // for setting space top on read
   16.28 @@ -135,6 +137,7 @@
   16.29  
   16.30      virtual bool validate();
   16.31      virtual void populate(FileMapInfo* info, size_t alignment);
   16.32 +    int compute_crc();
   16.33    };
   16.34  
   16.35    FileMapHeader * _header;
   16.36 @@ -153,6 +156,8 @@
   16.37    ~FileMapInfo();
   16.38  
   16.39    static int current_version()        { return _current_version; }
   16.40 +  int    compute_header_crc();
   16.41 +  void   set_header_crc(int crc)      { _header->_crc = crc; }
   16.42    void   populate_header(size_t alignment);
   16.43    bool   validate_header();
   16.44    void   invalidate();
   16.45 @@ -181,6 +186,7 @@
   16.46    void  write_bytes_aligned(const void* buffer, int count);
   16.47    char* map_region(int i);
   16.48    void  unmap_region(int i);
   16.49 +  bool  verify_region_checksum(int i);
   16.50    void  close();
   16.51    bool  is_open() { return _file_open; }
   16.52    ReservedSpace reserve_shared_memory();
    17.1 --- a/src/share/vm/memory/metaspaceShared.cpp	Wed Sep 10 09:05:31 2014 -0700
    17.2 +++ b/src/share/vm/memory/metaspaceShared.cpp	Mon Sep 15 16:39:00 2014 -0400
    17.3 @@ -607,6 +607,7 @@
    17.4  
    17.5    // Pass 2 - write data.
    17.6    mapinfo->open_for_write();
    17.7 +  mapinfo->set_header_crc(mapinfo->compute_header_crc());
    17.8    mapinfo->write_header();
    17.9    mapinfo->write_space(MetaspaceShared::ro, _loader_data->ro_metaspace(), true);
   17.10    mapinfo->write_space(MetaspaceShared::rw, _loader_data->rw_metaspace(), false);
   17.11 @@ -936,9 +937,13 @@
   17.12  
   17.13    // Map each shared region
   17.14    if ((_ro_base = mapinfo->map_region(ro)) != NULL &&
   17.15 +       mapinfo->verify_region_checksum(ro) &&
   17.16        (_rw_base = mapinfo->map_region(rw)) != NULL &&
   17.17 +       mapinfo->verify_region_checksum(rw) &&
   17.18        (_md_base = mapinfo->map_region(md)) != NULL &&
   17.19 +       mapinfo->verify_region_checksum(md) &&
   17.20        (_mc_base = mapinfo->map_region(mc)) != NULL &&
   17.21 +       mapinfo->verify_region_checksum(mc) &&
   17.22        (image_alignment == (size_t)max_alignment()) &&
   17.23        mapinfo->validate_classpath_entry_table()) {
   17.24      // Success (no need to do anything)
    18.1 --- a/src/share/vm/oops/arrayKlass.cpp	Wed Sep 10 09:05:31 2014 -0700
    18.2 +++ b/src/share/vm/oops/arrayKlass.cpp	Mon Sep 15 16:39:00 2014 -0400
    18.3 @@ -64,6 +64,13 @@
    18.4    return NULL;
    18.5  }
    18.6  
    18.7 +// find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
    18.8 +Klass* ArrayKlass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const {
    18.9 +  // There are no fields in an array klass but look to the super class (Object)
   18.10 +  assert(super(), "super klass must be present");
   18.11 +  return super()->find_field(name, sig, fd);
   18.12 +}
   18.13 +
   18.14  Method* ArrayKlass::uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const {
   18.15    // There are no methods in an array klass but the super class (Object) has some
   18.16    assert(super(), "super klass must be present");
    19.1 --- a/src/share/vm/oops/arrayKlass.hpp	Wed Sep 10 09:05:31 2014 -0700
    19.2 +++ b/src/share/vm/oops/arrayKlass.hpp	Mon Sep 15 16:39:00 2014 -0400
    19.3 @@ -28,6 +28,7 @@
    19.4  #include "memory/universe.hpp"
    19.5  #include "oops/klass.hpp"
    19.6  
    19.7 +class fieldDescriptor;
    19.8  class klassVtable;
    19.9  
   19.10  // ArrayKlass is the abstract baseclass for all array classes
   19.11 @@ -85,6 +86,9 @@
   19.12    virtual oop multi_allocate(int rank, jint* sizes, TRAPS);
   19.13    objArrayOop allocate_arrayArray(int n, int length, TRAPS);
   19.14  
   19.15 +  // find field according to JVM spec 5.4.3.2, returns the klass in which the field is defined
   19.16 +  Klass* find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const;
   19.17 +
   19.18    // Lookup operations
   19.19    Method* uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const;
   19.20  
    20.1 --- a/src/share/vm/oops/klass.cpp	Wed Sep 10 09:05:31 2014 -0700
    20.2 +++ b/src/share/vm/oops/klass.cpp	Mon Sep 15 16:39:00 2014 -0400
    20.3 @@ -130,6 +130,15 @@
    20.4    return is_subclass_of(k);
    20.5  }
    20.6  
    20.7 +Klass* Klass::find_field(Symbol* name, Symbol* sig, fieldDescriptor* fd) const {
    20.8 +#ifdef ASSERT
    20.9 +  tty->print_cr("Error: find_field called on a klass oop."
   20.10 +                " Likely error: reflection method does not correctly"
   20.11 +                " wrap return value in a mirror object.");
   20.12 +#endif
   20.13 +  ShouldNotReachHere();
   20.14 +  return NULL;
   20.15 +}
   20.16  
   20.17  Method* Klass::uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const {
   20.18  #ifdef ASSERT
    21.1 --- a/src/share/vm/oops/klass.hpp	Wed Sep 10 09:05:31 2014 -0700
    21.2 +++ b/src/share/vm/oops/klass.hpp	Mon Sep 15 16:39:00 2014 -0400
    21.3 @@ -90,6 +90,7 @@
    21.4  class klassVtable;
    21.5  class ParCompactionManager;
    21.6  class KlassSizeStats;
    21.7 +class fieldDescriptor;
    21.8  
    21.9  class Klass : public Metadata {
   21.10    friend class VMStructs;
   21.11 @@ -441,6 +442,7 @@
   21.12    virtual void initialize(TRAPS);
   21.13    // lookup operation for MethodLookupCache
   21.14    friend class MethodLookupCache;
   21.15 +  virtual Klass* find_field(Symbol* name, Symbol* signature, fieldDescriptor* fd) const;
   21.16    virtual Method* uncached_lookup_method(Symbol* name, Symbol* signature, MethodLookupMode mode) const;
   21.17   public:
   21.18    Method* lookup_method(Symbol* name, Symbol* signature) const {
    22.1 --- a/src/share/vm/prims/jvm.cpp	Wed Sep 10 09:05:31 2014 -0700
    22.2 +++ b/src/share/vm/prims/jvm.cpp	Mon Sep 15 16:39:00 2014 -0400
    22.3 @@ -808,6 +808,7 @@
    22.4    return (jclass) JNIHandles::make_local(env, k->java_mirror());
    22.5  JVM_END
    22.6  
    22.7 +// Not used; JVM_FindClassFromCaller replaces this.
    22.8  JVM_ENTRY(jclass, JVM_FindClassFromClassLoader(JNIEnv* env, const char* name,
    22.9                                                 jboolean init, jobject loader,
   22.10                                                 jboolean throwError))
   22.11 @@ -834,6 +835,42 @@
   22.12    return result;
   22.13  JVM_END
   22.14  
   22.15 +// Find a class with this name in this loader, using the caller's protection domain.
   22.16 +JVM_ENTRY(jclass, JVM_FindClassFromCaller(JNIEnv* env, const char* name,
   22.17 +                                          jboolean init, jobject loader,
   22.18 +                                          jclass caller))
   22.19 +  JVMWrapper2("JVM_FindClassFromCaller %s throws ClassNotFoundException", name);
   22.20 +  // Java libraries should ensure that name is never null...
   22.21 +  if (name == NULL || (int)strlen(name) > Symbol::max_length()) {
   22.22 +    // It's impossible to create this class;  the name cannot fit
   22.23 +    // into the constant pool.
   22.24 +    THROW_MSG_0(vmSymbols::java_lang_ClassNotFoundException(), name);
   22.25 +  }
   22.26 +
   22.27 +  TempNewSymbol h_name = SymbolTable::new_symbol(name, CHECK_NULL);
   22.28 +
   22.29 +  oop loader_oop = JNIHandles::resolve(loader);
   22.30 +  oop from_class = JNIHandles::resolve(caller);
   22.31 +  oop protection_domain = NULL;
   22.32 +  // If loader is null, shouldn't call ClassLoader.checkPackageAccess; otherwise get
   22.33 +  // NPE. Put it in another way, the bootstrap class loader has all permission and
   22.34 +  // thus no checkPackageAccess equivalence in the VM class loader.
   22.35 +  // The caller is also passed as NULL by the java code if there is no security
   22.36 +  // manager to avoid the performance cost of getting the calling class.
   22.37 +  if (from_class != NULL && loader_oop != NULL) {
   22.38 +    protection_domain = java_lang_Class::as_Klass(from_class)->protection_domain();
   22.39 +  }
   22.40 +
   22.41 +  Handle h_loader(THREAD, loader_oop);
   22.42 +  Handle h_prot(THREAD, protection_domain);
   22.43 +  jclass result = find_class_from_class_loader(env, h_name, init, h_loader,
   22.44 +                                               h_prot, false, THREAD);
   22.45 +
   22.46 +  if (TraceClassResolution && result != NULL) {
   22.47 +    trace_class_resolution(java_lang_Class::as_Klass(JNIHandles::resolve_non_null(result)));
   22.48 +  }
   22.49 +  return result;
   22.50 +JVM_END
   22.51  
   22.52  JVM_ENTRY(jclass, JVM_FindClassFromClass(JNIEnv *env, const char *name,
   22.53                                           jboolean init, jclass from))
   22.54 @@ -3997,10 +4034,15 @@
   22.55  
   22.56  // Shared JNI/JVM entry points //////////////////////////////////////////////////////////////
   22.57  
   22.58 -jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init, Handle loader, Handle protection_domain, jboolean throwError, TRAPS) {
   22.59 +jclass find_class_from_class_loader(JNIEnv* env, Symbol* name, jboolean init,
   22.60 +                                    Handle loader, Handle protection_domain,
   22.61 +                                    jboolean throwError, TRAPS) {
   22.62    // Security Note:
   22.63    //   The Java level wrapper will perform the necessary security check allowing
   22.64 -  //   us to pass the NULL as the initiating class loader.
   22.65 +  //   us to pass the NULL as the initiating class loader.  The VM is responsible for
   22.66 +  //   the checkPackageAccess relative to the initiating class loader via the
   22.67 +  //   protection_domain. The protection_domain is passed as NULL by the java code
   22.68 +  //   if there is no security manager in 3-arg Class.forName().
   22.69    Klass* klass = SystemDictionary::resolve_or_fail(name, loader, protection_domain, throwError != 0, CHECK_NULL);
   22.70  
   22.71    KlassHandle klass_handle(THREAD, klass);
    23.1 --- a/src/share/vm/prims/jvm.h	Wed Sep 10 09:05:31 2014 -0700
    23.2 +++ b/src/share/vm/prims/jvm.h	Mon Sep 15 16:39:00 2014 -0400
    23.3 @@ -1,5 +1,5 @@
    23.4  /*
    23.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    23.6 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
    23.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.8   *
    23.9   * This code is free software; you can redistribute it and/or modify it
   23.10 @@ -420,6 +420,19 @@
   23.11  JVM_FindClassFromBootLoader(JNIEnv *env, const char *name);
   23.12  
   23.13  /*
   23.14 + * Find a class from a given class loader.  Throws ClassNotFoundException.
   23.15 + *  name:   name of class
   23.16 + *  init:   whether initialization is done
   23.17 + *  loader: class loader to look up the class. This may not be the same as the caller's
   23.18 + *          class loader.
   23.19 + *  caller: initiating class. The initiating class may be null when a security
   23.20 + *          manager is not installed.
   23.21 + */
   23.22 +JNIEXPORT jclass JNICALL
   23.23 +JVM_FindClassFromCaller(JNIEnv *env, const char *name, jboolean init,
   23.24 +                        jobject loader, jclass caller);
   23.25 +
   23.26 +/*
   23.27   * Find a class from a given class.
   23.28   */
   23.29  JNIEXPORT jclass JNICALL
    24.1 --- a/src/share/vm/runtime/arguments.cpp	Wed Sep 10 09:05:31 2014 -0700
    24.2 +++ b/src/share/vm/runtime/arguments.cpp	Mon Sep 15 16:39:00 2014 -0400
    24.3 @@ -2448,6 +2448,10 @@
    24.4      warning("The VM option CICompilerCountPerCPU overrides CICompilerCount.");
    24.5    }
    24.6  
    24.7 +#ifdef COMPILER1
    24.8 +  status &= verify_interval(SafepointPollOffset, 0, os::vm_page_size() - BytesPerWord, "SafepointPollOffset");
    24.9 +#endif
   24.10 +
   24.11    return status;
   24.12  }
   24.13  
   24.14 @@ -3701,6 +3705,11 @@
   24.15      return JNI_ENOMEM;
   24.16    }
   24.17  
   24.18 +  // Set up VerifySharedSpaces
   24.19 +  if (FLAG_IS_DEFAULT(VerifySharedSpaces) && SharedArchiveFile != NULL) {
   24.20 +    VerifySharedSpaces = true;
   24.21 +  }
   24.22 +
   24.23    // Delay warning until here so that we've had a chance to process
   24.24    // the -XX:-PrintWarnings flag
   24.25    if (needs_hotspotrc_warning) {
    25.1 --- a/src/share/vm/runtime/globals.hpp	Wed Sep 10 09:05:31 2014 -0700
    25.2 +++ b/src/share/vm/runtime/globals.hpp	Mon Sep 15 16:39:00 2014 -0400
    25.3 @@ -1154,11 +1154,11 @@
    25.4            "Prevent spurious or premature wakeups from object.wait "         \
    25.5            "(Solaris only)")                                                 \
    25.6                                                                              \
    25.7 -  product(intx, NativeMonitorTimeout, -1, "(Unstable)")                     \
    25.8 -                                                                            \
    25.9 -  product(intx, NativeMonitorFlags, 0, "(Unstable)")                        \
   25.10 -                                                                            \
   25.11 -  product(intx, NativeMonitorSpinLimit, 20, "(Unstable)")                   \
   25.12 +  experimental(intx, NativeMonitorTimeout, -1, "(Unstable)")                \
   25.13 +                                                                            \
   25.14 +  experimental(intx, NativeMonitorFlags, 0, "(Unstable)")                   \
   25.15 +                                                                            \
   25.16 +  experimental(intx, NativeMonitorSpinLimit, 20, "(Unstable)")              \
   25.17                                                                              \
   25.18    develop(bool, UsePthreads, false,                                         \
   25.19            "Use pthread-based instead of libthread-based synchronization "   \
   25.20 @@ -3775,6 +3775,10 @@
   25.21    product(bool, UseSharedSpaces, true,                                      \
   25.22            "Use shared spaces for metadata")                                 \
   25.23                                                                              \
   25.24 +  product(bool, VerifySharedSpaces, false,                                  \
   25.25 +          "Verify shared spaces (false for default archive, true for "      \
   25.26 +          "archive specified by -XX:SharedArchiveFile)")                    \
   25.27 +                                                                            \
   25.28    product(bool, RequireSharedSpaces, false,                                 \
   25.29            "Require shared spaces for metadata")                             \
   25.30                                                                              \
    26.1 --- a/src/share/vm/runtime/reflection.cpp	Wed Sep 10 09:05:31 2014 -0700
    26.2 +++ b/src/share/vm/runtime/reflection.cpp	Mon Sep 15 16:39:00 2014 -0400
    26.3 @@ -1,5 +1,5 @@
    26.4  /*
    26.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    26.6 + * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
    26.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    26.8   *
    26.9   * This code is free software; you can redistribute it and/or modify it
   26.10 @@ -482,7 +482,7 @@
   26.11      ik = InstanceKlass::cast(hc);
   26.12  
   26.13      // There's no way to make a host class loop short of patching memory.
   26.14 -    // Therefore there cannot be a loop here unles there's another bug.
   26.15 +    // Therefore there cannot be a loop here unless there's another bug.
   26.16      // Still, let's check for it.
   26.17      assert(--inf_loop_check > 0, "no host_klass loop");
   26.18    }
   26.19 @@ -551,7 +551,8 @@
   26.20    if (access.is_protected()) {
   26.21      if (!protected_restriction) {
   26.22        // See if current_class (or outermost host class) is a subclass of field_class
   26.23 -      if (host_class->is_subclass_of(field_class)) {
   26.24 +      // An interface may not access protected members of j.l.Object
   26.25 +      if (!host_class->is_interface() && host_class->is_subclass_of(field_class)) {
   26.26          if (access.is_static() || // static fields are ok, see 6622385
   26.27              current_class == resolved_class ||
   26.28              field_class == resolved_class ||

mercurial