changeset 748:51285b431bb2

Merge
author apetrusenko
date Mon, 04 May 2009 02:57:39 -0700
parents af5d39ca39a3 (diff) b803b1b9e206 (current diff)
children c8f1f4de26c9 20c6f43950b5
files
diffstat 9 files changed, 134 insertions(+), 357 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Mon Apr 27 16:52:18 2009 -0700
+++ b/.hgtags	Mon May 04 02:57:39 2009 -0700
@@ -30,3 +30,4 @@
 032c6af894dae8d939b3dd31d82042549e7793e0 jdk7-b53
 fafab5d5349c7c066d677538db67a1ee0fb33bd2 jdk7-b54
 f8e839c086152da70d6ec5913ba6f9f509282e8d jdk7-b55
+a3fd9e40ff2e854f6169eb6d09d491a28634d04f jdk7-b56
--- a/make/hotspot_version	Mon Apr 27 16:52:18 2009 -0700
+++ b/make/hotspot_version	Mon May 04 02:57:39 2009 -0700
@@ -35,7 +35,7 @@
 
 HS_MAJOR_VER=16
 HS_MINOR_VER=0
-HS_BUILD_NUMBER=01
+HS_BUILD_NUMBER=02
 
 JDK_MAJOR_VER=1
 JDK_MINOR_VER=7
--- a/make/jprt.config	Mon Apr 27 16:52:18 2009 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,275 +0,0 @@
-#!echo "This is not a shell script"
-#
-# Copyright 2006-2008 Sun Microsystems, Inc.  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
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
-# CA 95054 USA or visit www.sun.com if you need additional information or
-# have any questions.
-#  
-#
-
-#############################################################################
-# Error
-error() # message
-{
-  echo "ERROR: $1"
-  exit 6
-}
-# Directory must exist
-dirMustExist() # dir name
-{
-  if [ ! -d "$1" ] ; then
-    error "Directory for $2 does not exist: $1"
-  fi
-}
-# File must exist
-fileMustExist() # dir name
-{
-  if [ ! -f "$1" ] ; then
-    error "File for $2 does not exist: $1"
-  fi
-}
-#############################################################################
-
-# Should be set by JPRT as the 3 basic inputs
-bootdir="${ALT_BOOTDIR}"
-slashjava="${ALT_SLASH_JAVA}"
-jdk_import="${ALT_JDK_IMPORT_PATH}"
-
-# Check input
-dirMustExist "${bootdir}"    ALT_BOOTDIR
-dirMustExist "${slashjava}"  ALT_SLASH_JAVA
-dirMustExist "${jdk_import}" ALT_JDK_IMPORT_PATH
-
-# Uses 'uname -s', but only expect SunOS or Linux, assume Windows otherwise.
-osname=`uname -s`
-if [ "${osname}" = SunOS ] ; then
-   
-    # SOLARIS: Sparc or X86
-    osarch=`uname -p`
-    if [ "${osarch}" = sparc ] ; then
-	solaris_arch=sparc
-    else
-	solaris_arch=i386
-    fi
-
-    if [ "${JPRT_SOLARIS_COMPILER_NAME}" != "" ] ; then
-        compiler_name=${JPRT_SOLARIS_COMPILER_NAME}
-    else
-        if [ "${JPRT_JOB_PRODUCT_RELEASE}" = "jdk6"      -o \
-             "${JPRT_JOB_PRODUCT_RELEASE}" = "jdk6u10"   -o \
-             "${JPRT_JOB_PRODUCT_RELEASE}" = "jdk6u14"   -o \
-             "${JPRT_JOB_PRODUCT_RELEASE}" = "jdk6perf" ] ; then
-            # All jdk6 builds use SS11
-            compiler_name=SS11
-        else
-	    compiler_name=SS12
-        fi
-    fi
-    
-    # Get into path (make sure it matches ALT setting)
-    compiler_path=${slashjava}/devtools/${solaris_arch}/SUNWspro/${compiler_name}/bin
-    dirMustExist "${compiler_path}" COMPILER_PATH
-    path4sdk=${compiler_path}
-
-    # Add basic solaris system paths
-    path4sdk=${path4sdk}:/usr/ccs/bin:/usr/ccs/lib:/usr/bin:/bin:/usr/sfw/bin
-
-    # Get the previous JDK to be used to bootstrap the build
-    path4sdk=${bootdir}/bin:${path4sdk}
-
-    # Find GNU make
-    make=/usr/sfw/bin/gmake
-    if [ ! -f ${make} ] ; then
-	make=/opt/sfw/bin/gmake
-	if [ ! -f ${make} ] ; then
-	    make=${slashjava}/devtools/${solaris_arch}/bin/gnumake
-        fi 
-    fi
-    fileMustExist "${make}" make
-
-    # File creation mask
-    umask 002
-
-elif [ "${osname}" = Linux ] ; then
-   
-    # LINUX: X86, AMD64
-    osarch=`uname -m`
-    if [ "${osarch}" = i686 ] ; then
-	linux_arch=i586
-    elif [ "${osarch}" = x86_64 ] ; then
-	linux_arch=amd64
-    fi
-
-    # Get the compilers into path (make sure it matches ALT setting)
-    compiler_path=/usr/bin
-    dirMustExist "${compiler_path}" COMPILER_PATH
-    path4sdk=${compiler_path}
-    
-    # Add basic paths
-    path4sdk=${path4sdk}:/usr/bin:/bin:/usr/sbin:/sbin
-
-    # Get the previous JDK to be used to bootstrap the build
-    path4sdk=${bootdir}/bin:${path4sdk}
-    
-    # Find GNU make
-    make=/usr/bin/make
-    fileMustExist "${make}" make
-
-    umask 002
-
-else
-
-    # Windows: Differs on CYGWIN vs. MKS, and the compiler available.
-    #   Also, blanks in pathnames gives GNU make headaches, so anything placed
-    #   in any ALT_* variable should be the short windows dosname.
-   
-    # WINDOWS: Install and use MKS or CYGWIN (should have already been done)
-    #   Assumption here is that you are in a shell window via MKS or cygwin.
-    #   MKS install should have defined the environment variable ROOTDIR.
-    #   We also need to figure out which one we have: X86, AMD64
-    if [ "`echo ${PROCESSOR_IDENTIFIER} | fgrep AMD64`" != "" ] ; then
-	windows_arch=amd64
-    else
-	windows_arch=i586
-    fi
-    
-    # We need to determine if we are running a CYGWIN shell or an MKS shell
-    #    (if uname isn't available, then it will be unix_toolset=unknown)
-    unix_toolset=unknown
-    if [ "`uname -a | fgrep Cygwin`" = "" -a -d "${ROOTDIR}" ] ; then
-        # We kind of assume ROOTDIR is where MKS is and it's ok
-        unix_toolset=MKS
-        mkshome=`dosname -s "${ROOTDIR}"`
-	# Utility to convert to short pathnames without spaces
-	dosname="${mkshome}/mksnt/dosname -s"
-        # Most unix utilities are in the mksnt directory of ROOTDIR
-        unixcommand_path="${mkshome}/mksnt"
-        path4sdk="${unixcommand_path}"
-        dirMustExist "${unixcommand_path}" UNIXCOMMAND_PATH
-	devtools_path="${slashjava}/devtools/win32/bin"
-	path4sdk="${devtools_path};${path4sdk}"
-        dirMustExist "${devtools_path}" DEVTOOLS_PATH
-        # Find GNU make
-        make="${devtools_path}/gnumake.exe"
-        fileMustExist "${make}" make
-    elif [ "`uname -a | fgrep Cygwin`" != "" -a -f /bin/cygpath ] ; then
-        # For CYGWIN, uname will have "Cygwin" in it, and /bin/cygpath should exist
-        unix_toolset=CYGWIN
-	# Utility to convert to short pathnames without spaces
-	dosname="/usr/bin/cygpath -a -m -s"
-        # Most unix utilities are in the /usr/bin
-        unixcommand_path="/usr/bin"
-        path4sdk="${unixcommand_path}"
-        dirMustExist "${unixcommand_path}" UNIXCOMMAND_PATH
-        # Find GNU make
-        make="${unixcommand_path}/make.exe"
-        fileMustExist "${make}" make
-    else
-      echo "WARNING: Cannot figure out if this is MKS or CYGWIN"
-    fi
-
-    # WINDOWS: Compiler setup (nasty part)
-    #   NOTE: You can use vcvars32.bat to set PATH, LIB, and INCLUDE.
-    #   NOTE: CYGWIN has a link.exe too, make sure the compilers are first
-    if [ "${windows_arch}" = i586 ] ; then
-        # 32bit Windows compiler settings
-        # VisualStudio .NET 2003 VC++ 7.1 (VS71COMNTOOLS should be defined)
-        vs_root=`${dosname} "${VS71COMNTOOLS}/../.."`
-        # Fill in PATH, LIB, and INCLUDE (unset all others to make sure)
-        vc7_root="${vs_root}/Vc7"
-        compiler_path="${vc7_root}/bin"
-        platform_sdk="${vc7_root}/PlatformSDK"
-        # LIB and INCLUDE must use ; as a separator
-        include4sdk="${vc7_root}/atlmfc/include"
-        include4sdk="${include4sdk};${vc7_root}/include"
-        include4sdk="${include4sdk};${platform_sdk}/include/prerelease"
-        include4sdk="${include4sdk};${platform_sdk}/include"
-        include4sdk="${include4sdk};${vs_root}/SDK/v1.1/include"
-        lib4sdk="${vc7_root}/atlmfc/lib"
-        lib4sdk="${lib4sdk};${vc7_root}/lib"
-        lib4sdk="${lib4sdk};${platform_sdk}/lib/prerelease"
-        lib4sdk="${lib4sdk};${platform_sdk}/lib"
-        lib4sdk="${lib4sdk};${vs_root}/SDK/v1.1/lib"
-        # Search path and DLL locating path
-        #   WARNING: CYGWIN has a link.exe too, make sure compilers are first
-        path4sdk="${vs_root}/Common7/Tools/bin;${path4sdk}"
-	path4sdk="${vs_root}/SDK/v1.1/bin;${path4sdk}"
-        path4sdk="${vs_root}/Common7/Tools;${path4sdk}"
-	path4sdk="${vs_root}/Common7/Tools/bin/prerelease;${path4sdk}"
-        path4sdk="${vs_root}/Common7/IDE;${path4sdk}"
-	path4sdk="${compiler_path};${path4sdk}"
-    elif [ "${windows_arch}" = amd64 ] ; then
-        # AMD64 64bit Windows compiler settings
-	if [ "${MSSDK}" != "" ] ; then
-	    platform_sdk="${MSSDK}"
-	else
-	    platform_sdk=`${dosname} "C:/Program Files/Microsoft Platform SDK/"`
-	fi
-	compiler_path="${platform_sdk}/Bin/win64/x86/AMD64"
-        # LIB and INCLUDE must use ; as a separator
-        include4sdk="${platform_sdk}/Include"
-	include4sdk="${include4sdk};${platform_sdk}/Include/crt/sys"
-	include4sdk="${include4sdk};${platform_sdk}/Include/mfc"
-	include4sdk="${include4sdk};${platform_sdk}/Include/atl"
-	include4sdk="${include4sdk};${platform_sdk}/Include/crt"
-        lib4sdk="${platform_sdk}/Lib/AMD64"
-        lib4sdk="${lib4sdk};${platform_sdk}/Lib/AMD64/atlmfc"
-        # Search path and DLL locating path
-        #   WARNING: CYGWIN has a link.exe too, make sure compilers are first
-        path4sdk="${platform_sdk}/bin;${path4sdk}"
-        path4sdk="${compiler_path};${path4sdk}"
-    fi
-    # Export LIB and INCLUDE
-    unset lib
-    unset Lib
-    LIB="${lib4sdk}"
-    export LIB
-    unset include
-    unset Include
-    INCLUDE="${include4sdk}"
-    export INCLUDE
-    # Set the ALT variable
-    dirMustExist "${compiler_path}" COMPILER_PATH
-    
-    # WINDOWS: Get the previous JDK to be used to bootstrap the build
-    path4sdk="${bootdir}/bin;${path4sdk}"
-
-    # Turn all \\ into /, remove duplicates and trailing /
-    slash_path="`echo ${path4sdk} | sed -e 's@\\\\@/@g' -e 's@//@/@g' -e 's@/$@@' -e 's@/;@;@g'`"
-    
-    # For windows, it's hard to know where the system is, so we just add this
-    #    to PATH.
-    path4sdk="${slash_path};${PATH}"
-    
-    # Convert path4sdk to cygwin style
-    if [ "${unix_toolset}" = CYGWIN ] ; then
-	path4sdk="`/usr/bin/cygpath -p ${path4sdk}`"
-    fi
-
-fi
-
-# Export PATH setting
-PATH="${path4sdk}"
-export PATH
-
-# Unset certain vars
-unset LD_LIBRARY_PATH
-unset LD_LIBRARY_PATH_32
-unset LD_LIBRARY_PATH_64
-
--- a/make/jprt.properties	Mon Apr 27 16:52:18 2009 -0700
+++ b/make/jprt.properties	Mon May 04 02:57:39 2009 -0700
@@ -70,10 +70,33 @@
 jprt.my.solaris.x64.jdk6u14=solaris_x64_5.10
 jprt.my.solaris.x64=${jprt.my.solaris.x64.${jprt.tools.default.release}}
 
-jprt.my.linux.i586=linux_i586
-jprt.my.linux.x64=linux_x64
-jprt.my.windows.i586=windows_i586
-jprt.my.windows.x64=windows_x64
+jprt.my.linux.i586.jdk7=linux_i586_2.6
+jprt.my.linux.i586.jdk6=linux_i586_2.4
+jprt.my.linux.i586.jdk6perf=linux_i586_2.4
+jprt.my.linux.i586.jdk6u10=linux_i586_2.4
+jprt.my.linux.i586.jdk6u14=linux_i586_2.4
+jprt.my.linux.i586=${jprt.my.linux.i586.${jprt.tools.default.release}}
+
+jprt.my.linux.x64.jdk7=linux_x64_2.6
+jprt.my.linux.x64.jdk6=linux_x64_2.4
+jprt.my.linux.x64.jdk6perf=linux_x64_2.4
+jprt.my.linux.x64.jdk6u10=linux_x64_2.4
+jprt.my.linux.x64.jdk6u14=linux_x64_2.4
+jprt.my.linux.x64=${jprt.my.linux.x64.${jprt.tools.default.release}}
+
+jprt.my.windows.i586.jdk7=windows_i586_5.0
+jprt.my.windows.i586.jdk6=windows_i586_5.0
+jprt.my.windows.i586.jdk6perf=windows_i586_5.0
+jprt.my.windows.i586.jdk6u10=windows_i586_5.0
+jprt.my.windows.i586.jdk6u14=windows_i586_5.0
+jprt.my.windows.i586=${jprt.my.windows.i586.${jprt.tools.default.release}}
+
+jprt.my.windows.x64.jdk7=windows_x64_5.2
+jprt.my.windows.x64.jdk6=windows_x64_5.2
+jprt.my.windows.x64.jdk6perf=windows_x64_5.2
+jprt.my.windows.x64.jdk6u10=windows_x64_5.2
+jprt.my.windows.x64.jdk6u14=windows_x64_5.2
+jprt.my.windows.x64=${jprt.my.windows.x64.${jprt.tools.default.release}}
 
 # Standard list of jprt build targets for this source tree
 
--- a/make/linux/makefiles/gcc.make	Mon Apr 27 16:52:18 2009 -0700
+++ b/make/linux/makefiles/gcc.make	Mon May 04 02:57:39 2009 -0700
@@ -113,6 +113,11 @@
 
 OPT_CFLAGS/NOOPT=-O0
 
+# 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. 
+ifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0"
+OPT_CFLAGS/mulnode.o += -O0
+endif
+
 #------------------------------------------------------------------------
 # Linker flags
 
--- a/src/share/vm/interpreter/bytecodeTracer.cpp	Mon Apr 27 16:52:18 2009 -0700
+++ b/src/share/vm/interpreter/bytecodeTracer.cpp	Mon May 04 02:57:39 2009 -0700
@@ -300,6 +300,7 @@
 
 void BytecodePrinter::print_attributes(Bytecodes::Code code, int bci, outputStream* st) {
   // Show attributes of pre-rewritten codes
+  code = Bytecodes::java_code(code);
   // If the code doesn't have any fields there's nothing to print.
   // note this is ==1 because the tableswitch and lookupswitch are
   // zero size (for some reason) and we want to print stuff out for them.
--- a/src/share/vm/runtime/dtraceJSDT.cpp	Mon Apr 27 16:52:18 2009 -0700
+++ b/src/share/vm/runtime/dtraceJSDT.cpp	Mon May 04 02:57:39 2009 -0700
@@ -60,6 +60,11 @@
       methodHandle h_method =
         methodHandle(THREAD, JNIHandles::resolve_jmethod_id(probe->method));
       nmethod* nm = AdapterHandlerLibrary::create_dtrace_nmethod(h_method);
+      if (nm == NULL) {
+        delete probes;
+        THROW_MSG_0(vmSymbols::java_lang_RuntimeException(),
+          "Unable to register DTrace probes (CodeCache: no room for DTrace nmethods).");
+      }
       h_method()->set_not_compilable(CompLevel_highest_tier);
       h_method()->set_code(h_method, nm);
       probes->nmethod_at_put(count++, nm);
--- a/src/share/vm/runtime/sharedRuntime.cpp	Mon Apr 27 16:52:18 2009 -0700
+++ b/src/share/vm/runtime/sharedRuntime.cpp	Mon May 04 02:57:39 2009 -0700
@@ -1776,7 +1776,14 @@
 GrowableArray<uint64_t>* AdapterHandlerLibrary::_fingerprints = NULL;
 GrowableArray<AdapterHandlerEntry* >* AdapterHandlerLibrary::_handlers = NULL;
 const int AdapterHandlerLibrary_size = 16*K;
-u_char                   AdapterHandlerLibrary::_buffer[AdapterHandlerLibrary_size + 32];
+BufferBlob* AdapterHandlerLibrary::_buffer = NULL;
+
+BufferBlob* AdapterHandlerLibrary::buffer_blob() {
+  // Should be called only when AdapterHandlerLibrary_lock is active.
+  if (_buffer == NULL) // Initialize lazily
+      _buffer = BufferBlob::create("adapters", AdapterHandlerLibrary_size);
+  return _buffer;
+}
 
 void AdapterHandlerLibrary::initialize() {
   if (_fingerprints != NULL) return;
@@ -1812,7 +1819,9 @@
   assert(ic_miss != NULL, "must have handler");
 
   int result;
+  NOT_PRODUCT(int code_size);
   BufferBlob *B = NULL;
+  AdapterHandlerEntry* entry = NULL;
   uint64_t fingerprint;
   {
     MutexLocker mu(AdapterHandlerLibrary_lock);
@@ -1850,42 +1859,45 @@
 
     // Create I2C & C2I handlers
     ResourceMark rm;
-    // Improve alignment slightly
-    u_char *buf = (u_char*)(((intptr_t)_buffer + CodeEntryAlignment-1) & ~(CodeEntryAlignment-1));
-    CodeBuffer buffer(buf, AdapterHandlerLibrary_size);
-    short buffer_locs[20];
-    buffer.insts()->initialize_shared_locs((relocInfo*)buffer_locs,
-                                           sizeof(buffer_locs)/sizeof(relocInfo));
-    MacroAssembler _masm(&buffer);
 
-    // Fill in the signature array, for the calling-convention call.
-    int total_args_passed = method->size_of_parameters(); // All args on stack
+    BufferBlob*  buf = buffer_blob(); // the temporary code buffer in CodeCache
+    if (buf != NULL) {
+      CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size());
+      short buffer_locs[20];
+      buffer.insts()->initialize_shared_locs((relocInfo*)buffer_locs,
+                                             sizeof(buffer_locs)/sizeof(relocInfo));
+      MacroAssembler _masm(&buffer);
+
+      // Fill in the signature array, for the calling-convention call.
+      int total_args_passed = method->size_of_parameters(); // All args on stack
 
-    BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType,total_args_passed);
-    VMRegPair  * regs   = NEW_RESOURCE_ARRAY(VMRegPair  ,total_args_passed);
-    int i=0;
-    if( !method->is_static() )  // Pass in receiver first
-      sig_bt[i++] = T_OBJECT;
-    for( SignatureStream ss(method->signature()); !ss.at_return_type(); ss.next()) {
-      sig_bt[i++] = ss.type();  // Collect remaining bits of signature
-      if( ss.type() == T_LONG || ss.type() == T_DOUBLE )
-        sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
-    }
-    assert( i==total_args_passed, "" );
+      BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType,total_args_passed);
+      VMRegPair  * regs   = NEW_RESOURCE_ARRAY(VMRegPair  ,total_args_passed);
+      int i=0;
+      if( !method->is_static() )  // Pass in receiver first
+        sig_bt[i++] = T_OBJECT;
+      for( SignatureStream ss(method->signature()); !ss.at_return_type(); ss.next()) {
+        sig_bt[i++] = ss.type();  // Collect remaining bits of signature
+        if( ss.type() == T_LONG || ss.type() == T_DOUBLE )
+          sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
+      }
+      assert( i==total_args_passed, "" );
 
-    // Now get the re-packed compiled-Java layout.
-    int comp_args_on_stack;
+      // Now get the re-packed compiled-Java layout.
+      int comp_args_on_stack;
 
-    // Get a description of the compiled java calling convention and the largest used (VMReg) stack slot usage
-    comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, false);
+      // Get a description of the compiled java calling convention and the largest used (VMReg) stack slot usage
+      comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, false);
 
-    AdapterHandlerEntry* entry = SharedRuntime::generate_i2c2i_adapters(&_masm,
-                                                                        total_args_passed,
-                                                                        comp_args_on_stack,
-                                                                        sig_bt,
-                                                                        regs);
+      entry = SharedRuntime::generate_i2c2i_adapters(&_masm,
+                                                     total_args_passed,
+                                                     comp_args_on_stack,
+                                                     sig_bt,
+                                                     regs);
 
-    B = BufferBlob::create(AdapterHandlerEntry::name, &buffer);
+      B = BufferBlob::create(AdapterHandlerEntry::name, &buffer);
+      NOT_PRODUCT(code_size = buffer.code_size());
+    }
     if (B == NULL) {
       // CodeCache is full, disable compilation
       // Ought to log this but compile log is only per compile thread
@@ -1912,9 +1924,9 @@
       tty->cr();
       tty->print_cr("i2c argument handler #%d for: %s %s (fingerprint = 0x%llx, %d bytes generated)",
                     _handlers->length(), (method->is_static() ? "static" : "receiver"),
-                    method->signature()->as_C_string(), fingerprint, buffer.code_size() );
+                    method->signature()->as_C_string(), fingerprint, code_size );
       tty->print_cr("c2i argument handler starts at %p",entry->get_c2i_entry());
-      Disassembler::decode(entry->get_i2c_entry(), entry->get_i2c_entry() + buffer.code_size());
+      Disassembler::decode(entry->get_i2c_entry(), entry->get_i2c_entry() + code_size);
     }
 #endif
 
@@ -1982,42 +1994,44 @@
       return nm;
     }
 
-    // Improve alignment slightly
-    u_char* buf = (u_char*)(((intptr_t)_buffer + CodeEntryAlignment-1) & ~(CodeEntryAlignment-1));
-    CodeBuffer buffer(buf, AdapterHandlerLibrary_size);
-    // Need a few relocation entries
-    double locs_buf[20];
-    buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo));
-    MacroAssembler _masm(&buffer);
+    ResourceMark rm;
 
-    // Fill in the signature array, for the calling-convention call.
-    int total_args_passed = method->size_of_parameters();
+    BufferBlob*  buf = buffer_blob(); // the temporary code buffer in CodeCache
+    if (buf != NULL) {
+      CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size());
+      double locs_buf[20];
+      buffer.insts()->initialize_shared_locs((relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo));
+      MacroAssembler _masm(&buffer);
+
+      // Fill in the signature array, for the calling-convention call.
+      int total_args_passed = method->size_of_parameters();
 
-    BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType,total_args_passed);
-    VMRegPair  * regs   = NEW_RESOURCE_ARRAY(VMRegPair  ,total_args_passed);
-    int i=0;
-    if( !method->is_static() )  // Pass in receiver first
-      sig_bt[i++] = T_OBJECT;
-    SignatureStream ss(method->signature());
-    for( ; !ss.at_return_type(); ss.next()) {
-      sig_bt[i++] = ss.type();  // Collect remaining bits of signature
-      if( ss.type() == T_LONG || ss.type() == T_DOUBLE )
-        sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
+      BasicType* sig_bt = NEW_RESOURCE_ARRAY(BasicType,total_args_passed);
+      VMRegPair*   regs = NEW_RESOURCE_ARRAY(VMRegPair,total_args_passed);
+      int i=0;
+      if( !method->is_static() )  // Pass in receiver first
+        sig_bt[i++] = T_OBJECT;
+      SignatureStream ss(method->signature());
+      for( ; !ss.at_return_type(); ss.next()) {
+        sig_bt[i++] = ss.type();  // Collect remaining bits of signature
+        if( ss.type() == T_LONG || ss.type() == T_DOUBLE )
+          sig_bt[i++] = T_VOID;   // Longs & doubles take 2 Java slots
+      }
+      assert( i==total_args_passed, "" );
+      BasicType ret_type = ss.type();
+
+      // Now get the compiled-Java layout as input arguments
+      int comp_args_on_stack;
+      comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, false);
+
+      // Generate the compiled-to-native wrapper code
+      nm = SharedRuntime::generate_native_wrapper(&_masm,
+                                                  method,
+                                                  total_args_passed,
+                                                  comp_args_on_stack,
+                                                  sig_bt,regs,
+                                                  ret_type);
     }
-    assert( i==total_args_passed, "" );
-    BasicType ret_type = ss.type();
-
-    // Now get the compiled-Java layout as input arguments
-    int comp_args_on_stack;
-    comp_args_on_stack = SharedRuntime::java_calling_convention(sig_bt, regs, total_args_passed, false);
-
-    // Generate the compiled-to-native wrapper code
-    nm = SharedRuntime::generate_native_wrapper(&_masm,
-                                                method,
-                                                total_args_passed,
-                                                comp_args_on_stack,
-                                                sig_bt,regs,
-                                                ret_type);
   }
 
   // Must unlock before calling set_code
@@ -2077,18 +2091,20 @@
       return nm;
     }
 
-    // Improve alignment slightly
-    u_char* buf = (u_char*)
-        (((intptr_t)_buffer + CodeEntryAlignment-1) & ~(CodeEntryAlignment-1));
-    CodeBuffer buffer(buf, AdapterHandlerLibrary_size);
-    // Need a few relocation entries
-    double locs_buf[20];
-    buffer.insts()->initialize_shared_locs(
+    ResourceMark rm;
+
+    BufferBlob*  buf = buffer_blob(); // the temporary code buffer in CodeCache
+    if (buf != NULL) {
+      CodeBuffer buffer(buf->instructions_begin(), buf->instructions_size());
+      // Need a few relocation entries
+      double locs_buf[20];
+      buffer.insts()->initialize_shared_locs(
         (relocInfo*)locs_buf, sizeof(locs_buf) / sizeof(relocInfo));
-    MacroAssembler _masm(&buffer);
+      MacroAssembler _masm(&buffer);
 
-    // Generate the compiled-to-native wrapper code
-    nm = SharedRuntime::generate_dtrace_nmethod(&_masm, method);
+      // Generate the compiled-to-native wrapper code
+      nm = SharedRuntime::generate_dtrace_nmethod(&_masm, method);
+    }
   }
   return nm;
 }
--- a/src/share/vm/runtime/sharedRuntime.hpp	Mon Apr 27 16:52:18 2009 -0700
+++ b/src/share/vm/runtime/sharedRuntime.hpp	Mon May 04 02:57:39 2009 -0700
@@ -557,12 +557,13 @@
 
 class AdapterHandlerLibrary: public AllStatic {
  private:
-  static u_char                   _buffer[];  // the temporary code buffer
+  static BufferBlob* _buffer; // the temporary code buffer in CodeCache
   static GrowableArray<uint64_t>* _fingerprints; // the fingerprint collection
   static GrowableArray<AdapterHandlerEntry*> * _handlers; // the corresponding handlers
   enum {
     AbstractMethodHandler = 1 // special handler for abstract methods
   };
+  static BufferBlob* buffer_blob();
   static void initialize();
   static int get_create_adapter_index(methodHandle method);
   static address get_i2c_entry( int index ) {