Merge

Thu, 05 Dec 2013 15:13:12 -0800

author
kvn
date
Thu, 05 Dec 2013 15:13:12 -0800
changeset 6492
1174c8abbdb6
parent 6491
e7cbc95179c4
parent 6138
a3dc98dc4d21
child 6493
3205e78d8193

Merge

src/cpu/x86/vm/sharedRuntime_x86_32.cpp file | annotate | diff | comparison | revisions
src/cpu/x86/vm/sharedRuntime_x86_64.cpp file | annotate | diff | comparison | revisions
src/share/vm/memory/universe.cpp file | annotate | diff | comparison | revisions
src/share/vm/opto/compile.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/globals.hpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/sharedRuntime.cpp file | annotate | diff | comparison | revisions
src/share/vm/runtime/sharedRuntime.hpp file | annotate | diff | comparison | revisions
test/compiler/jsr292/methodHandleExceptions/C.java file | annotate | diff | comparison | revisions
test/compiler/jsr292/methodHandleExceptions/I.java file | annotate | diff | comparison | revisions
     1.1 --- a/.hgtags	Thu Dec 05 19:19:09 2013 +0100
     1.2 +++ b/.hgtags	Thu Dec 05 15:13:12 2013 -0800
     1.3 @@ -396,3 +396,7 @@
     1.4  52b076e6ffae247c1c7d8b7aba995195be2b6fc2 jdk8-b116
     1.5  c78d517c7ea47501b456e707afd4b78e7b5b202e hs25-b59
     1.6  f573d00213b7170c2ff856f9cd83cd148437f5b9 jdk8-b117
     1.7 +abad3b2d905d9e1ad767c94baa94aba6ed5b207b hs25-b60
     1.8 +c9f439732b18ea16f7e65815327d5ea7092cc258 jdk8-b118
     1.9 +b2426da30009cd3069d03de073f351e6432c7682 hs25-b61
    1.10 +ce42d815dd2130250acf6132b51b624001638f0d jdk8-b119
     2.1 --- a/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java	Thu Dec 05 19:19:09 2013 +0100
     2.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java	Thu Dec 05 15:13:12 2013 -0800
     2.3 @@ -24,8 +24,9 @@
     2.4  
     2.5  package sun.jvm.hotspot.tools;
     2.6  
     2.7 -import sun.jvm.hotspot.runtime.*;
     2.8  import sun.jvm.hotspot.debugger.JVMDebugger;
     2.9 +import sun.jvm.hotspot.runtime.Arguments;
    2.10 +import sun.jvm.hotspot.runtime.VM;
    2.11  
    2.12  public class JInfo extends Tool {
    2.13      public JInfo() {
    2.14 @@ -138,14 +139,33 @@
    2.15      }
    2.16  
    2.17      private void printVMFlags() {
    2.18 +        VM.Flag[] flags = VM.getVM().getCommandLineFlags();
    2.19 +        System.out.print("Non-default VM flags: ");
    2.20 +        for (VM.Flag flag : flags) {
    2.21 +            if (flag.getOrigin() == 0) {
    2.22 +                // only print flags which aren't their defaults
    2.23 +                continue;
    2.24 +            }
    2.25 +            if (flag.isBool()) {
    2.26 +                String onoff = flag.getBool() ? "+" : "-";
    2.27 +                System.out.print("-XX:" + onoff + flag.getName() + " ");
    2.28 +            } else {
    2.29 +                System.out.print("-XX:" + flag.getName() + "="
    2.30 +                        + flag.getValue() + " ");
    2.31 +            }
    2.32 +        }
    2.33 +        System.out.println();
    2.34 +
    2.35 +        System.out.print("Command line: ");
    2.36          String str = Arguments.getJVMFlags();
    2.37          if (str != null) {
    2.38 -            System.out.println(str);
    2.39 +            System.out.print(str + " ");
    2.40          }
    2.41          str = Arguments.getJVMArgs();
    2.42          if (str != null) {
    2.43 -            System.out.println(str);
    2.44 +            System.out.print(str);
    2.45          }
    2.46 +        System.out.println();
    2.47      }
    2.48  
    2.49      private int mode;
     3.1 --- a/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java	Thu Dec 05 19:19:09 2013 +0100
     3.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java	Thu Dec 05 15:13:12 2013 -0800
     3.3 @@ -25,11 +25,11 @@
     3.4  package sun.jvm.hotspot.tools;
     3.5  
     3.6  import java.io.PrintStream;
     3.7 -import java.util.Hashtable;
     3.8  
     3.9 -import sun.jvm.hotspot.*;
    3.10 -import sun.jvm.hotspot.runtime.*;
    3.11 -import sun.jvm.hotspot.debugger.*;
    3.12 +import sun.jvm.hotspot.HotSpotAgent;
    3.13 +import sun.jvm.hotspot.debugger.DebuggerException;
    3.14 +import sun.jvm.hotspot.debugger.JVMDebugger;
    3.15 +import sun.jvm.hotspot.runtime.VM;
    3.16  
    3.17  // generic command line or GUI tool.
    3.18  // override run & code main as shown below.
    3.19 @@ -147,6 +147,7 @@
    3.20        }
    3.21  
    3.22        PrintStream err = System.err;
    3.23 +      PrintStream out = System.out;
    3.24  
    3.25        int pid = 0;
    3.26        String coreFileName   = null;
    3.27 @@ -180,18 +181,18 @@
    3.28        try {
    3.29          switch (debugeeType) {
    3.30            case DEBUGEE_PID:
    3.31 -             err.println("Attaching to process ID " + pid + ", please wait...");
    3.32 +             out.println("Attaching to process ID " + pid + ", please wait...");
    3.33               agent.attach(pid);
    3.34               break;
    3.35  
    3.36            case DEBUGEE_CORE:
    3.37 -             err.println("Attaching to core " + coreFileName +
    3.38 +             out.println("Attaching to core " + coreFileName +
    3.39                           " from executable " + executableName + ", please wait...");
    3.40               agent.attach(executableName, coreFileName);
    3.41               break;
    3.42  
    3.43            case DEBUGEE_REMOTE:
    3.44 -             err.println("Attaching to remote server " + remoteServer + ", please wait...");
    3.45 +             out.println("Attaching to remote server " + remoteServer + ", please wait...");
    3.46               agent.attach(remoteServer);
    3.47               break;
    3.48          }
    3.49 @@ -218,7 +219,7 @@
    3.50          return 1;
    3.51        }
    3.52  
    3.53 -      err.println("Debugger attached successfully.");
    3.54 +      out.println("Debugger attached successfully.");
    3.55        startInternal();
    3.56        return 0;
    3.57     }
    3.58 @@ -237,14 +238,14 @@
    3.59     // Remains of the start mechanism, common to both start methods.
    3.60     private void startInternal() {
    3.61  
    3.62 -      PrintStream err = System.err;
    3.63 +      PrintStream out = System.out;
    3.64        VM vm = VM.getVM();
    3.65        if (vm.isCore()) {
    3.66 -        err.println("Core build detected.");
    3.67 +        out.println("Core build detected.");
    3.68        } else if (vm.isClientCompiler()) {
    3.69 -        err.println("Client compiler detected.");
    3.70 +        out.println("Client compiler detected.");
    3.71        } else if (vm.isServerCompiler()) {
    3.72 -        err.println("Server compiler detected.");
    3.73 +        out.println("Server compiler detected.");
    3.74        } else {
    3.75          throw new RuntimeException("Fatal error: "
    3.76              + "should have been able to detect core/C1/C2 build");
    3.77 @@ -252,8 +253,8 @@
    3.78  
    3.79        String version = vm.getVMRelease();
    3.80        if (version != null) {
    3.81 -        err.print("JVM version is ");
    3.82 -        err.println(version);
    3.83 +        out.print("JVM version is ");
    3.84 +        out.println(version);
    3.85        }
    3.86  
    3.87        run();
     4.1 --- a/make/hotspot_version	Thu Dec 05 19:19:09 2013 +0100
     4.2 +++ b/make/hotspot_version	Thu Dec 05 15:13:12 2013 -0800
     4.3 @@ -35,7 +35,7 @@
     4.4  
     4.5  HS_MAJOR_VER=25
     4.6  HS_MINOR_VER=0
     4.7 -HS_BUILD_NUMBER=59
     4.8 +HS_BUILD_NUMBER=61
     4.9  
    4.10  JDK_MAJOR_VER=1
    4.11  JDK_MINOR_VER=8
     5.1 --- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Thu Dec 05 19:19:09 2013 +0100
     5.2 +++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Thu Dec 05 15:13:12 2013 -0800
     5.3 @@ -3003,6 +3003,10 @@
     5.4  
     5.5    // sp should be pointing at the return address to the caller (3)
     5.6  
     5.7 +  // Pick up the initial fp we should save
     5.8 +  // restore rbp before stack bang because if stack overflow is thrown it needs to be pushed (and preserved)
     5.9 +  __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
    5.10 +
    5.11    // Stack bang to make sure there's enough room for these interpreter frames.
    5.12    if (UseStackBanging) {
    5.13      __ movl(rbx, Address(rdi ,Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes()));
    5.14 @@ -3022,9 +3026,6 @@
    5.15    __ movl(rbx, Address(rdi, Deoptimization::UnrollBlock::number_of_frames_offset_in_bytes()));
    5.16    __ movl(counter, rbx);
    5.17  
    5.18 -  // Pick up the initial fp we should save
    5.19 -  __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
    5.20 -
    5.21    // Now adjust the caller's stack to make up for the extra locals
    5.22    // but record the original sp so that we can save it in the skeletal interpreter
    5.23    // frame and the stack walking of interpreter_sender will get the unextended sp
    5.24 @@ -3222,6 +3223,10 @@
    5.25  
    5.26    // sp should be pointing at the return address to the caller (3)
    5.27  
    5.28 +  // Pick up the initial fp we should save
    5.29 +  // restore rbp before stack bang because if stack overflow is thrown it needs to be pushed (and preserved)
    5.30 +  __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
    5.31 +
    5.32    // Stack bang to make sure there's enough room for these interpreter frames.
    5.33    if (UseStackBanging) {
    5.34      __ movl(rbx, Address(rdi ,Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes()));
    5.35 @@ -3242,9 +3247,6 @@
    5.36    __ movl(rbx, Address(rdi, Deoptimization::UnrollBlock::number_of_frames_offset_in_bytes()));
    5.37    __ movl(counter, rbx);
    5.38  
    5.39 -  // Pick up the initial fp we should save
    5.40 -  __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
    5.41 -
    5.42    // Now adjust the caller's stack to make up for the extra locals
    5.43    // but record the original sp so that we can save it in the skeletal interpreter
    5.44    // frame and the stack walking of interpreter_sender will get the unextended sp
     6.1 --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Thu Dec 05 19:19:09 2013 +0100
     6.2 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Thu Dec 05 15:13:12 2013 -0800
     6.3 @@ -3473,6 +3473,10 @@
     6.4  
     6.5    // rsp should be pointing at the return address to the caller (3)
     6.6  
     6.7 +  // Pick up the initial fp we should save
     6.8 +  // restore rbp before stack bang because if stack overflow is thrown it needs to be pushed (and preserved)
     6.9 +  __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
    6.10 +
    6.11    // Stack bang to make sure there's enough room for these interpreter frames.
    6.12    if (UseStackBanging) {
    6.13      __ movl(rbx, Address(rdi, Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes()));
    6.14 @@ -3491,9 +3495,6 @@
    6.15    // Load counter into rdx
    6.16    __ movl(rdx, Address(rdi, Deoptimization::UnrollBlock::number_of_frames_offset_in_bytes()));
    6.17  
    6.18 -  // Pick up the initial fp we should save
    6.19 -  __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
    6.20 -
    6.21    // Now adjust the caller's stack to make up for the extra locals
    6.22    // but record the original sp so that we can save it in the skeletal interpreter
    6.23    // frame and the stack walking of interpreter_sender will get the unextended sp
    6.24 @@ -3665,6 +3666,10 @@
    6.25  
    6.26    // rsp should be pointing at the return address to the caller (3)
    6.27  
    6.28 +  // Pick up the initial fp we should save
    6.29 +  // restore rbp before stack bang because if stack overflow is thrown it needs to be pushed (and preserved)
    6.30 +  __ movptr(rbp, Address(rdi, Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
    6.31 +
    6.32    // Stack bang to make sure there's enough room for these interpreter frames.
    6.33    if (UseStackBanging) {
    6.34      __ movl(rbx, Address(rdi ,Deoptimization::UnrollBlock::total_frame_sizes_offset_in_bytes()));
    6.35 @@ -3672,27 +3677,16 @@
    6.36    }
    6.37  
    6.38    // Load address of array of frame pcs into rcx (address*)
    6.39 -  __ movptr(rcx,
    6.40 -            Address(rdi,
    6.41 -                    Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes()));
    6.42 +  __ movptr(rcx, Address(rdi, Deoptimization::UnrollBlock::frame_pcs_offset_in_bytes()));
    6.43  
    6.44    // Trash the return pc
    6.45    __ addptr(rsp, wordSize);
    6.46  
    6.47    // Load address of array of frame sizes into rsi (intptr_t*)
    6.48 -  __ movptr(rsi, Address(rdi,
    6.49 -                         Deoptimization::UnrollBlock::
    6.50 -                         frame_sizes_offset_in_bytes()));
    6.51 +  __ movptr(rsi, Address(rdi, Deoptimization::UnrollBlock:: frame_sizes_offset_in_bytes()));
    6.52  
    6.53    // Counter
    6.54 -  __ movl(rdx, Address(rdi,
    6.55 -                       Deoptimization::UnrollBlock::
    6.56 -                       number_of_frames_offset_in_bytes())); // (int)
    6.57 -
    6.58 -  // Pick up the initial fp we should save
    6.59 -  __ movptr(rbp,
    6.60 -            Address(rdi,
    6.61 -                    Deoptimization::UnrollBlock::initial_info_offset_in_bytes()));
    6.62 +  __ movl(rdx, Address(rdi, Deoptimization::UnrollBlock:: number_of_frames_offset_in_bytes())); // (int)
    6.63  
    6.64    // Now adjust the caller's stack to make up for the extra locals but
    6.65    // record the original sp so that we can save it in the skeletal
    6.66 @@ -3702,9 +3696,7 @@
    6.67    const Register sender_sp = r8;
    6.68  
    6.69    __ mov(sender_sp, rsp);
    6.70 -  __ movl(rbx, Address(rdi,
    6.71 -                       Deoptimization::UnrollBlock::
    6.72 -                       caller_adjustment_offset_in_bytes())); // (int)
    6.73 +  __ movl(rbx, Address(rdi, Deoptimization::UnrollBlock:: caller_adjustment_offset_in_bytes())); // (int)
    6.74    __ subptr(rsp, rbx);
    6.75  
    6.76    // Push interpreter frames in a loop
     7.1 --- a/src/share/vm/ci/ciEnv.cpp	Thu Dec 05 19:19:09 2013 +0100
     7.2 +++ b/src/share/vm/ci/ciEnv.cpp	Thu Dec 05 15:13:12 2013 -0800
     7.3 @@ -1003,21 +1003,15 @@
     7.4      // Free codeBlobs
     7.5      code_buffer->free_blob();
     7.6  
     7.7 -    if (nm == NULL) {
     7.8 -      // The CodeCache is full.  Print out warning and disable compilation.
     7.9 -      record_failure("code cache is full");
    7.10 -      {
    7.11 -        MutexUnlocker ml(Compile_lock);
    7.12 -        MutexUnlocker locker(MethodCompileQueue_lock);
    7.13 -        CompileBroker::handle_full_code_cache();
    7.14 -      }
    7.15 -    } else {
    7.16 +    if (nm != NULL) {
    7.17        nm->set_has_unsafe_access(has_unsafe_access);
    7.18        nm->set_has_wide_vectors(has_wide_vectors);
    7.19  
    7.20        // Record successful registration.
    7.21        // (Put nm into the task handle *before* publishing to the Java heap.)
    7.22 -      if (task() != NULL)  task()->set_code(nm);
    7.23 +      if (task() != NULL) {
    7.24 +        task()->set_code(nm);
    7.25 +      }
    7.26  
    7.27        if (entry_bci == InvocationEntryBci) {
    7.28          if (TieredCompilation) {
    7.29 @@ -1055,12 +1049,16 @@
    7.30          method->method_holder()->add_osr_nmethod(nm);
    7.31        }
    7.32      }
    7.33 +  }  // safepoints are allowed again
    7.34 +
    7.35 +  if (nm != NULL) {
    7.36 +    // JVMTI -- compiled method notification (must be done outside lock)
    7.37 +    nm->post_compiled_method_load_event();
    7.38 +  } else {
    7.39 +    // The CodeCache is full. Print out warning and disable compilation.
    7.40 +    record_failure("code cache is full");
    7.41 +    CompileBroker::handle_full_code_cache();
    7.42    }
    7.43 -  // JVMTI -- compiled method notification (must be done outside lock)
    7.44 -  if (nm != NULL) {
    7.45 -    nm->post_compiled_method_load_event();
    7.46 -  }
    7.47 -
    7.48  }
    7.49  
    7.50  
     8.1 --- a/src/share/vm/classfile/classFileParser.cpp	Thu Dec 05 19:19:09 2013 +0100
     8.2 +++ b/src/share/vm/classfile/classFileParser.cpp	Thu Dec 05 15:13:12 2013 -0800
     8.3 @@ -4483,8 +4483,8 @@
     8.4    for (int index = 0; index < num_methods; index++) {
     8.5      Method* m = methods->at(index);
     8.6  
     8.7 -    // skip static and <init> methods
     8.8 -    if ((!m->is_static()) &&
     8.9 +    // skip private, static, and <init> methods
    8.10 +    if ((!m->is_private() && !m->is_static()) &&
    8.11          (m->name() != vmSymbols::object_initializer_name())) {
    8.12  
    8.13        Symbol* name = m->name();
     9.1 --- a/src/share/vm/classfile/classLoaderData.cpp	Thu Dec 05 19:19:09 2013 +0100
     9.2 +++ b/src/share/vm/classfile/classLoaderData.cpp	Thu Dec 05 15:13:12 2013 -0800
     9.3 @@ -62,13 +62,13 @@
     9.4  #include "runtime/safepoint.hpp"
     9.5  #include "runtime/synchronizer.hpp"
     9.6  #include "utilities/growableArray.hpp"
     9.7 +#include "utilities/macros.hpp"
     9.8  #include "utilities/ostream.hpp"
     9.9  
    9.10  #if INCLUDE_TRACE
    9.11   #include "trace/tracing.hpp"
    9.12  #endif
    9.13  
    9.14 -
    9.15  ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL;
    9.16  
    9.17  ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_anonymous, Dependencies dependencies) :
    9.18 @@ -754,7 +754,7 @@
    9.19    if (Tracing::enabled()) {
    9.20      if (Tracing::is_event_enabled(TraceClassUnloadEvent)) {
    9.21        assert(_unloading != NULL, "need class loader data unload list!");
    9.22 -      _class_unload_time = Tracing::time();
    9.23 +      _class_unload_time = Ticks::now();
    9.24        classes_unloading_do(&class_unload_event);
    9.25      }
    9.26      Tracing::on_unloading_classes();
    9.27 @@ -832,7 +832,7 @@
    9.28  
    9.29  #if INCLUDE_TRACE
    9.30  
    9.31 -TracingTime ClassLoaderDataGraph::_class_unload_time;
    9.32 +Ticks ClassLoaderDataGraph::_class_unload_time;
    9.33  
    9.34  void ClassLoaderDataGraph::class_unload_event(Klass* const k) {
    9.35  
    10.1 --- a/src/share/vm/classfile/classLoaderData.hpp	Thu Dec 05 19:19:09 2013 +0100
    10.2 +++ b/src/share/vm/classfile/classLoaderData.hpp	Thu Dec 05 15:13:12 2013 -0800
    10.3 @@ -33,7 +33,7 @@
    10.4  #include "utilities/growableArray.hpp"
    10.5  
    10.6  #if INCLUDE_TRACE
    10.7 -# include "trace/traceTime.hpp"
    10.8 +# include "utilities/ticks.hpp"
    10.9  #endif
   10.10  
   10.11  //
   10.12 @@ -98,7 +98,7 @@
   10.13  
   10.14  #if INCLUDE_TRACE
   10.15   private:
   10.16 -  static TracingTime _class_unload_time;
   10.17 +  static Ticks _class_unload_time;
   10.18    static void class_unload_event(Klass* const k);
   10.19  #endif
   10.20  };
    11.1 --- a/src/share/vm/classfile/metadataOnStackMark.cpp	Thu Dec 05 19:19:09 2013 +0100
    11.2 +++ b/src/share/vm/classfile/metadataOnStackMark.cpp	Thu Dec 05 15:13:12 2013 -0800
    11.3 @@ -30,6 +30,7 @@
    11.4  #include "prims/jvmtiImpl.hpp"
    11.5  #include "runtime/synchronizer.hpp"
    11.6  #include "runtime/thread.hpp"
    11.7 +#include "services/threadService.hpp"
    11.8  #include "utilities/growableArray.hpp"
    11.9  
   11.10  
   11.11 @@ -50,6 +51,7 @@
   11.12    CodeCache::alive_nmethods_do(nmethod::mark_on_stack);
   11.13    CompileBroker::mark_on_stack();
   11.14    JvmtiCurrentBreakpoints::metadata_do(Metadata::mark_on_stack);
   11.15 +  ThreadService::metadata_do(Metadata::mark_on_stack);
   11.16  }
   11.17  
   11.18  MetadataOnStackMark::~MetadataOnStackMark() {
    12.1 --- a/src/share/vm/classfile/systemDictionary.cpp	Thu Dec 05 19:19:09 2013 +0100
    12.2 +++ b/src/share/vm/classfile/systemDictionary.cpp	Thu Dec 05 15:13:12 2013 -0800
    12.3 @@ -55,13 +55,13 @@
    12.4  #include "runtime/signature.hpp"
    12.5  #include "services/classLoadingService.hpp"
    12.6  #include "services/threadService.hpp"
    12.7 +#include "utilities/macros.hpp"
    12.8 +#include "utilities/ticks.hpp"
    12.9  
   12.10  #if INCLUDE_TRACE
   12.11   #include "trace/tracing.hpp"
   12.12 - #include "trace/traceMacros.hpp"
   12.13  #endif
   12.14  
   12.15 -
   12.16  Dictionary*            SystemDictionary::_dictionary          = NULL;
   12.17  PlaceholderTable*      SystemDictionary::_placeholders        = NULL;
   12.18  Dictionary*            SystemDictionary::_shared_dictionary   = NULL;
   12.19 @@ -598,7 +598,7 @@
   12.20    assert(name != NULL && !FieldType::is_array(name) &&
   12.21           !FieldType::is_obj(name), "invalid class name");
   12.22  
   12.23 -  TracingTime class_load_start_time = Tracing::time();
   12.24 +  Ticks class_load_start_time = Ticks::now();
   12.25  
   12.26    // UseNewReflection
   12.27    // Fix for 4474172; see evaluation for more details
   12.28 @@ -1006,7 +1006,7 @@
   12.29                                        TRAPS) {
   12.30    TempNewSymbol parsed_name = NULL;
   12.31  
   12.32 -  TracingTime class_load_start_time = Tracing::time();
   12.33 +  Ticks class_load_start_time = Ticks::now();
   12.34  
   12.35    ClassLoaderData* loader_data;
   12.36    if (host_klass.not_null()) {
   12.37 @@ -2665,13 +2665,12 @@
   12.38  }
   12.39  
   12.40  // utility function for class load event
   12.41 -void SystemDictionary::post_class_load_event(TracingTime start_time,
   12.42 +void SystemDictionary::post_class_load_event(const Ticks& start_time,
   12.43                                               instanceKlassHandle k,
   12.44                                               Handle initiating_loader) {
   12.45  #if INCLUDE_TRACE
   12.46    EventClassLoad event(UNTIMED);
   12.47    if (event.should_commit()) {
   12.48 -    event.set_endtime(Tracing::time());
   12.49      event.set_starttime(start_time);
   12.50      event.set_loadedClass(k());
   12.51      oop defining_class_loader = k->class_loader();
    13.1 --- a/src/share/vm/classfile/systemDictionary.hpp	Thu Dec 05 19:19:09 2013 +0100
    13.2 +++ b/src/share/vm/classfile/systemDictionary.hpp	Thu Dec 05 15:13:12 2013 -0800
    13.3 @@ -31,7 +31,6 @@
    13.4  #include "oops/symbol.hpp"
    13.5  #include "runtime/java.hpp"
    13.6  #include "runtime/reflectionUtils.hpp"
    13.7 -#include "trace/traceTime.hpp"
    13.8  #include "utilities/hashtable.hpp"
    13.9  #include "utilities/hashtable.inline.hpp"
   13.10  
   13.11 @@ -78,6 +77,7 @@
   13.12  template <MEMFLAGS F> class HashtableBucket;
   13.13  class ResolutionErrorTable;
   13.14  class SymbolPropertyTable;
   13.15 +class Ticks;
   13.16  
   13.17  // Certain classes are preloaded, such as java.lang.Object and java.lang.String.
   13.18  // They are all "well-known", in the sense that no class loader is allowed
   13.19 @@ -141,7 +141,6 @@
   13.20    /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */                              \
   13.21    /* Universe::is_gte_jdk14x_version() is not set up by this point. */                                                   \
   13.22    /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
   13.23 -  do_klass(lambda_MagicLambdaImpl_klass,                java_lang_invoke_MagicLambdaImpl,          Opt                 ) \
   13.24    do_klass(reflect_MagicAccessorImpl_klass,             sun_reflect_MagicAccessorImpl,             Opt                 ) \
   13.25    do_klass(reflect_MethodAccessorImpl_klass,            sun_reflect_MethodAccessorImpl,            Opt_Only_JDK14NewRef) \
   13.26    do_klass(reflect_ConstructorAccessorImpl_klass,       sun_reflect_ConstructorAccessorImpl,       Opt_Only_JDK14NewRef) \
   13.27 @@ -166,6 +165,7 @@
   13.28                                                                                                                           \
   13.29    do_klass(StringBuffer_klass,                          java_lang_StringBuffer,                    Pre                 ) \
   13.30    do_klass(StringBuilder_klass,                         java_lang_StringBuilder,                   Pre                 ) \
   13.31 +  do_klass(misc_Unsafe_klass,                           sun_misc_Unsafe,                           Pre                 ) \
   13.32                                                                                                                           \
   13.33    /* It's NULL in non-1.4 JDKs. */                                                                                       \
   13.34    do_klass(StackTraceElement_klass,                     java_lang_StackTraceElement,               Opt                 ) \
   13.35 @@ -638,7 +638,7 @@
   13.36    static void add_to_hierarchy(instanceKlassHandle k, TRAPS);
   13.37  
   13.38    // event based tracing
   13.39 -  static void post_class_load_event(TracingTime start_time, instanceKlassHandle k,
   13.40 +  static void post_class_load_event(const Ticks& start_time, instanceKlassHandle k,
   13.41                                      Handle initiating_loader);
   13.42    // We pass in the hashtable index so we can calculate it outside of
   13.43    // the SystemDictionary_lock.
    14.1 --- a/src/share/vm/classfile/verifier.cpp	Thu Dec 05 19:19:09 2013 +0100
    14.2 +++ b/src/share/vm/classfile/verifier.cpp	Thu Dec 05 15:13:12 2013 -0800
    14.3 @@ -188,10 +188,8 @@
    14.4  bool Verifier::is_eligible_for_verification(instanceKlassHandle klass, bool should_verify_class) {
    14.5    Symbol* name = klass->name();
    14.6    Klass* refl_magic_klass = SystemDictionary::reflect_MagicAccessorImpl_klass();
    14.7 -  Klass* lambda_magic_klass = SystemDictionary::lambda_MagicLambdaImpl_klass();
    14.8  
    14.9    bool is_reflect = refl_magic_klass != NULL && klass->is_subtype_of(refl_magic_klass);
   14.10 -  bool is_lambda = lambda_magic_klass != NULL && klass->is_subtype_of(lambda_magic_klass);
   14.11  
   14.12    return (should_verify_for(klass->class_loader(), should_verify_class) &&
   14.13      // return if the class is a bootstrapping class
   14.14 @@ -215,9 +213,7 @@
   14.15      // NOTE: this is called too early in the bootstrapping process to be
   14.16      // guarded by Universe::is_gte_jdk14x_version()/UseNewReflection.
   14.17      // Also for lambda generated code, gte jdk8
   14.18 -    (!is_reflect || VerifyReflectionBytecodes) &&
   14.19 -    (!is_lambda || VerifyLambdaBytecodes)
   14.20 -  );
   14.21 +    (!is_reflect || VerifyReflectionBytecodes));
   14.22  }
   14.23  
   14.24  Symbol* Verifier::inference_verify(
   14.25 @@ -2306,6 +2302,24 @@
   14.26    }
   14.27  }
   14.28  
   14.29 +bool ClassVerifier::is_same_or_direct_interface(
   14.30 +    instanceKlassHandle klass,
   14.31 +    VerificationType klass_type,
   14.32 +    VerificationType ref_class_type) {
   14.33 +  if (ref_class_type.equals(klass_type)) return true;
   14.34 +  Array<Klass*>* local_interfaces = klass->local_interfaces();
   14.35 +  if (local_interfaces != NULL) {
   14.36 +    for (int x = 0; x < local_interfaces->length(); x++) {
   14.37 +      Klass* k = local_interfaces->at(x);
   14.38 +      assert (k != NULL && k->is_interface(), "invalid interface");
   14.39 +      if (ref_class_type.equals(VerificationType::reference_type(k->name()))) {
   14.40 +        return true;
   14.41 +      }
   14.42 +    }
   14.43 +  }
   14.44 +  return false;
   14.45 +}
   14.46 +
   14.47  void ClassVerifier::verify_invoke_instructions(
   14.48      RawBytecodeStream* bcs, u4 code_length, StackMapFrame* current_frame,
   14.49      bool *this_uninit, VerificationType return_type,
   14.50 @@ -2436,23 +2450,38 @@
   14.51        return;
   14.52      }
   14.53    } else if (opcode == Bytecodes::_invokespecial
   14.54 -             && !ref_class_type.equals(current_type())
   14.55 +             && !is_same_or_direct_interface(current_class(), current_type(), ref_class_type)
   14.56               && !ref_class_type.equals(VerificationType::reference_type(
   14.57                    current_class()->super()->name()))) {
   14.58      bool subtype = false;
   14.59 +    bool have_imr_indirect = cp->tag_at(index).value() == JVM_CONSTANT_InterfaceMethodref;
   14.60      if (!current_class()->is_anonymous()) {
   14.61        subtype = ref_class_type.is_assignable_from(
   14.62                   current_type(), this, CHECK_VERIFY(this));
   14.63      } else {
   14.64 -      subtype = ref_class_type.is_assignable_from(VerificationType::reference_type(
   14.65 -                 current_class()->host_klass()->name()), this, CHECK_VERIFY(this));
   14.66 +      VerificationType host_klass_type =
   14.67 +                        VerificationType::reference_type(current_class()->host_klass()->name());
   14.68 +      subtype = ref_class_type.is_assignable_from(host_klass_type, this, CHECK_VERIFY(this));
   14.69 +
   14.70 +      // If invokespecial of IMR, need to recheck for same or
   14.71 +      // direct interface relative to the host class
   14.72 +      have_imr_indirect = (have_imr_indirect &&
   14.73 +                           !is_same_or_direct_interface(
   14.74 +                             InstanceKlass::cast(current_class()->host_klass()),
   14.75 +                             host_klass_type, ref_class_type));
   14.76      }
   14.77      if (!subtype) {
   14.78        verify_error(ErrorContext::bad_code(bci),
   14.79            "Bad invokespecial instruction: "
   14.80            "current class isn't assignable to reference class.");
   14.81         return;
   14.82 +    } else if (have_imr_indirect) {
   14.83 +      verify_error(ErrorContext::bad_code(bci),
   14.84 +          "Bad invokespecial instruction: "
   14.85 +          "interface method reference is in an indirect superinterface.");
   14.86 +      return;
   14.87      }
   14.88 +
   14.89    }
   14.90    // Match method descriptor with operand stack
   14.91    for (int i = nargs - 1; i >= 0; i--) {  // Run backwards
    15.1 --- a/src/share/vm/classfile/verifier.hpp	Thu Dec 05 19:19:09 2013 +0100
    15.2 +++ b/src/share/vm/classfile/verifier.hpp	Thu Dec 05 15:13:12 2013 -0800
    15.3 @@ -345,6 +345,9 @@
    15.4    // that a class has been verified and prepared for execution.
    15.5    bool was_recursively_verified() { return _klass->is_rewritten(); }
    15.6  
    15.7 +  bool is_same_or_direct_interface(instanceKlassHandle klass,
    15.8 +    VerificationType klass_type, VerificationType ref_class_type);
    15.9 +
   15.10   public:
   15.11    enum {
   15.12      BYTECODE_OFFSET = 1,
    16.1 --- a/src/share/vm/classfile/vmSymbols.hpp	Thu Dec 05 19:19:09 2013 +0100
    16.2 +++ b/src/share/vm/classfile/vmSymbols.hpp	Thu Dec 05 15:13:12 2013 -0800
    16.3 @@ -273,7 +273,6 @@
    16.4    template(java_lang_invoke_Stable_signature,         "Ljava/lang/invoke/Stable;")                \
    16.5    template(java_lang_invoke_LambdaForm_Compiled_signature, "Ljava/lang/invoke/LambdaForm$Compiled;") \
    16.6    template(java_lang_invoke_LambdaForm_Hidden_signature, "Ljava/lang/invoke/LambdaForm$Hidden;")  \
    16.7 -  template(java_lang_invoke_MagicLambdaImpl,          "java/lang/invoke/MagicLambdaImpl")         \
    16.8    /* internal up-calls made only by the JVM, via class sun.invoke.MethodHandleNatives: */         \
    16.9    template(findMethodHandleType_name,                 "findMethodHandleType")                     \
   16.10    template(findMethodHandleType_signature,       "(Ljava/lang/Class;[Ljava/lang/Class;)Ljava/lang/invoke/MethodType;") \
   16.11 @@ -332,6 +331,7 @@
   16.12    template(findNative_name,                           "findNative")                               \
   16.13    template(deadChild_name,                            "deadChild")                                \
   16.14    template(addClass_name,                             "addClass")                                 \
   16.15 +  template(throwIllegalAccessError_name,              "throwIllegalAccessError")                  \
   16.16    template(getFromClass_name,                         "getFromClass")                             \
   16.17    template(dispatch_name,                             "dispatch")                                 \
   16.18    template(getSystemClassLoader_name,                 "getSystemClassLoader")                     \
    17.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu Dec 05 19:19:09 2013 +0100
    17.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Thu Dec 05 15:13:12 2013 -0800
    17.3 @@ -1993,7 +1993,7 @@
    17.4    GenCollectedHeap* gch = GenCollectedHeap::heap();
    17.5  
    17.6    STWGCTimer* gc_timer = GenMarkSweep::gc_timer();
    17.7 -  gc_timer->register_gc_start(os::elapsed_counter());
    17.8 +  gc_timer->register_gc_start();
    17.9  
   17.10    SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
   17.11    gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
   17.12 @@ -2089,7 +2089,7 @@
   17.13      size_policy()->msc_collection_end(gch->gc_cause());
   17.14    }
   17.15  
   17.16 -  gc_timer->register_gc_end(os::elapsed_counter());
   17.17 +  gc_timer->register_gc_end();
   17.18  
   17.19    gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
   17.20  
   17.21 @@ -2475,7 +2475,7 @@
   17.22  
   17.23  void CMSCollector::register_gc_start(GCCause::Cause cause) {
   17.24    _cms_start_registered = true;
   17.25 -  _gc_timer_cm->register_gc_start(os::elapsed_counter());
   17.26 +  _gc_timer_cm->register_gc_start();
   17.27    _gc_tracer_cm->report_gc_start(cause, _gc_timer_cm->gc_start());
   17.28  }
   17.29  
   17.30 @@ -2483,7 +2483,7 @@
   17.31    if (_cms_start_registered) {
   17.32      report_heap_summary(GCWhen::AfterGC);
   17.33  
   17.34 -    _gc_timer_cm->register_gc_end(os::elapsed_counter());
   17.35 +    _gc_timer_cm->register_gc_end();
   17.36      _gc_tracer_cm->report_gc_end(_gc_timer_cm->gc_end(), _gc_timer_cm->time_partitions());
   17.37      _cms_start_registered = false;
   17.38    }
    18.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Thu Dec 05 19:19:09 2013 +0100
    18.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Thu Dec 05 15:13:12 2013 -0800
    18.3 @@ -145,7 +145,7 @@
    18.4                                  );
    18.5  #endif /* USDT2 */
    18.6  
    18.7 -  _collector->_gc_timer_cm->register_gc_pause_start("Initial Mark", os::elapsed_counter());
    18.8 +  _collector->_gc_timer_cm->register_gc_pause_start("Initial Mark");
    18.9  
   18.10    GenCollectedHeap* gch = GenCollectedHeap::heap();
   18.11    GCCauseSetter gccs(gch, GCCause::_cms_initial_mark);
   18.12 @@ -157,7 +157,7 @@
   18.13  
   18.14    VM_CMS_Operation::verify_after_gc();
   18.15  
   18.16 -  _collector->_gc_timer_cm->register_gc_pause_end(os::elapsed_counter());
   18.17 +  _collector->_gc_timer_cm->register_gc_pause_end();
   18.18  
   18.19  #ifndef USDT2
   18.20    HS_DTRACE_PROBE(hs_private, cms__initmark__end);
   18.21 @@ -182,7 +182,7 @@
   18.22                                  );
   18.23  #endif /* USDT2 */
   18.24  
   18.25 -  _collector->_gc_timer_cm->register_gc_pause_start("Final Mark", os::elapsed_counter());
   18.26 +  _collector->_gc_timer_cm->register_gc_pause_start("Final Mark");
   18.27  
   18.28    GenCollectedHeap* gch = GenCollectedHeap::heap();
   18.29    GCCauseSetter gccs(gch, GCCause::_cms_final_remark);
   18.30 @@ -195,7 +195,7 @@
   18.31    VM_CMS_Operation::verify_after_gc();
   18.32  
   18.33    _collector->save_heap_summary();
   18.34 -  _collector->_gc_timer_cm->register_gc_pause_end(os::elapsed_counter());
   18.35 +  _collector->_gc_timer_cm->register_gc_pause_end();
   18.36  
   18.37  #ifndef USDT2
   18.38    HS_DTRACE_PROBE(hs_private, cms__remark__end);
    19.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Dec 05 19:19:09 2013 +0100
    19.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Thu Dec 05 15:13:12 2013 -0800
    19.3 @@ -56,6 +56,7 @@
    19.4  #include "oops/oop.inline.hpp"
    19.5  #include "oops/oop.pcgc.inline.hpp"
    19.6  #include "runtime/vmThread.hpp"
    19.7 +#include "utilities/ticks.hpp"
    19.8  
    19.9  size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0;
   19.10  
   19.11 @@ -1284,7 +1285,7 @@
   19.12    }
   19.13  
   19.14    STWGCTimer* gc_timer = G1MarkSweep::gc_timer();
   19.15 -  gc_timer->register_gc_start(os::elapsed_counter());
   19.16 +  gc_timer->register_gc_start();
   19.17  
   19.18    SerialOldTracer* gc_tracer = G1MarkSweep::gc_tracer();
   19.19    gc_tracer->report_gc_start(gc_cause(), gc_timer->gc_start());
   19.20 @@ -1552,7 +1553,7 @@
   19.21  
   19.22      post_full_gc_dump(gc_timer);
   19.23  
   19.24 -    gc_timer->register_gc_end(os::elapsed_counter());
   19.25 +    gc_timer->register_gc_end();
   19.26      gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
   19.27    }
   19.28  
   19.29 @@ -2482,7 +2483,7 @@
   19.30    FullGCCount_lock->notify_all();
   19.31  }
   19.32  
   19.33 -void G1CollectedHeap::register_concurrent_cycle_start(jlong start_time) {
   19.34 +void G1CollectedHeap::register_concurrent_cycle_start(const Ticks& start_time) {
   19.35    _concurrent_cycle_started = true;
   19.36    _gc_timer_cm->register_gc_start(start_time);
   19.37  
   19.38 @@ -2496,7 +2497,7 @@
   19.39        _gc_tracer_cm->report_concurrent_mode_failure();
   19.40      }
   19.41  
   19.42 -    _gc_timer_cm->register_gc_end(os::elapsed_counter());
   19.43 +    _gc_timer_cm->register_gc_end();
   19.44      _gc_tracer_cm->report_gc_end(_gc_timer_cm->gc_end(), _gc_timer_cm->time_partitions());
   19.45  
   19.46      _concurrent_cycle_started = false;
   19.47 @@ -3887,7 +3888,7 @@
   19.48      return false;
   19.49    }
   19.50  
   19.51 -  _gc_timer_stw->register_gc_start(os::elapsed_counter());
   19.52 +  _gc_timer_stw->register_gc_start();
   19.53  
   19.54    _gc_tracer_stw->report_gc_start(gc_cause(), _gc_timer_stw->gc_start());
   19.55  
   19.56 @@ -4265,7 +4266,7 @@
   19.57  
   19.58      _gc_tracer_stw->report_evacuation_info(&evacuation_info);
   19.59      _gc_tracer_stw->report_tenuring_threshold(_g1_policy->tenuring_threshold());
   19.60 -    _gc_timer_stw->register_gc_end(os::elapsed_counter());
   19.61 +    _gc_timer_stw->register_gc_end();
   19.62      _gc_tracer_stw->report_gc_end(_gc_timer_stw->gc_end(), _gc_timer_stw->time_partitions());
   19.63    }
   19.64    // It should now be safe to tell the concurrent mark thread to start
    20.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Dec 05 19:19:09 2013 +0100
    20.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Thu Dec 05 15:13:12 2013 -0800
    20.3 @@ -72,6 +72,7 @@
    20.4  class G1OldTracer;
    20.5  class EvacuationFailedInfo;
    20.6  class nmethod;
    20.7 +class Ticks;
    20.8  
    20.9  typedef OverflowTaskQueue<StarTask, mtGC>         RefToScanQueue;
   20.10  typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet;
   20.11 @@ -746,7 +747,7 @@
   20.12      return _old_marking_cycles_completed;
   20.13    }
   20.14  
   20.15 -  void register_concurrent_cycle_start(jlong start_time);
   20.16 +  void register_concurrent_cycle_start(const Ticks& start_time);
   20.17    void register_concurrent_cycle_end();
   20.18    void trace_heap_after_concurrent_cycle();
   20.19  
    21.1 --- a/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Thu Dec 05 19:19:09 2013 +0100
    21.2 +++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Thu Dec 05 15:13:12 2013 -0800
    21.3 @@ -915,7 +915,7 @@
    21.4  
    21.5    GenCollectedHeap* gch = GenCollectedHeap::heap();
    21.6  
    21.7 -  _gc_timer->register_gc_start(os::elapsed_counter());
    21.8 +  _gc_timer->register_gc_start();
    21.9  
   21.10    assert(gch->kind() == CollectedHeap::GenCollectedHeap,
   21.11      "not a CMS generational heap");
   21.12 @@ -1091,7 +1091,7 @@
   21.13    gch->trace_heap_after_gc(&gc_tracer);
   21.14    gc_tracer.report_tenuring_threshold(tenuring_threshold());
   21.15  
   21.16 -  _gc_timer->register_gc_end(os::elapsed_counter());
   21.17 +  _gc_timer->register_gc_end();
   21.18  
   21.19    gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
   21.20  }
    22.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Thu Dec 05 19:19:09 2013 +0100
    22.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Thu Dec 05 15:13:12 2013 -0800
    22.3 @@ -114,7 +114,7 @@
    22.4    assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
    22.5    GCCause::Cause gc_cause = heap->gc_cause();
    22.6  
    22.7 -  _gc_timer->register_gc_start(os::elapsed_counter());
    22.8 +  _gc_timer->register_gc_start();
    22.9    _gc_tracer->report_gc_start(gc_cause, _gc_timer->gc_start());
   22.10  
   22.11    PSAdaptiveSizePolicy* size_policy = heap->size_policy();
   22.12 @@ -390,7 +390,7 @@
   22.13    ParallelTaskTerminator::print_termination_counts();
   22.14  #endif
   22.15  
   22.16 -  _gc_timer->register_gc_end(os::elapsed_counter());
   22.17 +  _gc_timer->register_gc_end();
   22.18  
   22.19    _gc_tracer->report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
   22.20  
    23.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Thu Dec 05 19:19:09 2013 +0100
    23.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Thu Dec 05 15:13:12 2013 -0800
    23.3 @@ -2006,7 +2006,7 @@
    23.4  
    23.5    ParallelScavengeHeap* heap = gc_heap();
    23.6  
    23.7 -  _gc_timer.register_gc_start(os::elapsed_counter());
    23.8 +  _gc_timer.register_gc_start();
    23.9    _gc_tracer.report_gc_start(heap->gc_cause(), _gc_timer.gc_start());
   23.10  
   23.11    TimeStamp marking_start;
   23.12 @@ -2244,7 +2244,7 @@
   23.13    ParallelTaskTerminator::print_termination_counts();
   23.14  #endif
   23.15  
   23.16 -  _gc_timer.register_gc_end(os::elapsed_counter());
   23.17 +  _gc_timer.register_gc_end();
   23.18  
   23.19    _gc_tracer.report_dense_prefix(dense_prefix(old_space_id));
   23.20    _gc_tracer.report_gc_end(_gc_timer.gc_end(), _gc_timer.time_partitions());
    24.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Thu Dec 05 19:19:09 2013 +0100
    24.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Thu Dec 05 15:13:12 2013 -0800
    24.3 @@ -263,7 +263,7 @@
    24.4    assert(_preserved_mark_stack.is_empty(), "should be empty");
    24.5    assert(_preserved_oop_stack.is_empty(), "should be empty");
    24.6  
    24.7 -  _gc_timer.register_gc_start(os::elapsed_counter());
    24.8 +  _gc_timer.register_gc_start();
    24.9  
   24.10    TimeStamp scavenge_entry;
   24.11    TimeStamp scavenge_midpoint;
   24.12 @@ -691,7 +691,7 @@
   24.13  #endif
   24.14  
   24.15  
   24.16 -  _gc_timer.register_gc_end(os::elapsed_counter());
   24.17 +  _gc_timer.register_gc_end();
   24.18  
   24.19    _gc_tracer.report_gc_end(_gc_timer.gc_end(), _gc_timer.time_partitions());
   24.20  
    25.1 --- a/src/share/vm/gc_implementation/shared/gcTimer.cpp	Thu Dec 05 19:19:09 2013 +0100
    25.2 +++ b/src/share/vm/gc_implementation/shared/gcTimer.cpp	Thu Dec 05 15:13:12 2013 -0800
    25.3 @@ -25,52 +25,55 @@
    25.4  #include "precompiled.hpp"
    25.5  #include "gc_implementation/shared/gcTimer.hpp"
    25.6  #include "utilities/growableArray.hpp"
    25.7 +#include "utilities/ticks.inline.hpp"
    25.8  
    25.9 -void GCTimer::register_gc_start(jlong time) {
   25.10 +// the "time" parameter for most functions
   25.11 +// has a default value set by Ticks::now()
   25.12 +
   25.13 +void GCTimer::register_gc_start(const Ticks& time) {
   25.14    _time_partitions.clear();
   25.15    _gc_start = time;
   25.16  }
   25.17  
   25.18 -void GCTimer::register_gc_end(jlong time) {
   25.19 +void GCTimer::register_gc_end(const Ticks& time) {
   25.20    assert(!_time_partitions.has_active_phases(),
   25.21        "We should have ended all started phases, before ending the GC");
   25.22  
   25.23    _gc_end = time;
   25.24  }
   25.25  
   25.26 -void GCTimer::register_gc_pause_start(const char* name, jlong time) {
   25.27 +void GCTimer::register_gc_pause_start(const char* name, const Ticks& time) {
   25.28    _time_partitions.report_gc_phase_start(name, time);
   25.29  }
   25.30  
   25.31 -void GCTimer::register_gc_pause_end(jlong time) {
   25.32 +void GCTimer::register_gc_pause_end(const Ticks& time) {
   25.33    _time_partitions.report_gc_phase_end(time);
   25.34  }
   25.35  
   25.36 -void GCTimer::register_gc_phase_start(const char* name, jlong time) {
   25.37 +void GCTimer::register_gc_phase_start(const char* name, const Ticks& time) {
   25.38    _time_partitions.report_gc_phase_start(name, time);
   25.39  }
   25.40  
   25.41 -void GCTimer::register_gc_phase_end(jlong time) {
   25.42 +void GCTimer::register_gc_phase_end(const Ticks& time) {
   25.43    _time_partitions.report_gc_phase_end(time);
   25.44  }
   25.45  
   25.46 -
   25.47 -void STWGCTimer::register_gc_start(jlong time) {
   25.48 +void STWGCTimer::register_gc_start(const Ticks& time) {
   25.49    GCTimer::register_gc_start(time);
   25.50    register_gc_pause_start("GC Pause", time);
   25.51  }
   25.52  
   25.53 -void STWGCTimer::register_gc_end(jlong time) {
   25.54 +void STWGCTimer::register_gc_end(const Ticks& time) {
   25.55    register_gc_pause_end(time);
   25.56    GCTimer::register_gc_end(time);
   25.57  }
   25.58  
   25.59 -void ConcurrentGCTimer::register_gc_pause_start(const char* name, jlong time) {
   25.60 -  GCTimer::register_gc_pause_start(name, time);
   25.61 +void ConcurrentGCTimer::register_gc_pause_start(const char* name) {
   25.62 +  GCTimer::register_gc_pause_start(name);
   25.63  }
   25.64  
   25.65 -void ConcurrentGCTimer::register_gc_pause_end(jlong time) {
   25.66 -  GCTimer::register_gc_pause_end(time);
   25.67 +void ConcurrentGCTimer::register_gc_pause_end() {
   25.68 +  GCTimer::register_gc_pause_end();
   25.69  }
   25.70  
   25.71  void PhasesStack::clear() {
   25.72 @@ -111,11 +114,11 @@
   25.73  void TimePartitions::clear() {
   25.74    _phases->clear();
   25.75    _active_phases.clear();
   25.76 -  _sum_of_pauses = 0;
   25.77 -  _longest_pause = 0;
   25.78 +  _sum_of_pauses = Tickspan();
   25.79 +  _longest_pause = Tickspan();
   25.80  }
   25.81  
   25.82 -void TimePartitions::report_gc_phase_start(const char* name, jlong time) {
   25.83 +void TimePartitions::report_gc_phase_start(const char* name, const Ticks& time) {
   25.84    assert(_phases->length() <= 1000, "Too many recored phases?");
   25.85  
   25.86    int level = _active_phases.count();
   25.87 @@ -133,13 +136,13 @@
   25.88  void TimePartitions::update_statistics(GCPhase* phase) {
   25.89    // FIXME: This should only be done for pause phases
   25.90    if (phase->level() == 0) {
   25.91 -    jlong pause = phase->end() - phase->start();
   25.92 +    const Tickspan pause = phase->end() - phase->start();
   25.93      _sum_of_pauses += pause;
   25.94      _longest_pause = MAX2(pause, _longest_pause);
   25.95    }
   25.96  }
   25.97  
   25.98 -void TimePartitions::report_gc_phase_end(jlong time) {
   25.99 +void TimePartitions::report_gc_phase_end(const Ticks& time) {
  25.100    int phase_index = _active_phases.pop();
  25.101    GCPhase* phase = _phases->adr_at(phase_index);
  25.102    phase->set_end(time);
  25.103 @@ -157,14 +160,6 @@
  25.104    return _phases->adr_at(index);
  25.105  }
  25.106  
  25.107 -jlong TimePartitions::sum_of_pauses() {
  25.108 -  return _sum_of_pauses;
  25.109 -}
  25.110 -
  25.111 -jlong TimePartitions::longest_pause() {
  25.112 -  return _longest_pause;
  25.113 -}
  25.114 -
  25.115  bool TimePartitions::has_active_phases() {
  25.116    return _active_phases.count() > 0;
  25.117  }
  25.118 @@ -194,7 +189,7 @@
  25.119      max_nested_pause_phases();
  25.120    }
  25.121  
  25.122 -  static void validate_pause_phase(GCPhase* phase, int level, const char* name, jlong start, jlong end) {
  25.123 +  static void validate_pause_phase(GCPhase* phase, int level, const char* name, const Ticks& start, const Ticks& end) {
  25.124      assert(phase->level() == level, "Incorrect level");
  25.125      assert(strcmp(phase->name(), name) == 0, "Incorrect name");
  25.126      assert(phase->start() == start, "Incorrect start");
  25.127 @@ -209,8 +204,8 @@
  25.128      TimePartitionPhasesIterator iter(&time_partitions);
  25.129  
  25.130      validate_pause_phase(iter.next(), 0, "PausePhase", 2, 8);
  25.131 -    assert(time_partitions.sum_of_pauses() == 8-2, "Incorrect");
  25.132 -    assert(time_partitions.longest_pause() == 8-2, "Incorrect");
  25.133 +    assert(time_partitions.sum_of_pauses() == Ticks(8) - Ticks(2), "Incorrect");
  25.134 +    assert(time_partitions.longest_pause() == Ticks(8) - Ticks(2), "Incorrect");
  25.135  
  25.136      assert(!iter.has_next(), "Too many elements");
  25.137    }
  25.138 @@ -227,8 +222,8 @@
  25.139      validate_pause_phase(iter.next(), 0, "PausePhase1", 2, 3);
  25.140      validate_pause_phase(iter.next(), 0, "PausePhase2", 4, 6);
  25.141  
  25.142 -    assert(time_partitions.sum_of_pauses() == 3, "Incorrect");
  25.143 -    assert(time_partitions.longest_pause() == 2, "Incorrect");
  25.144 +    assert(time_partitions.sum_of_pauses() == Ticks(3) - Ticks(0), "Incorrect");
  25.145 +    assert(time_partitions.longest_pause() == Ticks(2) - Ticks(0), "Incorrect");
  25.146  
  25.147      assert(!iter.has_next(), "Too many elements");
  25.148    }
  25.149 @@ -245,8 +240,8 @@
  25.150      validate_pause_phase(iter.next(), 0, "PausePhase", 2, 5);
  25.151      validate_pause_phase(iter.next(), 1, "SubPhase", 3, 4);
  25.152  
  25.153 -    assert(time_partitions.sum_of_pauses() == 3, "Incorrect");
  25.154 -    assert(time_partitions.longest_pause() == 3, "Incorrect");
  25.155 +    assert(time_partitions.sum_of_pauses() == Ticks(3) - Ticks(0), "Incorrect");
  25.156 +    assert(time_partitions.longest_pause() == Ticks(3) - Ticks(0), "Incorrect");
  25.157  
  25.158      assert(!iter.has_next(), "Too many elements");
  25.159    }
  25.160 @@ -269,8 +264,8 @@
  25.161      validate_pause_phase(iter.next(), 2, "SubPhase2", 4, 7);
  25.162      validate_pause_phase(iter.next(), 3, "SubPhase3", 5, 6);
  25.163  
  25.164 -    assert(time_partitions.sum_of_pauses() == 7, "Incorrect");
  25.165 -    assert(time_partitions.longest_pause() == 7, "Incorrect");
  25.166 +    assert(time_partitions.sum_of_pauses() == Ticks(7) - Ticks(0), "Incorrect");
  25.167 +    assert(time_partitions.longest_pause() == Ticks(7) - Ticks(0), "Incorrect");
  25.168  
  25.169      assert(!iter.has_next(), "Too many elements");
  25.170    }
  25.171 @@ -298,8 +293,8 @@
  25.172      validate_pause_phase(iter.next(), 1, "SubPhase3", 7, 8);
  25.173      validate_pause_phase(iter.next(), 1, "SubPhase4", 9, 10);
  25.174  
  25.175 -    assert(time_partitions.sum_of_pauses() == 9, "Incorrect");
  25.176 -    assert(time_partitions.longest_pause() == 9, "Incorrect");
  25.177 +    assert(time_partitions.sum_of_pauses() == Ticks(9) - Ticks(0), "Incorrect");
  25.178 +    assert(time_partitions.longest_pause() == Ticks(9) - Ticks(0), "Incorrect");
  25.179  
  25.180      assert(!iter.has_next(), "Too many elements");
  25.181    }
  25.182 @@ -336,8 +331,8 @@
  25.183      validate_pause_phase(iter.next(), 2, "SubPhase22", 12, 13);
  25.184      validate_pause_phase(iter.next(), 1, "SubPhase3", 15, 16);
  25.185  
  25.186 -    assert(time_partitions.sum_of_pauses() == 15, "Incorrect");
  25.187 -    assert(time_partitions.longest_pause() == 15, "Incorrect");
  25.188 +    assert(time_partitions.sum_of_pauses() == Ticks(15) - Ticks(0), "Incorrect");
  25.189 +    assert(time_partitions.longest_pause() == Ticks(15) - Ticks(0), "Incorrect");
  25.190  
  25.191      assert(!iter.has_next(), "Too many elements");
  25.192    }
    26.1 --- a/src/share/vm/gc_implementation/shared/gcTimer.hpp	Thu Dec 05 19:19:09 2013 +0100
    26.2 +++ b/src/share/vm/gc_implementation/shared/gcTimer.hpp	Thu Dec 05 15:13:12 2013 -0800
    26.3 @@ -28,6 +28,7 @@
    26.4  #include "memory/allocation.hpp"
    26.5  #include "prims/jni_md.h"
    26.6  #include "utilities/macros.hpp"
    26.7 +#include "utilities/ticks.hpp"
    26.8  
    26.9  class ConcurrentPhase;
   26.10  class GCPhase;
   26.11 @@ -45,21 +46,21 @@
   26.12  class GCPhase {
   26.13    const char* _name;
   26.14    int _level;
   26.15 -  jlong _start;
   26.16 -  jlong _end;
   26.17 +  Ticks _start;
   26.18 +  Ticks _end;
   26.19  
   26.20   public:
   26.21    void set_name(const char* name) { _name = name; }
   26.22 -  const char* name() { return _name; }
   26.23 +  const char* name() const { return _name; }
   26.24  
   26.25 -  int level() { return _level; }
   26.26 +  int level() const { return _level; }
   26.27    void set_level(int level) { _level = level; }
   26.28  
   26.29 -  jlong start() { return _start; }
   26.30 -  void set_start(jlong time) { _start = time; }
   26.31 +  const Ticks start() const { return _start; }
   26.32 +  void set_start(const Ticks& time) { _start = time; }
   26.33  
   26.34 -  jlong end() { return _end; }
   26.35 -  void set_end(jlong time) { _end = time; }
   26.36 +  const Ticks end() const { return _end; }
   26.37 +  void set_end(const Ticks& time) { _end = time; }
   26.38  
   26.39    virtual void accept(PhaseVisitor* visitor) = 0;
   26.40  };
   26.41 @@ -102,22 +103,22 @@
   26.42    GrowableArray<PausePhase>* _phases;
   26.43    PhasesStack _active_phases;
   26.44  
   26.45 -  jlong _sum_of_pauses;
   26.46 -  jlong _longest_pause;
   26.47 +  Tickspan _sum_of_pauses;
   26.48 +  Tickspan _longest_pause;
   26.49  
   26.50   public:
   26.51    TimePartitions();
   26.52    ~TimePartitions();
   26.53    void clear();
   26.54  
   26.55 -  void report_gc_phase_start(const char* name, jlong time);
   26.56 -  void report_gc_phase_end(jlong time);
   26.57 +  void report_gc_phase_start(const char* name, const Ticks& time);
   26.58 +  void report_gc_phase_end(const Ticks& time);
   26.59  
   26.60    int num_phases() const;
   26.61    GCPhase* phase_at(int index) const;
   26.62  
   26.63 -  jlong sum_of_pauses();
   26.64 -  jlong longest_pause();
   26.65 +  const Tickspan sum_of_pauses() const { return _sum_of_pauses; }
   26.66 +  const Tickspan longest_pause() const { return _longest_pause; }
   26.67  
   26.68    bool has_active_phases();
   26.69   private:
   26.70 @@ -133,40 +134,37 @@
   26.71  class GCTimer : public ResourceObj {
   26.72    NOT_PRODUCT(friend class GCTimerTest;)
   26.73   protected:
   26.74 -  jlong _gc_start;
   26.75 -  jlong _gc_end;
   26.76 +  Ticks _gc_start;
   26.77 +  Ticks _gc_end;
   26.78    TimePartitions _time_partitions;
   26.79  
   26.80   public:
   26.81 -  virtual void register_gc_start(jlong time);
   26.82 -  virtual void register_gc_end(jlong time);
   26.83 +  virtual void register_gc_start(const Ticks& time = Ticks::now());
   26.84 +  virtual void register_gc_end(const Ticks& time = Ticks::now());
   26.85  
   26.86 -  void register_gc_phase_start(const char* name, jlong time);
   26.87 -  void register_gc_phase_end(jlong time);
   26.88 +  void register_gc_phase_start(const char* name, const Ticks& time);
   26.89 +  void register_gc_phase_end(const Ticks& time);
   26.90  
   26.91 -  jlong gc_start() { return _gc_start; }
   26.92 -  jlong gc_end() { return _gc_end; }
   26.93 +  const Ticks gc_start() const { return _gc_start; }
   26.94 +  const Ticks gc_end() const { return _gc_end; }
   26.95  
   26.96    TimePartitions* time_partitions() { return &_time_partitions; }
   26.97  
   26.98 -  long longest_pause();
   26.99 -  long sum_of_pauses();
  26.100 -
  26.101   protected:
  26.102 -  void register_gc_pause_start(const char* name, jlong time);
  26.103 -  void register_gc_pause_end(jlong time);
  26.104 +  void register_gc_pause_start(const char* name, const Ticks& time = Ticks::now());
  26.105 +  void register_gc_pause_end(const Ticks& time = Ticks::now());
  26.106  };
  26.107  
  26.108  class STWGCTimer : public GCTimer {
  26.109   public:
  26.110 -  virtual void register_gc_start(jlong time);
  26.111 -  virtual void register_gc_end(jlong time);
  26.112 +  virtual void register_gc_start(const Ticks& time = Ticks::now());
  26.113 +  virtual void register_gc_end(const Ticks& time = Ticks::now());
  26.114  };
  26.115  
  26.116  class ConcurrentGCTimer : public GCTimer {
  26.117   public:
  26.118 -  void register_gc_pause_start(const char* name, jlong time);
  26.119 -  void register_gc_pause_end(jlong time);
  26.120 +  void register_gc_pause_start(const char* name);
  26.121 +  void register_gc_pause_end();
  26.122  };
  26.123  
  26.124  class TimePartitionPhasesIterator {
    27.1 --- a/src/share/vm/gc_implementation/shared/gcTrace.cpp	Thu Dec 05 19:19:09 2013 +0100
    27.2 +++ b/src/share/vm/gc_implementation/shared/gcTrace.cpp	Thu Dec 05 15:13:12 2013 -0800
    27.3 @@ -32,6 +32,7 @@
    27.4  #include "memory/referenceProcessorStats.hpp"
    27.5  #include "runtime/os.hpp"
    27.6  #include "utilities/globalDefinitions.hpp"
    27.7 +#include "utilities/ticks.inline.hpp"
    27.8  
    27.9  #if INCLUDE_ALL_GCS
   27.10  #include "gc_implementation/g1/evacuationInfo.hpp"
   27.11 @@ -45,7 +46,7 @@
   27.12    return GCTracer_next_gc_id++;
   27.13  }
   27.14  
   27.15 -void GCTracer::report_gc_start_impl(GCCause::Cause cause, jlong timestamp) {
   27.16 +void GCTracer::report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp) {
   27.17    assert_unset_gc_id();
   27.18  
   27.19    GCId gc_id = create_new_gc_id();
   27.20 @@ -54,7 +55,7 @@
   27.21    _shared_gc_info.set_start_timestamp(timestamp);
   27.22  }
   27.23  
   27.24 -void GCTracer::report_gc_start(GCCause::Cause cause, jlong timestamp) {
   27.25 +void GCTracer::report_gc_start(GCCause::Cause cause, const Ticks& timestamp) {
   27.26    assert_unset_gc_id();
   27.27  
   27.28    report_gc_start_impl(cause, timestamp);
   27.29 @@ -64,7 +65,7 @@
   27.30    return _shared_gc_info.id() != SharedGCInfo::UNSET_GCID;
   27.31  }
   27.32  
   27.33 -void GCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
   27.34 +void GCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   27.35    assert_set_gc_id();
   27.36  
   27.37    _shared_gc_info.set_sum_of_pauses(time_partitions->sum_of_pauses());
   27.38 @@ -75,7 +76,7 @@
   27.39    send_garbage_collection_event();
   27.40  }
   27.41  
   27.42 -void GCTracer::report_gc_end(jlong timestamp, TimePartitions* time_partitions) {
   27.43 +void GCTracer::report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions) {
   27.44    assert_set_gc_id();
   27.45  
   27.46    report_gc_end_impl(timestamp, time_partitions);
   27.47 @@ -97,10 +98,10 @@
   27.48    const GCId _gc_id;
   27.49    const double _size_threshold_percentage;
   27.50    const size_t _total_size_in_words;
   27.51 -  const jlong _timestamp;
   27.52 +  const Ticks _timestamp;
   27.53  
   27.54   public:
   27.55 -  ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, jlong timestamp) :
   27.56 +  ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, const Ticks& timestamp) :
   27.57      _gc_id(gc_id),
   27.58      _size_threshold_percentage(ObjectCountCutOffPercent / 100),
   27.59      _total_size_in_words(total_size_in_words),
   27.60 @@ -131,9 +132,7 @@
   27.61      if (!cit.allocation_failed()) {
   27.62        HeapInspection hi(false, false, false, NULL);
   27.63        hi.populate_table(&cit, is_alive_cl);
   27.64 -
   27.65 -      jlong timestamp = os::elapsed_counter();
   27.66 -      ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), timestamp);
   27.67 +      ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), Ticks::now());
   27.68        cit.iterate(&event_sender);
   27.69      }
   27.70    }
   27.71 @@ -147,7 +146,7 @@
   27.72    send_meta_space_summary_event(when, meta_space_summary);
   27.73  }
   27.74  
   27.75 -void YoungGCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
   27.76 +void YoungGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   27.77    assert_set_gc_id();
   27.78    assert(_tenuring_threshold != UNSET_TENURING_THRESHOLD, "Tenuring threshold has not been reported");
   27.79  
   27.80 @@ -167,14 +166,14 @@
   27.81    _tenuring_threshold = tenuring_threshold;
   27.82  }
   27.83  
   27.84 -void OldGCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
   27.85 +void OldGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   27.86    assert_set_gc_id();
   27.87  
   27.88    GCTracer::report_gc_end_impl(timestamp, time_partitions);
   27.89    send_old_gc_event();
   27.90  }
   27.91  
   27.92 -void ParallelOldTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
   27.93 +void ParallelOldTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   27.94    assert_set_gc_id();
   27.95  
   27.96    OldGCTracer::report_gc_end_impl(timestamp, time_partitions);
   27.97 @@ -200,7 +199,7 @@
   27.98    _g1_young_gc_info.set_type(type);
   27.99  }
  27.100  
  27.101 -void G1NewTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
  27.102 +void G1NewTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
  27.103    assert_set_gc_id();
  27.104  
  27.105    YoungGCTracer::report_gc_end_impl(timestamp, time_partitions);
    28.1 --- a/src/share/vm/gc_implementation/shared/gcTrace.hpp	Thu Dec 05 19:19:09 2013 +0100
    28.2 +++ b/src/share/vm/gc_implementation/shared/gcTrace.hpp	Thu Dec 05 15:13:12 2013 -0800
    28.3 @@ -35,6 +35,7 @@
    28.4  #include "gc_implementation/g1/g1YCTypes.hpp"
    28.5  #endif
    28.6  #include "utilities/macros.hpp"
    28.7 +#include "utilities/ticks.hpp"
    28.8  
    28.9  typedef uint GCId;
   28.10  
   28.11 @@ -47,8 +48,6 @@
   28.12  class BoolObjectClosure;
   28.13  
   28.14  class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
   28.15 -  static const jlong UNSET_TIMESTAMP = -1;
   28.16 -
   28.17   public:
   28.18    static const GCId UNSET_GCID = (GCId)-1;
   28.19  
   28.20 @@ -56,23 +55,30 @@
   28.21    GCId _id;
   28.22    GCName _name;
   28.23    GCCause::Cause _cause;
   28.24 -  jlong _start_timestamp;
   28.25 -  jlong _end_timestamp;
   28.26 -  jlong _sum_of_pauses;
   28.27 -  jlong _longest_pause;
   28.28 +  Ticks     _start_timestamp;
   28.29 +  Ticks     _end_timestamp;
   28.30 +  Tickspan  _sum_of_pauses;
   28.31 +  Tickspan  _longest_pause;
   28.32  
   28.33   public:
   28.34 -  SharedGCInfo(GCName name) : _id(UNSET_GCID), _name(name), _cause(GCCause::_last_gc_cause),
   28.35 -      _start_timestamp(UNSET_TIMESTAMP), _end_timestamp(UNSET_TIMESTAMP), _sum_of_pauses(0), _longest_pause(0) {}
   28.36 +  SharedGCInfo(GCName name) :
   28.37 +    _id(UNSET_GCID),
   28.38 +    _name(name),
   28.39 +    _cause(GCCause::_last_gc_cause),
   28.40 +    _start_timestamp(),
   28.41 +    _end_timestamp(),
   28.42 +    _sum_of_pauses(),
   28.43 +    _longest_pause() {
   28.44 +  }
   28.45  
   28.46    void set_id(GCId id) { _id = id; }
   28.47    GCId id() const { return _id; }
   28.48  
   28.49 -  void set_start_timestamp(jlong timestamp) { _start_timestamp = timestamp; }
   28.50 -  jlong start_timestamp() const { return _start_timestamp; }
   28.51 +  void set_start_timestamp(const Ticks& timestamp) { _start_timestamp = timestamp; }
   28.52 +  const Ticks start_timestamp() const { return _start_timestamp; }
   28.53  
   28.54 -  void set_end_timestamp(jlong timestamp) { _end_timestamp = timestamp; }
   28.55 -  jlong end_timestamp() const { return _end_timestamp; }
   28.56 +  void set_end_timestamp(const Ticks& timestamp) { _end_timestamp = timestamp; }
   28.57 +  const Ticks end_timestamp() const { return _end_timestamp; }
   28.58  
   28.59    void set_name(GCName name) { _name = name; }
   28.60    GCName name() const { return _name; }
   28.61 @@ -80,11 +86,11 @@
   28.62    void set_cause(GCCause::Cause cause) { _cause = cause; }
   28.63    GCCause::Cause cause() const { return _cause; }
   28.64  
   28.65 -  void set_sum_of_pauses(jlong duration) { _sum_of_pauses = duration; }
   28.66 -  jlong sum_of_pauses() const { return _sum_of_pauses; }
   28.67 +  void set_sum_of_pauses(const Tickspan& duration) { _sum_of_pauses = duration; }
   28.68 +  const Tickspan sum_of_pauses() const { return _sum_of_pauses; }
   28.69  
   28.70 -  void set_longest_pause(jlong duration) { _longest_pause = duration; }
   28.71 -  jlong longest_pause() const { return _longest_pause; }
   28.72 +  void set_longest_pause(const Tickspan& duration) { _longest_pause = duration; }
   28.73 +  const Tickspan longest_pause() const { return _longest_pause; }
   28.74  };
   28.75  
   28.76  class ParallelOldGCInfo VALUE_OBJ_CLASS_SPEC {
   28.77 @@ -116,8 +122,8 @@
   28.78    SharedGCInfo _shared_gc_info;
   28.79  
   28.80   public:
   28.81 -  void report_gc_start(GCCause::Cause cause, jlong timestamp);
   28.82 -  void report_gc_end(jlong timestamp, TimePartitions* time_partitions);
   28.83 +  void report_gc_start(GCCause::Cause cause, const Ticks& timestamp);
   28.84 +  void report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions);
   28.85    void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const;
   28.86    void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
   28.87    void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
   28.88 @@ -125,8 +131,8 @@
   28.89  
   28.90   protected:
   28.91    GCTracer(GCName name) : _shared_gc_info(name) {}
   28.92 -  virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp);
   28.93 -  virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
   28.94 +  virtual void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp);
   28.95 +  virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
   28.96  
   28.97   private:
   28.98    void send_garbage_collection_event() const;
   28.99 @@ -143,7 +149,7 @@
  28.100  
  28.101   protected:
  28.102    YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}
  28.103 -  virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
  28.104 +  virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
  28.105  
  28.106   public:
  28.107    void report_promotion_failed(const PromotionFailedInfo& pf_info);
  28.108 @@ -157,7 +163,7 @@
  28.109  class OldGCTracer : public GCTracer {
  28.110   protected:
  28.111    OldGCTracer(GCName name) : GCTracer(name) {}
  28.112 -  virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
  28.113 +  virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
  28.114  
  28.115   public:
  28.116    void report_concurrent_mode_failure();
  28.117 @@ -175,7 +181,7 @@
  28.118    void report_dense_prefix(void* dense_prefix);
  28.119  
  28.120   protected:
  28.121 -  void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
  28.122 +  void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
  28.123  
  28.124   private:
  28.125    void send_parallel_old_event() const;
  28.126 @@ -209,7 +215,7 @@
  28.127    G1NewTracer() : YoungGCTracer(G1New) {}
  28.128  
  28.129    void report_yc_type(G1YCType type);
  28.130 -  void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
  28.131 +  void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
  28.132    void report_evacuation_info(EvacuationInfo* info);
  28.133    void report_evacuation_failed(EvacuationFailedInfo& ef_info);
  28.134  
    29.1 --- a/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Thu Dec 05 19:19:09 2013 +0100
    29.2 +++ b/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Thu Dec 05 15:13:12 2013 -0800
    29.3 @@ -55,12 +55,11 @@
    29.4  }
    29.5  
    29.6  void GCTracer::send_reference_stats_event(ReferenceType type, size_t count) const {
    29.7 -  EventGCReferenceStatistics e(UNTIMED);
    29.8 +  EventGCReferenceStatistics e;
    29.9    if (e.should_commit()) {
   29.10        e.set_gcId(_shared_gc_info.id());
   29.11        e.set_type((u1)type);
   29.12        e.set_count(count);
   29.13 -      e.set_endtime(os::elapsed_counter());
   29.14        e.commit();
   29.15    }
   29.16  }
   29.17 @@ -107,22 +106,20 @@
   29.18  }
   29.19  
   29.20  void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const {
   29.21 -  EventPromotionFailed e(UNTIMED);
   29.22 +  EventPromotionFailed e;
   29.23    if (e.should_commit()) {
   29.24      e.set_gcId(_shared_gc_info.id());
   29.25      e.set_data(to_trace_struct(pf_info));
   29.26      e.set_thread(pf_info.thread()->thread_id());
   29.27 -    e.set_endtime(os::elapsed_counter());
   29.28      e.commit();
   29.29    }
   29.30  }
   29.31  
   29.32  // Common to CMS and G1
   29.33  void OldGCTracer::send_concurrent_mode_failure_event() {
   29.34 -  EventConcurrentModeFailure e(UNTIMED);
   29.35 +  EventConcurrentModeFailure e;
   29.36    if (e.should_commit()) {
   29.37      e.set_gcId(_shared_gc_info.id());
   29.38 -    e.set_endtime(os::elapsed_counter());
   29.39      e.commit();
   29.40    }
   29.41  }
   29.42 @@ -140,7 +137,7 @@
   29.43  }
   29.44  
   29.45  void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) {
   29.46 -  EventEvacuationInfo e(UNTIMED);
   29.47 +  EventEvacuationInfo e;
   29.48    if (e.should_commit()) {
   29.49      e.set_gcId(_shared_gc_info.id());
   29.50      e.set_cSetRegions(info->collectionset_regions());
   29.51 @@ -151,17 +148,15 @@
   29.52      e.set_allocRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied());
   29.53      e.set_bytesCopied(info->bytes_copied());
   29.54      e.set_regionsFreed(info->regions_freed());
   29.55 -    e.set_endtime(os::elapsed_counter());
   29.56      e.commit();
   29.57    }
   29.58  }
   29.59  
   29.60  void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const {
   29.61 -  EventEvacuationFailed e(UNTIMED);
   29.62 +  EventEvacuationFailed e;
   29.63    if (e.should_commit()) {
   29.64      e.set_gcId(_shared_gc_info.id());
   29.65      e.set_data(to_trace_struct(ef_info));
   29.66 -    e.set_endtime(os::elapsed_counter());
   29.67      e.commit();
   29.68    }
   29.69  }
   29.70 @@ -195,13 +190,12 @@
   29.71    void visit(const GCHeapSummary* heap_summary) const {
   29.72      const VirtualSpaceSummary& heap_space = heap_summary->heap();
   29.73  
   29.74 -    EventGCHeapSummary e(UNTIMED);
   29.75 +    EventGCHeapSummary e;
   29.76      if (e.should_commit()) {
   29.77        e.set_gcId(_id);
   29.78        e.set_when((u1)_when);
   29.79        e.set_heapSpace(to_trace_struct(heap_space));
   29.80        e.set_heapUsed(heap_summary->used());
   29.81 -      e.set_endtime(os::elapsed_counter());
   29.82        e.commit();
   29.83      }
   29.84    }
   29.85 @@ -216,7 +210,7 @@
   29.86      const SpaceSummary& from_space = ps_heap_summary->from();
   29.87      const SpaceSummary& to_space = ps_heap_summary->to();
   29.88  
   29.89 -    EventPSHeapSummary e(UNTIMED);
   29.90 +    EventPSHeapSummary e;
   29.91      if (e.should_commit()) {
   29.92        e.set_gcId(_id);
   29.93        e.set_when((u1)_when);
   29.94 @@ -227,7 +221,6 @@
   29.95        e.set_edenSpace(to_trace_struct(ps_heap_summary->eden()));
   29.96        e.set_fromSpace(to_trace_struct(ps_heap_summary->from()));
   29.97        e.set_toSpace(to_trace_struct(ps_heap_summary->to()));
   29.98 -      e.set_endtime(os::elapsed_counter());
   29.99        e.commit();
  29.100      }
  29.101    }
  29.102 @@ -249,14 +242,13 @@
  29.103  }
  29.104  
  29.105  void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const {
  29.106 -  EventMetaspaceSummary e(UNTIMED);
  29.107 +  EventMetaspaceSummary e;
  29.108    if (e.should_commit()) {
  29.109      e.set_gcId(_shared_gc_info.id());
  29.110      e.set_when((u1) when);
  29.111      e.set_metaspace(to_trace_struct(meta_space_summary.meta_space()));
  29.112      e.set_dataSpace(to_trace_struct(meta_space_summary.data_space()));
  29.113      e.set_classSpace(to_trace_struct(meta_space_summary.class_space()));
  29.114 -    e.set_endtime(os::elapsed_counter());
  29.115      e.commit();
  29.116    }
  29.117  }
    30.1 --- a/src/share/vm/gc_implementation/shared/gcTraceTime.cpp	Thu Dec 05 19:19:09 2013 +0100
    30.2 +++ b/src/share/vm/gc_implementation/shared/gcTraceTime.cpp	Thu Dec 05 15:13:12 2013 -0800
    30.3 @@ -31,12 +31,13 @@
    30.4  #include "runtime/thread.inline.hpp"
    30.5  #include "runtime/timer.hpp"
    30.6  #include "utilities/ostream.hpp"
    30.7 +#include "utilities/ticks.inline.hpp"
    30.8  
    30.9  
   30.10  GCTraceTime::GCTraceTime(const char* title, bool doit, bool print_cr, GCTimer* timer) :
   30.11 -    _title(title), _doit(doit), _print_cr(print_cr), _timer(timer) {
   30.12 +    _title(title), _doit(doit), _print_cr(print_cr), _timer(timer), _start_counter() {
   30.13    if (_doit || _timer != NULL) {
   30.14 -    _start_counter = os::elapsed_counter();
   30.15 +    _start_counter.stamp();
   30.16    }
   30.17  
   30.18    if (_timer != NULL) {
   30.19 @@ -57,10 +58,10 @@
   30.20  }
   30.21  
   30.22  GCTraceTime::~GCTraceTime() {
   30.23 -  jlong stop_counter = 0;
   30.24 +  Ticks stop_counter;
   30.25  
   30.26    if (_doit || _timer != NULL) {
   30.27 -    stop_counter = os::elapsed_counter();
   30.28 +    stop_counter.stamp();
   30.29    }
   30.30  
   30.31    if (_timer != NULL) {
   30.32 @@ -68,11 +69,12 @@
   30.33    }
   30.34  
   30.35    if (_doit) {
   30.36 -    double seconds = TimeHelper::counter_to_seconds(stop_counter - _start_counter);
   30.37 +    const Tickspan duration = stop_counter - _start_counter;
   30.38 +    double duration_in_seconds = TicksToTimeHelper::seconds(duration);
   30.39      if (_print_cr) {
   30.40 -      gclog_or_tty->print_cr(", %3.7f secs]", seconds);
   30.41 +      gclog_or_tty->print_cr(", %3.7f secs]", duration_in_seconds);
   30.42      } else {
   30.43 -      gclog_or_tty->print(", %3.7f secs]", seconds);
   30.44 +      gclog_or_tty->print(", %3.7f secs]", duration_in_seconds);
   30.45      }
   30.46      gclog_or_tty->flush();
   30.47    }
    31.1 --- a/src/share/vm/gc_implementation/shared/gcTraceTime.hpp	Thu Dec 05 19:19:09 2013 +0100
    31.2 +++ b/src/share/vm/gc_implementation/shared/gcTraceTime.hpp	Thu Dec 05 15:13:12 2013 -0800
    31.3 @@ -26,6 +26,7 @@
    31.4  #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACETIME_HPP
    31.5  
    31.6  #include "prims/jni_md.h"
    31.7 +#include "utilities/ticks.hpp"
    31.8  
    31.9  class GCTimer;
   31.10  
   31.11 @@ -34,7 +35,7 @@
   31.12    bool _doit;
   31.13    bool _print_cr;
   31.14    GCTimer* _timer;
   31.15 -  jlong _start_counter;
   31.16 +  Ticks _start_counter;
   31.17  
   31.18   public:
   31.19    GCTraceTime(const char* title, bool doit, bool print_cr, GCTimer* timer);
    32.1 --- a/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp	Thu Dec 05 19:19:09 2013 +0100
    32.2 +++ b/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp	Thu Dec 05 15:13:12 2013 -0800
    32.3 @@ -28,10 +28,11 @@
    32.4  #include "memory/heapInspection.hpp"
    32.5  #include "trace/tracing.hpp"
    32.6  #include "utilities/globalDefinitions.hpp"
    32.7 +#include "utilities/ticks.hpp"
    32.8  
    32.9  #if INCLUDE_SERVICES
   32.10  
   32.11 -void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp) {
   32.12 +void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, const Ticks& timestamp) {
   32.13  #if INCLUDE_TRACE
   32.14    assert(Tracing::is_event_enabled(EventObjectCountAfterGC::eventId),
   32.15           "Only call this method if the event is enabled");
    33.1 --- a/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp	Thu Dec 05 19:19:09 2013 +0100
    33.2 +++ b/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp	Thu Dec 05 15:13:12 2013 -0800
    33.3 @@ -32,10 +32,11 @@
    33.4  #if INCLUDE_SERVICES
    33.5  
    33.6  class KlassInfoEntry;
    33.7 +class Ticks;
    33.8  
    33.9  class ObjectCountEventSender : public AllStatic {
   33.10   public:
   33.11 -  static void send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp);
   33.12 +  static void send(const KlassInfoEntry* entry, GCId gc_id, const Ticks& timestamp);
   33.13    static bool should_send_event();
   33.14  };
   33.15  
    34.1 --- a/src/share/vm/interpreter/linkResolver.cpp	Thu Dec 05 19:19:09 2013 +0100
    34.2 +++ b/src/share/vm/interpreter/linkResolver.cpp	Thu Dec 05 15:13:12 2013 -0800
    34.3 @@ -915,6 +915,25 @@
    34.4      return;
    34.5    }
    34.6  
    34.7 +  // check if invokespecial's interface method reference is in an indirect superinterface
    34.8 +  if (!current_klass.is_null() && resolved_klass->is_interface()) {
    34.9 +    Klass *klass_to_check = !InstanceKlass::cast(current_klass())->is_anonymous() ?
   34.10 +                                  current_klass() :
   34.11 +                                  InstanceKlass::cast(current_klass())->host_klass();
   34.12 +
   34.13 +    if (!InstanceKlass::cast(klass_to_check)->is_same_or_direct_interface(resolved_klass())) {
   34.14 +      ResourceMark rm(THREAD);
   34.15 +      char buf[200];
   34.16 +      jio_snprintf(buf, sizeof(buf),
   34.17 +                   "Interface method reference: %s, is in an indirect superinterface of %s",
   34.18 +                   Method::name_and_sig_as_C_string(resolved_klass(),
   34.19 +                                                         resolved_method->name(),
   34.20 +                                                         resolved_method->signature()),
   34.21 +                   current_klass->external_name());
   34.22 +      THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   34.23 +    }
   34.24 +  }
   34.25 +
   34.26    // check if not static
   34.27    if (resolved_method->is_static()) {
   34.28      ResourceMark rm(THREAD);
    35.1 --- a/src/share/vm/interpreter/rewriter.cpp	Thu Dec 05 19:19:09 2013 +0100
    35.2 +++ b/src/share/vm/interpreter/rewriter.cpp	Thu Dec 05 15:13:12 2013 -0800
    35.3 @@ -70,12 +70,14 @@
    35.4  }
    35.5  
    35.6  // Unrewrite the bytecodes if an error occurs.
    35.7 -void Rewriter::restore_bytecodes(TRAPS) {
    35.8 +void Rewriter::restore_bytecodes() {
    35.9    int len = _methods->length();
   35.10 +  bool invokespecial_error = false;
   35.11  
   35.12    for (int i = len-1; i >= 0; i--) {
   35.13      Method* method = _methods->at(i);
   35.14 -    scan_method(method, true, CHECK);
   35.15 +    scan_method(method, true, &invokespecial_error);
   35.16 +    assert(!invokespecial_error, "reversing should not get an invokespecial error");
   35.17    }
   35.18  }
   35.19  
   35.20 @@ -160,22 +162,21 @@
   35.21  // These cannot share cpCache entries.  It's unclear if all invokespecial to
   35.22  // InterfaceMethodrefs would resolve to the same thing so a new cpCache entry
   35.23  // is created for each one.  This was added with lambda.
   35.24 -void Rewriter::rewrite_invokespecial(address bcp, int offset, bool reverse, TRAPS) {
   35.25 -  static int count = 0;
   35.26 +void Rewriter::rewrite_invokespecial(address bcp, int offset, bool reverse, bool* invokespecial_error) {
   35.27    address p = bcp + offset;
   35.28    if (!reverse) {
   35.29      int cp_index = Bytes::get_Java_u2(p);
   35.30 +    if (_pool->tag_at(cp_index).is_interface_method()) {
   35.31      int cache_index = add_invokespecial_cp_cache_entry(cp_index);
   35.32      if (cache_index != (int)(jushort) cache_index) {
   35.33 -      THROW_MSG(vmSymbols::java_lang_InternalError(),
   35.34 -                "This classfile overflows invokespecial for interfaces "
   35.35 -                "and cannot be loaded");
   35.36 +      *invokespecial_error = true;
   35.37      }
   35.38      Bytes::put_native_u2(p, cache_index);
   35.39    } else {
   35.40 -    int cache_index = Bytes::get_native_u2(p);
   35.41 -    int cp_index = cp_cache_entry_pool_index(cache_index);
   35.42 -    Bytes::put_Java_u2(p, cp_index);
   35.43 +      rewrite_member_reference(bcp, offset, reverse);
   35.44 +    }
   35.45 +  } else {
   35.46 +    rewrite_member_reference(bcp, offset, reverse);
   35.47    }
   35.48  }
   35.49  
   35.50 @@ -329,7 +330,7 @@
   35.51  
   35.52  
   35.53  // Rewrites a method given the index_map information
   35.54 -void Rewriter::scan_method(Method* method, bool reverse, TRAPS) {
   35.55 +void Rewriter::scan_method(Method* method, bool reverse, bool* invokespecial_error) {
   35.56  
   35.57    int nof_jsrs = 0;
   35.58    bool has_monitor_bytecodes = false;
   35.59 @@ -391,15 +392,7 @@
   35.60          }
   35.61  
   35.62          case Bytecodes::_invokespecial  : {
   35.63 -          int offset = prefix_length + 1;
   35.64 -          address p = bcp + offset;
   35.65 -          int cp_index = Bytes::get_Java_u2(p);
   35.66 -          // InterfaceMethodref
   35.67 -          if (_pool->tag_at(cp_index).is_interface_method()) {
   35.68 -            rewrite_invokespecial(bcp, offset, reverse, CHECK);
   35.69 -          } else {
   35.70 -            rewrite_member_reference(bcp, offset, reverse);
   35.71 -          }
   35.72 +          rewrite_invokespecial(bcp, prefix_length+1, reverse, invokespecial_error);
   35.73            break;
   35.74          }
   35.75  
   35.76 @@ -496,11 +489,20 @@
   35.77  
   35.78    // rewrite methods, in two passes
   35.79    int len = _methods->length();
   35.80 +  bool invokespecial_error = false;
   35.81  
   35.82    for (int i = len-1; i >= 0; i--) {
   35.83      Method* method = _methods->at(i);
   35.84 -    scan_method(method, false, CHECK);  // If you get an error here,
   35.85 -                                        // there is no reversing bytecodes
   35.86 +    scan_method(method, false, &invokespecial_error);
   35.87 +    if (invokespecial_error) {
   35.88 +      // If you get an error here, there is no reversing bytecodes
   35.89 +      // This exception is stored for this class and no further attempt is
   35.90 +      // made at verifying or rewriting.
   35.91 +      THROW_MSG(vmSymbols::java_lang_InternalError(),
   35.92 +                "This classfile overflows invokespecial for interfaces "
   35.93 +                "and cannot be loaded");
   35.94 +      return;
   35.95 +     }
   35.96    }
   35.97  
   35.98    // May have to fix invokedynamic bytecodes if invokestatic/InterfaceMethodref
   35.99 @@ -513,7 +515,7 @@
  35.100    // Restore bytecodes to their unrewritten state if there are exceptions
  35.101    // rewriting bytecodes or allocating the cpCache
  35.102    if (HAS_PENDING_EXCEPTION) {
  35.103 -    restore_bytecodes(CATCH);
  35.104 +    restore_bytecodes();
  35.105      return;
  35.106    }
  35.107  
  35.108 @@ -530,7 +532,7 @@
  35.109        // relocating bytecodes.  If some are relocated, that is ok because that
  35.110        // doesn't affect constant pool to cpCache rewriting.
  35.111        if (HAS_PENDING_EXCEPTION) {
  35.112 -        restore_bytecodes(CATCH);
  35.113 +        restore_bytecodes();
  35.114          return;
  35.115        }
  35.116        // Method might have gotten rewritten.
    36.1 --- a/src/share/vm/interpreter/rewriter.hpp	Thu Dec 05 19:19:09 2013 +0100
    36.2 +++ b/src/share/vm/interpreter/rewriter.hpp	Thu Dec 05 15:13:12 2013 -0800
    36.3 @@ -189,18 +189,18 @@
    36.4  
    36.5    void compute_index_maps();
    36.6    void make_constant_pool_cache(TRAPS);
    36.7 -  void scan_method(Method* m, bool reverse, TRAPS);
    36.8 +  void scan_method(Method* m, bool reverse, bool* invokespecial_error);
    36.9    void rewrite_Object_init(methodHandle m, TRAPS);
   36.10    void rewrite_member_reference(address bcp, int offset, bool reverse);
   36.11    void maybe_rewrite_invokehandle(address opc, int cp_index, int cache_index, bool reverse);
   36.12    void rewrite_invokedynamic(address bcp, int offset, bool reverse);
   36.13    void maybe_rewrite_ldc(address bcp, int offset, bool is_wide, bool reverse);
   36.14 -  void rewrite_invokespecial(address bcp, int offset, bool reverse, TRAPS);
   36.15 +  void rewrite_invokespecial(address bcp, int offset, bool reverse, bool* invokespecial_error);
   36.16  
   36.17    void patch_invokedynamic_bytecodes();
   36.18  
   36.19    // Revert bytecodes in case of an exception.
   36.20 -  void restore_bytecodes(TRAPS);
   36.21 +  void restore_bytecodes();
   36.22  
   36.23    static methodHandle rewrite_jsrs(methodHandle m, TRAPS);
   36.24   public:
    37.1 --- a/src/share/vm/memory/defNewGeneration.cpp	Thu Dec 05 19:19:09 2013 +0100
    37.2 +++ b/src/share/vm/memory/defNewGeneration.cpp	Thu Dec 05 15:13:12 2013 -0800
    37.3 @@ -562,7 +562,7 @@
    37.4  
    37.5    GenCollectedHeap* gch = GenCollectedHeap::heap();
    37.6  
    37.7 -  _gc_timer->register_gc_start(os::elapsed_counter());
    37.8 +  _gc_timer->register_gc_start();
    37.9    DefNewTracer gc_tracer;
   37.10    gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start());
   37.11  
   37.12 @@ -709,7 +709,7 @@
   37.13    gch->trace_heap_after_gc(&gc_tracer);
   37.14    gc_tracer.report_tenuring_threshold(tenuring_threshold());
   37.15  
   37.16 -  _gc_timer->register_gc_end(os::elapsed_counter());
   37.17 +  _gc_timer->register_gc_end();
   37.18  
   37.19    gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
   37.20  }
    38.1 --- a/src/share/vm/memory/generation.cpp	Thu Dec 05 19:19:09 2013 +0100
    38.2 +++ b/src/share/vm/memory/generation.cpp	Thu Dec 05 15:13:12 2013 -0800
    38.3 @@ -635,16 +635,16 @@
    38.4      x(ref_processor(), gch->reserved_region());
    38.5  
    38.6    STWGCTimer* gc_timer = GenMarkSweep::gc_timer();
    38.7 -  gc_timer->register_gc_start(os::elapsed_counter());
    38.8 +  gc_timer->register_gc_start();
    38.9  
   38.10    SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
   38.11    gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
   38.12  
   38.13    GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_soft_refs);
   38.14  
   38.15 -  gc_timer->register_gc_end(os::elapsed_counter());
   38.16 +  gc_timer->register_gc_end();
   38.17  
   38.18 -  gc_tracer->report_gc_end(os::elapsed_counter(), gc_timer->time_partitions());
   38.19 +  gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
   38.20  
   38.21    SpecializationStats::print();
   38.22  }
    39.1 --- a/src/share/vm/memory/universe.cpp	Thu Dec 05 19:19:09 2013 +0100
    39.2 +++ b/src/share/vm/memory/universe.cpp	Thu Dec 05 15:13:12 2013 -0800
    39.3 @@ -120,6 +120,7 @@
    39.4  oop Universe::_arithmetic_exception_instance          = NULL;
    39.5  oop Universe::_virtual_machine_error_instance         = NULL;
    39.6  oop Universe::_vm_exception                           = NULL;
    39.7 +Method* Universe::_throw_illegal_access_error         = NULL;
    39.8  Array<int>* Universe::_the_empty_int_array            = NULL;
    39.9  Array<u2>* Universe::_the_empty_short_array           = NULL;
   39.10  Array<Klass*>* Universe::_the_empty_klass_array     = NULL;
   39.11 @@ -1101,6 +1102,18 @@
   39.12    Universe::_finalizer_register_cache->init(
   39.13      SystemDictionary::Finalizer_klass(), m);
   39.14  
   39.15 +  InstanceKlass::cast(SystemDictionary::misc_Unsafe_klass())->link_class(CHECK_false);
   39.16 +  m = InstanceKlass::cast(SystemDictionary::misc_Unsafe_klass())->find_method(
   39.17 +                                  vmSymbols::throwIllegalAccessError_name(),
   39.18 +                                  vmSymbols::void_method_signature());
   39.19 +  if (m != NULL && !m->is_static()) {
   39.20 +    // Note null is okay; this method is used in itables, and if it is null,
   39.21 +    // then AbstractMethodError is thrown instead.
   39.22 +    tty->print_cr("Unable to link/verify Unsafe.throwIllegalAccessError method");
   39.23 +    return false; // initialization failed (cannot throw exception yet)
   39.24 +  }
   39.25 +  Universe::_throw_illegal_access_error = m;
   39.26 +
   39.27    // Setup method for registering loaded classes in class loader vector
   39.28    InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->link_class(CHECK_false);
   39.29    m = InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->find_method(vmSymbols::addClass_name(), vmSymbols::class_void_signature());
    40.1 --- a/src/share/vm/memory/universe.hpp	Thu Dec 05 19:19:09 2013 +0100
    40.2 +++ b/src/share/vm/memory/universe.hpp	Thu Dec 05 15:13:12 2013 -0800
    40.3 @@ -149,6 +149,8 @@
    40.4    static LatestMethodCache* _loader_addClass_cache;    // method for registering loaded classes in class loader vector
    40.5    static LatestMethodCache* _pd_implies_cache;         // method for checking protection domain attributes
    40.6  
    40.7 +  static Method* _throw_illegal_access_error;
    40.8 +
    40.9    // preallocated error objects (no backtrace)
   40.10    static oop          _out_of_memory_error_java_heap;
   40.11    static oop          _out_of_memory_error_metaspace;
   40.12 @@ -305,6 +307,7 @@
   40.13    static oop          arithmetic_exception_instance() { return _arithmetic_exception_instance; }
   40.14    static oop          virtual_machine_error_instance() { return _virtual_machine_error_instance; }
   40.15    static oop          vm_exception()                  { return _vm_exception; }
   40.16 +  static Method*      throw_illegal_access_error()    { return _throw_illegal_access_error; }
   40.17  
   40.18    static Array<int>*       the_empty_int_array()    { return _the_empty_int_array; }
   40.19    static Array<u2>*        the_empty_short_array()  { return _the_empty_short_array; }
    41.1 --- a/src/share/vm/oops/instanceKlass.cpp	Thu Dec 05 19:19:09 2013 +0100
    41.2 +++ b/src/share/vm/oops/instanceKlass.cpp	Thu Dec 05 15:13:12 2013 -0800
    41.3 @@ -1051,6 +1051,18 @@
    41.4    return false;
    41.5  }
    41.6  
    41.7 +bool InstanceKlass::is_same_or_direct_interface(Klass *k) const {
    41.8 +  // Verify direct super interface
    41.9 +  if (this == k) return true;
   41.10 +  assert(k->is_interface(), "should be an interface class");
   41.11 +  for (int i = 0; i < local_interfaces()->length(); i++) {
   41.12 +    if (local_interfaces()->at(i) == k) {
   41.13 +      return true;
   41.14 +    }
   41.15 +  }
   41.16 +  return false;
   41.17 +}
   41.18 +
   41.19  objArrayOop InstanceKlass::allocate_objArray(int n, int length, TRAPS) {
   41.20    if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
   41.21    if (length > arrayOopDesc::max_array_length(T_OBJECT)) {
    42.1 --- a/src/share/vm/oops/instanceKlass.hpp	Thu Dec 05 19:19:09 2013 +0100
    42.2 +++ b/src/share/vm/oops/instanceKlass.hpp	Thu Dec 05 15:13:12 2013 -0800
    42.3 @@ -777,6 +777,7 @@
    42.4  
    42.5    // subclass/subinterface checks
    42.6    bool implements_interface(Klass* k) const;
    42.7 +  bool is_same_or_direct_interface(Klass* k) const;
    42.8  
    42.9    // Access to the implementor of an interface.
   42.10    Klass* implementor() const
    43.1 --- a/src/share/vm/oops/klassVtable.cpp	Thu Dec 05 19:19:09 2013 +0100
    43.2 +++ b/src/share/vm/oops/klassVtable.cpp	Thu Dec 05 15:13:12 2013 -0800
    43.3 @@ -1076,7 +1076,12 @@
    43.4        LinkResolver::lookup_instance_method_in_klasses(target, _klass, m->name(), m->signature(), CHECK);
    43.5      }
    43.6      if (target == NULL || !target->is_public() || target->is_abstract()) {
    43.7 -      // Entry do not resolve. Leave it empty
    43.8 +      // Entry does not resolve. Leave it empty for AbstractMethodError.
    43.9 +        if (!(target == NULL) && !target->is_public()) {
   43.10 +          // Stuff an IllegalAccessError throwing method in there instead.
   43.11 +          itableOffsetEntry::method_entry(_klass(), method_table_offset)[m->itable_index()].
   43.12 +              initialize(Universe::throw_illegal_access_error());
   43.13 +        }
   43.14      } else {
   43.15        // Entry did resolve, check loader constraints before initializing
   43.16        // if checkconstraints requested
    44.1 --- a/src/share/vm/opto/compile.hpp	Thu Dec 05 19:19:09 2013 +0100
    44.2 +++ b/src/share/vm/opto/compile.hpp	Thu Dec 05 15:13:12 2013 -0800
    44.3 @@ -42,6 +42,7 @@
    44.4  #include "runtime/deoptimization.hpp"
    44.5  #include "runtime/vmThread.hpp"
    44.6  #include "trace/tracing.hpp"
    44.7 +#include "utilities/ticks.hpp"
    44.8  
    44.9  class Block;
   44.10  class Bundle;
   44.11 @@ -598,20 +599,19 @@
   44.12    bool              has_method_handle_invokes() const { return _has_method_handle_invokes;     }
   44.13    void          set_has_method_handle_invokes(bool z) {        _has_method_handle_invokes = z; }
   44.14  
   44.15 -  jlong _latest_stage_start_counter;
   44.16 +  Ticks _latest_stage_start_counter;
   44.17  
   44.18    void begin_method() {
   44.19  #ifndef PRODUCT
   44.20      if (_printer) _printer->begin_method(this);
   44.21  #endif
   44.22 -    C->_latest_stage_start_counter = os::elapsed_counter();
   44.23 +    C->_latest_stage_start_counter.stamp();
   44.24    }
   44.25  
   44.26    void print_method(CompilerPhaseType cpt, int level = 1) {
   44.27 -    EventCompilerPhase event(UNTIMED);
   44.28 +    EventCompilerPhase event;
   44.29      if (event.should_commit()) {
   44.30        event.set_starttime(C->_latest_stage_start_counter);
   44.31 -      event.set_endtime(os::elapsed_counter());
   44.32        event.set_phase((u1) cpt);
   44.33        event.set_compileID(C->_compile_id);
   44.34        event.set_phaseLevel(level);
   44.35 @@ -622,14 +622,13 @@
   44.36  #ifndef PRODUCT
   44.37      if (_printer) _printer->print_method(this, CompilerPhaseTypeHelper::to_string(cpt), level);
   44.38  #endif
   44.39 -    C->_latest_stage_start_counter = os::elapsed_counter();
   44.40 +    C->_latest_stage_start_counter.stamp();
   44.41    }
   44.42  
   44.43    void end_method(int level = 1) {
   44.44 -    EventCompilerPhase event(UNTIMED);
   44.45 +    EventCompilerPhase event;
   44.46      if (event.should_commit()) {
   44.47        event.set_starttime(C->_latest_stage_start_counter);
   44.48 -      event.set_endtime(os::elapsed_counter());
   44.49        event.set_phase((u1) PHASE_END);
   44.50        event.set_compileID(C->_compile_id);
   44.51        event.set_phaseLevel(level);
    45.1 --- a/src/share/vm/runtime/globals.cpp	Thu Dec 05 19:19:09 2013 +0100
    45.2 +++ b/src/share/vm/runtime/globals.cpp	Thu Dec 05 15:13:12 2013 -0800
    45.3 @@ -321,6 +321,8 @@
    45.4        { KIND_PRODUCT, "product" },
    45.5        { KIND_MANAGEABLE, "manageable" },
    45.6        { KIND_DIAGNOSTIC, "diagnostic" },
    45.7 +      { KIND_EXPERIMENTAL, "experimental" },
    45.8 +      { KIND_COMMERCIAL, "commercial" },
    45.9        { KIND_NOT_PRODUCT, "notproduct" },
   45.10        { KIND_DEVELOP, "develop" },
   45.11        { KIND_LP64_PRODUCT, "lp64_product" },
    46.1 --- a/src/share/vm/runtime/globals.hpp	Thu Dec 05 19:19:09 2013 +0100
    46.2 +++ b/src/share/vm/runtime/globals.hpp	Thu Dec 05 15:13:12 2013 -0800
    46.3 @@ -3648,9 +3648,6 @@
    46.4            "Temporary flag for transition to AbstractMethodError wrapped "   \
    46.5            "in InvocationTargetException. See 6531596")                      \
    46.6                                                                              \
    46.7 -  develop(bool, VerifyLambdaBytecodes, false,                               \
    46.8 -          "Force verification of jdk 8 lambda metafactory bytecodes")       \
    46.9 -                                                                            \
   46.10    develop(intx, FastSuperclassLimit, 8,                                     \
   46.11            "Depth of hardwired instanceof accelerator array")                \
   46.12                                                                              \
    47.1 --- a/src/share/vm/runtime/reflection.cpp	Thu Dec 05 19:19:09 2013 +0100
    47.2 +++ b/src/share/vm/runtime/reflection.cpp	Thu Dec 05 15:13:12 2013 -0800
    47.3 @@ -470,12 +470,6 @@
    47.4      return true;
    47.5    }
    47.6  
    47.7 -  // Also allow all accesses from
    47.8 -  // java/lang/invoke/MagicLambdaImpl subclasses to succeed trivially.
    47.9 -  if (current_class->is_subclass_of(SystemDictionary::lambda_MagicLambdaImpl_klass())) {
   47.10 -    return true;
   47.11 -  }
   47.12 -
   47.13    return can_relax_access_check_for(current_class, new_class, classloader_only);
   47.14  }
   47.15  
   47.16 @@ -570,12 +564,6 @@
   47.17      return true;
   47.18    }
   47.19  
   47.20 -  // Also allow all accesses from
   47.21 -  // java/lang/invoke/MagicLambdaImpl subclasses to succeed trivially.
   47.22 -  if (current_class->is_subclass_of(SystemDictionary::lambda_MagicLambdaImpl_klass())) {
   47.23 -    return true;
   47.24 -  }
   47.25 -
   47.26    return can_relax_access_check_for(
   47.27      current_class, field_class, classloader_only);
   47.28  }
    48.1 --- a/src/share/vm/runtime/sharedRuntime.cpp	Thu Dec 05 19:19:09 2013 +0100
    48.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp	Thu Dec 05 15:13:12 2013 -0800
    48.3 @@ -84,6 +84,7 @@
    48.4  
    48.5  // Shared stub locations
    48.6  RuntimeStub*        SharedRuntime::_wrong_method_blob;
    48.7 +RuntimeStub*        SharedRuntime::_wrong_method_abstract_blob;
    48.8  RuntimeStub*        SharedRuntime::_ic_miss_blob;
    48.9  RuntimeStub*        SharedRuntime::_resolve_opt_virtual_call_blob;
   48.10  RuntimeStub*        SharedRuntime::_resolve_virtual_call_blob;
   48.11 @@ -101,11 +102,12 @@
   48.12  
   48.13  //----------------------------generate_stubs-----------------------------------
   48.14  void SharedRuntime::generate_stubs() {
   48.15 -  _wrong_method_blob                   = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method),         "wrong_method_stub");
   48.16 -  _ic_miss_blob                        = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_ic_miss), "ic_miss_stub");
   48.17 -  _resolve_opt_virtual_call_blob       = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_opt_virtual_call_C),  "resolve_opt_virtual_call");
   48.18 -  _resolve_virtual_call_blob           = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_virtual_call_C),      "resolve_virtual_call");
   48.19 -  _resolve_static_call_blob            = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_static_call_C),       "resolve_static_call");
   48.20 +  _wrong_method_blob                   = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method),          "wrong_method_stub");
   48.21 +  _wrong_method_abstract_blob          = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_abstract), "wrong_method_abstract_stub");
   48.22 +  _ic_miss_blob                        = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::handle_wrong_method_ic_miss),  "ic_miss_stub");
   48.23 +  _resolve_opt_virtual_call_blob       = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_opt_virtual_call_C),   "resolve_opt_virtual_call");
   48.24 +  _resolve_virtual_call_blob           = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_virtual_call_C),       "resolve_virtual_call");
   48.25 +  _resolve_static_call_blob            = generate_resolve_blob(CAST_FROM_FN_PTR(address, SharedRuntime::resolve_static_call_C),        "resolve_static_call");
   48.26  
   48.27  #ifdef COMPILER2
   48.28    // Vectors are generated only by C2.
   48.29 @@ -1345,6 +1347,11 @@
   48.30    return callee_method->verified_code_entry();
   48.31  JRT_END
   48.32  
   48.33 +// Handle abstract method call
   48.34 +JRT_BLOCK_ENTRY(address, SharedRuntime::handle_wrong_method_abstract(JavaThread* thread))
   48.35 +  return StubRoutines::throw_AbstractMethodError_entry();
   48.36 +JRT_END
   48.37 +
   48.38  
   48.39  // resolve a static call and patch code
   48.40  JRT_BLOCK_ENTRY(address, SharedRuntime::resolve_static_call_C(JavaThread *thread ))
   48.41 @@ -2341,12 +2348,13 @@
   48.42  
   48.43    // Create a special handler for abstract methods.  Abstract methods
   48.44    // are never compiled so an i2c entry is somewhat meaningless, but
   48.45 -  // fill it in with something appropriate just in case.  Pass handle
   48.46 -  // wrong method for the c2i transitions.
   48.47 -  address wrong_method = SharedRuntime::get_handle_wrong_method_stub();
   48.48 +  // throw AbstractMethodError just in case.
   48.49 +  // Pass wrong_method_abstract for the c2i transitions to return
   48.50 +  // AbstractMethodError for invalid invocations.
   48.51 +  address wrong_method_abstract = SharedRuntime::get_handle_wrong_method_abstract_stub();
   48.52    _abstract_method_handler = AdapterHandlerLibrary::new_entry(new AdapterFingerPrint(0, NULL),
   48.53                                                                StubRoutines::throw_AbstractMethodError_entry(),
   48.54 -                                                              wrong_method, wrong_method);
   48.55 +                                                              wrong_method_abstract, wrong_method_abstract);
   48.56  }
   48.57  
   48.58  AdapterHandlerEntry* AdapterHandlerLibrary::new_entry(AdapterFingerPrint* fingerprint,
    49.1 --- a/src/share/vm/runtime/sharedRuntime.hpp	Thu Dec 05 19:19:09 2013 +0100
    49.2 +++ b/src/share/vm/runtime/sharedRuntime.hpp	Thu Dec 05 15:13:12 2013 -0800
    49.3 @@ -56,6 +56,7 @@
    49.4    // Shared stub locations
    49.5  
    49.6    static RuntimeStub*        _wrong_method_blob;
    49.7 +  static RuntimeStub*        _wrong_method_abstract_blob;
    49.8    static RuntimeStub*        _ic_miss_blob;
    49.9    static RuntimeStub*        _resolve_opt_virtual_call_blob;
   49.10    static RuntimeStub*        _resolve_virtual_call_blob;
   49.11 @@ -206,6 +207,11 @@
   49.12      return _wrong_method_blob->entry_point();
   49.13    }
   49.14  
   49.15 +  static address get_handle_wrong_method_abstract_stub() {
   49.16 +    assert(_wrong_method_abstract_blob!= NULL, "oops");
   49.17 +    return _wrong_method_abstract_blob->entry_point();
   49.18 +  }
   49.19 +
   49.20  #ifdef COMPILER2
   49.21    static void generate_uncommon_trap_blob(void);
   49.22    static UncommonTrapBlob* uncommon_trap_blob()                  { return _uncommon_trap_blob; }
   49.23 @@ -499,6 +505,7 @@
   49.24    // handle ic miss with caller being compiled code
   49.25    // wrong method handling (inline cache misses, zombie methods)
   49.26    static address handle_wrong_method(JavaThread* thread);
   49.27 +  static address handle_wrong_method_abstract(JavaThread* thread);
   49.28    static address handle_wrong_method_ic_miss(JavaThread* thread);
   49.29  
   49.30  #ifndef PRODUCT
    50.1 --- a/src/share/vm/runtime/sweeper.cpp	Thu Dec 05 19:19:09 2013 +0100
    50.2 +++ b/src/share/vm/runtime/sweeper.cpp	Thu Dec 05 15:13:12 2013 -0800
    50.3 @@ -38,6 +38,7 @@
    50.4  #include "runtime/vm_operations.hpp"
    50.5  #include "trace/tracing.hpp"
    50.6  #include "utilities/events.hpp"
    50.7 +#include "utilities/ticks.inline.hpp"
    50.8  #include "utilities/xmlstream.hpp"
    50.9  
   50.10  #ifdef ASSERT
   50.11 @@ -144,10 +145,10 @@
   50.12                                                                 //   3) zombie      -> marked_for_reclamation
   50.13  
   50.14  int   NMethodSweeper::_total_nof_methods_reclaimed     = 0;    // Accumulated nof methods flushed
   50.15 -jlong NMethodSweeper::_total_time_sweeping             = 0;    // Accumulated time sweeping
   50.16 -jlong NMethodSweeper::_total_time_this_sweep           = 0;    // Total time this sweep
   50.17 -jlong NMethodSweeper::_peak_sweep_time                 = 0;    // Peak time for a full sweep
   50.18 -jlong NMethodSweeper::_peak_sweep_fraction_time        = 0;    // Peak time sweeping one fraction
   50.19 +Tickspan NMethodSweeper::_total_time_sweeping;                 // Accumulated time sweeping
   50.20 +Tickspan NMethodSweeper::_total_time_this_sweep;               // Total time this sweep
   50.21 +Tickspan NMethodSweeper::_peak_sweep_time;                     // Peak time for a full sweep
   50.22 +Tickspan NMethodSweeper::_peak_sweep_fraction_time;            // Peak time sweeping one fraction
   50.23  int   NMethodSweeper::_hotness_counter_reset_val       = 0;
   50.24  
   50.25  
   50.26 @@ -209,7 +210,7 @@
   50.27      _sweep_fractions_left = NmethodSweepFraction;
   50.28      _current = CodeCache::first_nmethod();
   50.29      _traversals += 1;
   50.30 -    _total_time_this_sweep = 0;
   50.31 +    _total_time_this_sweep = Tickspan();
   50.32  
   50.33      if (PrintMethodFlushing) {
   50.34        tty->print_cr("### Sweep: stack traversal %d", _traversals);
   50.35 @@ -231,7 +232,8 @@
   50.36   */
   50.37  void NMethodSweeper::possibly_sweep() {
   50.38    assert(JavaThread::current()->thread_state() == _thread_in_vm, "must run in vm mode");
   50.39 -  if (!MethodFlushing || !sweep_in_progress()) {
   50.40 +  // Only compiler threads are allowed to sweep
   50.41 +  if (!MethodFlushing || !sweep_in_progress() || !Thread::current()->is_Compiler_thread()) {
   50.42      return;
   50.43    }
   50.44  
   50.45 @@ -302,7 +304,7 @@
   50.46  }
   50.47  
   50.48  void NMethodSweeper::sweep_code_cache() {
   50.49 -  jlong sweep_start_counter = os::elapsed_counter();
   50.50 +  Ticks sweep_start_counter = Ticks::now();
   50.51  
   50.52    _flushed_count                = 0;
   50.53    _zombified_count              = 0;
   50.54 @@ -366,8 +368,8 @@
   50.55  
   50.56    assert(_sweep_fractions_left > 1 || _current == NULL, "must have scanned the whole cache");
   50.57  
   50.58 -  jlong sweep_end_counter = os::elapsed_counter();
   50.59 -  jlong sweep_time = sweep_end_counter - sweep_start_counter;
   50.60 +  const Ticks sweep_end_counter = Ticks::now();
   50.61 +  const Tickspan sweep_time = sweep_end_counter - sweep_start_counter;
   50.62    _total_time_sweeping  += sweep_time;
   50.63    _total_time_this_sweep += sweep_time;
   50.64    _peak_sweep_fraction_time = MAX2(sweep_time, _peak_sweep_fraction_time);
   50.65 @@ -388,7 +390,8 @@
   50.66  
   50.67  #ifdef ASSERT
   50.68    if(PrintMethodFlushing) {
   50.69 -    tty->print_cr("### sweeper:      sweep time(%d): " INT64_FORMAT, _sweep_fractions_left, (jlong)sweep_time);
   50.70 +    tty->print_cr("### sweeper:      sweep time(%d): "
   50.71 +      INT64_FORMAT, _sweep_fractions_left, (jlong)sweep_time.value());
   50.72    }
   50.73  #endif
   50.74  
    51.1 --- a/src/share/vm/runtime/sweeper.hpp	Thu Dec 05 19:19:09 2013 +0100
    51.2 +++ b/src/share/vm/runtime/sweeper.hpp	Thu Dec 05 15:13:12 2013 -0800
    51.3 @@ -25,6 +25,7 @@
    51.4  #ifndef SHARE_VM_RUNTIME_SWEEPER_HPP
    51.5  #define SHARE_VM_RUNTIME_SWEEPER_HPP
    51.6  
    51.7 +#include "utilities/ticks.hpp"
    51.8  // An NmethodSweeper is an incremental cleaner for:
    51.9  //    - cleanup inline caches
   51.10  //    - reclamation of nmethods
   51.11 @@ -71,10 +72,10 @@
   51.12                                                    //   3) zombie      -> marked_for_reclamation
   51.13    // Stat counters
   51.14    static int       _total_nof_methods_reclaimed;  // Accumulated nof methods flushed
   51.15 -  static jlong     _total_time_sweeping;          // Accumulated time sweeping
   51.16 -  static jlong     _total_time_this_sweep;        // Total time this sweep
   51.17 -  static jlong     _peak_sweep_time;              // Peak time for a full sweep
   51.18 -  static jlong     _peak_sweep_fraction_time;     // Peak time sweeping one fraction
   51.19 +  static Tickspan  _total_time_sweeping;          // Accumulated time sweeping
   51.20 +  static Tickspan  _total_time_this_sweep;        // Total time this sweep
   51.21 +  static Tickspan  _peak_sweep_time;              // Peak time for a full sweep
   51.22 +  static Tickspan  _peak_sweep_fraction_time;     // Peak time sweeping one fraction
   51.23  
   51.24    static int  process_nmethod(nmethod *nm);
   51.25    static void release_nmethod(nmethod* nm);
   51.26 @@ -87,9 +88,9 @@
   51.27   public:
   51.28    static long traversal_count()              { return _traversals; }
   51.29    static int  total_nof_methods_reclaimed()  { return _total_nof_methods_reclaimed; }
   51.30 -  static jlong total_time_sweeping()         { return _total_time_sweeping; }
   51.31 -  static jlong peak_sweep_time()             { return _peak_sweep_time; }
   51.32 -  static jlong peak_sweep_fraction_time()    { return _peak_sweep_fraction_time; }
   51.33 +  static const Tickspan total_time_sweeping()      { return _total_time_sweeping; }
   51.34 +  static const Tickspan peak_sweep_time()          { return _peak_sweep_time; }
   51.35 +  static const Tickspan peak_sweep_fraction_time() { return _peak_sweep_fraction_time; }
   51.36    static void log_sweep(const char* msg, const char* format = NULL, ...);
   51.37  
   51.38  
    52.1 --- a/src/share/vm/services/threadService.cpp	Thu Dec 05 19:19:09 2013 +0100
    52.2 +++ b/src/share/vm/services/threadService.cpp	Thu Dec 05 15:13:12 2013 -0800
    52.3 @@ -200,6 +200,12 @@
    52.4    }
    52.5  }
    52.6  
    52.7 +void ThreadService::metadata_do(void f(Metadata*)) {
    52.8 +  for (ThreadDumpResult* dump = _threaddump_list; dump != NULL; dump = dump->next()) {
    52.9 +    dump->metadata_do(f);
   52.10 +  }
   52.11 +}
   52.12 +
   52.13  void ThreadService::add_thread_dump(ThreadDumpResult* dump) {
   52.14    MutexLocker ml(Management_lock);
   52.15    if (_threaddump_list == NULL) {
   52.16 @@ -451,9 +457,16 @@
   52.17    }
   52.18  }
   52.19  
   52.20 +void ThreadDumpResult::metadata_do(void f(Metadata*)) {
   52.21 +  for (ThreadSnapshot* ts = _snapshots; ts != NULL; ts = ts->next()) {
   52.22 +    ts->metadata_do(f);
   52.23 +  }
   52.24 +}
   52.25 +
   52.26  StackFrameInfo::StackFrameInfo(javaVFrame* jvf, bool with_lock_info) {
   52.27    _method = jvf->method();
   52.28    _bci = jvf->bci();
   52.29 +  _class_holder = _method->method_holder()->klass_holder();
   52.30    _locked_monitors = NULL;
   52.31    if (with_lock_info) {
   52.32      ResourceMark rm;
   52.33 @@ -477,6 +490,11 @@
   52.34        f->do_oop((oop*) _locked_monitors->adr_at(i));
   52.35      }
   52.36    }
   52.37 +  f->do_oop(&_class_holder);
   52.38 +}
   52.39 +
   52.40 +void StackFrameInfo::metadata_do(void f(Metadata*)) {
   52.41 +  f(_method);
   52.42  }
   52.43  
   52.44  void StackFrameInfo::print_on(outputStream* st) const {
   52.45 @@ -620,6 +638,14 @@
   52.46    }
   52.47  }
   52.48  
   52.49 +void ThreadStackTrace::metadata_do(void f(Metadata*)) {
   52.50 +  int length = _frames->length();
   52.51 +  for (int i = 0; i < length; i++) {
   52.52 +    _frames->at(i)->metadata_do(f);
   52.53 +  }
   52.54 +}
   52.55 +
   52.56 +
   52.57  ConcurrentLocksDump::~ConcurrentLocksDump() {
   52.58    if (_retain_map_on_free) {
   52.59      return;
   52.60 @@ -823,6 +849,13 @@
   52.61    }
   52.62  }
   52.63  
   52.64 +void ThreadSnapshot::metadata_do(void f(Metadata*)) {
   52.65 +  if (_stack_trace != NULL) {
   52.66 +    _stack_trace->metadata_do(f);
   52.67 +  }
   52.68 +}
   52.69 +
   52.70 +
   52.71  DeadlockCycle::DeadlockCycle() {
   52.72    _is_deadlock = false;
   52.73    _threads = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<JavaThread*>(INITIAL_ARRAY_SIZE, true);
    53.1 --- a/src/share/vm/services/threadService.hpp	Thu Dec 05 19:19:09 2013 +0100
    53.2 +++ b/src/share/vm/services/threadService.hpp	Thu Dec 05 15:13:12 2013 -0800
    53.3 @@ -113,6 +113,7 @@
    53.4  
    53.5    // GC support
    53.6    static void   oops_do(OopClosure* f);
    53.7 +  static void   metadata_do(void f(Metadata*));
    53.8  };
    53.9  
   53.10  // Per-thread Statistics for synchronization
   53.11 @@ -242,6 +243,7 @@
   53.12    void        dump_stack_at_safepoint(int max_depth, bool with_locked_monitors);
   53.13    void        set_concurrent_locks(ThreadConcurrentLocks* l) { _concurrent_locks = l; }
   53.14    void        oops_do(OopClosure* f);
   53.15 +  void        metadata_do(void f(Metadata*));
   53.16  };
   53.17  
   53.18  class ThreadStackTrace : public CHeapObj<mtInternal> {
   53.19 @@ -265,6 +267,7 @@
   53.20    void            dump_stack_at_safepoint(int max_depth);
   53.21    Handle          allocate_fill_stack_trace_element_array(TRAPS);
   53.22    void            oops_do(OopClosure* f);
   53.23 +  void            metadata_do(void f(Metadata*));
   53.24    GrowableArray<oop>* jni_locked_monitors() { return _jni_locked_monitors; }
   53.25    int             num_jni_locked_monitors() { return (_jni_locked_monitors != NULL ? _jni_locked_monitors->length() : 0); }
   53.26  
   53.27 @@ -280,6 +283,9 @@
   53.28    Method*             _method;
   53.29    int                 _bci;
   53.30    GrowableArray<oop>* _locked_monitors; // list of object monitors locked by this frame
   53.31 +  // We need to save the mirrors in the backtrace to keep the class
   53.32 +  // from being unloaded while we still have this stack trace.
   53.33 +  oop                 _class_holder;
   53.34  
   53.35   public:
   53.36  
   53.37 @@ -289,9 +295,10 @@
   53.38        delete _locked_monitors;
   53.39      }
   53.40    };
   53.41 -  Method* method() const       { return _method; }
   53.42 +  Method*   method() const       { return _method; }
   53.43    int       bci()    const       { return _bci; }
   53.44    void      oops_do(OopClosure* f);
   53.45 +  void      metadata_do(void f(Metadata*));
   53.46  
   53.47    int       num_locked_monitors()       { return (_locked_monitors != NULL ? _locked_monitors->length() : 0); }
   53.48    GrowableArray<oop>* locked_monitors() { return _locked_monitors; }
   53.49 @@ -354,6 +361,7 @@
   53.50    int                  num_snapshots()                  { return _num_snapshots; }
   53.51    ThreadSnapshot*      snapshots()                      { return _snapshots; }
   53.52    void                 oops_do(OopClosure* f);
   53.53 +  void                 metadata_do(void f(Metadata*));
   53.54  };
   53.55  
   53.56  class DeadlockCycle : public CHeapObj<mtInternal> {
    54.1 --- a/src/share/vm/trace/noTraceBackend.hpp	Thu Dec 05 19:19:09 2013 +0100
    54.2 +++ b/src/share/vm/trace/noTraceBackend.hpp	Thu Dec 05 15:13:12 2013 -0800
    54.3 @@ -25,9 +25,7 @@
    54.4  #define SHARE_VM_TRACE_NOTRACEBACKEND_HPP
    54.5  
    54.6  #include "prims/jni.h"
    54.7 -
    54.8 -typedef jlong TracingTime;
    54.9 -typedef jlong RelativeTracingTime;
   54.10 +#include "trace/traceTime.hpp"
   54.11  
   54.12  class NoTraceBackend {
   54.13  public:
   54.14 @@ -44,5 +42,3 @@
   54.15  typedef NoTraceBackend Tracing;
   54.16  
   54.17  #endif
   54.18 -
   54.19 -
    55.1 --- a/src/share/vm/trace/trace.xml	Thu Dec 05 19:19:09 2013 +0100
    55.2 +++ b/src/share/vm/trace/trace.xml	Thu Dec 05 15:13:12 2013 -0800
    55.3 @@ -176,8 +176,8 @@
    55.4        <value type="UINT" field="gcId"  label="GC ID" relation="GC_ID" />
    55.5        <value type="GCNAME" field="name" label="Name" description="The name of the Garbage Collector" />
    55.6        <value type="GCCAUSE" field="cause" label="Cause" description="The reason for triggering this Garbage Collection" />
    55.7 -      <value type="RELATIVE_TICKS" field="sumOfPauses" label="Sum of Pauses" description="Sum of all the times in which Java execution was paused during the garbage collection" />
    55.8 -      <value type="RELATIVE_TICKS" field="longestPause" label="Longest Pause" description="Longest individual pause during the garbage collection" />
    55.9 +      <value type="TICKSPAN" field="sumOfPauses" label="Sum of Pauses" description="Sum of all the times in which Java execution was paused during the garbage collection" />
   55.10 +      <value type="TICKSPAN" field="longestPause" label="Longest Pause" description="Longest individual pause during the garbage collection" />
   55.11      </event>
   55.12  
   55.13      <event id="GCParallelOld" path="vm/gc/collector/parold_garbage_collection" label="Parallel Old Garbage Collection"
    56.1 --- a/src/share/vm/trace/traceBackend.hpp	Thu Dec 05 19:19:09 2013 +0100
    56.2 +++ b/src/share/vm/trace/traceBackend.hpp	Thu Dec 05 15:13:12 2013 -0800
    56.3 @@ -47,10 +47,6 @@
    56.4      return os::elapsed_counter();
    56.5    }
    56.6  
    56.7 -  static TracingTime time_adjustment(jlong time) {
    56.8 -    return time;
    56.9 -  }
   56.10 -
   56.11    static void on_unloading_classes(void) {
   56.12    }
   56.13  };
    57.1 --- a/src/share/vm/trace/traceEvent.hpp	Thu Dec 05 19:19:09 2013 +0100
    57.2 +++ b/src/share/vm/trace/traceEvent.hpp	Thu Dec 05 15:13:12 2013 -0800
    57.3 @@ -25,26 +25,23 @@
    57.4  #ifndef SHARE_VM_TRACE_TRACEEVENT_HPP
    57.5  #define SHARE_VM_TRACE_TRACEEVENT_HPP
    57.6  
    57.7 +#include "utilities/macros.hpp"
    57.8 +
    57.9  enum EventStartTime {
   57.10    UNTIMED,
   57.11    TIMED
   57.12  };
   57.13  
   57.14 -#include "utilities/macros.hpp"
   57.15 -
   57.16  #if INCLUDE_TRACE
   57.17  
   57.18  #include "trace/traceBackend.hpp"
   57.19  #include "trace/tracing.hpp"
   57.20  #include "tracefiles/traceEventIds.hpp"
   57.21  #include "tracefiles/traceTypes.hpp"
   57.22 +#include "utilities/ticks.hpp"
   57.23  
   57.24  template<typename T>
   57.25  class TraceEvent : public StackObj {
   57.26 - protected:
   57.27 -  jlong _startTime;
   57.28 -  jlong _endTime;
   57.29 -
   57.30   private:
   57.31    bool _started;
   57.32  #ifdef ASSERT
   57.33 @@ -54,6 +51,18 @@
   57.34    bool _ignore_check;
   57.35  #endif
   57.36  
   57.37 + protected:
   57.38 +  jlong _startTime;
   57.39 +  jlong _endTime;
   57.40 +
   57.41 +  void set_starttime(const TracingTime& time) {
   57.42 +    _startTime = time;
   57.43 +  }
   57.44 +
   57.45 +  void set_endtime(const TracingTime& time) {
   57.46 +    _endTime = time;
   57.47 +  }
   57.48 +
   57.49   public:
   57.50    TraceEvent(EventStartTime timing=TIMED) :
   57.51      _startTime(0),
   57.52 @@ -100,12 +109,12 @@
   57.53      set_commited();
   57.54    }
   57.55  
   57.56 -  void set_starttime(jlong time) {
   57.57 -    _startTime = time;
   57.58 +  void set_starttime(const Ticks& time) {
   57.59 +    _startTime = time.value();
   57.60    }
   57.61  
   57.62 -  void set_endtime(jlong time) {
   57.63 -    _endTime = time;
   57.64 +  void set_endtime(const Ticks& time) {
   57.65 +    _endTime = time.value();
   57.66    }
   57.67  
   57.68    TraceEventId id() const {
    58.1 --- a/src/share/vm/trace/traceEventClasses.xsl	Thu Dec 05 19:19:09 2013 +0100
    58.2 +++ b/src/share/vm/trace/traceEventClasses.xsl	Thu Dec 05 15:13:12 2013 -0800
    58.3 @@ -40,6 +40,7 @@
    58.4  #include "tracefiles/traceTypes.hpp"
    58.5  #include "trace/traceEvent.hpp"
    58.6  #include "utilities/macros.hpp"
    58.7 +#include "utilities/ticks.hpp"
    58.8  
    58.9  #if INCLUDE_TRACE
   58.10  
   58.11 @@ -55,8 +56,8 @@
   58.12  class TraceEvent {
   58.13  public:
   58.14    TraceEvent() {}
   58.15 -  void set_starttime(jlong time) const {}
   58.16 -  void set_endtime(jlong time) const {}
   58.17 +  void set_starttime(const Ticks&amp; time) {}
   58.18 +  void set_endtime(const Ticks&amp; time) {}
   58.19    bool should_commit() const { return false; }
   58.20    void commit() const {}
   58.21  };
   58.22 @@ -170,23 +171,23 @@
   58.23    </xsl:if>
   58.24  </xsl:template>
   58.25  
   58.26 -
   58.27  <xsl:template match="value[@type='TICKS']" mode="write-setters">
   58.28  #if INCLUDE_TRACE
   58.29 -  <xsl:value-of select="concat('void set_', @field, '(jlong time) { _', @field, ' = time; }')"/>
   58.30 +<xsl:value-of select="concat('  void set_', @field, '(const Ticks&amp; time) { _', @field, ' = time; }')"/>
   58.31  #else
   58.32 -  <xsl:value-of select="concat('void set_', @field, '(jlong ignore) {}')"/>
   58.33 +<xsl:value-of select="concat('  void set_', @field, '(const Ticks&amp; ignore) {}')"/>
   58.34  #endif
   58.35  </xsl:template>
   58.36  
   58.37 -<xsl:template match="value[@type='RELATIVE_TICKS']" mode="write-setters">
   58.38 +<xsl:template match="value[@type='TICKSPAN']" mode="write-setters">
   58.39  #if INCLUDE_TRACE
   58.40 -  <xsl:value-of select="concat('void set_', @field, '(jlong time) { _', @field, ' = time; }')"/>
   58.41 +  <xsl:value-of select="concat('  void set_', @field, '(const Tickspan&amp; time) { _', @field, ' = time; }')"/>
   58.42  #else
   58.43 -  <xsl:value-of select="concat('void set_', @field, '(jlong ignore) {}')"/>
   58.44 +  <xsl:value-of select="concat('  void set_', @field, '(const Tickspan&amp; ignore) {}')"/>
   58.45  #endif
   58.46  </xsl:template>
   58.47  
   58.48 +
   58.49  <xsl:template match="value" mode="write-fields">
   58.50    <xsl:variable name="type" select="@type"/>
   58.51    <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
   58.52 @@ -226,7 +227,17 @@
   58.53  <xsl:template match="value" mode="write-data">
   58.54    <xsl:variable name="type" select="@type"/>
   58.55    <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@writetype"/>
   58.56 -  <xsl:value-of select="concat('    ts.print_val(&quot;', @label, '&quot;, _', @field, ');')"/>
   58.57 +  <xsl:choose>
   58.58 +    <xsl:when test="@type='TICKSPAN'">
   58.59 +      <xsl:value-of select="concat('    ts.print_val(&quot;', @label, '&quot;, _', @field, '.value());')"/>
   58.60 +    </xsl:when>
   58.61 +    <xsl:when test="@type='TICKS'">
   58.62 +      <xsl:value-of select="concat('    ts.print_val(&quot;', @label, '&quot;, _', @field, '.value());')"/>
   58.63 +    </xsl:when>
   58.64 +    <xsl:otherwise>
   58.65 +      <xsl:value-of select="concat('    ts.print_val(&quot;', @label, '&quot;, _', @field, ');')"/>
   58.66 +    </xsl:otherwise>
   58.67 +  </xsl:choose>
   58.68    <xsl:if test="position() != last()">
   58.69      <xsl:text>
   58.70      ts.print(", ");
    59.1 --- a/src/share/vm/trace/traceTime.hpp	Thu Dec 05 19:19:09 2013 +0100
    59.2 +++ b/src/share/vm/trace/traceTime.hpp	Thu Dec 05 15:13:12 2013 -0800
    59.3 @@ -28,6 +28,5 @@
    59.4  #include "prims/jni.h"
    59.5  
    59.6  typedef jlong TracingTime;
    59.7 -typedef jlong RelativeTracingTime;
    59.8  
    59.9 -#endif
   59.10 +#endif // SHARE_VM_TRACE_TRACETIME_HPP
    60.1 --- a/src/share/vm/trace/traceTypes.xsl	Thu Dec 05 19:19:09 2013 +0100
    60.2 +++ b/src/share/vm/trace/traceTypes.xsl	Thu Dec 05 15:13:12 2013 -0800
    60.3 @@ -32,9 +32,11 @@
    60.4  #ifndef TRACEFILES_JFRTYPES_HPP
    60.5  #define TRACEFILES_JFRTYPES_HPP
    60.6  
    60.7 +#include "oops/symbol.hpp"
    60.8  #include "trace/traceDataTypes.hpp"
    60.9  #include "utilities/globalDefinitions.hpp"
   60.10 -#include "oops/symbol.hpp"
   60.11 +#include "utilities/ticks.hpp"
   60.12 +
   60.13  
   60.14  enum JVMContentType {
   60.15    _not_a_content_type = (JVM_CONTENT_TYPES_START - 1),
    61.1 --- a/src/share/vm/trace/tracetypes.xml	Thu Dec 05 19:19:09 2013 +0100
    61.2 +++ b/src/share/vm/trace/tracetypes.xml	Thu Dec 05 15:13:12 2013 -0800
    61.3 @@ -249,13 +249,13 @@
    61.4      <primary_type symbol="NANOS" datatype="LONG" contenttype="NANOS"
    61.5                    type="s8" sizeop="sizeof(s8)"/>
    61.6  
    61.7 -    <!-- 64-bit signed integer, SEMANTIC value ABSOLUTE TICKS -->
    61.8 +    <!-- 64-bit signed integer, SEMANTIC value TICKS -->
    61.9      <primary_type symbol="TICKS" datatype="LONG" contenttype="TICKS"
   61.10 -                  type="s8" sizeop="sizeof(s8)"/>
   61.11 +                  type="Ticks" sizeop="sizeof(s8)"/>
   61.12  
   61.13 -    <!-- 64-bit signed integer, SEMANTIC value RELATIVE TICKS -->
   61.14 -    <primary_type symbol="RELATIVE_TICKS" datatype="LONG" contenttype="TICKS"
   61.15 -                  type="s8" sizeop="sizeof(s8)"/>
   61.16 +    <!-- 64-bit signed integer, SEMANTIC value TICKS duration -->
   61.17 +    <primary_type symbol="TICKSPAN" datatype="LONG" contenttype="TICKS"
   61.18 +                  type="Tickspan" sizeop="sizeof(s8)"/>
   61.19  
   61.20      <!-- 64-bit unsigned integer, SEMANTIC value ADDRESS (mem loc) -->
   61.21      <primary_type symbol="ADDRESS" datatype="U8" contenttype="ADDRESS"
    62.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    62.2 +++ b/src/share/vm/utilities/ticks.cpp	Thu Dec 05 15:13:12 2013 -0800
    62.3 @@ -0,0 +1,68 @@
    62.4 +/*
    62.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    62.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    62.7 + *
    62.8 + * This code is free software; you can redistribute it and/or modify it
    62.9 + * under the terms of the GNU General Public License version 2 only, as
   62.10 + * published by the Free Software Foundation.
   62.11 + *
   62.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   62.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   62.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   62.15 + * version 2 for more details (a copy is included in the LICENSE file that
   62.16 + * accompanied this code).
   62.17 + *
   62.18 + * You should have received a copy of the GNU General Public License version
   62.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   62.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   62.21 + *
   62.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   62.23 + * or visit www.oracle.com if you need additional information or have any
   62.24 + * questions.
   62.25 + *
   62.26 + */
   62.27 +
   62.28 +#include "precompiled.hpp"
   62.29 +#include "runtime/os.hpp"
   62.30 +#include "utilities/ticks.inline.hpp"
   62.31 +
   62.32 +#ifdef ASSERT
   62.33 + const jlong Ticks::invalid_time_stamp = -2; // 0xFFFF FFFF`FFFF FFFE
   62.34 +#endif
   62.35 +
   62.36 +void Ticks::stamp() {
   62.37 +  _stamp_ticks = os::elapsed_counter();
   62.38 +}
   62.39 +
   62.40 +const Ticks Ticks::now() {
   62.41 +  Ticks t;
   62.42 +  t.stamp();
   62.43 +  return t;
   62.44 +}
   62.45 +
   62.46 +Tickspan::Tickspan(const Ticks& end, const Ticks& start) {
   62.47 +  assert(end.value() != Ticks::invalid_time_stamp, "end is unstamped!");
   62.48 +  assert(start.value() != Ticks::invalid_time_stamp, "start is unstamped!");
   62.49 +
   62.50 +  assert(end >= start, "negative time!");
   62.51 +
   62.52 +  _span_ticks = end.value() - start.value();
   62.53 +}
   62.54 +
   62.55 +template <typename ReturnType>
   62.56 +static ReturnType time_conversion(const Tickspan& span, TicksToTimeHelper::Unit unit) {
   62.57 +  assert(TicksToTimeHelper::SECONDS == unit ||
   62.58 +         TicksToTimeHelper::MILLISECONDS == unit, "invalid unit!");
   62.59 +
   62.60 +  ReturnType frequency_per_unit = (ReturnType)os::elapsed_frequency() / (ReturnType)unit;
   62.61 +
   62.62 +  return (ReturnType) ((ReturnType)span.value() / frequency_per_unit);
   62.63 +}
   62.64 +
   62.65 +double TicksToTimeHelper::seconds(const Tickspan& span) {
   62.66 +  return time_conversion<double>(span, SECONDS);
   62.67 +}
   62.68 +
   62.69 +jlong TicksToTimeHelper::milliseconds(const Tickspan& span) {
   62.70 +  return time_conversion<jlong>(span, MILLISECONDS);
   62.71 +}
    63.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    63.2 +++ b/src/share/vm/utilities/ticks.hpp	Thu Dec 05 15:13:12 2013 -0800
    63.3 @@ -0,0 +1,111 @@
    63.4 +/*
    63.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    63.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    63.7 + *
    63.8 + * This code is free software; you can redistribute it and/or modify it
    63.9 + * under the terms of the GNU General Public License version 2 only, as
   63.10 + * published by the Free Software Foundation.
   63.11 + *
   63.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   63.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   63.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   63.15 + * version 2 for more details (a copy is included in the LICENSE file that
   63.16 + * accompanied this code).
   63.17 + *
   63.18 + * You should have received a copy of the GNU General Public License version
   63.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   63.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   63.21 + *
   63.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   63.23 + * or visit www.oracle.com if you need additional information or have any
   63.24 + * questions.
   63.25 + *
   63.26 + */
   63.27 +
   63.28 +#ifndef SHARE_VM_UTILITIES_TICKS_HPP
   63.29 +#define SHARE_VM_UTILITIES_TICKS_HPP
   63.30 +
   63.31 +#include "memory/allocation.hpp"
   63.32 +#include "utilities/globalDefinitions.hpp"
   63.33 +
   63.34 +class Ticks;
   63.35 +
   63.36 +class Tickspan VALUE_OBJ_CLASS_SPEC {
   63.37 +  friend class Ticks;
   63.38 +  friend Tickspan operator-(const Ticks& end, const Ticks& start);
   63.39 +
   63.40 + private:
   63.41 +  jlong _span_ticks;
   63.42 +
   63.43 +  Tickspan(const Ticks& end, const Ticks& start);
   63.44 +
   63.45 + public:
   63.46 +  Tickspan() : _span_ticks(0) {}
   63.47 +
   63.48 +  Tickspan& operator+=(const Tickspan& rhs) {
   63.49 +    _span_ticks += rhs._span_ticks;
   63.50 +    return *this;
   63.51 +  }
   63.52 +
   63.53 +  jlong value() const {
   63.54 +    return _span_ticks;
   63.55 +  }
   63.56 +
   63.57 +};
   63.58 +
   63.59 +class Ticks VALUE_OBJ_CLASS_SPEC {
   63.60 + private:
   63.61 +  jlong _stamp_ticks;
   63.62 +
   63.63 + public:
   63.64 +  Ticks() : _stamp_ticks(0) {
   63.65 +    assert((_stamp_ticks = invalid_time_stamp) == invalid_time_stamp,
   63.66 +      "initial unstamped time value assignment");
   63.67 +  }
   63.68 +
   63.69 +  Ticks& operator+=(const Tickspan& span) {
   63.70 +    _stamp_ticks += span.value();
   63.71 +    return *this;
   63.72 +  }
   63.73 +
   63.74 +  Ticks& operator-=(const Tickspan& span) {
   63.75 +    _stamp_ticks -= span.value();
   63.76 +    return *this;
   63.77 +  }
   63.78 +
   63.79 +  void stamp();
   63.80 +
   63.81 +  jlong value() const {
   63.82 +    return _stamp_ticks;
   63.83 +  }
   63.84 +
   63.85 +  static const Ticks now();
   63.86 +
   63.87 +#ifdef ASSERT
   63.88 +  static const jlong invalid_time_stamp;
   63.89 +#endif
   63.90 +
   63.91 +#ifndef PRODUCT
   63.92 +  // only for internal use by GC VM tests
   63.93 +  friend class TimePartitionPhasesIteratorTest;
   63.94 +  friend class GCTimerTest;
   63.95 +
   63.96 + private:
   63.97 +  // implicit type conversion
   63.98 +  Ticks(int ticks) : _stamp_ticks(ticks) {}
   63.99 +
  63.100 +#endif // !PRODUCT
  63.101 +
  63.102 +};
  63.103 +
  63.104 +class TicksToTimeHelper : public AllStatic {
  63.105 + public:
  63.106 +  enum Unit {
  63.107 +    SECONDS = 1,
  63.108 +    MILLISECONDS = 1000
  63.109 +  };
  63.110 +  static double seconds(const Tickspan& span);
  63.111 +  static jlong milliseconds(const Tickspan& span);
  63.112 +};
  63.113 +
  63.114 +#endif // SHARE_VM_UTILITIES_TICKS_HPP
    64.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    64.2 +++ b/src/share/vm/utilities/ticks.inline.hpp	Thu Dec 05 15:13:12 2013 -0800
    64.3 @@ -0,0 +1,97 @@
    64.4 +/*
    64.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    64.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    64.7 + *
    64.8 + * This code is free software; you can redistribute it and/or modify it
    64.9 + * under the terms of the GNU General Public License version 2 only, as
   64.10 + * published by the Free Software Foundation.
   64.11 + *
   64.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   64.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   64.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   64.15 + * version 2 for more details (a copy is included in the LICENSE file that
   64.16 + * accompanied this code).
   64.17 + *
   64.18 + * You should have received a copy of the GNU General Public License version
   64.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   64.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   64.21 + *
   64.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   64.23 + * or visit www.oracle.com if you need additional information or have any
   64.24 + * questions.
   64.25 + *
   64.26 + */
   64.27 +
   64.28 +#ifndef SHARE_VM_UTILITIES_TICKS_INLINE_HPP
   64.29 +#define SHARE_VM_UTILITIES_TICKS_INLINE_HPP
   64.30 +
   64.31 +#include "utilities/ticks.hpp"
   64.32 +
   64.33 +inline Tickspan operator+(Tickspan lhs, const Tickspan& rhs) {
   64.34 +  lhs += rhs;
   64.35 +  return lhs;
   64.36 +}
   64.37 +
   64.38 +inline bool operator==(const Tickspan& lhs, const Tickspan& rhs) {
   64.39 +  return lhs.value() == rhs.value();
   64.40 +}
   64.41 +
   64.42 +inline bool operator!=(const Tickspan& lhs, const Tickspan& rhs) {
   64.43 +  return !operator==(lhs,rhs);
   64.44 +}
   64.45 +
   64.46 +inline bool operator<(const Tickspan& lhs, const Tickspan& rhs) {
   64.47 +  return lhs.value() < rhs.value();
   64.48 +}
   64.49 +
   64.50 +inline bool operator>(const Tickspan& lhs, const Tickspan& rhs) {
   64.51 +  return operator<(rhs,lhs);
   64.52 +}
   64.53 +
   64.54 +inline bool operator<=(const Tickspan& lhs, const Tickspan& rhs) {
   64.55 +  return !operator>(lhs,rhs);
   64.56 +}
   64.57 +
   64.58 +inline bool operator>=(const Tickspan& lhs, const Tickspan& rhs) {
   64.59 +  return !operator<(lhs,rhs);
   64.60 +}
   64.61 +
   64.62 +inline Ticks operator+(Ticks lhs, const Tickspan& span) {
   64.63 +  lhs += span;
   64.64 +  return lhs;
   64.65 +}
   64.66 +
   64.67 +inline Ticks operator-(Ticks lhs, const Tickspan& span) {
   64.68 +  lhs -= span;
   64.69 +  return lhs;
   64.70 +}
   64.71 +
   64.72 +inline Tickspan operator-(const Ticks& end, const Ticks& start) {
   64.73 +  return Tickspan(end, start);
   64.74 +}
   64.75 +
   64.76 +inline bool operator==(const Ticks& lhs, const Ticks& rhs) {
   64.77 +  return lhs.value() == rhs.value();
   64.78 +}
   64.79 +
   64.80 +inline bool operator!=(const Ticks& lhs, const Ticks& rhs) {
   64.81 +  return !operator==(lhs,rhs);
   64.82 +}
   64.83 +
   64.84 +inline bool operator<(const Ticks& lhs, const Ticks& rhs) {
   64.85 +  return lhs.value() < rhs.value();
   64.86 +}
   64.87 +
   64.88 +inline bool operator>(const Ticks& lhs, const Ticks& rhs) {
   64.89 +  return operator<(rhs,lhs);
   64.90 +}
   64.91 +
   64.92 +inline bool operator<=(const Ticks& lhs, const Ticks& rhs) {
   64.93 +  return !operator>(lhs,rhs);
   64.94 +}
   64.95 +
   64.96 +inline bool operator>=(const Ticks& lhs, const Ticks& rhs) {
   64.97 +  return !operator<(lhs,rhs);
   64.98 +}
   64.99 +
  64.100 +#endif // SHARE_VM_UTILITIES_TICKS_INLINE_HPP
    65.1 --- a/test/compiler/jsr292/ConcurrentClassLoadingTest.java	Thu Dec 05 19:19:09 2013 +0100
    65.2 +++ b/test/compiler/jsr292/ConcurrentClassLoadingTest.java	Thu Dec 05 15:13:12 2013 -0800
    65.3 @@ -172,7 +172,6 @@
    65.4              "java.lang.invoke.LambdaConversionException",
    65.5              "java.lang.invoke.LambdaForm",
    65.6              "java.lang.invoke.LambdaMetafactory",
    65.7 -            "java.lang.invoke.MagicLambdaImpl",
    65.8              "java.lang.invoke.MemberName",
    65.9              "java.lang.invoke.MethodHandle",
   65.10              "java.lang.invoke.MethodHandleImpl",
    66.1 --- a/test/compiler/jsr292/methodHandleExceptions/ByteClassLoader.java	Thu Dec 05 19:19:09 2013 +0100
    66.2 +++ b/test/compiler/jsr292/methodHandleExceptions/ByteClassLoader.java	Thu Dec 05 15:13:12 2013 -0800
    66.3 @@ -1,3 +1,12 @@
    66.4 +import java.io.BufferedOutputStream;
    66.5 +import java.io.FileNotFoundException;
    66.6 +import java.io.FileOutputStream;
    66.7 +import java.io.IOException;
    66.8 +import java.net.URL;
    66.9 +import java.net.URLClassLoader;
   66.10 +import java.util.jar.JarEntry;
   66.11 +import java.util.jar.JarOutputStream;
   66.12 +
   66.13  /*
   66.14   * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   66.15   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   66.16 @@ -23,12 +32,63 @@
   66.17   */
   66.18  
   66.19  /**
   66.20 - * A minimal classloader for loading bytecodes that could not result from
   66.21 - * properly compiled Java.
   66.22 + * A ByteClassLoader is used to define classes from collections of bytes, as
   66.23 + * well as loading classes in the usual way. It includes options to write the
   66.24 + * classes to files in a jar, or to read the classes from jars in a later or
   66.25 + * debugging run.
   66.26   *
   66.27 - * @author dr2chase
   66.28 + * If Boolean property byteclassloader.verbose is true, be chatty about jar
   66.29 + * file operations.
   66.30 + *
   66.31   */
   66.32 -public class ByteClassLoader extends ClassLoader {
   66.33 +public class ByteClassLoader extends URLClassLoader {
   66.34 +
   66.35 +    final static boolean verbose
   66.36 +            = Boolean.getBoolean("byteclassloader.verbose");
   66.37 +
   66.38 +    final boolean read;
   66.39 +    final JarOutputStream jos;
   66.40 +    final String jar_name;
   66.41 +
   66.42 +    /**
   66.43 +     * Make a new ByteClassLoader.
   66.44 +     *
   66.45 +     * @param jar_name  Basename of jar file to be read/written by this classloader.
   66.46 +     * @param read      If true, read classes from jar file instead of from parameter.
   66.47 +     * @param write     If true, write classes to jar files for offline study/use.
   66.48 +     *
   66.49 +     * @throws FileNotFoundException
   66.50 +     * @throws IOException
   66.51 +     */
   66.52 +    public ByteClassLoader(String jar_name, boolean read, boolean write)
   66.53 +            throws FileNotFoundException, IOException {
   66.54 +        super(read
   66.55 +                ? new URL[]{new URL("file:" + jar_name + ".jar")}
   66.56 +                : new URL[0]);
   66.57 +        this.read = read;
   66.58 +        this.jar_name = jar_name;
   66.59 +        this.jos = write
   66.60 +                ? new JarOutputStream(
   66.61 +                new BufferedOutputStream(
   66.62 +                new FileOutputStream(jar_name + ".jar"))) : null;
   66.63 +        if (read && write) {
   66.64 +            throw new Error("At most one of read and write may be true.");
   66.65 +        }
   66.66 +    }
   66.67 +
   66.68 +    private static void writeJarredFile(JarOutputStream jos, String file, String suffix, byte[] bytes) {
   66.69 +        String fileName = file.replace(".", "/") + "." + suffix;
   66.70 +        JarEntry ze = new JarEntry(fileName);
   66.71 +        try {
   66.72 +            ze.setSize(bytes.length);
   66.73 +            jos.putNextEntry(ze);
   66.74 +            jos.write(bytes);
   66.75 +            jos.closeEntry();
   66.76 +        } catch (IOException e) {
   66.77 +            throw new RuntimeException(e);
   66.78 +        }
   66.79 +    }
   66.80 +
   66.81      /**
   66.82       * (pre)load class name using classData for the definition.
   66.83       *
   66.84 @@ -36,9 +96,36 @@
   66.85       * @param classData
   66.86       * @return
   66.87       */
   66.88 -    public Class<?> loadBytes(String name, byte[] classData) {
   66.89 -         Class<?> clazz = defineClass(name, classData, 0, classData.length);
   66.90 -                     resolveClass(clazz);
   66.91 -         return clazz;
   66.92 +    public Class<?> loadBytes(String name, byte[] classData) throws ClassNotFoundException {
   66.93 +        if (jos != null) {
   66.94 +            if (verbose) {
   66.95 +                System.out.println("ByteClassLoader: writing " + name);
   66.96 +            }
   66.97 +            writeJarredFile(jos, name, "class", classData);
   66.98 +        }
   66.99 +
  66.100 +        Class<?> clazz = null;
  66.101 +        if (read) {
  66.102 +            if (verbose) {
  66.103 +                System.out.println("ByteClassLoader: reading " + name + " from " + jar_name);
  66.104 +            }
  66.105 +            clazz = loadClass(name);
  66.106 +        } else {
  66.107 +            clazz = defineClass(name, classData, 0, classData.length);
  66.108 +            resolveClass(clazz);
  66.109 +        }
  66.110 +        return clazz;
  66.111 +    }
  66.112 +
  66.113 +    public void close() {
  66.114 +        if (jos != null) {
  66.115 +            try {
  66.116 +                if (verbose) {
  66.117 +                    System.out.println("ByteClassLoader: closing " + jar_name);
  66.118 +                }
  66.119 +                jos.close();
  66.120 +            } catch (IOException ex) {
  66.121 +            }
  66.122 +        }
  66.123      }
  66.124  }
    67.1 --- a/test/compiler/jsr292/methodHandleExceptions/C.java	Thu Dec 05 19:19:09 2013 +0100
    67.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    67.3 @@ -1,33 +0,0 @@
    67.4 -/*
    67.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    67.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    67.7 - *
    67.8 - * This code is free software; you can redistribute it and/or modify it
    67.9 - * under the terms of the GNU General Public License version 2 only, as
   67.10 - * published by the Free Software Foundation.
   67.11 - *
   67.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   67.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   67.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   67.15 - * version 2 for more details (a copy is included in the LICENSE file that
   67.16 - * accompanied this code).
   67.17 - *
   67.18 - * You should have received a copy of the GNU General Public License version
   67.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   67.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   67.21 - *
   67.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   67.23 - * or visit www.oracle.com if you need additional information or have any
   67.24 - * questions.
   67.25 - *
   67.26 - */
   67.27 -
   67.28 -/**
   67.29 - * Test class -- implements I, which provides default for m, but this class
   67.30 - * declares it abstract which (should) hide the interface default, and throw
   67.31 - * an abstract method error if it is called (calling it requires bytecode hacking
   67.32 - * or inconsistent compilation).
   67.33 - */
   67.34 -public abstract class C implements I {
   67.35 -       public abstract int m();
   67.36 -}
    68.1 --- a/test/compiler/jsr292/methodHandleExceptions/I.java	Thu Dec 05 19:19:09 2013 +0100
    68.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    68.3 @@ -1,27 +0,0 @@
    68.4 -/*
    68.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    68.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    68.7 - *
    68.8 - * This code is free software; you can redistribute it and/or modify it
    68.9 - * under the terms of the GNU General Public License version 2 only, as
   68.10 - * published by the Free Software Foundation.
   68.11 - *
   68.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   68.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   68.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   68.15 - * version 2 for more details (a copy is included in the LICENSE file that
   68.16 - * accompanied this code).
   68.17 - *
   68.18 - * You should have received a copy of the GNU General Public License version
   68.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   68.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   68.21 - *
   68.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   68.23 - * or visit www.oracle.com if you need additional information or have any
   68.24 - * questions.
   68.25 - *
   68.26 - */
   68.27 -
   68.28 -public interface I {
   68.29 -    default public int m() { return 1; }
   68.30 -}
    69.1 --- a/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java	Thu Dec 05 19:19:09 2013 +0100
    69.2 +++ b/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java	Thu Dec 05 15:13:12 2013 -0800
    69.3 @@ -21,50 +21,127 @@
    69.4   * questions.
    69.5   *
    69.6   */
    69.7 -
    69.8  import java.lang.reflect.InvocationTargetException;
    69.9 +import java.lang.reflect.Method;
   69.10 +import java.util.ArrayList;
   69.11 +import java.util.List;
   69.12  import jdk.internal.org.objectweb.asm.ClassWriter;
   69.13  import jdk.internal.org.objectweb.asm.Handle;
   69.14  import jdk.internal.org.objectweb.asm.MethodVisitor;
   69.15  import jdk.internal.org.objectweb.asm.Opcodes;
   69.16 +import p.Dok;
   69.17  
   69.18  /**
   69.19 - * @test
   69.20 - * @bug 8025260
   69.21 - * @summary Ensure that AbstractMethodError is thrown, not NullPointerException, through MethodHandles::jump_from_method_handle code path
   69.22 + * @test @bug 8025260 8016839
   69.23 + * @summary Ensure that AbstractMethodError and IllegalAccessError are thrown appropriately, not NullPointerException
   69.24   *
   69.25 - * @compile -XDignore.symbol.file ByteClassLoader.java I.java C.java TestAMEnotNPE.java
   69.26 + * @compile -XDignore.symbol.file TestAMEnotNPE.java ByteClassLoader.java p/C.java p/Dok.java p/E.java p/F.java p/I.java p/Tdirect.java p/Treflect.java
   69.27 + *
   69.28   * @run main/othervm TestAMEnotNPE
   69.29 + * @run main/othervm -Xint TestAMEnotNPE
   69.30 + * @run main/othervm -Xcomp TestAMEnotNPE
   69.31   */
   69.32 -
   69.33  public class TestAMEnotNPE implements Opcodes {
   69.34  
   69.35 +    static boolean writeJarFiles = false;
   69.36 +    static boolean readJarFiles = false;
   69.37 +
   69.38      /**
   69.39 -     * The bytes for D, a NOT abstract class extending abstract class C
   69.40 -     * without supplying an implementation for abstract method m.
   69.41 -     * There is a default method in the interface I, but it should lose to
   69.42 -     * the abstract class.
   69.43 +     * Optional command line parameter (any case-insensitive prefix of)
   69.44 +     * "writejarfiles" or "readjarfiles".
   69.45 +     *
   69.46 +     * "Writejarfiles" creates a jar file for each different set of tested classes.
   69.47 +     * "Readjarfiles" causes the classloader to use the copies of the classes
   69.48 +     * found in the corresponding jar files.
   69.49 +     *
   69.50 +     * Jarfilenames look something like pD_ext_pF (p.D extends p.F)
   69.51 +     * and qD_m_pp_imp_pI (q.D with package-private m implements p.I)
   69.52 +     *
   69.53 +     */
   69.54 +    public static void main(String args[]) throws Throwable {
   69.55 +        ArrayList<Throwable> lt = new ArrayList<Throwable>();
   69.56  
   69.57 -     class D extends C {
   69.58 -        D() { super(); }
   69.59 -        // does not define m
   69.60 -     }
   69.61 +        if (args.length > 0) {
   69.62 +            String a0 = args[0].toLowerCase();
   69.63 +            if (a0.length() > 0) {
   69.64 +                writeJarFiles = ("writejarfiles").startsWith(a0);
   69.65 +                readJarFiles = ("readjarfiles").startsWith(a0);
   69.66 +            }
   69.67 +            if (!(writeJarFiles || readJarFiles)) {
   69.68 +                throw new Error("Command line parameter (if any) should be prefix of writeJarFiles or readJarFiles");
   69.69 +            }
   69.70 +        }
   69.71  
   69.72 +        try {
   69.73 +            System.out.println("TRYING p.D.m PRIVATE interface-invoked as p.I.m, p.D extends p.F, p.F.m FINAL");
   69.74 +            tryAndCheckThrown(lt, bytesForDprivateSubWhat("p/F"),
   69.75 +                    "p.D extends p.F (p.F implements p.I, FINAL public m), private m",
   69.76 +                    IllegalAccessError.class, "pD_ext_pF");
   69.77 +            // We'll take either a VerifyError (pre 2013-11-30)
   69.78 +            // or an IllegalAccessError (post 2013-11-22)
   69.79 +        } catch (VerifyError ve) {
   69.80 +            System.out.println("Saw expected VerifyError " + ve);
   69.81 +        }
   69.82 +        System.out.println();
   69.83 +
   69.84 +        System.out.println("TRYING p.D.m PRIVATE interface-invoked as p.I.m, p.D extends p.E");
   69.85 +        tryAndCheckThrown(lt, bytesForDprivateSubWhat("p/E"),
   69.86 +                "p.D extends p.E (p.E implements p.I, public m), private m",
   69.87 +                IllegalAccessError.class, "pD_ext_pE");
   69.88 +
   69.89 +        System.out.println("TRYING p.D.m ABSTRACT interface-invoked as p.I.m");
   69.90 +        tryAndCheckThrown(lt, bytesForD(),
   69.91 +                "D extends abstract C, no m",
   69.92 +                AbstractMethodError.class, "pD_ext_pC");
   69.93 +
   69.94 +        System.out.println("TRYING q.D.m PACKAGE interface-invoked as p.I.m");
   69.95 +        tryAndCheckThrown(lt, "q.D", bytesForDsomeAccess("q/D", 0),
   69.96 +                "q.D implements p.I, protected m", IllegalAccessError.class,
   69.97 +                "qD_m_pp_imp_pI");
   69.98 +
   69.99 +        // Note jar file name is used in the plural-arg case.
  69.100 +        System.out.println("TRYING p.D.m PRIVATE interface-invoked as p.I.m");
  69.101 +        tryAndCheckThrown(lt, bytesForDsomeAccess("p/D", ACC_PRIVATE),
  69.102 +                "p.D implements p.I, private m",
  69.103 +                IllegalAccessError.class, "pD_m_pri_imp_pI");
  69.104 +
  69.105 +        // Plural-arg test.
  69.106 +        System.out.println("TRYING p.D.m PRIVATE MANY ARG interface-invoked as p.I.m");
  69.107 +        tryAndCheckThrownMany(lt, bytesForDsomeAccess("p/D", ACC_PRIVATE),
  69.108 +                "p.D implements p.I, private m", IllegalAccessError.class);
  69.109 +
  69.110 +        if (lt.size() > 0) {
  69.111 +            System.out.flush();
  69.112 +            Thread.sleep(250); // This de-interleaves output and error in Netbeans, sigh.
  69.113 +            for (Throwable th : lt)
  69.114 +              System.err.println(th);
  69.115 +            throw new Error("Test failed, there were " + lt.size() + " failures listed above");
  69.116 +        } else {
  69.117 +            System.out.println("ALL PASS, HOORAY!");
  69.118 +        }
  69.119 +    }
  69.120 +
  69.121 +    /**
  69.122 +     * The bytes for D, a NOT abstract class extending abstract class C without
  69.123 +     * supplying an implementation for abstract method m. There is a default
  69.124 +     * method in the interface I, but it should lose to the abstract class.
  69.125 +     *
  69.126       * @return
  69.127       * @throws Exception
  69.128       */
  69.129      public static byte[] bytesForD() throws Exception {
  69.130  
  69.131 -        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS);
  69.132 +        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES
  69.133 +                | ClassWriter.COMPUTE_MAXS);
  69.134          MethodVisitor mv;
  69.135  
  69.136 -        cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, "D", null, "C", null);
  69.137 +        cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, "p/D", null, "p/C", null);
  69.138  
  69.139          {
  69.140              mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
  69.141              mv.visitCode();
  69.142              mv.visitVarInsn(ALOAD, 0);
  69.143 -            mv.visitMethodInsn(INVOKESPECIAL, "C", "<init>", "()V");
  69.144 +            mv.visitMethodInsn(INVOKESPECIAL, "p/C", "<init>", "()V");
  69.145              mv.visitInsn(RETURN);
  69.146              mv.visitMaxs(0, 0);
  69.147              mv.visitEnd();
  69.148 @@ -74,70 +151,346 @@
  69.149          return cw.toByteArray();
  69.150      }
  69.151  
  69.152 +    /**
  69.153 +     * The bytes for D, implements I, does not extend C, declares m()I with
  69.154 +     * access method_acc.
  69.155 +     *
  69.156 +     * @param d_name Name of class defined
  69.157 +     * @param method_acc Accessibility of that class's method m.
  69.158 +     * @return
  69.159 +     * @throws Exception
  69.160 +     */
  69.161 +    public static byte[] bytesForDsomeAccess(String d_name, int method_acc) throws Exception {
  69.162 +        return bytesForSomeDsubSomethingSomeAccess(d_name, "java/lang/Object", method_acc);
  69.163 +    }
  69.164  
  69.165      /**
  69.166 -     * The bytecodes for an invokeExact of a particular methodHandle, I.m, invoked on a D
  69.167 +     * The bytes for D implements I, extends some class, declares m()I as
  69.168 +     * private.
  69.169 +     *
  69.170 +     * Invokeinterface of I.m applied to this D should throw IllegalAccessError
  69.171 +     *
  69.172 +     * @param sub_what The name of the class that D will extend.
  69.173 +     * @return
  69.174 +     * @throws Exception
  69.175 +     */
  69.176 +    public static byte[] bytesForDprivateSubWhat(String sub_what) throws Exception {
  69.177 +        return bytesForSomeDsubSomethingSomeAccess("p/D", sub_what, ACC_PRIVATE);
  69.178 +    }
  69.179  
  69.180 -        class T {
  69.181 -           T() { super(); } // boring constructor
  69.182 -           int test() {
  69.183 -              MethodHandle mh = `I.m():int`;
  69.184 -              D d = new D();
  69.185 -              return mh.invokeExact(d); // Should explode here, AbstractMethodError
  69.186 -           }
  69.187 +    /**
  69.188 +     * Returns the bytes for a class with name d_name (presumably "D" in some
  69.189 +     * package), extending some class with name sub_what, implementing p.I,
  69.190 +     * and defining two methods m() and m(11args) with access method_acc.
  69.191 +     *
  69.192 +     * @param d_name      Name of class that is defined
  69.193 +     * @param sub_what    Name of class that it extends
  69.194 +     * @param method_acc  Accessibility of method(s) m in defined class.
  69.195 +     * @return
  69.196 +     * @throws Exception
  69.197 +     */
  69.198 +    public static byte[] bytesForSomeDsubSomethingSomeAccess
  69.199 +            (String d_name, String sub_what, int method_acc)
  69.200 +            throws Exception {
  69.201 +
  69.202 +        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES
  69.203 +                | ClassWriter.COMPUTE_MAXS);
  69.204 +        MethodVisitor mv;
  69.205 +        String[] interfaces = {"p/I"};
  69.206 +
  69.207 +        cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, d_name, null, sub_what, interfaces);
  69.208 +        {
  69.209 +            mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
  69.210 +            mv.visitCode();
  69.211 +            mv.visitVarInsn(ALOAD, 0);
  69.212 +            mv.visitMethodInsn(INVOKESPECIAL, sub_what, "<init>", "()V");
  69.213 +            mv.visitInsn(RETURN);
  69.214 +            mv.visitMaxs(0, 0);
  69.215 +            mv.visitEnd();
  69.216          }
  69.217 +        // int m() {return 3;}
  69.218 +        {
  69.219 +            mv = cw.visitMethod(method_acc, "m", "()I", null, null);
  69.220 +            mv.visitCode();
  69.221 +            mv.visitLdcInsn(new Integer(3));
  69.222 +            mv.visitInsn(IRETURN);
  69.223 +            mv.visitMaxs(0, 0);
  69.224 +            mv.visitEnd();
  69.225 +        }
  69.226 +        // int m(11args) {return 3;}
  69.227 +        {
  69.228 +            mv = cw.visitMethod(method_acc, "m", "(BCSIJ"
  69.229 +                    + "Ljava/lang/Object;"
  69.230 +                    + "Ljava/lang/Object;"
  69.231 +                    + "Ljava/lang/Object;"
  69.232 +                    + "Ljava/lang/Object;"
  69.233 +                    + "Ljava/lang/Object;"
  69.234 +                    + "Ljava/lang/Object;"
  69.235 +                    + ")I", null, null);
  69.236 +            mv.visitCode();
  69.237 +            mv.visitLdcInsn(new Integer(3));
  69.238 +            mv.visitInsn(IRETURN);
  69.239 +            mv.visitMaxs(0, 0);
  69.240 +            mv.visitEnd();
  69.241 +        }
  69.242 +        cw.visitEnd();
  69.243 +        return cw.toByteArray();
  69.244 +    }
  69.245  
  69.246 +    /**
  69.247 +     * The bytecodes for a class p/T defining a methods test() and test(11args)
  69.248 +     * that contain an invokeExact of a particular methodHandle, I.m.
  69.249 +     *
  69.250 +     * Test will be passed values that may imperfectly implement I,
  69.251 +     * and thus may in turn throw exceptions.
  69.252 +     *
  69.253       * @return
  69.254       * @throws Exception
  69.255       */
  69.256      public static byte[] bytesForT() throws Exception {
  69.257  
  69.258 -        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS);
  69.259 +        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES
  69.260 +                | ClassWriter.COMPUTE_MAXS);
  69.261          MethodVisitor mv;
  69.262  
  69.263 -        cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, "T", null, "java/lang/Object", null);
  69.264 +        cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, "p/T", null, "java/lang/Object", null);
  69.265          {
  69.266              mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
  69.267              mv.visitCode();
  69.268              mv.visitVarInsn(ALOAD, 0);
  69.269              mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
  69.270              mv.visitInsn(RETURN);
  69.271 -            mv.visitMaxs(0,0);
  69.272 +            mv.visitMaxs(0, 0);
  69.273              mv.visitEnd();
  69.274          }
  69.275 +        // static int test(I)
  69.276          {
  69.277 -            mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "test", "()I", null, null);
  69.278 +            mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "test", "(Lp/I;)I", null, null);
  69.279              mv.visitCode();
  69.280 -            mv.visitLdcInsn(new Handle(Opcodes.H_INVOKEINTERFACE, "I", "m", "()I"));
  69.281 -            mv.visitTypeInsn(NEW, "D");
  69.282 -            mv.visitInsn(DUP);
  69.283 -            mv.visitMethodInsn(INVOKESPECIAL, "D", "<init>", "()V");
  69.284 -            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle", "invokeExact", "(LI;)I");
  69.285 +            mv.visitLdcInsn(new Handle(Opcodes.H_INVOKEINTERFACE, "p/I", "m", "()I"));
  69.286 +            mv.visitVarInsn(ALOAD, 0);
  69.287 +            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle",
  69.288 +                    "invokeExact", "(Lp/I;)I");
  69.289              mv.visitInsn(IRETURN);
  69.290 -            mv.visitMaxs(0,0);
  69.291 +            mv.visitMaxs(0, 0);
  69.292 +            mv.visitEnd();
  69.293 +        }
  69.294 +        // static int test(I,11args)
  69.295 +        {
  69.296 +            mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "test", "(Lp/I;BCSIJLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)I", null, null);
  69.297 +            mv.visitCode();
  69.298 +            mv.visitLdcInsn(new Handle(Opcodes.H_INVOKEINTERFACE, "p/I", "m", "(BCSIJLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)I"));
  69.299 +            mv.visitVarInsn(ALOAD, 0);
  69.300 +            mv.visitVarInsn(ILOAD, 1);
  69.301 +            mv.visitVarInsn(ILOAD, 2);
  69.302 +            mv.visitVarInsn(ILOAD, 3);
  69.303 +            mv.visitVarInsn(ILOAD, 4);
  69.304 +            mv.visitVarInsn(LLOAD, 5);
  69.305 +            mv.visitVarInsn(ALOAD, 7);
  69.306 +            mv.visitVarInsn(ALOAD, 8);
  69.307 +            mv.visitVarInsn(ALOAD, 9);
  69.308 +            mv.visitVarInsn(ALOAD, 10);
  69.309 +            mv.visitVarInsn(ALOAD, 11);
  69.310 +            mv.visitVarInsn(ALOAD, 12);
  69.311 +            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle",
  69.312 +                    "invokeExact", "(Lp/I;BCSIJLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)I");
  69.313 +            mv.visitInsn(IRETURN);
  69.314 +            mv.visitMaxs(0, 0);
  69.315              mv.visitEnd();
  69.316          }
  69.317          cw.visitEnd();
  69.318          return cw.toByteArray();
  69.319      }
  69.320  
  69.321 -    public static void main(String args[] ) throws Throwable {
  69.322 -        ByteClassLoader bcl = new ByteClassLoader();
  69.323 -        Class<?> d = bcl.loadBytes("D", bytesForD());
  69.324 -        Class<?> t = bcl.loadBytes("T", bytesForT());
  69.325 +    private static void tryAndCheckThrown(
  69.326 +            List<Throwable> lt, byte[] dBytes, String what, Class<?> expected, String jar_name)
  69.327 +            throws Throwable {
  69.328 +        tryAndCheckThrown(lt, "p.D", dBytes, what, expected, jar_name);
  69.329 +    }
  69.330 +
  69.331 +    private static void tryAndCheckThrown(List<Throwable> lt, String d_name, byte[] dBytes, String what, Class<?> expected, String jar_name)
  69.332 +            throws Throwable {
  69.333 +
  69.334 +        System.out.println("Methodhandle invokeExact I.m() for instance of " + what);
  69.335 +        ByteClassLoader bcl1 = new ByteClassLoader(jar_name, readJarFiles, writeJarFiles);
  69.336          try {
  69.337 -          Object result = t.getMethod("test").invoke(null);
  69.338 -          System.out.println("Expected AbstractMethodError wrapped in InvocationTargetException, saw no exception");
  69.339 -          throw new Error("Missing expected exception");
  69.340 +            Class<?> d1 = bcl1.loadBytes(d_name, dBytes);
  69.341 +            Class<?> t1 = bcl1.loadBytes("p.T", bytesForT());
  69.342 +            invokeTest(t1, d1, expected, lt);
  69.343 +        } finally {
  69.344 +            // Not necessary for others -- all class files are written in this call.
  69.345 +            // (unless the VM crashes first).
  69.346 +            bcl1.close();
  69.347 +        }
  69.348 +
  69.349 +        System.out.println("Reflection invoke I.m() for instance of " + what);
  69.350 +        ByteClassLoader bcl3 = new ByteClassLoader(jar_name, readJarFiles, false);
  69.351 +        Class<?> d3 = bcl3.loadBytes(d_name, dBytes);
  69.352 +        Class<?> t3 = bcl3.loadClass("p.Treflect");
  69.353 +        invokeTest(t3, d3, expected, lt);
  69.354 +
  69.355 +        System.out.println("Bytecode invokeInterface I.m() for instance of " + what);
  69.356 +        ByteClassLoader bcl2 = new ByteClassLoader(jar_name, readJarFiles, false);
  69.357 +        Class<?> d2 = bcl2.loadBytes(d_name, dBytes);
  69.358 +        Class<?> t2 = bcl2.loadClass("p.Tdirect");
  69.359 +        badGoodBadGood(t2, d2, expected, lt);
  69.360 +    }
  69.361 +
  69.362 +    private static void invokeTest(Class<?> t, Class<?> d, Class<?> expected, List<Throwable> lt)
  69.363 +            throws Throwable {
  69.364 +        try {
  69.365 +            Method m = t.getMethod("test", p.I.class);
  69.366 +            Object o = d.newInstance();
  69.367 +            Object result = m.invoke(null, o);
  69.368 +            if (expected != null) {
  69.369 +                System.out.println("FAIL, Expected " + expected.getName()
  69.370 +                        + " wrapped in InvocationTargetException, but nothing was thrown");
  69.371 +                lt.add(new Error("Exception " + expected.getName() + " was not thrown"));
  69.372 +            } else {
  69.373 +                System.out.println("PASS, saw expected return.");
  69.374 +            }
  69.375          } catch (InvocationTargetException e) {
  69.376              Throwable th = e.getCause();
  69.377 -            if (th instanceof AbstractMethodError) {
  69.378 -                th.printStackTrace(System.out);
  69.379 -                System.out.println("PASS, saw expected exception (AbstractMethodError, wrapped in InvocationTargetException).");
  69.380 +            th.printStackTrace(System.out);
  69.381 +            if (expected != null) {
  69.382 +                if (expected.isInstance(th)) {
  69.383 +                    System.out.println("PASS, saw expected exception (" + expected.getName() + ").");
  69.384 +                } else {
  69.385 +                    System.out.println("FAIL, Expected " + expected.getName()
  69.386 +                            + " wrapped in InvocationTargetException, saw " + th);
  69.387 +                    lt.add(th);
  69.388 +                }
  69.389              } else {
  69.390 -                System.out.println("Expected AbstractMethodError wrapped in InvocationTargetException, saw " + th);
  69.391 -                throw th;
  69.392 +                System.out.println("FAIL, expected no exception, saw " + th);
  69.393 +                lt.add(th);
  69.394              }
  69.395          }
  69.396 +        System.out.println();
  69.397 +    }
  69.398 +
  69.399 +    /* Many-arg versions of above */
  69.400 +    private static void tryAndCheckThrownMany(List<Throwable> lt, byte[] dBytes, String what, Class<?> expected)
  69.401 +            throws Throwable {
  69.402 +
  69.403 +        System.out.println("Methodhandle invokeExact I.m(11params) for instance of " + what);
  69.404 +        ByteClassLoader bcl1 = new ByteClassLoader("p.D", readJarFiles, false);
  69.405 +        try {
  69.406 +            Class<?> d1 = bcl1.loadBytes("p.D", dBytes);
  69.407 +            Class<?> t1 = bcl1.loadBytes("p.T", bytesForT());
  69.408 +            invokeTestMany(t1, d1, expected, lt);
  69.409 +        } finally {
  69.410 +            bcl1.close(); // Not necessary for others -- all class files are written in this call.
  69.411 +        }
  69.412 +
  69.413 +        {
  69.414 +            System.out.println("Bytecode invokeInterface I.m(11params) for instance of " + what);
  69.415 +            ByteClassLoader bcl2 = new ByteClassLoader("pD_m_pri_imp_pI", readJarFiles, false);
  69.416 +            Class<?> d2 = bcl2.loadBytes("p.D", dBytes);
  69.417 +            Class<?> t2 = bcl2.loadClass("p.Tdirect");
  69.418 +            badGoodBadGoodMany(t2, d2, expected, lt);
  69.419 +
  69.420 +        }
  69.421 +        {
  69.422 +            System.out.println("Reflection invokeInterface I.m(11params) for instance of " + what);
  69.423 +            ByteClassLoader bcl2 = new ByteClassLoader("pD_m_pri_imp_pI", readJarFiles, false);
  69.424 +            Class<?> d2 = bcl2.loadBytes("p.D", dBytes);
  69.425 +            Class<?> t2 = bcl2.loadClass("p.Treflect");
  69.426 +            invokeTestMany(t2, d2, expected, lt);
  69.427 +        }
  69.428 +    }
  69.429 +
  69.430 +    private static void invokeTestMany(Class<?> t, Class<?> d, Class<?> expected, List<Throwable> lt)
  69.431 +            throws Throwable {
  69.432 +        try {
  69.433 +            Method m = t.getMethod("test", p.I.class,
  69.434 +                    Byte.TYPE, Character.TYPE, Short.TYPE, Integer.TYPE, Long.TYPE,
  69.435 +                    Object.class, Object.class, Object.class,
  69.436 +                    Object.class, Object.class, Object.class);
  69.437 +            Object o = d.newInstance();
  69.438 +            Byte b = 1;
  69.439 +            Character c = 2;
  69.440 +            Short s = 3;
  69.441 +            Integer i = 4;
  69.442 +            Long j = 5L;
  69.443 +            Object o1 = b;
  69.444 +            Object o2 = c;
  69.445 +            Object o3 = s;
  69.446 +            Object o4 = i;
  69.447 +            Object o5 = j;
  69.448 +            Object o6 = "6";
  69.449 +
  69.450 +            Object result = m.invoke(null, o, b, c, s, i, j,
  69.451 +                    o1, o2, o3, o4, o5, o6);
  69.452 +            if (expected != null) {
  69.453 +                System.out.println("FAIL, Expected " + expected.getName()
  69.454 +                        + " wrapped in InvocationTargetException, but nothing was thrown");
  69.455 +                lt.add(new Error("Exception " + expected.getName()
  69.456 +                        + " was not thrown"));
  69.457 +            } else {
  69.458 +                System.out.println("PASS, saw expected return.");
  69.459 +            }
  69.460 +        } catch (InvocationTargetException e) {
  69.461 +            Throwable th = e.getCause();
  69.462 +            th.printStackTrace(System.out);
  69.463 +            if (expected != null) {
  69.464 +                if (expected.isInstance(th)) {
  69.465 +                    System.out.println("PASS, saw expected exception ("
  69.466 +                            + expected.getName() + ").");
  69.467 +                } else {
  69.468 +                    System.out.println("FAIL, Expected " + expected.getName()
  69.469 +                            + " wrapped in InvocationTargetException, saw " + th);
  69.470 +                    lt.add(th);
  69.471 +                }
  69.472 +            } else {
  69.473 +                System.out.println("FAIL, expected no exception, saw " + th);
  69.474 +                lt.add(th);
  69.475 +            }
  69.476 +        }
  69.477 +        System.out.println();
  69.478 +    }
  69.479 +
  69.480 +    /**
  69.481 +     * This tests a peculiar idiom for tickling the bug on older VMs that lack
  69.482 +     * methodhandles.  The bug (if not fixed) acts in the following way:
  69.483 +     *
  69.484 +     *  When a broken receiver is passed to the first execution of an invokeinterface
  69.485 +     * bytecode, the illegal access is detected before the effects of resolution are
  69.486 +     * cached for later use, and so repeated calls with a broken receiver will always
  69.487 +     * throw the correct error.
  69.488 +     *
  69.489 +     * If, however, a good receiver is passed to the invokeinterface, the effects of
  69.490 +     * resolution will be successfully cached.  A subsequent execution with a broken
  69.491 +     * receiver will reuse the cached information, skip the detailed resolution work,
  69.492 +     * and instead encounter a null pointer.  By convention, that is the encoding for a
  69.493 +     * missing abstract method, and an AbstractMethodError is thrown -- not the expected
  69.494 +     * IllegalAccessError.
  69.495 +     *
  69.496 +     * @param t2 Test invocation class
  69.497 +     * @param d2 Test receiver class
  69.498 +     * @param expected expected exception type
  69.499 +     * @param lt list of unexpected throwables seen
  69.500 +     */
  69.501 +    private static void badGoodBadGood(Class<?> t2, Class<?> d2, Class<?> expected, List<Throwable> lt)
  69.502 +            throws Throwable {
  69.503 +        System.out.println("  Error input 1st time");
  69.504 +        invokeTest(t2, d2, expected, lt);
  69.505 +        System.out.println("  Good input (instance of Dok)");
  69.506 +        invokeTest(t2, Dok.class, null, lt);
  69.507 +        System.out.println("  Error input 2nd time");
  69.508 +        invokeTest(t2, d2, expected, lt);
  69.509 +        System.out.println("  Good input (instance of Dok)");
  69.510 +        invokeTest(t2, Dok.class, null, lt);
  69.511 +    }
  69.512 +
  69.513 +    private static void badGoodBadGoodMany(Class<?> t2, Class<?> d2, Class<?> expected, List<Throwable> lt)
  69.514 +            throws Throwable {
  69.515 +        System.out.println("  Error input 1st time");
  69.516 +        invokeTestMany(t2, d2, expected, lt);
  69.517 +        System.out.println("  Good input (instance of Dok)");
  69.518 +        invokeTestMany(t2, Dok.class, null, lt);
  69.519 +        System.out.println("  Error input 2nd time");
  69.520 +        invokeTestMany(t2, d2, expected, lt);
  69.521 +        System.out.println("  Good input (instance of Dok)");
  69.522 +        invokeTestMany(t2, Dok.class, null, lt);
  69.523      }
  69.524  }
    70.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    70.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/C.java	Thu Dec 05 15:13:12 2013 -0800
    70.3 @@ -0,0 +1,35 @@
    70.4 +/*
    70.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    70.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    70.7 + *
    70.8 + * This code is free software; you can redistribute it and/or modify it
    70.9 + * under the terms of the GNU General Public License version 2 only, as
   70.10 + * published by the Free Software Foundation.
   70.11 + *
   70.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   70.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   70.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   70.15 + * version 2 for more details (a copy is included in the LICENSE file that
   70.16 + * accompanied this code).
   70.17 + *
   70.18 + * You should have received a copy of the GNU General Public License version
   70.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   70.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   70.21 + *
   70.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   70.23 + * or visit www.oracle.com if you need additional information or have any
   70.24 + * questions.
   70.25 + *
   70.26 + */
   70.27 +
   70.28 +package p;
   70.29 +
   70.30 +/**
   70.31 + * Test class -- implements I, which provides default for m, but this class
   70.32 + * declares it abstract which (should) hide the interface default, and throw
   70.33 + * an abstract method error if called.
   70.34 + *
   70.35 + */
   70.36 +public abstract class C implements p.I {
   70.37 +       public abstract int m();
   70.38 +}
    71.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    71.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/Dok.java	Thu Dec 05 15:13:12 2013 -0800
    71.3 @@ -0,0 +1,31 @@
    71.4 +/*
    71.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    71.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    71.7 + *
    71.8 + * This code is free software; you can redistribute it and/or modify it
    71.9 + * under the terms of the GNU General Public License version 2 only, as
   71.10 + * published by the Free Software Foundation.
   71.11 + *
   71.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   71.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   71.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   71.15 + * version 2 for more details (a copy is included in the LICENSE file that
   71.16 + * accompanied this code).
   71.17 + *
   71.18 + * You should have received a copy of the GNU General Public License version
   71.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   71.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   71.21 + *
   71.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   71.23 + * or visit www.oracle.com if you need additional information or have any
   71.24 + * questions.
   71.25 + *
   71.26 + */
   71.27 +package p;
   71.28 +
   71.29 +/**
   71.30 + * Test class -- implements I, extends E, both define m, so all should be well.
   71.31 + */
   71.32 +public class Dok extends p.E {
   71.33 +
   71.34 +}
    72.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    72.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/E.java	Thu Dec 05 15:13:12 2013 -0800
    72.3 @@ -0,0 +1,38 @@
    72.4 +/*
    72.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    72.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    72.7 + *
    72.8 + * This code is free software; you can redistribute it and/or modify it
    72.9 + * under the terms of the GNU General Public License version 2 only, as
   72.10 + * published by the Free Software Foundation.
   72.11 + *
   72.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   72.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   72.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   72.15 + * version 2 for more details (a copy is included in the LICENSE file that
   72.16 + * accompanied this code).
   72.17 + *
   72.18 + * You should have received a copy of the GNU General Public License version
   72.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   72.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   72.21 + *
   72.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   72.23 + * or visit www.oracle.com if you need additional information or have any
   72.24 + * questions.
   72.25 + *
   72.26 + */
   72.27 +
   72.28 +package p;
   72.29 +
   72.30 +/**
   72.31 + * Test class -- implements I, which provides default for m, but this class
   72.32 + * redeclares it so that all its non-overriding descendants should call its
   72.33 + * method instead (with no error, assuming no descendant monkey business, which
   72.34 + * of course is NOT usually the case in this test).
   72.35 + *
   72.36 + */
   72.37 +public abstract class E implements p.I {
   72.38 +       public int m() {
   72.39 +           return 2;
   72.40 +       }
   72.41 +}
    73.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    73.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/F.java	Thu Dec 05 15:13:12 2013 -0800
    73.3 @@ -0,0 +1,41 @@
    73.4 +/*
    73.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    73.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    73.7 + *
    73.8 + * This code is free software; you can redistribute it and/or modify it
    73.9 + * under the terms of the GNU General Public License version 2 only, as
   73.10 + * published by the Free Software Foundation.
   73.11 + *
   73.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   73.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   73.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   73.15 + * version 2 for more details (a copy is included in the LICENSE file that
   73.16 + * accompanied this code).
   73.17 + *
   73.18 + * You should have received a copy of the GNU General Public License version
   73.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   73.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   73.21 + *
   73.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   73.23 + * or visit www.oracle.com if you need additional information or have any
   73.24 + * questions.
   73.25 + *
   73.26 + */
   73.27 +
   73.28 +package p;
   73.29 +
   73.30 +/**
   73.31 + * Test class -- implements I, which provides default for m, but this class
   73.32 + * redeclares it so that all its non-overriding descendants should call its
   73.33 + * method instead (with no error, assuming no descendant monkey business, which
   73.34 + * of course is NOT usually the case in this test).
   73.35 + *
   73.36 + * Note that m is final -- one form of monkey business is attempting to redefine
   73.37 + * m.
   73.38 + *
   73.39 + */
   73.40 +public abstract class F implements p.I {
   73.41 +       final public int m() {
   73.42 +           return 2;
   73.43 +       }
   73.44 +}
    74.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    74.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/I.java	Thu Dec 05 15:13:12 2013 -0800
    74.3 @@ -0,0 +1,37 @@
    74.4 +/*
    74.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    74.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    74.7 + *
    74.8 + * This code is free software; you can redistribute it and/or modify it
    74.9 + * under the terms of the GNU General Public License version 2 only, as
   74.10 + * published by the Free Software Foundation.
   74.11 + *
   74.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   74.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   74.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   74.15 + * version 2 for more details (a copy is included in the LICENSE file that
   74.16 + * accompanied this code).
   74.17 + *
   74.18 + * You should have received a copy of the GNU General Public License version
   74.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   74.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   74.21 + *
   74.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   74.23 + * or visit www.oracle.com if you need additional information or have any
   74.24 + * questions.
   74.25 + *
   74.26 + */
   74.27 +
   74.28 +package p;
   74.29 +
   74.30 +/**
   74.31 + * Test interface I, provides default implementations for m() and m(11args).
   74.32 + */
   74.33 +
   74.34 +public interface I {
   74.35 +    default public int m() { return 1; }
   74.36 +    default public int m(byte b, char c, short s, int i, long l,
   74.37 +           Object o1, Object o2, Object o3, Object o4, Object o5, Object o6) {
   74.38 +        return 2;
   74.39 +    }
   74.40 +}
    75.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    75.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/Tdirect.java	Thu Dec 05 15:13:12 2013 -0800
    75.3 @@ -0,0 +1,47 @@
    75.4 +/*
    75.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    75.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    75.7 + *
    75.8 + * This code is free software; you can redistribute it and/or modify it
    75.9 + * under the terms of the GNU General Public License version 2 only, as
   75.10 + * published by the Free Software Foundation.
   75.11 + *
   75.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   75.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   75.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   75.15 + * version 2 for more details (a copy is included in the LICENSE file that
   75.16 + * accompanied this code).
   75.17 + *
   75.18 + * You should have received a copy of the GNU General Public License version
   75.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   75.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   75.21 + *
   75.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   75.23 + * or visit www.oracle.com if you need additional information or have any
   75.24 + * questions.
   75.25 + *
   75.26 + */
   75.27 +
   75.28 +package p;
   75.29 +
   75.30 +/**
   75.31 + * Invokes I.m directly using invokeInterface bytecodes.
   75.32 + */
   75.33 +public class Tdirect {
   75.34 +     public static int test(p.I i) {
   75.35 +         int accum = 0;
   75.36 +         for (int j = 0; j < 100000; j++) {
   75.37 +             accum += i.m();
   75.38 +         }
   75.39 +        return accum;
   75.40 +    }
   75.41 +
   75.42 +     public static int test(p.I ii, byte b, char c, short s, int i, long l,
   75.43 +             Object o1, Object o2, Object o3, Object o4, Object o5, Object o6) {
   75.44 +         int accum = 0;
   75.45 +         for (int j = 0; j < 100000; j++) {
   75.46 +           accum += ii.m(b,c,s,i,l,o1,o2,o3,o4,o5,o6);
   75.47 +         }
   75.48 +         return accum;
   75.49 +     }
   75.50 +}
    76.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    76.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/Treflect.java	Thu Dec 05 15:13:12 2013 -0800
    76.3 @@ -0,0 +1,66 @@
    76.4 +/*
    76.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    76.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    76.7 + *
    76.8 + * This code is free software; you can redistribute it and/or modify it
    76.9 + * under the terms of the GNU General Public License version 2 only, as
   76.10 + * published by the Free Software Foundation.
   76.11 + *
   76.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   76.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   76.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   76.15 + * version 2 for more details (a copy is included in the LICENSE file that
   76.16 + * accompanied this code).
   76.17 + *
   76.18 + * You should have received a copy of the GNU General Public License version
   76.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   76.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   76.21 + *
   76.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   76.23 + * or visit www.oracle.com if you need additional information or have any
   76.24 + * questions.
   76.25 + *
   76.26 + */
   76.27 +package p;
   76.28 +
   76.29 +import java.lang.reflect.InvocationTargetException;
   76.30 +import java.lang.reflect.Method;
   76.31 +
   76.32 +/**
   76.33 + * Invokes I.m using reflection.
   76.34 + */
   76.35 +public class Treflect {
   76.36 +
   76.37 +    public static int test(p.I ii) throws Throwable {
   76.38 +        int accum = 0;
   76.39 +        Method m = p.I.class.getMethod("m");
   76.40 +        try {
   76.41 +            for (int j = 0; j < 100000; j++) {
   76.42 +                Object o = m.invoke(ii);
   76.43 +                accum += ((Integer) o).intValue();
   76.44 +            }
   76.45 +        } catch (InvocationTargetException ite) {
   76.46 +            throw ite.getCause();
   76.47 +        }
   76.48 +        return accum;
   76.49 +    }
   76.50 +
   76.51 +    public static int test(p.I ii, byte b, char c, short s, int i, long l,
   76.52 +            Object o1, Object o2, Object o3, Object o4, Object o5, Object o6)
   76.53 +            throws Throwable {
   76.54 +        Method m = p.I.class.getMethod("m", Byte.TYPE, Character.TYPE,
   76.55 +                Short.TYPE, Integer.TYPE, Long.TYPE,
   76.56 +                Object.class, Object.class, Object.class,
   76.57 +                Object.class, Object.class, Object.class);
   76.58 +        int accum = 0;
   76.59 +        try {
   76.60 +            for (int j = 0; j < 100000; j++) {
   76.61 +                Object o = m.invoke(ii, b, c, s, i, l, o1, o2, o3, o4, o5, o6);
   76.62 +                accum += ((Integer) o).intValue();
   76.63 +            }
   76.64 +        } catch (InvocationTargetException ite) {
   76.65 +            throw ite.getCause();
   76.66 +        }
   76.67 +        return accum;
   76.68 +    }
   76.69 +}
    77.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    77.2 +++ b/test/compiler/uncommontrap/TestStackBangRbp.java	Thu Dec 05 15:13:12 2013 -0800
    77.3 @@ -0,0 +1,294 @@
    77.4 +/*
    77.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    77.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    77.7 + *
    77.8 + * This code is free software; you can redistribute it and/or modify it
    77.9 + * under the terms of the GNU General Public License version 2 only, as
   77.10 + * published by the Free Software Foundation.
   77.11 + *
   77.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   77.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   77.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   77.15 + * version 2 for more details (a copy is included in the LICENSE file that
   77.16 + * accompanied this code).
   77.17 + *
   77.18 + * You should have received a copy of the GNU General Public License version
   77.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   77.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   77.21 + *
   77.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   77.23 + * or visit www.oracle.com if you need additional information or have any
   77.24 + * questions.
   77.25 + */
   77.26 +
   77.27 +/*
   77.28 + * @test
   77.29 + * @bug 8028308
   77.30 + * @summary rbp not restored when stack overflow is thrown from deopt/uncommon trap blobs
   77.31 + * @run main/othervm -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestStackBangRbp::m1 -XX:CompileCommand=exclude,TestStackBangRbp::m2 -Xss256K -XX:-UseOnStackReplacement TestStackBangRbp
   77.32 + *
   77.33 + */
   77.34 +public class TestStackBangRbp {
   77.35 +
   77.36 +    static class UnloadedClass1 {
   77.37 +    }
   77.38 +
   77.39 +    static class UnloadedClass2 {
   77.40 +    }
   77.41 +
   77.42 +    static Object m1(boolean deopt) {
   77.43 +        long l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12,
   77.44 +        l13, l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24,
   77.45 +        l25, l26, l27, l28, l29, l30, l31, l32, l33, l34, l35, l36,
   77.46 +        l37, l38, l39, l40, l41, l42, l43, l44, l45, l46, l47, l48,
   77.47 +        l49, l50, l51, l52, l53, l54, l55, l56, l57, l58, l59, l60,
   77.48 +        l61, l62, l63, l64, l65, l66, l67, l68, l69, l70, l71, l72,
   77.49 +        l73, l74, l75, l76, l77, l78, l79, l80, l81, l82, l83, l84,
   77.50 +        l85, l86, l87, l88, l89, l90, l91, l92, l93, l94, l95, l96,
   77.51 +        l97, l98, l99, l100, l101, l102, l103, l104, l105, l106, l107,
   77.52 +        l108, l109, l110, l111, l112, l113, l114, l115, l116, l117,
   77.53 +        l118, l119, l120, l121, l122, l123, l124, l125, l126, l127,
   77.54 +        l128, l129, l130, l131, l132, l133, l134, l135, l136, l137,
   77.55 +        l138, l139, l140, l141, l142, l143, l144, l145, l146, l147,
   77.56 +        l148, l149, l150, l151, l152, l153, l154, l155, l156, l157,
   77.57 +        l158, l159, l160, l161, l162, l163, l164, l165, l166, l167,
   77.58 +        l168, l169, l170, l171, l172, l173, l174, l175, l176, l177,
   77.59 +        l178, l179, l180, l181, l182, l183, l184, l185, l186, l187,
   77.60 +        l188, l189, l190, l191, l192, l193, l194, l195, l196, l197,
   77.61 +        l198, l199, l200, l201, l202, l203, l204, l205, l206, l207,
   77.62 +        l208, l209, l210, l211, l212, l213, l214, l215, l216, l217,
   77.63 +        l218, l219, l220, l221, l222, l223, l224, l225, l226, l227,
   77.64 +        l228, l229, l230, l231, l232, l233, l234, l235, l236, l237,
   77.65 +        l238, l239, l240, l241, l242, l243, l244, l245, l246, l247,
   77.66 +        l248, l249, l250, l251, l252, l253, l254, l255, l256, l257,
   77.67 +        l258, l259, l260, l261, l262, l263, l264, l265, l266, l267,
   77.68 +        l268, l269, l270, l271, l272, l273, l274, l275, l276, l277,
   77.69 +        l278, l279, l280, l281, l282, l283, l284, l285, l286, l287,
   77.70 +        l288, l289, l290, l291, l292, l293, l294, l295, l296, l297,
   77.71 +        l298, l299, l300, l301, l302, l303, l304, l305, l306, l307,
   77.72 +        l308, l309, l310, l311, l312, l313, l314, l315, l316, l317,
   77.73 +        l318, l319, l320, l321, l322, l323, l324, l325, l326, l327,
   77.74 +        l328, l329, l330, l331, l332, l333, l334, l335, l336, l337,
   77.75 +        l338, l339, l340, l341, l342, l343, l344, l345, l346, l347,
   77.76 +        l348, l349, l350, l351, l352, l353, l354, l355, l356, l357,
   77.77 +        l358, l359, l360, l361, l362, l363, l364, l365, l366, l367,
   77.78 +        l368, l369, l370, l371, l372, l373, l374, l375, l376, l377,
   77.79 +        l378, l379, l380, l381, l382, l383, l384, l385, l386, l387,
   77.80 +        l388, l389, l390, l391, l392, l393, l394, l395, l396, l397,
   77.81 +        l398, l399, l400, l401, l402, l403, l404, l405, l406, l407,
   77.82 +        l408, l409, l410, l411, l412, l413, l414, l415, l416, l417,
   77.83 +        l418, l419, l420, l421, l422, l423, l424, l425, l426, l427,
   77.84 +        l428, l429, l430, l431, l432, l433, l434, l435, l436, l437,
   77.85 +        l438, l439, l440, l441, l442, l443, l444, l445, l446, l447,
   77.86 +        l448, l449, l450, l451, l452, l453, l454, l455, l456, l457,
   77.87 +        l458, l459, l460, l461, l462, l463, l464, l465, l466, l467,
   77.88 +        l468, l469, l470, l471, l472, l473, l474, l475, l476, l477,
   77.89 +        l478, l479, l480, l481, l482, l483, l484, l485, l486, l487,
   77.90 +        l488, l489, l490, l491, l492, l493, l494, l495, l496, l497,
   77.91 +        l498, l499, l500, l501, l502, l503, l504, l505, l506, l507,
   77.92 +        l508, l509, l510, l511;
   77.93 +
   77.94 +        long ll0, ll1, ll2, ll3, ll4, ll5, ll6, ll7, ll8, ll9, ll10, ll11, ll12,
   77.95 +        ll13, ll14, ll15, ll16, ll17, ll18, ll19, ll20, ll21, ll22, ll23, ll24,
   77.96 +        ll25, ll26, ll27, ll28, ll29, ll30, ll31, ll32, ll33, ll34, ll35, ll36,
   77.97 +        ll37, ll38, ll39, ll40, ll41, ll42, ll43, ll44, ll45, ll46, ll47, ll48,
   77.98 +        ll49, ll50, ll51, ll52, ll53, ll54, ll55, ll56, ll57, ll58, ll59, ll60,
   77.99 +        ll61, ll62, ll63, ll64, ll65, ll66, ll67, ll68, ll69, ll70, ll71, ll72,
  77.100 +        ll73, ll74, ll75, ll76, ll77, ll78, ll79, ll80, ll81, ll82, ll83, ll84,
  77.101 +        ll85, ll86, ll87, ll88, ll89, ll90, ll91, ll92, ll93, ll94, ll95, ll96,
  77.102 +        ll97, ll98, ll99, ll100, ll101, ll102, ll103, ll104, ll105, ll106, ll107,
  77.103 +        ll108, ll109, ll110, ll111, ll112, ll113, ll114, ll115, ll116, ll117,
  77.104 +        ll118, ll119, ll120, ll121, ll122, ll123, ll124, ll125, ll126, ll127,
  77.105 +        ll128, ll129, ll130, ll131, ll132, ll133, ll134, ll135, ll136, ll137,
  77.106 +        ll138, ll139, ll140, ll141, ll142, ll143, ll144, ll145, ll146, ll147,
  77.107 +        ll148, ll149, ll150, ll151, ll152, ll153, ll154, ll155, ll156, ll157,
  77.108 +        ll158, ll159, ll160, ll161, ll162, ll163, ll164, ll165, ll166, ll167,
  77.109 +        ll168, ll169, ll170, ll171, ll172, ll173, ll174, ll175, ll176, ll177,
  77.110 +        ll178, ll179, ll180, ll181, ll182, ll183, ll184, ll185, ll186, ll187,
  77.111 +        ll188, ll189, ll190, ll191, ll192, ll193, ll194, ll195, ll196, ll197,
  77.112 +        ll198, ll199, ll200, ll201, ll202, ll203, ll204, ll205, ll206, ll207,
  77.113 +        ll208, ll209, ll210, ll211, ll212, ll213, ll214, ll215, ll216, ll217,
  77.114 +        ll218, ll219, ll220, ll221, ll222, ll223, ll224, ll225, ll226, ll227,
  77.115 +        ll228, ll229, ll230, ll231, ll232, ll233, ll234, ll235, ll236, ll237,
  77.116 +        ll238, ll239, ll240, ll241, ll242, ll243, ll244, ll245, ll246, ll247,
  77.117 +        ll248, ll249, ll250, ll251, ll252, ll253, ll254, ll255, ll256, ll257,
  77.118 +        ll258, ll259, ll260, ll261, ll262, ll263, ll264, ll265, ll266, ll267,
  77.119 +        ll268, ll269, ll270, ll271, ll272, ll273, ll274, ll275, ll276, ll277,
  77.120 +        ll278, ll279, ll280, ll281, ll282, ll283, ll284, ll285, ll286, ll287,
  77.121 +        ll288, ll289, ll290, ll291, ll292, ll293, ll294, ll295, ll296, ll297,
  77.122 +        ll298, ll299, ll300, ll301, ll302, ll303, ll304, ll305, ll306, ll307,
  77.123 +        ll308, ll309, ll310, ll311, ll312, ll313, ll314, ll315, ll316, ll317,
  77.124 +        ll318, ll319, ll320, ll321, ll322, ll323, ll324, ll325, ll326, ll327,
  77.125 +        ll328, ll329, ll330, ll331, ll332, ll333, ll334, ll335, ll336, ll337,
  77.126 +        ll338, ll339, ll340, ll341, ll342, ll343, ll344, ll345, ll346, ll347,
  77.127 +        ll348, ll349, ll350, ll351, ll352, ll353, ll354, ll355, ll356, ll357,
  77.128 +        ll358, ll359, ll360, ll361, ll362, ll363, ll364, ll365, ll366, ll367,
  77.129 +        ll368, ll369, ll370, ll371, ll372, ll373, ll374, ll375, ll376, ll377,
  77.130 +        ll378, ll379, ll380, ll381, ll382, ll383, ll384, ll385, ll386, ll387,
  77.131 +        ll388, ll389, ll390, ll391, ll392, ll393, ll394, ll395, ll396, ll397,
  77.132 +        ll398, ll399, ll400, ll401, ll402, ll403, ll404, ll405, ll406, ll407,
  77.133 +        ll408, ll409, ll410, ll411, ll412, ll413, ll414, ll415, ll416, ll417,
  77.134 +        ll418, ll419, ll420, ll421, ll422, ll423, ll424, ll425, ll426, ll427,
  77.135 +        ll428, ll429, ll430, ll431, ll432, ll433, ll434, ll435, ll436, ll437,
  77.136 +        ll438, ll439, ll440, ll441, ll442, ll443, ll444, ll445, ll446, ll447,
  77.137 +        ll448, ll449, ll450, ll451, ll452, ll453, ll454, ll455, ll456, ll457,
  77.138 +        ll458, ll459, ll460, ll461, ll462, ll463, ll464, ll465, ll466, ll467,
  77.139 +        ll468, ll469, ll470, ll471, ll472, ll473, ll474, ll475, ll476, ll477,
  77.140 +        ll478, ll479, ll480, ll481, ll482, ll483, ll484, ll485, ll486, ll487,
  77.141 +        ll488, ll489, ll490, ll491, ll492, ll493, ll494, ll495, ll496, ll497,
  77.142 +        ll498, ll499, ll500, ll501, ll502, ll503, ll504, ll505, ll506, ll507,
  77.143 +        ll508, ll509, ll510, ll511;
  77.144 +
  77.145 +        int i1 = TestStackBangRbp.i1;
  77.146 +        int i2 = TestStackBangRbp.i2;
  77.147 +        int i3 = TestStackBangRbp.i3;
  77.148 +        int i4 = TestStackBangRbp.i4;
  77.149 +        int i5 = TestStackBangRbp.i5;
  77.150 +        int i6 = TestStackBangRbp.i6;
  77.151 +        int i7 = TestStackBangRbp.i7;
  77.152 +        int i8 = TestStackBangRbp.i8;
  77.153 +        int i9 = TestStackBangRbp.i9;
  77.154 +        int i10 = TestStackBangRbp.i10;
  77.155 +        int i11 = TestStackBangRbp.i11;
  77.156 +        int i12 = TestStackBangRbp.i12;
  77.157 +        int i13 = TestStackBangRbp.i13;
  77.158 +        int i14 = TestStackBangRbp.i14;
  77.159 +        int i15 = TestStackBangRbp.i15;
  77.160 +        int i16 = TestStackBangRbp.i16;
  77.161 +
  77.162 +        TestStackBangRbp.i1 = i1;
  77.163 +        TestStackBangRbp.i2 = i2;
  77.164 +        TestStackBangRbp.i3 = i3;
  77.165 +        TestStackBangRbp.i4 = i4;
  77.166 +        TestStackBangRbp.i5 = i5;
  77.167 +        TestStackBangRbp.i6 = i6;
  77.168 +        TestStackBangRbp.i7 = i7;
  77.169 +        TestStackBangRbp.i8 = i8;
  77.170 +        TestStackBangRbp.i9 = i9;
  77.171 +        TestStackBangRbp.i10 = i10;
  77.172 +        TestStackBangRbp.i11 = i11;
  77.173 +        TestStackBangRbp.i12 = i12;
  77.174 +        TestStackBangRbp.i13 = i13;
  77.175 +        TestStackBangRbp.i14 = i14;
  77.176 +        TestStackBangRbp.i15 = i15;
  77.177 +        TestStackBangRbp.i16 = i16;
  77.178 +
  77.179 +        if (deopt) {
  77.180 +            // deoptimize with integer in rbp
  77.181 +            UnloadedClass1 res = new UnloadedClass1(); // forces deopt with c2
  77.182 +            return res;
  77.183 +        }
  77.184 +        return null;
  77.185 +    }
  77.186 +
  77.187 +    static boolean m2(boolean deopt) {
  77.188 +        // call m2 recursively until stack overflow. Then call m3 that
  77.189 +        // will call m1 and trigger and deopt in m1 while keeping a
  77.190 +        // lot of objects live in registers at the call to m1
  77.191 +
  77.192 +        long l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12,
  77.193 +        l13, l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24,
  77.194 +        l25, l26, l27, l28, l29, l30, l31, l32, l33, l34, l35, l36,
  77.195 +        l37, l38, l39, l40, l41, l42, l43, l44, l45, l46, l47, l48,
  77.196 +        l49, l50, l51, l52, l53, l54, l55, l56, l57, l58, l59, l60,
  77.197 +        l61, l62, l63, l64, l65, l66, l67, l68, l69, l70, l71, l72,
  77.198 +        l73, l74, l75, l76, l77, l78, l79, l80, l81, l82, l83, l84,
  77.199 +        l85, l86, l87, l88, l89, l90, l91, l92, l93, l94, l95, l96,
  77.200 +        l97, l98, l99, l100, l101, l102, l103, l104, l105, l106, l107,
  77.201 +        l108, l109, l110, l111, l112, l113, l114, l115, l116, l117,
  77.202 +        l118, l119, l120, l121, l122, l123, l124, l125, l126, l127,
  77.203 +        l128, l129, l130, l131, l132, l133, l134, l135, l136, l137,
  77.204 +        l138, l139, l140, l141, l142, l143, l144, l145, l146, l147,
  77.205 +        l148, l149, l150, l151, l152, l153, l154, l155, l156, l157,
  77.206 +        l158, l159, l160, l161, l162, l163, l164, l165, l166, l167,
  77.207 +        l168, l169, l170, l171, l172, l173, l174, l175, l176, l177,
  77.208 +        l178, l179, l180, l181, l182, l183, l184, l185, l186, l187,
  77.209 +        l188, l189, l190, l191, l192, l193, l194, l195, l196, l197,
  77.210 +        l198, l199, l200, l201, l202, l203, l204, l205, l206, l207,
  77.211 +        l208, l209, l210, l211, l212, l213, l214, l215, l216, l217,
  77.212 +        l218, l219, l220, l221, l222, l223, l224, l225, l226, l227,
  77.213 +        l228, l229, l230, l231, l232, l233, l234, l235, l236, l237,
  77.214 +        l238, l239, l240, l241, l242, l243, l244, l245, l246, l247,
  77.215 +        l248, l249, l250, l251, l252, l253, l254, l255, l256, l257,
  77.216 +        l258, l259, l260, l261, l262, l263, l264, l265, l266, l267,
  77.217 +        l268, l269, l270, l271, l272, l273, l274, l275, l276, l277,
  77.218 +        l278, l279, l280, l281, l282, l283, l284, l285, l286, l287,
  77.219 +        l288, l289, l290, l291, l292, l293, l294, l295, l296, l297,
  77.220 +        l298, l299, l300, l301, l302, l303, l304, l305, l306, l307,
  77.221 +        l308, l309, l310, l311, l312, l313, l314, l315, l316, l317,
  77.222 +        l318, l319, l320, l321, l322, l323, l324, l325, l326, l327,
  77.223 +        l328, l329, l330, l331, l332, l333, l334, l335, l336, l337,
  77.224 +        l338, l339, l340, l341, l342, l343, l344, l345, l346, l347,
  77.225 +        l348, l349, l350, l351, l352, l353, l354, l355, l356, l357,
  77.226 +        l358, l359, l360, l361, l362, l363, l364, l365, l366, l367,
  77.227 +        l368, l369, l370, l371, l372, l373, l374, l375, l376, l377,
  77.228 +        l378, l379, l380, l381, l382, l383, l384, l385, l386, l387,
  77.229 +        l388, l389, l390, l391, l392, l393, l394, l395, l396, l397,
  77.230 +        l398, l399, l400, l401, l402, l403, l404, l405, l406, l407,
  77.231 +        l408, l409, l410, l411, l412, l413, l414, l415, l416, l417,
  77.232 +        l418, l419, l420, l421, l422, l423, l424, l425, l426, l427,
  77.233 +        l428, l429, l430, l431, l432, l433, l434, l435, l436, l437,
  77.234 +        l438, l439, l440, l441, l442, l443, l444, l445, l446, l447,
  77.235 +        l448, l449, l450, l451, l452, l453, l454, l455, l456, l457,
  77.236 +        l458, l459, l460, l461, l462, l463, l464, l465, l466, l467,
  77.237 +        l468, l469, l470, l471, l472, l473, l474, l475, l476, l477,
  77.238 +        l478, l479, l480, l481, l482, l483, l484, l485, l486, l487,
  77.239 +        l488, l489, l490, l491, l492, l493, l494, l495, l496, l497,
  77.240 +        l498, l499, l500, l501, l502, l503, l504, l505, l506, l507,
  77.241 +        l508, l509, l510, l511;
  77.242 +
  77.243 +        boolean do_m3 = false;
  77.244 +        try {
  77.245 +            do_m3 = m2(deopt);
  77.246 +        } catch (StackOverflowError e) {
  77.247 +            return true;
  77.248 +        }
  77.249 +        if (do_m3) {
  77.250 +            m3(deopt);
  77.251 +        }
  77.252 +        return false;
  77.253 +    }
  77.254 +
  77.255 +    static volatile Object o1 = new Object();
  77.256 +
  77.257 +    static volatile int i1 = 1;
  77.258 +    static volatile int i2 = 2;
  77.259 +    static volatile int i3 = 3;
  77.260 +    static volatile int i4 = 4;
  77.261 +    static volatile int i5 = 5;
  77.262 +    static volatile int i6 = 6;
  77.263 +    static volatile int i7 = 7;
  77.264 +    static volatile int i8 = 8;
  77.265 +    static volatile int i9 = 9;
  77.266 +    static volatile int i10 = 10;
  77.267 +    static volatile int i11 = 11;
  77.268 +    static volatile int i12 = 12;
  77.269 +    static volatile int i13 = 13;
  77.270 +    static volatile int i14 = 14;
  77.271 +    static volatile int i15 = 15;
  77.272 +    static volatile int i16 = 16;
  77.273 +
  77.274 +    static void m3(boolean deopt) {
  77.275 +        Object o1 = TestStackBangRbp.o1;
  77.276 +        TestStackBangRbp.o1 = o1;
  77.277 +
  77.278 +        try {
  77.279 +            m1(deopt);
  77.280 +        } catch (StackOverflowError e) {
  77.281 +            // deoptimize again. rbp holds an integer. It should have an object.
  77.282 +            UnloadedClass2 res = new UnloadedClass2(); // forces deopt with c2
  77.283 +        }
  77.284 +        TestStackBangRbp.o1 = o1;
  77.285 +    }
  77.286 +
  77.287 +    static public void main(String[] args) {
  77.288 +        // get m1 & m3 compiled
  77.289 +        for (int i = 0; i < 20000; i++) {
  77.290 +            m1(false);
  77.291 +            m3(false);
  77.292 +        }
  77.293 +        m2(true);
  77.294 +
  77.295 +        System.out.println("TEST PASSED");
  77.296 +    }
  77.297 +}
    78.1 --- a/test/runtime/6626217/Test6626217.sh	Thu Dec 05 19:19:09 2013 +0100
    78.2 +++ b/test/runtime/6626217/Test6626217.sh	Thu Dec 05 15:13:12 2013 -0800
    78.3 @@ -21,7 +21,8 @@
    78.4  #  questions.
    78.5  # 
    78.6  
    78.7 - 
    78.8 +
    78.9 +# @ignore 8028733
   78.10  # @test @(#)Test6626217.sh
   78.11  # @bug 6626217
   78.12  # @summary Loader-constraint table allows arrays instead of only the base-classes
    79.1 --- a/test/runtime/6929067/Test6929067.sh	Thu Dec 05 19:19:09 2013 +0100
    79.2 +++ b/test/runtime/6929067/Test6929067.sh	Thu Dec 05 15:13:12 2013 -0800
    79.3 @@ -1,6 +1,7 @@
    79.4  #!/bin/sh
    79.5  
    79.6  ##
    79.7 +## @ignore 8028740
    79.8  ## @test Test6929067.sh
    79.9  ## @bug 6929067
   79.10  ## @bug 8021296
    80.1 --- a/test/runtime/CDSCompressedKPtrs/XShareAuto.java	Thu Dec 05 19:19:09 2013 +0100
    80.2 +++ b/test/runtime/CDSCompressedKPtrs/XShareAuto.java	Thu Dec 05 15:13:12 2013 -0800
    80.3 @@ -22,6 +22,7 @@
    80.4   */
    80.5  
    80.6  /*
    80.7 + * @ignore 8026154
    80.8   * @test
    80.9   * @bug 8005933
   80.10   * @summary Test that -Xshare:auto uses CDS when explicitly specified with -server.
    81.1 --- a/test/runtime/InitialThreadOverflow/testme.sh	Thu Dec 05 19:19:09 2013 +0100
    81.2 +++ b/test/runtime/InitialThreadOverflow/testme.sh	Thu Dec 05 15:13:12 2013 -0800
    81.3 @@ -21,6 +21,7 @@
    81.4  # or visit www.oracle.com if you need additional information or have any
    81.5  # questions.
    81.6  
    81.7 +# @ignore 8029139
    81.8  # @test testme.sh
    81.9  # @bug 8009062
   81.10  # @summary Poor performance of JNI AttachCurrentThread after fix for 7017193
    82.1 --- a/test/runtime/LoadClass/LoadClassNegative.java	Thu Dec 05 19:19:09 2013 +0100
    82.2 +++ b/test/runtime/LoadClass/LoadClassNegative.java	Thu Dec 05 15:13:12 2013 -0800
    82.3 @@ -22,6 +22,7 @@
    82.4   */
    82.5  
    82.6  /*
    82.7 + * @ignore 8028095
    82.8   * @test
    82.9   * @key regression
   82.10   * @bug 8020675
    83.1 --- a/test/runtime/XCheckJniJsig/XCheckJSig.java	Thu Dec 05 19:19:09 2013 +0100
    83.2 +++ b/test/runtime/XCheckJniJsig/XCheckJSig.java	Thu Dec 05 15:13:12 2013 -0800
    83.3 @@ -22,6 +22,7 @@
    83.4   */
    83.5  
    83.6  /*
    83.7 + * @ignore 8023735
    83.8   * @test
    83.9   * @bug 7051189 8023393
   83.10   * @summary Need to suppress info message if -Xcheck:jni is used with libjsig.so
    84.1 --- a/test/runtime/jsig/Test8017498.sh	Thu Dec 05 19:19:09 2013 +0100
    84.2 +++ b/test/runtime/jsig/Test8017498.sh	Thu Dec 05 15:13:12 2013 -0800
    84.3 @@ -24,6 +24,7 @@
    84.4  #
    84.5  
    84.6  ##
    84.7 +## @ignore 8028806
    84.8  ## @test Test8017498.sh
    84.9  ## @bug 8017498
   84.10  ## @bug 8020791
    85.1 --- a/test/runtime/memory/ReadFromNoaccessArea.java	Thu Dec 05 19:19:09 2013 +0100
    85.2 +++ b/test/runtime/memory/ReadFromNoaccessArea.java	Thu Dec 05 15:13:12 2013 -0800
    85.3 @@ -22,6 +22,7 @@
    85.4   */
    85.5  
    85.6  /*
    85.7 + * @ignore 8028398
    85.8   * @test
    85.9   * @summary Test that touching noaccess area in class ReservedHeapSpace results in SIGSEGV/ACCESS_VIOLATION
   85.10   * @library /testlibrary /testlibrary/whitebox

mercurial