Merge

Tue, 16 Aug 2016 13:31:51 -0700

author
asaha
date
Tue, 16 Aug 2016 13:31:51 -0700
changeset 8680
6009b66f2fa1
parent 8679
fff265b31090
parent 8587
14919ca8db45
child 8684
3e2b407e18c3

Merge

.hgtags file | annotate | diff | comparison | revisions
     1.1 --- a/.hgtags	Thu Aug 11 12:17:39 2016 +0300
     1.2 +++ b/.hgtags	Tue Aug 16 13:31:51 2016 -0700
     1.3 @@ -904,6 +904,7 @@
     1.4  019b22dd8128840ecdcd1bfebcf4447e28e45068 jdk8u111-b06
     1.5  3f337aaf090769653ee0a746fbe661d09055a883 jdk8u111-b07
     1.6  e180e364a40364a059a20c74b97ab4e928e2b676 jdk8u111-b08
     1.7 +c48b303692bb86c42e928da6dec815e901a24c5b jdk8u111-b09
     1.8  b09a69142dd3bf78ca66bb0c99046ca7cccbdda9 jdk8u112-b00
     1.9  cf1faa9100dd8c8df6e1a604aaf613d037f51ebf jdk8u112-b01
    1.10  f22b5be95347c669a1463d9e05ec3bf11420208e jdk8u112-b02
    1.11 @@ -912,4 +913,5 @@
    1.12  4b7af794466ba22461ed043a1394df43e4993c4f jdk8u112-b06
    1.13  55ed9b0a35e4ad4bb5ca3f393f6749e81ad9fef0 jdk8u112-b07
    1.14  670f8169b83c6af14339fe37b2a2b8384dc2149b jdk8u112-b08
    1.15 +1ccd27199595fedefcd1ca4a335e049887c63107 jdk8u112-b09
    1.16  3b0e5f01891f5ebbf67797b1aae786196f1bb4f6 jdk8u121-b00
     2.1 --- a/src/share/vm/oops/method.cpp	Thu Aug 11 12:17:39 2016 +0300
     2.2 +++ b/src/share/vm/oops/method.cpp	Tue Aug 16 13:31:51 2016 -0700
     2.3 @@ -111,6 +111,7 @@
     2.4  // Release Method*.  The nmethod will be gone when we get here because
     2.5  // we've walked the code cache.
     2.6  void Method::deallocate_contents(ClassLoaderData* loader_data) {
     2.7 +  clear_jmethod_id(loader_data);
     2.8    MetadataFactory::free_metadata(loader_data, constMethod());
     2.9    set_constMethod(NULL);
    2.10    MetadataFactory::free_metadata(loader_data, method_data());
    2.11 @@ -1800,6 +1801,17 @@
    2.12  #endif // ASSERT
    2.13      *m = _free_method;
    2.14    }
    2.15 +  void clear_method(Method* m) {
    2.16 +    for (JNIMethodBlock* b = this; b != NULL; b = b->_next) {
    2.17 +      for (int i = 0; i < number_of_methods; i++) {
    2.18 +        if (b->_methods[i] == m) {
    2.19 +          b->_methods[i] = NULL;
    2.20 +          return;
    2.21 +        }
    2.22 +      }
    2.23 +    }
    2.24 +    // not found
    2.25 +  }
    2.26  
    2.27    // During class unloading the methods are cleared, which is different
    2.28    // than freed.
    2.29 @@ -1872,7 +1884,9 @@
    2.30  
    2.31  bool Method::is_method_id(jmethodID mid) {
    2.32    Method* m = resolve_jmethod_id(mid);
    2.33 -  assert(m != NULL, "should be called with non-null method");
    2.34 +  if (m == NULL) {
    2.35 +    return false;
    2.36 +  }
    2.37    InstanceKlass* ik = m->method_holder();
    2.38    if (ik == NULL) {
    2.39      return false;
    2.40 @@ -1905,6 +1919,10 @@
    2.41    }
    2.42  }
    2.43  
    2.44 +void Method::clear_jmethod_id(ClassLoaderData* loader_data) {
    2.45 +  loader_data->jmethod_ids()->clear_method(this);
    2.46 +}
    2.47 +
    2.48  // Called when the class loader is unloaded to make all methods weak.
    2.49  void Method::clear_jmethod_ids(ClassLoaderData* loader_data) {
    2.50    loader_data->jmethod_ids()->clear_all_methods();
     3.1 --- a/src/share/vm/oops/method.hpp	Thu Aug 11 12:17:39 2016 +0300
     3.2 +++ b/src/share/vm/oops/method.hpp	Tue Aug 16 13:31:51 2016 -0700
     3.3 @@ -768,6 +768,8 @@
     3.4  
     3.5    // Helper routines for intrinsic_id() and vmIntrinsics::method().
     3.6    void init_intrinsic_id();     // updates from _none if a match
     3.7 +  void clear_jmethod_id(ClassLoaderData* loader_data);
     3.8 +
     3.9    static vmSymbols::SID klass_id_for_intrinsics(Klass* holder);
    3.10  
    3.11    bool     jfr_towrite()                { return _jfr_towrite;              }
     4.1 --- a/src/share/vm/prims/jvm.cpp	Thu Aug 11 12:17:39 2016 +0300
     4.2 +++ b/src/share/vm/prims/jvm.cpp	Tue Aug 16 13:31:51 2016 -0700
     4.3 @@ -1,5 +1,5 @@
     4.4  /*
     4.5 - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     4.6 + * Copyright (c) 1997, 2016, 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 @@ -2872,7 +2872,18 @@
    4.11  int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args) {
    4.12    // see bug 4399518, 4417214
    4.13    if ((intptr_t)count <= 0) return -1;
    4.14 -  return vsnprintf(str, count, fmt, args);
    4.15 +
    4.16 +  int result = vsnprintf(str, count, fmt, args);
    4.17 +  // Note: on truncation vsnprintf(3) on Unix returns number of
    4.18 +  // characters which would have been written had the buffer been large
    4.19 +  // enough; on Windows, it returns -1. We handle both cases here and
    4.20 +  // always return -1, and perform null termination.
    4.21 +  if ((result > 0 && (size_t)result >= count) || result == -1) {
    4.22 +    str[count - 1] = '\0';
    4.23 +    result = -1;
    4.24 +  }
    4.25 +
    4.26 +  return result;
    4.27  }
    4.28  
    4.29  ATTRIBUTE_PRINTF(3, 0)
     5.1 --- a/src/share/vm/runtime/deoptimization.cpp	Thu Aug 11 12:17:39 2016 +0300
     5.2 +++ b/src/share/vm/runtime/deoptimization.cpp	Tue Aug 16 13:31:51 2016 -0700
     5.3 @@ -1881,8 +1881,6 @@
     5.4                         trap_reason_name(reason),
     5.5                         recomp_flag ? " recompiled" : "");
     5.6    }
     5.7 -  if (len >= buflen)
     5.8 -    buf[buflen-1] = '\0';
     5.9    return buf;
    5.10  }
    5.11  
    5.12 @@ -1952,8 +1950,6 @@
    5.13      len = jio_snprintf(buf, buflen, "reason='%s' action='%s' index='%d'",
    5.14                         reason, action, unloaded_class_index);
    5.15    }
    5.16 -  if (len >= buflen)
    5.17 -    buf[buflen-1] = '\0';
    5.18    return buf;
    5.19  }
    5.20  
     6.1 --- a/src/share/vm/runtime/java.cpp	Thu Aug 11 12:17:39 2016 +0300
     6.2 +++ b/src/share/vm/runtime/java.cpp	Tue Aug 16 13:31:51 2016 -0700
     6.3 @@ -1,5 +1,5 @@
     6.4  /*
     6.5 - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     6.6 + * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     6.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8   *
     6.9   * This code is free software; you can redistribute it and/or modify it
    6.10 @@ -773,25 +773,36 @@
    6.11  }
    6.12  
    6.13  void JDK_Version::to_string(char* buffer, size_t buflen) const {
    6.14 +  assert(buffer && buflen > 0, "call with useful buffer");
    6.15    size_t index = 0;
    6.16    if (!is_valid()) {
    6.17      jio_snprintf(buffer, buflen, "%s", "(uninitialized)");
    6.18    } else if (is_partially_initialized()) {
    6.19      jio_snprintf(buffer, buflen, "%s", "(uninitialized) pre-1.6.0");
    6.20    } else {
    6.21 -    index += jio_snprintf(
    6.22 +    int rc = jio_snprintf(
    6.23          &buffer[index], buflen - index, "%d.%d", _major, _minor);
    6.24 +    if (rc == -1) return;
    6.25 +    index += rc;
    6.26      if (_micro > 0) {
    6.27 -      index += jio_snprintf(&buffer[index], buflen - index, ".%d", _micro);
    6.28 +      rc = jio_snprintf(&buffer[index], buflen - index, ".%d", _micro);
    6.29 +      if (rc == -1) return;
    6.30 +      index += rc;
    6.31      }
    6.32      if (_update > 0) {
    6.33 -      index += jio_snprintf(&buffer[index], buflen - index, "_%02d", _update);
    6.34 +      rc = jio_snprintf(&buffer[index], buflen - index, "_%02d", _update);
    6.35 +      if (rc == -1) return;
    6.36 +      index += rc;
    6.37      }
    6.38      if (_special > 0) {
    6.39 -      index += jio_snprintf(&buffer[index], buflen - index, "%c", _special);
    6.40 +      rc = jio_snprintf(&buffer[index], buflen - index, "%c", _special);
    6.41 +      if (rc == -1) return;
    6.42 +      index += rc;
    6.43      }
    6.44      if (_build > 0) {
    6.45 -      index += jio_snprintf(&buffer[index], buflen - index, "-b%02d", _build);
    6.46 +      rc = jio_snprintf(&buffer[index], buflen - index, "-b%02d", _build);
    6.47 +      if (rc == -1) return;
    6.48 +      index += rc;
    6.49      }
    6.50    }
    6.51  }

mercurial