Merge

Wed, 18 Apr 2018 12:37:42 -0700

author
robm
date
Wed, 18 Apr 2018 12:37:42 -0700
changeset 9310
574c3b0cf3e5
parent 9298
df9cd79f6387
parent 9309
187f1907676f
child 9311
cb0b95b67cb2

Merge

     1.1 --- a/make/bsd/makefiles/jsig.make	Fri Apr 13 18:17:50 2018 +0000
     1.2 +++ b/make/bsd/makefiles/jsig.make	Wed Apr 18 12:37:42 2018 -0700
     1.3 @@ -62,7 +62,7 @@
     1.4  $(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
     1.5  	@echo Making signal interposition lib...
     1.6  	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
     1.7 -                         $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) -o $@ $<
     1.8 +                         $(LFLAGS_JSIG) $(JSIG_DEBUG_CFLAGS) $(EXTRA_CFLAGS) -o $@ $<
     1.9  ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
    1.10    ifeq ($(OS_VENDOR), Darwin)
    1.11  	$(DSYMUTIL) $@
     2.1 --- a/src/cpu/zero/vm/entry_zero.hpp	Fri Apr 13 18:17:50 2018 +0000
     2.2 +++ b/src/cpu/zero/vm/entry_zero.hpp	Wed Apr 18 12:37:42 2018 -0700
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
     2.7   * Copyright 2008, 2009, 2010 Red Hat, Inc.
     2.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.9   *
    2.10 @@ -26,6 +26,8 @@
    2.11  #ifndef CPU_ZERO_VM_ENTRY_ZERO_HPP
    2.12  #define CPU_ZERO_VM_ENTRY_ZERO_HPP
    2.13  
    2.14 +#include "interpreter/cppInterpreter.hpp"
    2.15 +
    2.16  class ZeroEntry {
    2.17   public:
    2.18    ZeroEntry() {
     3.1 --- a/src/cpu/zero/vm/nativeInst_zero.cpp	Fri Apr 13 18:17:50 2018 +0000
     3.2 +++ b/src/cpu/zero/vm/nativeInst_zero.cpp	Wed Apr 18 12:37:42 2018 -0700
     3.3 @@ -1,5 +1,5 @@
     3.4  /*
     3.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     3.6 + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
     3.7   * Copyright 2008 Red Hat, Inc.
     3.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.9   *
    3.10 @@ -25,6 +25,8 @@
    3.11  
    3.12  #include "precompiled.hpp"
    3.13  #include "assembler_zero.inline.hpp"
    3.14 +#include "entry_zero.hpp"
    3.15 +#include "interpreter/cppInterpreter.hpp"
    3.16  #include "memory/resourceArea.hpp"
    3.17  #include "nativeInst_zero.hpp"
    3.18  #include "oops/oop.inline.hpp"
     4.1 --- a/src/os/linux/vm/os_linux.hpp	Fri Apr 13 18:17:50 2018 +0000
     4.2 +++ b/src/os/linux/vm/os_linux.hpp	Wed Apr 18 12:37:42 2018 -0700
     4.3 @@ -284,8 +284,8 @@
     4.4    static void set_numa_bitmask_isbitset(numa_bitmask_isbitset_func_t func) { _numa_bitmask_isbitset = func; }
     4.5    static void set_numa_distance(numa_distance_func_t func) { _numa_distance = func; }
     4.6    static void set_numa_all_nodes(unsigned long* ptr) { _numa_all_nodes = ptr; }
     4.7 -  static void set_numa_all_nodes_ptr(struct bitmask **ptr) { _numa_all_nodes_ptr = *ptr; }
     4.8 -  static void set_numa_nodes_ptr(struct bitmask **ptr) { _numa_nodes_ptr = *ptr; }
     4.9 +  static void set_numa_all_nodes_ptr(struct bitmask **ptr) { _numa_all_nodes_ptr = (ptr == NULL ? NULL : *ptr); }
    4.10 +  static void set_numa_nodes_ptr(struct bitmask **ptr) { _numa_nodes_ptr = (ptr == NULL ? NULL : *ptr); }
    4.11    static int sched_getcpu_syscall(void);
    4.12  public:
    4.13    static int sched_getcpu()  { return _sched_getcpu != NULL ? _sched_getcpu() : -1; }
    4.14 @@ -329,6 +329,18 @@
    4.15    static bool isnode_in_existing_nodes(unsigned int n) {
    4.16      if (_numa_bitmask_isbitset != NULL && _numa_nodes_ptr != NULL) {
    4.17        return _numa_bitmask_isbitset(_numa_nodes_ptr, n);
    4.18 +    } else if (_numa_bitmask_isbitset != NULL && _numa_all_nodes_ptr != NULL) {
    4.19 +      // Not all libnuma API v2 implement numa_nodes_ptr, so it's not possible
    4.20 +      // to trust the API version for checking its absence. On the other hand,
    4.21 +      // numa_nodes_ptr found in libnuma 2.0.9 and above is the only way to get
    4.22 +      // a complete view of all numa nodes in the system, hence numa_nodes_ptr
    4.23 +      // is used to handle CPU and nodes on architectures (like PowerPC) where
    4.24 +      // there can exist nodes with CPUs but no memory or vice-versa and the
    4.25 +      // nodes may be non-contiguous. For most of the architectures, like
    4.26 +      // x86_64, numa_node_ptr presents the same node set as found in
    4.27 +      // numa_all_nodes_ptr so it's possible to use numa_all_nodes_ptr as a
    4.28 +      // substitute.
    4.29 +      return _numa_bitmask_isbitset(_numa_all_nodes_ptr, n);
    4.30      } else
    4.31        return 0;
    4.32    }
     5.1 --- a/src/share/vm/c1/c1_Runtime1.cpp	Fri Apr 13 18:17:50 2018 +0000
     5.2 +++ b/src/share/vm/c1/c1_Runtime1.cpp	Wed Apr 18 12:37:42 2018 -0700
     5.3 @@ -1,5 +1,5 @@
     5.4  /*
     5.5 - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
     5.6 + * Copyright (c) 1999, 2018, 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 @@ -547,9 +547,8 @@
    5.11      // normal bytecode execution.
    5.12      thread->clear_exception_oop_and_pc();
    5.13  
    5.14 -    Handle original_exception(thread, exception());
    5.15 -
    5.16 -    continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false);
    5.17 +    bool recursive_exception = false;
    5.18 +    continuation = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, false, false, recursive_exception);
    5.19      // If an exception was thrown during exception dispatch, the exception oop may have changed
    5.20      thread->set_exception_oop(exception());
    5.21      thread->set_exception_pc(pc);
    5.22 @@ -557,8 +556,9 @@
    5.23      // the exception cache is used only by non-implicit exceptions
    5.24      // Update the exception cache only when there didn't happen
    5.25      // another exception during the computation of the compiled
    5.26 -    // exception handler.
    5.27 -    if (continuation != NULL && original_exception() == exception()) {
    5.28 +    // exception handler. Checking for exception oop equality is not
    5.29 +    // sufficient because some exceptions are pre-allocated and reused.
    5.30 +    if (continuation != NULL && !recursive_exception) {
    5.31        nm->add_handler_for_exception_and_pc(exception, pc, continuation);
    5.32      }
    5.33    }
     6.1 --- a/src/share/vm/code/codeBlob.cpp	Fri Apr 13 18:17:50 2018 +0000
     6.2 +++ b/src/share/vm/code/codeBlob.cpp	Wed Apr 18 12:37:42 2018 -0700
     6.3 @@ -1,5 +1,5 @@
     6.4  /*
     6.5 - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
     6.6 + * Copyright (c) 1998, 2018, 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 @@ -289,6 +289,28 @@
    6.11    return blob;
    6.12  }
    6.13  
    6.14 +VtableBlob::VtableBlob(const char* name, int size) :
    6.15 +  BufferBlob(name, size) {
    6.16 +}
    6.17 +
    6.18 +VtableBlob* VtableBlob::create(const char* name, int buffer_size) {
    6.19 +  ThreadInVMfromUnknown __tiv;  // get to VM state in case we block on CodeCache_lock
    6.20 +
    6.21 +  VtableBlob* blob = NULL;
    6.22 +  unsigned int size = sizeof(VtableBlob);
    6.23 +  // align the size to CodeEntryAlignment
    6.24 +  size = align_code_offset(size);
    6.25 +  size += round_to(buffer_size, oopSize);
    6.26 +  assert(name != NULL, "must provide a name");
    6.27 +  {
    6.28 +    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
    6.29 +    blob = new (size) VtableBlob(name, size);
    6.30 +  }
    6.31 +  // Track memory usage statistic after releasing CodeCache_lock
    6.32 +  MemoryService::track_code_cache_memory_usage();
    6.33 +
    6.34 +  return blob;
    6.35 +}
    6.36  
    6.37  //----------------------------------------------------------------------------------------------------
    6.38  // Implementation of MethodHandlesAdapterBlob
     7.1 --- a/src/share/vm/code/codeBlob.hpp	Fri Apr 13 18:17:50 2018 +0000
     7.2 +++ b/src/share/vm/code/codeBlob.hpp	Wed Apr 18 12:37:42 2018 -0700
     7.3 @@ -1,5 +1,5 @@
     7.4  /*
     7.5 - * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
     7.6 + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
     7.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8   *
     7.9   * This code is free software; you can redistribute it and/or modify it
    7.10 @@ -101,6 +101,7 @@
    7.11    virtual bool is_exception_stub() const         { return false; }
    7.12    virtual bool is_safepoint_stub() const              { return false; }
    7.13    virtual bool is_adapter_blob() const                { return false; }
    7.14 +  virtual bool is_vtable_blob() const                 { return false; }
    7.15    virtual bool is_method_handles_adapter_blob() const { return false; }
    7.16  
    7.17    virtual bool is_compiled_by_c2() const         { return false; }
    7.18 @@ -202,6 +203,7 @@
    7.19  class BufferBlob: public CodeBlob {
    7.20    friend class VMStructs;
    7.21    friend class AdapterBlob;
    7.22 +  friend class VtableBlob;
    7.23    friend class MethodHandlesAdapterBlob;
    7.24  
    7.25   private:
    7.26 @@ -246,6 +248,18 @@
    7.27    virtual bool is_adapter_blob() const { return true; }
    7.28  };
    7.29  
    7.30 +//---------------------------------------------------------------------------------------------------
    7.31 +class VtableBlob: public BufferBlob {
    7.32 +private:
    7.33 +  VtableBlob(const char*, int);
    7.34 +
    7.35 +public:
    7.36 +  // Creation
    7.37 +  static VtableBlob* create(const char* name, int buffer_size);
    7.38 +
    7.39 +  // Typing
    7.40 +  virtual bool is_vtable_blob() const { return true; }
    7.41 +};
    7.42  
    7.43  //----------------------------------------------------------------------------------------------------
    7.44  // MethodHandlesAdapterBlob: used to hold MethodHandles adapters
     8.1 --- a/src/share/vm/code/codeCache.cpp	Fri Apr 13 18:17:50 2018 +0000
     8.2 +++ b/src/share/vm/code/codeCache.cpp	Wed Apr 18 12:37:42 2018 -0700
     8.3 @@ -1,5 +1,5 @@
     8.4  /*
     8.5 - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
     8.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     8.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.8   *
     8.9   * This code is free software; you can redistribute it and/or modify it
    8.10 @@ -41,6 +41,7 @@
    8.11  #include "oops/oop.inline.hpp"
    8.12  #include "runtime/handles.inline.hpp"
    8.13  #include "runtime/arguments.hpp"
    8.14 +#include "runtime/deoptimization.hpp"
    8.15  #include "runtime/icache.hpp"
    8.16  #include "runtime/java.hpp"
    8.17  #include "runtime/mutexLocker.hpp"
     9.1 --- a/src/share/vm/code/compiledIC.cpp	Fri Apr 13 18:17:50 2018 +0000
     9.2 +++ b/src/share/vm/code/compiledIC.cpp	Wed Apr 18 12:37:42 2018 -0700
     9.3 @@ -1,5 +1,5 @@
     9.4  /*
     9.5 - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
     9.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
     9.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.8   *
     9.9   * This code is free software; you can redistribute it and/or modify it
    9.10 @@ -232,7 +232,7 @@
    9.11      assert(k->verify_itable_index(itable_index), "sanity check");
    9.12  #endif //ASSERT
    9.13      CompiledICHolder* holder = new CompiledICHolder(call_info->resolved_method()->method_holder(),
    9.14 -                                                    call_info->resolved_klass()());
    9.15 +                                                    call_info->resolved_klass()(), false);
    9.16      holder->claim();
    9.17      InlineCacheBuffer::create_transition_stub(this, holder, entry);
    9.18    } else {
    9.19 @@ -270,7 +270,7 @@
    9.20    assert(!is_optimized(), "an optimized call cannot be megamorphic");
    9.21  
    9.22    // Cannot rely on cached_value. It is either an interface or a method.
    9.23 -  return VtableStubs::is_entry_point(ic_destination());
    9.24 +  return VtableStubs::entry_point(ic_destination()) != NULL;
    9.25  }
    9.26  
    9.27  bool CompiledIC::is_call_to_compiled() const {
    9.28 @@ -534,9 +534,11 @@
    9.29      return true;
    9.30    }
    9.31    // itable stubs also use CompiledICHolder
    9.32 -  if (VtableStubs::is_entry_point(entry) && VtableStubs::stub_containing(entry)->is_itable_stub()) {
    9.33 -    return true;
    9.34 +  if (cb != NULL && cb->is_vtable_blob()) {
    9.35 +    VtableStub* s = VtableStubs::entry_point(entry);
    9.36 +    return (s != NULL) && s->is_itable_stub();
    9.37    }
    9.38 +
    9.39    return false;
    9.40  }
    9.41  
    10.1 --- a/src/share/vm/code/vtableStubs.cpp	Fri Apr 13 18:17:50 2018 +0000
    10.2 +++ b/src/share/vm/code/vtableStubs.cpp	Wed Apr 18 12:37:42 2018 -0700
    10.3 @@ -1,5 +1,5 @@
    10.4  /*
    10.5 - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
    10.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    10.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    10.8   *
    10.9   * This code is free software; you can redistribute it and/or modify it
   10.10 @@ -60,7 +60,7 @@
   10.11  
   10.12     // There is a dependency on the name of the blob in src/share/vm/prims/jvmtiCodeBlobEvents.cpp
   10.13     // If changing the name, update the other file accordingly.
   10.14 -    BufferBlob* blob = BufferBlob::create("vtable chunks", bytes);
   10.15 +    VtableBlob* blob = VtableBlob::create("vtable chunks", bytes);
   10.16      if (blob == NULL) {
   10.17        return NULL;
   10.18      }
   10.19 @@ -167,17 +167,18 @@
   10.20    _number_of_vtable_stubs++;
   10.21  }
   10.22  
   10.23 -
   10.24 -bool VtableStubs::is_entry_point(address pc) {
   10.25 +VtableStub* VtableStubs::entry_point(address pc) {
   10.26    MutexLocker ml(VtableStubs_lock);
   10.27    VtableStub* stub = (VtableStub*)(pc - VtableStub::entry_offset());
   10.28    uint hash = VtableStubs::hash(stub->is_vtable_stub(), stub->index());
   10.29    VtableStub* s;
   10.30    for (s = _table[hash]; s != NULL && s != stub; s = s->next()) {}
   10.31 -  return s == stub;
   10.32 +  if (s == stub) {
   10.33 +    return s;
   10.34 +  }
   10.35 +  return NULL;
   10.36  }
   10.37  
   10.38 -
   10.39  bool VtableStubs::contains(address pc) {
   10.40    // simple solution for now - we may want to use
   10.41    // a faster way if this function is called often
    11.1 --- a/src/share/vm/code/vtableStubs.hpp	Fri Apr 13 18:17:50 2018 +0000
    11.2 +++ b/src/share/vm/code/vtableStubs.hpp	Wed Apr 18 12:37:42 2018 -0700
    11.3 @@ -1,5 +1,5 @@
    11.4  /*
    11.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    11.6 + * Copyright (c) 1997, 2018, 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 @@ -126,7 +126,7 @@
   11.11   public:
   11.12    static address     find_vtable_stub(int vtable_index) { return find_stub(true,  vtable_index); }
   11.13    static address     find_itable_stub(int itable_index) { return find_stub(false, itable_index); }
   11.14 -  static bool        is_entry_point(address pc);                     // is pc a vtable stub entry point?
   11.15 +  static VtableStub* entry_point(address pc);                        // vtable stub entry point for a pc
   11.16    static bool        contains(address pc);                           // is pc within any stub?
   11.17    static VtableStub* stub_containing(address pc);                    // stub containing pc or NULL
   11.18    static int         number_of_vtable_stubs() { return _number_of_vtable_stubs; }
    12.1 --- a/src/share/vm/interpreter/cppInterpreterGenerator.hpp	Fri Apr 13 18:17:50 2018 +0000
    12.2 +++ b/src/share/vm/interpreter/cppInterpreterGenerator.hpp	Wed Apr 18 12:37:42 2018 -0700
    12.3 @@ -1,5 +1,5 @@
    12.4  /*
    12.5 - * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    12.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    12.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.8   *
    12.9   * This code is free software; you can redistribute it and/or modify it
   12.10 @@ -29,6 +29,9 @@
   12.11  // of the template interpreter generator.
   12.12  
   12.13  #ifdef CC_INTERP
   12.14 +#ifdef TARGET_ARCH_zero
   12.15 +# include "entry_zero.hpp"
   12.16 +#endif
   12.17  
   12.18  class CppInterpreterGenerator: public AbstractInterpreterGenerator {
   12.19    protected:
    13.1 --- a/src/share/vm/interpreter/interpreter.hpp	Fri Apr 13 18:17:50 2018 +0000
    13.2 +++ b/src/share/vm/interpreter/interpreter.hpp	Wed Apr 18 12:37:42 2018 -0700
    13.3 @@ -1,5 +1,5 @@
    13.4  /*
    13.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    13.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    13.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.8   *
    13.9   * This code is free software; you can redistribute it and/or modify it
   13.10 @@ -28,11 +28,9 @@
   13.11  #include "code/stubs.hpp"
   13.12  #include "interpreter/cppInterpreter.hpp"
   13.13  #include "interpreter/templateInterpreter.hpp"
   13.14 -#ifdef ZERO
   13.15  #ifdef TARGET_ARCH_zero
   13.16  # include "entry_zero.hpp"
   13.17  #endif
   13.18 -#endif
   13.19  
   13.20  // This file contains the platform-independent parts
   13.21  // of the interpreter and the interpreter generator.
    14.1 --- a/src/share/vm/interpreter/interpreterRuntime.cpp	Fri Apr 13 18:17:50 2018 +0000
    14.2 +++ b/src/share/vm/interpreter/interpreterRuntime.cpp	Wed Apr 18 12:37:42 2018 -0700
    14.3 @@ -1,5 +1,5 @@
    14.4  /*
    14.5 - * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
    14.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    14.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.8   *
    14.9   * This code is free software; you can redistribute it and/or modify it
   14.10 @@ -320,6 +320,8 @@
   14.11    Handle exception = get_preinitialized_exception(
   14.12                                   SystemDictionary::StackOverflowError_klass(),
   14.13                                   CHECK);
   14.14 +  // Increment counter for hs_err file reporting
   14.15 +  Atomic::inc(&Exceptions::_stack_overflow_errors);
   14.16    THROW_HANDLE(exception);
   14.17  IRT_END
   14.18  
    15.1 --- a/src/share/vm/memory/metaspace.cpp	Fri Apr 13 18:17:50 2018 +0000
    15.2 +++ b/src/share/vm/memory/metaspace.cpp	Wed Apr 18 12:37:42 2018 -0700
    15.3 @@ -3098,13 +3098,24 @@
    15.4    initialize_class_space(metaspace_rs);
    15.5  
    15.6    if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) {
    15.7 -    gclog_or_tty->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: " SIZE_FORMAT,
    15.8 -                            Universe::narrow_klass_base(), Universe::narrow_klass_shift());
    15.9 -    gclog_or_tty->print_cr("Compressed class space size: " SIZE_FORMAT " Address: " PTR_FORMAT " Req Addr: " PTR_FORMAT,
   15.10 -                           compressed_class_space_size(), metaspace_rs.base(), requested_addr);
   15.11 +      print_compressed_class_space(gclog_or_tty, requested_addr);
   15.12    }
   15.13  }
   15.14  
   15.15 +void Metaspace::print_compressed_class_space(outputStream* st, const char* requested_addr) {
   15.16 +  st->print_cr("Narrow klass base: " PTR_FORMAT ", Narrow klass shift: %d",
   15.17 +               p2i(Universe::narrow_klass_base()), Universe::narrow_klass_shift());
   15.18 +  if (_class_space_list != NULL) {
   15.19 +    address base = (address)_class_space_list->current_virtual_space()->bottom();
   15.20 +    st->print("Compressed class space size: " SIZE_FORMAT " Address: " PTR_FORMAT,
   15.21 +                 compressed_class_space_size(), p2i(base));
   15.22 +    if (requested_addr != 0) {
   15.23 +      st->print(" Req Addr: " PTR_FORMAT, p2i(requested_addr));
   15.24 +    }
   15.25 +    st->cr();
   15.26 +   }
   15.27 + }
   15.28 +
   15.29  // For UseCompressedClassPointers the class space is reserved above the top of
   15.30  // the Java heap.  The argument passed in is at the base of the compressed space.
   15.31  void Metaspace::initialize_class_space(ReservedSpace rs) {
    16.1 --- a/src/share/vm/memory/metaspace.hpp	Fri Apr 13 18:17:50 2018 +0000
    16.2 +++ b/src/share/vm/memory/metaspace.hpp	Wed Apr 18 12:37:42 2018 -0700
    16.3 @@ -1,5 +1,5 @@
    16.4  /*
    16.5 - * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
    16.6 + * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
    16.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.8   *
    16.9   * This code is free software; you can redistribute it and/or modify it
   16.10 @@ -259,6 +259,8 @@
   16.11    // Debugging support
   16.12    void verify();
   16.13  
   16.14 +  static void print_compressed_class_space(outputStream* st, const char* requested_addr = 0);
   16.15 +
   16.16    class AllocRecordClosure :  public StackObj {
   16.17    public:
   16.18      virtual void doit(address ptr, MetaspaceObj::Type type, int byte_size) = 0;
    17.1 --- a/src/share/vm/memory/universe.cpp	Fri Apr 13 18:17:50 2018 +0000
    17.2 +++ b/src/share/vm/memory/universe.cpp	Wed Apr 18 12:37:42 2018 -0700
    17.3 @@ -1,5 +1,5 @@
    17.4  /*
    17.5 - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
    17.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    17.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.8   *
    17.9   * This code is free software; you can redistribute it and/or modify it
   17.10 @@ -882,7 +882,7 @@
   17.11      Universe::set_narrow_ptrs_base(Universe::narrow_oop_base());
   17.12  
   17.13      if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) {
   17.14 -      Universe::print_compressed_oops_mode();
   17.15 +      Universe::print_compressed_oops_mode(tty);
   17.16      }
   17.17    }
   17.18    // Universe::narrow_oop_base() is one page below the heap.
   17.19 @@ -904,23 +904,21 @@
   17.20    return JNI_OK;
   17.21  }
   17.22  
   17.23 -void Universe::print_compressed_oops_mode() {
   17.24 -  tty->cr();
   17.25 -  tty->print("heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB",
   17.26 +void Universe::print_compressed_oops_mode(outputStream* st) {
   17.27 +  st->print("heap address: " PTR_FORMAT ", size: " SIZE_FORMAT " MB",
   17.28                Universe::heap()->base(), Universe::heap()->reserved_region().byte_size()/M);
   17.29  
   17.30 -  tty->print(", Compressed Oops mode: %s", narrow_oop_mode_to_string(narrow_oop_mode()));
   17.31 +  st->print(", Compressed Oops mode: %s", narrow_oop_mode_to_string(narrow_oop_mode()));
   17.32  
   17.33    if (Universe::narrow_oop_base() != 0) {
   17.34 -    tty->print(":" PTR_FORMAT, Universe::narrow_oop_base());
   17.35 +    st->print(":" PTR_FORMAT, Universe::narrow_oop_base());
   17.36    }
   17.37  
   17.38    if (Universe::narrow_oop_shift() != 0) {
   17.39 -    tty->print(", Oop shift amount: %d", Universe::narrow_oop_shift());
   17.40 +    st->print(", Oop shift amount: %d", Universe::narrow_oop_shift());
   17.41    }
   17.42  
   17.43 -  tty->cr();
   17.44 -  tty->cr();
   17.45 +  st->cr();
   17.46  }
   17.47  
   17.48  // Reserve the Java heap, which is now the same for all GCs.
    18.1 --- a/src/share/vm/memory/universe.hpp	Fri Apr 13 18:17:50 2018 +0000
    18.2 +++ b/src/share/vm/memory/universe.hpp	Wed Apr 18 12:37:42 2018 -0700
    18.3 @@ -1,5 +1,5 @@
    18.4  /*
    18.5 - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
    18.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    18.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.8   *
    18.9   * This code is free software; you can redistribute it and/or modify it
   18.10 @@ -375,7 +375,7 @@
   18.11    static void     set_narrow_ptrs_base(address a)         { _narrow_ptrs_base = a; }
   18.12    static address  narrow_ptrs_base()                      { return _narrow_ptrs_base; }
   18.13  
   18.14 -  static void     print_compressed_oops_mode();
   18.15 +  static void     print_compressed_oops_mode(outputStream* st);
   18.16  
   18.17    // this is set in vm_version on sparc (and then reset in universe afaict)
   18.18    static void     set_narrow_oop_shift(int shift)         {
    19.1 --- a/src/share/vm/oops/compiledICHolder.cpp	Fri Apr 13 18:17:50 2018 +0000
    19.2 +++ b/src/share/vm/oops/compiledICHolder.cpp	Wed Apr 18 12:37:42 2018 -0700
    19.3 @@ -1,5 +1,5 @@
    19.4  /*
    19.5 - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
    19.6 + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
    19.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.8   *
    19.9   * This code is free software; you can redistribute it and/or modify it
   19.10 @@ -24,30 +24,12 @@
   19.11  
   19.12  #include "precompiled.hpp"
   19.13  #include "oops/compiledICHolder.hpp"
   19.14 -#include "oops/klass.hpp"
   19.15 -#include "oops/method.hpp"
   19.16  #include "oops/oop.inline2.hpp"
   19.17  
   19.18  volatile int CompiledICHolder::_live_count;
   19.19  volatile int CompiledICHolder::_live_not_claimed_count;
   19.20  
   19.21  
   19.22 -bool CompiledICHolder::is_loader_alive(BoolObjectClosure* is_alive) {
   19.23 -  if (_holder_metadata->is_method()) {
   19.24 -    if (!((Method*)_holder_metadata)->method_holder()->is_loader_alive(is_alive)) {
   19.25 -      return false;
   19.26 -    }
   19.27 -  } else if (_holder_metadata->is_klass()) {
   19.28 -    if (!((Klass*)_holder_metadata)->is_loader_alive(is_alive)) {
   19.29 -      return false;
   19.30 -    }
   19.31 -  }
   19.32 -  if (!_holder_klass->is_loader_alive(is_alive)) {
   19.33 -    return false;
   19.34 -  }
   19.35 -  return true;
   19.36 -}
   19.37 -
   19.38  // Printing
   19.39  
   19.40  void CompiledICHolder::print_on(outputStream* st) const {
    20.1 --- a/src/share/vm/oops/compiledICHolder.hpp	Fri Apr 13 18:17:50 2018 +0000
    20.2 +++ b/src/share/vm/oops/compiledICHolder.hpp	Wed Apr 18 12:37:42 2018 -0700
    20.3 @@ -1,5 +1,5 @@
    20.4  /*
    20.5 - * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
    20.6 + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
    20.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.8   *
    20.9   * This code is free software; you can redistribute it and/or modify it
   20.10 @@ -26,6 +26,8 @@
   20.11  #define SHARE_VM_OOPS_COMPILEDICHOLDEROOP_HPP
   20.12  
   20.13  #include "oops/oop.hpp"
   20.14 +#include "oops/klass.hpp"
   20.15 +#include "oops/method.hpp"
   20.16  
   20.17  // A CompiledICHolder* is a helper object for the inline cache implementation.
   20.18  // It holds:
   20.19 @@ -48,11 +50,12 @@
   20.20    Metadata* _holder_metadata;
   20.21    Klass*    _holder_klass;    // to avoid name conflict with oopDesc::_klass
   20.22    CompiledICHolder* _next;
   20.23 +  bool _is_metadata_method;
   20.24  
   20.25   public:
   20.26    // Constructor
   20.27 -  CompiledICHolder(Metadata* metadata, Klass* klass)
   20.28 -      : _holder_metadata(metadata), _holder_klass(klass) {
   20.29 +  CompiledICHolder(Metadata* metadata, Klass* klass, bool is_method = true)
   20.30 +      : _holder_metadata(metadata), _holder_klass(klass), _is_metadata_method(is_method) {
   20.31  #ifdef ASSERT
   20.32      Atomic::inc(&_live_count);
   20.33      Atomic::inc(&_live_not_claimed_count);
   20.34 @@ -82,7 +85,16 @@
   20.35    CompiledICHolder* next()     { return _next; }
   20.36    void set_next(CompiledICHolder* n) { _next = n; }
   20.37  
   20.38 -  bool is_loader_alive(BoolObjectClosure* is_alive);
   20.39 +  inline bool is_loader_alive(BoolObjectClosure* is_alive) {
   20.40 +    Klass* k = _is_metadata_method ? ((Method*)_holder_metadata)->method_holder() : (Klass*)_holder_metadata;
   20.41 +    if (!k->is_loader_alive(is_alive)) {
   20.42 +      return false;
   20.43 +    }
   20.44 +    if (!_holder_klass->is_loader_alive(is_alive)) {
   20.45 +      return false;
   20.46 +    }
   20.47 +    return true;
   20.48 +  }
   20.49  
   20.50    // Verify
   20.51    void verify_on(outputStream* st);
    21.1 --- a/src/share/vm/opto/ifnode.cpp	Fri Apr 13 18:17:50 2018 +0000
    21.2 +++ b/src/share/vm/opto/ifnode.cpp	Wed Apr 18 12:37:42 2018 -0700
    21.3 @@ -453,6 +453,9 @@
    21.4  // offset.  Return 2 if we had to negate the test.  Index is NULL if the check
    21.5  // is versus a constant.
    21.6  int IfNode::is_range_check(Node* &range, Node* &index, jint &offset) {
    21.7 +  if (outcnt() != 2) {
    21.8 +    return 0;
    21.9 +  }
   21.10    Node* b = in(1);
   21.11    if (b == NULL || !b->is_Bool())  return 0;
   21.12    BoolNode* bn = b->as_Bool();
    22.1 --- a/src/share/vm/opto/library_call.cpp	Fri Apr 13 18:17:50 2018 +0000
    22.2 +++ b/src/share/vm/opto/library_call.cpp	Wed Apr 18 12:37:42 2018 -0700
    22.3 @@ -6026,7 +6026,7 @@
    22.4    }
    22.5  
    22.6    assert(UseMontgomeryMultiplyIntrinsic, "not implemented on this platform");
    22.7 -  const char* stubName = "montgomery_square";
    22.8 +  const char* stubName = "montgomery_multiply";
    22.9  
   22.10    assert(callee()->signature()->size() == 7, "montgomeryMultiply has 7 parameters");
   22.11  
    23.1 --- a/src/share/vm/opto/runtime.cpp	Fri Apr 13 18:17:50 2018 +0000
    23.2 +++ b/src/share/vm/opto/runtime.cpp	Wed Apr 18 12:37:42 2018 -0700
    23.3 @@ -1,5 +1,5 @@
    23.4  /*
    23.5 - * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
    23.6 + * Copyright (c) 1998, 2018, 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 @@ -1234,17 +1234,23 @@
   23.11          force_unwind ? NULL : nm->handler_for_exception_and_pc(exception, pc);
   23.12  
   23.13        if (handler_address == NULL) {
   23.14 -        Handle original_exception(thread, exception());
   23.15 -        handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true);
   23.16 +        bool recursive_exception = false;
   23.17 +        handler_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true, recursive_exception);
   23.18          assert (handler_address != NULL, "must have compiled handler");
   23.19          // Update the exception cache only when the unwind was not forced
   23.20          // and there didn't happen another exception during the computation of the
   23.21 -        // compiled exception handler.
   23.22 -        if (!force_unwind && original_exception() == exception()) {
   23.23 +        // compiled exception handler. Checking for exception oop equality is not
   23.24 +        // sufficient because some exceptions are pre-allocated and reused.
   23.25 +        if (!force_unwind && !recursive_exception) {
   23.26            nm->add_handler_for_exception_and_pc(exception,pc,handler_address);
   23.27          }
   23.28        } else {
   23.29 -        assert(handler_address == SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true), "Must be the same");
   23.30 +#ifdef ASSERT
   23.31 +        bool recursive_exception = false;
   23.32 +        address computed_address = SharedRuntime::compute_compiled_exc_handler(nm, pc, exception, force_unwind, true, recursive_exception);
   23.33 +        assert(recursive_exception || (handler_address == computed_address), err_msg("Handler address inconsistency: " PTR_FORMAT " != " PTR_FORMAT,
   23.34 +                 p2i(handler_address), p2i(computed_address)));
   23.35 +#endif
   23.36        }
   23.37      }
   23.38  
    24.1 --- a/src/share/vm/prims/jvmtiTagMap.cpp	Fri Apr 13 18:17:50 2018 +0000
    24.2 +++ b/src/share/vm/prims/jvmtiTagMap.cpp	Wed Apr 18 12:37:42 2018 -0700
    24.3 @@ -1,5 +1,5 @@
    24.4  /*
    24.5 - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
    24.6 + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
    24.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.8   *
    24.9   * This code is free software; you can redistribute it and/or modify it
   24.10 @@ -47,6 +47,7 @@
   24.11  #include "services/serviceUtil.hpp"
   24.12  #include "utilities/macros.hpp"
   24.13  #if INCLUDE_ALL_GCS
   24.14 +#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
   24.15  #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
   24.16  #endif // INCLUDE_ALL_GCS
   24.17  
   24.18 @@ -1519,6 +1520,14 @@
   24.19        if (_tags[i] == entry->tag()) {
   24.20          oop o = entry->object();
   24.21          assert(o != NULL && Universe::heap()->is_in_reserved(o), "sanity check");
   24.22 +#if INCLUDE_ALL_GCS
   24.23 +        if (UseG1GC) {
   24.24 +          // The reference in this tag map could be the only (implicitly weak)
   24.25 +          // reference to that object. If we hand it out, we need to keep it live wrt
   24.26 +          // SATB marking similar to other j.l.ref.Reference referents.
   24.27 +          G1SATBCardTableModRefBS::enqueue(o);
   24.28 +        }
   24.29 +#endif
   24.30          jobject ref = JNIHandles::make_local(JavaThread::current(), o);
   24.31          _object_results->append(ref);
   24.32          _tag_results->append((uint64_t)entry->tag());
    25.1 --- a/src/share/vm/runtime/frame.hpp	Fri Apr 13 18:17:50 2018 +0000
    25.2 +++ b/src/share/vm/runtime/frame.hpp	Wed Apr 18 12:37:42 2018 -0700
    25.3 @@ -1,5 +1,5 @@
    25.4  /*
    25.5 - * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
    25.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    25.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    25.8   *
    25.9   * This code is free software; you can redistribute it and/or modify it
   25.10 @@ -45,11 +45,9 @@
   25.11  # include "adfiles/adGlobals_ppc_64.hpp"
   25.12  #endif
   25.13  #endif // COMPILER2
   25.14 -#ifdef ZERO
   25.15  #ifdef TARGET_ARCH_zero
   25.16  # include "stack_zero.hpp"
   25.17  #endif
   25.18 -#endif
   25.19  
   25.20  typedef class BytecodeInterpreter* interpreterState;
   25.21  
    26.1 --- a/src/share/vm/runtime/frame.inline.hpp	Fri Apr 13 18:17:50 2018 +0000
    26.2 +++ b/src/share/vm/runtime/frame.inline.hpp	Wed Apr 18 12:37:42 2018 -0700
    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, 2018, 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 @@ -46,14 +46,12 @@
   26.11  #ifdef TARGET_ARCH_ppc
   26.12  # include "jniTypes_ppc.hpp"
   26.13  #endif
   26.14 -#ifdef ZERO
   26.15  #ifdef TARGET_ARCH_zero
   26.16  # include "entryFrame_zero.hpp"
   26.17  # include "fakeStubFrame_zero.hpp"
   26.18  # include "interpreterFrame_zero.hpp"
   26.19  # include "sharkFrame_zero.hpp"
   26.20  #endif
   26.21 -#endif
   26.22  
   26.23  // This file holds platform-independent bodies of inline functions for frames.
   26.24  
    27.1 --- a/src/share/vm/runtime/os.cpp	Fri Apr 13 18:17:50 2018 +0000
    27.2 +++ b/src/share/vm/runtime/os.cpp	Wed Apr 18 12:37:42 2018 -0700
    27.3 @@ -1,5 +1,5 @@
    27.4  /*
    27.5 - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
    27.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    27.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    27.8   *
    27.9   * This code is free software; you can redistribute it and/or modify it
   27.10 @@ -847,7 +847,7 @@
   27.11    pd_print_cpu_info(st);
   27.12  }
   27.13  
   27.14 -void os::print_date_and_time(outputStream *st) {
   27.15 +void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) {
   27.16    const int secs_per_day  = 86400;
   27.17    const int secs_per_hour = 3600;
   27.18    const int secs_per_min  = 60;
   27.19 @@ -856,6 +856,12 @@
   27.20    (void)time(&tloc);
   27.21    st->print("time: %s", ctime(&tloc));  // ctime adds newline.
   27.22  
   27.23 +  struct tm tz;
   27.24 +  if (localtime_pd(&tloc, &tz) != NULL) {
   27.25 +    ::strftime(buf, buflen, "%Z", &tz);
   27.26 +    st->print_cr("timezone: %s", buf);
   27.27 +  }
   27.28 +
   27.29    double t = os::elapsedTime();
   27.30    // NOTE: It tends to crash after a SEGV if we want to printf("%f",...) in
   27.31    //       Linux. Must be a bug in glibc ? Workaround is to round "t" to int
    28.1 --- a/src/share/vm/runtime/os.hpp	Fri Apr 13 18:17:50 2018 +0000
    28.2 +++ b/src/share/vm/runtime/os.hpp	Wed Apr 18 12:37:42 2018 -0700
    28.3 @@ -621,7 +621,7 @@
    28.4    static void print_register_info(outputStream* st, void* context);
    28.5    static void print_siginfo(outputStream* st, void* siginfo);
    28.6    static void print_signal_handlers(outputStream* st, char* buf, size_t buflen);
    28.7 -  static void print_date_and_time(outputStream* st);
    28.8 +  static void print_date_and_time(outputStream* st, char* buf, size_t buflen);
    28.9  
   28.10    static void print_location(outputStream* st, intptr_t x, bool verbose = false);
   28.11    static size_t lasterror(char *buf, size_t len);
    29.1 --- a/src/share/vm/runtime/sharedRuntime.cpp	Fri Apr 13 18:17:50 2018 +0000
    29.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp	Wed Apr 18 12:37:42 2018 -0700
    29.3 @@ -1,5 +1,5 @@
    29.4  /*
    29.5 - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
    29.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    29.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    29.8   *
    29.9   * This code is free software; you can redistribute it and/or modify it
   29.10 @@ -639,7 +639,7 @@
   29.11  // ret_pc points into caller; we are returning caller's exception handler
   29.12  // for given exception
   29.13  address SharedRuntime::compute_compiled_exc_handler(nmethod* nm, address ret_pc, Handle& exception,
   29.14 -                                                    bool force_unwind, bool top_frame_only) {
   29.15 +                                                    bool force_unwind, bool top_frame_only, bool& recursive_exception_occurred) {
   29.16    assert(nm != NULL, "must exist");
   29.17    ResourceMark rm;
   29.18  
   29.19 @@ -667,6 +667,7 @@
   29.20          // BCI of the exception handler which caused the exception to be
   29.21          // thrown (bugs 4307310 and 4546590). Set "exception" reference
   29.22          // argument to ensure that the correct exception is thrown (4870175).
   29.23 +        recursive_exception_occurred = true;
   29.24          exception = Handle(THREAD, PENDING_EXCEPTION);
   29.25          CLEAR_PENDING_EXCEPTION;
   29.26          if (handler_bci >= 0) {
   29.27 @@ -758,6 +759,8 @@
   29.28    if (StackTraceInThrowable) {
   29.29      java_lang_Throwable::fill_in_stack_trace(exception);
   29.30    }
   29.31 +  // Increment counter for hs_err file reporting
   29.32 +  Atomic::inc(&Exceptions::_stack_overflow_errors);
   29.33    throw_and_post_jvmti_exception(thread, exception);
   29.34  JRT_END
   29.35  
    30.1 --- a/src/share/vm/runtime/sharedRuntime.hpp	Fri Apr 13 18:17:50 2018 +0000
    30.2 +++ b/src/share/vm/runtime/sharedRuntime.hpp	Wed Apr 18 12:37:42 2018 -0700
    30.3 @@ -1,5 +1,5 @@
    30.4  /*
    30.5 - * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
    30.6 + * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
    30.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.8   *
    30.9   * This code is free software; you can redistribute it and/or modify it
   30.10 @@ -184,7 +184,7 @@
   30.11  
   30.12    // exception handling and implicit exceptions
   30.13    static address compute_compiled_exc_handler(nmethod* nm, address ret_pc, Handle& exception,
   30.14 -                                              bool force_unwind, bool top_frame_only);
   30.15 +                                              bool force_unwind, bool top_frame_only, bool& recursive_exception_occurred);
   30.16    enum ImplicitExceptionKind {
   30.17      IMPLICIT_NULL,
   30.18      IMPLICIT_DIVIDE_BY_ZERO,
    31.1 --- a/src/share/vm/runtime/thread.hpp	Fri Apr 13 18:17:50 2018 +0000
    31.2 +++ b/src/share/vm/runtime/thread.hpp	Wed Apr 18 12:37:42 2018 -0700
    31.3 @@ -51,11 +51,9 @@
    31.4  #include "gc_implementation/g1/dirtyCardQueue.hpp"
    31.5  #include "gc_implementation/g1/satbQueue.hpp"
    31.6  #endif // INCLUDE_ALL_GCS
    31.7 -#ifdef ZERO
    31.8  #ifdef TARGET_ARCH_zero
    31.9  # include "stack_zero.hpp"
   31.10  #endif
   31.11 -#endif
   31.12  
   31.13  class ThreadSafepointState;
   31.14  class ThreadProfiler;
    32.1 --- a/src/share/vm/utilities/exceptions.cpp	Fri Apr 13 18:17:50 2018 +0000
    32.2 +++ b/src/share/vm/utilities/exceptions.cpp	Wed Apr 18 12:37:42 2018 -0700
    32.3 @@ -1,5 +1,5 @@
    32.4  /*
    32.5 - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
    32.6 + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
    32.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    32.8   *
    32.9   * This code is free software; you can redistribute it and/or modify it
   32.10 @@ -154,6 +154,10 @@
   32.11      return;
   32.12    }
   32.13  
   32.14 +  if (h_exception->is_a(SystemDictionary::OutOfMemoryError_klass())) {
   32.15 +    count_out_of_memory_exceptions(h_exception);
   32.16 +  }
   32.17 +
   32.18    assert(h_exception->is_a(SystemDictionary::Throwable_klass()), "exception is not a subclass of java/lang/Throwable");
   32.19  
   32.20    // set the pending exception
   32.21 @@ -228,6 +232,8 @@
   32.22      if (StackTraceInThrowable) {
   32.23        java_lang_Throwable::fill_in_stack_trace(exception, method());
   32.24      }
   32.25 +    // Increment counter for hs_err file reporting
   32.26 +    Atomic::inc(&Exceptions::_stack_overflow_errors);
   32.27    } else {
   32.28      // if prior exception, throw that one instead
   32.29      exception = Handle(THREAD, THREAD->pending_exception());
   32.30 @@ -404,6 +410,44 @@
   32.31                                     h_prot, to_utf8_safe);
   32.32  }
   32.33  
   32.34 +
   32.35 +// Exception counting for hs_err file
   32.36 +volatile int Exceptions::_stack_overflow_errors = 0;
   32.37 +volatile int Exceptions::_out_of_memory_error_java_heap_errors = 0;
   32.38 +volatile int Exceptions::_out_of_memory_error_metaspace_errors = 0;
   32.39 +volatile int Exceptions::_out_of_memory_error_class_metaspace_errors = 0;
   32.40 +
   32.41 +void Exceptions::count_out_of_memory_exceptions(Handle exception) {
   32.42 +  if (exception() == Universe::out_of_memory_error_metaspace()) {
   32.43 +     Atomic::inc(&_out_of_memory_error_metaspace_errors);
   32.44 +  } else if (exception() == Universe::out_of_memory_error_class_metaspace()) {
   32.45 +     Atomic::inc(&_out_of_memory_error_class_metaspace_errors);
   32.46 +  } else {
   32.47 +     // everything else reported as java heap OOM
   32.48 +     Atomic::inc(&_out_of_memory_error_java_heap_errors);
   32.49 +  }
   32.50 +}
   32.51 +
   32.52 +void print_oom_count(outputStream* st, const char *err, int count) {
   32.53 +  if (count > 0) {
   32.54 +    st->print_cr("OutOfMemoryError %s=%d", err, count);
   32.55 +  }
   32.56 +}
   32.57 +
   32.58 +bool Exceptions::has_exception_counts() {
   32.59 +  return (_stack_overflow_errors + _out_of_memory_error_java_heap_errors +
   32.60 +         _out_of_memory_error_metaspace_errors + _out_of_memory_error_class_metaspace_errors) > 0;
   32.61 +}
   32.62 +
   32.63 +void Exceptions::print_exception_counts_on_error(outputStream* st) {
   32.64 +  print_oom_count(st, "java_heap_errors", _out_of_memory_error_java_heap_errors);
   32.65 +  print_oom_count(st, "metaspace_errors", _out_of_memory_error_metaspace_errors);
   32.66 +  print_oom_count(st, "class_metaspace_errors", _out_of_memory_error_class_metaspace_errors);
   32.67 +  if (_stack_overflow_errors > 0) {
   32.68 +    st->print_cr("StackOverflowErrors=%d", _stack_overflow_errors);
   32.69 +  }
   32.70 +}
   32.71 +
   32.72  // Implementation of ExceptionMark
   32.73  
   32.74  ExceptionMark::ExceptionMark(Thread*& thread) {
    33.1 --- a/src/share/vm/utilities/exceptions.hpp	Fri Apr 13 18:17:50 2018 +0000
    33.2 +++ b/src/share/vm/utilities/exceptions.hpp	Wed Apr 18 12:37:42 2018 -0700
    33.3 @@ -1,5 +1,5 @@
    33.4  /*
    33.5 - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
    33.6 + * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
    33.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.8   *
    33.9   * This code is free software; you can redistribute it and/or modify it
   33.10 @@ -102,6 +102,11 @@
   33.11  class Exceptions {
   33.12    static bool special_exception(Thread *thread, const char* file, int line, Handle exception);
   33.13    static bool special_exception(Thread* thread, const char* file, int line, Symbol* name, const char* message);
   33.14 +
   33.15 +  // Count out of memory errors that are interesting in error diagnosis
   33.16 +  static volatile int _out_of_memory_error_java_heap_errors;
   33.17 +  static volatile int _out_of_memory_error_metaspace_errors;
   33.18 +  static volatile int _out_of_memory_error_class_metaspace_errors;
   33.19   public:
   33.20    // this enum is defined to indicate whether it is safe to
   33.21    // ignore the encoding scheme of the original message string.
   33.22 @@ -160,6 +165,14 @@
   33.23  
   33.24    static void throw_stack_overflow_exception(Thread* thread, const char* file, int line, methodHandle method);
   33.25  
   33.26 +  // Exception counting for error files of interesting exceptions that may have
   33.27 +  // caused a problem for the jvm
   33.28 +  static volatile int _stack_overflow_errors;
   33.29 +
   33.30 +  static bool has_exception_counts();
   33.31 +  static void count_out_of_memory_exceptions(Handle exception);
   33.32 +  static void print_exception_counts_on_error(outputStream* st);
   33.33 +
   33.34    // for AbortVMOnException flag
   33.35    NOT_PRODUCT(static void debug_check_abort(Handle exception, const char* message = NULL);)
   33.36    NOT_PRODUCT(static void debug_check_abort(const char *value_string, const char* message = NULL);)
    34.1 --- a/src/share/vm/utilities/vmError.cpp	Fri Apr 13 18:17:50 2018 +0000
    34.2 +++ b/src/share/vm/utilities/vmError.cpp	Wed Apr 18 12:37:42 2018 -0700
    34.3 @@ -1,5 +1,5 @@
    34.4  /*
    34.5 - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
    34.6 + * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
    34.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.8   *
    34.9   * This code is free software; you can redistribute it and/or modify it
   34.10 @@ -304,6 +304,47 @@
   34.11  #endif // ZERO
   34.12  }
   34.13  
   34.14 +static void print_oom_reasons(outputStream* st) {
   34.15 +  st->print_cr("# Possible reasons:");
   34.16 +  st->print_cr("#   The system is out of physical RAM or swap space");
   34.17 +  if (UseCompressedOops) {
   34.18 +    st->print_cr("#   The process is running with CompressedOops enabled, and the Java Heap may be blocking the growth of the native heap");
   34.19 +  }
   34.20 +  if (LogBytesPerWord == 2) {
   34.21 +    st->print_cr("#   In 32 bit mode, the process size limit was hit");
   34.22 +  }
   34.23 +  st->print_cr("# Possible solutions:");
   34.24 +  st->print_cr("#   Reduce memory load on the system");
   34.25 +  st->print_cr("#   Increase physical memory or swap space");
   34.26 +  st->print_cr("#   Check if swap backing store is full");
   34.27 +  if (LogBytesPerWord == 2) {
   34.28 +    st->print_cr("#   Use 64 bit Java on a 64 bit OS");
   34.29 +  }
   34.30 +  st->print_cr("#   Decrease Java heap size (-Xmx/-Xms)");
   34.31 +  st->print_cr("#   Decrease number of Java threads");
   34.32 +  st->print_cr("#   Decrease Java thread stack sizes (-Xss)");
   34.33 +  st->print_cr("#   Set larger code cache with -XX:ReservedCodeCacheSize=");
   34.34 +  if (UseCompressedOops) {
   34.35 +    switch (Universe::narrow_oop_mode()) {
   34.36 +      case Universe::UnscaledNarrowOop:
   34.37 +        st->print_cr("#   JVM is running with Unscaled Compressed Oops mode in which the Java heap is");
   34.38 +        st->print_cr("#     placed in the first 4GB address space. The Java Heap base address is the");
   34.39 +        st->print_cr("#     maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress");
   34.40 +        st->print_cr("#     to set the Java Heap base and to place the Java Heap above 4GB virtual address.");
   34.41 +        break;
   34.42 +      case Universe::ZeroBasedNarrowOop:
   34.43 +        st->print_cr("#   JVM is running with Zero Based Compressed Oops mode in which the Java heap is");
   34.44 +        st->print_cr("#     placed in the first 32GB address space. The Java Heap base address is the");
   34.45 +        st->print_cr("#     maximum limit for the native heap growth. Please use -XX:HeapBaseMinAddress");
   34.46 +        st->print_cr("#     to set the Java Heap base and to place the Java Heap above 32GB virtual address.");
   34.47 +        break;
   34.48 +      default:
   34.49 +        break;
   34.50 +    }
   34.51 +  }
   34.52 +  st->print_cr("# This output file may be truncated or incomplete.");
   34.53 +}
   34.54 +
   34.55  // This is the main function to report a fatal error. Only one thread can
   34.56  // call this function, so we don't need to worry about MT-safety. But it's
   34.57  // possible that the error handler itself may crash or die on an internal
   34.58 @@ -375,19 +416,7 @@
   34.59           }
   34.60           // In error file give some solutions
   34.61           if (_verbose) {
   34.62 -           st->print_cr("# Possible reasons:");
   34.63 -           st->print_cr("#   The system is out of physical RAM or swap space");
   34.64 -           st->print_cr("#   In 32 bit mode, the process size limit was hit");
   34.65 -           st->print_cr("# Possible solutions:");
   34.66 -           st->print_cr("#   Reduce memory load on the system");
   34.67 -           st->print_cr("#   Increase physical memory or swap space");
   34.68 -           st->print_cr("#   Check if swap backing store is full");
   34.69 -           st->print_cr("#   Use 64 bit Java on a 64 bit OS");
   34.70 -           st->print_cr("#   Decrease Java heap size (-Xmx/-Xms)");
   34.71 -           st->print_cr("#   Decrease number of Java threads");
   34.72 -           st->print_cr("#   Decrease Java thread stack sizes (-Xss)");
   34.73 -           st->print_cr("#   Set larger code cache with -XX:ReservedCodeCacheSize=");
   34.74 -           st->print_cr("# This output file may be truncated or incomplete.");
   34.75 +           print_oom_reasons(st);
   34.76           } else {
   34.77             return;  // that's enough for the screen
   34.78           }
   34.79 @@ -675,6 +704,24 @@
   34.80         st->cr();
   34.81       }
   34.82  
   34.83 +  STEP(182, "(printing number of OutOfMemoryError and StackOverflow exceptions)")
   34.84 +
   34.85 +     if (_verbose && Exceptions::has_exception_counts()) {
   34.86 +       st->print_cr("OutOfMemory and StackOverflow Exception counts:");
   34.87 +       Exceptions::print_exception_counts_on_error(st);
   34.88 +       st->cr();
   34.89 +     }
   34.90 +
   34.91 +  STEP(185, "(printing compressed oops mode")
   34.92 +
   34.93 +     if (_verbose && UseCompressedOops) {
   34.94 +       Universe::print_compressed_oops_mode(st);
   34.95 +       if (UseCompressedClassPointers) {
   34.96 +         Metaspace::print_compressed_class_space(st);
   34.97 +       }
   34.98 +       st->cr();
   34.99 +     }
  34.100 +
  34.101    STEP(190, "(printing heap information)" )
  34.102  
  34.103       if (_verbose && Universe::is_fully_initialized()) {
  34.104 @@ -780,7 +827,7 @@
  34.105    STEP(280, "(printing date and time)" )
  34.106  
  34.107       if (_verbose) {
  34.108 -       os::print_date_and_time(st);
  34.109 +       os::print_date_and_time(st, buf, sizeof(buf));
  34.110         st->cr();
  34.111       }
  34.112  
    35.1 --- a/test/compiler/gcbarriers/PreserveFPRegistersTest.java	Fri Apr 13 18:17:50 2018 +0000
    35.2 +++ b/test/compiler/gcbarriers/PreserveFPRegistersTest.java	Wed Apr 18 12:37:42 2018 -0700
    35.3 @@ -25,14 +25,22 @@
    35.4  /**
    35.5   * @test
    35.6   * @bug 8148175
    35.7 - * @run main/othervm/timeout=300  -XX:+UseG1GC -Xbatch -Xmx128m PreserveFPRegistersTest
    35.8 + * @requires vm.gc=="G1" | vm.gc=="null"
    35.9 + * @library /testlibrary /testlibrary/whitebox
   35.10 + * @run main/bootclasspath/othervm -Xbatch -XX:+UnlockDiagnosticVMOptions
   35.11 + *      -XX:+WhiteBoxAPI -Xmx300m -XX:+UseG1GC PreserveFPRegistersTest
   35.12   */
   35.13 +
   35.14 +import sun.hotspot.WhiteBox;
   35.15 +
   35.16  public class PreserveFPRegistersTest {
   35.17  
   35.18      public static void main(String... args) throws InterruptedException {
   35.19          new PreserveFPRegistersTest().go();
   35.20      }
   35.21  
   35.22 +    private static WhiteBox wb = WhiteBox.getWhiteBox();
   35.23 +
   35.24      public final Object[][] storage;
   35.25  
   35.26      /**
   35.27 @@ -51,18 +59,32 @@
   35.28      public final int regionCount;
   35.29  
   35.30      PreserveFPRegistersTest() {
   35.31 -        long regionSize = 1_000_000; //WB.g1RegionSize();
   35.32 -
   35.33 +        long regionSize = wb.g1RegionSize();
   35.34          Runtime rt = Runtime.getRuntime();
   35.35          long used = rt.totalMemory() - rt.freeMemory();
   35.36          long totalFree = rt.maxMemory() - used;
   35.37          regionCount = (int) ( (totalFree / regionSize) * 0.9);
   35.38 -        int refSize = 4;
   35.39 +        int refSize = wb.getHeapOopSize();
   35.40 +        N = (int) ((regionSize / K ) / refSize) - 5;
   35.41  
   35.42 -        N = (int) ((regionSize / K ) / refSize) - 5;
   35.43 -        storage = new Object[regionCount * K][];
   35.44 -        for (int i = 0; i < storage.length; i++) {
   35.45 -            storage[i] = new Object[N];
   35.46 +        System.out.println("%% Memory");
   35.47 +        System.out.println("%%   used          :        " + used / 1024 + "M");
   35.48 +        System.out.println("%%   available     :        " + totalFree / 1024 + "M");
   35.49 +        System.out.println("%%   G1 Region Size:        " + regionSize / 1024 + "M");
   35.50 +        System.out.println("%%   region count  :        " + regionCount);
   35.51 +
   35.52 +        System.out.println("%% Objects storage");
   35.53 +        System.out.println("%%   N (array length)      : " + N);
   35.54 +        System.out.println("%%   K (objects in regions): " + K);
   35.55 +        System.out.println("%%   Reference size        : " + refSize);
   35.56 +
   35.57 +        try {
   35.58 +            storage = new Object[regionCount * K][];
   35.59 +            for (int i = 0; i < storage.length; i++) {
   35.60 +                storage[i] = new Object[N];
   35.61 +            }
   35.62 +        } catch(OutOfMemoryError e) {
   35.63 +            throw new AssertionError("Test Failed with unexpected OutOfMemoryError exception");
   35.64          }
   35.65      }
   35.66  

mercurial