8140274: methodHandles and constantPoolHandles should be passed as const references
authorcoleenp
Fri, 23 Oct 2015 16:48:38 -0400
changeset 33593 60764a78fa5c
parent 33579 01ade4446d96
child 33594 8c87ef3e5497
8140274: methodHandles and constantPoolHandles should be passed as const references Summary: modified code to use const reference parameters Reviewed-by: sspitsyn, twisti
hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp
hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp
hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp
hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp
hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp
hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp
hotspot/src/os/aix/vm/os_aix.cpp
hotspot/src/os/bsd/vm/os_bsd.cpp
hotspot/src/os/linux/vm/os_linux.cpp
hotspot/src/os/solaris/vm/os_solaris.cpp
hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
hotspot/src/share/vm/asm/codeBuffer.cpp
hotspot/src/share/vm/asm/codeBuffer.hpp
hotspot/src/share/vm/c1/c1_Compiler.cpp
hotspot/src/share/vm/c1/c1_Compiler.hpp
hotspot/src/share/vm/ci/ciEnv.cpp
hotspot/src/share/vm/ci/ciEnv.hpp
hotspot/src/share/vm/ci/ciSignature.cpp
hotspot/src/share/vm/ci/ciSignature.hpp
hotspot/src/share/vm/classfile/classFileParser.cpp
hotspot/src/share/vm/classfile/classFileParser.hpp
hotspot/src/share/vm/classfile/javaClasses.cpp
hotspot/src/share/vm/classfile/javaClasses.hpp
hotspot/src/share/vm/classfile/resolutionErrors.cpp
hotspot/src/share/vm/classfile/resolutionErrors.hpp
hotspot/src/share/vm/classfile/symbolTable.cpp
hotspot/src/share/vm/classfile/symbolTable.hpp
hotspot/src/share/vm/classfile/systemDictionary.cpp
hotspot/src/share/vm/classfile/systemDictionary.hpp
hotspot/src/share/vm/classfile/verifier.cpp
hotspot/src/share/vm/classfile/verifier.hpp
hotspot/src/share/vm/classfile/vmSymbols.cpp
hotspot/src/share/vm/classfile/vmSymbols.hpp
hotspot/src/share/vm/code/compiledIC.cpp
hotspot/src/share/vm/code/compiledIC.hpp
hotspot/src/share/vm/code/debugInfoRec.cpp
hotspot/src/share/vm/code/debugInfoRec.hpp
hotspot/src/share/vm/code/nmethod.cpp
hotspot/src/share/vm/code/nmethod.hpp
hotspot/src/share/vm/compiler/abstractCompiler.hpp
hotspot/src/share/vm/compiler/compileBroker.cpp
hotspot/src/share/vm/compiler/compileBroker.hpp
hotspot/src/share/vm/compiler/compileTask.cpp
hotspot/src/share/vm/compiler/compileTask.hpp
hotspot/src/share/vm/compiler/compilerOracle.cpp
hotspot/src/share/vm/compiler/compilerOracle.hpp
hotspot/src/share/vm/compiler/methodMatcher.cpp
hotspot/src/share/vm/compiler/methodMatcher.hpp
hotspot/src/share/vm/interpreter/abstractInterpreter.hpp
hotspot/src/share/vm/interpreter/bytecode.hpp
hotspot/src/share/vm/interpreter/bytecodeStream.hpp
hotspot/src/share/vm/interpreter/bytecodeTracer.cpp
hotspot/src/share/vm/interpreter/bytecodeTracer.hpp
hotspot/src/share/vm/interpreter/interpreter.cpp
hotspot/src/share/vm/interpreter/interpreterRuntime.cpp
hotspot/src/share/vm/interpreter/interpreterRuntime.hpp
hotspot/src/share/vm/interpreter/linkResolver.cpp
hotspot/src/share/vm/interpreter/linkResolver.hpp
hotspot/src/share/vm/interpreter/oopMapCache.cpp
hotspot/src/share/vm/interpreter/oopMapCache.hpp
hotspot/src/share/vm/interpreter/rewriter.cpp
hotspot/src/share/vm/interpreter/rewriter.hpp
hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp
hotspot/src/share/vm/jvmci/jvmciCompilerToVM.hpp
hotspot/src/share/vm/jvmci/jvmciEnv.cpp
hotspot/src/share/vm/jvmci/jvmciEnv.hpp
hotspot/src/share/vm/oops/constantPool.cpp
hotspot/src/share/vm/oops/constantPool.hpp
hotspot/src/share/vm/oops/cpCache.cpp
hotspot/src/share/vm/oops/cpCache.hpp
hotspot/src/share/vm/oops/fieldInfo.hpp
hotspot/src/share/vm/oops/fieldStreams.hpp
hotspot/src/share/vm/oops/generateOopMap.cpp
hotspot/src/share/vm/oops/generateOopMap.hpp
hotspot/src/share/vm/oops/instanceKlass.cpp
hotspot/src/share/vm/oops/instanceKlass.hpp
hotspot/src/share/vm/oops/method.cpp
hotspot/src/share/vm/oops/method.hpp
hotspot/src/share/vm/oops/methodData.cpp
hotspot/src/share/vm/oops/methodData.hpp
hotspot/src/share/vm/opto/c2compiler.cpp
hotspot/src/share/vm/opto/c2compiler.hpp
hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp
hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp
hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp
hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp
hotspot/src/share/vm/prims/nativeLookup.cpp
hotspot/src/share/vm/prims/nativeLookup.hpp
hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
hotspot/src/share/vm/runtime/advancedThresholdPolicy.hpp
hotspot/src/share/vm/runtime/compilationPolicy.cpp
hotspot/src/share/vm/runtime/compilationPolicy.hpp
hotspot/src/share/vm/runtime/deoptimization.cpp
hotspot/src/share/vm/runtime/deoptimization.hpp
hotspot/src/share/vm/runtime/javaCalls.cpp
hotspot/src/share/vm/runtime/javaCalls.hpp
hotspot/src/share/vm/runtime/os.cpp
hotspot/src/share/vm/runtime/os.hpp
hotspot/src/share/vm/runtime/reflection.cpp
hotspot/src/share/vm/runtime/reflection.hpp
hotspot/src/share/vm/runtime/relocator.cpp
hotspot/src/share/vm/runtime/relocator.hpp
hotspot/src/share/vm/runtime/sharedRuntime.cpp
hotspot/src/share/vm/runtime/sharedRuntime.hpp
hotspot/src/share/vm/runtime/signature.hpp
hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp
hotspot/src/share/vm/runtime/simpleThresholdPolicy.hpp
hotspot/src/share/vm/shark/sharkCompiler.cpp
hotspot/src/share/vm/shark/sharkCompiler.hpp
hotspot/src/share/vm/utilities/exceptions.cpp
hotspot/src/share/vm/utilities/exceptions.hpp
--- a/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/cpu/aarch64/vm/sharedRuntime_aarch64.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1276,7 +1276,7 @@
 //    return to caller
 //
 nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
-                                                methodHandle method,
+                                                const methodHandle& method,
                                                 int compile_id,
                                                 BasicType* in_sig_bt,
                                                 VMRegPair* in_regs,
--- a/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/cpu/ppc/vm/sharedRuntime_ppc.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1701,7 +1701,7 @@
 //   return to caller
 //
 nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
-                                                methodHandle method,
+                                                const methodHandle& method,
                                                 int compile_id,
                                                 BasicType *in_sig_bt,
                                                 VMRegPair *in_regs,
--- a/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1955,7 +1955,7 @@
 //    return to caller
 //
 nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
-                                                methodHandle method,
+                                                const methodHandle& method,
                                                 int compile_id,
                                                 BasicType* in_sig_bt,
                                                 VMRegPair* in_regs,
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1502,7 +1502,7 @@
 //    return to caller
 //
 nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
-                                                methodHandle method,
+                                                const methodHandle& method,
                                                 int compile_id,
                                                 BasicType* in_sig_bt,
                                                 VMRegPair* in_regs,
--- a/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1694,7 +1694,7 @@
 };
 
 static void verify_oop_args(MacroAssembler* masm,
-                            methodHandle method,
+                            const methodHandle& method,
                             const BasicType* sig_bt,
                             const VMRegPair* regs) {
   Register temp_reg = rbx;  // not part of any compiled calling seq
@@ -1804,7 +1804,7 @@
 //    return to caller
 //
 nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
-                                                methodHandle method,
+                                                const methodHandle& method,
                                                 int compile_id,
                                                 BasicType* in_sig_bt,
                                                 VMRegPair* in_regs,
--- a/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/cpu/zero/vm/sharedRuntime_zero.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -76,7 +76,7 @@
 }
 
 nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler *masm,
-                                                methodHandle method,
+                                                const methodHandle& method,
                                                 int compile_id,
                                                 BasicType *sig_bt,
                                                 VMRegPair *regs,
--- a/hotspot/src/os/aix/vm/os_aix.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/os/aix/vm/os_aix.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -3811,7 +3811,7 @@
 // able to use structured exception handling (thread-local exception filters)
 // on, e.g., Win32.
 void
-os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method,
+os::os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& method,
                          JavaCallArguments* args, Thread* thread) {
   f(value, method, args, thread);
 }
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -3745,7 +3745,7 @@
 // able to use structured exception handling (thread-local exception filters)
 // on, e.g., Win32.
 void os::os_exception_wrapper(java_call_t f, JavaValue* value,
-                              methodHandle* method, JavaCallArguments* args,
+                              const methodHandle& method, JavaCallArguments* args,
                               Thread* thread) {
   f(value, method, args, thread);
 }
--- a/hotspot/src/os/linux/vm/os_linux.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/os/linux/vm/os_linux.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -4960,7 +4960,7 @@
 // able to use structured exception handling (thread-local exception filters)
 // on, e.g., Win32.
 void
-os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method,
+os::os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& method,
                          JavaCallArguments* args, Thread* thread) {
   f(value, method, args, thread);
 }
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -3774,7 +3774,7 @@
 // This does not do anything on Solaris. This is basically a hook for being
 // able to use structured exception handling (thread-local exception filters) on, e.g., Win32.
 void os::os_exception_wrapper(java_call_t f, JavaValue* value,
-                              methodHandle* method, JavaCallArguments* args,
+                              const methodHandle& method, JavaCallArguments* args,
                               Thread* thread) {
   f(value, method, args, thread);
 }
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -71,7 +71,7 @@
 extern LONG WINAPI topLevelExceptionFilter(_EXCEPTION_POINTERS* );
 
 // Install a win32 structured exception handler around thread.
-void os::os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread) {
+void os::os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& method, JavaCallArguments* args, Thread* thread) {
   __try {
 
 #ifndef AMD64
--- a/hotspot/src/share/vm/asm/codeBuffer.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -509,7 +509,7 @@
   }
 }
 
-void CodeBuffer::finalize_oop_references(methodHandle mh) {
+void CodeBuffer::finalize_oop_references(const methodHandle& mh) {
   No_Safepoint_Verifier nsv;
 
   GrowableArray<oop> oops;
--- a/hotspot/src/share/vm/asm/codeBuffer.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/asm/codeBuffer.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -541,7 +541,7 @@
   bool insts_contains2(address pc) const { return _insts.contains2(pc); }
 
   // Record any extra oops required to keep embedded metadata alive
-  void finalize_oop_references(methodHandle method);
+  void finalize_oop_references(const methodHandle& method);
 
   // Allocated size in all sections, when aligned and concatenated
   // (this is the eventual state of the content in its final
--- a/hotspot/src/share/vm/c1/c1_Compiler.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/c1/c1_Compiler.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,7 +98,7 @@
   return buffer_blob;
 }
 
-bool Compiler::is_intrinsic_supported(methodHandle method) {
+bool Compiler::is_intrinsic_supported(const methodHandle& method) {
   vmIntrinsics::ID id = method->intrinsic_id();
   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 
--- a/hotspot/src/share/vm/c1/c1_Compiler.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/c1/c1_Compiler.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,7 +56,7 @@
   virtual void print_timers();
 
   // Check if the C1 compiler supports an intrinsic for 'method'.
-  virtual bool is_intrinsic_supported(methodHandle method);
+  virtual bool is_intrinsic_supported(const methodHandle& method);
 
   // Size of the code buffer
   static int code_buffer_size();
--- a/hotspot/src/share/vm/ci/ciEnv.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -380,7 +380,7 @@
 // ------------------------------------------------------------------
 // ciEnv::get_klass_by_name_impl
 ciKlass* ciEnv::get_klass_by_name_impl(ciKlass* accessing_klass,
-                                       constantPoolHandle cpool,
+                                       const constantPoolHandle& cpool,
                                        ciSymbol* name,
                                        bool require_local) {
   ASSERT_IN_VM;
@@ -502,7 +502,7 @@
 // ciEnv::get_klass_by_index_impl
 //
 // Implementation of get_klass_by_index.
-ciKlass* ciEnv::get_klass_by_index_impl(constantPoolHandle cpool,
+ciKlass* ciEnv::get_klass_by_index_impl(const constantPoolHandle& cpool,
                                         int index,
                                         bool& is_accessible,
                                         ciInstanceKlass* accessor) {
@@ -559,7 +559,7 @@
 // ciEnv::get_klass_by_index
 //
 // Get a klass from the constant pool.
-ciKlass* ciEnv::get_klass_by_index(constantPoolHandle cpool,
+ciKlass* ciEnv::get_klass_by_index(const constantPoolHandle& cpool,
                                    int index,
                                    bool& is_accessible,
                                    ciInstanceKlass* accessor) {
@@ -570,7 +570,7 @@
 // ciEnv::get_constant_by_index_impl
 //
 // Implementation of get_constant_by_index().
-ciConstant ciEnv::get_constant_by_index_impl(constantPoolHandle cpool,
+ciConstant ciEnv::get_constant_by_index_impl(const constantPoolHandle& cpool,
                                              int pool_index, int cache_index,
                                              ciInstanceKlass* accessor) {
   bool ignore_will_link;
@@ -656,7 +656,7 @@
 // Pull a constant out of the constant pool.  How appropriate.
 //
 // Implementation note: this query is currently in no way cached.
-ciConstant ciEnv::get_constant_by_index(constantPoolHandle cpool,
+ciConstant ciEnv::get_constant_by_index(const constantPoolHandle& cpool,
                                         int pool_index, int cache_index,
                                         ciInstanceKlass* accessor) {
   GUARDED_VM_ENTRY(return get_constant_by_index_impl(cpool, pool_index, cache_index, accessor);)
@@ -736,7 +736,7 @@
 
 // ------------------------------------------------------------------
 // ciEnv::get_method_by_index_impl
-ciMethod* ciEnv::get_method_by_index_impl(constantPoolHandle cpool,
+ciMethod* ciEnv::get_method_by_index_impl(const constantPoolHandle& cpool,
                                           int index, Bytecodes::Code bc,
                                           ciInstanceKlass* accessor) {
   if (bc == Bytecodes::_invokedynamic) {
@@ -848,7 +848,7 @@
 
 // ------------------------------------------------------------------
 // ciEnv::get_method_by_index
-ciMethod* ciEnv::get_method_by_index(constantPoolHandle cpool,
+ciMethod* ciEnv::get_method_by_index(const constantPoolHandle& cpool,
                                      int index, Bytecodes::Code bc,
                                      ciInstanceKlass* accessor) {
   GUARDED_VM_ENTRY(return get_method_by_index_impl(cpool, index, bc, accessor);)
--- a/hotspot/src/share/vm/ci/ciEnv.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/ci/ciEnv.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -118,34 +118,34 @@
                              bool require_local);
 
   // Constant pool access.
-  ciKlass*   get_klass_by_index(constantPoolHandle cpool,
+  ciKlass*   get_klass_by_index(const constantPoolHandle& cpool,
                                 int klass_index,
                                 bool& is_accessible,
                                 ciInstanceKlass* loading_klass);
-  ciConstant get_constant_by_index(constantPoolHandle cpool,
+  ciConstant get_constant_by_index(const constantPoolHandle& cpool,
                                    int pool_index, int cache_index,
                                    ciInstanceKlass* accessor);
   ciField*   get_field_by_index(ciInstanceKlass* loading_klass,
                                 int field_index);
-  ciMethod*  get_method_by_index(constantPoolHandle cpool,
+  ciMethod*  get_method_by_index(const constantPoolHandle& cpool,
                                  int method_index, Bytecodes::Code bc,
                                  ciInstanceKlass* loading_klass);
 
   // Implementation methods for loading and constant pool access.
   ciKlass* get_klass_by_name_impl(ciKlass* accessing_klass,
-                                  constantPoolHandle cpool,
+                                  const constantPoolHandle& cpool,
                                   ciSymbol* klass_name,
                                   bool require_local);
-  ciKlass*   get_klass_by_index_impl(constantPoolHandle cpool,
+  ciKlass*   get_klass_by_index_impl(const constantPoolHandle& cpool,
                                      int klass_index,
                                      bool& is_accessible,
                                      ciInstanceKlass* loading_klass);
-  ciConstant get_constant_by_index_impl(constantPoolHandle cpool,
+  ciConstant get_constant_by_index_impl(const constantPoolHandle& cpool,
                                         int pool_index, int cache_index,
                                         ciInstanceKlass* loading_klass);
   ciField*   get_field_by_index_impl(ciInstanceKlass* loading_klass,
                                      int field_index);
-  ciMethod*  get_method_by_index_impl(constantPoolHandle cpool,
+  ciMethod*  get_method_by_index_impl(const constantPoolHandle& cpool,
                                       int method_index, Bytecodes::Code bc,
                                       ciInstanceKlass* loading_klass);
 
--- a/hotspot/src/share/vm/ci/ciSignature.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/ci/ciSignature.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@
 
 // ------------------------------------------------------------------
 // ciSignature::ciSignature
-ciSignature::ciSignature(ciKlass* accessing_klass, constantPoolHandle cpool, ciSymbol* symbol) {
+ciSignature::ciSignature(ciKlass* accessing_klass, const constantPoolHandle& cpool, ciSymbol* symbol) {
   ASSERT_IN_VM;
   EXCEPTION_CONTEXT;
   _accessing_klass = accessing_klass;
--- a/hotspot/src/share/vm/ci/ciSignature.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/ci/ciSignature.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,7 +46,7 @@
   friend class ciBytecodeStream;
   friend class ciObjectFactory;
 
-  ciSignature(ciKlass* accessing_klass, constantPoolHandle cpool, ciSymbol* signature);
+  ciSignature(ciKlass* accessing_klass, const constantPoolHandle& cpool, ciSymbol* signature);
   ciSignature(ciKlass* accessing_klass,                           ciSymbol* signature, ciMethodType* method_type);
 
   void get_all_klasses();
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -646,7 +646,7 @@
 }
 
 
-void ClassFileParser::patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS) {
+void ClassFileParser::patch_constant_pool(const constantPoolHandle& cp, int index, Handle patch, TRAPS) {
   BasicType patch_type = T_VOID;
 
   switch (cp->tag_at(index).value()) {
@@ -4411,7 +4411,7 @@
 
 void ClassFileParser::print_field_layout(Symbol* name,
                                          Array<u2>* fields,
-                                         constantPoolHandle cp,
+                                         const constantPoolHandle& cp,
                                          int instance_size,
                                          int instance_fields_start,
                                          int instance_fields_end,
--- a/hotspot/src/share/vm/classfile/classFileParser.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/classFileParser.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -241,7 +241,7 @@
 
   void print_field_layout(Symbol* name,
                           Array<u2>* fields,
-                          constantPoolHandle cp,
+                          const constantPoolHandle& cp,
                           int instance_size,
                           int instance_fields_start,
                           int instance_fields_end,
@@ -403,7 +403,7 @@
     assert(!has_cp_patch_at(index), "");
     return patch;
   }
-  void patch_constant_pool(constantPoolHandle cp, int index, Handle patch, TRAPS);
+  void patch_constant_pool(const constantPoolHandle& cp, int index, Handle patch, TRAPS);
 
   // Wrapper for constantTag.is_klass_[or_]reference.
   // In older versions of the VM, Klass*s cannot sneak into early phases of
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1561,7 +1561,7 @@
   st->print_cr("%s", buf);
 }
 
-void java_lang_Throwable::print_stack_element(outputStream *st, methodHandle method, int bci) {
+void java_lang_Throwable::print_stack_element(outputStream *st, const methodHandle& method, int bci) {
   Handle mirror = method->method_holder()->java_mirror();
   int method_id = method->orig_method_idnum();
   int version = method->constants()->version();
@@ -1632,7 +1632,7 @@
   }
 }
 
-void java_lang_Throwable::fill_in_stack_trace(Handle throwable, methodHandle method, TRAPS) {
+void java_lang_Throwable::fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS) {
   if (!StackTraceInThrowable) return;
   ResourceMark rm(THREAD);
 
@@ -1763,7 +1763,7 @@
   set_backtrace(throwable(), bt.backtrace());
 }
 
-void java_lang_Throwable::fill_in_stack_trace(Handle throwable, methodHandle method) {
+void java_lang_Throwable::fill_in_stack_trace(Handle throwable, const methodHandle& method) {
   // No-op if stack trace is disabled
   if (!StackTraceInThrowable) {
     return;
@@ -1945,7 +1945,7 @@
   return element();
 }
 
-oop java_lang_StackTraceElement::create(methodHandle method, int bci, TRAPS) {
+oop java_lang_StackTraceElement::create(const methodHandle& method, int bci, TRAPS) {
   Handle mirror (THREAD, method->method_holder()->java_mirror());
   int method_id = method->orig_method_idnum();
   int cpref = method->name_index();
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -532,7 +532,7 @@
   static Symbol* detail_message(oop throwable);
   static void print_stack_element(outputStream *st, Handle mirror, int method,
                                   int version, int bci, int cpref);
-  static void print_stack_element(outputStream *st, methodHandle method, int bci);
+  static void print_stack_element(outputStream *st, const methodHandle& method, int bci);
   static void print_stack_usage(Handle stream);
 
   // Allocate space for backtrace (created but stack trace not filled in)
@@ -540,8 +540,8 @@
   // Fill in current stack trace for throwable with preallocated backtrace (no GC)
   static void fill_in_stack_trace_of_preallocated_backtrace(Handle throwable);
   // Fill in current stack trace, can cause GC
-  static void fill_in_stack_trace(Handle throwable, methodHandle method, TRAPS);
-  static void fill_in_stack_trace(Handle throwable, methodHandle method = methodHandle());
+  static void fill_in_stack_trace(Handle throwable, const methodHandle& method, TRAPS);
+  static void fill_in_stack_trace(Handle throwable, const methodHandle& method = methodHandle());
   // Programmatic access to stack trace
   static oop  get_stack_trace_element(oop throwable, int index, TRAPS);
   static int  get_stack_trace_depth(oop throwable, TRAPS);
@@ -1347,7 +1347,7 @@
 
   // Create an instance of StackTraceElement
   static oop create(Handle mirror, int method, int version, int bci, int cpref, TRAPS);
-  static oop create(methodHandle method, int bci, TRAPS);
+  static oop create(const methodHandle& method, int bci, TRAPS);
 
   // Debugging
   friend class JavaClasses;
--- a/hotspot/src/share/vm/classfile/resolutionErrors.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/resolutionErrors.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
 
 // add new entry to the table
 void ResolutionErrorTable::add_entry(int index, unsigned int hash,
-                                     constantPoolHandle pool, int cp_index,
+                                     const constantPoolHandle& pool, int cp_index,
                                      Symbol* error, Symbol* message)
 {
   assert_locked_or_safepoint(SystemDictionary_lock);
@@ -44,7 +44,7 @@
 
 // find entry in the table
 ResolutionErrorEntry* ResolutionErrorTable::find_entry(int index, unsigned int hash,
-                                                       constantPoolHandle pool, int cp_index)
+                                                       const constantPoolHandle& pool, int cp_index)
 {
   assert_locked_or_safepoint(SystemDictionary_lock);
 
--- a/hotspot/src/share/vm/classfile/resolutionErrors.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/resolutionErrors.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,15 +56,15 @@
   }
 
   void add_entry(int index, unsigned int hash,
-                 constantPoolHandle pool, int which, Symbol* error, Symbol* message);
+                 const constantPoolHandle& pool, int which, Symbol* error, Symbol* message);
 
 
   // find error given the constant pool and constant pool index
   ResolutionErrorEntry* find_entry(int index, unsigned int hash,
-                                   constantPoolHandle pool, int cp_index);
+                                   const constantPoolHandle& pool, int cp_index);
 
 
-  unsigned int compute_hash(constantPoolHandle pool, int cp_index) {
+  unsigned int compute_hash(const constantPoolHandle& pool, int cp_index) {
     return (unsigned int) pool->identity_hash() + cp_index;
   }
 
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -371,7 +371,7 @@
   }
 }
 
-void SymbolTable::add(ClassLoaderData* loader_data, constantPoolHandle cp,
+void SymbolTable::add(ClassLoaderData* loader_data, const constantPoolHandle& cp,
                       int names_count,
                       const char** names, int* lengths, int* cp_indices,
                       unsigned int* hashValues, TRAPS) {
@@ -452,7 +452,7 @@
 
 // This version of basic_add adds symbols in batch from the constant pool
 // parsing.
-bool SymbolTable::basic_add(ClassLoaderData* loader_data, constantPoolHandle cp,
+bool SymbolTable::basic_add(ClassLoaderData* loader_data, const constantPoolHandle& cp,
                             int names_count,
                             const char** names, int* lengths,
                             int* cp_indices, unsigned int* hashValues,
--- a/hotspot/src/share/vm/classfile/symbolTable.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/symbolTable.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -100,12 +100,12 @@
   Symbol* basic_add(int index, u1* name, int len, unsigned int hashValue,
                     bool c_heap, TRAPS);
   bool basic_add(ClassLoaderData* loader_data,
-                 constantPoolHandle cp, int names_count,
+                 const constantPoolHandle& cp, int names_count,
                  const char** names, int* lengths, int* cp_indices,
                  unsigned int* hashValues, TRAPS);
 
   static void new_symbols(ClassLoaderData* loader_data,
-                          constantPoolHandle cp, int names_count,
+                          const constantPoolHandle& cp, int names_count,
                           const char** name, int* lengths,
                           int* cp_indices, unsigned int* hashValues,
                           TRAPS) {
@@ -170,7 +170,7 @@
   static Symbol* lookup_only_unicode(const jchar* name, int len, unsigned int& hash);
 
   static void add(ClassLoaderData* loader_data,
-                  constantPoolHandle cp, int names_count,
+                  const constantPoolHandle& cp, int names_count,
                   const char** names, int* lengths, int* cp_indices,
                   unsigned int* hashValues, TRAPS);
 
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -2155,7 +2155,7 @@
 
 // Add entry to resolution error table to record the error when the first
 // attempt to resolve a reference to a class has failed.
-void SystemDictionary::add_resolution_error(constantPoolHandle pool, int which,
+void SystemDictionary::add_resolution_error(const constantPoolHandle& pool, int which,
                                             Symbol* error, Symbol* message) {
   unsigned int hash = resolution_errors()->compute_hash(pool, which);
   int index = resolution_errors()->hash_to_index(hash);
@@ -2171,7 +2171,7 @@
 }
 
 // Lookup resolution error table. Returns error if found, otherwise NULL.
-Symbol* SystemDictionary::find_resolution_error(constantPoolHandle pool, int which,
+Symbol* SystemDictionary::find_resolution_error(const constantPoolHandle& pool, int which,
                                                 Symbol** message) {
   unsigned int hash = resolution_errors()->compute_hash(pool, which);
   int index = resolution_errors()->hash_to_index(hash);
--- a/hotspot/src/share/vm/classfile/systemDictionary.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/systemDictionary.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -547,10 +547,10 @@
 
   // Record the error when the first attempt to resolve a reference from a constant
   // pool entry to a class fails.
-  static void add_resolution_error(constantPoolHandle pool, int which, Symbol* error,
+  static void add_resolution_error(const constantPoolHandle& pool, int which, Symbol* error,
                                    Symbol* message);
   static void delete_resolution_error(ConstantPool* pool);
-  static Symbol* find_resolution_error(constantPoolHandle pool, int which,
+  static Symbol* find_resolution_error(const constantPoolHandle& pool, int which,
                                        Symbol** message);
 
  protected:
--- a/hotspot/src/share/vm/classfile/verifier.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/verifier.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -605,7 +605,7 @@
   }
 }
 
-void ClassVerifier::verify_method(methodHandle m, TRAPS) {
+void ClassVerifier::verify_method(const methodHandle& m, TRAPS) {
   HandleMark hm(THREAD);
   _method = m;   // initialize _method
   if (VerboseVerification) {
@@ -1901,7 +1901,7 @@
 }
 
 void ClassVerifier::verify_cp_index(
-    u2 bci, constantPoolHandle cp, int index, TRAPS) {
+    u2 bci, const constantPoolHandle& cp, int index, TRAPS) {
   int nconstants = cp->length();
   if ((index <= 0) || (index >= nconstants)) {
     verify_error(ErrorContext::bad_cp_index(bci, index),
@@ -1912,7 +1912,7 @@
 }
 
 void ClassVerifier::verify_cp_type(
-    u2 bci, int index, constantPoolHandle cp, unsigned int types, TRAPS) {
+    u2 bci, int index, const constantPoolHandle& cp, unsigned int types, TRAPS) {
 
   // In some situations, bytecode rewriting may occur while we're verifying.
   // In this case, a constant pool cache exists and some indices refer to that
@@ -1931,7 +1931,7 @@
 }
 
 void ClassVerifier::verify_cp_class_type(
-    u2 bci, int index, constantPoolHandle cp, TRAPS) {
+    u2 bci, int index, const constantPoolHandle& cp, TRAPS) {
   verify_cp_index(bci, cp, index, CHECK_VERIFY(this));
   constantTag tag = cp->tag_at(index);
   if (!tag.is_klass() && !tag.is_unresolved_klass()) {
@@ -2023,7 +2023,7 @@
 
 void ClassVerifier::verify_ldc(
     int opcode, u2 index, StackMapFrame* current_frame,
-    constantPoolHandle cp, u2 bci, TRAPS) {
+    const constantPoolHandle& cp, u2 bci, TRAPS) {
   verify_cp_index(bci, cp, index, CHECK_VERIFY(this));
   constantTag tag = cp->tag_at(index);
   unsigned int types;
@@ -2165,7 +2165,7 @@
 
 void ClassVerifier::verify_field_instructions(RawBytecodeStream* bcs,
                                               StackMapFrame* current_frame,
-                                              constantPoolHandle cp,
+                                              const constantPoolHandle& cp,
                                               bool allow_arrays,
                                               TRAPS) {
   u2 index = bcs->get_index_u2();
@@ -2477,7 +2477,7 @@
 void ClassVerifier::verify_invoke_init(
     RawBytecodeStream* bcs, u2 ref_class_index, VerificationType ref_class_type,
     StackMapFrame* current_frame, u4 code_length, bool in_try_block,
-    bool *this_uninit, constantPoolHandle cp, StackMapTable* stackmap_table,
+    bool *this_uninit, const constantPoolHandle& cp, StackMapTable* stackmap_table,
     TRAPS) {
   u2 bci = bcs->bci();
   VerificationType type = current_frame->pop_stack(
@@ -2613,7 +2613,7 @@
 void ClassVerifier::verify_invoke_instructions(
     RawBytecodeStream* bcs, u4 code_length, StackMapFrame* current_frame,
     bool in_try_block, bool *this_uninit, VerificationType return_type,
-    constantPoolHandle cp, StackMapTable* stackmap_table, TRAPS) {
+    const constantPoolHandle& cp, StackMapTable* stackmap_table, TRAPS) {
   // Make sure the constant pool item is the right type
   u2 index = bcs->get_index_u2();
   Bytecodes::Code opcode = bcs->raw_code();
@@ -2878,7 +2878,7 @@
 }
 
 void ClassVerifier::verify_anewarray(
-    u2 bci, u2 index, constantPoolHandle cp,
+    u2 bci, u2 index, const constantPoolHandle& cp,
     StackMapFrame* current_frame, TRAPS) {
   verify_cp_class_type(bci, index, cp, CHECK_VERIFY(this));
   current_frame->pop_stack(
--- a/hotspot/src/share/vm/classfile/verifier.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/verifier.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -262,14 +262,14 @@
 
   ErrorContext _error_context;  // contains information about an error
 
-  void verify_method(methodHandle method, TRAPS);
+  void verify_method(const methodHandle& method, TRAPS);
   char* generate_code_data(methodHandle m, u4 code_length, TRAPS);
   void verify_exception_handler_table(u4 code_length, char* code_data,
                                       int& min, int& max, TRAPS);
   void verify_local_variable_table(u4 code_length, char* code_data, TRAPS);
 
   VerificationType cp_ref_index_to_type(
-      int index, constantPoolHandle cp, TRAPS) {
+      int index, const constantPoolHandle& cp, TRAPS) {
     return cp_index_to_type(cp->klass_ref_index_at(index), cp, THREAD);
   }
 
@@ -277,10 +277,10 @@
     instanceKlassHandle this_class, Klass* target_class,
     Symbol* field_name, Symbol* field_sig, bool is_method);
 
-  void verify_cp_index(u2 bci, constantPoolHandle cp, int index, TRAPS);
-  void verify_cp_type(u2 bci, int index, constantPoolHandle cp,
+  void verify_cp_index(u2 bci, const constantPoolHandle& cp, int index, TRAPS);
+  void verify_cp_type(u2 bci, int index, const constantPoolHandle& cp,
       unsigned int types, TRAPS);
-  void verify_cp_class_type(u2 bci, int index, constantPoolHandle cp, TRAPS);
+  void verify_cp_class_type(u2 bci, int index, const constantPoolHandle& cp, TRAPS);
 
   u2 verify_stackmap_table(
     u2 stackmap_index, u2 bci, StackMapFrame* current_frame,
@@ -292,7 +292,7 @@
 
   void verify_ldc(
     int opcode, u2 index, StackMapFrame *current_frame,
-    constantPoolHandle cp, u2 bci, TRAPS);
+    const constantPoolHandle& cp, u2 bci, TRAPS);
 
   void verify_switch(
     RawBytecodeStream* bcs, u4 code_length, char* code_data,
@@ -300,12 +300,12 @@
 
   void verify_field_instructions(
     RawBytecodeStream* bcs, StackMapFrame* current_frame,
-    constantPoolHandle cp, bool allow_arrays, TRAPS);
+    const constantPoolHandle& cp, bool allow_arrays, TRAPS);
 
   void verify_invoke_init(
     RawBytecodeStream* bcs, u2 ref_index, VerificationType ref_class_type,
     StackMapFrame* current_frame, u4 code_length, bool in_try_block,
-    bool* this_uninit, constantPoolHandle cp, StackMapTable* stackmap_table,
+    bool* this_uninit, const constantPoolHandle& cp, StackMapTable* stackmap_table,
     TRAPS);
 
   // Used by ends_in_athrow() to push all handlers that contain bci onto the
@@ -322,10 +322,10 @@
   void verify_invoke_instructions(
     RawBytecodeStream* bcs, u4 code_length, StackMapFrame* current_frame,
     bool in_try_block, bool* this_uninit, VerificationType return_type,
-    constantPoolHandle cp, StackMapTable* stackmap_table, TRAPS);
+    const constantPoolHandle& cp, StackMapTable* stackmap_table, TRAPS);
 
   VerificationType get_newarray_type(u2 index, u2 bci, TRAPS);
-  void verify_anewarray(u2 bci, u2 index, constantPoolHandle cp,
+  void verify_anewarray(u2 bci, u2 index, const constantPoolHandle& cp,
       StackMapFrame* current_frame, TRAPS);
   void verify_return_value(
       VerificationType return_type, VerificationType type, u2 offset,
@@ -406,7 +406,7 @@
   int change_sig_to_verificationType(
     SignatureStream* sig_type, VerificationType* inference_type, TRAPS);
 
-  VerificationType cp_index_to_type(int index, constantPoolHandle cp, TRAPS) {
+  VerificationType cp_index_to_type(int index, const constantPoolHandle& cp, TRAPS) {
     return VerificationType::reference_type(cp->klass_name_at(index));
   }
 
--- a/hotspot/src/share/vm/classfile/vmSymbols.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/vmSymbols.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -417,7 +417,7 @@
   }
 }
 
-bool vmIntrinsics::is_disabled_by_flags(methodHandle method, methodHandle compilation_context) {
+bool vmIntrinsics::is_disabled_by_flags(const methodHandle& method, const methodHandle& compilation_context) {
   vmIntrinsics::ID id = method->intrinsic_id();
   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 
--- a/hotspot/src/share/vm/classfile/vmSymbols.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/classfile/vmSymbols.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1402,7 +1402,7 @@
 
   // Returns true if a compiler intrinsic is disabled by command-line flags
   // and false otherwise.
-  static bool is_disabled_by_flags(methodHandle method, methodHandle compilation_context);
+  static bool is_disabled_by_flags(const methodHandle& method, const methodHandle& compilation_context);
 };
 
 #endif // SHARE_VM_CLASSFILE_VMSYMBOLS_HPP
--- a/hotspot/src/share/vm/code/compiledIC.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/code/compiledIC.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -462,7 +462,7 @@
 // is_optimized: Compiler has generated an optimized call (i.e., no inline
 // cache) static_bound: The call can be static bound (i.e, no need to use
 // inline cache)
-void CompiledIC::compute_monomorphic_entry(methodHandle method,
+void CompiledIC::compute_monomorphic_entry(const methodHandle& method,
                                            KlassHandle receiver_klass,
                                            bool is_optimized,
                                            bool static_bound,
@@ -594,7 +594,7 @@
 
 // Compute settings for a CompiledStaticCall. Since we might have to set
 // the stub when calling to the interpreter, we need to return arguments.
-void CompiledStaticCall::compute_entry(methodHandle m, StaticCallInfo& info) {
+void CompiledStaticCall::compute_entry(const methodHandle& m, StaticCallInfo& info) {
   nmethod* m_code = m->code();
   info._callee = m;
   if (m_code != NULL && m_code->is_in_use()) {
--- a/hotspot/src/share/vm/code/compiledIC.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/code/compiledIC.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -222,7 +222,7 @@
   // allocation in the code cache fails.
   bool set_to_megamorphic(CallInfo* call_info, Bytecodes::Code bytecode, TRAPS);
 
-  static void compute_monomorphic_entry(methodHandle method, KlassHandle receiver_klass,
+  static void compute_monomorphic_entry(const methodHandle& method, KlassHandle receiver_klass,
                                         bool is_optimized, bool static_bound, CompiledICInfo& info, TRAPS);
 
   // Location
@@ -324,7 +324,7 @@
   void set(const StaticCallInfo& info);
 
   // Compute entry point given a method
-  static void compute_entry(methodHandle m, StaticCallInfo& info);
+  static void compute_entry(const methodHandle& m, StaticCallInfo& info);
 
   // Stub support
   address find_stub();
--- a/hotspot/src/share/vm/code/debugInfoRec.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/code/debugInfoRec.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -324,7 +324,7 @@
 // must call add_safepoint before: it sets PcDesc and this routine uses
 // the last PcDesc set
 void DebugInformationRecorder::describe_scope(int         pc_offset,
-                                              methodHandle methodH,
+                                              const methodHandle& methodH,
                                               ciMethod*   method,
                                               int         bci,
                                               bool        reexecute,
--- a/hotspot/src/share/vm/code/debugInfoRec.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/code/debugInfoRec.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -98,7 +98,7 @@
   // by add_non_safepoint, and the locals, expressions, and monitors
   // must all be null.
   void describe_scope(int         pc_offset,
-                      methodHandle methodH,
+                      const methodHandle& methodH,
                       ciMethod*   method,
                       int         bci,
                       bool        reexecute,
--- a/hotspot/src/share/vm/code/nmethod.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/code/nmethod.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -558,7 +558,7 @@
 #endif
 }
 
-nmethod* nmethod::new_native_nmethod(methodHandle method,
+nmethod* nmethod::new_native_nmethod(const methodHandle& method,
   int compile_id,
   CodeBuffer *code_buffer,
   int vep_offset,
@@ -596,7 +596,7 @@
   return nm;
 }
 
-nmethod* nmethod::new_nmethod(methodHandle method,
+nmethod* nmethod::new_nmethod(const methodHandle& method,
   int compile_id,
   int entry_bci,
   CodeOffsets* offsets,
--- a/hotspot/src/share/vm/code/nmethod.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/code/nmethod.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -307,7 +307,7 @@
 
  public:
   // create nmethod with entry_bci
-  static nmethod* new_nmethod(methodHandle method,
+  static nmethod* new_nmethod(const methodHandle& method,
                               int compile_id,
                               int entry_bci,
                               CodeOffsets* offsets,
@@ -327,7 +327,7 @@
 #endif
                              );
 
-  static nmethod* new_native_nmethod(methodHandle method,
+  static nmethod* new_native_nmethod(const methodHandle& method,
                                      int compile_id,
                                      CodeBuffer *code_buffer,
                                      int vep_offset,
--- a/hotspot/src/share/vm/compiler/abstractCompiler.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/compiler/abstractCompiler.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -110,7 +110,7 @@
   // Missing feature tests
   virtual bool supports_native()                 { return true; }
   virtual bool supports_osr   ()                 { return true; }
-  virtual bool can_compile_method(methodHandle method)  { return true; }
+  virtual bool can_compile_method(const methodHandle& method)  { return true; }
 
   // Determine if the current compiler provides an intrinsic
   // for method 'method'. An intrinsic is available if:
@@ -141,7 +141,7 @@
   // disable intrinsics on a per-method basis. In cases (2) and (3) the
   // compilation context is aClass::aMethod and java.lang.ref.Reference::get,
   // respectively.
-  virtual bool is_intrinsic_available(methodHandle method, methodHandle compilation_context) {
+  virtual bool is_intrinsic_available(const methodHandle& method, const methodHandle& compilation_context) {
     return is_intrinsic_supported(method) &&
            !vmIntrinsics::is_disabled_by_flags(method, compilation_context);
   }
@@ -154,7 +154,7 @@
   // by default no intrinsics are supported by a compiler except
   // the ones listed in the method. Overriding methods should conform
   // to this behavior.
-  virtual bool is_intrinsic_supported(methodHandle method) {
+  virtual bool is_intrinsic_supported(const methodHandle& method) {
     return false;
   }
 
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -777,10 +777,10 @@
 // CompileBroker::compile_method
 //
 // Request compilation of a method.
-void CompileBroker::compile_method_base(methodHandle method,
+void CompileBroker::compile_method_base(const methodHandle& method,
                                         int osr_bci,
                                         int comp_level,
-                                        methodHandle hot_method,
+                                        const methodHandle& hot_method,
                                         int hot_count,
                                         const char* comment,
                                         Thread* thread) {
@@ -980,9 +980,9 @@
 }
 
 
-nmethod* CompileBroker::compile_method(methodHandle method, int osr_bci,
+nmethod* CompileBroker::compile_method(const methodHandle& method, int osr_bci,
                                        int comp_level,
-                                       methodHandle hot_method, int hot_count,
+                                       const methodHandle& hot_method, int hot_count,
                                        const char* comment, Thread* THREAD) {
   // make sure arguments make sense
   assert(method->method_holder()->oop_is_instance(), "not an instance method");
@@ -1121,7 +1121,7 @@
 // CompileBroker::compilation_is_complete
 //
 // See if compilation of this method is already complete.
-bool CompileBroker::compilation_is_complete(methodHandle method,
+bool CompileBroker::compilation_is_complete(const methodHandle& method,
                                             int          osr_bci,
                                             int          comp_level) {
   bool is_osr = (osr_bci != standard_entry_bci);
@@ -1154,7 +1154,7 @@
  * versa).  This can be remedied by a full queue search to disambiguate
  * cases.  If it is deemed profitable, this may be done.
  */
-bool CompileBroker::compilation_is_in_queue(methodHandle method) {
+bool CompileBroker::compilation_is_in_queue(const methodHandle& method) {
   return method->queued_for_compilation();
 }
 
@@ -1162,7 +1162,7 @@
 // CompileBroker::compilation_is_prohibited
 //
 // See if this compilation is not allowed.
-bool CompileBroker::compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level) {
+bool CompileBroker::compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level) {
   bool is_native = method->is_native();
   // Some compilers may not support the compilation of natives.
   AbstractCompiler *comp = compiler(comp_level);
@@ -1205,7 +1205,7 @@
  * and the ID is not within the specified range, the method is not compiled and 0 is returned.
  * The function also allows to generate separate compilation IDs for OSR compilations.
  */
-int CompileBroker::assign_compile_id(methodHandle method, int osr_bci) {
+int CompileBroker::assign_compile_id(const methodHandle& method, int osr_bci) {
 #ifdef ASSERT
   bool is_osr = (osr_bci != standard_entry_bci);
   int id;
@@ -1240,7 +1240,7 @@
 // CompileBroker::assign_compile_id_unlocked
 //
 // Public wrapper for assign_compile_id that acquires the needed locks
-uint CompileBroker::assign_compile_id_unlocked(Thread* thread, methodHandle method, int osr_bci) {
+uint CompileBroker::assign_compile_id_unlocked(Thread* thread, const methodHandle& method, int osr_bci) {
   MutexLocker locker(MethodCompileQueue_lock, thread);
   return assign_compile_id(method, osr_bci);
 }
@@ -1257,7 +1257,7 @@
 
 // ------------------------------------------------------------------
 // CompileBroker::preload_classes
-void CompileBroker::preload_classes(methodHandle method, TRAPS) {
+void CompileBroker::preload_classes(const methodHandle& method, TRAPS) {
   // Move this code over from c1_Compiler.cpp
   ShouldNotReachHere();
 }
@@ -1270,10 +1270,10 @@
 // compilation.  Add this task to the queue.
 CompileTask* CompileBroker::create_compile_task(CompileQueue* queue,
                                               int           compile_id,
-                                              methodHandle  method,
+                                              const methodHandle&  method,
                                               int           osr_bci,
                                               int           comp_level,
-                                              methodHandle  hot_method,
+                                              const methodHandle&  hot_method,
                                               int           hot_count,
                                               const char*   comment,
                                               bool          blocking) {
@@ -1866,7 +1866,7 @@
 // CompileBroker::set_last_compile
 //
 // Record this compilation for debugging purposes.
-void CompileBroker::set_last_compile(CompilerThread* thread, methodHandle method, bool is_osr, int comp_level) {
+void CompileBroker::set_last_compile(CompilerThread* thread, const methodHandle& method, bool is_osr, int comp_level) {
   ResourceMark rm;
   char* method_name = method->name()->as_C_string();
   strncpy(_last_method_compiled, method_name, CompileBroker::name_buffer_length);
@@ -1952,7 +1952,7 @@
 // CompileBroker::check_break_at
 //
 // Should the compilation break at the current compilation.
-bool CompileBroker::check_break_at(methodHandle method, int compile_id, bool is_osr) {
+bool CompileBroker::check_break_at(const methodHandle& method, int compile_id, bool is_osr) {
   if (CICountOSR && is_osr && (compile_id == CIBreakAtOSR)) {
     return true;
   } else if( CompilerOracle::should_break_at(method) ) { // break when compiling
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -144,7 +144,7 @@
 
   // Compile type Information for print_last_compile() and CompilerCounters
   enum { no_compile, normal_compile, osr_compile, native_compile };
-  static int assign_compile_id (methodHandle method, int osr_bci);
+  static int assign_compile_id (const methodHandle& method, int osr_bci);
 
 
  private:
@@ -217,17 +217,17 @@
 
   static JavaThread* make_thread(const char* name, CompileQueue* queue, CompilerCounters* counters, AbstractCompiler* comp, bool compiler_thread, TRAPS);
   static void init_compiler_sweeper_threads(int c1_compiler_count, int c2_compiler_count);
-  static bool compilation_is_complete  (methodHandle method, int osr_bci, int comp_level);
-  static bool compilation_is_prohibited(methodHandle method, int osr_bci, int comp_level);
+  static bool compilation_is_complete  (const methodHandle& method, int osr_bci, int comp_level);
+  static bool compilation_is_prohibited(const methodHandle& method, int osr_bci, int comp_level);
   static bool is_compile_blocking();
-  static void preload_classes          (methodHandle method, TRAPS);
+  static void preload_classes          (const methodHandle& method, TRAPS);
 
   static CompileTask* create_compile_task(CompileQueue* queue,
                                           int           compile_id,
-                                          methodHandle  method,
+                                          const methodHandle&  method,
                                           int           osr_bci,
                                           int           comp_level,
-                                          methodHandle  hot_method,
+                                          const methodHandle&  hot_method,
                                           int           hot_count,
                                           const char*   comment,
                                           bool          blocking);
@@ -235,16 +235,16 @@
 
   static void invoke_compiler_on_method(CompileTask* task);
   static void post_compile(CompilerThread* thread, CompileTask* task, EventCompilation& event, bool success, ciEnv* ci_env);
-  static void set_last_compile(CompilerThread *thread, methodHandle method, bool is_osr, int comp_level);
+  static void set_last_compile(CompilerThread *thread, const methodHandle& method, bool is_osr, int comp_level);
   static void push_jni_handle_block();
   static void pop_jni_handle_block();
-  static bool check_break_at(methodHandle method, int compile_id, bool is_osr);
+  static bool check_break_at(const methodHandle& method, int compile_id, bool is_osr);
   static void collect_statistics(CompilerThread* thread, elapsedTimer time, CompileTask* task);
 
-  static void compile_method_base(methodHandle method,
+  static void compile_method_base(const methodHandle& method,
                                   int osr_bci,
                                   int comp_level,
-                                  methodHandle hot_method,
+                                  const methodHandle& hot_method,
                                   int hot_count,
                                   const char* comment,
                                   Thread* thread);
@@ -265,7 +265,7 @@
     return NULL;
   }
 
-  static bool compilation_is_in_queue(methodHandle method);
+  static bool compilation_is_in_queue(const methodHandle& method);
   static void print_compile_queues(outputStream* st);
   static int queue_size(int comp_level) {
     CompileQueue *q = compile_queue(comp_level);
@@ -273,15 +273,15 @@
   }
   static void compilation_init();
   static void init_compiler_thread_log();
-  static nmethod* compile_method(methodHandle method,
+  static nmethod* compile_method(const methodHandle& method,
                                  int osr_bci,
                                  int comp_level,
-                                 methodHandle hot_method,
+                                 const methodHandle& hot_method,
                                  int hot_count,
                                  const char* comment, Thread* thread);
 
   // Acquire any needed locks and assign a compile id
-  static uint assign_compile_id_unlocked(Thread* thread, methodHandle method, int osr_bci);
+  static uint assign_compile_id_unlocked(Thread* thread, const methodHandle& method, int osr_bci);
 
   static void compiler_thread_loop();
   static uint get_compilation_id() { return _compilation_id; }
--- a/hotspot/src/share/vm/compiler/compileTask.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/compiler/compileTask.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,10 +75,10 @@
 
 
 void CompileTask::initialize(int compile_id,
-                             methodHandle method,
+                             const methodHandle& method,
                              int osr_bci,
                              int comp_level,
-                             methodHandle hot_method,
+                             const methodHandle& hot_method,
                              int hot_count,
                              const char* comment,
                              bool is_blocking) {
--- a/hotspot/src/share/vm/compiler/compileTask.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/compiler/compileTask.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -71,8 +71,8 @@
     _lock = new Monitor(Mutex::nonleaf+2, "CompileTaskLock");
   }
 
-  void initialize(int compile_id, methodHandle method, int osr_bci, int comp_level,
-                  methodHandle hot_method, int hot_count, const char* comment,
+  void initialize(int compile_id, const methodHandle& method, int osr_bci, int comp_level,
+                  const methodHandle& hot_method, int hot_count, const char* comment,
                   bool is_blocking);
 
   static CompileTask* allocate();
--- a/hotspot/src/share/vm/compiler/compilerOracle.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/compiler/compilerOracle.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -313,7 +313,7 @@
 }
 
 template<typename T>
-bool CompilerOracle::has_option_value(methodHandle method, const char* option, T& value) {
+bool CompilerOracle::has_option_value(const methodHandle& method, const char* option, T& value) {
   if (option_list != NULL) {
     TypedMethodOptionMatcher* m = option_list->match(method, option, get_type_for<T>());
     if (m != NULL) {
@@ -325,19 +325,19 @@
 }
 
 // Explicit instantiation for all OptionTypes supported.
-template bool CompilerOracle::has_option_value<intx>(methodHandle method, const char* option, intx& value);
-template bool CompilerOracle::has_option_value<uintx>(methodHandle method, const char* option, uintx& value);
-template bool CompilerOracle::has_option_value<bool>(methodHandle method, const char* option, bool& value);
-template bool CompilerOracle::has_option_value<ccstr>(methodHandle method, const char* option, ccstr& value);
-template bool CompilerOracle::has_option_value<double>(methodHandle method, const char* option, double& value);
+template bool CompilerOracle::has_option_value<intx>(const methodHandle& method, const char* option, intx& value);
+template bool CompilerOracle::has_option_value<uintx>(const methodHandle& method, const char* option, uintx& value);
+template bool CompilerOracle::has_option_value<bool>(const methodHandle& method, const char* option, bool& value);
+template bool CompilerOracle::has_option_value<ccstr>(const methodHandle& method, const char* option, ccstr& value);
+template bool CompilerOracle::has_option_value<double>(const methodHandle& method, const char* option, double& value);
 
-bool CompilerOracle::has_option_string(methodHandle method, const char* option) {
+bool CompilerOracle::has_option_string(const methodHandle& method, const char* option) {
   bool value = false;
   has_option_value(method, option, value);
   return value;
 }
 
-bool CompilerOracle::should_exclude(methodHandle method, bool& quietly) {
+bool CompilerOracle::should_exclude(const methodHandle& method, bool& quietly) {
   quietly = true;
   if (lists[ExcludeCommand] != NULL) {
     if (lists[ExcludeCommand]->match(method)) {
@@ -352,17 +352,17 @@
   return false;
 }
 
-bool CompilerOracle::should_inline(methodHandle method) {
+bool CompilerOracle::should_inline(const methodHandle& method) {
   return (check_predicate(InlineCommand, method));
 }
 
 // Check both DontInlineCommand and ExcludeCommand here
 // - consistent behavior for all compilers
-bool CompilerOracle::should_not_inline(methodHandle method) {
+bool CompilerOracle::should_not_inline(const methodHandle& method) {
   return check_predicate(DontInlineCommand, method) || check_predicate(ExcludeCommand, method);
 }
 
-bool CompilerOracle::should_print(methodHandle method) {
+bool CompilerOracle::should_print(const methodHandle& method) {
   return check_predicate(PrintCommand, method);
 }
 
@@ -370,13 +370,13 @@
   return lists[PrintCommand] != NULL;
 }
 
-bool CompilerOracle::should_log(methodHandle method) {
+bool CompilerOracle::should_log(const methodHandle& method) {
   if (!LogCompilation)            return false;
   if (lists[LogCommand] == NULL)  return true;  // by default, log all
   return (check_predicate(LogCommand, method));
 }
 
-bool CompilerOracle::should_break_at(methodHandle method) {
+bool CompilerOracle::should_break_at(const methodHandle& method) {
   return check_predicate(BreakCommand, method);
 }
 
@@ -756,7 +756,7 @@
   stream.cr();
 }
 
-void CompilerOracle::append_exclude_to_file(methodHandle method) {
+void CompilerOracle::append_exclude_to_file(const methodHandle& method) {
   assert(has_command_file(), "command file must be specified");
   fileStream stream(fopen(cc_file(), "at"));
   stream.print("exclude ");
--- a/hotspot/src/share/vm/compiler/compilerOracle.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/compiler/compilerOracle.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,30 +46,30 @@
   static void parse_from_file();
 
   // Tells whether we to exclude compilation of method
-  static bool should_exclude(methodHandle method, bool& quietly);
+  static bool should_exclude(const methodHandle& method, bool& quietly);
 
   // Tells whether we want to inline this method
-  static bool should_inline(methodHandle method);
+  static bool should_inline(const methodHandle& method);
 
   // Tells whether we want to disallow inlining of this method
-  static bool should_not_inline(methodHandle method);
+  static bool should_not_inline(const methodHandle& method);
 
   // Tells whether we should print the assembly for this method
-  static bool should_print(methodHandle method);
+  static bool should_print(const methodHandle& method);
 
   // Tells whether we should log the compilation data for this method
-  static bool should_log(methodHandle method);
+  static bool should_log(const methodHandle& method);
 
   // Tells whether to break when compiling method
-  static bool should_break_at(methodHandle method);
+  static bool should_break_at(const methodHandle& method);
 
   // Check to see if this method has option set for it
-  static bool has_option_string(methodHandle method, const char * option);
+  static bool has_option_string(const methodHandle& method, const char * option);
 
   // Check if method has option and value set. If yes, overwrite value and return true,
   // otherwise leave value unchanged and return false.
   template<typename T>
-  static bool has_option_value(methodHandle method, const char* option, T& value);
+  static bool has_option_value(const methodHandle& method, const char* option, T& value);
 
   // Reads from string instead of file
   static void parse_from_string(const char* command_string, void (*parser)(char*));
@@ -79,7 +79,7 @@
 
   // For updating the oracle file
   static void append_comment_to_file(const char* message);
-  static void append_exclude_to_file(methodHandle method);
+  static void append_exclude_to_file(const methodHandle& method);
 
   // Tells whether there are any methods to print for print_method_statistics()
   static bool should_print_methods();
--- a/hotspot/src/share/vm/compiler/methodMatcher.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/compiler/methodMatcher.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -306,7 +306,7 @@
   }
 }
 
-bool MethodMatcher::matches(methodHandle method) const {
+bool MethodMatcher::matches(const methodHandle& method) const {
   Symbol* class_name  = method->method_holder()->name();
   Symbol* method_name = method->name();
   Symbol* signature = method->signature();
--- a/hotspot/src/share/vm/compiler/methodMatcher.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/compiler/methodMatcher.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -60,7 +60,7 @@
   void init(Symbol* class_name, Mode class_mode, Symbol* method_name, Mode method_mode, Symbol* signature);
   static void parse_method_pattern(char*& line, const char*& error_msg, MethodMatcher* m);
   static void print_symbol(outputStream* st, Symbol* h, Mode mode);
-  bool matches(methodHandle method) const;
+  bool matches(const methodHandle& method) const;
   void print_base(outputStream* st);
 
  private:
@@ -101,7 +101,7 @@
     return bm;
   }
 
-  bool match(methodHandle method) {
+  bool match(const methodHandle& method) {
     for (BasicMatcher* current = this; current != NULL; current = current->next()) {
       if (current->matches(method)) {
         return true;
--- a/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/abstractInterpreter.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -194,7 +194,7 @@
                                      bool is_bottom_frame);
 
   // Runtime support
-  static bool       is_not_reached(                       methodHandle method, int bci);
+  static bool       is_not_reached(const methodHandle& method, int bci);
   // Safepoint support
   static void       notice_safepoints()                         { ShouldNotReachHere(); } // stops the thread when reaching a safepoint
   static void       ignore_safepoints()                         { ShouldNotReachHere(); } // ignores safepoints
--- a/hotspot/src/share/vm/interpreter/bytecode.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/bytecode.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -179,7 +179,7 @@
  protected:
   const methodHandle _method;                          // method containing the bytecode
 
-  Bytecode_member_ref(methodHandle method, int bci)  : Bytecode(method(), method()->bcp_from(bci)), _method(method) {}
+  Bytecode_member_ref(const methodHandle& method, int bci)  : Bytecode(method(), method()->bcp_from(bci)), _method(method) {}
 
   methodHandle method() const                    { return _method; }
   ConstantPool* constants() const              { return _method->constants(); }
@@ -201,10 +201,10 @@
 class Bytecode_invoke: public Bytecode_member_ref {
  protected:
   // Constructor that skips verification
-  Bytecode_invoke(methodHandle method, int bci, bool unused)  : Bytecode_member_ref(method, bci) {}
+  Bytecode_invoke(const methodHandle& method, int bci, bool unused)  : Bytecode_member_ref(method, bci) {}
 
  public:
-  Bytecode_invoke(methodHandle method, int bci)  : Bytecode_member_ref(method, bci) { verify(); }
+  Bytecode_invoke(const methodHandle& method, int bci)  : Bytecode_member_ref(method, bci) { verify(); }
   void verify() const;
 
   // Attributes
@@ -232,10 +232,10 @@
 
  private:
   // Helper to skip verification.   Used is_valid() to check if the result is really an invoke
-  inline friend Bytecode_invoke Bytecode_invoke_check(methodHandle method, int bci);
+  inline friend Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci);
 };
 
-inline Bytecode_invoke Bytecode_invoke_check(methodHandle method, int bci) {
+inline Bytecode_invoke Bytecode_invoke_check(const methodHandle& method, int bci) {
   return Bytecode_invoke(method, bci, false);
 }
 
@@ -243,7 +243,7 @@
 // Abstraction for all field accesses (put/get field/static)
 class Bytecode_field: public Bytecode_member_ref {
  public:
-  Bytecode_field(methodHandle method, int bci)  : Bytecode_member_ref(method, bci) { verify(); }
+  Bytecode_field(const methodHandle& method, int bci)  : Bytecode_member_ref(method, bci) { verify(); }
 
   // Testers
   bool is_getfield() const                       { return java_code() == Bytecodes::_getfield; }
@@ -316,7 +316,7 @@
   int raw_index() const;
 
  public:
-  Bytecode_loadconstant(methodHandle method, int bci): Bytecode(method(), method->bcp_from(bci)), _method(method) { verify(); }
+  Bytecode_loadconstant(const methodHandle& method, int bci): Bytecode(method(), method->bcp_from(bci)), _method(method) { verify(); }
 
   void verify() const {
     assert(_method.not_null(), "must supply method");
--- a/hotspot/src/share/vm/interpreter/bytecodeStream.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/bytecodeStream.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,7 +63,7 @@
   bool            _is_raw;                       // false in 'cooked' BytecodeStream
 
   // Construction
-  BaseBytecodeStream(methodHandle method) : _method(method) {
+  BaseBytecodeStream(const methodHandle& method) : _method(method) {
     set_interval(0, _method->code_size());
     _is_raw = false;
   }
@@ -118,7 +118,7 @@
 class RawBytecodeStream: public BaseBytecodeStream {
  public:
   // Construction
-  RawBytecodeStream(methodHandle method) : BaseBytecodeStream(method) {
+  RawBytecodeStream(const methodHandle& method) : BaseBytecodeStream(method) {
     _is_raw = true;
   }
 
@@ -169,7 +169,7 @@
 
  public:
   // Construction
-  BytecodeStream(methodHandle method) : BaseBytecodeStream(method) { }
+  BytecodeStream(const methodHandle& method) : BaseBytecodeStream(method) { }
 
   // Iteration
   Bytecodes::Code next() {
--- a/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/bytecodeTracer.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -84,7 +84,7 @@
 
   // This method is called while executing the raw bytecodes, so none of
   // the adjustments that BytecodeStream performs applies.
-  void trace(methodHandle method, address bcp, uintptr_t tos, uintptr_t tos2, outputStream* st) {
+  void trace(const methodHandle& method, address bcp, uintptr_t tos, uintptr_t tos2, outputStream* st) {
     ResourceMark rm;
     if (_current_method != method()) {
       // Note 1: This code will not work as expected with true MT/MP.
@@ -126,7 +126,7 @@
 
   // Used for Method*::print_codes().  The input bcp comes from
   // BytecodeStream, which will skip wide bytecodes.
-  void trace(methodHandle method, address bcp, outputStream* st) {
+  void trace(const methodHandle& method, address bcp, outputStream* st) {
     _current_method = method();
     ResourceMark rm;
     Bytecodes::Code code = Bytecodes::code_at(method(), bcp);
@@ -166,7 +166,7 @@
 }
 
 
-void BytecodeTracer::trace(methodHandle method, address bcp, uintptr_t tos, uintptr_t tos2, outputStream* st) {
+void BytecodeTracer::trace(const methodHandle& method, address bcp, uintptr_t tos, uintptr_t tos2, outputStream* st) {
   if (TraceBytecodes && BytecodeCounter::counter_value() >= TraceBytecodesAt) {
     ttyLocker ttyl;  // 5065316: keep the following output coherent
     // The ttyLocker also prevents races between two threads
@@ -185,7 +185,7 @@
   }
 }
 
-void BytecodeTracer::trace(methodHandle method, address bcp, outputStream* st) {
+void BytecodeTracer::trace(const methodHandle& method, address bcp, outputStream* st) {
   ttyLocker ttyl;  // 5065316: keep the following output coherent
   _closure->trace(method, bcp, st);
 }
--- a/hotspot/src/share/vm/interpreter/bytecodeTracer.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/bytecodeTracer.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,8 +46,8 @@
   static BytecodeClosure* closure()                                                   { return _closure; }
   static void             set_closure(BytecodeClosure* closure) { _closure = closure; }
 
-  static void             trace(methodHandle method, address bcp, uintptr_t tos, uintptr_t tos2, outputStream* st = tty);
-  static void             trace(methodHandle method, address bcp, outputStream* st = tty);
+  static void             trace(const methodHandle& method, address bcp, uintptr_t tos, uintptr_t tos2, outputStream* st = tty);
+  static void             trace(const methodHandle& method, address bcp, outputStream* st = tty);
 };
 
 
@@ -55,8 +55,8 @@
 
 class BytecodeClosure {
  public:
-  virtual void trace(methodHandle method, address bcp, uintptr_t tos, uintptr_t tos2, outputStream* st) = 0;
-  virtual void trace(methodHandle method, address bcp, outputStream* st) = 0;
+  virtual void trace(const methodHandle& method, address bcp, uintptr_t tos, uintptr_t tos2, outputStream* st) = 0;
+  virtual void trace(const methodHandle& method, address bcp, outputStream* st) = 0;
 };
 
 #endif // SHARE_VM_INTERPRETER_BYTECODETRACER_HPP
--- a/hotspot/src/share/vm/interpreter/interpreter.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/interpreter.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -320,7 +320,7 @@
 
 // Return true if the interpreter can prove that the given bytecode has
 // not yet been executed (in Java semantics, not in actual operation).
-bool AbstractInterpreter::is_not_reached(methodHandle method, int bci) {
+bool AbstractInterpreter::is_not_reached(const methodHandle& method, int bci) {
   Bytecodes::Code code = method()->code_at(bci);
 
   if (!Bytecodes::must_rewrite(code)) {
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1192,7 +1192,7 @@
   return handler;
 }
 
-void SignatureHandlerLibrary::add(methodHandle method) {
+void SignatureHandlerLibrary::add(const methodHandle& method) {
   if (method->signature_handler() == NULL) {
     // use slow signature handler if we can't do better
     int handler_index = -1;
--- a/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/interpreterRuntime.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -218,7 +218,7 @@
   static void pd_set_handler(address handler);
 
  public:
-  static void add(methodHandle method);
+  static void add(const methodHandle& method);
   static void add(uint64_t fingerprint, address handler);
 };
 
--- a/hotspot/src/share/vm/interpreter/linkResolver.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/linkResolver.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -237,7 +237,7 @@
 //------------------------------------------------------------------------------------------------------------------------
 // Implementation of LinkInfo
 
-LinkInfo::LinkInfo(constantPoolHandle pool, int index, TRAPS) {
+LinkInfo::LinkInfo(const constantPoolHandle& pool, int index, TRAPS) {
    // resolve klass
   Klass* result = pool->klass_ref_at(index, CHECK);
   _resolved_klass = KlassHandle(THREAD, result);
@@ -559,7 +559,7 @@
 }
 
 methodHandle LinkResolver::resolve_method_statically(Bytecodes::Code code,
-                                                     constantPoolHandle pool, int index, TRAPS) {
+                                                     const constantPoolHandle& pool, int index, TRAPS) {
   // This method is used only
   // (1) in C2 from InlineTree::ok_to_inline (via ciMethod::check_call),
   // and
@@ -816,7 +816,7 @@
   }
 }
 
-void LinkResolver::resolve_field_access(fieldDescriptor& fd, constantPoolHandle pool, int index, Bytecodes::Code byte, TRAPS) {
+void LinkResolver::resolve_field_access(fieldDescriptor& fd, const constantPoolHandle& pool, int index, Bytecodes::Code byte, TRAPS) {
   LinkInfo link_info(pool, index, CHECK);
   resolve_field(fd, link_info, byte, true, CHECK);
 }
@@ -1442,7 +1442,7 @@
 //------------------------------------------------------------------------------------------------------------------------
 // ConstantPool entries
 
-void LinkResolver::resolve_invoke(CallInfo& result, Handle recv, constantPoolHandle pool, int index, Bytecodes::Code byte, TRAPS) {
+void LinkResolver::resolve_invoke(CallInfo& result, Handle recv, const constantPoolHandle& pool, int index, Bytecodes::Code byte, TRAPS) {
   switch (byte) {
     case Bytecodes::_invokestatic   : resolve_invokestatic   (result,       pool, index, CHECK); break;
     case Bytecodes::_invokespecial  : resolve_invokespecial  (result,       pool, index, CHECK); break;
@@ -1454,20 +1454,20 @@
   return;
 }
 
-void LinkResolver::resolve_invokestatic(CallInfo& result, constantPoolHandle pool, int index, TRAPS) {
+void LinkResolver::resolve_invokestatic(CallInfo& result, const constantPoolHandle& pool, int index, TRAPS) {
   LinkInfo link_info(pool, index, CHECK);
   resolve_static_call(result, link_info, /*initialize_class*/true, CHECK);
 }
 
 
-void LinkResolver::resolve_invokespecial(CallInfo& result, constantPoolHandle pool, int index, TRAPS) {
+void LinkResolver::resolve_invokespecial(CallInfo& result, const constantPoolHandle& pool, int index, TRAPS) {
   LinkInfo link_info(pool, index, CHECK);
   resolve_special_call(result, link_info, CHECK);
 }
 
 
 void LinkResolver::resolve_invokevirtual(CallInfo& result, Handle recv,
-                                          constantPoolHandle pool, int index,
+                                          const constantPoolHandle& pool, int index,
                                           TRAPS) {
 
   LinkInfo link_info(pool, index, CHECK);
@@ -1476,14 +1476,14 @@
 }
 
 
-void LinkResolver::resolve_invokeinterface(CallInfo& result, Handle recv, constantPoolHandle pool, int index, TRAPS) {
+void LinkResolver::resolve_invokeinterface(CallInfo& result, Handle recv, const constantPoolHandle& pool, int index, TRAPS) {
   LinkInfo link_info(pool, index, CHECK);
   KlassHandle recvrKlass (THREAD, recv.is_null() ? (Klass*)NULL : recv->klass());
   resolve_interface_call(result, recv, recvrKlass, link_info, true, CHECK);
 }
 
 
-void LinkResolver::resolve_invokehandle(CallInfo& result, constantPoolHandle pool, int index, TRAPS) {
+void LinkResolver::resolve_invokehandle(CallInfo& result, const constantPoolHandle& pool, int index, TRAPS) {
   // This guy is reached from InterpreterRuntime::resolve_invokehandle.
   LinkInfo link_info(pool, index, CHECK);
   if (TraceMethodHandles) {
@@ -1528,7 +1528,7 @@
   }
 }
 
-void LinkResolver::resolve_invokedynamic(CallInfo& result, constantPoolHandle pool, int index, TRAPS) {
+void LinkResolver::resolve_invokedynamic(CallInfo& result, const constantPoolHandle& pool, int index, TRAPS) {
   Symbol* method_name       = pool->name_ref_at(index);
   Symbol* method_signature  = pool->signature_ref_at(index);
   KlassHandle current_klass = KlassHandle(THREAD, pool->pool_holder());
--- a/hotspot/src/share/vm/interpreter/linkResolver.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/linkResolver.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -136,7 +136,7 @@
   KlassHandle _current_klass;   // class that owns the constant pool
   bool        _check_access;
  public:
-  LinkInfo(constantPoolHandle pool, int index, TRAPS);
+  LinkInfo(const constantPoolHandle& pool, int index, TRAPS);
   // Condensed information from other call sites within the vm.
   LinkInfo(KlassHandle resolved_klass, Symbol* name, Symbol* signature,
            KlassHandle current_klass, bool check_access = true) :
@@ -226,17 +226,17 @@
 
   // runtime resolving from constant pool
   static void resolve_invokestatic   (CallInfo& result,
-                                      constantPoolHandle pool, int index, TRAPS);
+                                      const constantPoolHandle& pool, int index, TRAPS);
   static void resolve_invokespecial  (CallInfo& result,
-                                      constantPoolHandle pool, int index, TRAPS);
+                                      const constantPoolHandle& pool, int index, TRAPS);
   static void resolve_invokevirtual  (CallInfo& result, Handle recv,
-                                      constantPoolHandle pool, int index, TRAPS);
+                                      const constantPoolHandle& pool, int index, TRAPS);
   static void resolve_invokeinterface(CallInfo& result, Handle recv,
-                                      constantPoolHandle pool, int index, TRAPS);
+                                      const constantPoolHandle& pool, int index, TRAPS);
   static void resolve_invokedynamic  (CallInfo& result,
-                                      constantPoolHandle pool, int index, TRAPS);
+                                      const constantPoolHandle& pool, int index, TRAPS);
   static void resolve_invokehandle   (CallInfo& result,
-                                      constantPoolHandle pool, int index, TRAPS);
+                                      const constantPoolHandle& pool, int index, TRAPS);
  public:
   // constant pool resolving
   static void check_klass_accessability(KlassHandle ref_klass, KlassHandle sel_klass, TRAPS);
@@ -244,11 +244,11 @@
   // static resolving calls (will not run any Java code);
   // used only from Bytecode_invoke::static_target
   static methodHandle resolve_method_statically(Bytecodes::Code code,
-                                                constantPoolHandle pool,
+                                                const constantPoolHandle& pool,
                                                 int index, TRAPS);
 
   static void resolve_field_access(fieldDescriptor& result,
-                                   constantPoolHandle pool,
+                                   const constantPoolHandle& pool,
                                    int index, Bytecodes::Code byte, TRAPS);
   static void resolve_field(fieldDescriptor& result, const LinkInfo& link_info,
                             Bytecodes::Code access_kind,
@@ -293,7 +293,7 @@
 
   // runtime resolving from constant pool
   static void resolve_invoke(CallInfo& result, Handle recv,
-                             constantPoolHandle pool, int index,
+                             const constantPoolHandle& pool, int index,
                              Bytecodes::Code byte, TRAPS);
  private:
   static void trace_method_resolution(const char* prefix, KlassHandle klass,
--- a/hotspot/src/share/vm/interpreter/oopMapCache.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -426,7 +426,7 @@
   }
 }
 
-inline unsigned int OopMapCache::hash_value_for(methodHandle method, int bci) const {
+inline unsigned int OopMapCache::hash_value_for(const methodHandle& method, int bci) const {
   // We use method->code_size() rather than method->identity_hash() below since
   // the mark may not be present if a pointer to the method is already reversed.
   return   ((unsigned int) bci)
@@ -477,7 +477,7 @@
     }
 }
 
-void OopMapCache::lookup(methodHandle method,
+void OopMapCache::lookup(const methodHandle& method,
                          int bci,
                          InterpreterOopMap* entry_for) const {
   MutexLocker x(&_mut);
@@ -558,7 +558,7 @@
   return;
 }
 
-void OopMapCache::compute_one_oop_map(methodHandle method, int bci, InterpreterOopMap* entry) {
+void OopMapCache::compute_one_oop_map(const methodHandle& method, int bci, InterpreterOopMap* entry) {
   // Due to the invariants above it's tricky to allocate a temporary OopMapCacheEntry on the stack
   OopMapCacheEntry* tmp = NEW_C_HEAP_ARRAY(OopMapCacheEntry, 1, mtClass);
   tmp->initialize();
--- a/hotspot/src/share/vm/interpreter/oopMapCache.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/oopMapCache.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -116,7 +116,7 @@
   void set_expression_stack_size(int sz)         { _expression_stack_size = sz; }
 
   // Lookup
-  bool match(methodHandle method, int bci) const { return _method == method() && _bci == bci; }
+  bool match(const methodHandle& method, int bci) const { return _method == method() && _bci == bci; }
   bool is_empty() const;
 
   // Initialization
@@ -151,7 +151,7 @@
 
   OopMapCacheEntry* _array;
 
-  unsigned int hash_value_for(methodHandle method, int bci) const;
+  unsigned int hash_value_for(const methodHandle& method, int bci) const;
   OopMapCacheEntry* entry_at(int i) const;
 
   mutable Mutex _mut;
@@ -167,10 +167,10 @@
 
   // Returns the oopMap for (method, bci) in parameter "entry".
   // Returns false if an oop map was not found.
-  void lookup(methodHandle method, int bci, InterpreterOopMap* entry) const;
+  void lookup(const methodHandle& method, int bci, InterpreterOopMap* entry) const;
 
   // Compute an oop map without updating the cache or grabbing any locks (for debugging)
-  static void compute_one_oop_map(methodHandle method, int bci, InterpreterOopMap* entry);
+  static void compute_one_oop_map(const methodHandle& method, int bci, InterpreterOopMap* entry);
 
   // Returns total no. of bytes allocated as part of OopMapCache's
   static long memory_usage()                     PRODUCT_RETURN0;
--- a/hotspot/src/share/vm/interpreter/rewriter.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/rewriter.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -509,7 +509,7 @@
   // (That's all, folks.)
 }
 
-Rewriter::Rewriter(instanceKlassHandle klass, constantPoolHandle cpool, Array<Method*>* methods, TRAPS)
+Rewriter::Rewriter(instanceKlassHandle klass, const constantPoolHandle& cpool, Array<Method*>* methods, TRAPS)
   : _klass(klass),
     _pool(cpool),
     _methods(methods)
--- a/hotspot/src/share/vm/interpreter/rewriter.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/interpreter/rewriter.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -185,7 +185,7 @@
   }
 
   // All the work goes in here:
-  Rewriter(instanceKlassHandle klass, constantPoolHandle cpool, Array<Method*>* methods, TRAPS);
+  Rewriter(instanceKlassHandle klass, const constantPoolHandle& cpool, Array<Method*>* methods, TRAPS);
 
   void compute_index_maps();
   void make_constant_pool_cache(TRAPS);
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -60,7 +60,7 @@
 
 #define C2V_END }
 
-oop CompilerToVM::get_jvmci_method(methodHandle method, TRAPS) {
+oop CompilerToVM::get_jvmci_method(const methodHandle& method, TRAPS) {
   if (method() != NULL) {
     JavaValue result(T_OBJECT);
     JavaCallArguments args;
--- a/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/jvmci/jvmciCompilerToVM.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -94,7 +94,7 @@
     return (MethodData*) (address) metaspaceMethodData;
   }
 
-  static oop get_jvmci_method(methodHandle method, TRAPS);
+  static oop get_jvmci_method(const methodHandle& method, TRAPS);
 
   static oop get_jvmci_type(KlassHandle klass, TRAPS);
 };
--- a/hotspot/src/share/vm/jvmci/jvmciEnv.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/jvmci/jvmciEnv.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,7 @@
 
 // ------------------------------------------------------------------
 KlassHandle JVMCIEnv::get_klass_by_name_impl(KlassHandle& accessing_klass,
-                                          constantPoolHandle& cpool,
+                                          const constantPoolHandle& cpool,
                                           Symbol* sym,
                                           bool require_local) {
   JVMCI_EXCEPTION_CONTEXT;
@@ -174,7 +174,7 @@
 
 // ------------------------------------------------------------------
 // Implementation of get_klass_by_index.
-KlassHandle JVMCIEnv::get_klass_by_index_impl(constantPoolHandle& cpool,
+KlassHandle JVMCIEnv::get_klass_by_index_impl(const constantPoolHandle& cpool,
                                         int index,
                                         bool& is_accessible,
                                         KlassHandle& accessor) {
@@ -215,7 +215,7 @@
 
 // ------------------------------------------------------------------
 // Get a klass from the constant pool.
-KlassHandle JVMCIEnv::get_klass_by_index(constantPoolHandle& cpool,
+KlassHandle JVMCIEnv::get_klass_by_index(const constantPoolHandle& cpool,
                                    int index,
                                    bool& is_accessible,
                                    KlassHandle& accessor) {
@@ -312,7 +312,7 @@
 
 
 // ------------------------------------------------------------------
-methodHandle JVMCIEnv::get_method_by_index_impl(constantPoolHandle& cpool,
+methodHandle JVMCIEnv::get_method_by_index_impl(const constantPoolHandle& cpool,
                                           int index, Bytecodes::Code bc,
                                           instanceKlassHandle& accessor) {
   if (bc == Bytecodes::_invokedynamic) {
@@ -395,7 +395,7 @@
 
 
 // ------------------------------------------------------------------
-methodHandle JVMCIEnv::get_method_by_index(constantPoolHandle& cpool,
+methodHandle JVMCIEnv::get_method_by_index(const constantPoolHandle& cpool,
                                      int index, Bytecodes::Code bc,
                                      instanceKlassHandle& accessor) {
   ResourceMark rm;
--- a/hotspot/src/share/vm/jvmci/jvmciEnv.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/jvmci/jvmciEnv.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,13 +83,13 @@
                              bool require_local);
 
   // Constant pool access.
-  static KlassHandle   get_klass_by_index(constantPoolHandle& cpool,
+  static KlassHandle   get_klass_by_index(const constantPoolHandle& cpool,
                                 int klass_index,
                                 bool& is_accessible,
                                 KlassHandle& loading_klass);
   static void   get_field_by_index(instanceKlassHandle& loading_klass, fieldDescriptor& fd,
                                 int field_index);
-  static methodHandle  get_method_by_index(constantPoolHandle& cpool,
+  static methodHandle  get_method_by_index(const constantPoolHandle& cpool,
                                  int method_index, Bytecodes::Code bc,
                                  instanceKlassHandle& loading_klass);
 
@@ -106,16 +106,16 @@
 
   // Implementation methods for loading and constant pool access.
   static KlassHandle get_klass_by_name_impl(KlassHandle& accessing_klass,
-                                  constantPoolHandle& cpool,
+                                  const constantPoolHandle& cpool,
                                   Symbol* klass_name,
                                   bool require_local);
-  static KlassHandle   get_klass_by_index_impl(constantPoolHandle& cpool,
+  static KlassHandle   get_klass_by_index_impl(const constantPoolHandle& cpool,
                                      int klass_index,
                                      bool& is_accessible,
                                      KlassHandle& loading_klass);
   static void   get_field_by_index_impl(instanceKlassHandle& loading_klass, fieldDescriptor& fd,
                                      int field_index);
-  static methodHandle  get_method_by_index_impl(constantPoolHandle& cpool,
+  static methodHandle  get_method_by_index_impl(const constantPoolHandle& cpool,
                                       int method_index, Bytecodes::Code bc,
                                       instanceKlassHandle& loading_klass);
 
--- a/hotspot/src/share/vm/oops/constantPool.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/constantPool.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -178,7 +178,7 @@
   return (i < 0) ? _no_index_sentinel : i;
 }
 
-void ConstantPool::trace_class_resolution(constantPoolHandle this_cp, KlassHandle k) {
+void ConstantPool::trace_class_resolution(const constantPoolHandle& this_cp, KlassHandle k) {
   ResourceMark rm;
   int line_number = -1;
   const char * source_file = NULL;
@@ -207,7 +207,7 @@
   }
 }
 
-Klass* ConstantPool::klass_at_impl(constantPoolHandle this_cp, int which,
+Klass* ConstantPool::klass_at_impl(const constantPoolHandle& this_cp, int which,
                                    bool save_resolution_error, TRAPS) {
   assert(THREAD->is_Java_thread(), "must be a Java thread");
 
@@ -288,7 +288,7 @@
 // by compiler and exception handling.  Also used to avoid classloads for
 // instanceof operations. Returns NULL if the class has not been loaded or
 // if the verification of constant pool failed
-Klass* ConstantPool::klass_at_if_loaded(constantPoolHandle this_cp, int which) {
+Klass* ConstantPool::klass_at_if_loaded(const constantPoolHandle& this_cp, int which) {
   CPSlot entry = this_cp->slot_at(which);
   if (entry.is_resolved()) {
     assert(entry.get_klass()->is_klass(), "must be");
@@ -321,12 +321,12 @@
 }
 
 
-Klass* ConstantPool::klass_ref_at_if_loaded(constantPoolHandle this_cp, int which) {
+Klass* ConstantPool::klass_ref_at_if_loaded(const constantPoolHandle& this_cp, int which) {
   return klass_at_if_loaded(this_cp, this_cp->klass_ref_index_at(which));
 }
 
 
-Method* ConstantPool::method_at_if_loaded(constantPoolHandle cpool,
+Method* ConstantPool::method_at_if_loaded(const constantPoolHandle& cpool,
                                                    int which) {
   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
   int cache_index = decode_cpcache_index(which, true);
@@ -342,14 +342,14 @@
 }
 
 
-bool ConstantPool::has_appendix_at_if_loaded(constantPoolHandle cpool, int which) {
+bool ConstantPool::has_appendix_at_if_loaded(const constantPoolHandle& cpool, int which) {
   if (cpool->cache() == NULL)  return false;  // nothing to load yet
   int cache_index = decode_cpcache_index(which, true);
   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   return e->has_appendix();
 }
 
-oop ConstantPool::appendix_at_if_loaded(constantPoolHandle cpool, int which) {
+oop ConstantPool::appendix_at_if_loaded(const constantPoolHandle& cpool, int which) {
   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
   int cache_index = decode_cpcache_index(which, true);
   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
@@ -357,14 +357,14 @@
 }
 
 
-bool ConstantPool::has_method_type_at_if_loaded(constantPoolHandle cpool, int which) {
+bool ConstantPool::has_method_type_at_if_loaded(const constantPoolHandle& cpool, int which) {
   if (cpool->cache() == NULL)  return false;  // nothing to load yet
   int cache_index = decode_cpcache_index(which, true);
   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
   return e->has_method_type();
 }
 
-oop ConstantPool::method_type_at_if_loaded(constantPoolHandle cpool, int which) {
+oop ConstantPool::method_type_at_if_loaded(const constantPoolHandle& cpool, int which) {
   if (cpool->cache() == NULL)  return NULL;  // nothing to load yet
   int cache_index = decode_cpcache_index(which, true);
   ConstantPoolCacheEntry* e = cpool->cache()->entry_at(cache_index);
@@ -434,7 +434,7 @@
 }
 
 
-void ConstantPool::verify_constant_pool_resolve(constantPoolHandle this_cp, KlassHandle k, TRAPS) {
+void ConstantPool::verify_constant_pool_resolve(const constantPoolHandle& this_cp, KlassHandle k, TRAPS) {
  if (k->oop_is_instance() || k->oop_is_objArray()) {
     instanceKlassHandle holder (THREAD, this_cp->pool_holder());
     Klass* elem = k->oop_is_instance() ? k() : ObjArrayKlass::cast(k())->bottom_klass();
@@ -502,7 +502,7 @@
 }
 
 
-void ConstantPool::resolve_string_constants_impl(constantPoolHandle this_cp, TRAPS) {
+void ConstantPool::resolve_string_constants_impl(const constantPoolHandle& this_cp, TRAPS) {
   for (int index = 1; index < this_cp->length(); index++) { // Index 0 is unused
     if (this_cp->tag_at(index).is_string()) {
       this_cp->string_at(index, CHECK);
@@ -526,7 +526,7 @@
   return true;
 }
 
-Symbol* ConstantPool::exception_message(constantPoolHandle this_cp, int which, constantTag tag, oop pending_exception) {
+Symbol* ConstantPool::exception_message(const constantPoolHandle& this_cp, int which, constantTag tag, oop pending_exception) {
   // Dig out the detailed message to reuse if possible
   Symbol* message = java_lang_Throwable::detail_message(pending_exception);
   if (message != NULL) {
@@ -554,7 +554,7 @@
   return message;
 }
 
-void ConstantPool::throw_resolution_error(constantPoolHandle this_cp, int which, TRAPS) {
+void ConstantPool::throw_resolution_error(const constantPoolHandle& this_cp, int which, TRAPS) {
   Symbol* message = NULL;
   Symbol* error = SystemDictionary::find_resolution_error(this_cp, which, &message);
   assert(error != NULL && message != NULL, "checking");
@@ -565,7 +565,7 @@
 
 // If resolution for Class, MethodHandle or MethodType fails, save the exception
 // in the resolution error table, so that the same exception is thrown again.
-void ConstantPool::save_and_throw_exception(constantPoolHandle this_cp, int which,
+void ConstantPool::save_and_throw_exception(const constantPoolHandle& this_cp, int which,
                                             constantTag tag, TRAPS) {
   Symbol* error = PENDING_EXCEPTION->klass()->name();
 
@@ -603,7 +603,7 @@
 // Called to resolve constants in the constant pool and return an oop.
 // Some constant pool entries cache their resolved oop. This is also
 // called to create oops from constants to use in arguments for invokedynamic
-oop ConstantPool::resolve_constant_at_impl(constantPoolHandle this_cp, int index, int cache_index, TRAPS) {
+oop ConstantPool::resolve_constant_at_impl(const constantPoolHandle& this_cp, int index, int cache_index, TRAPS) {
   oop result_oop = NULL;
   Handle throw_exception;
 
@@ -756,7 +756,7 @@
 }
 
 
-oop ConstantPool::resolve_bootstrap_specifier_at_impl(constantPoolHandle this_cp, int index, TRAPS) {
+oop ConstantPool::resolve_bootstrap_specifier_at_impl(const constantPoolHandle& this_cp, int index, TRAPS) {
   assert(this_cp->tag_at(index).is_invoke_dynamic(), "Corrupted constant pool");
 
   Handle bsm;
@@ -794,7 +794,7 @@
   return info();
 }
 
-oop ConstantPool::string_at_impl(constantPoolHandle this_cp, int which, int obj_index, TRAPS) {
+oop ConstantPool::string_at_impl(const constantPoolHandle& this_cp, int which, int obj_index, TRAPS) {
   // If the string has already been interned, this entry will be non-null
   oop str = this_cp->resolved_references()->obj_at(obj_index);
   if (str != NULL) return str;
@@ -830,7 +830,7 @@
 
 // Compare this constant pool's entry at index1 to the constant pool
 // cp2's entry at index2.
-bool ConstantPool::compare_entry_to(int index1, constantPoolHandle cp2,
+bool ConstantPool::compare_entry_to(int index1, const constantPoolHandle& cp2,
        int index2, TRAPS) {
 
   // The error tags are equivalent to non-error tags when comparing
@@ -1056,7 +1056,7 @@
 
 // Extend the operands array with the length and size of the ext_cp operands.
 // Used in RedefineClasses for CP merge.
-void ConstantPool::extend_operands(constantPoolHandle ext_cp, TRAPS) {
+void ConstantPool::extend_operands(const constantPoolHandle& ext_cp, TRAPS) {
   int delta_len = operand_array_length(ext_cp->operands());
   if (delta_len == 0) {
     return; // nothing to do
@@ -1096,8 +1096,8 @@
 } // end shrink_operands()
 
 
-void ConstantPool::copy_operands(constantPoolHandle from_cp,
-                                 constantPoolHandle to_cp,
+void ConstantPool::copy_operands(const constantPoolHandle& from_cp,
+                                 const constantPoolHandle& to_cp,
                                  TRAPS) {
 
   int from_oplen = operand_array_length(from_cp->operands());
@@ -1160,8 +1160,8 @@
 // Copy this constant pool's entries at start_i to end_i (inclusive)
 // to the constant pool to_cp's entries starting at to_i. A total of
 // (end_i - start_i) + 1 entries are copied.
-void ConstantPool::copy_cp_to_impl(constantPoolHandle from_cp, int start_i, int end_i,
-       constantPoolHandle to_cp, int to_i, TRAPS) {
+void ConstantPool::copy_cp_to_impl(const constantPoolHandle& from_cp, int start_i, int end_i,
+       const constantPoolHandle& to_cp, int to_i, TRAPS) {
 
 
   int dest_i = to_i;  // leave original alone for debug purposes
@@ -1191,8 +1191,8 @@
 
 // Copy this constant pool's entry at from_i to the constant pool
 // to_cp's entry at to_i.
-void ConstantPool::copy_entry_to(constantPoolHandle from_cp, int from_i,
-                                        constantPoolHandle to_cp, int to_i,
+void ConstantPool::copy_entry_to(const constantPoolHandle& from_cp, int from_i,
+                                        const constantPoolHandle& to_cp, int to_i,
                                         TRAPS) {
 
   int tag = from_cp->tag_at(from_i).value();
@@ -1339,7 +1339,7 @@
 // constant pool's entry at pattern_i. Returns the index of a
 // matching entry or zero (0) if there is no matching entry.
 int ConstantPool::find_matching_entry(int pattern_i,
-      constantPoolHandle search_cp, TRAPS) {
+      const constantPoolHandle& search_cp, TRAPS) {
 
   // index zero (0) is not used
   for (int i = 1; i < search_cp->length(); i++) {
@@ -1355,7 +1355,7 @@
 
 // Compare this constant pool's bootstrap specifier at idx1 to the constant pool
 // cp2's bootstrap specifier at idx2.
-bool ConstantPool::compare_operand_to(int idx1, constantPoolHandle cp2, int idx2, TRAPS) {
+bool ConstantPool::compare_operand_to(int idx1, const constantPoolHandle& cp2, int idx2, TRAPS) {
   int k1 = operand_bootstrap_method_ref_index_at(idx1);
   int k2 = cp2->operand_bootstrap_method_ref_index_at(idx2);
   bool match = compare_entry_to(k1, cp2, k2, CHECK_false);
@@ -1382,7 +1382,7 @@
 // this constant pool's bootstrap specifier at pattern_i index.
 // Return the index of a matching bootstrap specifier or (-1) if there is no match.
 int ConstantPool::find_matching_operand(int pattern_i,
-                    constantPoolHandle search_cp, int search_len, TRAPS) {
+                    const constantPoolHandle& search_cp, int search_len, TRAPS) {
   for (int i = 0; i < search_len; i++) {
     bool found = compare_operand_to(pattern_i, search_cp, i, CHECK_(-1));
     if (found) {
--- a/hotspot/src/share/vm/oops/constantPool.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/constantPool.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -604,15 +604,15 @@
     return offset;
   }
   // Compare a bootsrap specifier in the operands arrays
-  bool compare_operand_to(int bootstrap_specifier_index1, constantPoolHandle cp2,
+  bool compare_operand_to(int bootstrap_specifier_index1, const constantPoolHandle& cp2,
                           int bootstrap_specifier_index2, TRAPS);
   // Find a bootsrap specifier in the operands array
-  int find_matching_operand(int bootstrap_specifier_index, constantPoolHandle search_cp,
+  int find_matching_operand(int bootstrap_specifier_index, const constantPoolHandle& search_cp,
                             int operands_cur_len, TRAPS);
   // Resize the operands array with delta_len and delta_size
   void resize_operands(int delta_len, int delta_size, TRAPS);
   // Extend the operands array with the length and size of the ext_cp operands
-  void extend_operands(constantPoolHandle ext_cp, TRAPS);
+  void extend_operands(const constantPoolHandle& ext_cp, TRAPS);
   // Shrink the operands array to a smaller array with new_len length
   void shrink_operands(int new_len, TRAPS);
 
@@ -735,13 +735,13 @@
   friend class SystemDictionary;
 
   // Used by compiler to prevent classloading.
-  static Method*          method_at_if_loaded      (constantPoolHandle this_cp, int which);
-  static bool       has_appendix_at_if_loaded      (constantPoolHandle this_cp, int which);
-  static oop            appendix_at_if_loaded      (constantPoolHandle this_cp, int which);
-  static bool    has_method_type_at_if_loaded      (constantPoolHandle this_cp, int which);
-  static oop         method_type_at_if_loaded      (constantPoolHandle this_cp, int which);
-  static Klass*            klass_at_if_loaded      (constantPoolHandle this_cp, int which);
-  static Klass*        klass_ref_at_if_loaded      (constantPoolHandle this_cp, int which);
+  static Method*          method_at_if_loaded      (const constantPoolHandle& this_cp, int which);
+  static bool       has_appendix_at_if_loaded      (const constantPoolHandle& this_cp, int which);
+  static oop            appendix_at_if_loaded      (const constantPoolHandle& this_cp, int which);
+  static bool    has_method_type_at_if_loaded      (const constantPoolHandle& this_cp, int which);
+  static oop         method_type_at_if_loaded      (const constantPoolHandle& this_cp, int which);
+  static Klass*            klass_at_if_loaded      (const constantPoolHandle& this_cp, int which);
+  static Klass*        klass_ref_at_if_loaded      (const constantPoolHandle& this_cp, int which);
 
   // Routines currently used for annotations (only called by jvm.cpp) but which might be used in the
   // future by other Java code. These take constant pool indices rather than
@@ -797,38 +797,38 @@
   }
 
   // Performs the LinkResolver checks
-  static void verify_constant_pool_resolve(constantPoolHandle this_cp, KlassHandle klass, TRAPS);
+  static void verify_constant_pool_resolve(const constantPoolHandle& this_cp, KlassHandle klass, TRAPS);
 
   // Implementation of methods that needs an exposed 'this' pointer, in order to
   // handle GC while executing the method
-  static Klass* klass_at_impl(constantPoolHandle this_cp, int which,
+  static Klass* klass_at_impl(const constantPoolHandle& this_cp, int which,
                               bool save_resolution_error, TRAPS);
-  static oop string_at_impl(constantPoolHandle this_cp, int which, int obj_index, TRAPS);
+  static oop string_at_impl(const constantPoolHandle& this_cp, int which, int obj_index, TRAPS);
 
-  static void trace_class_resolution(constantPoolHandle this_cp, KlassHandle k);
+  static void trace_class_resolution(const constantPoolHandle& this_cp, KlassHandle k);
 
   // Resolve string constants (to prevent allocation during compilation)
-  static void resolve_string_constants_impl(constantPoolHandle this_cp, TRAPS);
+  static void resolve_string_constants_impl(const constantPoolHandle& this_cp, TRAPS);
 
-  static oop resolve_constant_at_impl(constantPoolHandle this_cp, int index, int cache_index, TRAPS);
-  static oop resolve_bootstrap_specifier_at_impl(constantPoolHandle this_cp, int index, TRAPS);
+  static oop resolve_constant_at_impl(const constantPoolHandle& this_cp, int index, int cache_index, TRAPS);
+  static oop resolve_bootstrap_specifier_at_impl(const constantPoolHandle& this_cp, int index, TRAPS);
 
   // Exception handling
-  static void throw_resolution_error(constantPoolHandle this_cp, int which, TRAPS);
-  static Symbol* exception_message(constantPoolHandle this_cp, int which, constantTag tag, oop pending_exception);
-  static void save_and_throw_exception(constantPoolHandle this_cp, int which, constantTag tag, TRAPS);
+  static void throw_resolution_error(const constantPoolHandle& this_cp, int which, TRAPS);
+  static Symbol* exception_message(const constantPoolHandle& this_cp, int which, constantTag tag, oop pending_exception);
+  static void save_and_throw_exception(const constantPoolHandle& this_cp, int which, constantTag tag, TRAPS);
 
  public:
   // Merging ConstantPool* support:
-  bool compare_entry_to(int index1, constantPoolHandle cp2, int index2, TRAPS);
-  void copy_cp_to(int start_i, int end_i, constantPoolHandle to_cp, int to_i, TRAPS) {
+  bool compare_entry_to(int index1, const constantPoolHandle& cp2, int index2, TRAPS);
+  void copy_cp_to(int start_i, int end_i, const constantPoolHandle& to_cp, int to_i, TRAPS) {
     constantPoolHandle h_this(THREAD, this);
     copy_cp_to_impl(h_this, start_i, end_i, to_cp, to_i, THREAD);
   }
-  static void copy_cp_to_impl(constantPoolHandle from_cp, int start_i, int end_i, constantPoolHandle to_cp, int to_i, TRAPS);
-  static void copy_entry_to(constantPoolHandle from_cp, int from_i, constantPoolHandle to_cp, int to_i, TRAPS);
-  static void copy_operands(constantPoolHandle from_cp, constantPoolHandle to_cp, TRAPS);
-  int  find_matching_entry(int pattern_i, constantPoolHandle search_cp, TRAPS);
+  static void copy_cp_to_impl(const constantPoolHandle& from_cp, int start_i, int end_i, const constantPoolHandle& to_cp, int to_i, TRAPS);
+  static void copy_entry_to(const constantPoolHandle& from_cp, int from_i, const constantPoolHandle& to_cp, int to_i, TRAPS);
+  static void copy_operands(const constantPoolHandle& from_cp, const constantPoolHandle& to_cp, TRAPS);
+  int  find_matching_entry(int pattern_i, const constantPoolHandle& search_cp, TRAPS);
   int  version() const                    { return _saved._version; }
   void set_version(int version)           { _saved._version = version; }
   void increment_and_save_version(int version) {
--- a/hotspot/src/share/vm/oops/cpCache.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/cpCache.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -246,7 +246,7 @@
   set_direct_or_vtable_call(invoke_code, method, index);
 }
 
-void ConstantPoolCacheEntry::set_itable_call(Bytecodes::Code invoke_code, methodHandle method, int index) {
+void ConstantPoolCacheEntry::set_itable_call(Bytecodes::Code invoke_code, const methodHandle& method, int index) {
   assert(method->method_holder()->verify_itable_index(index), "");
   assert(invoke_code == Bytecodes::_invokeinterface, "");
   InstanceKlass* interf = method->method_holder();
@@ -261,15 +261,15 @@
 }
 
 
-void ConstantPoolCacheEntry::set_method_handle(constantPoolHandle cpool, const CallInfo &call_info) {
+void ConstantPoolCacheEntry::set_method_handle(const constantPoolHandle& cpool, const CallInfo &call_info) {
   set_method_handle_common(cpool, Bytecodes::_invokehandle, call_info);
 }
 
-void ConstantPoolCacheEntry::set_dynamic_call(constantPoolHandle cpool, const CallInfo &call_info) {
+void ConstantPoolCacheEntry::set_dynamic_call(const constantPoolHandle& cpool, const CallInfo &call_info) {
   set_method_handle_common(cpool, Bytecodes::_invokedynamic, call_info);
 }
 
-void ConstantPoolCacheEntry::set_method_handle_common(constantPoolHandle cpool,
+void ConstantPoolCacheEntry::set_method_handle_common(const constantPoolHandle& cpool,
                                                       Bytecodes::Code invoke_code,
                                                       const CallInfo &call_info) {
   // NOTE: This CPCE can be the subject of data races.
@@ -361,7 +361,7 @@
   }
 }
 
-Method* ConstantPoolCacheEntry::method_if_resolved(constantPoolHandle cpool) {
+Method* ConstantPoolCacheEntry::method_if_resolved(const constantPoolHandle& cpool) {
   // Decode the action of set_method and set_interface_call
   Bytecodes::Code invoke_code = bytecode_1();
   if (invoke_code != (Bytecodes::Code)0) {
@@ -406,7 +406,7 @@
 }
 
 
-oop ConstantPoolCacheEntry::appendix_if_resolved(constantPoolHandle cpool) {
+oop ConstantPoolCacheEntry::appendix_if_resolved(const constantPoolHandle& cpool) {
   if (!has_appendix())
     return NULL;
   const int ref_index = f2_as_index() + _indy_resolved_references_appendix_offset;
@@ -415,7 +415,7 @@
 }
 
 
-oop ConstantPoolCacheEntry::method_type_if_resolved(constantPoolHandle cpool) {
+oop ConstantPoolCacheEntry::method_type_if_resolved(const constantPoolHandle& cpool) {
   if (!has_method_type())
     return NULL;
   const int ref_index = f2_as_index() + _indy_resolved_references_method_type_offset;
--- a/hotspot/src/share/vm/oops/cpCache.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/cpCache.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -246,17 +246,17 @@
 
   void set_itable_call(
     Bytecodes::Code invoke_code,                 // the bytecode used; must be invokeinterface
-    methodHandle method,                         // the resolved interface method
+    const methodHandle& method,                  // the resolved interface method
     int itable_index                             // index into itable for the method
   );
 
   void set_method_handle(
-    constantPoolHandle cpool,                    // holding constant pool (required for locking)
+    const constantPoolHandle& cpool,             // holding constant pool (required for locking)
     const CallInfo &call_info                    // Call link information
   );
 
   void set_dynamic_call(
-    constantPoolHandle cpool,                    // holding constant pool (required for locking)
+    const constantPoolHandle& cpool,             // holding constant pool (required for locking)
     const CallInfo &call_info                    // Call link information
   );
 
@@ -276,7 +276,7 @@
   // resolution logic needs to make slightly different assessments about the
   // number and types of arguments.
   void set_method_handle_common(
-    constantPoolHandle cpool,                    // holding constant pool (required for locking)
+    const constantPoolHandle& cpool,                    // holding constant pool (required for locking)
     Bytecodes::Code invoke_code,                 // _invokehandle or _invokedynamic
     const CallInfo &call_info                    // Call link information
   );
@@ -291,9 +291,9 @@
     _indy_resolved_references_entries
   };
 
-  Method*      method_if_resolved(constantPoolHandle cpool);
-  oop        appendix_if_resolved(constantPoolHandle cpool);
-  oop     method_type_if_resolved(constantPoolHandle cpool);
+  Method*      method_if_resolved(const constantPoolHandle& cpool);
+  oop        appendix_if_resolved(const constantPoolHandle& cpool);
+  oop     method_type_if_resolved(const constantPoolHandle& cpool);
 
   void set_parameter_size(int value);
 
--- a/hotspot/src/share/vm/oops/fieldInfo.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/fieldInfo.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -176,7 +176,7 @@
     return (_shorts[low_packed_offset] & FIELDINFO_TAG_MASK) == FIELDINFO_TAG_OFFSET;
   }
 
-  Symbol* name(constantPoolHandle cp) const {
+  Symbol* name(const constantPoolHandle& cp) const {
     int index = name_index();
     if (is_internal()) {
       return lookup_symbol(index);
@@ -184,7 +184,7 @@
     return cp->symbol_at(index);
   }
 
-  Symbol* signature(constantPoolHandle cp) const {
+  Symbol* signature(const constantPoolHandle& cp) const {
     int index = signature_index();
     if (is_internal()) {
       return lookup_symbol(index);
--- a/hotspot/src/share/vm/oops/fieldStreams.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/fieldStreams.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,7 +79,7 @@
     return num_fields;
   }
 
-  FieldStreamBase(Array<u2>* fields, constantPoolHandle constants, int start, int limit) {
+  FieldStreamBase(Array<u2>* fields, const constantPoolHandle& constants, int start, int limit) {
     _fields = fields;
     _constants = constants;
     _index = start;
@@ -91,7 +91,7 @@
     }
   }
 
-  FieldStreamBase(Array<u2>* fields, constantPoolHandle constants) {
+  FieldStreamBase(Array<u2>* fields, const constantPoolHandle& constants) {
     _fields = fields;
     _constants = constants;
     _index = 0;
@@ -251,7 +251,7 @@
 
 class AllFieldStream : public FieldStreamBase {
  public:
-  AllFieldStream(Array<u2>* fields, constantPoolHandle constants): FieldStreamBase(fields, constants) {}
+  AllFieldStream(Array<u2>* fields, const constantPoolHandle& constants): FieldStreamBase(fields, constants) {}
   AllFieldStream(InstanceKlass* k):      FieldStreamBase(k->fields(), k->constants()) {}
   AllFieldStream(instanceKlassHandle k): FieldStreamBase(k->fields(), k->constants()) {}
 };
--- a/hotspot/src/share/vm/oops/generateOopMap.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/generateOopMap.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -222,7 +222,7 @@
   }
 }
 
-void RetTable::compute_ret_table(methodHandle method) {
+void RetTable::compute_ret_table(const methodHandle& method) {
   BytecodeStream i(method);
   Bytecodes::Code bytecode;
 
@@ -2039,7 +2039,7 @@
 //
 //  ============ Main Entry Point ===========
 //
-GenerateOopMap::GenerateOopMap(methodHandle method) {
+GenerateOopMap::GenerateOopMap(const methodHandle& method) {
   // We have to initialize all variables here, that can be queried directly
   _method = method;
   _max_locals=0;
--- a/hotspot/src/share/vm/oops/generateOopMap.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/generateOopMap.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -78,7 +78,7 @@
   void add_jsr(int return_bci, int target_bci);   // Adds entry to list
  public:
   RetTable()                                                  { _first = NULL; }
-  void compute_ret_table(methodHandle method);
+  void compute_ret_table(const methodHandle& method);
   void update_ret_table(int bci, int delta);
   RetTableEntry* find_jsrs_for_target(int targBci);
 };
@@ -462,7 +462,7 @@
 
   friend class RelocCallback;
  public:
-  GenerateOopMap(methodHandle method);
+  GenerateOopMap(const methodHandle& method);
 
   // Compute the map.
   void compute_map(TRAPS);
@@ -537,7 +537,7 @@
 #endif
 
  public:
-  ResolveOopMapConflicts(methodHandle method) : GenerateOopMap(method) { _must_clear_locals = false; };
+  ResolveOopMapConflicts(const methodHandle& method) : GenerateOopMap(method) { _must_clear_locals = false; };
 
   methodHandle do_potential_rewrite(TRAPS);
   bool must_clear_locals() const { return _must_clear_locals; }
@@ -562,7 +562,7 @@
                                            int stack_top)                 {}
   virtual void fill_init_vars             (GrowableArray<intptr_t> *init_vars) {}
  public:
-  GeneratePairingInfo(methodHandle method) : GenerateOopMap(method)       {};
+  GeneratePairingInfo(const methodHandle& method) : GenerateOopMap(method)       {};
 
   // Call compute_map(CHECK) to generate info.
 };
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1141,7 +1141,7 @@
 }
 
 
-void InstanceKlass::mask_for(methodHandle method, int bci,
+void InstanceKlass::mask_for(const methodHandle& method, int bci,
   InterpreterOopMap* entry_for) {
   // Dirty read, then double-check under a lock.
   if (_oop_map_cache == NULL) {
@@ -1645,7 +1645,7 @@
 // locking has to be done very carefully to avoid deadlocks
 // and/or other cache consistency problems.
 //
-jmethodID InstanceKlass::get_jmethod_id(instanceKlassHandle ik_h, methodHandle method_h) {
+jmethodID InstanceKlass::get_jmethod_id(instanceKlassHandle ik_h, const methodHandle& method_h) {
   size_t idnum = (size_t)method_h->method_idnum();
   jmethodID* jmeths = ik_h->methods_jmethod_ids_acquire();
   size_t length = 0;
@@ -2413,7 +2413,7 @@
 // Assumes name-signature match
 // "this" is InstanceKlass of super_method which must exist
 // note that the InstanceKlass of the method in the targetclassname has not always been created yet
-bool InstanceKlass::is_override(methodHandle super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS) {
+bool InstanceKlass::is_override(const methodHandle& super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS) {
    // Private methods can not be overridden
    if (super_method->is_private()) {
      return false;
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -414,7 +414,7 @@
   };
 
   // method override check
-  bool is_override(methodHandle super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS);
+  bool is_override(const methodHandle& super_method, Handle targetclassloader, Symbol* targetclassname, TRAPS);
 
   // package
   bool is_same_class_package(Klass* class2);
@@ -780,7 +780,7 @@
 
   // jmethodID support
   static jmethodID get_jmethod_id(instanceKlassHandle ik_h,
-                     methodHandle method_h);
+                     const methodHandle& method_h);
   static jmethodID get_jmethod_id_fetch_or_update(instanceKlassHandle ik_h,
                      size_t idnum, jmethodID new_id, jmethodID* new_jmeths,
                      jmethodID* to_dealloc_id_p,
@@ -827,7 +827,7 @@
   // OopMapCache support
   OopMapCache* oop_map_cache()               { return _oop_map_cache; }
   void set_oop_map_cache(OopMapCache *cache) { _oop_map_cache = cache; }
-  void mask_for(methodHandle method, int bci, InterpreterOopMap* entry);
+  void mask_for(const methodHandle& method, int bci, InterpreterOopMap* entry);
 
   // JNI identifier support (for static fields - for jni performance)
   JNIid* jni_ids()                               { return _jni_ids; }
--- a/hotspot/src/share/vm/oops/method.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/method.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -366,7 +366,7 @@
 
 // Build a MethodData* object to hold information about this method
 // collected in the interpreter.
-void Method::build_interpreter_method_data(methodHandle method, TRAPS) {
+void Method::build_interpreter_method_data(const methodHandle& method, TRAPS) {
   // Do not profile the method if metaspace has hit an OOM previously
   // allocating profiling data. Callers clear pending exception so don't
   // add one here.
@@ -897,7 +897,7 @@
 
 // Called when the method_holder is getting linked. Setup entrypoints so the method
 // is ready to be called from interpreter, compiler, and vtables.
-void Method::link_method(methodHandle h_method, TRAPS) {
+void Method::link_method(const methodHandle& h_method, TRAPS) {
   // If the code cache is full, we may reenter this function for the
   // leftover methods that weren't linked.
   if (_i2i_entry != NULL) return;
--- a/hotspot/src/share/vm/oops/method.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/method.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -393,7 +393,7 @@
   bool was_executed_more_than(int n);
   bool was_never_executed()                      { return !was_executed_more_than(0); }
 
-  static void build_interpreter_method_data(methodHandle method, TRAPS);
+  static void build_interpreter_method_data(const methodHandle& method, TRAPS);
 
   static MethodCounters* build_method_counters(Method* m, TRAPS);
 
@@ -435,7 +435,7 @@
   address get_c2i_unverified_entry();
   AdapterHandlerEntry* adapter() {  return _adapter; }
   // setup entry points
-  void link_method(methodHandle method, TRAPS);
+  void link_method(const methodHandle& method, TRAPS);
   // clear entry points. Used by sharing code
   void unlink_method();
 
--- a/hotspot/src/share/vm/oops/methodData.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/methodData.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -708,7 +708,7 @@
 // A MethodData* holds information which has been collected about
 // a method.
 
-MethodData* MethodData::allocate(ClassLoaderData* loader_data, methodHandle method, TRAPS) {
+MethodData* MethodData::allocate(ClassLoaderData* loader_data, const methodHandle& method, TRAPS) {
   int size = MethodData::compute_allocation_size_in_words(method);
 
   return new (loader_data, size, false, MetaspaceObj::MethodDataType, THREAD)
@@ -898,7 +898,7 @@
 
 // Compute the size of the MethodData* necessary to store
 // profiling information about a given method.  Size is in bytes.
-int MethodData::compute_allocation_size_in_bytes(methodHandle method) {
+int MethodData::compute_allocation_size_in_bytes(const methodHandle& method) {
   int data_size = 0;
   BytecodeStream stream(method);
   Bytecodes::Code c;
@@ -931,7 +931,7 @@
 
 // Compute the size of the MethodData* necessary to store
 // profiling information about a given method.  Size is in words
-int MethodData::compute_allocation_size_in_words(methodHandle method) {
+int MethodData::compute_allocation_size_in_words(const methodHandle& method) {
   int byte_size = compute_allocation_size_in_bytes(method);
   int word_size = align_size_up(byte_size, BytesPerWord) / BytesPerWord;
   return align_object_size(word_size);
@@ -1129,7 +1129,7 @@
 }
 
 // Initialize the MethodData* corresponding to a given method.
-MethodData::MethodData(methodHandle method, int size, TRAPS)
+MethodData::MethodData(const methodHandle& method, int size, TRAPS)
   : _extra_data_lock(Monitor::leaf, "MDO extra data lock"),
     _parameters_type_data_di(parameters_uninitialized) {
   // Set the method back-pointer.
@@ -1513,7 +1513,7 @@
   // not yet implemented.
 }
 
-bool MethodData::profile_jsr292(methodHandle m, int bci) {
+bool MethodData::profile_jsr292(const methodHandle& m, int bci) {
   if (m->is_compiled_lambda_form()) {
     return true;
   }
@@ -1538,7 +1538,7 @@
   return profile_arguments_flag() == type_profile_all;
 }
 
-bool MethodData::profile_arguments_for_invoke(methodHandle m, int bci) {
+bool MethodData::profile_arguments_for_invoke(const methodHandle& m, int bci) {
   if (!profile_arguments()) {
     return false;
   }
@@ -1567,7 +1567,7 @@
   return profile_return_flag() == type_profile_all;
 }
 
-bool MethodData::profile_return_for_invoke(methodHandle m, int bci) {
+bool MethodData::profile_return_for_invoke(const methodHandle& m, int bci) {
   if (!profile_return()) {
     return false;
   }
@@ -1596,7 +1596,7 @@
   return profile_parameters_flag() == type_profile_all;
 }
 
-bool MethodData::profile_parameters_for_method(methodHandle m) {
+bool MethodData::profile_parameters_for_method(const methodHandle& m) {
   if (!profile_parameters()) {
     return false;
   }
--- a/hotspot/src/share/vm/oops/methodData.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/oops/methodData.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2145,9 +2145,9 @@
 
   Mutex _extra_data_lock;
 
-  MethodData(methodHandle method, int size, TRAPS);
+  MethodData(const methodHandle& method, int size, TRAPS);
 public:
-  static MethodData* allocate(ClassLoaderData* loader_data, methodHandle method, TRAPS);
+  static MethodData* allocate(ClassLoaderData* loader_data, const methodHandle& method, TRAPS);
   MethodData() : _extra_data_lock(Monitor::leaf, "MDO extra data lock") {}; // For ciMethodData
 
   bool is_methodData() const volatile { return true; }
@@ -2283,13 +2283,13 @@
     type_profile_all = 2
   };
 
-  static bool profile_jsr292(methodHandle m, int bci);
+  static bool profile_jsr292(const methodHandle& m, int bci);
   static int profile_arguments_flag();
   static bool profile_all_arguments();
-  static bool profile_arguments_for_invoke(methodHandle m, int bci);
+  static bool profile_arguments_for_invoke(const methodHandle& m, int bci);
   static int profile_return_flag();
   static bool profile_all_return();
-  static bool profile_return_for_invoke(methodHandle m, int bci);
+  static bool profile_return_for_invoke(const methodHandle& m, int bci);
   static int profile_parameters_flag();
   static bool profile_parameters_jsr292_only();
   static bool profile_all_parameters();
@@ -2304,8 +2304,8 @@
   }
 
   // Compute the size of a MethodData* before it is created.
-  static int compute_allocation_size_in_bytes(methodHandle method);
-  static int compute_allocation_size_in_words(methodHandle method);
+  static int compute_allocation_size_in_bytes(const methodHandle& method);
+  static int compute_allocation_size_in_words(const methodHandle& method);
   static int compute_extra_data_count(int data_size, int empty_bc_count, bool needs_speculative_traps);
 
   // Determine if a given bytecode can have profile information.
@@ -2589,7 +2589,7 @@
   void verify_on(outputStream* st);
   void verify_data_on(outputStream* st);
 
-  static bool profile_parameters_for_method(methodHandle m);
+  static bool profile_parameters_for_method(const methodHandle& m);
   static bool profile_arguments();
   static bool profile_arguments_jsr292_only();
   static bool profile_return();
--- a/hotspot/src/share/vm/opto/c2compiler.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -157,7 +157,7 @@
   Compile::print_timers();
 }
 
-bool C2Compiler::is_intrinsic_supported(methodHandle method, bool is_virtual) {
+bool C2Compiler::is_intrinsic_supported(const methodHandle& method, bool is_virtual) {
   vmIntrinsics::ID id = method->intrinsic_id();
   assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
 
--- a/hotspot/src/share/vm/opto/c2compiler.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/opto/c2compiler.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,13 +56,13 @@
   // possible for only a limited set of available intrinsics whereas
   // a non-virtual dispatch is possible for all available intrinsics.)
   // Return false otherwise.
-  virtual bool is_intrinsic_supported(methodHandle method) {
+  virtual bool is_intrinsic_supported(const methodHandle& method) {
     return is_intrinsic_supported(method, false);
   }
 
   // Check if the compiler supports an intrinsic for 'method' given the
   // the dispatch mode specified by the 'is_virtual' parameter.
-  virtual bool is_intrinsic_supported(methodHandle method, bool is_virtual);
+  virtual bool is_intrinsic_supported(const methodHandle& method, bool is_virtual);
 
   // Initial size of the code buffer (may be increased at runtime)
   static int initial_code_buffer_size();
--- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -125,7 +125,7 @@
 // JVMSpec|     u2 attributes_count;
 // JVMSpec|     attribute_info attributes[attributes_count];
 // JVMSpec|   }
-void JvmtiClassFileReconstituter::write_code_attribute(methodHandle method) {
+void JvmtiClassFileReconstituter::write_code_attribute(const methodHandle& method) {
   ConstMethod* const_method = method->constMethod();
   u2 line_num_cnt = 0;
   int stackmap_len = 0;
@@ -415,7 +415,7 @@
 }
 
 // Compute size of LineNumberTable
-u2 JvmtiClassFileReconstituter::line_number_table_entries(methodHandle method) {
+u2 JvmtiClassFileReconstituter::line_number_table_entries(const methodHandle& method) {
   // The line number table is compressed so we don't know how big it is until decompressed.
   // Decompression is really fast so we just do it twice.
   u2 num_entries = 0;
@@ -435,7 +435,7 @@
 // JVMSpec|        u2 line_number;
 // JVMSpec|     } line_number_table[line_number_table_length];
 // JVMSpec|   }
-void JvmtiClassFileReconstituter::write_line_number_table_attribute(methodHandle method,
+void JvmtiClassFileReconstituter::write_line_number_table_attribute(const methodHandle& method,
                                                                     u2 num_entries) {
 
   write_attribute_name_index("LineNumberTable");
@@ -461,7 +461,7 @@
 // JVMSpec|       u2 index;
 // JVMSpec|     } local_variable_table[local_variable_table_length];
 // JVMSpec|   }
-void JvmtiClassFileReconstituter::write_local_variable_table_attribute(methodHandle method, u2 num_entries) {
+void JvmtiClassFileReconstituter::write_local_variable_table_attribute(const methodHandle& method, u2 num_entries) {
     write_attribute_name_index("LocalVariableTable");
     write_u4(2 + num_entries * (2 + 2 + 2 + 2 + 2));
     write_u2(num_entries);
@@ -491,7 +491,7 @@
 // JVMSpec|       u2 index;
 // JVMSpec|     } local_variable_type_table[local_variable_type_table_length];
 // JVMSpec|   }
-void JvmtiClassFileReconstituter::write_local_variable_type_table_attribute(methodHandle method, u2 num_entries) {
+void JvmtiClassFileReconstituter::write_local_variable_type_table_attribute(const methodHandle& method, u2 num_entries) {
     write_attribute_name_index("LocalVariableTypeTable");
     write_u4(2 + num_entries * (2 + 2 + 2 + 2 + 2));
     write_u2(num_entries);
@@ -519,7 +519,7 @@
 // JSR-202|     u2 number_of_entries;
 // JSR-202|     stack_map_frame_entries[number_of_entries];
 // JSR-202|   }
-void JvmtiClassFileReconstituter::write_stackmap_table_attribute(methodHandle method,
+void JvmtiClassFileReconstituter::write_stackmap_table_attribute(const methodHandle& method,
                                                                  int stackmap_len) {
 
   write_attribute_name_index("StackMapTable");
@@ -538,7 +538,7 @@
 // JVMSpec|     u2 attributes_count;
 // JVMSpec|     attribute_info attributes[attributes_count];
 // JVMSpec|   }
-void JvmtiClassFileReconstituter::write_method_info(methodHandle method) {
+void JvmtiClassFileReconstituter::write_method_info(const methodHandle& method) {
   AccessFlags access_flags = method->access_flags();
   ConstMethod* const_method = method->constMethod();
   u2 generic_signature_index = const_method->generic_signature_index();
@@ -813,7 +813,7 @@
   Bytes::put_Java_u8(writeable_address(8), x);
 }
 
-void JvmtiClassFileReconstituter::copy_bytecodes(methodHandle mh,
+void JvmtiClassFileReconstituter::copy_bytecodes(const methodHandle& mh,
                                                  unsigned char* bytecodes) {
   // use a BytecodeStream to iterate over the bytecodes. JVM/fast bytecodes
   // and the breakpoint bytecode are converted to their original bytecodes.
--- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -110,18 +110,18 @@
   void write_class_file_format();
   void write_field_infos();
   void write_method_infos();
-  void write_method_info(methodHandle method);
-  void write_code_attribute(methodHandle method);
+  void write_method_info(const methodHandle& method);
+  void write_code_attribute(const methodHandle& method);
   void write_exceptions_attribute(ConstMethod* const_method);
   void write_synthetic_attribute();
   void write_class_attributes();
   void write_source_file_attribute();
   void write_source_debug_extension_attribute();
-  u2 line_number_table_entries(methodHandle method);
-  void write_line_number_table_attribute(methodHandle method, u2 num_entries);
-  void write_local_variable_table_attribute(methodHandle method, u2 num_entries);
-  void write_local_variable_type_table_attribute(methodHandle method, u2 num_entries);
-  void write_stackmap_table_attribute(methodHandle method, int stackmap_table_len);
+  u2 line_number_table_entries(const methodHandle& method);
+  void write_line_number_table_attribute(const methodHandle& method, u2 num_entries);
+  void write_local_variable_table_attribute(const methodHandle& method, u2 num_entries);
+  void write_local_variable_type_table_attribute(const methodHandle& method, u2 num_entries);
+  void write_stackmap_table_attribute(const methodHandle& method, int stackmap_table_len);
   u2 inner_classes_attribute_length();
   void write_inner_classes_attribute(int length);
   void write_signature_attribute(u2 generic_signaure_index);
@@ -150,7 +150,7 @@
 
   u1* class_file_bytes()      { return _buffer; }
 
-  static void copy_bytecodes(methodHandle method, unsigned char* bytecodes);
+  static void copy_bytecodes(const methodHandle& method, unsigned char* bytecodes);
 };
 
 #endif // SHARE_VM_PRIMS_JVMTICLASSFILERECONSTITUTER_HPP
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -216,7 +216,7 @@
 // referenced CP entries may already exist in *merge_cp_p in which case
 // there is nothing extra to append and only the current entry is
 // appended.
-void VM_RedefineClasses::append_entry(constantPoolHandle scratch_cp,
+void VM_RedefineClasses::append_entry(const constantPoolHandle& scratch_cp,
        int scratch_i, constantPoolHandle *merge_cp_p, int *merge_cp_length_p,
        TRAPS) {
 
@@ -475,7 +475,7 @@
 } // end append_entry()
 
 
-int VM_RedefineClasses::find_or_append_indirect_entry(constantPoolHandle scratch_cp,
+int VM_RedefineClasses::find_or_append_indirect_entry(const constantPoolHandle& scratch_cp,
       int ref_i, constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS) {
 
   int new_ref_i = ref_i;
@@ -507,7 +507,7 @@
 // Append a bootstrap specifier into the merge_cp operands that is semantically equal
 // to the scratch_cp operands bootstrap specifier passed by the old_bs_i index.
 // Recursively append new merge_cp entries referenced by the new bootstrap specifier.
-void VM_RedefineClasses::append_operand(constantPoolHandle scratch_cp, int old_bs_i,
+void VM_RedefineClasses::append_operand(const constantPoolHandle& scratch_cp, int old_bs_i,
        constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS) {
 
   int old_ref_i = scratch_cp->operand_bootstrap_method_ref_index_at(old_bs_i);
@@ -551,7 +551,7 @@
 } // end append_operand()
 
 
-int VM_RedefineClasses::find_or_append_operand(constantPoolHandle scratch_cp,
+int VM_RedefineClasses::find_or_append_operand(const constantPoolHandle& scratch_cp,
       int old_bs_i, constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS) {
 
   int new_bs_i = old_bs_i; // bootstrap specifier index
@@ -577,7 +577,7 @@
 } // end find_or_append_operand()
 
 
-void VM_RedefineClasses::finalize_operands_merge(constantPoolHandle merge_cp, TRAPS) {
+void VM_RedefineClasses::finalize_operands_merge(const constantPoolHandle& merge_cp, TRAPS) {
   if (merge_cp->operands() == NULL) {
     return;
   }
@@ -910,8 +910,8 @@
 
 // Returns true if the current mismatch is due to a resolved/unresolved
 // class pair. Otherwise, returns false.
-bool VM_RedefineClasses::is_unresolved_class_mismatch(constantPoolHandle cp1,
-       int index1, constantPoolHandle cp2, int index2) {
+bool VM_RedefineClasses::is_unresolved_class_mismatch(const constantPoolHandle& cp1,
+       int index1, const constantPoolHandle& cp2, int index2) {
 
   jbyte t1 = cp1->tag_at(index1).value();
   if (t1 != JVM_CONSTANT_Class && t1 != JVM_CONSTANT_UnresolvedClass) {
@@ -1149,7 +1149,7 @@
 
 // Map old_index to new_index as needed. scratch_cp is only needed
 // for RC_TRACE() calls.
-void VM_RedefineClasses::map_index(constantPoolHandle scratch_cp,
+void VM_RedefineClasses::map_index(const constantPoolHandle& scratch_cp,
        int old_index, int new_index) {
   if (find_new_index(old_index) != 0) {
     // old_index is already mapped
@@ -1195,8 +1195,8 @@
 // scratch_cp to the corresponding entry in *merge_cp_p. Index map
 // entries are only created for entries in scratch_cp that occupy a
 // different location in *merged_cp_p.
-bool VM_RedefineClasses::merge_constant_pools(constantPoolHandle old_cp,
-       constantPoolHandle scratch_cp, constantPoolHandle *merge_cp_p,
+bool VM_RedefineClasses::merge_constant_pools(const constantPoolHandle& old_cp,
+       const constantPoolHandle& scratch_cp, constantPoolHandle *merge_cp_p,
        int *merge_cp_length_p, TRAPS) {
 
   if (merge_cp_p == NULL) {
@@ -2867,7 +2867,7 @@
 // }
 //
 void VM_RedefineClasses::rewrite_cp_refs_in_stack_map_table(
-       methodHandle method, TRAPS) {
+       const methodHandle& method, TRAPS) {
 
   if (!method->has_stackmap_table()) {
     return;
--- a/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/prims/jvmtiRedefineClasses.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -420,23 +420,23 @@
   void increment_class_counter(InstanceKlass *ik, TRAPS);
 
   // Support for constant pool merging (these routines are in alpha order):
-  void append_entry(constantPoolHandle scratch_cp, int scratch_i,
+  void append_entry(const constantPoolHandle& scratch_cp, int scratch_i,
     constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS);
-  void append_operand(constantPoolHandle scratch_cp, int scratch_bootstrap_spec_index,
+  void append_operand(const constantPoolHandle& scratch_cp, int scratch_bootstrap_spec_index,
     constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS);
-  void finalize_operands_merge(constantPoolHandle merge_cp, TRAPS);
-  int find_or_append_indirect_entry(constantPoolHandle scratch_cp, int scratch_i,
+  void finalize_operands_merge(const constantPoolHandle& merge_cp, TRAPS);
+  int find_or_append_indirect_entry(const constantPoolHandle& scratch_cp, int scratch_i,
     constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS);
-  int find_or_append_operand(constantPoolHandle scratch_cp, int scratch_bootstrap_spec_index,
+  int find_or_append_operand(const constantPoolHandle& scratch_cp, int scratch_bootstrap_spec_index,
     constantPoolHandle *merge_cp_p, int *merge_cp_length_p, TRAPS);
   int find_new_index(int old_index);
   int find_new_operand_index(int old_bootstrap_spec_index);
-  bool is_unresolved_class_mismatch(constantPoolHandle cp1, int index1,
-    constantPoolHandle cp2, int index2);
-  void map_index(constantPoolHandle scratch_cp, int old_index, int new_index);
+  bool is_unresolved_class_mismatch(const constantPoolHandle& cp1, int index1,
+    const constantPoolHandle& cp2, int index2);
+  void map_index(const constantPoolHandle& scratch_cp, int old_index, int new_index);
   void map_operand_index(int old_bootstrap_spec_index, int new_bootstrap_spec_index);
-  bool merge_constant_pools(constantPoolHandle old_cp,
-    constantPoolHandle scratch_cp, constantPoolHandle *merge_cp_p,
+  bool merge_constant_pools(const constantPoolHandle& old_cp,
+    const constantPoolHandle& scratch_cp, constantPoolHandle *merge_cp_p,
     int *merge_cp_length_p, TRAPS);
   jvmtiError merge_cp_and_rewrite(instanceKlassHandle the_class,
     instanceKlassHandle scratch_class, TRAPS);
@@ -480,7 +480,7 @@
     instanceKlassHandle scratch_class, TRAPS);
   bool rewrite_cp_refs_in_methods_type_annotations(
     instanceKlassHandle scratch_class, TRAPS);
-  void rewrite_cp_refs_in_stack_map_table(methodHandle method, TRAPS);
+  void rewrite_cp_refs_in_stack_map_table(const methodHandle& method, TRAPS);
   void rewrite_cp_refs_in_verification_type_info(
          address& stackmap_addr_ref, address stackmap_end, u2 frame_i,
          u1 frame_size, TRAPS);
--- a/hotspot/src/share/vm/prims/nativeLookup.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/prims/nativeLookup.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -67,7 +67,7 @@
 }
 
 
-char* NativeLookup::pure_jni_name(methodHandle method) {
+char* NativeLookup::pure_jni_name(const methodHandle& method) {
   stringStream st;
   // Prefix
   st.print("Java_");
@@ -80,7 +80,7 @@
 }
 
 
-char* NativeLookup::critical_jni_name(methodHandle method) {
+char* NativeLookup::critical_jni_name(const methodHandle& method) {
   stringStream st;
   // Prefix
   st.print("JavaCritical_");
@@ -93,7 +93,7 @@
 }
 
 
-char* NativeLookup::long_jni_name(methodHandle method) {
+char* NativeLookup::long_jni_name(const methodHandle& method) {
   // Signature ignore the wrapping parenteses and the trailing return type
   stringStream st;
   Symbol* signature = method->signature();
@@ -142,7 +142,7 @@
   return NULL;
 }
 
-address NativeLookup::lookup_style(methodHandle method, char* pure_name, const char* long_name, int args_size, bool os_style, bool& in_base_library, TRAPS) {
+address NativeLookup::lookup_style(const methodHandle& method, char* pure_name, const char* long_name, int args_size, bool os_style, bool& in_base_library, TRAPS) {
   address entry;
   // Compute complete JNI name for style
   stringStream st;
@@ -199,7 +199,7 @@
 }
 
 
-address NativeLookup::lookup_critical_style(methodHandle method, char* pure_name, const char* long_name, int args_size, bool os_style) {
+address NativeLookup::lookup_critical_style(const methodHandle& method, char* pure_name, const char* long_name, int args_size, bool os_style) {
   if (!method->has_native_function()) {
     return NULL;
   }
@@ -229,7 +229,7 @@
 
 // Check all the formats of native implementation name to see if there is one
 // for the specified method.
-address NativeLookup::lookup_entry(methodHandle method, bool& in_base_library, TRAPS) {
+address NativeLookup::lookup_entry(const methodHandle& method, bool& in_base_library, TRAPS) {
   address entry = NULL;
   in_base_library = false;
   // Compute pure name
@@ -264,7 +264,7 @@
 
 // Check all the formats of native implementation name to see if there is one
 // for the specified method.
-address NativeLookup::lookup_critical_entry(methodHandle method) {
+address NativeLookup::lookup_critical_entry(const methodHandle& method) {
   if (!CriticalJNINatives) return NULL;
 
   if (method->is_synchronized() ||
@@ -318,7 +318,7 @@
 // If any are found, remove them before attemping the look up of the
 // native implementation again.
 // See SetNativeMethodPrefix in the JVM TI Spec for more details.
-address NativeLookup::lookup_entry_prefixed(methodHandle method, bool& in_base_library, TRAPS) {
+address NativeLookup::lookup_entry_prefixed(const methodHandle& method, bool& in_base_library, TRAPS) {
 #if INCLUDE_JVMTI
   ResourceMark rm(THREAD);
 
@@ -354,7 +354,7 @@
   return NULL;
 }
 
-address NativeLookup::lookup_base(methodHandle method, bool& in_base_library, TRAPS) {
+address NativeLookup::lookup_base(const methodHandle& method, bool& in_base_library, TRAPS) {
   address entry = NULL;
   ResourceMark rm(THREAD);
 
@@ -372,7 +372,7 @@
 }
 
 
-address NativeLookup::lookup(methodHandle method, bool& in_base_library, TRAPS) {
+address NativeLookup::lookup(const methodHandle& method, bool& in_base_library, TRAPS) {
   if (!method->has_native_function()) {
     address entry = lookup_base(method, in_base_library, CHECK_NULL);
     method->set_native_function(entry,
--- a/hotspot/src/share/vm/prims/nativeLookup.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/prims/nativeLookup.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,20 +34,20 @@
 class NativeLookup : AllStatic {
  private:
   // JNI name computation
-  static char* pure_jni_name(methodHandle method);
-  static char* long_jni_name(methodHandle method);
-  static char* critical_jni_name(methodHandle method);
+  static char* pure_jni_name(const methodHandle& method);
+  static char* long_jni_name(const methodHandle& method);
+  static char* critical_jni_name(const methodHandle& method);
 
   // Style specific lookup
-  static address lookup_style(methodHandle method, char* pure_name, const char* long_name, int args_size, bool os_style, bool& in_base_library, TRAPS);
-  static address lookup_critical_style(methodHandle method, char* pure_name, const char* long_name, int args_size, bool os_style);
-  static address lookup_base (methodHandle method, bool& in_base_library, TRAPS);
-  static address lookup_entry(methodHandle method, bool& in_base_library, TRAPS);
-  static address lookup_entry_prefixed(methodHandle method, bool& in_base_library, TRAPS);
+  static address lookup_style(const methodHandle& method, char* pure_name, const char* long_name, int args_size, bool os_style, bool& in_base_library, TRAPS);
+  static address lookup_critical_style(const methodHandle& method, char* pure_name, const char* long_name, int args_size, bool os_style);
+  static address lookup_base (const methodHandle& method, bool& in_base_library, TRAPS);
+  static address lookup_entry(const methodHandle& method, bool& in_base_library, TRAPS);
+  static address lookup_entry_prefixed(const methodHandle& method, bool& in_base_library, TRAPS);
  public:
   // Lookup native function. May throw UnsatisfiedLinkError.
-  static address lookup(methodHandle method, bool& in_base_library, TRAPS);
-  static address lookup_critical_entry(methodHandle method);
+  static address lookup(const methodHandle& method, bool& in_base_library, TRAPS);
+  static address lookup_critical_entry(const methodHandle& method);
 
   // Lookup native functions in base library.
   static address base_library_lookup(const char* class_name, const char* method_name, const char* signature);
--- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -467,14 +467,14 @@
 }
 
 // Update the rate and submit compile
-void AdvancedThresholdPolicy::submit_compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) {
+void AdvancedThresholdPolicy::submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread) {
   int hot_count = (bci == InvocationEntryBci) ? mh->invocation_count() : mh->backedge_count();
   update_rate(os::javaTimeMillis(), mh());
   CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", thread);
 }
 
 // Handle the invocation event.
-void AdvancedThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh,
+void AdvancedThresholdPolicy::method_invocation_event(const methodHandle& mh, const methodHandle& imh,
                                                       CompLevel level, nmethod* nm, JavaThread* thread) {
   if (should_create_mdo(mh(), level)) {
     create_mdo(mh, thread);
@@ -489,7 +489,7 @@
 
 // Handle the back branch event. Notice that we can compile the method
 // with a regular entry from here.
-void AdvancedThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh,
+void AdvancedThresholdPolicy::method_back_branch_event(const methodHandle& mh, const methodHandle& imh,
                                                        int bci, CompLevel level, nmethod* nm, JavaThread* thread) {
   if (should_create_mdo(mh(), level)) {
     create_mdo(mh, thread);
--- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -213,11 +213,11 @@
   jlong start_time() const     { return _start_time; }
 
   // Submit a given method for compilation (and update the rate).
-  virtual void submit_compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread);
+  virtual void submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread);
   // event() from SimpleThresholdPolicy would call these.
-  virtual void method_invocation_event(methodHandle method, methodHandle inlinee,
+  virtual void method_invocation_event(const methodHandle& method, const methodHandle& inlinee,
                                        CompLevel level, nmethod* nm, JavaThread* thread);
-  virtual void method_back_branch_event(methodHandle method, methodHandle inlinee,
+  virtual void method_back_branch_event(const methodHandle& method, const methodHandle& inlinee,
                                         int bci, CompLevel level, nmethod* nm, JavaThread* thread);
 public:
   AdvancedThresholdPolicy() : _start_time(0) { }
--- a/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/compilationPolicy.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -218,7 +218,7 @@
   return 0;
 }
 
-void NonTieredCompPolicy::reset_counter_for_invocation_event(methodHandle m) {
+void NonTieredCompPolicy::reset_counter_for_invocation_event(const methodHandle& m) {
   // Make sure invocation and backedge counter doesn't overflow again right away
   // as would be the case for native methods.
 
@@ -232,7 +232,7 @@
   assert(!m->was_never_executed(), "don't reset to 0 -- could be mistaken for never-executed");
 }
 
-void NonTieredCompPolicy::reset_counter_for_back_branch_event(methodHandle m) {
+void NonTieredCompPolicy::reset_counter_for_back_branch_event(const methodHandle& m) {
   // Delay next back-branch event but pump up invocation counter to trigger
   // whole method compilation.
   MethodCounters* mcs = m->method_counters();
@@ -357,7 +357,7 @@
   return (current >= initial + target);
 }
 
-nmethod* NonTieredCompPolicy::event(methodHandle method, methodHandle inlinee, int branch_bci,
+nmethod* NonTieredCompPolicy::event(const methodHandle& method, const methodHandle& inlinee, int branch_bci,
                                     int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread) {
   assert(comp_level == CompLevel_none, "This should be only called from the interpreter");
   NOT_PRODUCT(trace_frequency_counter_overflow(method, branch_bci, bci));
@@ -417,7 +417,7 @@
 
 #ifndef PRODUCT
 PRAGMA_FORMAT_NONLITERAL_IGNORED_EXTERNAL
-void NonTieredCompPolicy::trace_frequency_counter_overflow(methodHandle m, int branch_bci, int bci) {
+void NonTieredCompPolicy::trace_frequency_counter_overflow(const methodHandle& m, int branch_bci, int bci) {
   if (TraceInvocationCounterOverflow) {
     MethodCounters* mcs = m->method_counters();
     assert(mcs != NULL, "MethodCounters cannot be NULL for profiling");
@@ -448,7 +448,7 @@
   }
 }
 
-void NonTieredCompPolicy::trace_osr_request(methodHandle method, nmethod* osr, int bci) {
+void NonTieredCompPolicy::trace_osr_request(const methodHandle& method, nmethod* osr, int bci) {
   if (TraceOnStackReplacement) {
     ResourceMark rm;
     tty->print(osr != NULL ? "Reused OSR entry for " : "Requesting OSR entry for ");
@@ -460,7 +460,7 @@
 
 // SimpleCompPolicy - compile current method
 
-void SimpleCompPolicy::method_invocation_event(methodHandle m, JavaThread* thread) {
+void SimpleCompPolicy::method_invocation_event(const methodHandle& m, JavaThread* thread) {
   const int comp_level = CompLevel_highest_tier;
   const int hot_count = m->invocation_count();
   reset_counter_for_invocation_event(m);
@@ -474,7 +474,7 @@
   }
 }
 
-void SimpleCompPolicy::method_back_branch_event(methodHandle m, int bci, JavaThread* thread) {
+void SimpleCompPolicy::method_back_branch_event(const methodHandle& m, int bci, JavaThread* thread) {
   const int comp_level = CompLevel_highest_tier;
   const int hot_count = m->backedge_count();
   const char* comment = "backedge_count";
@@ -491,7 +491,7 @@
 
 
 // Consider m for compilation
-void StackWalkCompPolicy::method_invocation_event(methodHandle m, JavaThread* thread) {
+void StackWalkCompPolicy::method_invocation_event(const methodHandle& m, JavaThread* thread) {
   const int comp_level = CompLevel_highest_tier;
   const int hot_count = m->invocation_count();
   reset_counter_for_invocation_event(m);
@@ -530,7 +530,7 @@
   }
 }
 
-void StackWalkCompPolicy::method_back_branch_event(methodHandle m, int bci, JavaThread* thread) {
+void StackWalkCompPolicy::method_back_branch_event(const methodHandle& m, int bci, JavaThread* thread) {
   const int comp_level = CompLevel_highest_tier;
   const int hot_count = m->backedge_count();
   const char* comment = "backedge_count";
@@ -663,7 +663,7 @@
 }
 
 
-const char* StackWalkCompPolicy::shouldInline(methodHandle m, float freq, int cnt) {
+const char* StackWalkCompPolicy::shouldInline(const methodHandle& m, float freq, int cnt) {
   // Allows targeted inlining
   // positive filter: should send be inlined?  returns NULL (--> yes)
   // or rejection msg
@@ -690,7 +690,7 @@
 }
 
 
-const char* StackWalkCompPolicy::shouldNotInline(methodHandle m) {
+const char* StackWalkCompPolicy::shouldNotInline(const methodHandle& m) {
   // negative filter: should send NOT be inlined?  returns NULL (--> inline) or rejection msg
   if (m->is_abstract()) return (_msg = "abstract method");
   // note: we allow ik->is_abstract()
--- a/hotspot/src/share/vm/runtime/compilationPolicy.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/compilationPolicy.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -66,7 +66,7 @@
   virtual int compiler_count(CompLevel comp_level) = 0;
   // main notification entry, return a pointer to an nmethod if the OSR is required,
   // returns NULL otherwise.
-  virtual nmethod* event(methodHandle method, methodHandle inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread) = 0;
+  virtual nmethod* event(const methodHandle& method, const methodHandle& inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread) = 0;
   // safepoint() is called at the end of the safepoint
   virtual void do_safepoint_work() = 0;
   // reprofile request
@@ -91,11 +91,11 @@
 class NonTieredCompPolicy : public CompilationPolicy {
   int _compiler_count;
 protected:
-  static void trace_frequency_counter_overflow(methodHandle m, int branch_bci, int bci);
-  static void trace_osr_request(methodHandle method, nmethod* osr, int bci);
+  static void trace_frequency_counter_overflow(const methodHandle& m, int branch_bci, int bci);
+  static void trace_osr_request(const methodHandle& method, nmethod* osr, int bci);
   static void trace_osr_completion(nmethod* osr_nm);
-  void reset_counter_for_invocation_event(methodHandle method);
-  void reset_counter_for_back_branch_event(methodHandle method);
+  void reset_counter_for_invocation_event(const methodHandle& method);
+  void reset_counter_for_back_branch_event(const methodHandle& method);
 public:
   NonTieredCompPolicy() : _compiler_count(0) { }
   virtual CompLevel initial_compile_level() { return CompLevel_highest_tier; }
@@ -107,15 +107,15 @@
   virtual bool is_mature(Method* method);
   virtual void initialize();
   virtual CompileTask* select_task(CompileQueue* compile_queue);
-  virtual nmethod* event(methodHandle method, methodHandle inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread);
-  virtual void method_invocation_event(methodHandle m, JavaThread* thread) = 0;
-  virtual void method_back_branch_event(methodHandle m, int bci, JavaThread* thread) = 0;
+  virtual nmethod* event(const methodHandle& method, const methodHandle& inlinee, int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread);
+  virtual void method_invocation_event(const methodHandle& m, JavaThread* thread) = 0;
+  virtual void method_back_branch_event(const methodHandle& m, int bci, JavaThread* thread) = 0;
 };
 
 class SimpleCompPolicy : public NonTieredCompPolicy {
  public:
-  virtual void method_invocation_event(methodHandle m, JavaThread* thread);
-  virtual void method_back_branch_event(methodHandle m, int bci, JavaThread* thread);
+  virtual void method_invocation_event(const methodHandle& m, JavaThread* thread);
+  virtual void method_back_branch_event(const methodHandle& m, int bci, JavaThread* thread);
 };
 
 // StackWalkCompPolicy - existing C2 policy
@@ -123,8 +123,8 @@
 #ifdef COMPILER2
 class StackWalkCompPolicy : public NonTieredCompPolicy {
  public:
-  virtual void method_invocation_event(methodHandle m, JavaThread* thread);
-  virtual void method_back_branch_event(methodHandle m, int bci, JavaThread* thread);
+  virtual void method_invocation_event(const methodHandle& m, JavaThread* thread);
+  virtual void method_back_branch_event(const methodHandle& m, int bci, JavaThread* thread);
 
  private:
   RFrame* findTopInlinableFrame(GrowableArray<RFrame*>* stack);
@@ -134,9 +134,9 @@
   // they are used for performance debugging only (print better messages)
   static const char* _msg;            // reason for not inlining
 
-  static const char* shouldInline   (methodHandle callee, float frequency, int cnt);
+  static const char* shouldInline   (const methodHandle& callee, float frequency, int cnt);
   // positive filter: should send be inlined?  returns NULL (--> yes) or rejection msg
-  static const char* shouldNotInline(methodHandle callee);
+  static const char* shouldNotInline(const methodHandle& callee);
   // negative filter: should send NOT be inlined?  returns NULL (--> inline) or rejection msg
 
 };
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1345,7 +1345,7 @@
 }
 
 #if defined(COMPILER2) || defined(SHARK) || INCLUDE_JVMCI
-void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int index, TRAPS) {
+void Deoptimization::load_class_by_index(const constantPoolHandle& constant_pool, int index, TRAPS) {
   // in case of an unresolved klass entry, load the class.
   if (constant_pool->tag_at(index).is_unresolved_klass()) {
     Klass* tk = constant_pool->klass_at_ignore_error(index, CHECK);
@@ -1376,7 +1376,7 @@
 }
 
 
-void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int index) {
+void Deoptimization::load_class_by_index(const constantPoolHandle& constant_pool, int index) {
   EXCEPTION_MARK;
   load_class_by_index(constant_pool, index, THREAD);
   if (HAS_PENDING_EXCEPTION) {
--- a/hotspot/src/share/vm/runtime/deoptimization.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/deoptimization.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -420,8 +420,8 @@
                                                bool& ret_maybe_prior_trap,
                                                bool& ret_maybe_prior_recompile);
   // class loading support for uncommon trap
-  static void load_class_by_index(constantPoolHandle constant_pool, int index, TRAPS);
-  static void load_class_by_index(constantPoolHandle constant_pool, int index);
+  static void load_class_by_index(const constantPoolHandle& constant_pool, int index, TRAPS);
+  static void load_class_by_index(const constantPoolHandle& constant_pool, int index);
 
   static UnrollBlock* fetch_unroll_info_helper(JavaThread* thread);
 
--- a/hotspot/src/share/vm/runtime/javaCalls.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/javaCalls.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -289,21 +289,20 @@
 // Implementation of JavaCalls (low level)
 
 
-void JavaCalls::call(JavaValue* result, methodHandle method, JavaCallArguments* args, TRAPS) {
+void JavaCalls::call(JavaValue* result, const methodHandle& method, JavaCallArguments* args, TRAPS) {
   // Check if we need to wrap a potential OS exception handler around thread
   // This is used for e.g. Win32 structured exception handlers
   assert(THREAD->is_Java_thread(), "only JavaThreads can make JavaCalls");
   // Need to wrap each and every time, since there might be native code down the
   // stack that has installed its own exception handlers
-  os::os_exception_wrapper(call_helper, result, &method, args, THREAD);
+  os::os_exception_wrapper(call_helper, result, method, args, THREAD);
 }
 
-void JavaCalls::call_helper(JavaValue* result, methodHandle* m, JavaCallArguments* args, TRAPS) {
+void JavaCalls::call_helper(JavaValue* result, const methodHandle& method, JavaCallArguments* args, TRAPS) {
   // During dumping, Java execution environment is not fully initialized. Also, Java execution
   // may cause undesirable side-effects in the class metadata.
   assert(!DumpSharedSpaces, "must not execute Java bytecodes when dumping");
 
-  methodHandle method = *m;
   JavaThread* thread = (JavaThread*)THREAD;
   assert(thread->is_Java_thread(), "must be called by a java thread");
   assert(method.not_null(), "must have a method to call");
@@ -546,7 +545,7 @@
 };
 
 
-void JavaCallArguments::verify(methodHandle method, BasicType return_type,
+void JavaCallArguments::verify(const methodHandle& method, BasicType return_type,
   Thread *thread) {
   guarantee(method->size_of_parameters() == size_of_parameters(), "wrong no. of arguments pushed");
 
--- a/hotspot/src/share/vm/runtime/javaCalls.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/javaCalls.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -189,7 +189,7 @@
   int   size_of_parameters() const { return _size; }
 
   // Verify that pushed arguments fits a given method
-  void verify(methodHandle method, BasicType return_type, Thread *thread);
+  void verify(const methodHandle& method, BasicType return_type, Thread *thread);
 };
 
 // All calls to Java have to go via JavaCalls. Sets up the stack frame
@@ -197,7 +197,7 @@
 //
 
 class JavaCalls: AllStatic {
-  static void call_helper(JavaValue* result, methodHandle* method, JavaCallArguments* args, TRAPS);
+  static void call_helper(JavaValue* result, const methodHandle& method, JavaCallArguments* args, TRAPS);
  public:
   // call_special
   // ------------
@@ -227,7 +227,7 @@
   static void call_static(JavaValue* result, KlassHandle klass, Symbol* name, Symbol* signature, Handle arg1, Handle arg2, TRAPS);
 
   // Low-level interface
-  static void call(JavaValue* result, methodHandle method, JavaCallArguments* args, TRAPS);
+  static void call(JavaValue* result, const methodHandle& method, JavaCallArguments* args, TRAPS);
 };
 
 #endif // SHARE_VM_RUNTIME_JAVACALLS_HPP
--- a/hotspot/src/share/vm/runtime/os.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/os.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1394,7 +1394,7 @@
 // Returns true if the current stack pointer is above the stack shadow
 // pages, false otherwise.
 
-bool os::stack_shadow_pages_available(Thread *thread, methodHandle method) {
+bool os::stack_shadow_pages_available(Thread *thread, const methodHandle& method) {
   assert(StackRedPages > 0 && StackYellowPages > 0,"Sanity check");
   address sp = current_stack_pointer();
   // Check if we have StackShadowPages above the yellow zone.  This parameter
--- a/hotspot/src/share/vm/runtime/os.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/os.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -96,7 +96,7 @@
 const bool ExecMem = true;
 
 // Typedef for structured exception handling support
-typedef void (*java_call_t)(JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread);
+typedef void (*java_call_t)(JavaValue* value, const methodHandle& method, JavaCallArguments* args, Thread* thread);
 
 class MallocTracker;
 
@@ -263,7 +263,7 @@
   static bool uses_stack_guard_pages();
   static bool allocate_stack_guard_pages();
   static void bang_stack_shadow_pages();
-  static bool stack_shadow_pages_available(Thread *thread, methodHandle method);
+  static bool stack_shadow_pages_available(Thread *thread, const methodHandle& method);
 
   // OS interface to Virtual Memory
 
@@ -722,7 +722,7 @@
   static void init_random(long initval);   // initialize random sequence
 
   // Structured OS Exception support
-  static void os_exception_wrapper(java_call_t f, JavaValue* value, methodHandle* method, JavaCallArguments* args, Thread* thread);
+  static void os_exception_wrapper(java_call_t f, JavaValue* value, const methodHandle& method, JavaCallArguments* args, Thread* thread);
 
   // On Posix compatible OS it will simply check core dump limits while on Windows
   // it will check if dump file can be created. Check or prepare a core dump to be
--- a/hotspot/src/share/vm/runtime/reflection.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/reflection.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -612,7 +612,7 @@
 }
 
 
-objArrayHandle Reflection::get_parameter_types(methodHandle method, int parameter_count, oop* return_type, TRAPS) {
+objArrayHandle Reflection::get_parameter_types(const methodHandle& method, int parameter_count, oop* return_type, TRAPS) {
   // Allocate array holding parameter types (java.lang.Class instances)
   objArrayOop m = oopFactory::new_objArray(SystemDictionary::Class_klass(), parameter_count, CHECK_(objArrayHandle()));
   objArrayHandle mirrors (THREAD, m);
@@ -635,7 +635,7 @@
   return mirrors;
 }
 
-objArrayHandle Reflection::get_exception_types(methodHandle method, TRAPS) {
+objArrayHandle Reflection::get_exception_types(const methodHandle& method, TRAPS) {
   return method->resolved_checked_exceptions(THREAD);
 }
 
@@ -663,7 +663,7 @@
 }
 
 
-oop Reflection::new_method(methodHandle method, bool for_constant_pool_access, TRAPS) {
+oop Reflection::new_method(const methodHandle& method, bool for_constant_pool_access, TRAPS) {
   // Allow sun.reflect.ConstantPool to refer to <clinit> methods as java.lang.reflect.Methods.
   assert(!method()->is_initializer() ||
          (for_constant_pool_access && method()->is_static()),
@@ -726,7 +726,7 @@
 }
 
 
-oop Reflection::new_constructor(methodHandle method, TRAPS) {
+oop Reflection::new_constructor(const methodHandle& method, TRAPS) {
   assert(method()->is_initializer(), "should call new_method instead");
 
   instanceKlassHandle  holder (THREAD, method->method_holder());
@@ -824,7 +824,7 @@
 }
 
 
-methodHandle Reflection::resolve_interface_call(instanceKlassHandle klass, methodHandle method,
+methodHandle Reflection::resolve_interface_call(instanceKlassHandle klass, const methodHandle& method,
                                                 KlassHandle recv_klass, Handle receiver, TRAPS) {
   assert(!method.is_null() , "method should not be null");
 
@@ -839,7 +839,7 @@
 }
 
 
-oop Reflection::invoke(instanceKlassHandle klass, methodHandle reflected_method,
+oop Reflection::invoke(instanceKlassHandle klass, const methodHandle& reflected_method,
                        Handle receiver, bool override, objArrayHandle ptypes,
                        BasicType rtype, objArrayHandle args, bool is_method_invoke, TRAPS) {
   ResourceMark rm(THREAD);
--- a/hotspot/src/share/vm/runtime/reflection.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/reflection.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -48,8 +48,8 @@
   static Klass* basic_type_mirror_to_arrayklass(oop basic_type_mirror, TRAPS);
   static oop      basic_type_arrayklass_to_mirror(Klass* basic_type_arrayklass, TRAPS);
 
-  static objArrayHandle get_parameter_types(methodHandle method, int parameter_count, oop* return_type, TRAPS);
-  static objArrayHandle get_exception_types(methodHandle method, TRAPS);
+  static objArrayHandle get_parameter_types(const methodHandle& method, int parameter_count, oop* return_type, TRAPS);
+  static objArrayHandle get_exception_types(const methodHandle& method, TRAPS);
   // Creating new java.lang.reflect.xxx wrappers
   static Handle new_type(Symbol* signature, KlassHandle k, TRAPS);
 
@@ -110,9 +110,9 @@
   //
 
   // Create a java.lang.reflect.Method object based on a method
-  static oop new_method(methodHandle method, bool for_constant_pool_access, TRAPS);
+  static oop new_method(const methodHandle& method, bool for_constant_pool_access, TRAPS);
   // Create a java.lang.reflect.Constructor object based on a method
-  static oop new_constructor(methodHandle method, TRAPS);
+  static oop new_constructor(const methodHandle& method, TRAPS);
   // Create a java.lang.reflect.Field object based on a field descriptor
   static oop new_field(fieldDescriptor* fd, TRAPS);
   // Create a java.lang.reflect.Parameter object based on a
@@ -122,9 +122,16 @@
 
 private:
   // method resolution for invoke
-  static methodHandle resolve_interface_call(instanceKlassHandle klass, methodHandle method, KlassHandle recv_klass, Handle receiver, TRAPS);
+  static methodHandle resolve_interface_call(instanceKlassHandle klass, const methodHandle& method, KlassHandle recv_klass, Handle receiver, TRAPS);
   // Method call (shared by invoke_method and invoke_constructor)
-  static oop  invoke(instanceKlassHandle klass, methodHandle method, Handle receiver, bool override, objArrayHandle ptypes, BasicType rtype, objArrayHandle args, bool is_method_invoke, TRAPS);
+  static oop  invoke(instanceKlassHandle klass,
+                     const methodHandle& method,
+                     Handle receiver,
+                     bool override,
+                     objArrayHandle ptypes,
+                     BasicType rtype,
+                     objArrayHandle args,
+                     bool is_method_invoke, TRAPS);
 
   // Narrowing of basic types. Used to create correct jvalues for
   // boolean, byte, char and short return return values from interpreter
--- a/hotspot/src/share/vm/runtime/relocator.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/relocator.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -125,7 +125,7 @@
 //-----------------------------------------------------------------------------------------------------------
 // Relocator code
 
-Relocator::Relocator(methodHandle m, RelocatorListener* listener) {
+Relocator::Relocator(const methodHandle& m, RelocatorListener* listener) {
   set_method(m);
   set_code_length(method()->code_size());
   set_code_array(NULL);
--- a/hotspot/src/share/vm/runtime/relocator.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/relocator.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
 
 class Relocator : public ResourceObj {
  public:
-  Relocator(methodHandle method, RelocatorListener* listener);
+  Relocator(const methodHandle& method, RelocatorListener* listener);
   methodHandle insert_space_at(int bci, int space, u_char inst_buffer[], TRAPS);
 
   // Callbacks from ChangeItem's
@@ -81,7 +81,7 @@
   void set_compressed_line_number_table_size(int size)        { _compressed_line_number_table_size = size; }
 
   methodHandle method() const               { return _method; }
-  void set_method(methodHandle method)      { _method = method; }
+  void set_method(const methodHandle& method)      { _method = method; }
 
   // This will return a raw bytecode, which is possibly rewritten.
   Bytecodes::Code code_at(int bci) const          { return (Bytecodes::Code) code_array()[bci]; }
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1697,7 +1697,7 @@
 }
 
 #ifdef ASSERT
-void SharedRuntime::check_member_name_argument_is_last_argument(methodHandle method,
+void SharedRuntime::check_member_name_argument_is_last_argument(const methodHandle& method,
                                                                 const BasicType* sig_bt,
                                                                 const VMRegPair* regs) {
   ResourceMark rm;
@@ -2430,7 +2430,7 @@
   return _adapters->new_entry(fingerprint, i2c_entry, c2i_entry, c2i_unverified_entry);
 }
 
-AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(methodHandle method) {
+AdapterHandlerEntry* AdapterHandlerLibrary::get_adapter(const methodHandle& method) {
   // Use customized signature handler.  Need to lock around updates to
   // the AdapterHandlerTable (it is not safe for concurrent readers
   // and a single writer: this could be fixed if it becomes a
@@ -2640,7 +2640,7 @@
  * arguments, and transitions to native.  On return from the native we transition
  * back to java blocking if a safepoint is in progress.
  */
-void AdapterHandlerLibrary::create_native_wrapper(methodHandle method) {
+void AdapterHandlerLibrary::create_native_wrapper(const methodHandle& method) {
   ResourceMark rm;
   nmethod* nm = NULL;
 
--- a/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -361,7 +361,7 @@
   // return value is the maximum number of VMReg stack slots the convention will use.
   static int java_calling_convention(const BasicType* sig_bt, VMRegPair* regs, int total_args_passed, int is_outgoing);
 
-  static void check_member_name_argument_is_last_argument(methodHandle method,
+  static void check_member_name_argument_is_last_argument(const methodHandle& method,
                                                           const BasicType* sig_bt,
                                                           const VMRegPair* regs) NOT_DEBUG_RETURN;
 
@@ -472,7 +472,7 @@
   // is a JNI critical method, or a compiled method handle adapter,
   // such as _invokeBasic, _linkToVirtual, etc.
   static nmethod* generate_native_wrapper(MacroAssembler* masm,
-                                          methodHandle method,
+                                          const methodHandle& method,
                                           int compile_id,
                                           BasicType* sig_bt,
                                           VMRegPair* regs,
@@ -680,8 +680,8 @@
 
   static AdapterHandlerEntry* new_entry(AdapterFingerPrint* fingerprint,
                                         address i2c_entry, address c2i_entry, address c2i_unverified_entry);
-  static void create_native_wrapper(methodHandle method);
-  static AdapterHandlerEntry* get_adapter(methodHandle method);
+  static void create_native_wrapper(const methodHandle& method);
+  static AdapterHandlerEntry* get_adapter(const methodHandle& method);
 
   static void print_handler(const CodeBlob* b) { print_handler_on(tty, b); }
   static void print_handler_on(outputStream* st, const CodeBlob* b);
--- a/hotspot/src/share/vm/runtime/signature.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/signature.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -242,7 +242,7 @@
 
   void do_void()    { ShouldNotReachHere(); }
 
-  Fingerprinter(methodHandle method) : SignatureIterator(method->signature()) {
+  Fingerprinter(const methodHandle& method) : SignatureIterator(method->signature()) {
     mh = method;
     _fingerprint = 0;
   }
@@ -320,7 +320,7 @@
   virtual void pass_double()           { pass_long(); }  // may be same as long
 #endif
 
-  NativeSignatureIterator(methodHandle method) : SignatureIterator(method->signature()) {
+  NativeSignatureIterator(const methodHandle& method) : SignatureIterator(method->signature()) {
     _method = method;
     _offset = 0;
     _jni_offset = 0;
--- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -185,7 +185,7 @@
   }
 }
 
-nmethod* SimpleThresholdPolicy::event(methodHandle method, methodHandle inlinee,
+nmethod* SimpleThresholdPolicy::event(const methodHandle& method, const methodHandle& inlinee,
                                       int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread) {
   if (comp_level == CompLevel_none &&
       JvmtiExport::can_post_interpreter_events() &&
@@ -222,7 +222,7 @@
 }
 
 // Check if the method can be compiled, change level if necessary
-void SimpleThresholdPolicy::compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) {
+void SimpleThresholdPolicy::compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread) {
   assert(level <= TieredStopAtLevel, "Invalid compilation level");
   if (level == CompLevel_none) {
     return;
@@ -249,7 +249,7 @@
 }
 
 // Tell the broker to compile the method
-void SimpleThresholdPolicy::submit_compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread) {
+void SimpleThresholdPolicy::submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread) {
   int hot_count = (bci == InvocationEntryBci) ? mh->invocation_count() : mh->backedge_count();
   CompileBroker::compile_method(mh, bci, level, mh, hot_count, "tiered", thread);
 }
@@ -377,7 +377,7 @@
 
 
 // Handle the invocation event.
-void SimpleThresholdPolicy::method_invocation_event(methodHandle mh, methodHandle imh,
+void SimpleThresholdPolicy::method_invocation_event(const methodHandle& mh, const methodHandle& imh,
                                               CompLevel level, nmethod* nm, JavaThread* thread) {
   if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) {
     CompLevel next_level = call_event(mh(), level);
@@ -389,7 +389,7 @@
 
 // Handle the back branch event. Notice that we can compile the method
 // with a regular entry from here.
-void SimpleThresholdPolicy::method_back_branch_event(methodHandle mh, methodHandle imh,
+void SimpleThresholdPolicy::method_back_branch_event(const methodHandle& mh, const methodHandle& imh,
                                                      int bci, CompLevel level, nmethod* nm, JavaThread* thread) {
   // If the method is already compiling, quickly bail out.
   if (is_compilation_enabled() && !CompileBroker::compilation_is_in_queue(mh)) {
--- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,9 +67,9 @@
   // Print policy-specific information if necessary
   virtual void print_specific(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level) { }
   // Check if the method can be compiled, change level if necessary
-  void compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread);
+  void compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread);
   // Submit a given method for compilation
-  virtual void submit_compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread);
+  virtual void submit_compile(const methodHandle& mh, int bci, CompLevel level, JavaThread* thread);
   // Simple methods are as good being compiled with C1 as C2.
   // This function tells if it's such a function.
   inline bool is_trivial(Method* method);
@@ -87,9 +87,9 @@
     }
     return CompLevel_none;
   }
-  virtual void method_invocation_event(methodHandle method, methodHandle inlinee,
+  virtual void method_invocation_event(const methodHandle& method, const methodHandle& inlinee,
                                        CompLevel level, nmethod* nm, JavaThread* thread);
-  virtual void method_back_branch_event(methodHandle method, methodHandle inlinee,
+  virtual void method_back_branch_event(const methodHandle& method, const methodHandle& inlinee,
                                         int bci, CompLevel level, nmethod* nm, JavaThread* thread);
 public:
   SimpleThresholdPolicy() : _c1_count(0), _c2_count(0) { }
@@ -103,7 +103,7 @@
   virtual void delay_compilation(Method* method) { }
   virtual void disable_compilation(Method* method) { }
   virtual void reprofile(ScopeDesc* trap_scope, bool is_osr);
-  virtual nmethod* event(methodHandle method, methodHandle inlinee,
+  virtual nmethod* event(const methodHandle& method, const methodHandle& inlinee,
                          int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread);
   // Select task is called by CompileBroker. We should return a task or NULL.
   virtual CompileTask* select_task(CompileQueue* compile_queue);
--- a/hotspot/src/share/vm/shark/sharkCompiler.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/shark/sharkCompiler.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -222,7 +222,7 @@
 }
 
 nmethod* SharkCompiler::generate_native_wrapper(MacroAssembler* masm,
-                                                methodHandle    target,
+                                                const methodHandle& target,
                                                 int             compile_id,
                                                 BasicType*      arg_types,
                                                 BasicType       return_type) {
--- a/hotspot/src/share/vm/shark/sharkCompiler.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/shark/sharkCompiler.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -46,7 +46,7 @@
   // Missing feature tests
   bool supports_native() { return true; }
   bool supports_osr()    { return true; }
-  bool can_compile_method(methodHandle method)  {
+  bool can_compile_method(const methodHandle& method)  {
     return ! (method->is_method_handle_intrinsic() || method->is_compiled_lambda_form());
   }
 
@@ -61,7 +61,7 @@
 
   // Generate a wrapper for a native (JNI) method
   nmethod* generate_native_wrapper(MacroAssembler* masm,
-                                   methodHandle    target,
+                                   const methodHandle& target,
                                    int             compile_id,
                                    BasicType*      arg_types,
                                    BasicType       return_type);
--- a/hotspot/src/share/vm/utilities/exceptions.cpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/utilities/exceptions.cpp	Fri Oct 23 16:48:38 2015 -0400
@@ -222,7 +222,7 @@
 }
 
 
-void Exceptions::throw_stack_overflow_exception(Thread* THREAD, const char* file, int line, methodHandle method) {
+void Exceptions::throw_stack_overflow_exception(Thread* THREAD, const char* file, int line, const methodHandle& method) {
   Handle exception;
   if (!THREAD->has_pending_exception()) {
     Klass* k = SystemDictionary::StackOverflowError_klass();
--- a/hotspot/src/share/vm/utilities/exceptions.hpp	Wed Oct 21 13:46:25 2015 +0000
+++ b/hotspot/src/share/vm/utilities/exceptions.hpp	Fri Oct 23 16:48:38 2015 -0400
@@ -163,7 +163,7 @@
                               const char* message,
                               ExceptionMsgToUtf8Mode to_utf8_safe = safe_to_utf8);
 
-  static void throw_stack_overflow_exception(Thread* thread, const char* file, int line, methodHandle method);
+  static void throw_stack_overflow_exception(Thread* thread, const char* file, int line, const methodHandle& method);
 
   // Exception counting for error files of interesting exceptions that may have
   // caused a problem for the jvm