changeset 5795:93c74efa2c44

Merge
author asaha
date Thu, 02 Oct 2014 08:45:11 -0700
parents b16738945803 (diff) af55a74be9b6 (current diff)
children 6c1a8b7ed616
files .hgtags
diffstat 7 files changed, 167 insertions(+), 82 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Oct 02 08:35:26 2014 -0700
+++ b/.hgtags	Thu Oct 02 08:45:11 2014 -0700
@@ -740,3 +740,6 @@
 a9e695f0d831f115720a4dcad3d33e0003b0acad jdk7u72-b12
 ac701f87d1ea46033c69f3e1cb84fc0a971da70c jdk7u72-b13
 d9b56c6bdddb6f9d8242230f5fdd58f9c7d30ea5 jdk7u72-b14
+e6b6d91b3934c281086f8efacb0926e7451cc18b jdk7u75-b00
+9096ac248b379a0f3012f18c7289ec47cdef8459 jdk7u75-b01
+a6964b2822d906eab9c923cdd723cf3dd4facfcd jdk7u75-b02
--- a/make/hotspot_version	Thu Oct 02 08:35:26 2014 -0700
+++ b/make/hotspot_version	Thu Oct 02 08:45:11 2014 -0700
@@ -1,5 +1,5 @@
 # 
-# Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 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
@@ -31,11 +31,11 @@
 #
 
 # Don't put quotes (fail windows build).
-HOTSPOT_VM_COPYRIGHT=Copyright 2014
+HOTSPOT_VM_COPYRIGHT=Copyright 2015
 
 HS_MAJOR_VER=24
-HS_MINOR_VER=72
-HS_BUILD_NUMBER=04
+HS_MINOR_VER=75
+HS_BUILD_NUMBER=01
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=7
--- a/src/share/vm/ci/bcEscapeAnalyzer.cpp	Thu Oct 02 08:35:26 2014 -0700
+++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp	Thu Oct 02 08:45:11 2014 -0700
@@ -89,8 +89,8 @@
 public:
   ArgumentMap *_vars;
   ArgumentMap *_stack;
-  short _stack_height;
-  short _max_stack;
+  int _stack_height;
+  int _max_stack;
   bool _initialized;
   ArgumentMap empty_map;
 
--- a/src/share/vm/prims/jni.cpp	Thu Oct 02 08:35:26 2014 -0700
+++ b/src/share/vm/prims/jni.cpp	Thu Oct 02 08:45:11 2014 -0700
@@ -5037,6 +5037,7 @@
 #include "gc_implementation/shared/gcTimer.hpp"
 #include "gc_interface/collectedHeap.hpp"
 #include "utilities/quickSort.hpp"
+#include "utilities/ostream.hpp"
 
 #define run_unit_test(unit_test_function_call)              \
   tty->print_cr("Running test: " #unit_test_function_call); \
@@ -5058,6 +5059,7 @@
     run_unit_test(QuickSort::test_quick_sort());
     run_unit_test(AltHashing::test_alt_hash());
     run_unit_test(TestOldFreeSpaceCalculation_test());
+    run_unit_test(test_loggc_filename());
     tty->print_cr("All internal VM tests passed");
   }
 }
--- a/src/share/vm/utilities/defaultStream.hpp	Thu Oct 02 08:35:26 2014 -0700
+++ b/src/share/vm/utilities/defaultStream.hpp	Thu Oct 02 08:45:11 2014 -0700
@@ -41,6 +41,8 @@
 
   void init();
   void init_log();
+  fileStream* open_file(const char* log_name);
+  void start_log();
   void finish_log();
   void finish_log_on_error(char *buf, int buflen);
  public:
--- a/src/share/vm/utilities/ostream.cpp	Thu Oct 02 08:35:26 2014 -0700
+++ b/src/share/vm/utilities/ostream.cpp	Thu Oct 02 08:45:11 2014 -0700
@@ -567,6 +567,11 @@
     buffer_length += strlen(pid);
   }
 
+  // File name is too long.
+  if (buffer_length > JVM_MAXPATHLEN) {
+    return NULL;
+  }
+
   // Create big enough buffer.
   char *buf = NEW_C_HEAP_ARRAY(char, buffer_length, mtInternal);
 
@@ -589,87 +594,54 @@
   return buf;
 }
 
+fileStream* defaultStream::open_file(const char* log_name){
+  const char* try_name = make_log_name(log_name, NULL);
+  if (try_name == NULL) {
+    warning("Cannot open file %s: file name is too long.\n", log_name);
+    return NULL;
+  }
+
+  fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
+  FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
+  if (file->is_open()) {
+    return file;
+  }
+
+  // Try again to open the file.
+  delete file;
+  char warnbuf[O_BUFLEN*2];
+  jio_snprintf(warnbuf, sizeof(warnbuf), "Warning:  Cannot open log file: %s\n", try_name);
+  // Note:  This feature is for maintainer use only.  No need for L10N.
+  jio_print(warnbuf);
+  try_name = make_log_name("hs_pid%p.log", os::get_temp_directory());
+  if (try_name == NULL) {
+    warning("Cannot open file %s: file name is too long for directory %s.\n", "hs_pid", os::get_temp_directory());
+    return NULL;
+  }
+
+  jio_snprintf(warnbuf, sizeof(warnbuf), "Warning:  Forcing option -XX:LogFile=%s\n", try_name);
+  jio_print(warnbuf);
+
+  file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
+  FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
+  if (file->is_open()) {
+    return file;
+  }
+
+  delete file;
+  return NULL;
+}
+
 void defaultStream::init_log() {
   // %%% Need a MutexLocker?
   const char* log_name = LogFile != NULL ? LogFile : "hotspot.log";
-  const char* try_name = make_log_name(log_name, NULL);
-  fileStream* file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
-  if (!file->is_open()) {
-    // Try again to open the file.
-    char warnbuf[O_BUFLEN*2];
-    jio_snprintf(warnbuf, sizeof(warnbuf),
-                 "Warning:  Cannot open log file: %s\n", try_name);
-    // Note:  This feature is for maintainer use only.  No need for L10N.
-    jio_print(warnbuf);
-    FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
-    try_name = make_log_name("hs_pid%p.log", os::get_temp_directory());
-    jio_snprintf(warnbuf, sizeof(warnbuf),
-                 "Warning:  Forcing option -XX:LogFile=%s\n", try_name);
-    jio_print(warnbuf);
-    delete file;
-    file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
-    FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
-  }
-  if (file->is_open()) {
+  fileStream* file = open_file(log_name);
+
+  if (file != NULL) {
     _log_file = file;
-    xmlStream* xs = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file);
-    _outer_xmlStream = xs;
-    if (this == tty)  xtty = xs;
-    // Write XML header.
-    xs->print_cr("<?xml version='1.0' encoding='UTF-8'?>");
-    // (For now, don't bother to issue a DTD for this private format.)
-    jlong time_ms = os::javaTimeMillis() - tty->time_stamp().milliseconds();
-    // %%% Should be: jlong time_ms = os::start_time_milliseconds(), if
-    // we ever get round to introduce that method on the os class
-    xs->head("hotspot_log version='%d %d'"
-             " process='%d' time_ms='"INT64_FORMAT"'",
-             LOG_MAJOR_VERSION, LOG_MINOR_VERSION,
-             os::current_process_id(), time_ms);
-    // Write VM version header immediately.
-    xs->head("vm_version");
-    xs->head("name"); xs->text("%s", VM_Version::vm_name()); xs->cr();
-    xs->tail("name");
-    xs->head("release"); xs->text("%s", VM_Version::vm_release()); xs->cr();
-    xs->tail("release");
-    xs->head("info"); xs->text("%s", VM_Version::internal_vm_info_string()); xs->cr();
-    xs->tail("info");
-    xs->tail("vm_version");
-    // Record information about the command-line invocation.
-    xs->head("vm_arguments");  // Cf. Arguments::print_on()
-    if (Arguments::num_jvm_flags() > 0) {
-      xs->head("flags");
-      Arguments::print_jvm_flags_on(xs->text());
-      xs->tail("flags");
-    }
-    if (Arguments::num_jvm_args() > 0) {
-      xs->head("args");
-      Arguments::print_jvm_args_on(xs->text());
-      xs->tail("args");
-    }
-    if (Arguments::java_command() != NULL) {
-      xs->head("command"); xs->text()->print_cr("%s", Arguments::java_command());
-      xs->tail("command");
-    }
-    if (Arguments::sun_java_launcher() != NULL) {
-      xs->head("launcher"); xs->text()->print_cr("%s", Arguments::sun_java_launcher());
-      xs->tail("launcher");
-    }
-    if (Arguments::system_properties() !=  NULL) {
-      xs->head("properties");
-      // Print it as a java-style property list.
-      // System properties don't generally contain newlines, so don't bother with unparsing.
-      for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
-        xs->text()->print_cr("%s=%s", p->key(), p->value());
-      }
-      xs->tail("properties");
-    }
-    xs->tail("vm_arguments");
-    // tty output per se is grouped under the <tty>...</tty> element.
-    xs->head("tty");
-    // All further non-markup text gets copied to the tty:
-    xs->_text = this;  // requires friend declaration!
+    _outer_xmlStream = new(ResourceObj::C_HEAP, mtInternal) xmlStream(file);
+    start_log();
   } else {
-    delete(file);
     // and leave xtty as NULL
     LogVMOutput = false;
     DisplayVMOutput = true;
@@ -677,6 +649,64 @@
   }
 }
 
+void defaultStream::start_log() {
+  xmlStream* xs = _outer_xmlStream;
+  if (this == tty)  xtty = xs;
+  // Write XML header.
+  xs->print_cr("<?xml version='1.0' encoding='UTF-8'?>");
+  // (For now, don't bother to issue a DTD for this private format.)
+  jlong time_ms = os::javaTimeMillis() - tty->time_stamp().milliseconds();
+  // %%% Should be: jlong time_ms = os::start_time_milliseconds(), if
+  // we ever get round to introduce that method on the os class
+  xs->head("hotspot_log version='%d %d'"
+           " process='%d' time_ms='"INT64_FORMAT"'",
+           LOG_MAJOR_VERSION, LOG_MINOR_VERSION,
+           os::current_process_id(), time_ms);
+  // Write VM version header immediately.
+  xs->head("vm_version");
+  xs->head("name"); xs->text("%s", VM_Version::vm_name()); xs->cr();
+  xs->tail("name");
+  xs->head("release"); xs->text("%s", VM_Version::vm_release()); xs->cr();
+  xs->tail("release");
+  xs->head("info"); xs->text("%s", VM_Version::internal_vm_info_string()); xs->cr();
+  xs->tail("info");
+  xs->tail("vm_version");
+  // Record information about the command-line invocation.
+  xs->head("vm_arguments");  // Cf. Arguments::print_on()
+  if (Arguments::num_jvm_flags() > 0) {
+    xs->head("flags");
+    Arguments::print_jvm_flags_on(xs->text());
+    xs->tail("flags");
+  }
+  if (Arguments::num_jvm_args() > 0) {
+    xs->head("args");
+    Arguments::print_jvm_args_on(xs->text());
+    xs->tail("args");
+  }
+  if (Arguments::java_command() != NULL) {
+    xs->head("command"); xs->text()->print_cr("%s", Arguments::java_command());
+    xs->tail("command");
+  }
+  if (Arguments::sun_java_launcher() != NULL) {
+    xs->head("launcher"); xs->text()->print_cr("%s", Arguments::sun_java_launcher());
+    xs->tail("launcher");
+  }
+  if (Arguments::system_properties() !=  NULL) {
+    xs->head("properties");
+    // Print it as a java-style property list.
+    // System properties don't generally contain newlines, so don't bother with unparsing.
+    for (SystemProperty* p = Arguments::system_properties(); p != NULL; p = p->next()) {
+      xs->text()->print_cr("%s=%s", p->key(), p->value());
+    }
+    xs->tail("properties");
+  }
+  xs->tail("vm_arguments");
+  // tty output per se is grouped under the <tty>...</tty> element.
+  xs->head("tty");
+  // All further non-markup text gets copied to the tty:
+  xs->_text = this;  // requires friend declaration!
+}
+
 // finish_log() is called during normal VM shutdown. finish_log_on_error() is
 // called by ostream_abort() after a fatal error.
 //
@@ -1038,6 +1068,50 @@
 }
 
 #ifndef PRODUCT
+void test_loggc_filename() {
+  const char* o_result;
+
+  {
+    // longest filename
+    char longest_name[JVM_MAXPATHLEN];
+    memset(longest_name, 'a', sizeof(longest_name));
+    longest_name[JVM_MAXPATHLEN - 1] = '\0';
+    o_result = make_log_name((const char*)&longest_name, NULL);
+    assert(strcmp(longest_name, o_result) == 0, err_msg("longest name does not match. expected '%s' but got '%s'", longest_name, o_result));
+    FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  }
+
+  {
+    // too long file name
+    char too_long_name[JVM_MAXPATHLEN + 100];
+    int too_long_length = sizeof(too_long_name);
+    memset(too_long_name, 'a', too_long_length);
+    too_long_name[too_long_length - 1] = '\0';
+    o_result = make_log_name((const char*)&too_long_name, NULL);
+    assert(o_result == NULL, err_msg("Too long file name should return NULL, but got '%s'", o_result));
+  }
+
+  {
+    // too long with pid
+    char longest_name[JVM_MAXPATHLEN];
+    memset(longest_name, 'a', JVM_MAXPATHLEN);
+    longest_name[JVM_MAXPATHLEN - 3] = '%';
+    longest_name[JVM_MAXPATHLEN - 2] = 'p';
+    longest_name[JVM_MAXPATHLEN - 1] = '\0';
+    o_result = make_log_name((const char*)&longest_name, NULL);
+    assert(o_result == NULL, err_msg("Too long file name after %%p pid expansion should return NULL, but got '%s'", o_result));
+  }
+
+  {
+    // too long with pid (star)
+    char longest_name[JVM_MAXPATHLEN];
+    memset(longest_name, 'a', JVM_MAXPATHLEN);
+    longest_name[JVM_MAXPATHLEN - 2] = '*';
+    longest_name[JVM_MAXPATHLEN - 1] = '\0';
+    o_result = make_log_name((const char*)&longest_name, NULL);
+    assert(o_result == NULL, err_msg("Too long file name after star (pid) expansion should return NULL, but got '%s'", o_result));
+  }
+}
 
 #if defined(SOLARIS) || defined(LINUX) || defined(_ALLBSD_SOURCE)
 #include <sys/types.h>
--- a/src/share/vm/utilities/ostream.hpp	Thu Oct 02 08:35:26 2014 -0700
+++ b/src/share/vm/utilities/ostream.hpp	Thu Oct 02 08:45:11 2014 -0700
@@ -242,6 +242,10 @@
   virtual void rotate_log();
 };
 
+#ifndef PRODUCT
+void test_loggc_filename();
+#endif
+
 void ostream_init();
 void ostream_init_log();
 void ostream_exit();