changeset 2176:27e4ea99855d

Merge
author johnc
date Thu, 27 Jan 2011 13:42:28 -0800
parents 9846d99e16d3 (diff) 81668b1f4877 (current diff)
children 3582bf76420e
files src/share/vm/runtime/arguments.cpp
diffstat 25 files changed, 169 insertions(+), 114 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Jan 26 09:57:42 2011 -0800
+++ b/.hgtags	Thu Jan 27 13:42:28 2011 -0800
@@ -141,4 +141,6 @@
 0a8e0d4345b37b71ec49dda08ee03b68c4f1b592 jdk7-b124
 0a8e0d4345b37b71ec49dda08ee03b68c4f1b592 hs20-b05
 e24ab3fa6aafad3efabbe7dba9918c5f461a20b1 jdk7-b125
+4c851c931d001a882cab809aaf3a55371b919244 jdk7-b126
 e24ab3fa6aafad3efabbe7dba9918c5f461a20b1 hs20-b06
+d535bf4c12355a2897e918da9f8910c0aceec4fb hs20-b07
--- a/make/hotspot_version	Wed Jan 26 09:57:42 2011 -0800
+++ b/make/hotspot_version	Thu Jan 27 13:42:28 2011 -0800
@@ -33,9 +33,9 @@
 # Don't put quotes (fail windows build).
 HOTSPOT_VM_COPYRIGHT=Copyright 2011
 
-HS_MAJOR_VER=20
+HS_MAJOR_VER=21
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=07
+HS_BUILD_NUMBER=01
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=7
--- a/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/cpu/sparc/vm/c1_CodeStubs_sparc.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -129,27 +129,6 @@
 }
 
 
-// Implementation of ArrayStoreExceptionStub
-
-ArrayStoreExceptionStub::ArrayStoreExceptionStub(CodeEmitInfo* info):
-  _info(info) {
-}
-
-
-void ArrayStoreExceptionStub::emit_code(LIR_Assembler* ce) {
-  __ bind(_entry);
-  __ call(Runtime1::entry_for(Runtime1::throw_array_store_exception_id), relocInfo::runtime_call_type);
-  __ delayed()->nop();
-  ce->add_call_info_here(_info);
-  ce->verify_oop_map(_info);
-#ifdef ASSERT
-  __ should_not_reach_here();
-#endif
-}
-
-
-
-
 // Implementation of NewInstanceStub
 
 NewInstanceStub::NewInstanceStub(LIR_Opr klass_reg, LIR_Opr result, ciInstanceKlass* klass, CodeEmitInfo* info, Runtime1::StubID stub_id) {
--- a/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/cpu/sparc/vm/c1_Runtime1_sparc.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -343,9 +343,10 @@
   // returned.
 
   restore_live_registers(sasm);
-  __ restore();
-  __ br(Assembler::always, false, Assembler::pt, deopt_blob->unpack_with_reexecution(), relocInfo::runtime_call_type);
-  __ delayed()->nop();
+
+  AddressLiteral dest(deopt_blob->unpack_with_reexecution());
+  __ jump_to(dest, O0);
+  __ delayed()->restore();
 
   __ bind(no_deopt);
   restore_live_registers(sasm);
@@ -709,7 +710,7 @@
     case throw_array_store_exception_id:
       {
         __ set_info("throw_array_store_exception", dont_gc_arguments);
-        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), false);
+        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true);
       }
       break;
 
--- a/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/cpu/x86/vm/c1_CodeStubs_x86.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -411,20 +411,6 @@
 }
 
 
-ArrayStoreExceptionStub::ArrayStoreExceptionStub(CodeEmitInfo* info):
-  _info(info) {
-}
-
-
-void ArrayStoreExceptionStub::emit_code(LIR_Assembler* ce) {
-  assert(__ rsp_offset() == 0, "frame size should be fixed");
-  __ bind(_entry);
-  __ call(RuntimeAddress(Runtime1::entry_for(Runtime1::throw_array_store_exception_id)));
-  ce->add_call_info_here(_info);
-  debug_only(__ should_not_reach_here());
-}
-
-
 void ArrayCopyStub::emit_code(LIR_Assembler* ce) {
   //---------------slow case: call to native-----------------
   __ bind(_entry);
--- a/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/cpu/x86/vm/c1_LIRGenerator_x86.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -733,8 +733,8 @@
 
   // generate compare-and-swap; produces zero condition if swap occurs
   int value_offset = sun_misc_AtomicLongCSImpl::value_offset();
-  LIR_Opr addr = obj.result();
-  __ add(addr, LIR_OprFact::intConst(value_offset), addr);
+  LIR_Opr addr = new_pointer_register();
+  __ leal(LIR_OprFact::address(new LIR_Address(obj.result(), value_offset, T_LONG)), addr);
   LIR_Opr t1 = LIR_OprFact::illegalOpr;  // no temp needed
   LIR_Opr t2 = LIR_OprFact::illegalOpr;  // no temp needed
   __ cas_long(addr, cmp_value.result(), new_value.result(), t1, t2);
--- a/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/cpu/x86/vm/c1_Runtime1_x86.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1337,7 +1337,7 @@
       { StubFrame f(sasm, "throw_array_store_exception", dont_gc_arguments);
         // tos + 0: link
         //     + 1: return address
-        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), false);
+        oop_maps = generate_exception_throw(sasm, CAST_FROM_FN_PTR(address, throw_array_store_exception), true);
       }
       break;
 
--- a/src/share/vm/c1/c1_Canonicalizer.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_Canonicalizer.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -898,4 +898,4 @@
 void Canonicalizer::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {}
 void Canonicalizer::do_ProfileCall(ProfileCall* x) {}
 void Canonicalizer::do_ProfileInvoke(ProfileInvoke* x) {}
-
+void Canonicalizer::do_RuntimeCall(RuntimeCall* x) {}
--- a/src/share/vm/c1/c1_Canonicalizer.hpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_Canonicalizer.hpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -102,6 +102,7 @@
   virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   virtual void do_ProfileCall    (ProfileCall*     x);
   virtual void do_ProfileInvoke  (ProfileInvoke*   x);
+  virtual void do_RuntimeCall    (RuntimeCall*     x);
 };
 
 #endif // SHARE_VM_C1_C1_CANONICALIZER_HPP
--- a/src/share/vm/c1/c1_CodeStubs.hpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_CodeStubs.hpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -476,18 +476,12 @@
 
 
 
-class ArrayStoreExceptionStub: public CodeStub {
+class ArrayStoreExceptionStub: public SimpleExceptionStub {
  private:
   CodeEmitInfo* _info;
 
  public:
-  ArrayStoreExceptionStub(CodeEmitInfo* info);
-  virtual void emit_code(LIR_Assembler* emit);
-  virtual CodeEmitInfo* info() const             { return _info; }
-  virtual bool is_exception_throw_stub() const   { return true; }
-  virtual void visit(LIR_OpVisitState* visitor) {
-    visitor->do_slow_case(_info);
-  }
+  ArrayStoreExceptionStub(LIR_Opr obj, CodeEmitInfo* info): SimpleExceptionStub(Runtime1::throw_array_store_exception_id, obj, info) {}
 #ifndef PRODUCT
   virtual void print_name(outputStream* out) const { out->print("ArrayStoreExceptionStub"); }
 #endif // PRODUCT
--- a/src/share/vm/c1/c1_GraphBuilder.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1396,6 +1396,13 @@
   if (continuation() != NULL) {
     assert(!method()->is_synchronized() || InlineSynchronizedMethods, "can not inline synchronized methods yet");
 
+    if (compilation()->env()->dtrace_method_probes()) {
+      // Report exit from inline methods
+      Values* args = new Values(1);
+      args->push(append(new Constant(new ObjectConstant(method()))));
+      append(new RuntimeCall(voidType, "dtrace_method_exit", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), args));
+    }
+
     // If the inlined method is synchronized, the monitor must be
     // released before we jump to the continuation block.
     if (method()->is_synchronized()) {
@@ -3301,6 +3308,13 @@
   Value exception = append_with_bci(new ExceptionObject(), SynchronizationEntryBCI);
   assert(exception->is_pinned(), "must be");
 
+  if (compilation()->env()->dtrace_method_probes()) {
+    // Report exit from inline methods
+    Values* args = new Values(1);
+    args->push(append(new Constant(new ObjectConstant(method()))));
+    append(new RuntimeCall(voidType, "dtrace_method_exit", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_exit), args));
+  }
+
   int bci = SynchronizationEntryBCI;
   if (lock) {
     assert(state()->locks_size() > 0 && state()->lock_at(state()->locks_size() - 1) == lock, "lock is missing");
@@ -3486,6 +3500,11 @@
     inline_sync_entry(lock, sync_handler);
   }
 
+  if (compilation()->env()->dtrace_method_probes()) {
+    Values* args = new Values(1);
+    args->push(append(new Constant(new ObjectConstant(method()))));
+    append(new RuntimeCall(voidType, "dtrace_method_entry", CAST_FROM_FN_PTR(address, SharedRuntime::dtrace_method_entry), args));
+  }
 
   BlockBegin* callee_start_block = block_at(0);
   if (callee_start_block != NULL) {
--- a/src/share/vm/c1/c1_Instruction.hpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_Instruction.hpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,6 +106,7 @@
 class         UnsafePrefetchWrite;
 class   ProfileCall;
 class   ProfileInvoke;
+class   RuntimeCall;
 
 // A Value is a reference to the instruction creating the value
 typedef Instruction* Value;
@@ -202,6 +203,7 @@
   virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) = 0;
   virtual void do_ProfileCall    (ProfileCall*     x) = 0;
   virtual void do_ProfileInvoke  (ProfileInvoke*   x) = 0;
+  virtual void do_RuntimeCall    (RuntimeCall*     x) = 0;
 };
 
 
@@ -2267,6 +2269,38 @@
   virtual void input_values_do(ValueVisitor* f)   { if (_recv != NULL) f->visit(&_recv); }
 };
 
+
+// Call some C runtime function that doesn't safepoint,
+// optionally passing the current thread as the first argument.
+LEAF(RuntimeCall, Instruction)
+ private:
+  const char* _entry_name;
+  address     _entry;
+  Values*     _args;
+  bool        _pass_thread;  // Pass the JavaThread* as an implicit first argument
+
+ public:
+  RuntimeCall(ValueType* type, const char* entry_name, address entry, Values* args, bool pass_thread = true)
+    : Instruction(type)
+    , _entry(entry)
+    , _args(args)
+    , _entry_name(entry_name)
+    , _pass_thread(pass_thread) {
+    ASSERT_VALUES
+    pin();
+  }
+
+  const char* entry_name() const  { return _entry_name; }
+  address entry() const           { return _entry; }
+  int number_of_arguments() const { return _args->length(); }
+  Value argument_at(int i) const  { return _args->at(i); }
+  bool pass_thread() const        { return _pass_thread; }
+
+  virtual void input_values_do(ValueVisitor* f)   {
+    for (int i = 0; i < _args->length(); i++) f->visit(_args->adr_at(i));
+  }
+};
+
 // Use to trip invocation counter of an inlined method
 
 LEAF(ProfileInvoke, Instruction)
--- a/src/share/vm/c1/c1_InstructionPrinter.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_InstructionPrinter.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -841,4 +841,13 @@
 
 }
 
+void InstructionPrinter::do_RuntimeCall(RuntimeCall* x) {
+  output()->print("call_rt %s(", x->entry_name());
+  for (int i = 0; i < x->number_of_arguments(); i++) {
+    if (i > 0) output()->print(", ");
+    print_value(x->argument_at(i));
+  }
+  output()->put(')');
+}
+
 #endif // PRODUCT
--- a/src/share/vm/c1/c1_InstructionPrinter.hpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_InstructionPrinter.hpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -131,6 +131,7 @@
   virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   virtual void do_ProfileCall    (ProfileCall*     x);
   virtual void do_ProfileInvoke  (ProfileInvoke*   x);
+  virtual void do_RuntimeCall    (RuntimeCall*     x);
 };
 #endif // PRODUCT
 
--- a/src/share/vm/c1/c1_LIR.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_LIR.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -396,7 +396,7 @@
   , _should_profile(false)
 {
   if (code == lir_store_check) {
-    _stub = new ArrayStoreExceptionStub(info_for_exception);
+    _stub = new ArrayStoreExceptionStub(object, info_for_exception);
     assert(info_for_exception != NULL, "store_check throws exceptions");
   } else {
     ShouldNotReachHere();
--- a/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2741,6 +2741,31 @@
   }
 }
 
+void LIRGenerator::do_RuntimeCall(RuntimeCall* x) {
+  LIR_OprList* args = new LIR_OprList(x->number_of_arguments());
+  BasicTypeList* signature = new BasicTypeList(x->number_of_arguments());
+
+  if (x->pass_thread()) {
+    signature->append(T_ADDRESS);
+    args->append(getThreadPointer());
+  }
+
+  for (int i = 0; i < x->number_of_arguments(); i++) {
+    Value a = x->argument_at(i);
+    LIRItem* item = new LIRItem(a, this);
+    item->load_item();
+    args->append(item->result());
+    signature->append(as_BasicType(a->type()));
+  }
+
+  LIR_Opr result = call_runtime(signature, args, x->entry(), x->type(), NULL);
+  if (x->type() == voidType) {
+    set_no_result(x);
+  } else {
+    __ move(result, rlock_result(x));
+  }
+}
+
 LIR_Opr LIRGenerator::call_runtime(Value arg1, address entry, ValueType* result_type, CodeEmitInfo* info) {
   LIRItemList args(1);
   LIRItem value(arg1, this);
--- a/src/share/vm/c1/c1_LIRGenerator.hpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_LIRGenerator.hpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -522,6 +522,7 @@
   virtual void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   virtual void do_ProfileCall    (ProfileCall*     x);
   virtual void do_ProfileInvoke  (ProfileInvoke*   x);
+  virtual void do_RuntimeCall    (RuntimeCall*     x);
 };
 
 
--- a/src/share/vm/c1/c1_Optimizer.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_Optimizer.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -496,6 +496,7 @@
   void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x);
   void do_ProfileCall    (ProfileCall*     x);
   void do_ProfileInvoke  (ProfileInvoke*   x);
+  void do_RuntimeCall    (RuntimeCall*     x);
 };
 
 
@@ -664,6 +665,7 @@
 void NullCheckVisitor::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {}
 void NullCheckVisitor::do_ProfileCall    (ProfileCall*     x) { nce()->clear_last_explicit_null_check(); }
 void NullCheckVisitor::do_ProfileInvoke  (ProfileInvoke*   x) {}
+void NullCheckVisitor::do_RuntimeCall    (RuntimeCall*     x) {}
 
 
 void NullCheckEliminator::visit(Value* p) {
--- a/src/share/vm/c1/c1_Runtime1.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_Runtime1.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -339,8 +339,10 @@
 JRT_END
 
 
-JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread))
-  THROW(vmSymbolHandles::java_lang_ArrayStoreException());
+JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread, oopDesc* obj))
+  ResourceMark rm(thread);
+  const char* klass_name = Klass::cast(obj->klass())->external_name();
+  SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayStoreException(), klass_name);
 JRT_END
 
 
--- a/src/share/vm/c1/c1_Runtime1.hpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_Runtime1.hpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -143,9 +143,9 @@
   static void throw_index_exception(JavaThread* thread, int index);
   static void throw_div0_exception(JavaThread* thread);
   static void throw_null_pointer_exception(JavaThread* thread);
-  static void throw_class_cast_exception(JavaThread* thread, oopDesc* obect);
+  static void throw_class_cast_exception(JavaThread* thread, oopDesc* object);
   static void throw_incompatible_class_change_error(JavaThread* thread);
-  static void throw_array_store_exception(JavaThread* thread);
+  static void throw_array_store_exception(JavaThread* thread, oopDesc* object);
 
   static void monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock);
   static void monitorexit (JavaThread* thread, BasicObjectLock* lock);
--- a/src/share/vm/c1/c1_ValueMap.hpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/c1/c1_ValueMap.hpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -192,11 +192,12 @@
   void do_ExceptionObject(ExceptionObject* x) { /* nothing to do */ }
   void do_RoundFP        (RoundFP*         x) { /* nothing to do */ }
   void do_UnsafeGetRaw   (UnsafeGetRaw*    x) { /* nothing to do */ }
-  void do_ProfileInvoke  (ProfileInvoke*   x) { /* nothing to do */ };
   void do_UnsafeGetObject(UnsafeGetObject* x) { /* nothing to do */ }
   void do_UnsafePrefetchRead (UnsafePrefetchRead*  x) { /* nothing to do */ }
   void do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) { /* nothing to do */ }
   void do_ProfileCall    (ProfileCall*     x) { /* nothing to do */ }
+  void do_ProfileInvoke  (ProfileInvoke*   x) { /* nothing to do */ };
+  void do_RuntimeCall    (RuntimeCall*     x) { /* nothing to do */ };
 };
 
 
--- a/src/share/vm/ci/bcEscapeAnalyzer.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/ci/bcEscapeAnalyzer.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -233,6 +233,10 @@
 
   // compute size of arguments
   int arg_size = target->arg_size();
+  if (code == Bytecodes::_invokedynamic) {
+    assert(!target->is_static(), "receiver explicit in method");
+    arg_size--;  // implicit, not really on stack
+  }
   if (!target->is_loaded() && code == Bytecodes::_invokestatic) {
     arg_size--;
   }
@@ -250,6 +254,10 @@
     ArgumentMap arg = state._stack[i];
     skip_callee = !is_argument(arg) || !is_arg_stack(arg) || (directly_recursive && arg.is_singleton(i - arg_base));
   }
+  // For now we conservatively skip invokedynamic.
+  if (code == Bytecodes::_invokedynamic) {
+    skip_callee = true;
+  }
   if (skip_callee) {
     TRACE_BCEA(3, tty->print_cr("[EA] skipping method %s::%s", holder->name()->as_utf8(), target->name()->as_utf8()));
     for (i = 0; i < arg_size; i++) {
--- a/src/share/vm/prims/jvm.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/prims/jvm.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2651,12 +2651,18 @@
     // we operate.
     MutexLocker mu(Threads_lock);
 
-    // Check to see if we're running a thread that's already exited or was
-    // stopped (is_stillborn) or is still active (thread is not NULL).
-    if (java_lang_Thread::is_stillborn(JNIHandles::resolve_non_null(jthread)) ||
-        java_lang_Thread::thread(JNIHandles::resolve_non_null(jthread)) != NULL) {
-        throw_illegal_thread_state = true;
+    // Since JDK 5 the java.lang.Thread threadStatus is used to prevent
+    // re-starting an already started thread, so we should usually find
+    // that the JavaThread is null. However for a JNI attached thread
+    // there is a small window between the Thread object being created
+    // (with its JavaThread set) and the update to its threadStatus, so we
+    // have to check for this
+    if (java_lang_Thread::thread(JNIHandles::resolve_non_null(jthread)) != NULL) {
+      throw_illegal_thread_state = true;
     } else {
+      // We could also check the stillborn flag to see if this thread was already stopped, but
+      // for historical reasons we let the thread detect that itself when it starts running
+
       jlong size =
              java_lang_Thread::stackSize(JNIHandles::resolve_non_null(jthread));
       // Allocate the C++ Thread structure and create the native thread.  The
@@ -2704,7 +2710,7 @@
 // JVM_Stop is implemented using a VM_Operation, so threads are forced to safepoints
 // before the quasi-asynchronous exception is delivered.  This is a little obtrusive,
 // but is thought to be reliable and simple. In the case, where the receiver is the
-// save thread as the sender, no safepoint is needed.
+// same thread as the sender, no safepoint is needed.
 JVM_ENTRY(void, JVM_StopThread(JNIEnv* env, jobject jthread, jobject throwable))
   JVMWrapper("JVM_StopThread");
 
@@ -2715,26 +2721,27 @@
   oop java_thread = JNIHandles::resolve_non_null(jthread);
   JavaThread* receiver = java_lang_Thread::thread(java_thread);
   Events::log("JVM_StopThread thread JavaThread " INTPTR_FORMAT " as oop " INTPTR_FORMAT " [exception " INTPTR_FORMAT "]", receiver, (address)java_thread, throwable);
-  // First check if thread already exited
+  // First check if thread is alive
   if (receiver != NULL) {
     // Check if exception is getting thrown at self (use oop equality, since the
     // target object might exit)
     if (java_thread == thread->threadObj()) {
-      // This is a change from JDK 1.1, but JDK 1.2 will also do it:
-      // NOTE (from JDK 1.2): this is done solely to prevent stopped
-      // threads from being restarted.
-      // Fix for 4314342, 4145910, perhaps others: it now doesn't have
-      // any effect on the "liveness" of a thread; see
-      // JVM_IsThreadAlive, below.
-      if (java_throwable->is_a(SystemDictionary::ThreadDeath_klass())) {
-        java_lang_Thread::set_stillborn(java_thread);
-      }
       THROW_OOP(java_throwable);
     } else {
       // Enques a VM_Operation to stop all threads and then deliver the exception...
       Thread::send_async_exception(java_thread, JNIHandles::resolve(throwable));
     }
   }
+  else {
+    // Either:
+    // - target thread has not been started before being stopped, or
+    // - target thread already terminated
+    // We could read the threadStatus to determine which case it is
+    // but that is overkill as it doesn't matter. We must set the
+    // stillborn flag for the first case, and if the thread has already
+    // exited setting this flag has no affect
+    java_lang_Thread::set_stillborn(java_thread);
+  }
 JVM_END
 
 
--- a/src/share/vm/runtime/arguments.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/runtime/arguments.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -3035,15 +3035,6 @@
     }
     ScavengeRootsInCode = 1;
   }
-#ifdef COMPILER2
-  if (EnableInvokeDynamic && DoEscapeAnalysis) {
-    // TODO: We need to find rules for invokedynamic and EA.  For now,
-    // simply disable EA by default.
-    if (FLAG_IS_DEFAULT(DoEscapeAnalysis)) {
-      DoEscapeAnalysis = false;
-    }
-  }
-#endif
 
   if (PrintGCDetails) {
     // Turn on -verbose:gc options as well
--- a/src/share/vm/runtime/thread.cpp	Wed Jan 26 09:57:42 2011 -0800
+++ b/src/share/vm/runtime/thread.cpp	Thu Jan 27 13:42:28 2011 -0800
@@ -1510,11 +1510,11 @@
   assert(JavaThread::current() == this, "sanity check");
   assert(this->threadObj() != NULL, "just checking");
 
-  // Execute thread entry point. If this thread is being asked to restart,
-  // or has been stopped before starting, do not reexecute entry point.
+  // Execute thread entry point unless this thread has a pending exception
+  // or has been stopped before starting.
   // Note: Due to JVM_StopThread we can have pending exceptions already!
-  if (!this->has_pending_exception() && !java_lang_Thread::is_stillborn(this->threadObj())) {
-    // enter the thread's entry point only if we have no pending exceptions
+  if (!this->has_pending_exception() &&
+      !java_lang_Thread::is_stillborn(this->threadObj())) {
     HandleMark hm(this);
     this->entry_point()(this, this);
   }
@@ -1533,13 +1533,10 @@
   ObjectLocker lock(threadObj, thread);
   // Ignore pending exception (ThreadDeath), since we are exiting anyway
   thread->clear_pending_exception();
-  // It is of profound importance that we set the stillborn bit and reset the thread object,
-  // before we do the notify. Since, changing these two variable will make JVM_IsAlive return
-  // false. So in case another thread is doing a join on this thread , it will detect that the thread
-  // is dead when it gets notified.
-  java_lang_Thread::set_stillborn(threadObj());
   // Thread is exiting. So set thread_status field in  java.lang.Thread class to TERMINATED.
   java_lang_Thread::set_thread_status(threadObj(), java_lang_Thread::TERMINATED);
+  // Clear the native thread instance - this makes isAlive return false and allows the join()
+  // to complete once we've done the notify_all below
   java_lang_Thread::set_thread(threadObj(), NULL);
   lock.notify_all(thread);
   // Ignore pending exception (ThreadDeath), since we are exiting anyway
@@ -1996,11 +1993,6 @@
   // (the compiler thread should not be a Java thread -- fix in 1.4.2)
   if (is_Compiler_thread()) return;
 
-  // This is a change from JDK 1.1, but JDK 1.2 will also do it:
-  if (java_throwable->is_a(SystemDictionary::ThreadDeath_klass())) {
-    java_lang_Thread::set_stillborn(threadObj());
-  }
-
   {
     // Actually throw the Throwable against the target Thread - however
     // only if there is no thread death exception installed already.