Merge

Mon, 02 Dec 2013 15:43:04 +0100

author
ehelin
date
Mon, 02 Dec 2013 15:43:04 +0100
changeset 6149
9fc985481d78
parent 6148
55a0da3d420b
parent 6141
3fbb71fdc6e5
child 6150
50287b659eb8

Merge

src/share/vm/oops/instanceKlass.cpp 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	Tue Nov 26 14:35:38 2013 +0100
     1.2 +++ b/.hgtags	Mon Dec 02 15:43:04 2013 +0100
     1.3 @@ -397,3 +397,5 @@
     1.4  c78d517c7ea47501b456e707afd4b78e7b5b202e hs25-b59
     1.5  f573d00213b7170c2ff856f9cd83cd148437f5b9 jdk8-b117
     1.6  abad3b2d905d9e1ad767c94baa94aba6ed5b207b hs25-b60
     1.7 +c9f439732b18ea16f7e65815327d5ea7092cc258 jdk8-b118
     1.8 +b2426da30009cd3069d03de073f351e6432c7682 hs25-b61
     2.1 --- a/make/hotspot_version	Tue Nov 26 14:35:38 2013 +0100
     2.2 +++ b/make/hotspot_version	Mon Dec 02 15:43:04 2013 +0100
     2.3 @@ -35,7 +35,7 @@
     2.4  
     2.5  HS_MAJOR_VER=25
     2.6  HS_MINOR_VER=0
     2.7 -HS_BUILD_NUMBER=61
     2.8 +HS_BUILD_NUMBER=62
     2.9  
    2.10  JDK_MAJOR_VER=1
    2.11  JDK_MINOR_VER=8
     3.1 --- a/src/share/vm/classfile/classFileParser.cpp	Tue Nov 26 14:35:38 2013 +0100
     3.2 +++ b/src/share/vm/classfile/classFileParser.cpp	Mon Dec 02 15:43:04 2013 +0100
     3.3 @@ -4483,8 +4483,8 @@
     3.4    for (int index = 0; index < num_methods; index++) {
     3.5      Method* m = methods->at(index);
     3.6  
     3.7 -    // skip static and <init> methods
     3.8 -    if ((!m->is_static()) &&
     3.9 +    // skip private, static, and <init> methods
    3.10 +    if ((!m->is_private() && !m->is_static()) &&
    3.11          (m->name() != vmSymbols::object_initializer_name())) {
    3.12  
    3.13        Symbol* name = m->name();
     4.1 --- a/src/share/vm/classfile/classLoaderData.cpp	Tue Nov 26 14:35:38 2013 +0100
     4.2 +++ b/src/share/vm/classfile/classLoaderData.cpp	Mon Dec 02 15:43:04 2013 +0100
     4.3 @@ -62,13 +62,13 @@
     4.4  #include "runtime/safepoint.hpp"
     4.5  #include "runtime/synchronizer.hpp"
     4.6  #include "utilities/growableArray.hpp"
     4.7 +#include "utilities/macros.hpp"
     4.8  #include "utilities/ostream.hpp"
     4.9  
    4.10  #if INCLUDE_TRACE
    4.11   #include "trace/tracing.hpp"
    4.12  #endif
    4.13  
    4.14 -
    4.15  ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL;
    4.16  
    4.17  ClassLoaderData::ClassLoaderData(Handle h_class_loader, bool is_anonymous, Dependencies dependencies) :
    4.18 @@ -754,7 +754,7 @@
    4.19    if (Tracing::enabled()) {
    4.20      if (Tracing::is_event_enabled(TraceClassUnloadEvent)) {
    4.21        assert(_unloading != NULL, "need class loader data unload list!");
    4.22 -      _class_unload_time = Tracing::time();
    4.23 +      _class_unload_time = Ticks::now();
    4.24        classes_unloading_do(&class_unload_event);
    4.25      }
    4.26      Tracing::on_unloading_classes();
    4.27 @@ -832,7 +832,7 @@
    4.28  
    4.29  #if INCLUDE_TRACE
    4.30  
    4.31 -TracingTime ClassLoaderDataGraph::_class_unload_time;
    4.32 +Ticks ClassLoaderDataGraph::_class_unload_time;
    4.33  
    4.34  void ClassLoaderDataGraph::class_unload_event(Klass* const k) {
    4.35  
     5.1 --- a/src/share/vm/classfile/classLoaderData.hpp	Tue Nov 26 14:35:38 2013 +0100
     5.2 +++ b/src/share/vm/classfile/classLoaderData.hpp	Mon Dec 02 15:43:04 2013 +0100
     5.3 @@ -33,7 +33,7 @@
     5.4  #include "utilities/growableArray.hpp"
     5.5  
     5.6  #if INCLUDE_TRACE
     5.7 -# include "trace/traceTime.hpp"
     5.8 +# include "utilities/ticks.hpp"
     5.9  #endif
    5.10  
    5.11  //
    5.12 @@ -98,7 +98,7 @@
    5.13  
    5.14  #if INCLUDE_TRACE
    5.15   private:
    5.16 -  static TracingTime _class_unload_time;
    5.17 +  static Ticks _class_unload_time;
    5.18    static void class_unload_event(Klass* const k);
    5.19  #endif
    5.20  };
     6.1 --- a/src/share/vm/classfile/systemDictionary.cpp	Tue Nov 26 14:35:38 2013 +0100
     6.2 +++ b/src/share/vm/classfile/systemDictionary.cpp	Mon Dec 02 15:43:04 2013 +0100
     6.3 @@ -55,13 +55,13 @@
     6.4  #include "runtime/signature.hpp"
     6.5  #include "services/classLoadingService.hpp"
     6.6  #include "services/threadService.hpp"
     6.7 +#include "utilities/macros.hpp"
     6.8 +#include "utilities/ticks.hpp"
     6.9  
    6.10  #if INCLUDE_TRACE
    6.11   #include "trace/tracing.hpp"
    6.12 - #include "trace/traceMacros.hpp"
    6.13  #endif
    6.14  
    6.15 -
    6.16  Dictionary*            SystemDictionary::_dictionary          = NULL;
    6.17  PlaceholderTable*      SystemDictionary::_placeholders        = NULL;
    6.18  Dictionary*            SystemDictionary::_shared_dictionary   = NULL;
    6.19 @@ -598,7 +598,7 @@
    6.20    assert(name != NULL && !FieldType::is_array(name) &&
    6.21           !FieldType::is_obj(name), "invalid class name");
    6.22  
    6.23 -  TracingTime class_load_start_time = Tracing::time();
    6.24 +  Ticks class_load_start_time = Ticks::now();
    6.25  
    6.26    // UseNewReflection
    6.27    // Fix for 4474172; see evaluation for more details
    6.28 @@ -1006,7 +1006,7 @@
    6.29                                        TRAPS) {
    6.30    TempNewSymbol parsed_name = NULL;
    6.31  
    6.32 -  TracingTime class_load_start_time = Tracing::time();
    6.33 +  Ticks class_load_start_time = Ticks::now();
    6.34  
    6.35    ClassLoaderData* loader_data;
    6.36    if (host_klass.not_null()) {
    6.37 @@ -2665,13 +2665,12 @@
    6.38  }
    6.39  
    6.40  // utility function for class load event
    6.41 -void SystemDictionary::post_class_load_event(TracingTime start_time,
    6.42 +void SystemDictionary::post_class_load_event(const Ticks& start_time,
    6.43                                               instanceKlassHandle k,
    6.44                                               Handle initiating_loader) {
    6.45  #if INCLUDE_TRACE
    6.46    EventClassLoad event(UNTIMED);
    6.47    if (event.should_commit()) {
    6.48 -    event.set_endtime(Tracing::time());
    6.49      event.set_starttime(start_time);
    6.50      event.set_loadedClass(k());
    6.51      oop defining_class_loader = k->class_loader();
     7.1 --- a/src/share/vm/classfile/systemDictionary.hpp	Tue Nov 26 14:35:38 2013 +0100
     7.2 +++ b/src/share/vm/classfile/systemDictionary.hpp	Mon Dec 02 15:43:04 2013 +0100
     7.3 @@ -31,7 +31,6 @@
     7.4  #include "oops/symbol.hpp"
     7.5  #include "runtime/java.hpp"
     7.6  #include "runtime/reflectionUtils.hpp"
     7.7 -#include "trace/traceTime.hpp"
     7.8  #include "utilities/hashtable.hpp"
     7.9  #include "utilities/hashtable.inline.hpp"
    7.10  
    7.11 @@ -78,6 +77,7 @@
    7.12  template <MEMFLAGS F> class HashtableBucket;
    7.13  class ResolutionErrorTable;
    7.14  class SymbolPropertyTable;
    7.15 +class Ticks;
    7.16  
    7.17  // Certain classes are preloaded, such as java.lang.Object and java.lang.String.
    7.18  // They are all "well-known", in the sense that no class loader is allowed
    7.19 @@ -165,6 +165,7 @@
    7.20                                                                                                                           \
    7.21    do_klass(StringBuffer_klass,                          java_lang_StringBuffer,                    Pre                 ) \
    7.22    do_klass(StringBuilder_klass,                         java_lang_StringBuilder,                   Pre                 ) \
    7.23 +  do_klass(misc_Unsafe_klass,                           sun_misc_Unsafe,                           Pre                 ) \
    7.24                                                                                                                           \
    7.25    /* It's NULL in non-1.4 JDKs. */                                                                                       \
    7.26    do_klass(StackTraceElement_klass,                     java_lang_StackTraceElement,               Opt                 ) \
    7.27 @@ -637,7 +638,7 @@
    7.28    static void add_to_hierarchy(instanceKlassHandle k, TRAPS);
    7.29  
    7.30    // event based tracing
    7.31 -  static void post_class_load_event(TracingTime start_time, instanceKlassHandle k,
    7.32 +  static void post_class_load_event(const Ticks& start_time, instanceKlassHandle k,
    7.33                                      Handle initiating_loader);
    7.34    // We pass in the hashtable index so we can calculate it outside of
    7.35    // the SystemDictionary_lock.
     8.1 --- a/src/share/vm/classfile/verifier.cpp	Tue Nov 26 14:35:38 2013 +0100
     8.2 +++ b/src/share/vm/classfile/verifier.cpp	Mon Dec 02 15:43:04 2013 +0100
     8.3 @@ -2302,6 +2302,24 @@
     8.4    }
     8.5  }
     8.6  
     8.7 +bool ClassVerifier::is_same_or_direct_interface(
     8.8 +    instanceKlassHandle klass,
     8.9 +    VerificationType klass_type,
    8.10 +    VerificationType ref_class_type) {
    8.11 +  if (ref_class_type.equals(klass_type)) return true;
    8.12 +  Array<Klass*>* local_interfaces = klass->local_interfaces();
    8.13 +  if (local_interfaces != NULL) {
    8.14 +    for (int x = 0; x < local_interfaces->length(); x++) {
    8.15 +      Klass* k = local_interfaces->at(x);
    8.16 +      assert (k != NULL && k->is_interface(), "invalid interface");
    8.17 +      if (ref_class_type.equals(VerificationType::reference_type(k->name()))) {
    8.18 +        return true;
    8.19 +      }
    8.20 +    }
    8.21 +  }
    8.22 +  return false;
    8.23 +}
    8.24 +
    8.25  void ClassVerifier::verify_invoke_instructions(
    8.26      RawBytecodeStream* bcs, u4 code_length, StackMapFrame* current_frame,
    8.27      bool *this_uninit, VerificationType return_type,
    8.28 @@ -2432,23 +2450,38 @@
    8.29        return;
    8.30      }
    8.31    } else if (opcode == Bytecodes::_invokespecial
    8.32 -             && !ref_class_type.equals(current_type())
    8.33 +             && !is_same_or_direct_interface(current_class(), current_type(), ref_class_type)
    8.34               && !ref_class_type.equals(VerificationType::reference_type(
    8.35                    current_class()->super()->name()))) {
    8.36      bool subtype = false;
    8.37 +    bool have_imr_indirect = cp->tag_at(index).value() == JVM_CONSTANT_InterfaceMethodref;
    8.38      if (!current_class()->is_anonymous()) {
    8.39        subtype = ref_class_type.is_assignable_from(
    8.40                   current_type(), this, CHECK_VERIFY(this));
    8.41      } else {
    8.42 -      subtype = ref_class_type.is_assignable_from(VerificationType::reference_type(
    8.43 -                 current_class()->host_klass()->name()), this, CHECK_VERIFY(this));
    8.44 +      VerificationType host_klass_type =
    8.45 +                        VerificationType::reference_type(current_class()->host_klass()->name());
    8.46 +      subtype = ref_class_type.is_assignable_from(host_klass_type, this, CHECK_VERIFY(this));
    8.47 +
    8.48 +      // If invokespecial of IMR, need to recheck for same or
    8.49 +      // direct interface relative to the host class
    8.50 +      have_imr_indirect = (have_imr_indirect &&
    8.51 +                           !is_same_or_direct_interface(
    8.52 +                             InstanceKlass::cast(current_class()->host_klass()),
    8.53 +                             host_klass_type, ref_class_type));
    8.54      }
    8.55      if (!subtype) {
    8.56        verify_error(ErrorContext::bad_code(bci),
    8.57            "Bad invokespecial instruction: "
    8.58            "current class isn't assignable to reference class.");
    8.59         return;
    8.60 +    } else if (have_imr_indirect) {
    8.61 +      verify_error(ErrorContext::bad_code(bci),
    8.62 +          "Bad invokespecial instruction: "
    8.63 +          "interface method reference is in an indirect superinterface.");
    8.64 +      return;
    8.65      }
    8.66 +
    8.67    }
    8.68    // Match method descriptor with operand stack
    8.69    for (int i = nargs - 1; i >= 0; i--) {  // Run backwards
     9.1 --- a/src/share/vm/classfile/verifier.hpp	Tue Nov 26 14:35:38 2013 +0100
     9.2 +++ b/src/share/vm/classfile/verifier.hpp	Mon Dec 02 15:43:04 2013 +0100
     9.3 @@ -345,6 +345,9 @@
     9.4    // that a class has been verified and prepared for execution.
     9.5    bool was_recursively_verified() { return _klass->is_rewritten(); }
     9.6  
     9.7 +  bool is_same_or_direct_interface(instanceKlassHandle klass,
     9.8 +    VerificationType klass_type, VerificationType ref_class_type);
     9.9 +
    9.10   public:
    9.11    enum {
    9.12      BYTECODE_OFFSET = 1,
    10.1 --- a/src/share/vm/classfile/vmSymbols.hpp	Tue Nov 26 14:35:38 2013 +0100
    10.2 +++ b/src/share/vm/classfile/vmSymbols.hpp	Mon Dec 02 15:43:04 2013 +0100
    10.3 @@ -331,6 +331,7 @@
    10.4    template(findNative_name,                           "findNative")                               \
    10.5    template(deadChild_name,                            "deadChild")                                \
    10.6    template(addClass_name,                             "addClass")                                 \
    10.7 +  template(throwIllegalAccessError_name,              "throwIllegalAccessError")                  \
    10.8    template(getFromClass_name,                         "getFromClass")                             \
    10.9    template(dispatch_name,                             "dispatch")                                 \
   10.10    template(getSystemClassLoader_name,                 "getSystemClassLoader")                     \
    11.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Tue Nov 26 14:35:38 2013 +0100
    11.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Mon Dec 02 15:43:04 2013 +0100
    11.3 @@ -1993,7 +1993,7 @@
    11.4    GenCollectedHeap* gch = GenCollectedHeap::heap();
    11.5  
    11.6    STWGCTimer* gc_timer = GenMarkSweep::gc_timer();
    11.7 -  gc_timer->register_gc_start(os::elapsed_counter());
    11.8 +  gc_timer->register_gc_start();
    11.9  
   11.10    SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
   11.11    gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
   11.12 @@ -2089,7 +2089,7 @@
   11.13      size_policy()->msc_collection_end(gch->gc_cause());
   11.14    }
   11.15  
   11.16 -  gc_timer->register_gc_end(os::elapsed_counter());
   11.17 +  gc_timer->register_gc_end();
   11.18  
   11.19    gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
   11.20  
   11.21 @@ -2475,7 +2475,7 @@
   11.22  
   11.23  void CMSCollector::register_gc_start(GCCause::Cause cause) {
   11.24    _cms_start_registered = true;
   11.25 -  _gc_timer_cm->register_gc_start(os::elapsed_counter());
   11.26 +  _gc_timer_cm->register_gc_start();
   11.27    _gc_tracer_cm->report_gc_start(cause, _gc_timer_cm->gc_start());
   11.28  }
   11.29  
   11.30 @@ -2483,7 +2483,7 @@
   11.31    if (_cms_start_registered) {
   11.32      report_heap_summary(GCWhen::AfterGC);
   11.33  
   11.34 -    _gc_timer_cm->register_gc_end(os::elapsed_counter());
   11.35 +    _gc_timer_cm->register_gc_end();
   11.36      _gc_tracer_cm->report_gc_end(_gc_timer_cm->gc_end(), _gc_timer_cm->time_partitions());
   11.37      _cms_start_registered = false;
   11.38    }
    12.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Tue Nov 26 14:35:38 2013 +0100
    12.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp	Mon Dec 02 15:43:04 2013 +0100
    12.3 @@ -145,7 +145,7 @@
    12.4                                  );
    12.5  #endif /* USDT2 */
    12.6  
    12.7 -  _collector->_gc_timer_cm->register_gc_pause_start("Initial Mark", os::elapsed_counter());
    12.8 +  _collector->_gc_timer_cm->register_gc_pause_start("Initial Mark");
    12.9  
   12.10    GenCollectedHeap* gch = GenCollectedHeap::heap();
   12.11    GCCauseSetter gccs(gch, GCCause::_cms_initial_mark);
   12.12 @@ -157,7 +157,7 @@
   12.13  
   12.14    VM_CMS_Operation::verify_after_gc();
   12.15  
   12.16 -  _collector->_gc_timer_cm->register_gc_pause_end(os::elapsed_counter());
   12.17 +  _collector->_gc_timer_cm->register_gc_pause_end();
   12.18  
   12.19  #ifndef USDT2
   12.20    HS_DTRACE_PROBE(hs_private, cms__initmark__end);
   12.21 @@ -182,7 +182,7 @@
   12.22                                  );
   12.23  #endif /* USDT2 */
   12.24  
   12.25 -  _collector->_gc_timer_cm->register_gc_pause_start("Final Mark", os::elapsed_counter());
   12.26 +  _collector->_gc_timer_cm->register_gc_pause_start("Final Mark");
   12.27  
   12.28    GenCollectedHeap* gch = GenCollectedHeap::heap();
   12.29    GCCauseSetter gccs(gch, GCCause::_cms_final_remark);
   12.30 @@ -195,7 +195,7 @@
   12.31    VM_CMS_Operation::verify_after_gc();
   12.32  
   12.33    _collector->save_heap_summary();
   12.34 -  _collector->_gc_timer_cm->register_gc_pause_end(os::elapsed_counter());
   12.35 +  _collector->_gc_timer_cm->register_gc_pause_end();
   12.36  
   12.37  #ifndef USDT2
   12.38    HS_DTRACE_PROBE(hs_private, cms__remark__end);
    13.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Tue Nov 26 14:35:38 2013 +0100
    13.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Mon Dec 02 15:43:04 2013 +0100
    13.3 @@ -56,6 +56,7 @@
    13.4  #include "oops/oop.inline.hpp"
    13.5  #include "oops/oop.pcgc.inline.hpp"
    13.6  #include "runtime/vmThread.hpp"
    13.7 +#include "utilities/ticks.hpp"
    13.8  
    13.9  size_t G1CollectedHeap::_humongous_object_threshold_in_words = 0;
   13.10  
   13.11 @@ -1284,7 +1285,7 @@
   13.12    }
   13.13  
   13.14    STWGCTimer* gc_timer = G1MarkSweep::gc_timer();
   13.15 -  gc_timer->register_gc_start(os::elapsed_counter());
   13.16 +  gc_timer->register_gc_start();
   13.17  
   13.18    SerialOldTracer* gc_tracer = G1MarkSweep::gc_tracer();
   13.19    gc_tracer->report_gc_start(gc_cause(), gc_timer->gc_start());
   13.20 @@ -1552,7 +1553,7 @@
   13.21  
   13.22      post_full_gc_dump(gc_timer);
   13.23  
   13.24 -    gc_timer->register_gc_end(os::elapsed_counter());
   13.25 +    gc_timer->register_gc_end();
   13.26      gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
   13.27    }
   13.28  
   13.29 @@ -2482,7 +2483,7 @@
   13.30    FullGCCount_lock->notify_all();
   13.31  }
   13.32  
   13.33 -void G1CollectedHeap::register_concurrent_cycle_start(jlong start_time) {
   13.34 +void G1CollectedHeap::register_concurrent_cycle_start(const Ticks& start_time) {
   13.35    _concurrent_cycle_started = true;
   13.36    _gc_timer_cm->register_gc_start(start_time);
   13.37  
   13.38 @@ -2496,7 +2497,7 @@
   13.39        _gc_tracer_cm->report_concurrent_mode_failure();
   13.40      }
   13.41  
   13.42 -    _gc_timer_cm->register_gc_end(os::elapsed_counter());
   13.43 +    _gc_timer_cm->register_gc_end();
   13.44      _gc_tracer_cm->report_gc_end(_gc_timer_cm->gc_end(), _gc_timer_cm->time_partitions());
   13.45  
   13.46      _concurrent_cycle_started = false;
   13.47 @@ -3887,7 +3888,7 @@
   13.48      return false;
   13.49    }
   13.50  
   13.51 -  _gc_timer_stw->register_gc_start(os::elapsed_counter());
   13.52 +  _gc_timer_stw->register_gc_start();
   13.53  
   13.54    _gc_tracer_stw->report_gc_start(gc_cause(), _gc_timer_stw->gc_start());
   13.55  
   13.56 @@ -4265,7 +4266,7 @@
   13.57  
   13.58      _gc_tracer_stw->report_evacuation_info(&evacuation_info);
   13.59      _gc_tracer_stw->report_tenuring_threshold(_g1_policy->tenuring_threshold());
   13.60 -    _gc_timer_stw->register_gc_end(os::elapsed_counter());
   13.61 +    _gc_timer_stw->register_gc_end();
   13.62      _gc_tracer_stw->report_gc_end(_gc_timer_stw->gc_end(), _gc_timer_stw->time_partitions());
   13.63    }
   13.64    // It should now be safe to tell the concurrent mark thread to start
    14.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Tue Nov 26 14:35:38 2013 +0100
    14.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Mon Dec 02 15:43:04 2013 +0100
    14.3 @@ -72,6 +72,7 @@
    14.4  class G1OldTracer;
    14.5  class EvacuationFailedInfo;
    14.6  class nmethod;
    14.7 +class Ticks;
    14.8  
    14.9  typedef OverflowTaskQueue<StarTask, mtGC>         RefToScanQueue;
   14.10  typedef GenericTaskQueueSet<RefToScanQueue, mtGC> RefToScanQueueSet;
   14.11 @@ -746,7 +747,7 @@
   14.12      return _old_marking_cycles_completed;
   14.13    }
   14.14  
   14.15 -  void register_concurrent_cycle_start(jlong start_time);
   14.16 +  void register_concurrent_cycle_start(const Ticks& start_time);
   14.17    void register_concurrent_cycle_end();
   14.18    void trace_heap_after_concurrent_cycle();
   14.19  
    15.1 --- a/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Tue Nov 26 14:35:38 2013 +0100
    15.2 +++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Mon Dec 02 15:43:04 2013 +0100
    15.3 @@ -915,7 +915,7 @@
    15.4  
    15.5    GenCollectedHeap* gch = GenCollectedHeap::heap();
    15.6  
    15.7 -  _gc_timer->register_gc_start(os::elapsed_counter());
    15.8 +  _gc_timer->register_gc_start();
    15.9  
   15.10    assert(gch->kind() == CollectedHeap::GenCollectedHeap,
   15.11      "not a CMS generational heap");
   15.12 @@ -1091,7 +1091,7 @@
   15.13    gch->trace_heap_after_gc(&gc_tracer);
   15.14    gc_tracer.report_tenuring_threshold(tenuring_threshold());
   15.15  
   15.16 -  _gc_timer->register_gc_end(os::elapsed_counter());
   15.17 +  _gc_timer->register_gc_end();
   15.18  
   15.19    gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
   15.20  }
    16.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Tue Nov 26 14:35:38 2013 +0100
    16.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp	Mon Dec 02 15:43:04 2013 +0100
    16.3 @@ -114,7 +114,7 @@
    16.4    assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity");
    16.5    GCCause::Cause gc_cause = heap->gc_cause();
    16.6  
    16.7 -  _gc_timer->register_gc_start(os::elapsed_counter());
    16.8 +  _gc_timer->register_gc_start();
    16.9    _gc_tracer->report_gc_start(gc_cause, _gc_timer->gc_start());
   16.10  
   16.11    PSAdaptiveSizePolicy* size_policy = heap->size_policy();
   16.12 @@ -390,7 +390,7 @@
   16.13    ParallelTaskTerminator::print_termination_counts();
   16.14  #endif
   16.15  
   16.16 -  _gc_timer->register_gc_end(os::elapsed_counter());
   16.17 +  _gc_timer->register_gc_end();
   16.18  
   16.19    _gc_tracer->report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
   16.20  
    17.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Tue Nov 26 14:35:38 2013 +0100
    17.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp	Mon Dec 02 15:43:04 2013 +0100
    17.3 @@ -2006,7 +2006,7 @@
    17.4  
    17.5    ParallelScavengeHeap* heap = gc_heap();
    17.6  
    17.7 -  _gc_timer.register_gc_start(os::elapsed_counter());
    17.8 +  _gc_timer.register_gc_start();
    17.9    _gc_tracer.report_gc_start(heap->gc_cause(), _gc_timer.gc_start());
   17.10  
   17.11    TimeStamp marking_start;
   17.12 @@ -2244,7 +2244,7 @@
   17.13    ParallelTaskTerminator::print_termination_counts();
   17.14  #endif
   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_dense_prefix(dense_prefix(old_space_id));
   17.20    _gc_tracer.report_gc_end(_gc_timer.gc_end(), _gc_timer.time_partitions());
    18.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Tue Nov 26 14:35:38 2013 +0100
    18.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp	Mon Dec 02 15:43:04 2013 +0100
    18.3 @@ -263,7 +263,7 @@
    18.4    assert(_preserved_mark_stack.is_empty(), "should be empty");
    18.5    assert(_preserved_oop_stack.is_empty(), "should be empty");
    18.6  
    18.7 -  _gc_timer.register_gc_start(os::elapsed_counter());
    18.8 +  _gc_timer.register_gc_start();
    18.9  
   18.10    TimeStamp scavenge_entry;
   18.11    TimeStamp scavenge_midpoint;
   18.12 @@ -691,7 +691,7 @@
   18.13  #endif
   18.14  
   18.15  
   18.16 -  _gc_timer.register_gc_end(os::elapsed_counter());
   18.17 +  _gc_timer.register_gc_end();
   18.18  
   18.19    _gc_tracer.report_gc_end(_gc_timer.gc_end(), _gc_timer.time_partitions());
   18.20  
    19.1 --- a/src/share/vm/gc_implementation/shared/gcTimer.cpp	Tue Nov 26 14:35:38 2013 +0100
    19.2 +++ b/src/share/vm/gc_implementation/shared/gcTimer.cpp	Mon Dec 02 15:43:04 2013 +0100
    19.3 @@ -25,52 +25,55 @@
    19.4  #include "precompiled.hpp"
    19.5  #include "gc_implementation/shared/gcTimer.hpp"
    19.6  #include "utilities/growableArray.hpp"
    19.7 +#include "utilities/ticks.inline.hpp"
    19.8  
    19.9 -void GCTimer::register_gc_start(jlong time) {
   19.10 +// the "time" parameter for most functions
   19.11 +// has a default value set by Ticks::now()
   19.12 +
   19.13 +void GCTimer::register_gc_start(const Ticks& time) {
   19.14    _time_partitions.clear();
   19.15    _gc_start = time;
   19.16  }
   19.17  
   19.18 -void GCTimer::register_gc_end(jlong time) {
   19.19 +void GCTimer::register_gc_end(const Ticks& time) {
   19.20    assert(!_time_partitions.has_active_phases(),
   19.21        "We should have ended all started phases, before ending the GC");
   19.22  
   19.23    _gc_end = time;
   19.24  }
   19.25  
   19.26 -void GCTimer::register_gc_pause_start(const char* name, jlong time) {
   19.27 +void GCTimer::register_gc_pause_start(const char* name, const Ticks& time) {
   19.28    _time_partitions.report_gc_phase_start(name, time);
   19.29  }
   19.30  
   19.31 -void GCTimer::register_gc_pause_end(jlong time) {
   19.32 +void GCTimer::register_gc_pause_end(const Ticks& time) {
   19.33    _time_partitions.report_gc_phase_end(time);
   19.34  }
   19.35  
   19.36 -void GCTimer::register_gc_phase_start(const char* name, jlong time) {
   19.37 +void GCTimer::register_gc_phase_start(const char* name, const Ticks& time) {
   19.38    _time_partitions.report_gc_phase_start(name, time);
   19.39  }
   19.40  
   19.41 -void GCTimer::register_gc_phase_end(jlong time) {
   19.42 +void GCTimer::register_gc_phase_end(const Ticks& time) {
   19.43    _time_partitions.report_gc_phase_end(time);
   19.44  }
   19.45  
   19.46 -
   19.47 -void STWGCTimer::register_gc_start(jlong time) {
   19.48 +void STWGCTimer::register_gc_start(const Ticks& time) {
   19.49    GCTimer::register_gc_start(time);
   19.50    register_gc_pause_start("GC Pause", time);
   19.51  }
   19.52  
   19.53 -void STWGCTimer::register_gc_end(jlong time) {
   19.54 +void STWGCTimer::register_gc_end(const Ticks& time) {
   19.55    register_gc_pause_end(time);
   19.56    GCTimer::register_gc_end(time);
   19.57  }
   19.58  
   19.59 -void ConcurrentGCTimer::register_gc_pause_start(const char* name, jlong time) {
   19.60 -  GCTimer::register_gc_pause_start(name, time);
   19.61 +void ConcurrentGCTimer::register_gc_pause_start(const char* name) {
   19.62 +  GCTimer::register_gc_pause_start(name);
   19.63  }
   19.64  
   19.65 -void ConcurrentGCTimer::register_gc_pause_end(jlong time) {
   19.66 -  GCTimer::register_gc_pause_end(time);
   19.67 +void ConcurrentGCTimer::register_gc_pause_end() {
   19.68 +  GCTimer::register_gc_pause_end();
   19.69  }
   19.70  
   19.71  void PhasesStack::clear() {
   19.72 @@ -111,11 +114,11 @@
   19.73  void TimePartitions::clear() {
   19.74    _phases->clear();
   19.75    _active_phases.clear();
   19.76 -  _sum_of_pauses = 0;
   19.77 -  _longest_pause = 0;
   19.78 +  _sum_of_pauses = Tickspan();
   19.79 +  _longest_pause = Tickspan();
   19.80  }
   19.81  
   19.82 -void TimePartitions::report_gc_phase_start(const char* name, jlong time) {
   19.83 +void TimePartitions::report_gc_phase_start(const char* name, const Ticks& time) {
   19.84    assert(_phases->length() <= 1000, "Too many recored phases?");
   19.85  
   19.86    int level = _active_phases.count();
   19.87 @@ -133,13 +136,13 @@
   19.88  void TimePartitions::update_statistics(GCPhase* phase) {
   19.89    // FIXME: This should only be done for pause phases
   19.90    if (phase->level() == 0) {
   19.91 -    jlong pause = phase->end() - phase->start();
   19.92 +    const Tickspan pause = phase->end() - phase->start();
   19.93      _sum_of_pauses += pause;
   19.94      _longest_pause = MAX2(pause, _longest_pause);
   19.95    }
   19.96  }
   19.97  
   19.98 -void TimePartitions::report_gc_phase_end(jlong time) {
   19.99 +void TimePartitions::report_gc_phase_end(const Ticks& time) {
  19.100    int phase_index = _active_phases.pop();
  19.101    GCPhase* phase = _phases->adr_at(phase_index);
  19.102    phase->set_end(time);
  19.103 @@ -157,14 +160,6 @@
  19.104    return _phases->adr_at(index);
  19.105  }
  19.106  
  19.107 -jlong TimePartitions::sum_of_pauses() {
  19.108 -  return _sum_of_pauses;
  19.109 -}
  19.110 -
  19.111 -jlong TimePartitions::longest_pause() {
  19.112 -  return _longest_pause;
  19.113 -}
  19.114 -
  19.115  bool TimePartitions::has_active_phases() {
  19.116    return _active_phases.count() > 0;
  19.117  }
  19.118 @@ -194,7 +189,7 @@
  19.119      max_nested_pause_phases();
  19.120    }
  19.121  
  19.122 -  static void validate_pause_phase(GCPhase* phase, int level, const char* name, jlong start, jlong end) {
  19.123 +  static void validate_pause_phase(GCPhase* phase, int level, const char* name, const Ticks& start, const Ticks& end) {
  19.124      assert(phase->level() == level, "Incorrect level");
  19.125      assert(strcmp(phase->name(), name) == 0, "Incorrect name");
  19.126      assert(phase->start() == start, "Incorrect start");
  19.127 @@ -209,8 +204,8 @@
  19.128      TimePartitionPhasesIterator iter(&time_partitions);
  19.129  
  19.130      validate_pause_phase(iter.next(), 0, "PausePhase", 2, 8);
  19.131 -    assert(time_partitions.sum_of_pauses() == 8-2, "Incorrect");
  19.132 -    assert(time_partitions.longest_pause() == 8-2, "Incorrect");
  19.133 +    assert(time_partitions.sum_of_pauses() == Ticks(8) - Ticks(2), "Incorrect");
  19.134 +    assert(time_partitions.longest_pause() == Ticks(8) - Ticks(2), "Incorrect");
  19.135  
  19.136      assert(!iter.has_next(), "Too many elements");
  19.137    }
  19.138 @@ -227,8 +222,8 @@
  19.139      validate_pause_phase(iter.next(), 0, "PausePhase1", 2, 3);
  19.140      validate_pause_phase(iter.next(), 0, "PausePhase2", 4, 6);
  19.141  
  19.142 -    assert(time_partitions.sum_of_pauses() == 3, "Incorrect");
  19.143 -    assert(time_partitions.longest_pause() == 2, "Incorrect");
  19.144 +    assert(time_partitions.sum_of_pauses() == Ticks(3) - Ticks(0), "Incorrect");
  19.145 +    assert(time_partitions.longest_pause() == Ticks(2) - Ticks(0), "Incorrect");
  19.146  
  19.147      assert(!iter.has_next(), "Too many elements");
  19.148    }
  19.149 @@ -245,8 +240,8 @@
  19.150      validate_pause_phase(iter.next(), 0, "PausePhase", 2, 5);
  19.151      validate_pause_phase(iter.next(), 1, "SubPhase", 3, 4);
  19.152  
  19.153 -    assert(time_partitions.sum_of_pauses() == 3, "Incorrect");
  19.154 -    assert(time_partitions.longest_pause() == 3, "Incorrect");
  19.155 +    assert(time_partitions.sum_of_pauses() == Ticks(3) - Ticks(0), "Incorrect");
  19.156 +    assert(time_partitions.longest_pause() == Ticks(3) - Ticks(0), "Incorrect");
  19.157  
  19.158      assert(!iter.has_next(), "Too many elements");
  19.159    }
  19.160 @@ -269,8 +264,8 @@
  19.161      validate_pause_phase(iter.next(), 2, "SubPhase2", 4, 7);
  19.162      validate_pause_phase(iter.next(), 3, "SubPhase3", 5, 6);
  19.163  
  19.164 -    assert(time_partitions.sum_of_pauses() == 7, "Incorrect");
  19.165 -    assert(time_partitions.longest_pause() == 7, "Incorrect");
  19.166 +    assert(time_partitions.sum_of_pauses() == Ticks(7) - Ticks(0), "Incorrect");
  19.167 +    assert(time_partitions.longest_pause() == Ticks(7) - Ticks(0), "Incorrect");
  19.168  
  19.169      assert(!iter.has_next(), "Too many elements");
  19.170    }
  19.171 @@ -298,8 +293,8 @@
  19.172      validate_pause_phase(iter.next(), 1, "SubPhase3", 7, 8);
  19.173      validate_pause_phase(iter.next(), 1, "SubPhase4", 9, 10);
  19.174  
  19.175 -    assert(time_partitions.sum_of_pauses() == 9, "Incorrect");
  19.176 -    assert(time_partitions.longest_pause() == 9, "Incorrect");
  19.177 +    assert(time_partitions.sum_of_pauses() == Ticks(9) - Ticks(0), "Incorrect");
  19.178 +    assert(time_partitions.longest_pause() == Ticks(9) - Ticks(0), "Incorrect");
  19.179  
  19.180      assert(!iter.has_next(), "Too many elements");
  19.181    }
  19.182 @@ -336,8 +331,8 @@
  19.183      validate_pause_phase(iter.next(), 2, "SubPhase22", 12, 13);
  19.184      validate_pause_phase(iter.next(), 1, "SubPhase3", 15, 16);
  19.185  
  19.186 -    assert(time_partitions.sum_of_pauses() == 15, "Incorrect");
  19.187 -    assert(time_partitions.longest_pause() == 15, "Incorrect");
  19.188 +    assert(time_partitions.sum_of_pauses() == Ticks(15) - Ticks(0), "Incorrect");
  19.189 +    assert(time_partitions.longest_pause() == Ticks(15) - Ticks(0), "Incorrect");
  19.190  
  19.191      assert(!iter.has_next(), "Too many elements");
  19.192    }
    20.1 --- a/src/share/vm/gc_implementation/shared/gcTimer.hpp	Tue Nov 26 14:35:38 2013 +0100
    20.2 +++ b/src/share/vm/gc_implementation/shared/gcTimer.hpp	Mon Dec 02 15:43:04 2013 +0100
    20.3 @@ -28,6 +28,7 @@
    20.4  #include "memory/allocation.hpp"
    20.5  #include "prims/jni_md.h"
    20.6  #include "utilities/macros.hpp"
    20.7 +#include "utilities/ticks.hpp"
    20.8  
    20.9  class ConcurrentPhase;
   20.10  class GCPhase;
   20.11 @@ -45,21 +46,21 @@
   20.12  class GCPhase {
   20.13    const char* _name;
   20.14    int _level;
   20.15 -  jlong _start;
   20.16 -  jlong _end;
   20.17 +  Ticks _start;
   20.18 +  Ticks _end;
   20.19  
   20.20   public:
   20.21    void set_name(const char* name) { _name = name; }
   20.22 -  const char* name() { return _name; }
   20.23 +  const char* name() const { return _name; }
   20.24  
   20.25 -  int level() { return _level; }
   20.26 +  int level() const { return _level; }
   20.27    void set_level(int level) { _level = level; }
   20.28  
   20.29 -  jlong start() { return _start; }
   20.30 -  void set_start(jlong time) { _start = time; }
   20.31 +  const Ticks start() const { return _start; }
   20.32 +  void set_start(const Ticks& time) { _start = time; }
   20.33  
   20.34 -  jlong end() { return _end; }
   20.35 -  void set_end(jlong time) { _end = time; }
   20.36 +  const Ticks end() const { return _end; }
   20.37 +  void set_end(const Ticks& time) { _end = time; }
   20.38  
   20.39    virtual void accept(PhaseVisitor* visitor) = 0;
   20.40  };
   20.41 @@ -102,22 +103,22 @@
   20.42    GrowableArray<PausePhase>* _phases;
   20.43    PhasesStack _active_phases;
   20.44  
   20.45 -  jlong _sum_of_pauses;
   20.46 -  jlong _longest_pause;
   20.47 +  Tickspan _sum_of_pauses;
   20.48 +  Tickspan _longest_pause;
   20.49  
   20.50   public:
   20.51    TimePartitions();
   20.52    ~TimePartitions();
   20.53    void clear();
   20.54  
   20.55 -  void report_gc_phase_start(const char* name, jlong time);
   20.56 -  void report_gc_phase_end(jlong time);
   20.57 +  void report_gc_phase_start(const char* name, const Ticks& time);
   20.58 +  void report_gc_phase_end(const Ticks& time);
   20.59  
   20.60    int num_phases() const;
   20.61    GCPhase* phase_at(int index) const;
   20.62  
   20.63 -  jlong sum_of_pauses();
   20.64 -  jlong longest_pause();
   20.65 +  const Tickspan sum_of_pauses() const { return _sum_of_pauses; }
   20.66 +  const Tickspan longest_pause() const { return _longest_pause; }
   20.67  
   20.68    bool has_active_phases();
   20.69   private:
   20.70 @@ -133,40 +134,37 @@
   20.71  class GCTimer : public ResourceObj {
   20.72    NOT_PRODUCT(friend class GCTimerTest;)
   20.73   protected:
   20.74 -  jlong _gc_start;
   20.75 -  jlong _gc_end;
   20.76 +  Ticks _gc_start;
   20.77 +  Ticks _gc_end;
   20.78    TimePartitions _time_partitions;
   20.79  
   20.80   public:
   20.81 -  virtual void register_gc_start(jlong time);
   20.82 -  virtual void register_gc_end(jlong time);
   20.83 +  virtual void register_gc_start(const Ticks& time = Ticks::now());
   20.84 +  virtual void register_gc_end(const Ticks& time = Ticks::now());
   20.85  
   20.86 -  void register_gc_phase_start(const char* name, jlong time);
   20.87 -  void register_gc_phase_end(jlong time);
   20.88 +  void register_gc_phase_start(const char* name, const Ticks& time);
   20.89 +  void register_gc_phase_end(const Ticks& time);
   20.90  
   20.91 -  jlong gc_start() { return _gc_start; }
   20.92 -  jlong gc_end() { return _gc_end; }
   20.93 +  const Ticks gc_start() const { return _gc_start; }
   20.94 +  const Ticks gc_end() const { return _gc_end; }
   20.95  
   20.96    TimePartitions* time_partitions() { return &_time_partitions; }
   20.97  
   20.98 -  long longest_pause();
   20.99 -  long sum_of_pauses();
  20.100 -
  20.101   protected:
  20.102 -  void register_gc_pause_start(const char* name, jlong time);
  20.103 -  void register_gc_pause_end(jlong time);
  20.104 +  void register_gc_pause_start(const char* name, const Ticks& time = Ticks::now());
  20.105 +  void register_gc_pause_end(const Ticks& time = Ticks::now());
  20.106  };
  20.107  
  20.108  class STWGCTimer : public GCTimer {
  20.109   public:
  20.110 -  virtual void register_gc_start(jlong time);
  20.111 -  virtual void register_gc_end(jlong time);
  20.112 +  virtual void register_gc_start(const Ticks& time = Ticks::now());
  20.113 +  virtual void register_gc_end(const Ticks& time = Ticks::now());
  20.114  };
  20.115  
  20.116  class ConcurrentGCTimer : public GCTimer {
  20.117   public:
  20.118 -  void register_gc_pause_start(const char* name, jlong time);
  20.119 -  void register_gc_pause_end(jlong time);
  20.120 +  void register_gc_pause_start(const char* name);
  20.121 +  void register_gc_pause_end();
  20.122  };
  20.123  
  20.124  class TimePartitionPhasesIterator {
    21.1 --- a/src/share/vm/gc_implementation/shared/gcTrace.cpp	Tue Nov 26 14:35:38 2013 +0100
    21.2 +++ b/src/share/vm/gc_implementation/shared/gcTrace.cpp	Mon Dec 02 15:43:04 2013 +0100
    21.3 @@ -32,6 +32,7 @@
    21.4  #include "memory/referenceProcessorStats.hpp"
    21.5  #include "runtime/os.hpp"
    21.6  #include "utilities/globalDefinitions.hpp"
    21.7 +#include "utilities/ticks.inline.hpp"
    21.8  
    21.9  #if INCLUDE_ALL_GCS
   21.10  #include "gc_implementation/g1/evacuationInfo.hpp"
   21.11 @@ -45,7 +46,7 @@
   21.12    return GCTracer_next_gc_id++;
   21.13  }
   21.14  
   21.15 -void GCTracer::report_gc_start_impl(GCCause::Cause cause, jlong timestamp) {
   21.16 +void GCTracer::report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp) {
   21.17    assert_unset_gc_id();
   21.18  
   21.19    GCId gc_id = create_new_gc_id();
   21.20 @@ -54,7 +55,7 @@
   21.21    _shared_gc_info.set_start_timestamp(timestamp);
   21.22  }
   21.23  
   21.24 -void GCTracer::report_gc_start(GCCause::Cause cause, jlong timestamp) {
   21.25 +void GCTracer::report_gc_start(GCCause::Cause cause, const Ticks& timestamp) {
   21.26    assert_unset_gc_id();
   21.27  
   21.28    report_gc_start_impl(cause, timestamp);
   21.29 @@ -64,7 +65,7 @@
   21.30    return _shared_gc_info.id() != SharedGCInfo::UNSET_GCID;
   21.31  }
   21.32  
   21.33 -void GCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
   21.34 +void GCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   21.35    assert_set_gc_id();
   21.36  
   21.37    _shared_gc_info.set_sum_of_pauses(time_partitions->sum_of_pauses());
   21.38 @@ -75,7 +76,7 @@
   21.39    send_garbage_collection_event();
   21.40  }
   21.41  
   21.42 -void GCTracer::report_gc_end(jlong timestamp, TimePartitions* time_partitions) {
   21.43 +void GCTracer::report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions) {
   21.44    assert_set_gc_id();
   21.45  
   21.46    report_gc_end_impl(timestamp, time_partitions);
   21.47 @@ -97,10 +98,10 @@
   21.48    const GCId _gc_id;
   21.49    const double _size_threshold_percentage;
   21.50    const size_t _total_size_in_words;
   21.51 -  const jlong _timestamp;
   21.52 +  const Ticks _timestamp;
   21.53  
   21.54   public:
   21.55 -  ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, jlong timestamp) :
   21.56 +  ObjectCountEventSenderClosure(GCId gc_id, size_t total_size_in_words, const Ticks& timestamp) :
   21.57      _gc_id(gc_id),
   21.58      _size_threshold_percentage(ObjectCountCutOffPercent / 100),
   21.59      _total_size_in_words(total_size_in_words),
   21.60 @@ -131,9 +132,7 @@
   21.61      if (!cit.allocation_failed()) {
   21.62        HeapInspection hi(false, false, false, NULL);
   21.63        hi.populate_table(&cit, is_alive_cl);
   21.64 -
   21.65 -      jlong timestamp = os::elapsed_counter();
   21.66 -      ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), timestamp);
   21.67 +      ObjectCountEventSenderClosure event_sender(_shared_gc_info.id(), cit.size_of_instances_in_words(), Ticks::now());
   21.68        cit.iterate(&event_sender);
   21.69      }
   21.70    }
   21.71 @@ -147,7 +146,7 @@
   21.72    send_meta_space_summary_event(when, meta_space_summary);
   21.73  }
   21.74  
   21.75 -void YoungGCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
   21.76 +void YoungGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   21.77    assert_set_gc_id();
   21.78    assert(_tenuring_threshold != UNSET_TENURING_THRESHOLD, "Tenuring threshold has not been reported");
   21.79  
   21.80 @@ -167,14 +166,14 @@
   21.81    _tenuring_threshold = tenuring_threshold;
   21.82  }
   21.83  
   21.84 -void OldGCTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
   21.85 +void OldGCTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   21.86    assert_set_gc_id();
   21.87  
   21.88    GCTracer::report_gc_end_impl(timestamp, time_partitions);
   21.89    send_old_gc_event();
   21.90  }
   21.91  
   21.92 -void ParallelOldTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
   21.93 +void ParallelOldTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
   21.94    assert_set_gc_id();
   21.95  
   21.96    OldGCTracer::report_gc_end_impl(timestamp, time_partitions);
   21.97 @@ -200,7 +199,7 @@
   21.98    _g1_young_gc_info.set_type(type);
   21.99  }
  21.100  
  21.101 -void G1NewTracer::report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions) {
  21.102 +void G1NewTracer::report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions) {
  21.103    assert_set_gc_id();
  21.104  
  21.105    YoungGCTracer::report_gc_end_impl(timestamp, time_partitions);
    22.1 --- a/src/share/vm/gc_implementation/shared/gcTrace.hpp	Tue Nov 26 14:35:38 2013 +0100
    22.2 +++ b/src/share/vm/gc_implementation/shared/gcTrace.hpp	Mon Dec 02 15:43:04 2013 +0100
    22.3 @@ -35,6 +35,7 @@
    22.4  #include "gc_implementation/g1/g1YCTypes.hpp"
    22.5  #endif
    22.6  #include "utilities/macros.hpp"
    22.7 +#include "utilities/ticks.hpp"
    22.8  
    22.9  typedef uint GCId;
   22.10  
   22.11 @@ -47,8 +48,6 @@
   22.12  class BoolObjectClosure;
   22.13  
   22.14  class SharedGCInfo VALUE_OBJ_CLASS_SPEC {
   22.15 -  static const jlong UNSET_TIMESTAMP = -1;
   22.16 -
   22.17   public:
   22.18    static const GCId UNSET_GCID = (GCId)-1;
   22.19  
   22.20 @@ -56,23 +55,30 @@
   22.21    GCId _id;
   22.22    GCName _name;
   22.23    GCCause::Cause _cause;
   22.24 -  jlong _start_timestamp;
   22.25 -  jlong _end_timestamp;
   22.26 -  jlong _sum_of_pauses;
   22.27 -  jlong _longest_pause;
   22.28 +  Ticks     _start_timestamp;
   22.29 +  Ticks     _end_timestamp;
   22.30 +  Tickspan  _sum_of_pauses;
   22.31 +  Tickspan  _longest_pause;
   22.32  
   22.33   public:
   22.34 -  SharedGCInfo(GCName name) : _id(UNSET_GCID), _name(name), _cause(GCCause::_last_gc_cause),
   22.35 -      _start_timestamp(UNSET_TIMESTAMP), _end_timestamp(UNSET_TIMESTAMP), _sum_of_pauses(0), _longest_pause(0) {}
   22.36 +  SharedGCInfo(GCName name) :
   22.37 +    _id(UNSET_GCID),
   22.38 +    _name(name),
   22.39 +    _cause(GCCause::_last_gc_cause),
   22.40 +    _start_timestamp(),
   22.41 +    _end_timestamp(),
   22.42 +    _sum_of_pauses(),
   22.43 +    _longest_pause() {
   22.44 +  }
   22.45  
   22.46    void set_id(GCId id) { _id = id; }
   22.47    GCId id() const { return _id; }
   22.48  
   22.49 -  void set_start_timestamp(jlong timestamp) { _start_timestamp = timestamp; }
   22.50 -  jlong start_timestamp() const { return _start_timestamp; }
   22.51 +  void set_start_timestamp(const Ticks& timestamp) { _start_timestamp = timestamp; }
   22.52 +  const Ticks start_timestamp() const { return _start_timestamp; }
   22.53  
   22.54 -  void set_end_timestamp(jlong timestamp) { _end_timestamp = timestamp; }
   22.55 -  jlong end_timestamp() const { return _end_timestamp; }
   22.56 +  void set_end_timestamp(const Ticks& timestamp) { _end_timestamp = timestamp; }
   22.57 +  const Ticks end_timestamp() const { return _end_timestamp; }
   22.58  
   22.59    void set_name(GCName name) { _name = name; }
   22.60    GCName name() const { return _name; }
   22.61 @@ -80,11 +86,11 @@
   22.62    void set_cause(GCCause::Cause cause) { _cause = cause; }
   22.63    GCCause::Cause cause() const { return _cause; }
   22.64  
   22.65 -  void set_sum_of_pauses(jlong duration) { _sum_of_pauses = duration; }
   22.66 -  jlong sum_of_pauses() const { return _sum_of_pauses; }
   22.67 +  void set_sum_of_pauses(const Tickspan& duration) { _sum_of_pauses = duration; }
   22.68 +  const Tickspan sum_of_pauses() const { return _sum_of_pauses; }
   22.69  
   22.70 -  void set_longest_pause(jlong duration) { _longest_pause = duration; }
   22.71 -  jlong longest_pause() const { return _longest_pause; }
   22.72 +  void set_longest_pause(const Tickspan& duration) { _longest_pause = duration; }
   22.73 +  const Tickspan longest_pause() const { return _longest_pause; }
   22.74  };
   22.75  
   22.76  class ParallelOldGCInfo VALUE_OBJ_CLASS_SPEC {
   22.77 @@ -116,8 +122,8 @@
   22.78    SharedGCInfo _shared_gc_info;
   22.79  
   22.80   public:
   22.81 -  void report_gc_start(GCCause::Cause cause, jlong timestamp);
   22.82 -  void report_gc_end(jlong timestamp, TimePartitions* time_partitions);
   22.83 +  void report_gc_start(GCCause::Cause cause, const Ticks& timestamp);
   22.84 +  void report_gc_end(const Ticks& timestamp, TimePartitions* time_partitions);
   22.85    void report_gc_heap_summary(GCWhen::Type when, const GCHeapSummary& heap_summary, const MetaspaceSummary& meta_space_summary) const;
   22.86    void report_gc_reference_stats(const ReferenceProcessorStats& rp) const;
   22.87    void report_object_count_after_gc(BoolObjectClosure* object_filter) NOT_SERVICES_RETURN;
   22.88 @@ -125,8 +131,8 @@
   22.89  
   22.90   protected:
   22.91    GCTracer(GCName name) : _shared_gc_info(name) {}
   22.92 -  virtual void report_gc_start_impl(GCCause::Cause cause, jlong timestamp);
   22.93 -  virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
   22.94 +  virtual void report_gc_start_impl(GCCause::Cause cause, const Ticks& timestamp);
   22.95 +  virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
   22.96  
   22.97   private:
   22.98    void send_garbage_collection_event() const;
   22.99 @@ -143,7 +149,7 @@
  22.100  
  22.101   protected:
  22.102    YoungGCTracer(GCName name) : GCTracer(name), _tenuring_threshold(UNSET_TENURING_THRESHOLD) {}
  22.103 -  virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
  22.104 +  virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
  22.105  
  22.106   public:
  22.107    void report_promotion_failed(const PromotionFailedInfo& pf_info);
  22.108 @@ -157,7 +163,7 @@
  22.109  class OldGCTracer : public GCTracer {
  22.110   protected:
  22.111    OldGCTracer(GCName name) : GCTracer(name) {}
  22.112 -  virtual void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
  22.113 +  virtual void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
  22.114  
  22.115   public:
  22.116    void report_concurrent_mode_failure();
  22.117 @@ -175,7 +181,7 @@
  22.118    void report_dense_prefix(void* dense_prefix);
  22.119  
  22.120   protected:
  22.121 -  void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
  22.122 +  void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
  22.123  
  22.124   private:
  22.125    void send_parallel_old_event() const;
  22.126 @@ -209,7 +215,7 @@
  22.127    G1NewTracer() : YoungGCTracer(G1New) {}
  22.128  
  22.129    void report_yc_type(G1YCType type);
  22.130 -  void report_gc_end_impl(jlong timestamp, TimePartitions* time_partitions);
  22.131 +  void report_gc_end_impl(const Ticks& timestamp, TimePartitions* time_partitions);
  22.132    void report_evacuation_info(EvacuationInfo* info);
  22.133    void report_evacuation_failed(EvacuationFailedInfo& ef_info);
  22.134  
    23.1 --- a/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Tue Nov 26 14:35:38 2013 +0100
    23.2 +++ b/src/share/vm/gc_implementation/shared/gcTraceSend.cpp	Mon Dec 02 15:43:04 2013 +0100
    23.3 @@ -55,12 +55,11 @@
    23.4  }
    23.5  
    23.6  void GCTracer::send_reference_stats_event(ReferenceType type, size_t count) const {
    23.7 -  EventGCReferenceStatistics e(UNTIMED);
    23.8 +  EventGCReferenceStatistics e;
    23.9    if (e.should_commit()) {
   23.10        e.set_gcId(_shared_gc_info.id());
   23.11        e.set_type((u1)type);
   23.12        e.set_count(count);
   23.13 -      e.set_endtime(os::elapsed_counter());
   23.14        e.commit();
   23.15    }
   23.16  }
   23.17 @@ -107,22 +106,20 @@
   23.18  }
   23.19  
   23.20  void YoungGCTracer::send_promotion_failed_event(const PromotionFailedInfo& pf_info) const {
   23.21 -  EventPromotionFailed e(UNTIMED);
   23.22 +  EventPromotionFailed e;
   23.23    if (e.should_commit()) {
   23.24      e.set_gcId(_shared_gc_info.id());
   23.25      e.set_data(to_trace_struct(pf_info));
   23.26      e.set_thread(pf_info.thread()->thread_id());
   23.27 -    e.set_endtime(os::elapsed_counter());
   23.28      e.commit();
   23.29    }
   23.30  }
   23.31  
   23.32  // Common to CMS and G1
   23.33  void OldGCTracer::send_concurrent_mode_failure_event() {
   23.34 -  EventConcurrentModeFailure e(UNTIMED);
   23.35 +  EventConcurrentModeFailure e;
   23.36    if (e.should_commit()) {
   23.37      e.set_gcId(_shared_gc_info.id());
   23.38 -    e.set_endtime(os::elapsed_counter());
   23.39      e.commit();
   23.40    }
   23.41  }
   23.42 @@ -140,7 +137,7 @@
   23.43  }
   23.44  
   23.45  void G1NewTracer::send_evacuation_info_event(EvacuationInfo* info) {
   23.46 -  EventEvacuationInfo e(UNTIMED);
   23.47 +  EventEvacuationInfo e;
   23.48    if (e.should_commit()) {
   23.49      e.set_gcId(_shared_gc_info.id());
   23.50      e.set_cSetRegions(info->collectionset_regions());
   23.51 @@ -151,17 +148,15 @@
   23.52      e.set_allocRegionsUsedAfter(info->alloc_regions_used_before() + info->bytes_copied());
   23.53      e.set_bytesCopied(info->bytes_copied());
   23.54      e.set_regionsFreed(info->regions_freed());
   23.55 -    e.set_endtime(os::elapsed_counter());
   23.56      e.commit();
   23.57    }
   23.58  }
   23.59  
   23.60  void G1NewTracer::send_evacuation_failed_event(const EvacuationFailedInfo& ef_info) const {
   23.61 -  EventEvacuationFailed e(UNTIMED);
   23.62 +  EventEvacuationFailed e;
   23.63    if (e.should_commit()) {
   23.64      e.set_gcId(_shared_gc_info.id());
   23.65      e.set_data(to_trace_struct(ef_info));
   23.66 -    e.set_endtime(os::elapsed_counter());
   23.67      e.commit();
   23.68    }
   23.69  }
   23.70 @@ -195,13 +190,12 @@
   23.71    void visit(const GCHeapSummary* heap_summary) const {
   23.72      const VirtualSpaceSummary& heap_space = heap_summary->heap();
   23.73  
   23.74 -    EventGCHeapSummary e(UNTIMED);
   23.75 +    EventGCHeapSummary e;
   23.76      if (e.should_commit()) {
   23.77        e.set_gcId(_id);
   23.78        e.set_when((u1)_when);
   23.79        e.set_heapSpace(to_trace_struct(heap_space));
   23.80        e.set_heapUsed(heap_summary->used());
   23.81 -      e.set_endtime(os::elapsed_counter());
   23.82        e.commit();
   23.83      }
   23.84    }
   23.85 @@ -216,7 +210,7 @@
   23.86      const SpaceSummary& from_space = ps_heap_summary->from();
   23.87      const SpaceSummary& to_space = ps_heap_summary->to();
   23.88  
   23.89 -    EventPSHeapSummary e(UNTIMED);
   23.90 +    EventPSHeapSummary e;
   23.91      if (e.should_commit()) {
   23.92        e.set_gcId(_id);
   23.93        e.set_when((u1)_when);
   23.94 @@ -227,7 +221,6 @@
   23.95        e.set_edenSpace(to_trace_struct(ps_heap_summary->eden()));
   23.96        e.set_fromSpace(to_trace_struct(ps_heap_summary->from()));
   23.97        e.set_toSpace(to_trace_struct(ps_heap_summary->to()));
   23.98 -      e.set_endtime(os::elapsed_counter());
   23.99        e.commit();
  23.100      }
  23.101    }
  23.102 @@ -249,14 +242,13 @@
  23.103  }
  23.104  
  23.105  void GCTracer::send_meta_space_summary_event(GCWhen::Type when, const MetaspaceSummary& meta_space_summary) const {
  23.106 -  EventMetaspaceSummary e(UNTIMED);
  23.107 +  EventMetaspaceSummary e;
  23.108    if (e.should_commit()) {
  23.109      e.set_gcId(_shared_gc_info.id());
  23.110      e.set_when((u1) when);
  23.111      e.set_metaspace(to_trace_struct(meta_space_summary.meta_space()));
  23.112      e.set_dataSpace(to_trace_struct(meta_space_summary.data_space()));
  23.113      e.set_classSpace(to_trace_struct(meta_space_summary.class_space()));
  23.114 -    e.set_endtime(os::elapsed_counter());
  23.115      e.commit();
  23.116    }
  23.117  }
    24.1 --- a/src/share/vm/gc_implementation/shared/gcTraceTime.cpp	Tue Nov 26 14:35:38 2013 +0100
    24.2 +++ b/src/share/vm/gc_implementation/shared/gcTraceTime.cpp	Mon Dec 02 15:43:04 2013 +0100
    24.3 @@ -31,12 +31,13 @@
    24.4  #include "runtime/thread.inline.hpp"
    24.5  #include "runtime/timer.hpp"
    24.6  #include "utilities/ostream.hpp"
    24.7 +#include "utilities/ticks.inline.hpp"
    24.8  
    24.9  
   24.10  GCTraceTime::GCTraceTime(const char* title, bool doit, bool print_cr, GCTimer* timer) :
   24.11 -    _title(title), _doit(doit), _print_cr(print_cr), _timer(timer) {
   24.12 +    _title(title), _doit(doit), _print_cr(print_cr), _timer(timer), _start_counter() {
   24.13    if (_doit || _timer != NULL) {
   24.14 -    _start_counter = os::elapsed_counter();
   24.15 +    _start_counter.stamp();
   24.16    }
   24.17  
   24.18    if (_timer != NULL) {
   24.19 @@ -57,10 +58,10 @@
   24.20  }
   24.21  
   24.22  GCTraceTime::~GCTraceTime() {
   24.23 -  jlong stop_counter = 0;
   24.24 +  Ticks stop_counter;
   24.25  
   24.26    if (_doit || _timer != NULL) {
   24.27 -    stop_counter = os::elapsed_counter();
   24.28 +    stop_counter.stamp();
   24.29    }
   24.30  
   24.31    if (_timer != NULL) {
   24.32 @@ -68,11 +69,12 @@
   24.33    }
   24.34  
   24.35    if (_doit) {
   24.36 -    double seconds = TimeHelper::counter_to_seconds(stop_counter - _start_counter);
   24.37 +    const Tickspan duration = stop_counter - _start_counter;
   24.38 +    double duration_in_seconds = TicksToTimeHelper::seconds(duration);
   24.39      if (_print_cr) {
   24.40 -      gclog_or_tty->print_cr(", %3.7f secs]", seconds);
   24.41 +      gclog_or_tty->print_cr(", %3.7f secs]", duration_in_seconds);
   24.42      } else {
   24.43 -      gclog_or_tty->print(", %3.7f secs]", seconds);
   24.44 +      gclog_or_tty->print(", %3.7f secs]", duration_in_seconds);
   24.45      }
   24.46      gclog_or_tty->flush();
   24.47    }
    25.1 --- a/src/share/vm/gc_implementation/shared/gcTraceTime.hpp	Tue Nov 26 14:35:38 2013 +0100
    25.2 +++ b/src/share/vm/gc_implementation/shared/gcTraceTime.hpp	Mon Dec 02 15:43:04 2013 +0100
    25.3 @@ -26,6 +26,7 @@
    25.4  #define SHARE_VM_GC_IMPLEMENTATION_SHARED_GCTRACETIME_HPP
    25.5  
    25.6  #include "prims/jni_md.h"
    25.7 +#include "utilities/ticks.hpp"
    25.8  
    25.9  class GCTimer;
   25.10  
   25.11 @@ -34,7 +35,7 @@
   25.12    bool _doit;
   25.13    bool _print_cr;
   25.14    GCTimer* _timer;
   25.15 -  jlong _start_counter;
   25.16 +  Ticks _start_counter;
   25.17  
   25.18   public:
   25.19    GCTraceTime(const char* title, bool doit, bool print_cr, GCTimer* timer);
    26.1 --- a/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp	Tue Nov 26 14:35:38 2013 +0100
    26.2 +++ b/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp	Mon Dec 02 15:43:04 2013 +0100
    26.3 @@ -28,10 +28,11 @@
    26.4  #include "memory/heapInspection.hpp"
    26.5  #include "trace/tracing.hpp"
    26.6  #include "utilities/globalDefinitions.hpp"
    26.7 +#include "utilities/ticks.hpp"
    26.8  
    26.9  #if INCLUDE_SERVICES
   26.10  
   26.11 -void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp) {
   26.12 +void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, const Ticks& timestamp) {
   26.13  #if INCLUDE_TRACE
   26.14    assert(Tracing::is_event_enabled(EventObjectCountAfterGC::eventId),
   26.15           "Only call this method if the event is enabled");
    27.1 --- a/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp	Tue Nov 26 14:35:38 2013 +0100
    27.2 +++ b/src/share/vm/gc_implementation/shared/objectCountEventSender.hpp	Mon Dec 02 15:43:04 2013 +0100
    27.3 @@ -32,10 +32,11 @@
    27.4  #if INCLUDE_SERVICES
    27.5  
    27.6  class KlassInfoEntry;
    27.7 +class Ticks;
    27.8  
    27.9  class ObjectCountEventSender : public AllStatic {
   27.10   public:
   27.11 -  static void send(const KlassInfoEntry* entry, GCId gc_id, jlong timestamp);
   27.12 +  static void send(const KlassInfoEntry* entry, GCId gc_id, const Ticks& timestamp);
   27.13    static bool should_send_event();
   27.14  };
   27.15  
    28.1 --- a/src/share/vm/interpreter/linkResolver.cpp	Tue Nov 26 14:35:38 2013 +0100
    28.2 +++ b/src/share/vm/interpreter/linkResolver.cpp	Mon Dec 02 15:43:04 2013 +0100
    28.3 @@ -915,6 +915,25 @@
    28.4      return;
    28.5    }
    28.6  
    28.7 +  // check if invokespecial's interface method reference is in an indirect superinterface
    28.8 +  if (!current_klass.is_null() && resolved_klass->is_interface()) {
    28.9 +    Klass *klass_to_check = !InstanceKlass::cast(current_klass())->is_anonymous() ?
   28.10 +                                  current_klass() :
   28.11 +                                  InstanceKlass::cast(current_klass())->host_klass();
   28.12 +
   28.13 +    if (!InstanceKlass::cast(klass_to_check)->is_same_or_direct_interface(resolved_klass())) {
   28.14 +      ResourceMark rm(THREAD);
   28.15 +      char buf[200];
   28.16 +      jio_snprintf(buf, sizeof(buf),
   28.17 +                   "Interface method reference: %s, is in an indirect superinterface of %s",
   28.18 +                   Method::name_and_sig_as_C_string(resolved_klass(),
   28.19 +                                                         resolved_method->name(),
   28.20 +                                                         resolved_method->signature()),
   28.21 +                   current_klass->external_name());
   28.22 +      THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   28.23 +    }
   28.24 +  }
   28.25 +
   28.26    // check if not static
   28.27    if (resolved_method->is_static()) {
   28.28      ResourceMark rm(THREAD);
    29.1 --- a/src/share/vm/memory/defNewGeneration.cpp	Tue Nov 26 14:35:38 2013 +0100
    29.2 +++ b/src/share/vm/memory/defNewGeneration.cpp	Mon Dec 02 15:43:04 2013 +0100
    29.3 @@ -562,7 +562,7 @@
    29.4  
    29.5    GenCollectedHeap* gch = GenCollectedHeap::heap();
    29.6  
    29.7 -  _gc_timer->register_gc_start(os::elapsed_counter());
    29.8 +  _gc_timer->register_gc_start();
    29.9    DefNewTracer gc_tracer;
   29.10    gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start());
   29.11  
   29.12 @@ -709,7 +709,7 @@
   29.13    gch->trace_heap_after_gc(&gc_tracer);
   29.14    gc_tracer.report_tenuring_threshold(tenuring_threshold());
   29.15  
   29.16 -  _gc_timer->register_gc_end(os::elapsed_counter());
   29.17 +  _gc_timer->register_gc_end();
   29.18  
   29.19    gc_tracer.report_gc_end(_gc_timer->gc_end(), _gc_timer->time_partitions());
   29.20  }
    30.1 --- a/src/share/vm/memory/generation.cpp	Tue Nov 26 14:35:38 2013 +0100
    30.2 +++ b/src/share/vm/memory/generation.cpp	Mon Dec 02 15:43:04 2013 +0100
    30.3 @@ -635,16 +635,16 @@
    30.4      x(ref_processor(), gch->reserved_region());
    30.5  
    30.6    STWGCTimer* gc_timer = GenMarkSweep::gc_timer();
    30.7 -  gc_timer->register_gc_start(os::elapsed_counter());
    30.8 +  gc_timer->register_gc_start();
    30.9  
   30.10    SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
   30.11    gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
   30.12  
   30.13    GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_soft_refs);
   30.14  
   30.15 -  gc_timer->register_gc_end(os::elapsed_counter());
   30.16 +  gc_timer->register_gc_end();
   30.17  
   30.18 -  gc_tracer->report_gc_end(os::elapsed_counter(), gc_timer->time_partitions());
   30.19 +  gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
   30.20  
   30.21    SpecializationStats::print();
   30.22  }
    31.1 --- a/src/share/vm/memory/universe.cpp	Tue Nov 26 14:35:38 2013 +0100
    31.2 +++ b/src/share/vm/memory/universe.cpp	Mon Dec 02 15:43:04 2013 +0100
    31.3 @@ -120,6 +120,7 @@
    31.4  oop Universe::_arithmetic_exception_instance          = NULL;
    31.5  oop Universe::_virtual_machine_error_instance         = NULL;
    31.6  oop Universe::_vm_exception                           = NULL;
    31.7 +Method* Universe::_throw_illegal_access_error         = NULL;
    31.8  Array<int>* Universe::_the_empty_int_array            = NULL;
    31.9  Array<u2>* Universe::_the_empty_short_array           = NULL;
   31.10  Array<Klass*>* Universe::_the_empty_klass_array     = NULL;
   31.11 @@ -1096,6 +1097,18 @@
   31.12    Universe::_finalizer_register_cache->init(
   31.13      SystemDictionary::Finalizer_klass(), m);
   31.14  
   31.15 +  InstanceKlass::cast(SystemDictionary::misc_Unsafe_klass())->link_class(CHECK_false);
   31.16 +  m = InstanceKlass::cast(SystemDictionary::misc_Unsafe_klass())->find_method(
   31.17 +                                  vmSymbols::throwIllegalAccessError_name(),
   31.18 +                                  vmSymbols::void_method_signature());
   31.19 +  if (m != NULL && !m->is_static()) {
   31.20 +    // Note null is okay; this method is used in itables, and if it is null,
   31.21 +    // then AbstractMethodError is thrown instead.
   31.22 +    tty->print_cr("Unable to link/verify Unsafe.throwIllegalAccessError method");
   31.23 +    return false; // initialization failed (cannot throw exception yet)
   31.24 +  }
   31.25 +  Universe::_throw_illegal_access_error = m;
   31.26 +
   31.27    // Setup method for registering loaded classes in class loader vector
   31.28    InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->link_class(CHECK_false);
   31.29    m = InstanceKlass::cast(SystemDictionary::ClassLoader_klass())->find_method(vmSymbols::addClass_name(), vmSymbols::class_void_signature());
    32.1 --- a/src/share/vm/memory/universe.hpp	Tue Nov 26 14:35:38 2013 +0100
    32.2 +++ b/src/share/vm/memory/universe.hpp	Mon Dec 02 15:43:04 2013 +0100
    32.3 @@ -149,6 +149,8 @@
    32.4    static LatestMethodCache* _loader_addClass_cache;    // method for registering loaded classes in class loader vector
    32.5    static LatestMethodCache* _pd_implies_cache;         // method for checking protection domain attributes
    32.6  
    32.7 +  static Method* _throw_illegal_access_error;
    32.8 +
    32.9    // preallocated error objects (no backtrace)
   32.10    static oop          _out_of_memory_error_java_heap;
   32.11    static oop          _out_of_memory_error_metaspace;
   32.12 @@ -305,6 +307,7 @@
   32.13    static oop          arithmetic_exception_instance() { return _arithmetic_exception_instance; }
   32.14    static oop          virtual_machine_error_instance() { return _virtual_machine_error_instance; }
   32.15    static oop          vm_exception()                  { return _vm_exception; }
   32.16 +  static Method*      throw_illegal_access_error()    { return _throw_illegal_access_error; }
   32.17  
   32.18    static Array<int>*       the_empty_int_array()    { return _the_empty_int_array; }
   32.19    static Array<u2>*        the_empty_short_array()  { return _the_empty_short_array; }
    33.1 --- a/src/share/vm/oops/instanceKlass.cpp	Tue Nov 26 14:35:38 2013 +0100
    33.2 +++ b/src/share/vm/oops/instanceKlass.cpp	Mon Dec 02 15:43:04 2013 +0100
    33.3 @@ -1051,6 +1051,18 @@
    33.4    return false;
    33.5  }
    33.6  
    33.7 +bool InstanceKlass::is_same_or_direct_interface(Klass *k) const {
    33.8 +  // Verify direct super interface
    33.9 +  if (this == k) return true;
   33.10 +  assert(k->is_interface(), "should be an interface class");
   33.11 +  for (int i = 0; i < local_interfaces()->length(); i++) {
   33.12 +    if (local_interfaces()->at(i) == k) {
   33.13 +      return true;
   33.14 +    }
   33.15 +  }
   33.16 +  return false;
   33.17 +}
   33.18 +
   33.19  objArrayOop InstanceKlass::allocate_objArray(int n, int length, TRAPS) {
   33.20    if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
   33.21    if (length > arrayOopDesc::max_array_length(T_OBJECT)) {
    34.1 --- a/src/share/vm/oops/instanceKlass.hpp	Tue Nov 26 14:35:38 2013 +0100
    34.2 +++ b/src/share/vm/oops/instanceKlass.hpp	Mon Dec 02 15:43:04 2013 +0100
    34.3 @@ -777,6 +777,7 @@
    34.4  
    34.5    // subclass/subinterface checks
    34.6    bool implements_interface(Klass* k) const;
    34.7 +  bool is_same_or_direct_interface(Klass* k) const;
    34.8  
    34.9    // Access to the implementor of an interface.
   34.10    Klass* implementor() const
    35.1 --- a/src/share/vm/oops/klassVtable.cpp	Tue Nov 26 14:35:38 2013 +0100
    35.2 +++ b/src/share/vm/oops/klassVtable.cpp	Mon Dec 02 15:43:04 2013 +0100
    35.3 @@ -1076,7 +1076,12 @@
    35.4        LinkResolver::lookup_instance_method_in_klasses(target, _klass, m->name(), m->signature(), CHECK);
    35.5      }
    35.6      if (target == NULL || !target->is_public() || target->is_abstract()) {
    35.7 -      // Entry do not resolve. Leave it empty
    35.8 +      // Entry does not resolve. Leave it empty for AbstractMethodError.
    35.9 +        if (!(target == NULL) && !target->is_public()) {
   35.10 +          // Stuff an IllegalAccessError throwing method in there instead.
   35.11 +          itableOffsetEntry::method_entry(_klass(), method_table_offset)[m->itable_index()].
   35.12 +              initialize(Universe::throw_illegal_access_error());
   35.13 +        }
   35.14      } else {
   35.15        // Entry did resolve, check loader constraints before initializing
   35.16        // if checkconstraints requested
    36.1 --- a/src/share/vm/opto/compile.hpp	Tue Nov 26 14:35:38 2013 +0100
    36.2 +++ b/src/share/vm/opto/compile.hpp	Mon Dec 02 15:43:04 2013 +0100
    36.3 @@ -42,6 +42,7 @@
    36.4  #include "runtime/deoptimization.hpp"
    36.5  #include "runtime/vmThread.hpp"
    36.6  #include "trace/tracing.hpp"
    36.7 +#include "utilities/ticks.hpp"
    36.8  
    36.9  class Block;
   36.10  class Bundle;
   36.11 @@ -597,20 +598,19 @@
   36.12    bool              has_method_handle_invokes() const { return _has_method_handle_invokes;     }
   36.13    void          set_has_method_handle_invokes(bool z) {        _has_method_handle_invokes = z; }
   36.14  
   36.15 -  jlong _latest_stage_start_counter;
   36.16 +  Ticks _latest_stage_start_counter;
   36.17  
   36.18    void begin_method() {
   36.19  #ifndef PRODUCT
   36.20      if (_printer) _printer->begin_method(this);
   36.21  #endif
   36.22 -    C->_latest_stage_start_counter = os::elapsed_counter();
   36.23 +    C->_latest_stage_start_counter.stamp();
   36.24    }
   36.25  
   36.26    void print_method(CompilerPhaseType cpt, int level = 1) {
   36.27 -    EventCompilerPhase event(UNTIMED);
   36.28 +    EventCompilerPhase event;
   36.29      if (event.should_commit()) {
   36.30        event.set_starttime(C->_latest_stage_start_counter);
   36.31 -      event.set_endtime(os::elapsed_counter());
   36.32        event.set_phase((u1) cpt);
   36.33        event.set_compileID(C->_compile_id);
   36.34        event.set_phaseLevel(level);
   36.35 @@ -621,14 +621,13 @@
   36.36  #ifndef PRODUCT
   36.37      if (_printer) _printer->print_method(this, CompilerPhaseTypeHelper::to_string(cpt), level);
   36.38  #endif
   36.39 -    C->_latest_stage_start_counter = os::elapsed_counter();
   36.40 +    C->_latest_stage_start_counter.stamp();
   36.41    }
   36.42  
   36.43    void end_method(int level = 1) {
   36.44 -    EventCompilerPhase event(UNTIMED);
   36.45 +    EventCompilerPhase event;
   36.46      if (event.should_commit()) {
   36.47        event.set_starttime(C->_latest_stage_start_counter);
   36.48 -      event.set_endtime(os::elapsed_counter());
   36.49        event.set_phase((u1) PHASE_END);
   36.50        event.set_compileID(C->_compile_id);
   36.51        event.set_phaseLevel(level);
    37.1 --- a/src/share/vm/prims/jvmtiImpl.hpp	Tue Nov 26 14:35:38 2013 +0100
    37.2 +++ b/src/share/vm/prims/jvmtiImpl.hpp	Mon Dec 02 15:43:04 2013 +0100
    37.3 @@ -299,7 +299,7 @@
    37.4    static inline bool is_breakpoint(address bcp);
    37.5  
    37.6    static void oops_do(OopClosure* f);
    37.7 -  static void metadata_do(void f(Metadata*));
    37.8 +  static void metadata_do(void f(Metadata*)) NOT_JVMTI_RETURN;
    37.9    static void gc_epilogue();
   37.10  };
   37.11  
    38.1 --- a/src/share/vm/runtime/sweeper.cpp	Tue Nov 26 14:35:38 2013 +0100
    38.2 +++ b/src/share/vm/runtime/sweeper.cpp	Mon Dec 02 15:43:04 2013 +0100
    38.3 @@ -38,6 +38,7 @@
    38.4  #include "runtime/vm_operations.hpp"
    38.5  #include "trace/tracing.hpp"
    38.6  #include "utilities/events.hpp"
    38.7 +#include "utilities/ticks.inline.hpp"
    38.8  #include "utilities/xmlstream.hpp"
    38.9  
   38.10  #ifdef ASSERT
   38.11 @@ -144,10 +145,10 @@
   38.12                                                                 //   3) zombie      -> marked_for_reclamation
   38.13  
   38.14  int   NMethodSweeper::_total_nof_methods_reclaimed     = 0;    // Accumulated nof methods flushed
   38.15 -jlong NMethodSweeper::_total_time_sweeping             = 0;    // Accumulated time sweeping
   38.16 -jlong NMethodSweeper::_total_time_this_sweep           = 0;    // Total time this sweep
   38.17 -jlong NMethodSweeper::_peak_sweep_time                 = 0;    // Peak time for a full sweep
   38.18 -jlong NMethodSweeper::_peak_sweep_fraction_time        = 0;    // Peak time sweeping one fraction
   38.19 +Tickspan NMethodSweeper::_total_time_sweeping;                 // Accumulated time sweeping
   38.20 +Tickspan NMethodSweeper::_total_time_this_sweep;               // Total time this sweep
   38.21 +Tickspan NMethodSweeper::_peak_sweep_time;                     // Peak time for a full sweep
   38.22 +Tickspan NMethodSweeper::_peak_sweep_fraction_time;            // Peak time sweeping one fraction
   38.23  int   NMethodSweeper::_hotness_counter_reset_val       = 0;
   38.24  
   38.25  
   38.26 @@ -209,7 +210,7 @@
   38.27      _sweep_fractions_left = NmethodSweepFraction;
   38.28      _current = CodeCache::first_nmethod();
   38.29      _traversals += 1;
   38.30 -    _total_time_this_sweep = 0;
   38.31 +    _total_time_this_sweep = Tickspan();
   38.32  
   38.33      if (PrintMethodFlushing) {
   38.34        tty->print_cr("### Sweep: stack traversal %d", _traversals);
   38.35 @@ -303,7 +304,7 @@
   38.36  }
   38.37  
   38.38  void NMethodSweeper::sweep_code_cache() {
   38.39 -  jlong sweep_start_counter = os::elapsed_counter();
   38.40 +  Ticks sweep_start_counter = Ticks::now();
   38.41  
   38.42    _flushed_count                = 0;
   38.43    _zombified_count              = 0;
   38.44 @@ -367,8 +368,8 @@
   38.45  
   38.46    assert(_sweep_fractions_left > 1 || _current == NULL, "must have scanned the whole cache");
   38.47  
   38.48 -  jlong sweep_end_counter = os::elapsed_counter();
   38.49 -  jlong sweep_time = sweep_end_counter - sweep_start_counter;
   38.50 +  const Ticks sweep_end_counter = Ticks::now();
   38.51 +  const Tickspan sweep_time = sweep_end_counter - sweep_start_counter;
   38.52    _total_time_sweeping  += sweep_time;
   38.53    _total_time_this_sweep += sweep_time;
   38.54    _peak_sweep_fraction_time = MAX2(sweep_time, _peak_sweep_fraction_time);
   38.55 @@ -389,7 +390,8 @@
   38.56  
   38.57  #ifdef ASSERT
   38.58    if(PrintMethodFlushing) {
   38.59 -    tty->print_cr("### sweeper:      sweep time(%d): " INT64_FORMAT, _sweep_fractions_left, (jlong)sweep_time);
   38.60 +    tty->print_cr("### sweeper:      sweep time(%d): "
   38.61 +      INT64_FORMAT, _sweep_fractions_left, (jlong)sweep_time.value());
   38.62    }
   38.63  #endif
   38.64  
    39.1 --- a/src/share/vm/runtime/sweeper.hpp	Tue Nov 26 14:35:38 2013 +0100
    39.2 +++ b/src/share/vm/runtime/sweeper.hpp	Mon Dec 02 15:43:04 2013 +0100
    39.3 @@ -25,6 +25,7 @@
    39.4  #ifndef SHARE_VM_RUNTIME_SWEEPER_HPP
    39.5  #define SHARE_VM_RUNTIME_SWEEPER_HPP
    39.6  
    39.7 +#include "utilities/ticks.hpp"
    39.8  // An NmethodSweeper is an incremental cleaner for:
    39.9  //    - cleanup inline caches
   39.10  //    - reclamation of nmethods
   39.11 @@ -71,10 +72,10 @@
   39.12                                                    //   3) zombie      -> marked_for_reclamation
   39.13    // Stat counters
   39.14    static int       _total_nof_methods_reclaimed;  // Accumulated nof methods flushed
   39.15 -  static jlong     _total_time_sweeping;          // Accumulated time sweeping
   39.16 -  static jlong     _total_time_this_sweep;        // Total time this sweep
   39.17 -  static jlong     _peak_sweep_time;              // Peak time for a full sweep
   39.18 -  static jlong     _peak_sweep_fraction_time;     // Peak time sweeping one fraction
   39.19 +  static Tickspan  _total_time_sweeping;          // Accumulated time sweeping
   39.20 +  static Tickspan  _total_time_this_sweep;        // Total time this sweep
   39.21 +  static Tickspan  _peak_sweep_time;              // Peak time for a full sweep
   39.22 +  static Tickspan  _peak_sweep_fraction_time;     // Peak time sweeping one fraction
   39.23  
   39.24    static int  process_nmethod(nmethod *nm);
   39.25    static void release_nmethod(nmethod* nm);
   39.26 @@ -87,9 +88,9 @@
   39.27   public:
   39.28    static long traversal_count()              { return _traversals; }
   39.29    static int  total_nof_methods_reclaimed()  { return _total_nof_methods_reclaimed; }
   39.30 -  static jlong total_time_sweeping()         { return _total_time_sweeping; }
   39.31 -  static jlong peak_sweep_time()             { return _peak_sweep_time; }
   39.32 -  static jlong peak_sweep_fraction_time()    { return _peak_sweep_fraction_time; }
   39.33 +  static const Tickspan total_time_sweeping()      { return _total_time_sweeping; }
   39.34 +  static const Tickspan peak_sweep_time()          { return _peak_sweep_time; }
   39.35 +  static const Tickspan peak_sweep_fraction_time() { return _peak_sweep_fraction_time; }
   39.36    static void log_sweep(const char* msg, const char* format = NULL, ...);
   39.37  
   39.38  
    40.1 --- a/src/share/vm/trace/noTraceBackend.hpp	Tue Nov 26 14:35:38 2013 +0100
    40.2 +++ b/src/share/vm/trace/noTraceBackend.hpp	Mon Dec 02 15:43:04 2013 +0100
    40.3 @@ -25,9 +25,7 @@
    40.4  #define SHARE_VM_TRACE_NOTRACEBACKEND_HPP
    40.5  
    40.6  #include "prims/jni.h"
    40.7 -
    40.8 -typedef jlong TracingTime;
    40.9 -typedef jlong RelativeTracingTime;
   40.10 +#include "trace/traceTime.hpp"
   40.11  
   40.12  class NoTraceBackend {
   40.13  public:
   40.14 @@ -44,5 +42,3 @@
   40.15  typedef NoTraceBackend Tracing;
   40.16  
   40.17  #endif
   40.18 -
   40.19 -
    41.1 --- a/src/share/vm/trace/trace.xml	Tue Nov 26 14:35:38 2013 +0100
    41.2 +++ b/src/share/vm/trace/trace.xml	Mon Dec 02 15:43:04 2013 +0100
    41.3 @@ -176,8 +176,8 @@
    41.4        <value type="UINT" field="gcId"  label="GC ID" relation="GC_ID" />
    41.5        <value type="GCNAME" field="name" label="Name" description="The name of the Garbage Collector" />
    41.6        <value type="GCCAUSE" field="cause" label="Cause" description="The reason for triggering this Garbage Collection" />
    41.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" />
    41.8 -      <value type="RELATIVE_TICKS" field="longestPause" label="Longest Pause" description="Longest individual pause during the garbage collection" />
    41.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" />
   41.10 +      <value type="TICKSPAN" field="longestPause" label="Longest Pause" description="Longest individual pause during the garbage collection" />
   41.11      </event>
   41.12  
   41.13      <event id="GCParallelOld" path="vm/gc/collector/parold_garbage_collection" label="Parallel Old Garbage Collection"
    42.1 --- a/src/share/vm/trace/traceBackend.hpp	Tue Nov 26 14:35:38 2013 +0100
    42.2 +++ b/src/share/vm/trace/traceBackend.hpp	Mon Dec 02 15:43:04 2013 +0100
    42.3 @@ -47,10 +47,6 @@
    42.4      return os::elapsed_counter();
    42.5    }
    42.6  
    42.7 -  static TracingTime time_adjustment(jlong time) {
    42.8 -    return time;
    42.9 -  }
   42.10 -
   42.11    static void on_unloading_classes(void) {
   42.12    }
   42.13  };
    43.1 --- a/src/share/vm/trace/traceEvent.hpp	Tue Nov 26 14:35:38 2013 +0100
    43.2 +++ b/src/share/vm/trace/traceEvent.hpp	Mon Dec 02 15:43:04 2013 +0100
    43.3 @@ -25,26 +25,23 @@
    43.4  #ifndef SHARE_VM_TRACE_TRACEEVENT_HPP
    43.5  #define SHARE_VM_TRACE_TRACEEVENT_HPP
    43.6  
    43.7 +#include "utilities/macros.hpp"
    43.8 +
    43.9  enum EventStartTime {
   43.10    UNTIMED,
   43.11    TIMED
   43.12  };
   43.13  
   43.14 -#include "utilities/macros.hpp"
   43.15 -
   43.16  #if INCLUDE_TRACE
   43.17  
   43.18  #include "trace/traceBackend.hpp"
   43.19  #include "trace/tracing.hpp"
   43.20  #include "tracefiles/traceEventIds.hpp"
   43.21  #include "tracefiles/traceTypes.hpp"
   43.22 +#include "utilities/ticks.hpp"
   43.23  
   43.24  template<typename T>
   43.25  class TraceEvent : public StackObj {
   43.26 - protected:
   43.27 -  jlong _startTime;
   43.28 -  jlong _endTime;
   43.29 -
   43.30   private:
   43.31    bool _started;
   43.32  #ifdef ASSERT
   43.33 @@ -54,6 +51,18 @@
   43.34    bool _ignore_check;
   43.35  #endif
   43.36  
   43.37 + protected:
   43.38 +  jlong _startTime;
   43.39 +  jlong _endTime;
   43.40 +
   43.41 +  void set_starttime(const TracingTime& time) {
   43.42 +    _startTime = time;
   43.43 +  }
   43.44 +
   43.45 +  void set_endtime(const TracingTime& time) {
   43.46 +    _endTime = time;
   43.47 +  }
   43.48 +
   43.49   public:
   43.50    TraceEvent(EventStartTime timing=TIMED) :
   43.51      _startTime(0),
   43.52 @@ -100,12 +109,12 @@
   43.53      set_commited();
   43.54    }
   43.55  
   43.56 -  void set_starttime(jlong time) {
   43.57 -    _startTime = time;
   43.58 +  void set_starttime(const Ticks& time) {
   43.59 +    _startTime = time.value();
   43.60    }
   43.61  
   43.62 -  void set_endtime(jlong time) {
   43.63 -    _endTime = time;
   43.64 +  void set_endtime(const Ticks& time) {
   43.65 +    _endTime = time.value();
   43.66    }
   43.67  
   43.68    TraceEventId id() const {
    44.1 --- a/src/share/vm/trace/traceEventClasses.xsl	Tue Nov 26 14:35:38 2013 +0100
    44.2 +++ b/src/share/vm/trace/traceEventClasses.xsl	Mon Dec 02 15:43:04 2013 +0100
    44.3 @@ -40,6 +40,7 @@
    44.4  #include "tracefiles/traceTypes.hpp"
    44.5  #include "trace/traceEvent.hpp"
    44.6  #include "utilities/macros.hpp"
    44.7 +#include "utilities/ticks.hpp"
    44.8  
    44.9  #if INCLUDE_TRACE
   44.10  
   44.11 @@ -55,8 +56,8 @@
   44.12  class TraceEvent {
   44.13  public:
   44.14    TraceEvent() {}
   44.15 -  void set_starttime(jlong time) const {}
   44.16 -  void set_endtime(jlong time) const {}
   44.17 +  void set_starttime(const Ticks&amp; time) {}
   44.18 +  void set_endtime(const Ticks&amp; time) {}
   44.19    bool should_commit() const { return false; }
   44.20    void commit() const {}
   44.21  };
   44.22 @@ -170,23 +171,23 @@
   44.23    </xsl:if>
   44.24  </xsl:template>
   44.25  
   44.26 -
   44.27  <xsl:template match="value[@type='TICKS']" mode="write-setters">
   44.28  #if INCLUDE_TRACE
   44.29 -  <xsl:value-of select="concat('void set_', @field, '(jlong time) { _', @field, ' = time; }')"/>
   44.30 +<xsl:value-of select="concat('  void set_', @field, '(const Ticks&amp; time) { _', @field, ' = time; }')"/>
   44.31  #else
   44.32 -  <xsl:value-of select="concat('void set_', @field, '(jlong ignore) {}')"/>
   44.33 +<xsl:value-of select="concat('  void set_', @field, '(const Ticks&amp; ignore) {}')"/>
   44.34  #endif
   44.35  </xsl:template>
   44.36  
   44.37 -<xsl:template match="value[@type='RELATIVE_TICKS']" mode="write-setters">
   44.38 +<xsl:template match="value[@type='TICKSPAN']" mode="write-setters">
   44.39  #if INCLUDE_TRACE
   44.40 -  <xsl:value-of select="concat('void set_', @field, '(jlong time) { _', @field, ' = time; }')"/>
   44.41 +  <xsl:value-of select="concat('  void set_', @field, '(const Tickspan&amp; time) { _', @field, ' = time; }')"/>
   44.42  #else
   44.43 -  <xsl:value-of select="concat('void set_', @field, '(jlong ignore) {}')"/>
   44.44 +  <xsl:value-of select="concat('  void set_', @field, '(const Tickspan&amp; ignore) {}')"/>
   44.45  #endif
   44.46  </xsl:template>
   44.47  
   44.48 +
   44.49  <xsl:template match="value" mode="write-fields">
   44.50    <xsl:variable name="type" select="@type"/>
   44.51    <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@type"/>
   44.52 @@ -226,7 +227,17 @@
   44.53  <xsl:template match="value" mode="write-data">
   44.54    <xsl:variable name="type" select="@type"/>
   44.55    <xsl:variable name="wt" select="//primary_type[@symbol=$type]/@writetype"/>
   44.56 -  <xsl:value-of select="concat('    ts.print_val(&quot;', @label, '&quot;, _', @field, ');')"/>
   44.57 +  <xsl:choose>
   44.58 +    <xsl:when test="@type='TICKSPAN'">
   44.59 +      <xsl:value-of select="concat('    ts.print_val(&quot;', @label, '&quot;, _', @field, '.value());')"/>
   44.60 +    </xsl:when>
   44.61 +    <xsl:when test="@type='TICKS'">
   44.62 +      <xsl:value-of select="concat('    ts.print_val(&quot;', @label, '&quot;, _', @field, '.value());')"/>
   44.63 +    </xsl:when>
   44.64 +    <xsl:otherwise>
   44.65 +      <xsl:value-of select="concat('    ts.print_val(&quot;', @label, '&quot;, _', @field, ');')"/>
   44.66 +    </xsl:otherwise>
   44.67 +  </xsl:choose>
   44.68    <xsl:if test="position() != last()">
   44.69      <xsl:text>
   44.70      ts.print(", ");
    45.1 --- a/src/share/vm/trace/traceTime.hpp	Tue Nov 26 14:35:38 2013 +0100
    45.2 +++ b/src/share/vm/trace/traceTime.hpp	Mon Dec 02 15:43:04 2013 +0100
    45.3 @@ -28,6 +28,5 @@
    45.4  #include "prims/jni.h"
    45.5  
    45.6  typedef jlong TracingTime;
    45.7 -typedef jlong RelativeTracingTime;
    45.8  
    45.9 -#endif
   45.10 +#endif // SHARE_VM_TRACE_TRACETIME_HPP
    46.1 --- a/src/share/vm/trace/traceTypes.xsl	Tue Nov 26 14:35:38 2013 +0100
    46.2 +++ b/src/share/vm/trace/traceTypes.xsl	Mon Dec 02 15:43:04 2013 +0100
    46.3 @@ -32,9 +32,11 @@
    46.4  #ifndef TRACEFILES_JFRTYPES_HPP
    46.5  #define TRACEFILES_JFRTYPES_HPP
    46.6  
    46.7 +#include "oops/symbol.hpp"
    46.8  #include "trace/traceDataTypes.hpp"
    46.9  #include "utilities/globalDefinitions.hpp"
   46.10 -#include "oops/symbol.hpp"
   46.11 +#include "utilities/ticks.hpp"
   46.12 +
   46.13  
   46.14  enum JVMContentType {
   46.15    _not_a_content_type = (JVM_CONTENT_TYPES_START - 1),
    47.1 --- a/src/share/vm/trace/tracetypes.xml	Tue Nov 26 14:35:38 2013 +0100
    47.2 +++ b/src/share/vm/trace/tracetypes.xml	Mon Dec 02 15:43:04 2013 +0100
    47.3 @@ -249,13 +249,13 @@
    47.4      <primary_type symbol="NANOS" datatype="LONG" contenttype="NANOS"
    47.5                    type="s8" sizeop="sizeof(s8)"/>
    47.6  
    47.7 -    <!-- 64-bit signed integer, SEMANTIC value ABSOLUTE TICKS -->
    47.8 +    <!-- 64-bit signed integer, SEMANTIC value TICKS -->
    47.9      <primary_type symbol="TICKS" datatype="LONG" contenttype="TICKS"
   47.10 -                  type="s8" sizeop="sizeof(s8)"/>
   47.11 +                  type="Ticks" sizeop="sizeof(s8)"/>
   47.12  
   47.13 -    <!-- 64-bit signed integer, SEMANTIC value RELATIVE TICKS -->
   47.14 -    <primary_type symbol="RELATIVE_TICKS" datatype="LONG" contenttype="TICKS"
   47.15 -                  type="s8" sizeop="sizeof(s8)"/>
   47.16 +    <!-- 64-bit signed integer, SEMANTIC value TICKS duration -->
   47.17 +    <primary_type symbol="TICKSPAN" datatype="LONG" contenttype="TICKS"
   47.18 +                  type="Tickspan" sizeop="sizeof(s8)"/>
   47.19  
   47.20      <!-- 64-bit unsigned integer, SEMANTIC value ADDRESS (mem loc) -->
   47.21      <primary_type symbol="ADDRESS" datatype="U8" contenttype="ADDRESS"
    48.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    48.2 +++ b/src/share/vm/utilities/ticks.cpp	Mon Dec 02 15:43:04 2013 +0100
    48.3 @@ -0,0 +1,68 @@
    48.4 +/*
    48.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    48.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    48.7 + *
    48.8 + * This code is free software; you can redistribute it and/or modify it
    48.9 + * under the terms of the GNU General Public License version 2 only, as
   48.10 + * published by the Free Software Foundation.
   48.11 + *
   48.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   48.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   48.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   48.15 + * version 2 for more details (a copy is included in the LICENSE file that
   48.16 + * accompanied this code).
   48.17 + *
   48.18 + * You should have received a copy of the GNU General Public License version
   48.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   48.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   48.21 + *
   48.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   48.23 + * or visit www.oracle.com if you need additional information or have any
   48.24 + * questions.
   48.25 + *
   48.26 + */
   48.27 +
   48.28 +#include "precompiled.hpp"
   48.29 +#include "runtime/os.hpp"
   48.30 +#include "utilities/ticks.inline.hpp"
   48.31 +
   48.32 +#ifdef ASSERT
   48.33 + const jlong Ticks::invalid_time_stamp = -2; // 0xFFFF FFFF`FFFF FFFE
   48.34 +#endif
   48.35 +
   48.36 +void Ticks::stamp() {
   48.37 +  _stamp_ticks = os::elapsed_counter();
   48.38 +}
   48.39 +
   48.40 +const Ticks Ticks::now() {
   48.41 +  Ticks t;
   48.42 +  t.stamp();
   48.43 +  return t;
   48.44 +}
   48.45 +
   48.46 +Tickspan::Tickspan(const Ticks& end, const Ticks& start) {
   48.47 +  assert(end.value() != Ticks::invalid_time_stamp, "end is unstamped!");
   48.48 +  assert(start.value() != Ticks::invalid_time_stamp, "start is unstamped!");
   48.49 +
   48.50 +  assert(end >= start, "negative time!");
   48.51 +
   48.52 +  _span_ticks = end.value() - start.value();
   48.53 +}
   48.54 +
   48.55 +template <typename ReturnType>
   48.56 +static ReturnType time_conversion(const Tickspan& span, TicksToTimeHelper::Unit unit) {
   48.57 +  assert(TicksToTimeHelper::SECONDS == unit ||
   48.58 +         TicksToTimeHelper::MILLISECONDS == unit, "invalid unit!");
   48.59 +
   48.60 +  ReturnType frequency_per_unit = (ReturnType)os::elapsed_frequency() / (ReturnType)unit;
   48.61 +
   48.62 +  return (ReturnType) ((ReturnType)span.value() / frequency_per_unit);
   48.63 +}
   48.64 +
   48.65 +double TicksToTimeHelper::seconds(const Tickspan& span) {
   48.66 +  return time_conversion<double>(span, SECONDS);
   48.67 +}
   48.68 +
   48.69 +jlong TicksToTimeHelper::milliseconds(const Tickspan& span) {
   48.70 +  return time_conversion<jlong>(span, MILLISECONDS);
   48.71 +}
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/src/share/vm/utilities/ticks.hpp	Mon Dec 02 15:43:04 2013 +0100
    49.3 @@ -0,0 +1,111 @@
    49.4 +/*
    49.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    49.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.7 + *
    49.8 + * This code is free software; you can redistribute it and/or modify it
    49.9 + * under the terms of the GNU General Public License version 2 only, as
   49.10 + * published by the Free Software Foundation.
   49.11 + *
   49.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   49.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   49.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   49.15 + * version 2 for more details (a copy is included in the LICENSE file that
   49.16 + * accompanied this code).
   49.17 + *
   49.18 + * You should have received a copy of the GNU General Public License version
   49.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   49.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   49.21 + *
   49.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   49.23 + * or visit www.oracle.com if you need additional information or have any
   49.24 + * questions.
   49.25 + *
   49.26 + */
   49.27 +
   49.28 +#ifndef SHARE_VM_UTILITIES_TICKS_HPP
   49.29 +#define SHARE_VM_UTILITIES_TICKS_HPP
   49.30 +
   49.31 +#include "memory/allocation.hpp"
   49.32 +#include "utilities/globalDefinitions.hpp"
   49.33 +
   49.34 +class Ticks;
   49.35 +
   49.36 +class Tickspan VALUE_OBJ_CLASS_SPEC {
   49.37 +  friend class Ticks;
   49.38 +  friend Tickspan operator-(const Ticks& end, const Ticks& start);
   49.39 +
   49.40 + private:
   49.41 +  jlong _span_ticks;
   49.42 +
   49.43 +  Tickspan(const Ticks& end, const Ticks& start);
   49.44 +
   49.45 + public:
   49.46 +  Tickspan() : _span_ticks(0) {}
   49.47 +
   49.48 +  Tickspan& operator+=(const Tickspan& rhs) {
   49.49 +    _span_ticks += rhs._span_ticks;
   49.50 +    return *this;
   49.51 +  }
   49.52 +
   49.53 +  jlong value() const {
   49.54 +    return _span_ticks;
   49.55 +  }
   49.56 +
   49.57 +};
   49.58 +
   49.59 +class Ticks VALUE_OBJ_CLASS_SPEC {
   49.60 + private:
   49.61 +  jlong _stamp_ticks;
   49.62 +
   49.63 + public:
   49.64 +  Ticks() : _stamp_ticks(0) {
   49.65 +    assert((_stamp_ticks = invalid_time_stamp) == invalid_time_stamp,
   49.66 +      "initial unstamped time value assignment");
   49.67 +  }
   49.68 +
   49.69 +  Ticks& operator+=(const Tickspan& span) {
   49.70 +    _stamp_ticks += span.value();
   49.71 +    return *this;
   49.72 +  }
   49.73 +
   49.74 +  Ticks& operator-=(const Tickspan& span) {
   49.75 +    _stamp_ticks -= span.value();
   49.76 +    return *this;
   49.77 +  }
   49.78 +
   49.79 +  void stamp();
   49.80 +
   49.81 +  jlong value() const {
   49.82 +    return _stamp_ticks;
   49.83 +  }
   49.84 +
   49.85 +  static const Ticks now();
   49.86 +
   49.87 +#ifdef ASSERT
   49.88 +  static const jlong invalid_time_stamp;
   49.89 +#endif
   49.90 +
   49.91 +#ifndef PRODUCT
   49.92 +  // only for internal use by GC VM tests
   49.93 +  friend class TimePartitionPhasesIteratorTest;
   49.94 +  friend class GCTimerTest;
   49.95 +
   49.96 + private:
   49.97 +  // implicit type conversion
   49.98 +  Ticks(int ticks) : _stamp_ticks(ticks) {}
   49.99 +
  49.100 +#endif // !PRODUCT
  49.101 +
  49.102 +};
  49.103 +
  49.104 +class TicksToTimeHelper : public AllStatic {
  49.105 + public:
  49.106 +  enum Unit {
  49.107 +    SECONDS = 1,
  49.108 +    MILLISECONDS = 1000
  49.109 +  };
  49.110 +  static double seconds(const Tickspan& span);
  49.111 +  static jlong milliseconds(const Tickspan& span);
  49.112 +};
  49.113 +
  49.114 +#endif // SHARE_VM_UTILITIES_TICKS_HPP
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/src/share/vm/utilities/ticks.inline.hpp	Mon Dec 02 15:43:04 2013 +0100
    50.3 @@ -0,0 +1,97 @@
    50.4 +/*
    50.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    50.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.7 + *
    50.8 + * This code is free software; you can redistribute it and/or modify it
    50.9 + * under the terms of the GNU General Public License version 2 only, as
   50.10 + * published by the Free Software Foundation.
   50.11 + *
   50.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   50.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   50.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   50.15 + * version 2 for more details (a copy is included in the LICENSE file that
   50.16 + * accompanied this code).
   50.17 + *
   50.18 + * You should have received a copy of the GNU General Public License version
   50.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   50.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   50.21 + *
   50.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   50.23 + * or visit www.oracle.com if you need additional information or have any
   50.24 + * questions.
   50.25 + *
   50.26 + */
   50.27 +
   50.28 +#ifndef SHARE_VM_UTILITIES_TICKS_INLINE_HPP
   50.29 +#define SHARE_VM_UTILITIES_TICKS_INLINE_HPP
   50.30 +
   50.31 +#include "utilities/ticks.hpp"
   50.32 +
   50.33 +inline Tickspan operator+(Tickspan lhs, const Tickspan& rhs) {
   50.34 +  lhs += rhs;
   50.35 +  return lhs;
   50.36 +}
   50.37 +
   50.38 +inline bool operator==(const Tickspan& lhs, const Tickspan& rhs) {
   50.39 +  return lhs.value() == rhs.value();
   50.40 +}
   50.41 +
   50.42 +inline bool operator!=(const Tickspan& lhs, const Tickspan& rhs) {
   50.43 +  return !operator==(lhs,rhs);
   50.44 +}
   50.45 +
   50.46 +inline bool operator<(const Tickspan& lhs, const Tickspan& rhs) {
   50.47 +  return lhs.value() < rhs.value();
   50.48 +}
   50.49 +
   50.50 +inline bool operator>(const Tickspan& lhs, const Tickspan& rhs) {
   50.51 +  return operator<(rhs,lhs);
   50.52 +}
   50.53 +
   50.54 +inline bool operator<=(const Tickspan& lhs, const Tickspan& rhs) {
   50.55 +  return !operator>(lhs,rhs);
   50.56 +}
   50.57 +
   50.58 +inline bool operator>=(const Tickspan& lhs, const Tickspan& rhs) {
   50.59 +  return !operator<(lhs,rhs);
   50.60 +}
   50.61 +
   50.62 +inline Ticks operator+(Ticks lhs, const Tickspan& span) {
   50.63 +  lhs += span;
   50.64 +  return lhs;
   50.65 +}
   50.66 +
   50.67 +inline Ticks operator-(Ticks lhs, const Tickspan& span) {
   50.68 +  lhs -= span;
   50.69 +  return lhs;
   50.70 +}
   50.71 +
   50.72 +inline Tickspan operator-(const Ticks& end, const Ticks& start) {
   50.73 +  return Tickspan(end, start);
   50.74 +}
   50.75 +
   50.76 +inline bool operator==(const Ticks& lhs, const Ticks& rhs) {
   50.77 +  return lhs.value() == rhs.value();
   50.78 +}
   50.79 +
   50.80 +inline bool operator!=(const Ticks& lhs, const Ticks& rhs) {
   50.81 +  return !operator==(lhs,rhs);
   50.82 +}
   50.83 +
   50.84 +inline bool operator<(const Ticks& lhs, const Ticks& rhs) {
   50.85 +  return lhs.value() < rhs.value();
   50.86 +}
   50.87 +
   50.88 +inline bool operator>(const Ticks& lhs, const Ticks& rhs) {
   50.89 +  return operator<(rhs,lhs);
   50.90 +}
   50.91 +
   50.92 +inline bool operator<=(const Ticks& lhs, const Ticks& rhs) {
   50.93 +  return !operator>(lhs,rhs);
   50.94 +}
   50.95 +
   50.96 +inline bool operator>=(const Ticks& lhs, const Ticks& rhs) {
   50.97 +  return !operator<(lhs,rhs);
   50.98 +}
   50.99 +
  50.100 +#endif // SHARE_VM_UTILITIES_TICKS_INLINE_HPP
    51.1 --- a/test/compiler/jsr292/methodHandleExceptions/ByteClassLoader.java	Tue Nov 26 14:35:38 2013 +0100
    51.2 +++ b/test/compiler/jsr292/methodHandleExceptions/ByteClassLoader.java	Mon Dec 02 15:43:04 2013 +0100
    51.3 @@ -1,3 +1,12 @@
    51.4 +import java.io.BufferedOutputStream;
    51.5 +import java.io.FileNotFoundException;
    51.6 +import java.io.FileOutputStream;
    51.7 +import java.io.IOException;
    51.8 +import java.net.URL;
    51.9 +import java.net.URLClassLoader;
   51.10 +import java.util.jar.JarEntry;
   51.11 +import java.util.jar.JarOutputStream;
   51.12 +
   51.13  /*
   51.14   * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   51.15   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   51.16 @@ -23,12 +32,63 @@
   51.17   */
   51.18  
   51.19  /**
   51.20 - * A minimal classloader for loading bytecodes that could not result from
   51.21 - * properly compiled Java.
   51.22 + * A ByteClassLoader is used to define classes from collections of bytes, as
   51.23 + * well as loading classes in the usual way. It includes options to write the
   51.24 + * classes to files in a jar, or to read the classes from jars in a later or
   51.25 + * debugging run.
   51.26   *
   51.27 - * @author dr2chase
   51.28 + * If Boolean property byteclassloader.verbose is true, be chatty about jar
   51.29 + * file operations.
   51.30 + *
   51.31   */
   51.32 -public class ByteClassLoader extends ClassLoader {
   51.33 +public class ByteClassLoader extends URLClassLoader {
   51.34 +
   51.35 +    final static boolean verbose
   51.36 +            = Boolean.getBoolean("byteclassloader.verbose");
   51.37 +
   51.38 +    final boolean read;
   51.39 +    final JarOutputStream jos;
   51.40 +    final String jar_name;
   51.41 +
   51.42 +    /**
   51.43 +     * Make a new ByteClassLoader.
   51.44 +     *
   51.45 +     * @param jar_name  Basename of jar file to be read/written by this classloader.
   51.46 +     * @param read      If true, read classes from jar file instead of from parameter.
   51.47 +     * @param write     If true, write classes to jar files for offline study/use.
   51.48 +     *
   51.49 +     * @throws FileNotFoundException
   51.50 +     * @throws IOException
   51.51 +     */
   51.52 +    public ByteClassLoader(String jar_name, boolean read, boolean write)
   51.53 +            throws FileNotFoundException, IOException {
   51.54 +        super(read
   51.55 +                ? new URL[]{new URL("file:" + jar_name + ".jar")}
   51.56 +                : new URL[0]);
   51.57 +        this.read = read;
   51.58 +        this.jar_name = jar_name;
   51.59 +        this.jos = write
   51.60 +                ? new JarOutputStream(
   51.61 +                new BufferedOutputStream(
   51.62 +                new FileOutputStream(jar_name + ".jar"))) : null;
   51.63 +        if (read && write) {
   51.64 +            throw new Error("At most one of read and write may be true.");
   51.65 +        }
   51.66 +    }
   51.67 +
   51.68 +    private static void writeJarredFile(JarOutputStream jos, String file, String suffix, byte[] bytes) {
   51.69 +        String fileName = file.replace(".", "/") + "." + suffix;
   51.70 +        JarEntry ze = new JarEntry(fileName);
   51.71 +        try {
   51.72 +            ze.setSize(bytes.length);
   51.73 +            jos.putNextEntry(ze);
   51.74 +            jos.write(bytes);
   51.75 +            jos.closeEntry();
   51.76 +        } catch (IOException e) {
   51.77 +            throw new RuntimeException(e);
   51.78 +        }
   51.79 +    }
   51.80 +
   51.81      /**
   51.82       * (pre)load class name using classData for the definition.
   51.83       *
   51.84 @@ -36,9 +96,36 @@
   51.85       * @param classData
   51.86       * @return
   51.87       */
   51.88 -    public Class<?> loadBytes(String name, byte[] classData) {
   51.89 -         Class<?> clazz = defineClass(name, classData, 0, classData.length);
   51.90 -                     resolveClass(clazz);
   51.91 -         return clazz;
   51.92 +    public Class<?> loadBytes(String name, byte[] classData) throws ClassNotFoundException {
   51.93 +        if (jos != null) {
   51.94 +            if (verbose) {
   51.95 +                System.out.println("ByteClassLoader: writing " + name);
   51.96 +            }
   51.97 +            writeJarredFile(jos, name, "class", classData);
   51.98 +        }
   51.99 +
  51.100 +        Class<?> clazz = null;
  51.101 +        if (read) {
  51.102 +            if (verbose) {
  51.103 +                System.out.println("ByteClassLoader: reading " + name + " from " + jar_name);
  51.104 +            }
  51.105 +            clazz = loadClass(name);
  51.106 +        } else {
  51.107 +            clazz = defineClass(name, classData, 0, classData.length);
  51.108 +            resolveClass(clazz);
  51.109 +        }
  51.110 +        return clazz;
  51.111 +    }
  51.112 +
  51.113 +    public void close() {
  51.114 +        if (jos != null) {
  51.115 +            try {
  51.116 +                if (verbose) {
  51.117 +                    System.out.println("ByteClassLoader: closing " + jar_name);
  51.118 +                }
  51.119 +                jos.close();
  51.120 +            } catch (IOException ex) {
  51.121 +            }
  51.122 +        }
  51.123      }
  51.124  }
    52.1 --- a/test/compiler/jsr292/methodHandleExceptions/C.java	Tue Nov 26 14:35:38 2013 +0100
    52.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    52.3 @@ -1,33 +0,0 @@
    52.4 -/*
    52.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    52.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    52.7 - *
    52.8 - * This code is free software; you can redistribute it and/or modify it
    52.9 - * under the terms of the GNU General Public License version 2 only, as
   52.10 - * published by the Free Software Foundation.
   52.11 - *
   52.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   52.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   52.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   52.15 - * version 2 for more details (a copy is included in the LICENSE file that
   52.16 - * accompanied this code).
   52.17 - *
   52.18 - * You should have received a copy of the GNU General Public License version
   52.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   52.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   52.21 - *
   52.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   52.23 - * or visit www.oracle.com if you need additional information or have any
   52.24 - * questions.
   52.25 - *
   52.26 - */
   52.27 -
   52.28 -/**
   52.29 - * Test class -- implements I, which provides default for m, but this class
   52.30 - * declares it abstract which (should) hide the interface default, and throw
   52.31 - * an abstract method error if it is called (calling it requires bytecode hacking
   52.32 - * or inconsistent compilation).
   52.33 - */
   52.34 -public abstract class C implements I {
   52.35 -       public abstract int m();
   52.36 -}
    53.1 --- a/test/compiler/jsr292/methodHandleExceptions/I.java	Tue Nov 26 14:35:38 2013 +0100
    53.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    53.3 @@ -1,27 +0,0 @@
    53.4 -/*
    53.5 - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    53.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    53.7 - *
    53.8 - * This code is free software; you can redistribute it and/or modify it
    53.9 - * under the terms of the GNU General Public License version 2 only, as
   53.10 - * published by the Free Software Foundation.
   53.11 - *
   53.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   53.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   53.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   53.15 - * version 2 for more details (a copy is included in the LICENSE file that
   53.16 - * accompanied this code).
   53.17 - *
   53.18 - * You should have received a copy of the GNU General Public License version
   53.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   53.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   53.21 - *
   53.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   53.23 - * or visit www.oracle.com if you need additional information or have any
   53.24 - * questions.
   53.25 - *
   53.26 - */
   53.27 -
   53.28 -public interface I {
   53.29 -    default public int m() { return 1; }
   53.30 -}
    54.1 --- a/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java	Tue Nov 26 14:35:38 2013 +0100
    54.2 +++ b/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java	Mon Dec 02 15:43:04 2013 +0100
    54.3 @@ -21,50 +21,127 @@
    54.4   * questions.
    54.5   *
    54.6   */
    54.7 -
    54.8  import java.lang.reflect.InvocationTargetException;
    54.9 +import java.lang.reflect.Method;
   54.10 +import java.util.ArrayList;
   54.11 +import java.util.List;
   54.12  import jdk.internal.org.objectweb.asm.ClassWriter;
   54.13  import jdk.internal.org.objectweb.asm.Handle;
   54.14  import jdk.internal.org.objectweb.asm.MethodVisitor;
   54.15  import jdk.internal.org.objectweb.asm.Opcodes;
   54.16 +import p.Dok;
   54.17  
   54.18  /**
   54.19 - * @test
   54.20 - * @bug 8025260
   54.21 - * @summary Ensure that AbstractMethodError is thrown, not NullPointerException, through MethodHandles::jump_from_method_handle code path
   54.22 + * @test @bug 8025260 8016839
   54.23 + * @summary Ensure that AbstractMethodError and IllegalAccessError are thrown appropriately, not NullPointerException
   54.24   *
   54.25 - * @compile -XDignore.symbol.file ByteClassLoader.java I.java C.java TestAMEnotNPE.java
   54.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
   54.27 + *
   54.28   * @run main/othervm TestAMEnotNPE
   54.29 + * @run main/othervm -Xint TestAMEnotNPE
   54.30 + * @run main/othervm -Xcomp TestAMEnotNPE
   54.31   */
   54.32 -
   54.33  public class TestAMEnotNPE implements Opcodes {
   54.34  
   54.35 +    static boolean writeJarFiles = false;
   54.36 +    static boolean readJarFiles = false;
   54.37 +
   54.38      /**
   54.39 -     * The bytes for D, a NOT abstract class extending abstract class C
   54.40 -     * without supplying an implementation for abstract method m.
   54.41 -     * There is a default method in the interface I, but it should lose to
   54.42 -     * the abstract class.
   54.43 +     * Optional command line parameter (any case-insensitive prefix of)
   54.44 +     * "writejarfiles" or "readjarfiles".
   54.45 +     *
   54.46 +     * "Writejarfiles" creates a jar file for each different set of tested classes.
   54.47 +     * "Readjarfiles" causes the classloader to use the copies of the classes
   54.48 +     * found in the corresponding jar files.
   54.49 +     *
   54.50 +     * Jarfilenames look something like pD_ext_pF (p.D extends p.F)
   54.51 +     * and qD_m_pp_imp_pI (q.D with package-private m implements p.I)
   54.52 +     *
   54.53 +     */
   54.54 +    public static void main(String args[]) throws Throwable {
   54.55 +        ArrayList<Throwable> lt = new ArrayList<Throwable>();
   54.56  
   54.57 -     class D extends C {
   54.58 -        D() { super(); }
   54.59 -        // does not define m
   54.60 -     }
   54.61 +        if (args.length > 0) {
   54.62 +            String a0 = args[0].toLowerCase();
   54.63 +            if (a0.length() > 0) {
   54.64 +                writeJarFiles = ("writejarfiles").startsWith(a0);
   54.65 +                readJarFiles = ("readjarfiles").startsWith(a0);
   54.66 +            }
   54.67 +            if (!(writeJarFiles || readJarFiles)) {
   54.68 +                throw new Error("Command line parameter (if any) should be prefix of writeJarFiles or readJarFiles");
   54.69 +            }
   54.70 +        }
   54.71  
   54.72 +        try {
   54.73 +            System.out.println("TRYING p.D.m PRIVATE interface-invoked as p.I.m, p.D extends p.F, p.F.m FINAL");
   54.74 +            tryAndCheckThrown(lt, bytesForDprivateSubWhat("p/F"),
   54.75 +                    "p.D extends p.F (p.F implements p.I, FINAL public m), private m",
   54.76 +                    IllegalAccessError.class, "pD_ext_pF");
   54.77 +            // We'll take either a VerifyError (pre 2013-11-30)
   54.78 +            // or an IllegalAccessError (post 2013-11-22)
   54.79 +        } catch (VerifyError ve) {
   54.80 +            System.out.println("Saw expected VerifyError " + ve);
   54.81 +        }
   54.82 +        System.out.println();
   54.83 +
   54.84 +        System.out.println("TRYING p.D.m PRIVATE interface-invoked as p.I.m, p.D extends p.E");
   54.85 +        tryAndCheckThrown(lt, bytesForDprivateSubWhat("p/E"),
   54.86 +                "p.D extends p.E (p.E implements p.I, public m), private m",
   54.87 +                IllegalAccessError.class, "pD_ext_pE");
   54.88 +
   54.89 +        System.out.println("TRYING p.D.m ABSTRACT interface-invoked as p.I.m");
   54.90 +        tryAndCheckThrown(lt, bytesForD(),
   54.91 +                "D extends abstract C, no m",
   54.92 +                AbstractMethodError.class, "pD_ext_pC");
   54.93 +
   54.94 +        System.out.println("TRYING q.D.m PACKAGE interface-invoked as p.I.m");
   54.95 +        tryAndCheckThrown(lt, "q.D", bytesForDsomeAccess("q/D", 0),
   54.96 +                "q.D implements p.I, protected m", IllegalAccessError.class,
   54.97 +                "qD_m_pp_imp_pI");
   54.98 +
   54.99 +        // Note jar file name is used in the plural-arg case.
  54.100 +        System.out.println("TRYING p.D.m PRIVATE interface-invoked as p.I.m");
  54.101 +        tryAndCheckThrown(lt, bytesForDsomeAccess("p/D", ACC_PRIVATE),
  54.102 +                "p.D implements p.I, private m",
  54.103 +                IllegalAccessError.class, "pD_m_pri_imp_pI");
  54.104 +
  54.105 +        // Plural-arg test.
  54.106 +        System.out.println("TRYING p.D.m PRIVATE MANY ARG interface-invoked as p.I.m");
  54.107 +        tryAndCheckThrownMany(lt, bytesForDsomeAccess("p/D", ACC_PRIVATE),
  54.108 +                "p.D implements p.I, private m", IllegalAccessError.class);
  54.109 +
  54.110 +        if (lt.size() > 0) {
  54.111 +            System.out.flush();
  54.112 +            Thread.sleep(250); // This de-interleaves output and error in Netbeans, sigh.
  54.113 +            for (Throwable th : lt)
  54.114 +              System.err.println(th);
  54.115 +            throw new Error("Test failed, there were " + lt.size() + " failures listed above");
  54.116 +        } else {
  54.117 +            System.out.println("ALL PASS, HOORAY!");
  54.118 +        }
  54.119 +    }
  54.120 +
  54.121 +    /**
  54.122 +     * The bytes for D, a NOT abstract class extending abstract class C without
  54.123 +     * supplying an implementation for abstract method m. There is a default
  54.124 +     * method in the interface I, but it should lose to the abstract class.
  54.125 +     *
  54.126       * @return
  54.127       * @throws Exception
  54.128       */
  54.129      public static byte[] bytesForD() throws Exception {
  54.130  
  54.131 -        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS);
  54.132 +        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES
  54.133 +                | ClassWriter.COMPUTE_MAXS);
  54.134          MethodVisitor mv;
  54.135  
  54.136 -        cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, "D", null, "C", null);
  54.137 +        cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, "p/D", null, "p/C", null);
  54.138  
  54.139          {
  54.140              mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
  54.141              mv.visitCode();
  54.142              mv.visitVarInsn(ALOAD, 0);
  54.143 -            mv.visitMethodInsn(INVOKESPECIAL, "C", "<init>", "()V");
  54.144 +            mv.visitMethodInsn(INVOKESPECIAL, "p/C", "<init>", "()V");
  54.145              mv.visitInsn(RETURN);
  54.146              mv.visitMaxs(0, 0);
  54.147              mv.visitEnd();
  54.148 @@ -74,70 +151,346 @@
  54.149          return cw.toByteArray();
  54.150      }
  54.151  
  54.152 +    /**
  54.153 +     * The bytes for D, implements I, does not extend C, declares m()I with
  54.154 +     * access method_acc.
  54.155 +     *
  54.156 +     * @param d_name Name of class defined
  54.157 +     * @param method_acc Accessibility of that class's method m.
  54.158 +     * @return
  54.159 +     * @throws Exception
  54.160 +     */
  54.161 +    public static byte[] bytesForDsomeAccess(String d_name, int method_acc) throws Exception {
  54.162 +        return bytesForSomeDsubSomethingSomeAccess(d_name, "java/lang/Object", method_acc);
  54.163 +    }
  54.164  
  54.165      /**
  54.166 -     * The bytecodes for an invokeExact of a particular methodHandle, I.m, invoked on a D
  54.167 +     * The bytes for D implements I, extends some class, declares m()I as
  54.168 +     * private.
  54.169 +     *
  54.170 +     * Invokeinterface of I.m applied to this D should throw IllegalAccessError
  54.171 +     *
  54.172 +     * @param sub_what The name of the class that D will extend.
  54.173 +     * @return
  54.174 +     * @throws Exception
  54.175 +     */
  54.176 +    public static byte[] bytesForDprivateSubWhat(String sub_what) throws Exception {
  54.177 +        return bytesForSomeDsubSomethingSomeAccess("p/D", sub_what, ACC_PRIVATE);
  54.178 +    }
  54.179  
  54.180 -        class T {
  54.181 -           T() { super(); } // boring constructor
  54.182 -           int test() {
  54.183 -              MethodHandle mh = `I.m():int`;
  54.184 -              D d = new D();
  54.185 -              return mh.invokeExact(d); // Should explode here, AbstractMethodError
  54.186 -           }
  54.187 +    /**
  54.188 +     * Returns the bytes for a class with name d_name (presumably "D" in some
  54.189 +     * package), extending some class with name sub_what, implementing p.I,
  54.190 +     * and defining two methods m() and m(11args) with access method_acc.
  54.191 +     *
  54.192 +     * @param d_name      Name of class that is defined
  54.193 +     * @param sub_what    Name of class that it extends
  54.194 +     * @param method_acc  Accessibility of method(s) m in defined class.
  54.195 +     * @return
  54.196 +     * @throws Exception
  54.197 +     */
  54.198 +    public static byte[] bytesForSomeDsubSomethingSomeAccess
  54.199 +            (String d_name, String sub_what, int method_acc)
  54.200 +            throws Exception {
  54.201 +
  54.202 +        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES
  54.203 +                | ClassWriter.COMPUTE_MAXS);
  54.204 +        MethodVisitor mv;
  54.205 +        String[] interfaces = {"p/I"};
  54.206 +
  54.207 +        cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, d_name, null, sub_what, interfaces);
  54.208 +        {
  54.209 +            mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
  54.210 +            mv.visitCode();
  54.211 +            mv.visitVarInsn(ALOAD, 0);
  54.212 +            mv.visitMethodInsn(INVOKESPECIAL, sub_what, "<init>", "()V");
  54.213 +            mv.visitInsn(RETURN);
  54.214 +            mv.visitMaxs(0, 0);
  54.215 +            mv.visitEnd();
  54.216          }
  54.217 +        // int m() {return 3;}
  54.218 +        {
  54.219 +            mv = cw.visitMethod(method_acc, "m", "()I", null, null);
  54.220 +            mv.visitCode();
  54.221 +            mv.visitLdcInsn(new Integer(3));
  54.222 +            mv.visitInsn(IRETURN);
  54.223 +            mv.visitMaxs(0, 0);
  54.224 +            mv.visitEnd();
  54.225 +        }
  54.226 +        // int m(11args) {return 3;}
  54.227 +        {
  54.228 +            mv = cw.visitMethod(method_acc, "m", "(BCSIJ"
  54.229 +                    + "Ljava/lang/Object;"
  54.230 +                    + "Ljava/lang/Object;"
  54.231 +                    + "Ljava/lang/Object;"
  54.232 +                    + "Ljava/lang/Object;"
  54.233 +                    + "Ljava/lang/Object;"
  54.234 +                    + "Ljava/lang/Object;"
  54.235 +                    + ")I", null, null);
  54.236 +            mv.visitCode();
  54.237 +            mv.visitLdcInsn(new Integer(3));
  54.238 +            mv.visitInsn(IRETURN);
  54.239 +            mv.visitMaxs(0, 0);
  54.240 +            mv.visitEnd();
  54.241 +        }
  54.242 +        cw.visitEnd();
  54.243 +        return cw.toByteArray();
  54.244 +    }
  54.245  
  54.246 +    /**
  54.247 +     * The bytecodes for a class p/T defining a methods test() and test(11args)
  54.248 +     * that contain an invokeExact of a particular methodHandle, I.m.
  54.249 +     *
  54.250 +     * Test will be passed values that may imperfectly implement I,
  54.251 +     * and thus may in turn throw exceptions.
  54.252 +     *
  54.253       * @return
  54.254       * @throws Exception
  54.255       */
  54.256      public static byte[] bytesForT() throws Exception {
  54.257  
  54.258 -        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES|ClassWriter.COMPUTE_MAXS);
  54.259 +        ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES
  54.260 +                | ClassWriter.COMPUTE_MAXS);
  54.261          MethodVisitor mv;
  54.262  
  54.263 -        cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, "T", null, "java/lang/Object", null);
  54.264 +        cw.visit(V1_8, ACC_PUBLIC + ACC_SUPER, "p/T", null, "java/lang/Object", null);
  54.265          {
  54.266              mv = cw.visitMethod(ACC_PUBLIC, "<init>", "()V", null, null);
  54.267              mv.visitCode();
  54.268              mv.visitVarInsn(ALOAD, 0);
  54.269              mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "<init>", "()V");
  54.270              mv.visitInsn(RETURN);
  54.271 -            mv.visitMaxs(0,0);
  54.272 +            mv.visitMaxs(0, 0);
  54.273              mv.visitEnd();
  54.274          }
  54.275 +        // static int test(I)
  54.276          {
  54.277 -            mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "test", "()I", null, null);
  54.278 +            mv = cw.visitMethod(ACC_PUBLIC + ACC_STATIC, "test", "(Lp/I;)I", null, null);
  54.279              mv.visitCode();
  54.280 -            mv.visitLdcInsn(new Handle(Opcodes.H_INVOKEINTERFACE, "I", "m", "()I"));
  54.281 -            mv.visitTypeInsn(NEW, "D");
  54.282 -            mv.visitInsn(DUP);
  54.283 -            mv.visitMethodInsn(INVOKESPECIAL, "D", "<init>", "()V");
  54.284 -            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle", "invokeExact", "(LI;)I");
  54.285 +            mv.visitLdcInsn(new Handle(Opcodes.H_INVOKEINTERFACE, "p/I", "m", "()I"));
  54.286 +            mv.visitVarInsn(ALOAD, 0);
  54.287 +            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle",
  54.288 +                    "invokeExact", "(Lp/I;)I");
  54.289              mv.visitInsn(IRETURN);
  54.290 -            mv.visitMaxs(0,0);
  54.291 +            mv.visitMaxs(0, 0);
  54.292 +            mv.visitEnd();
  54.293 +        }
  54.294 +        // static int test(I,11args)
  54.295 +        {
  54.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);
  54.297 +            mv.visitCode();
  54.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"));
  54.299 +            mv.visitVarInsn(ALOAD, 0);
  54.300 +            mv.visitVarInsn(ILOAD, 1);
  54.301 +            mv.visitVarInsn(ILOAD, 2);
  54.302 +            mv.visitVarInsn(ILOAD, 3);
  54.303 +            mv.visitVarInsn(ILOAD, 4);
  54.304 +            mv.visitVarInsn(LLOAD, 5);
  54.305 +            mv.visitVarInsn(ALOAD, 7);
  54.306 +            mv.visitVarInsn(ALOAD, 8);
  54.307 +            mv.visitVarInsn(ALOAD, 9);
  54.308 +            mv.visitVarInsn(ALOAD, 10);
  54.309 +            mv.visitVarInsn(ALOAD, 11);
  54.310 +            mv.visitVarInsn(ALOAD, 12);
  54.311 +            mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/invoke/MethodHandle",
  54.312 +                    "invokeExact", "(Lp/I;BCSIJLjava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)I");
  54.313 +            mv.visitInsn(IRETURN);
  54.314 +            mv.visitMaxs(0, 0);
  54.315              mv.visitEnd();
  54.316          }
  54.317          cw.visitEnd();
  54.318          return cw.toByteArray();
  54.319      }
  54.320  
  54.321 -    public static void main(String args[] ) throws Throwable {
  54.322 -        ByteClassLoader bcl = new ByteClassLoader();
  54.323 -        Class<?> d = bcl.loadBytes("D", bytesForD());
  54.324 -        Class<?> t = bcl.loadBytes("T", bytesForT());
  54.325 +    private static void tryAndCheckThrown(
  54.326 +            List<Throwable> lt, byte[] dBytes, String what, Class<?> expected, String jar_name)
  54.327 +            throws Throwable {
  54.328 +        tryAndCheckThrown(lt, "p.D", dBytes, what, expected, jar_name);
  54.329 +    }
  54.330 +
  54.331 +    private static void tryAndCheckThrown(List<Throwable> lt, String d_name, byte[] dBytes, String what, Class<?> expected, String jar_name)
  54.332 +            throws Throwable {
  54.333 +
  54.334 +        System.out.println("Methodhandle invokeExact I.m() for instance of " + what);
  54.335 +        ByteClassLoader bcl1 = new ByteClassLoader(jar_name, readJarFiles, writeJarFiles);
  54.336          try {
  54.337 -          Object result = t.getMethod("test").invoke(null);
  54.338 -          System.out.println("Expected AbstractMethodError wrapped in InvocationTargetException, saw no exception");
  54.339 -          throw new Error("Missing expected exception");
  54.340 +            Class<?> d1 = bcl1.loadBytes(d_name, dBytes);
  54.341 +            Class<?> t1 = bcl1.loadBytes("p.T", bytesForT());
  54.342 +            invokeTest(t1, d1, expected, lt);
  54.343 +        } finally {
  54.344 +            // Not necessary for others -- all class files are written in this call.
  54.345 +            // (unless the VM crashes first).
  54.346 +            bcl1.close();
  54.347 +        }
  54.348 +
  54.349 +        System.out.println("Reflection invoke I.m() for instance of " + what);
  54.350 +        ByteClassLoader bcl3 = new ByteClassLoader(jar_name, readJarFiles, false);
  54.351 +        Class<?> d3 = bcl3.loadBytes(d_name, dBytes);
  54.352 +        Class<?> t3 = bcl3.loadClass("p.Treflect");
  54.353 +        invokeTest(t3, d3, expected, lt);
  54.354 +
  54.355 +        System.out.println("Bytecode invokeInterface I.m() for instance of " + what);
  54.356 +        ByteClassLoader bcl2 = new ByteClassLoader(jar_name, readJarFiles, false);
  54.357 +        Class<?> d2 = bcl2.loadBytes(d_name, dBytes);
  54.358 +        Class<?> t2 = bcl2.loadClass("p.Tdirect");
  54.359 +        badGoodBadGood(t2, d2, expected, lt);
  54.360 +    }
  54.361 +
  54.362 +    private static void invokeTest(Class<?> t, Class<?> d, Class<?> expected, List<Throwable> lt)
  54.363 +            throws Throwable {
  54.364 +        try {
  54.365 +            Method m = t.getMethod("test", p.I.class);
  54.366 +            Object o = d.newInstance();
  54.367 +            Object result = m.invoke(null, o);
  54.368 +            if (expected != null) {
  54.369 +                System.out.println("FAIL, Expected " + expected.getName()
  54.370 +                        + " wrapped in InvocationTargetException, but nothing was thrown");
  54.371 +                lt.add(new Error("Exception " + expected.getName() + " was not thrown"));
  54.372 +            } else {
  54.373 +                System.out.println("PASS, saw expected return.");
  54.374 +            }
  54.375          } catch (InvocationTargetException e) {
  54.376              Throwable th = e.getCause();
  54.377 -            if (th instanceof AbstractMethodError) {
  54.378 -                th.printStackTrace(System.out);
  54.379 -                System.out.println("PASS, saw expected exception (AbstractMethodError, wrapped in InvocationTargetException).");
  54.380 +            th.printStackTrace(System.out);
  54.381 +            if (expected != null) {
  54.382 +                if (expected.isInstance(th)) {
  54.383 +                    System.out.println("PASS, saw expected exception (" + expected.getName() + ").");
  54.384 +                } else {
  54.385 +                    System.out.println("FAIL, Expected " + expected.getName()
  54.386 +                            + " wrapped in InvocationTargetException, saw " + th);
  54.387 +                    lt.add(th);
  54.388 +                }
  54.389              } else {
  54.390 -                System.out.println("Expected AbstractMethodError wrapped in InvocationTargetException, saw " + th);
  54.391 -                throw th;
  54.392 +                System.out.println("FAIL, expected no exception, saw " + th);
  54.393 +                lt.add(th);
  54.394              }
  54.395          }
  54.396 +        System.out.println();
  54.397 +    }
  54.398 +
  54.399 +    /* Many-arg versions of above */
  54.400 +    private static void tryAndCheckThrownMany(List<Throwable> lt, byte[] dBytes, String what, Class<?> expected)
  54.401 +            throws Throwable {
  54.402 +
  54.403 +        System.out.println("Methodhandle invokeExact I.m(11params) for instance of " + what);
  54.404 +        ByteClassLoader bcl1 = new ByteClassLoader("p.D", readJarFiles, false);
  54.405 +        try {
  54.406 +            Class<?> d1 = bcl1.loadBytes("p.D", dBytes);
  54.407 +            Class<?> t1 = bcl1.loadBytes("p.T", bytesForT());
  54.408 +            invokeTestMany(t1, d1, expected, lt);
  54.409 +        } finally {
  54.410 +            bcl1.close(); // Not necessary for others -- all class files are written in this call.
  54.411 +        }
  54.412 +
  54.413 +        {
  54.414 +            System.out.println("Bytecode invokeInterface I.m(11params) for instance of " + what);
  54.415 +            ByteClassLoader bcl2 = new ByteClassLoader("pD_m_pri_imp_pI", readJarFiles, false);
  54.416 +            Class<?> d2 = bcl2.loadBytes("p.D", dBytes);
  54.417 +            Class<?> t2 = bcl2.loadClass("p.Tdirect");
  54.418 +            badGoodBadGoodMany(t2, d2, expected, lt);
  54.419 +
  54.420 +        }
  54.421 +        {
  54.422 +            System.out.println("Reflection invokeInterface I.m(11params) for instance of " + what);
  54.423 +            ByteClassLoader bcl2 = new ByteClassLoader("pD_m_pri_imp_pI", readJarFiles, false);
  54.424 +            Class<?> d2 = bcl2.loadBytes("p.D", dBytes);
  54.425 +            Class<?> t2 = bcl2.loadClass("p.Treflect");
  54.426 +            invokeTestMany(t2, d2, expected, lt);
  54.427 +        }
  54.428 +    }
  54.429 +
  54.430 +    private static void invokeTestMany(Class<?> t, Class<?> d, Class<?> expected, List<Throwable> lt)
  54.431 +            throws Throwable {
  54.432 +        try {
  54.433 +            Method m = t.getMethod("test", p.I.class,
  54.434 +                    Byte.TYPE, Character.TYPE, Short.TYPE, Integer.TYPE, Long.TYPE,
  54.435 +                    Object.class, Object.class, Object.class,
  54.436 +                    Object.class, Object.class, Object.class);
  54.437 +            Object o = d.newInstance();
  54.438 +            Byte b = 1;
  54.439 +            Character c = 2;
  54.440 +            Short s = 3;
  54.441 +            Integer i = 4;
  54.442 +            Long j = 5L;
  54.443 +            Object o1 = b;
  54.444 +            Object o2 = c;
  54.445 +            Object o3 = s;
  54.446 +            Object o4 = i;
  54.447 +            Object o5 = j;
  54.448 +            Object o6 = "6";
  54.449 +
  54.450 +            Object result = m.invoke(null, o, b, c, s, i, j,
  54.451 +                    o1, o2, o3, o4, o5, o6);
  54.452 +            if (expected != null) {
  54.453 +                System.out.println("FAIL, Expected " + expected.getName()
  54.454 +                        + " wrapped in InvocationTargetException, but nothing was thrown");
  54.455 +                lt.add(new Error("Exception " + expected.getName()
  54.456 +                        + " was not thrown"));
  54.457 +            } else {
  54.458 +                System.out.println("PASS, saw expected return.");
  54.459 +            }
  54.460 +        } catch (InvocationTargetException e) {
  54.461 +            Throwable th = e.getCause();
  54.462 +            th.printStackTrace(System.out);
  54.463 +            if (expected != null) {
  54.464 +                if (expected.isInstance(th)) {
  54.465 +                    System.out.println("PASS, saw expected exception ("
  54.466 +                            + expected.getName() + ").");
  54.467 +                } else {
  54.468 +                    System.out.println("FAIL, Expected " + expected.getName()
  54.469 +                            + " wrapped in InvocationTargetException, saw " + th);
  54.470 +                    lt.add(th);
  54.471 +                }
  54.472 +            } else {
  54.473 +                System.out.println("FAIL, expected no exception, saw " + th);
  54.474 +                lt.add(th);
  54.475 +            }
  54.476 +        }
  54.477 +        System.out.println();
  54.478 +    }
  54.479 +
  54.480 +    /**
  54.481 +     * This tests a peculiar idiom for tickling the bug on older VMs that lack
  54.482 +     * methodhandles.  The bug (if not fixed) acts in the following way:
  54.483 +     *
  54.484 +     *  When a broken receiver is passed to the first execution of an invokeinterface
  54.485 +     * bytecode, the illegal access is detected before the effects of resolution are
  54.486 +     * cached for later use, and so repeated calls with a broken receiver will always
  54.487 +     * throw the correct error.
  54.488 +     *
  54.489 +     * If, however, a good receiver is passed to the invokeinterface, the effects of
  54.490 +     * resolution will be successfully cached.  A subsequent execution with a broken
  54.491 +     * receiver will reuse the cached information, skip the detailed resolution work,
  54.492 +     * and instead encounter a null pointer.  By convention, that is the encoding for a
  54.493 +     * missing abstract method, and an AbstractMethodError is thrown -- not the expected
  54.494 +     * IllegalAccessError.
  54.495 +     *
  54.496 +     * @param t2 Test invocation class
  54.497 +     * @param d2 Test receiver class
  54.498 +     * @param expected expected exception type
  54.499 +     * @param lt list of unexpected throwables seen
  54.500 +     */
  54.501 +    private static void badGoodBadGood(Class<?> t2, Class<?> d2, Class<?> expected, List<Throwable> lt)
  54.502 +            throws Throwable {
  54.503 +        System.out.println("  Error input 1st time");
  54.504 +        invokeTest(t2, d2, expected, lt);
  54.505 +        System.out.println("  Good input (instance of Dok)");
  54.506 +        invokeTest(t2, Dok.class, null, lt);
  54.507 +        System.out.println("  Error input 2nd time");
  54.508 +        invokeTest(t2, d2, expected, lt);
  54.509 +        System.out.println("  Good input (instance of Dok)");
  54.510 +        invokeTest(t2, Dok.class, null, lt);
  54.511 +    }
  54.512 +
  54.513 +    private static void badGoodBadGoodMany(Class<?> t2, Class<?> d2, Class<?> expected, List<Throwable> lt)
  54.514 +            throws Throwable {
  54.515 +        System.out.println("  Error input 1st time");
  54.516 +        invokeTestMany(t2, d2, expected, lt);
  54.517 +        System.out.println("  Good input (instance of Dok)");
  54.518 +        invokeTestMany(t2, Dok.class, null, lt);
  54.519 +        System.out.println("  Error input 2nd time");
  54.520 +        invokeTestMany(t2, d2, expected, lt);
  54.521 +        System.out.println("  Good input (instance of Dok)");
  54.522 +        invokeTestMany(t2, Dok.class, null, lt);
  54.523      }
  54.524  }
    55.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    55.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/C.java	Mon Dec 02 15:43:04 2013 +0100
    55.3 @@ -0,0 +1,35 @@
    55.4 +/*
    55.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    55.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    55.7 + *
    55.8 + * This code is free software; you can redistribute it and/or modify it
    55.9 + * under the terms of the GNU General Public License version 2 only, as
   55.10 + * published by the Free Software Foundation.
   55.11 + *
   55.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   55.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   55.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   55.15 + * version 2 for more details (a copy is included in the LICENSE file that
   55.16 + * accompanied this code).
   55.17 + *
   55.18 + * You should have received a copy of the GNU General Public License version
   55.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   55.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   55.21 + *
   55.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   55.23 + * or visit www.oracle.com if you need additional information or have any
   55.24 + * questions.
   55.25 + *
   55.26 + */
   55.27 +
   55.28 +package p;
   55.29 +
   55.30 +/**
   55.31 + * Test class -- implements I, which provides default for m, but this class
   55.32 + * declares it abstract which (should) hide the interface default, and throw
   55.33 + * an abstract method error if called.
   55.34 + *
   55.35 + */
   55.36 +public abstract class C implements p.I {
   55.37 +       public abstract int m();
   55.38 +}
    56.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    56.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/Dok.java	Mon Dec 02 15:43:04 2013 +0100
    56.3 @@ -0,0 +1,31 @@
    56.4 +/*
    56.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    56.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    56.7 + *
    56.8 + * This code is free software; you can redistribute it and/or modify it
    56.9 + * under the terms of the GNU General Public License version 2 only, as
   56.10 + * published by the Free Software Foundation.
   56.11 + *
   56.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   56.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   56.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   56.15 + * version 2 for more details (a copy is included in the LICENSE file that
   56.16 + * accompanied this code).
   56.17 + *
   56.18 + * You should have received a copy of the GNU General Public License version
   56.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   56.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   56.21 + *
   56.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   56.23 + * or visit www.oracle.com if you need additional information or have any
   56.24 + * questions.
   56.25 + *
   56.26 + */
   56.27 +package p;
   56.28 +
   56.29 +/**
   56.30 + * Test class -- implements I, extends E, both define m, so all should be well.
   56.31 + */
   56.32 +public class Dok extends p.E {
   56.33 +
   56.34 +}
    57.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    57.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/E.java	Mon Dec 02 15:43:04 2013 +0100
    57.3 @@ -0,0 +1,38 @@
    57.4 +/*
    57.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    57.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    57.7 + *
    57.8 + * This code is free software; you can redistribute it and/or modify it
    57.9 + * under the terms of the GNU General Public License version 2 only, as
   57.10 + * published by the Free Software Foundation.
   57.11 + *
   57.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   57.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   57.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   57.15 + * version 2 for more details (a copy is included in the LICENSE file that
   57.16 + * accompanied this code).
   57.17 + *
   57.18 + * You should have received a copy of the GNU General Public License version
   57.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   57.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   57.21 + *
   57.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   57.23 + * or visit www.oracle.com if you need additional information or have any
   57.24 + * questions.
   57.25 + *
   57.26 + */
   57.27 +
   57.28 +package p;
   57.29 +
   57.30 +/**
   57.31 + * Test class -- implements I, which provides default for m, but this class
   57.32 + * redeclares it so that all its non-overriding descendants should call its
   57.33 + * method instead (with no error, assuming no descendant monkey business, which
   57.34 + * of course is NOT usually the case in this test).
   57.35 + *
   57.36 + */
   57.37 +public abstract class E implements p.I {
   57.38 +       public int m() {
   57.39 +           return 2;
   57.40 +       }
   57.41 +}
    58.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    58.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/F.java	Mon Dec 02 15:43:04 2013 +0100
    58.3 @@ -0,0 +1,41 @@
    58.4 +/*
    58.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    58.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    58.7 + *
    58.8 + * This code is free software; you can redistribute it and/or modify it
    58.9 + * under the terms of the GNU General Public License version 2 only, as
   58.10 + * published by the Free Software Foundation.
   58.11 + *
   58.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   58.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   58.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   58.15 + * version 2 for more details (a copy is included in the LICENSE file that
   58.16 + * accompanied this code).
   58.17 + *
   58.18 + * You should have received a copy of the GNU General Public License version
   58.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   58.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   58.21 + *
   58.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   58.23 + * or visit www.oracle.com if you need additional information or have any
   58.24 + * questions.
   58.25 + *
   58.26 + */
   58.27 +
   58.28 +package p;
   58.29 +
   58.30 +/**
   58.31 + * Test class -- implements I, which provides default for m, but this class
   58.32 + * redeclares it so that all its non-overriding descendants should call its
   58.33 + * method instead (with no error, assuming no descendant monkey business, which
   58.34 + * of course is NOT usually the case in this test).
   58.35 + *
   58.36 + * Note that m is final -- one form of monkey business is attempting to redefine
   58.37 + * m.
   58.38 + *
   58.39 + */
   58.40 +public abstract class F implements p.I {
   58.41 +       final public int m() {
   58.42 +           return 2;
   58.43 +       }
   58.44 +}
    59.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    59.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/I.java	Mon Dec 02 15:43:04 2013 +0100
    59.3 @@ -0,0 +1,37 @@
    59.4 +/*
    59.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    59.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    59.7 + *
    59.8 + * This code is free software; you can redistribute it and/or modify it
    59.9 + * under the terms of the GNU General Public License version 2 only, as
   59.10 + * published by the Free Software Foundation.
   59.11 + *
   59.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   59.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   59.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   59.15 + * version 2 for more details (a copy is included in the LICENSE file that
   59.16 + * accompanied this code).
   59.17 + *
   59.18 + * You should have received a copy of the GNU General Public License version
   59.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   59.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   59.21 + *
   59.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   59.23 + * or visit www.oracle.com if you need additional information or have any
   59.24 + * questions.
   59.25 + *
   59.26 + */
   59.27 +
   59.28 +package p;
   59.29 +
   59.30 +/**
   59.31 + * Test interface I, provides default implementations for m() and m(11args).
   59.32 + */
   59.33 +
   59.34 +public interface I {
   59.35 +    default public int m() { return 1; }
   59.36 +    default public int m(byte b, char c, short s, int i, long l,
   59.37 +           Object o1, Object o2, Object o3, Object o4, Object o5, Object o6) {
   59.38 +        return 2;
   59.39 +    }
   59.40 +}
    60.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    60.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/Tdirect.java	Mon Dec 02 15:43:04 2013 +0100
    60.3 @@ -0,0 +1,47 @@
    60.4 +/*
    60.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    60.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    60.7 + *
    60.8 + * This code is free software; you can redistribute it and/or modify it
    60.9 + * under the terms of the GNU General Public License version 2 only, as
   60.10 + * published by the Free Software Foundation.
   60.11 + *
   60.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   60.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   60.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   60.15 + * version 2 for more details (a copy is included in the LICENSE file that
   60.16 + * accompanied this code).
   60.17 + *
   60.18 + * You should have received a copy of the GNU General Public License version
   60.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   60.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   60.21 + *
   60.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   60.23 + * or visit www.oracle.com if you need additional information or have any
   60.24 + * questions.
   60.25 + *
   60.26 + */
   60.27 +
   60.28 +package p;
   60.29 +
   60.30 +/**
   60.31 + * Invokes I.m directly using invokeInterface bytecodes.
   60.32 + */
   60.33 +public class Tdirect {
   60.34 +     public static int test(p.I i) {
   60.35 +         int accum = 0;
   60.36 +         for (int j = 0; j < 100000; j++) {
   60.37 +             accum += i.m();
   60.38 +         }
   60.39 +        return accum;
   60.40 +    }
   60.41 +
   60.42 +     public static int test(p.I ii, byte b, char c, short s, int i, long l,
   60.43 +             Object o1, Object o2, Object o3, Object o4, Object o5, Object o6) {
   60.44 +         int accum = 0;
   60.45 +         for (int j = 0; j < 100000; j++) {
   60.46 +           accum += ii.m(b,c,s,i,l,o1,o2,o3,o4,o5,o6);
   60.47 +         }
   60.48 +         return accum;
   60.49 +     }
   60.50 +}
    61.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    61.2 +++ b/test/compiler/jsr292/methodHandleExceptions/p/Treflect.java	Mon Dec 02 15:43:04 2013 +0100
    61.3 @@ -0,0 +1,66 @@
    61.4 +/*
    61.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    61.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    61.7 + *
    61.8 + * This code is free software; you can redistribute it and/or modify it
    61.9 + * under the terms of the GNU General Public License version 2 only, as
   61.10 + * published by the Free Software Foundation.
   61.11 + *
   61.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   61.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   61.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   61.15 + * version 2 for more details (a copy is included in the LICENSE file that
   61.16 + * accompanied this code).
   61.17 + *
   61.18 + * You should have received a copy of the GNU General Public License version
   61.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   61.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   61.21 + *
   61.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   61.23 + * or visit www.oracle.com if you need additional information or have any
   61.24 + * questions.
   61.25 + *
   61.26 + */
   61.27 +package p;
   61.28 +
   61.29 +import java.lang.reflect.InvocationTargetException;
   61.30 +import java.lang.reflect.Method;
   61.31 +
   61.32 +/**
   61.33 + * Invokes I.m using reflection.
   61.34 + */
   61.35 +public class Treflect {
   61.36 +
   61.37 +    public static int test(p.I ii) throws Throwable {
   61.38 +        int accum = 0;
   61.39 +        Method m = p.I.class.getMethod("m");
   61.40 +        try {
   61.41 +            for (int j = 0; j < 100000; j++) {
   61.42 +                Object o = m.invoke(ii);
   61.43 +                accum += ((Integer) o).intValue();
   61.44 +            }
   61.45 +        } catch (InvocationTargetException ite) {
   61.46 +            throw ite.getCause();
   61.47 +        }
   61.48 +        return accum;
   61.49 +    }
   61.50 +
   61.51 +    public static int test(p.I ii, byte b, char c, short s, int i, long l,
   61.52 +            Object o1, Object o2, Object o3, Object o4, Object o5, Object o6)
   61.53 +            throws Throwable {
   61.54 +        Method m = p.I.class.getMethod("m", Byte.TYPE, Character.TYPE,
   61.55 +                Short.TYPE, Integer.TYPE, Long.TYPE,
   61.56 +                Object.class, Object.class, Object.class,
   61.57 +                Object.class, Object.class, Object.class);
   61.58 +        int accum = 0;
   61.59 +        try {
   61.60 +            for (int j = 0; j < 100000; j++) {
   61.61 +                Object o = m.invoke(ii, b, c, s, i, l, o1, o2, o3, o4, o5, o6);
   61.62 +                accum += ((Integer) o).intValue();
   61.63 +            }
   61.64 +        } catch (InvocationTargetException ite) {
   61.65 +            throw ite.getCause();
   61.66 +        }
   61.67 +        return accum;
   61.68 +    }
   61.69 +}
    62.1 --- a/test/runtime/6626217/Test6626217.sh	Tue Nov 26 14:35:38 2013 +0100
    62.2 +++ b/test/runtime/6626217/Test6626217.sh	Mon Dec 02 15:43:04 2013 +0100
    62.3 @@ -21,7 +21,8 @@
    62.4  #  questions.
    62.5  # 
    62.6  
    62.7 - 
    62.8 +
    62.9 +# @ignore 8028733
   62.10  # @test @(#)Test6626217.sh
   62.11  # @bug 6626217
   62.12  # @summary Loader-constraint table allows arrays instead of only the base-classes
    63.1 --- a/test/runtime/6929067/Test6929067.sh	Tue Nov 26 14:35:38 2013 +0100
    63.2 +++ b/test/runtime/6929067/Test6929067.sh	Mon Dec 02 15:43:04 2013 +0100
    63.3 @@ -1,6 +1,7 @@
    63.4  #!/bin/sh
    63.5  
    63.6  ##
    63.7 +## @ignore 8028740
    63.8  ## @test Test6929067.sh
    63.9  ## @bug 6929067
   63.10  ## @bug 8021296
    64.1 --- a/test/runtime/CDSCompressedKPtrs/XShareAuto.java	Tue Nov 26 14:35:38 2013 +0100
    64.2 +++ b/test/runtime/CDSCompressedKPtrs/XShareAuto.java	Mon Dec 02 15:43:04 2013 +0100
    64.3 @@ -22,6 +22,7 @@
    64.4   */
    64.5  
    64.6  /*
    64.7 + * @ignore 8026154
    64.8   * @test
    64.9   * @bug 8005933
   64.10   * @summary Test that -Xshare:auto uses CDS when explicitly specified with -server.
    65.1 --- a/test/runtime/InitialThreadOverflow/testme.sh	Tue Nov 26 14:35:38 2013 +0100
    65.2 +++ b/test/runtime/InitialThreadOverflow/testme.sh	Mon Dec 02 15:43:04 2013 +0100
    65.3 @@ -21,6 +21,7 @@
    65.4  # or visit www.oracle.com if you need additional information or have any
    65.5  # questions.
    65.6  
    65.7 +# @ignore 8029139
    65.8  # @test testme.sh
    65.9  # @bug 8009062
   65.10  # @summary Poor performance of JNI AttachCurrentThread after fix for 7017193
    66.1 --- a/test/runtime/LoadClass/LoadClassNegative.java	Tue Nov 26 14:35:38 2013 +0100
    66.2 +++ b/test/runtime/LoadClass/LoadClassNegative.java	Mon Dec 02 15:43:04 2013 +0100
    66.3 @@ -22,6 +22,7 @@
    66.4   */
    66.5  
    66.6  /*
    66.7 + * @ignore 8028095
    66.8   * @test
    66.9   * @key regression
   66.10   * @bug 8020675
    67.1 --- a/test/runtime/XCheckJniJsig/XCheckJSig.java	Tue Nov 26 14:35:38 2013 +0100
    67.2 +++ b/test/runtime/XCheckJniJsig/XCheckJSig.java	Mon Dec 02 15:43:04 2013 +0100
    67.3 @@ -22,6 +22,7 @@
    67.4   */
    67.5  
    67.6  /*
    67.7 + * @ignore 8023735
    67.8   * @test
    67.9   * @bug 7051189 8023393
   67.10   * @summary Need to suppress info message if -Xcheck:jni is used with libjsig.so
    68.1 --- a/test/runtime/jsig/Test8017498.sh	Tue Nov 26 14:35:38 2013 +0100
    68.2 +++ b/test/runtime/jsig/Test8017498.sh	Mon Dec 02 15:43:04 2013 +0100
    68.3 @@ -24,6 +24,7 @@
    68.4  #
    68.5  
    68.6  ##
    68.7 +## @ignore 8028806
    68.8  ## @test Test8017498.sh
    68.9  ## @bug 8017498
   68.10  ## @bug 8020791
    69.1 --- a/test/runtime/memory/ReadFromNoaccessArea.java	Tue Nov 26 14:35:38 2013 +0100
    69.2 +++ b/test/runtime/memory/ReadFromNoaccessArea.java	Mon Dec 02 15:43:04 2013 +0100
    69.3 @@ -22,6 +22,7 @@
    69.4   */
    69.5  
    69.6  /*
    69.7 + * @ignore 8028398
    69.8   * @test
    69.9   * @summary Test that touching noaccess area in class ReservedHeapSpace results in SIGSEGV/ACCESS_VIOLATION
   69.10   * @library /testlibrary /testlibrary/whitebox

mercurial