Merge

Fri, 25 Feb 2011 12:46:46 -0800

author
trims
date
Fri, 25 Feb 2011 12:46:46 -0800
changeset 2577
5a4223160326
parent 2530
f3e07ceeaed9
parent 2576
76b97f73ee91
child 2578
658d198b2e04

Merge

make/windows/platform_amd64 file | annotate | diff | comparison | revisions
make/windows/platform_i486 file | annotate | diff | comparison | revisions
make/windows/platform_ia64 file | annotate | diff | comparison | revisions
src/share/tools/ProjectCreator/Macro.java file | annotate | diff | comparison | revisions
src/share/tools/ProjectCreator/MacroDefinitions.java file | annotate | diff | comparison | revisions
     1.1 --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/StubRoutines.java	Fri Feb 25 11:42:03 2011 -0800
     1.2 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/StubRoutines.java	Fri Feb 25 12:46:46 2011 -0800
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -31,8 +31,7 @@
    1.11  /** Very minimal port for now to get frames working */
    1.12  
    1.13  public class StubRoutines {
    1.14 -  private static AddressField      callStubReturnAddressField;
    1.15 -  private static AddressField      callStubCompiledReturnAddressField;
    1.16 +  private static AddressField callStubReturnAddressField;
    1.17  
    1.18    static {
    1.19      VM.registerVMInitializedObserver(new Observer() {
    1.20 @@ -44,20 +43,7 @@
    1.21  
    1.22    private static synchronized void initialize(TypeDataBase db) {
    1.23      Type type = db.lookupType("StubRoutines");
    1.24 -
    1.25      callStubReturnAddressField = type.getAddressField("_call_stub_return_address");
    1.26 -    // Only some platforms have specific return from compiled to call_stub
    1.27 -    try {
    1.28 -      type = db.lookupType("StubRoutines::x86");
    1.29 -      if (type != null) {
    1.30 -        callStubCompiledReturnAddressField = type.getAddressField("_call_stub_compiled_return");
    1.31 -      }
    1.32 -    } catch (RuntimeException re) {
    1.33 -      callStubCompiledReturnAddressField = null;
    1.34 -    }
    1.35 -    if (callStubCompiledReturnAddressField == null && VM.getVM().getCPU().equals("x86")) {
    1.36 -      throw new InternalError("Missing definition for _call_stub_compiled_return");
    1.37 -    }
    1.38    }
    1.39  
    1.40    public StubRoutines() {
    1.41 @@ -65,20 +51,10 @@
    1.42  
    1.43    public boolean returnsToCallStub(Address returnPC) {
    1.44      Address addr = callStubReturnAddressField.getValue();
    1.45 -    boolean result = false;
    1.46 -    if (addr == null) {
    1.47 -      result = (addr == returnPC);
    1.48 -    } else {
    1.49 -      result = addr.equals(returnPC);
    1.50 -    }
    1.51 -    if (result || callStubCompiledReturnAddressField == null ) return result;
    1.52 -    // Could be a return to compiled code return point
    1.53 -    addr = callStubCompiledReturnAddressField.getValue();
    1.54      if (addr == null) {
    1.55        return (addr == returnPC);
    1.56      } else {
    1.57        return (addr.equals(returnPC));
    1.58      }
    1.59 -
    1.60    }
    1.61  }
     2.1 --- a/make/Makefile	Fri Feb 25 11:42:03 2011 -0800
     2.2 +++ b/make/Makefile	Fri Feb 25 12:46:46 2011 -0800
     2.3 @@ -1,5 +1,5 @@
     2.4  #
     2.5 -# Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
     2.6 +# Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
     2.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8  #
     2.9  # This code is free software; you can redistribute it and/or modify it
    2.10 @@ -43,6 +43,7 @@
    2.11  #  ALT_OUTPUTDIR              Output directory to use for hotspot build
    2.12  #  ALT_EXPORT_PATH            Directory to export hotspot build to
    2.13  #  ALT_JDK_IMPORT_PATH        Current JDK build (only for create_jdk rules)
    2.14 +#  ALT_JDK_TARGET_IMPORT_PATH Current JDK build when cross-compiling
    2.15  #  ALT_BUILD_WIN_SA           Building SA on Windows is disabled by default.
    2.16  #                             Set ALT_BUILD_WIN_SA=1 to enable building SA on
    2.17  #                             Windows.
     3.1 --- a/make/defs.make	Fri Feb 25 11:42:03 2011 -0800
     3.2 +++ b/make/defs.make	Fri Feb 25 12:46:46 2011 -0800
     3.3 @@ -1,5 +1,5 @@
     3.4  #
     3.5 -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
     3.6 +# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
     3.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3.8  #
     3.9  # This code is free software; you can redistribute it and/or modify it
    3.10 @@ -162,6 +162,13 @@
    3.11    JDK_IMPORT_PATH=$(ALT_JDK_IMPORT_PATH)
    3.12  endif
    3.13  
    3.14 +# Other parts of JDK build may require an import JDK that can be executed
    3.15 +# on the build host. For cross-compile builds we also need an import JDK
    3.16 +# that matches the target arch, so for that we set ALT_JDK_TARGET_IMPORT_PATH
    3.17 +ifneq ($(ALT_JDK_TARGET_IMPORT_PATH),)
    3.18 +  JDK_IMPORT_PATH=$(ALT_JDK_TARGET_IMPORT_PATH)
    3.19 +endif
    3.20 +
    3.21  # Find JDK used for javac compiles
    3.22  BOOTDIR=$(SLASH_JAVA)/re/j2se/$(PREVIOUS_JDK_VERSION)/latest/binaries/$(PLATFORM)
    3.23  ifneq ($(ALT_BOOTDIR),)
     4.1 --- a/make/jprt.properties	Fri Feb 25 11:42:03 2011 -0800
     4.2 +++ b/make/jprt.properties	Fri Feb 25 12:46:46 2011 -0800
     4.3 @@ -1,5 +1,5 @@
     4.4  #
     4.5 -# Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
     4.6 +# Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
     4.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4.8  #
     4.9  # This code is free software; you can redistribute it and/or modify it
    4.10 @@ -437,6 +437,7 @@
    4.11      ${jprt.my.windows.x64}-{product|fastdebug}-c2-GCBasher_ParallelGC, \
    4.12      ${jprt.my.windows.x64}-{product|fastdebug}-c2-GCBasher_ParNewGC, \
    4.13      ${jprt.my.windows.x64}-{product|fastdebug}-c2-GCBasher_CMS, \
    4.14 +    ${jprt.my.windows.x64}-{product|fastdebug}-c2-GCBasher_G1, \
    4.15      ${jprt.my.windows.x64}-{product|fastdebug}-c2-GCBasher_ParOldGC, \
    4.16      ${jprt.my.windows.x64}-{product|fastdebug}-c2-GCOld_default, \
    4.17      ${jprt.my.windows.x64}-{product|fastdebug}-c2-GCOld_SerialGC, \
     5.1 --- a/make/windows/create.bat	Fri Feb 25 11:42:03 2011 -0800
     5.2 +++ b/make/windows/create.bat	Fri Feb 25 12:46:46 2011 -0800
     5.3 @@ -1,6 +1,6 @@
     5.4  @echo off
     5.5  REM
     5.6 -REM Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     5.7 +REM Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     5.8  REM DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.9  REM
    5.10  REM This code is free software; you can redistribute it and/or modify it
    5.11 @@ -50,9 +50,7 @@
    5.12  
    5.13  
    5.14  :testit
    5.15 -cl 2>&1 | grep "IA-64" >NUL
    5.16 -if %errorlevel% == 0 goto isia64
    5.17 -cl 2>&1 | grep "AMD64" >NUL
    5.18 +cl 2>&1 | grep "x64" >NUL
    5.19  if %errorlevel% == 0 goto amd64
    5.20  set ARCH=x86
    5.21  set BUILDARCH=i486
    5.22 @@ -64,12 +62,6 @@
    5.23  set BUILDARCH=amd64
    5.24  set Platform_arch=x86
    5.25  set Platform_arch_model=x86_64
    5.26 -goto done
    5.27 -:isia64
    5.28 -set ARCH=ia64
    5.29 -set BUILDARCH=ia64
    5.30 -set Platform_arch=ia64
    5.31 -set Platform_arch_model=ia64
    5.32  :done
    5.33  
    5.34  setlocal
    5.35 @@ -81,7 +73,7 @@
    5.36  REM Set HotSpotWorkSpace to the directy two steps above this script
    5.37  for %%i in ("%~dp0..") do ( set HotSpotWorkSpace=%%~dpi)
    5.38  set HotSpotBuildRoot=%HotSpotWorkSpace%build
    5.39 -set HotSpotBuildSpace=%HotSpotBuildRoot%\vs
    5.40 +set HotSpotBuildSpace=%HotSpotBuildRoot%\vs-%BUILDARCH%
    5.41  set HotSpotJDKDist=%1
    5.42  
    5.43  
    5.44 @@ -89,9 +81,9 @@
    5.45  for /F %%i in ('sh %HotSpotWorkSpace%/make/windows/get_msc_ver.sh') do set %%i
    5.46  
    5.47  echo **************************************************************
    5.48 -set ProjectFile=jvm.vcproj
    5.49 +set ProjectFile=%HotSpotBuildSpace%\jvm.vcproj
    5.50  if "%MSC_VER%" == "1200" (
    5.51 -set ProjectFile=jvm.dsp
    5.52 +set ProjectFile=%HotSpotBuildSpace%\jvm.dsp
    5.53  echo Will generate VC6 project {unsupported}
    5.54  ) else (
    5.55  if "%MSC_VER%" == "1400" (
    5.56 @@ -163,7 +155,7 @@
    5.57  )
    5.58  
    5.59  REM force regneration of ProjectFile
    5.60 -if exist %HotSpotBuildSpace%\%ProjectFile% del %HotSpotBuildSpace%\%ProjectFile%
    5.61 +if exist %ProjectFile% del %ProjectFile%
    5.62  
    5.63  for /D %%i in (compiler1, compiler2, tiered, core, kernel) do (
    5.64  echo -- %%i --
    5.65 @@ -182,6 +174,7 @@
    5.66  echo BUILDARCH=%BUILDARCH%                 >>    %HotSpotBuildSpace%\%%i\local.make
    5.67  echo Platform_arch=%Platform_arch%         >>    %HotSpotBuildSpace%\%%i\local.make
    5.68  echo Platform_arch_model=%Platform_arch_model% >>    %HotSpotBuildSpace%\%%i\local.make
    5.69 +echo MSC_VER=%MSC_VER% 			   >>    %HotSpotBuildSpace%\%%i\local.make
    5.70  
    5.71  for /D %%j in (debug, fastdebug, product) do (
    5.72  if NOT EXIST %HotSpotBuildSpace%\%%i\%%j mkdir %HotSpotBuildSpace%\%%i\%%j
    5.73 @@ -196,7 +189,7 @@
    5.74  pushd %HotSpotBuildRoot%
    5.75  
    5.76  REM It doesn't matter which variant we use here, "compiler1" is as good as any of the others - we need the common variables
    5.77 -nmake /nologo /F %HotSpotWorkSpace%/make/windows/projectfiles/common/Makefile LOCAL_MAKE=%HotSpotBuildSpace%\compiler1\local.make %HotSpotBuildRoot%/%ProjectFile%
    5.78 +nmake /nologo /F %HotSpotWorkSpace%/make/windows/projectfiles/common/Makefile LOCAL_MAKE=%HotSpotBuildSpace%\compiler1\local.make %ProjectFile%
    5.79  
    5.80  popd
    5.81  
     6.1 --- a/make/windows/makefiles/compile.make	Fri Feb 25 11:42:03 2011 -0800
     6.2 +++ b/make/windows/makefiles/compile.make	Fri Feb 25 12:46:46 2011 -0800
     6.3 @@ -1,5 +1,5 @@
     6.4  #
     6.5 -# Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
     6.6 +# Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     6.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.8  #
     6.9  # This code is free software; you can redistribute it and/or modify it
    6.10 @@ -141,9 +141,6 @@
    6.11  !endif
    6.12  !endif
    6.13  
    6.14 -# Add what version of the compiler we think this is to the compile line
    6.15 -CPP_FLAGS=$(CPP_FLAGS) /D "MSC_VER=$(MSC_VER)"
    6.16 -
    6.17  # By default, we do not want to use the debug version of the msvcrt.dll file
    6.18  #   but if MFC_DEBUG is defined in the environment it will be used.
    6.19  MS_RUNTIME_OPTION = /MD
     7.1 --- a/make/windows/makefiles/projectcreator.make	Fri Feb 25 11:42:03 2011 -0800
     7.2 +++ b/make/windows/makefiles/projectcreator.make	Fri Feb 25 12:46:46 2011 -0800
     7.3 @@ -1,5 +1,5 @@
     7.4  #
     7.5 -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     7.6 +# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
     7.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.8  #
     7.9  # This code is free software; you can redistribute it and/or modify it
    7.10 @@ -36,8 +36,6 @@
    7.11          $(WorkSpace)\src\share\tools\ProjectCreator\DirectoryTree.java \
    7.12          $(WorkSpace)\src\share\tools\ProjectCreator\DirectoryTreeNode.java \
    7.13          $(WorkSpace)\src\share\tools\ProjectCreator\FileFormatException.java \
    7.14 -        $(WorkSpace)\src\share\tools\ProjectCreator\Macro.java \
    7.15 -        $(WorkSpace)\src\share\tools\ProjectCreator\MacroDefinitions.java \
    7.16          $(WorkSpace)\src\share\tools\ProjectCreator\ProjectCreator.java \
    7.17          $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatform.java \
    7.18          $(WorkSpace)\src\share\tools\ProjectCreator\WinGammaPlatformVC6.java \
    7.19 @@ -50,6 +48,10 @@
    7.20  
    7.21  # This is only used internally
    7.22  ProjectCreatorIncludesPRIVATE=\
    7.23 +        -relativeInclude src\closed\share\vm \
    7.24 +        -relativeInclude src\closed\os\windows\vm \
    7.25 +        -relativeInclude src\closed\os_cpu\windows_$(Platform_arch)\vm \
    7.26 +        -relativeInclude src\closed\cpu\$(Platform_arch)\vm \
    7.27          -relativeInclude src\share\vm \
    7.28          -relativeInclude src\share\vm\prims \
    7.29          -relativeInclude src\os\windows\vm \
    7.30 @@ -84,7 +86,7 @@
    7.31          -buildBase $(HOTSPOTBUILDSPACE)\%f\%b \
    7.32          -startAt src \
    7.33          -compiler $(VcVersion) \
    7.34 -        -projectFileName $(HOTSPOTBUILDROOT)\$(ProjectFile) \
    7.35 +        -projectFileName $(HOTSPOTBUILDSPACE)\$(ProjectFile) \
    7.36          -jdkTargetRoot $(HOTSPOTJDKDIST) \
    7.37          -define ALIGN_STACK_FRAMES \
    7.38          -define VM_LITTLE_ENDIAN \
    7.39 @@ -106,13 +108,20 @@
    7.40  # Add in build-specific options
    7.41  !if "$(BUILDARCH)" == "i486"
    7.42  ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \
    7.43 +	-platformName Win32 \
    7.44          -define IA32 \
    7.45          -ignorePath x86_64 \
    7.46          -define TARGET_ARCH_MODEL_x86_32
    7.47  !else
    7.48 +!if "$(BUILDARCH)" == "amd64"
    7.49  ProjectCreatorIDEOptions=$(ProjectCreatorIDEOptions) \
    7.50 +	-platformName x64 \
    7.51 +        -define AMD64 \
    7.52 +	-define _LP64 \
    7.53          -ignorePath x86_32 \
    7.54 -        -define TARGET_ARCH_MODEL_x86_64
    7.55 +        -define TARGET_ARCH_MODEL_x86_64 \
    7.56 +	-define TARGET_OS_ARCH_MODEL_windows_x86_64
    7.57 +!endif
    7.58  !endif
    7.59  
    7.60  ProjectCreatorIDEOptionsIgnoreCompiler1=\
     8.1 --- a/make/windows/makefiles/rules.make	Fri Feb 25 11:42:03 2011 -0800
     8.2 +++ b/make/windows/makefiles/rules.make	Fri Feb 25 12:46:46 2011 -0800
     8.3 @@ -1,5 +1,5 @@
     8.4  #
     8.5 -# Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     8.6 +# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
     8.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.8  #
     8.9  # This code is free software; you can redistribute it and/or modify it
    8.10 @@ -53,7 +53,7 @@
    8.11  !if "$(MSC_VER)" == "1200"
    8.12  
    8.13  VcVersion=VC6
    8.14 -ProjectFile=vm.dsp
    8.15 +ProjectFile=jvm.dsp
    8.16  
    8.17  !elseif "$(MSC_VER)" == "1400"
    8.18  
     9.1 --- a/make/windows/platform_amd64	Fri Feb 25 11:42:03 2011 -0800
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,15 +0,0 @@
     9.4 -// Platform file for win32 NT platform
     9.5 -
     9.6 -os_family = windows
     9.7 -
     9.8 -arch = x86
     9.9 -
    9.10 -arch_model = x86_64
    9.11 -
    9.12 -os_arch = windows_x86
    9.13 -
    9.14 -os_arch_model = windows_x86_64
    9.15 -
    9.16 -lib_arch = amd64
    9.17 -
    9.18 -compiler = visCPP
    10.1 --- a/make/windows/platform_i486	Fri Feb 25 11:42:03 2011 -0800
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,15 +0,0 @@
    10.4 -// Platform file for windows platform
    10.5 -
    10.6 -os_family = windows
    10.7 -
    10.8 -arch = x86
    10.9 -
   10.10 -arch_model = x86_32
   10.11 -
   10.12 -os_arch = windows_x86
   10.13 -
   10.14 -os_arch_model = windows_x86_32
   10.15 -
   10.16 -lib_arch = i386
   10.17 -
   10.18 -compiler = visCPP
    11.1 --- a/make/windows/platform_ia64	Fri Feb 25 11:42:03 2011 -0800
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,12 +0,0 @@
    11.4 -// Platform file for Itanium Windows platform $Revision: 1.0 $
    11.5 -
    11.6 -os_family = win32
    11.7 -
    11.8 -arch = ia64
    11.9 -
   11.10 -os_arch = win32_ia64
   11.11 -
   11.12 -compiler = visCPP
   11.13 -
   11.14 -gnu_dis_arch = ia64
   11.15 -
    12.1 --- a/make/windows/projectfiles/common/Makefile	Fri Feb 25 11:42:03 2011 -0800
    12.2 +++ b/make/windows/projectfiles/common/Makefile	Fri Feb 25 12:46:46 2011 -0800
    12.3 @@ -1,5 +1,5 @@
    12.4  #
    12.5 -# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    12.6 +# Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    12.7  # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.8  #
    12.9  # This code is free software; you can redistribute it and/or modify it
   12.10 @@ -54,8 +54,6 @@
   12.11  JvmtiOutDir=$(HOTSPOTBUILDSPACE)\$(Variant)\generated\jvmtifiles
   12.12  !include $(HOTSPOTWORKSPACE)/make/windows/makefiles/jvmti.make
   12.13  
   12.14 -Platform=$(HOTSPOTWORKSPACE)/make/windows/platform_$(BUILDARCH)
   12.15 -
   12.16  !if "$(Variant)" == "compiler2"
   12.17  # Pick up rules for building adlc
   12.18  !include $(HOTSPOTWORKSPACE)/make/windows/makefiles/adlc.make
   12.19 @@ -105,17 +103,16 @@
   12.20  !endif
   12.21  
   12.22  ProjectCreatorIDEOptions =       $(ProjectCreatorIDEOptions) \
   12.23 -      -platform            $(Platform) \
   12.24        -define              HOTSPOT_RELEASE_VERSION=\\\"$(HOTSPOT_RELEASE_VERSION)\\\" \
   12.25        -define              JRE_RELEASE_VERSION=\\\"$(JRE_RELEASE_VERSION)\\\" \
   12.26        -define              HOTSPOT_VM_DISTRO=\\\"$(HOTSPOT_VM_DISTRO)\\\"
   12.27  
   12.28 -$(HOTSPOTBUILDROOT)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class
   12.29 +$(HOTSPOTBUILDSPACE)/$(ProjectFile): $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class
   12.30  	@$(RUN_JAVA) -Djava.class.path=$(HOTSPOTBUILDSPACE)/classes ProjectCreator WinGammaPlatform$(VcVersion) $(ProjectCreatorIDEOptions)
   12.31  
   12.32  clean:
   12.33  	@rm -rf $(HOTSPOTBUILDSPACE)/classes
   12.34 -	@rm -r ../$(ProjectFile)
   12.35 +	@rm -r $(HOTSPOTBUILDSPACE)/$(ProjectFile)
   12.36  
   12.37  $(HOTSPOTBUILDSPACE)/classes/ProjectCreator.class: $(ProjectCreatorSources)
   12.38  	@if exist $(HOTSPOTBUILDSPACE)\classes rmdir /s /q $(HOTSPOTBUILDSPACE)\classes
    13.1 --- a/src/cpu/sparc/vm/assembler_sparc.cpp	Fri Feb 25 11:42:03 2011 -0800
    13.2 +++ b/src/cpu/sparc/vm/assembler_sparc.cpp	Fri Feb 25 12:46:46 2011 -0800
    13.3 @@ -2407,14 +2407,23 @@
    13.4  #endif
    13.5  
    13.6  
    13.7 -void MacroAssembler::load_sized_value(Address src, Register dst,
    13.8 -                                      size_t size_in_bytes, bool is_signed) {
    13.9 +void MacroAssembler::load_sized_value(Address src, Register dst, size_t size_in_bytes, bool is_signed) {
   13.10    switch (size_in_bytes) {
   13.11 -  case  8: ldx(src, dst); break;
   13.12 -  case  4: ld( src, dst); break;
   13.13 -  case  2: is_signed ? ldsh(src, dst) : lduh(src, dst); break;
   13.14 -  case  1: is_signed ? ldsb(src, dst) : ldub(src, dst); break;
   13.15 -  default: ShouldNotReachHere();
   13.16 +  case  8:  ld_long(src, dst); break;
   13.17 +  case  4:  ld(     src, dst); break;
   13.18 +  case  2:  is_signed ? ldsh(src, dst) : lduh(src, dst); break;
   13.19 +  case  1:  is_signed ? ldsb(src, dst) : ldub(src, dst); break;
   13.20 +  default:  ShouldNotReachHere();
   13.21 +  }
   13.22 +}
   13.23 +
   13.24 +void MacroAssembler::store_sized_value(Register src, Address dst, size_t size_in_bytes) {
   13.25 +  switch (size_in_bytes) {
   13.26 +  case  8:  st_long(src, dst); break;
   13.27 +  case  4:  st(     src, dst); break;
   13.28 +  case  2:  sth(    src, dst); break;
   13.29 +  case  1:  stb(    src, dst); break;
   13.30 +  default:  ShouldNotReachHere();
   13.31    }
   13.32  }
   13.33  
    14.1 --- a/src/cpu/sparc/vm/assembler_sparc.hpp	Fri Feb 25 11:42:03 2011 -0800
    14.2 +++ b/src/cpu/sparc/vm/assembler_sparc.hpp	Fri Feb 25 12:46:46 2011 -0800
    14.3 @@ -2330,8 +2330,9 @@
    14.4    void lcmp( Register Ra, Register Rb, Register Rresult);
    14.5  #endif
    14.6  
    14.7 -  // Loading values by size and signed-ness
    14.8 -  void load_sized_value(Address src, Register dst, size_t size_in_bytes, bool is_signed);
    14.9 +  // Load and store values by size and signed-ness
   14.10 +  void load_sized_value( Address src, Register dst, size_t size_in_bytes, bool is_signed);
   14.11 +  void store_sized_value(Register src, Address dst, size_t size_in_bytes);
   14.12  
   14.13    void float_cmp( bool is_float, int unordered_result,
   14.14                    FloatRegister Fa, FloatRegister Fb,
    15.1 --- a/src/cpu/sparc/vm/methodHandles_sparc.cpp	Fri Feb 25 11:42:03 2011 -0800
    15.2 +++ b/src/cpu/sparc/vm/methodHandles_sparc.cpp	Fri Feb 25 12:46:46 2011 -0800
    15.3 @@ -596,16 +596,9 @@
    15.4          __ st_ptr(O1_scratch, Address(O0_argslot, 0));
    15.5        } else {
    15.6          Address prim_value_addr(O1_scratch, java_lang_boxing_object::value_offset_in_bytes(arg_type));
    15.7 -        __ load_sized_value(prim_value_addr, O2_scratch, type2aelembytes(arg_type), is_signed_subword_type(arg_type));
    15.8 -        if (arg_slots == 2) {
    15.9 -          __ unimplemented("not yet tested");
   15.10 -#ifndef _LP64
   15.11 -          __ signx(O2_scratch, O3_scratch);  // Sign extend
   15.12 -#endif
   15.13 -          __ st_long(O2_scratch, Address(O0_argslot, 0));  // Uses O2/O3 on !_LP64
   15.14 -        } else {
   15.15 -          __ st_ptr( O2_scratch, Address(O0_argslot, 0));
   15.16 -        }
   15.17 +        const int arg_size = type2aelembytes(arg_type);
   15.18 +        __ load_sized_value(prim_value_addr, O2_scratch, arg_size, is_signed_subword_type(arg_type));
   15.19 +        __ store_sized_value(O2_scratch, Address(O0_argslot, 0), arg_size);  // long store uses O2/O3 on !_LP64
   15.20        }
   15.21  
   15.22        if (direct_to_method) {
   15.23 @@ -784,11 +777,9 @@
   15.24        switch (ek) {
   15.25        case _adapter_opt_i2l:
   15.26          {
   15.27 -          __ ldsw(arg_lsw, O2_scratch);      // Load LSW
   15.28 -#ifndef _LP64
   15.29 -          __ signx(O2_scratch, O3_scratch);  // Sign extend
   15.30 -#endif
   15.31 -          __ st_long(O2_scratch, arg_msw);   // Uses O2/O3 on !_LP64
   15.32 +          __ ldsw(arg_lsw, O2_scratch);                           // Load LSW
   15.33 +          NOT_LP64(__ srlx(O2_scratch, BitsPerInt, O3_scratch));  // Move high bits to lower bits for std
   15.34 +          __ st_long(O2_scratch, arg_msw);                        // Uses O2/O3 on !_LP64
   15.35          }
   15.36          break;
   15.37        case _adapter_opt_unboxl:
    16.1 --- a/src/cpu/sparc/vm/sparc.ad	Fri Feb 25 11:42:03 2011 -0800
    16.2 +++ b/src/cpu/sparc/vm/sparc.ad	Fri Feb 25 12:46:46 2011 -0800
    16.3 @@ -8125,6 +8125,17 @@
    16.4  %}
    16.5  #endif
    16.6  
    16.7 +instruct cmpLTMask0( iRegI dst, iRegI src, immI0 zero, flagsReg ccr ) %{
    16.8 +  match(Set dst (CmpLTMask src zero));
    16.9 +  effect(KILL ccr);
   16.10 +  size(4);
   16.11 +  format %{ "SRA    $src,#31,$dst\t# cmpLTMask0" %}
   16.12 +  ins_encode %{
   16.13 +    __ sra($src$$Register, 31, $dst$$Register);
   16.14 +  %}
   16.15 +  ins_pipe(ialu_reg_imm);
   16.16 +%}
   16.17 +
   16.18  instruct cmpLTMask_reg_reg( iRegI dst, iRegI p, iRegI q, flagsReg ccr ) %{
   16.19    match(Set dst (CmpLTMask p q));
   16.20    effect( KILL ccr );
   16.21 @@ -8144,19 +8155,7 @@
   16.22  
   16.23    format %{ "SUBcc  $p,$q,$p\t! p' = p-q\n\t"
   16.24              "ADD    $p,$y,$tmp\t! g3=p-q+y\n\t"
   16.25 -            "MOVl   $tmp,$p\t! p' < 0 ? p'+y : p'" %}
   16.26 -  ins_encode( enc_cadd_cmpLTMask(p, q, y, tmp) );
   16.27 -  ins_pipe( cadd_cmpltmask );
   16.28 -%}
   16.29 -
   16.30 -instruct cadd_cmpLTMask2( iRegI p, iRegI q, iRegI y, iRegI tmp, flagsReg ccr ) %{
   16.31 -  match(Set p (AddI (SubI p q) (AndI (CmpLTMask p q) y)));
   16.32 -  effect( KILL ccr, TEMP tmp);
   16.33 -  ins_cost(DEFAULT_COST*3);
   16.34 -
   16.35 -  format %{ "SUBcc  $p,$q,$p\t! p' = p-q\n\t"
   16.36 -            "ADD    $p,$y,$tmp\t! g3=p-q+y\n\t"
   16.37 -            "MOVl   $tmp,$p\t! p' < 0 ? p'+y : p'" %}
   16.38 +            "MOVlt  $tmp,$p\t! p' < 0 ? p'+y : p'" %}
   16.39    ins_encode( enc_cadd_cmpLTMask(p, q, y, tmp) );
   16.40    ins_pipe( cadd_cmpltmask );
   16.41  %}
    17.1 --- a/src/cpu/x86/vm/assembler_x86.cpp	Fri Feb 25 11:42:03 2011 -0800
    17.2 +++ b/src/cpu/x86/vm/assembler_x86.cpp	Fri Feb 25 12:46:46 2011 -0800
    17.3 @@ -2349,6 +2349,17 @@
    17.4    a_byte(p);
    17.5  }
    17.6  
    17.7 +void Assembler::por(XMMRegister dst, XMMRegister src) {
    17.8 +  NOT_LP64(assert(VM_Version::supports_sse2(), ""));
    17.9 +
   17.10 +  emit_byte(0x66);
   17.11 +  int  encode = prefix_and_encode(dst->encoding(), src->encoding());
   17.12 +  emit_byte(0x0F);
   17.13 +
   17.14 +  emit_byte(0xEB);
   17.15 +  emit_byte(0xC0 | encode);
   17.16 +}
   17.17 +
   17.18  void Assembler::pshufd(XMMRegister dst, XMMRegister src, int mode) {
   17.19    assert(isByte(mode), "invalid value");
   17.20    NOT_LP64(assert(VM_Version::supports_sse2(), ""));
   17.21 @@ -6528,20 +6539,39 @@
   17.22    return off;
   17.23  }
   17.24  
   17.25 -void MacroAssembler::load_sized_value(Register dst, Address src,
   17.26 -                                      size_t size_in_bytes, bool is_signed) {
   17.27 +void MacroAssembler::load_sized_value(Register dst, Address src, size_t size_in_bytes, bool is_signed, Register dst2) {
   17.28    switch (size_in_bytes) {
   17.29  #ifndef _LP64
   17.30 -  // For case 8, caller is responsible for manually loading
   17.31 -  // the second word into another register.
   17.32 -  case  8: movl(dst, src); break;
   17.33 +  case  8:
   17.34 +    assert(dst2 != noreg, "second dest register required");
   17.35 +    movl(dst,  src);
   17.36 +    movl(dst2, src.plus_disp(BytesPerInt));
   17.37 +    break;
   17.38  #else
   17.39 -  case  8: movq(dst, src); break;
   17.40 +  case  8:  movq(dst, src); break;
   17.41  #endif
   17.42 -  case  4: movl(dst, src); break;
   17.43 -  case  2: is_signed ? load_signed_short(dst, src) : load_unsigned_short(dst, src); break;
   17.44 -  case  1: is_signed ? load_signed_byte( dst, src) : load_unsigned_byte( dst, src); break;
   17.45 -  default: ShouldNotReachHere();
   17.46 +  case  4:  movl(dst, src); break;
   17.47 +  case  2:  is_signed ? load_signed_short(dst, src) : load_unsigned_short(dst, src); break;
   17.48 +  case  1:  is_signed ? load_signed_byte( dst, src) : load_unsigned_byte( dst, src); break;
   17.49 +  default:  ShouldNotReachHere();
   17.50 +  }
   17.51 +}
   17.52 +
   17.53 +void MacroAssembler::store_sized_value(Address dst, Register src, size_t size_in_bytes, Register src2) {
   17.54 +  switch (size_in_bytes) {
   17.55 +#ifndef _LP64
   17.56 +  case  8:
   17.57 +    assert(src2 != noreg, "second source register required");
   17.58 +    movl(dst,                        src);
   17.59 +    movl(dst.plus_disp(BytesPerInt), src2);
   17.60 +    break;
   17.61 +#else
   17.62 +  case  8:  movq(dst, src); break;
   17.63 +#endif
   17.64 +  case  4:  movl(dst, src); break;
   17.65 +  case  2:  movw(dst, src); break;
   17.66 +  case  1:  movb(dst, src); break;
   17.67 +  default:  ShouldNotReachHere();
   17.68    }
   17.69  }
   17.70  
   17.71 @@ -8636,7 +8666,7 @@
   17.72  // Compare strings.
   17.73  void MacroAssembler::string_compare(Register str1, Register str2,
   17.74                                      Register cnt1, Register cnt2, Register result,
   17.75 -                                    XMMRegister vec1, XMMRegister vec2) {
   17.76 +                                    XMMRegister vec1) {
   17.77    Label LENGTH_DIFF_LABEL, POP_LABEL, DONE_LABEL, WHILE_HEAD_LABEL;
   17.78  
   17.79    // Compute the minimum of the string lengths and the
   17.80 @@ -8683,62 +8713,85 @@
   17.81      bind(LSkip2);
   17.82    }
   17.83  
   17.84 -  // Advance to next character
   17.85 -  addptr(str1, 2);
   17.86 -  addptr(str2, 2);
   17.87 +  Address::ScaleFactor scale = Address::times_2;
   17.88 +  int stride = 8;
   17.89 +
   17.90 +  // Advance to next element
   17.91 +  addptr(str1, 16/stride);
   17.92 +  addptr(str2, 16/stride);
   17.93  
   17.94    if (UseSSE42Intrinsics) {
   17.95 -    // With SSE4.2, use double quad vector compare
   17.96 -    Label COMPARE_VECTORS, VECTOR_NOT_EQUAL, COMPARE_TAIL;
   17.97 +    Label COMPARE_WIDE_VECTORS, VECTOR_NOT_EQUAL, COMPARE_TAIL;
   17.98 +    int pcmpmask = 0x19;
   17.99      // Setup to compare 16-byte vectors
  17.100 -    movl(cnt1, cnt2);
  17.101 -    andl(cnt2, 0xfffffff8); // cnt2 holds the vector count
  17.102 -    andl(cnt1, 0x00000007); // cnt1 holds the tail count
  17.103 -    testl(cnt2, cnt2);
  17.104 +    movl(result, cnt2);
  17.105 +    andl(cnt2, ~(stride - 1));   // cnt2 holds the vector count
  17.106      jccb(Assembler::zero, COMPARE_TAIL);
  17.107  
  17.108 -    lea(str2, Address(str2, cnt2, Address::times_2));
  17.109 -    lea(str1, Address(str1, cnt2, Address::times_2));
  17.110 -    negptr(cnt2);
  17.111 -
  17.112 -    bind(COMPARE_VECTORS);
  17.113 -    movdqu(vec1, Address(str1, cnt2, Address::times_2));
  17.114 -    movdqu(vec2, Address(str2, cnt2, Address::times_2));
  17.115 -    pxor(vec1, vec2);
  17.116 -    ptest(vec1, vec1);
  17.117 -    jccb(Assembler::notZero, VECTOR_NOT_EQUAL);
  17.118 -    addptr(cnt2, 8);
  17.119 -    jcc(Assembler::notZero, COMPARE_VECTORS);
  17.120 -    jmpb(COMPARE_TAIL);
  17.121 +    lea(str1, Address(str1, result, scale));
  17.122 +    lea(str2, Address(str2, result, scale));
  17.123 +    negptr(result);
  17.124 +
  17.125 +    // pcmpestri
  17.126 +    //   inputs:
  17.127 +    //     vec1- substring
  17.128 +    //     rax - negative string length (elements count)
  17.129 +    //     mem - scaned string
  17.130 +    //     rdx - string length (elements count)
  17.131 +    //     pcmpmask - cmp mode: 11000 (string compare with negated result)
  17.132 +    //               + 00 (unsigned bytes) or  + 01 (unsigned shorts)
  17.133 +    //   outputs:
  17.134 +    //     rcx - first mismatched element index
  17.135 +    assert(result == rax && cnt2 == rdx && cnt1 == rcx, "pcmpestri");
  17.136 +
  17.137 +    bind(COMPARE_WIDE_VECTORS);
  17.138 +    movdqu(vec1, Address(str1, result, scale));
  17.139 +    pcmpestri(vec1, Address(str2, result, scale), pcmpmask);
  17.140 +    // After pcmpestri cnt1(rcx) contains mismatched element index
  17.141 +
  17.142 +    jccb(Assembler::below, VECTOR_NOT_EQUAL);  // CF==1
  17.143 +    addptr(result, stride);
  17.144 +    subptr(cnt2, stride);
  17.145 +    jccb(Assembler::notZero, COMPARE_WIDE_VECTORS);
  17.146 +
  17.147 +    // compare wide vectors tail
  17.148 +    testl(result, result);
  17.149 +    jccb(Assembler::zero, LENGTH_DIFF_LABEL);
  17.150 +
  17.151 +    movl(cnt2, stride);
  17.152 +    movl(result, stride);
  17.153 +    negptr(result);
  17.154 +    movdqu(vec1, Address(str1, result, scale));
  17.155 +    pcmpestri(vec1, Address(str2, result, scale), pcmpmask);
  17.156 +    jccb(Assembler::aboveEqual, LENGTH_DIFF_LABEL);
  17.157  
  17.158      // Mismatched characters in the vectors
  17.159      bind(VECTOR_NOT_EQUAL);
  17.160 -    lea(str1, Address(str1, cnt2, Address::times_2));
  17.161 -    lea(str2, Address(str2, cnt2, Address::times_2));
  17.162 -    movl(cnt1, 8);
  17.163 -
  17.164 -    // Compare tail (< 8 chars), or rescan last vectors to
  17.165 -    // find 1st mismatched characters
  17.166 -    bind(COMPARE_TAIL);
  17.167 -    testl(cnt1, cnt1);
  17.168 -    jccb(Assembler::zero, LENGTH_DIFF_LABEL);
  17.169 -    movl(cnt2, cnt1);
  17.170 +    addptr(result, cnt1);
  17.171 +    movptr(cnt2, result);
  17.172 +    load_unsigned_short(result, Address(str1, cnt2, scale));
  17.173 +    load_unsigned_short(cnt1, Address(str2, cnt2, scale));
  17.174 +    subl(result, cnt1);
  17.175 +    jmpb(POP_LABEL);
  17.176 +
  17.177 +    bind(COMPARE_TAIL); // limit is zero
  17.178 +    movl(cnt2, result);
  17.179      // Fallthru to tail compare
  17.180    }
  17.181  
  17.182    // Shift str2 and str1 to the end of the arrays, negate min
  17.183 -  lea(str1, Address(str1, cnt2, Address::times_2, 0));
  17.184 -  lea(str2, Address(str2, cnt2, Address::times_2, 0));
  17.185 +  lea(str1, Address(str1, cnt2, scale, 0));
  17.186 +  lea(str2, Address(str2, cnt2, scale, 0));
  17.187    negptr(cnt2);
  17.188  
  17.189 -    // Compare the rest of the characters
  17.190 +  // Compare the rest of the elements
  17.191    bind(WHILE_HEAD_LABEL);
  17.192 -  load_unsigned_short(result, Address(str1, cnt2, Address::times_2, 0));
  17.193 -  load_unsigned_short(cnt1, Address(str2, cnt2, Address::times_2, 0));
  17.194 +  load_unsigned_short(result, Address(str1, cnt2, scale, 0));
  17.195 +  load_unsigned_short(cnt1, Address(str2, cnt2, scale, 0));
  17.196    subl(result, cnt1);
  17.197    jccb(Assembler::notZero, POP_LABEL);
  17.198    increment(cnt2);
  17.199 -  jcc(Assembler::notZero, WHILE_HEAD_LABEL);
  17.200 +  jccb(Assembler::notZero, WHILE_HEAD_LABEL);
  17.201  
  17.202    // Strings are equal up to min length.  Return the length difference.
  17.203    bind(LENGTH_DIFF_LABEL);
  17.204 @@ -8747,7 +8800,7 @@
  17.205  
  17.206    // Discard the stored length difference
  17.207    bind(POP_LABEL);
  17.208 -  addptr(rsp, wordSize);
  17.209 +  pop(cnt1);
  17.210  
  17.211    // That's it
  17.212    bind(DONE_LABEL);
  17.213 @@ -8795,6 +8848,7 @@
  17.214    if (UseSSE42Intrinsics) {
  17.215      // With SSE4.2, use double quad vector compare
  17.216      Label COMPARE_WIDE_VECTORS, COMPARE_TAIL;
  17.217 +
  17.218      // Compare 16-byte vectors
  17.219      andl(result, 0x0000000e);  //   tail count (in bytes)
  17.220      andl(limit, 0xfffffff0);   // vector count (in bytes)
  17.221 @@ -8808,11 +8862,23 @@
  17.222      movdqu(vec1, Address(ary1, limit, Address::times_1));
  17.223      movdqu(vec2, Address(ary2, limit, Address::times_1));
  17.224      pxor(vec1, vec2);
  17.225 +
  17.226      ptest(vec1, vec1);
  17.227      jccb(Assembler::notZero, FALSE_LABEL);
  17.228      addptr(limit, 16);
  17.229      jcc(Assembler::notZero, COMPARE_WIDE_VECTORS);
  17.230  
  17.231 +    testl(result, result);
  17.232 +    jccb(Assembler::zero, TRUE_LABEL);
  17.233 +
  17.234 +    movdqu(vec1, Address(ary1, result, Address::times_1, -16));
  17.235 +    movdqu(vec2, Address(ary2, result, Address::times_1, -16));
  17.236 +    pxor(vec1, vec2);
  17.237 +
  17.238 +    ptest(vec1, vec1);
  17.239 +    jccb(Assembler::notZero, FALSE_LABEL);
  17.240 +    jmpb(TRUE_LABEL);
  17.241 +
  17.242      bind(COMPARE_TAIL); // limit is zero
  17.243      movl(limit, result);
  17.244      // Fallthru to tail compare
    18.1 --- a/src/cpu/x86/vm/assembler_x86.hpp	Fri Feb 25 11:42:03 2011 -0800
    18.2 +++ b/src/cpu/x86/vm/assembler_x86.hpp	Fri Feb 25 12:46:46 2011 -0800
    18.3 @@ -1277,6 +1277,9 @@
    18.4    void prefetcht2(Address src);
    18.5    void prefetchw(Address src);
    18.6  
    18.7 +  // POR - Bitwise logical OR
    18.8 +  void por(XMMRegister dst, XMMRegister src);
    18.9 +
   18.10    // Shuffle Packed Doublewords
   18.11    void pshufd(XMMRegister dst, XMMRegister src, int mode);
   18.12    void pshufd(XMMRegister dst, Address src,     int mode);
   18.13 @@ -1522,8 +1525,9 @@
   18.14    // Support for sign-extension (hi:lo = extend_sign(lo))
   18.15    void extend_sign(Register hi, Register lo);
   18.16  
   18.17 -  // Loading values by size and signed-ness
   18.18 -  void load_sized_value(Register dst, Address src, size_t size_in_bytes, bool is_signed);
   18.19 +  // Load and store values by size and signed-ness
   18.20 +  void load_sized_value(Register dst, Address src, size_t size_in_bytes, bool is_signed, Register dst2 = noreg);
   18.21 +  void store_sized_value(Address dst, Register src, size_t size_in_bytes, Register src2 = noreg);
   18.22  
   18.23    // Support for inc/dec with optimal instruction selection depending on value
   18.24  
   18.25 @@ -2293,7 +2297,7 @@
   18.26    // Compare strings.
   18.27    void string_compare(Register str1, Register str2,
   18.28                        Register cnt1, Register cnt2, Register result,
   18.29 -                      XMMRegister vec1, XMMRegister vec2);
   18.30 +                      XMMRegister vec1);
   18.31  
   18.32    // Compare char[] arrays.
   18.33    void char_arrays_equals(bool is_array_equ, Register ary1, Register ary2,
    19.1 --- a/src/cpu/x86/vm/cppInterpreter_x86.cpp	Fri Feb 25 11:42:03 2011 -0800
    19.2 +++ b/src/cpu/x86/vm/cppInterpreter_x86.cpp	Fri Feb 25 12:46:46 2011 -0800
    19.3 @@ -1,5 +1,5 @@
    19.4  /*
    19.5 - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
    19.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
    19.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.8   *
    19.9   * This code is free software; you can redistribute it and/or modify it
   19.10 @@ -1899,8 +1899,6 @@
   19.11    Label do_double;
   19.12    Label done_conv;
   19.13  
   19.14 -  address compiled_entry = __ pc();
   19.15 -
   19.16    // The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases
   19.17    if (UseSSE < 2) {
   19.18      __ lea(state, Address(rbp,  -(int)sizeof(BytecodeInterpreter)));
   19.19 @@ -1934,15 +1932,7 @@
   19.20      __ jmp(done_conv);
   19.21    }
   19.22  
   19.23 -#if 0
   19.24 -  // emit a sentinel we can test for when converting an interpreter
   19.25 -  // entry point to a compiled entry point.
   19.26 -  __ a_long(Interpreter::return_sentinel);
   19.27 -  __ a_long((int)compiled_entry);
   19.28 -#endif
   19.29 -
   19.30    // Return point to interpreter from compiled/native method
   19.31 -
   19.32    InternalAddress return_from_native_method(__ pc());
   19.33  
   19.34    __ bind(done_conv);
    20.1 --- a/src/cpu/x86/vm/interpreter_x86.hpp	Fri Feb 25 11:42:03 2011 -0800
    20.2 +++ b/src/cpu/x86/vm/interpreter_x86.hpp	Fri Feb 25 12:46:46 2011 -0800
    20.3 @@ -1,5 +1,5 @@
    20.4  /*
    20.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    20.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    20.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    20.8   *
    20.9   * This code is free software; you can redistribute it and/or modify it
   20.10 @@ -26,14 +26,6 @@
   20.11  #define CPU_X86_VM_INTERPRETER_X86_HPP
   20.12  
   20.13   public:
   20.14 -
   20.15 -  // Sentinel placed in the code for interpreter returns so
   20.16 -  // that i2c adapters and osr code can recognize an interpreter
   20.17 -  // return address and convert the return to a specialized
   20.18 -  // block of code to handle compiedl return values and cleaning
   20.19 -  // the fpu stack.
   20.20 -  static const int return_sentinel;
   20.21 -
   20.22    static Address::ScaleFactor stackElementScale() { return Address::times_4; }
   20.23  
   20.24    // Offset from rsp (which points to the last stack element)
    21.1 --- a/src/cpu/x86/vm/interpreter_x86_32.cpp	Fri Feb 25 11:42:03 2011 -0800
    21.2 +++ b/src/cpu/x86/vm/interpreter_x86_32.cpp	Fri Feb 25 12:46:46 2011 -0800
    21.3 @@ -1,5 +1,5 @@
    21.4  /*
    21.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    21.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    21.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.8   *
    21.9   * This code is free software; you can redistribute it and/or modify it
   21.10 @@ -51,9 +51,6 @@
   21.11  
   21.12  #define __ _masm->
   21.13  
   21.14 -// Initialize the sentinel used to distinguish an interpreter return address.
   21.15 -const int Interpreter::return_sentinel = 0xfeedbeed;
   21.16 -
   21.17  //------------------------------------------------------------------------------------------------------------------------
   21.18  
   21.19  address AbstractInterpreterGenerator::generate_slow_signature_handler() {
    22.1 --- a/src/cpu/x86/vm/methodHandles_x86.cpp	Fri Feb 25 11:42:03 2011 -0800
    22.2 +++ b/src/cpu/x86/vm/methodHandles_x86.cpp	Fri Feb 25 12:46:46 2011 -0800
    22.3 @@ -602,24 +602,18 @@
    22.4        // make room for the new argument:
    22.5        __ movl(rax_argslot, rcx_bmh_vmargslot);
    22.6        __ lea(rax_argslot, __ argument_address(rax_argslot));
    22.7 -      insert_arg_slots(_masm, arg_slots * stack_move_unit(), arg_mask,
    22.8 -                       rax_argslot, rbx_temp, rdx_temp);
    22.9 +
   22.10 +      insert_arg_slots(_masm, arg_slots * stack_move_unit(), arg_mask, rax_argslot, rbx_temp, rdx_temp);
   22.11  
   22.12        // store bound argument into the new stack slot:
   22.13        __ load_heap_oop(rbx_temp, rcx_bmh_argument);
   22.14 -      Address prim_value_addr(rbx_temp, java_lang_boxing_object::value_offset_in_bytes(arg_type));
   22.15        if (arg_type == T_OBJECT) {
   22.16          __ movptr(Address(rax_argslot, 0), rbx_temp);
   22.17        } else {
   22.18 -        __ load_sized_value(rdx_temp, prim_value_addr,
   22.19 -                            type2aelembytes(arg_type), is_signed_subword_type(arg_type));
   22.20 -        __ movptr(Address(rax_argslot, 0), rdx_temp);
   22.21 -#ifndef _LP64
   22.22 -        if (arg_slots == 2) {
   22.23 -          __ movl(rdx_temp, prim_value_addr.plus_disp(wordSize));
   22.24 -          __ movl(Address(rax_argslot, Interpreter::stackElementSize), rdx_temp);
   22.25 -        }
   22.26 -#endif //_LP64
   22.27 +        Address prim_value_addr(rbx_temp, java_lang_boxing_object::value_offset_in_bytes(arg_type));
   22.28 +        const int arg_size = type2aelembytes(arg_type);
   22.29 +        __ load_sized_value(rdx_temp, prim_value_addr, arg_size, is_signed_subword_type(arg_type), rbx_temp);
   22.30 +        __ store_sized_value(Address(rax_argslot, 0), rdx_temp, arg_size, rbx_temp);
   22.31        }
   22.32  
   22.33        if (direct_to_method) {
    23.1 --- a/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Fri Feb 25 11:42:03 2011 -0800
    23.2 +++ b/src/cpu/x86/vm/sharedRuntime_x86_32.cpp	Fri Feb 25 12:46:46 2011 -0800
    23.3 @@ -1,5 +1,5 @@
    23.4  /*
    23.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    23.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    23.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.8   *
    23.9   * This code is free software; you can redistribute it and/or modify it
   23.10 @@ -660,25 +660,6 @@
   23.11                              int comp_args_on_stack,
   23.12                              const BasicType *sig_bt,
   23.13                              const VMRegPair *regs) {
   23.14 -  // we're being called from the interpreter but need to find the
   23.15 -  // compiled return entry point.  The return address on the stack
   23.16 -  // should point at it and we just need to pull the old value out.
   23.17 -  // load up the pointer to the compiled return entry point and
   23.18 -  // rewrite our return pc. The code is arranged like so:
   23.19 -  //
   23.20 -  // .word Interpreter::return_sentinel
   23.21 -  // .word address_of_compiled_return_point
   23.22 -  // return_entry_point: blah_blah_blah
   23.23 -  //
   23.24 -  // So we can find the appropriate return point by loading up the word
   23.25 -  // just prior to the current return address we have on the stack.
   23.26 -  //
   23.27 -  // We will only enter here from an interpreted frame and never from after
   23.28 -  // passing thru a c2i. Azul allowed this but we do not. If we lose the
   23.29 -  // race and use a c2i we will remain interpreted for the race loser(s).
   23.30 -  // This removes all sorts of headaches on the x86 side and also eliminates
   23.31 -  // the possibility of having c2i -> i2c -> c2i -> ... endless transitions.
   23.32 -
   23.33  
   23.34    // Note: rsi contains the senderSP on entry. We must preserve it since
   23.35    // we may do a i2c -> c2i transition if we lose a race where compiled
   23.36 @@ -687,40 +668,6 @@
   23.37    // Pick up the return address
   23.38    __ movptr(rax, Address(rsp, 0));
   23.39  
   23.40 -  // If UseSSE >= 2 then no cleanup is needed on the return to the
   23.41 -  // interpreter so skip fixing up the return entry point unless
   23.42 -  // VerifyFPU is enabled.
   23.43 -  if (UseSSE < 2 || VerifyFPU) {
   23.44 -    Label skip, chk_int;
   23.45 -    // If we were called from the call stub we need to do a little bit different
   23.46 -    // cleanup than if the interpreter returned to the call stub.
   23.47 -
   23.48 -    ExternalAddress stub_return_address(StubRoutines::_call_stub_return_address);
   23.49 -    __ cmpptr(rax, stub_return_address.addr());
   23.50 -    __ jcc(Assembler::notEqual, chk_int);
   23.51 -    assert(StubRoutines::x86::get_call_stub_compiled_return() != NULL, "must be set");
   23.52 -    __ lea(rax, ExternalAddress(StubRoutines::x86::get_call_stub_compiled_return()));
   23.53 -    __ jmp(skip);
   23.54 -
   23.55 -    // It must be the interpreter since we never get here via a c2i (unlike Azul)
   23.56 -
   23.57 -    __ bind(chk_int);
   23.58 -#ifdef ASSERT
   23.59 -    {
   23.60 -      Label ok;
   23.61 -      __ cmpl(Address(rax, -2*wordSize), Interpreter::return_sentinel);
   23.62 -      __ jcc(Assembler::equal, ok);
   23.63 -      __ int3();
   23.64 -      __ bind(ok);
   23.65 -    }
   23.66 -#endif // ASSERT
   23.67 -    __ movptr(rax, Address(rax, -wordSize));
   23.68 -    __ bind(skip);
   23.69 -  }
   23.70 -
   23.71 -  // rax, now contains the compiled return entry point which will do an
   23.72 -  // cleanup needed for the return from compiled to interpreted.
   23.73 -
   23.74    // Must preserve original SP for loading incoming arguments because
   23.75    // we need to align the outgoing SP for compiled code.
   23.76    __ movptr(rdi, rsp);
    24.1 --- a/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Fri Feb 25 11:42:03 2011 -0800
    24.2 +++ b/src/cpu/x86/vm/sharedRuntime_x86_64.cpp	Fri Feb 25 12:46:46 2011 -0800
    24.3 @@ -1,5 +1,5 @@
    24.4  /*
    24.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    24.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    24.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    24.8   *
    24.9   * This code is free software; you can redistribute it and/or modify it
   24.10 @@ -610,14 +610,6 @@
   24.11                              const BasicType *sig_bt,
   24.12                              const VMRegPair *regs) {
   24.13  
   24.14 -  //
   24.15 -  // We will only enter here from an interpreted frame and never from after
   24.16 -  // passing thru a c2i. Azul allowed this but we do not. If we lose the
   24.17 -  // race and use a c2i we will remain interpreted for the race loser(s).
   24.18 -  // This removes all sorts of headaches on the x86 side and also eliminates
   24.19 -  // the possibility of having c2i -> i2c -> c2i -> ... endless transitions.
   24.20 -
   24.21 -
   24.22    // Note: r13 contains the senderSP on entry. We must preserve it since
   24.23    // we may do a i2c -> c2i transition if we lose a race where compiled
   24.24    // code goes non-entrant while we get args ready.
   24.25 @@ -627,6 +619,7 @@
   24.26    // save code can segv when fxsave instructions find improperly
   24.27    // aligned stack pointer.
   24.28  
   24.29 +  // Pick up the return address
   24.30    __ movptr(rax, Address(rsp, 0));
   24.31  
   24.32    // Must preserve original SP for loading incoming arguments because
    25.1 --- a/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Fri Feb 25 11:42:03 2011 -0800
    25.2 +++ b/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Fri Feb 25 12:46:46 2011 -0800
    25.3 @@ -1,5 +1,5 @@
    25.4  /*
    25.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    25.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    25.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    25.8   *
    25.9   * This code is free software; you can redistribute it and/or modify it
   25.10 @@ -240,9 +240,30 @@
   25.11      BLOCK_COMMENT("call_stub_return_address:");
   25.12      return_address = __ pc();
   25.13  
   25.14 -    Label common_return;
   25.15 +#ifdef COMPILER2
   25.16 +    {
   25.17 +      Label L_skip;
   25.18 +      if (UseSSE >= 2) {
   25.19 +        __ verify_FPU(0, "call_stub_return");
   25.20 +      } else {
   25.21 +        for (int i = 1; i < 8; i++) {
   25.22 +          __ ffree(i);
   25.23 +        }
   25.24  
   25.25 -    __ BIND(common_return);
   25.26 +        // UseSSE <= 1 so double result should be left on TOS
   25.27 +        __ movl(rsi, result_type);
   25.28 +        __ cmpl(rsi, T_DOUBLE);
   25.29 +        __ jcc(Assembler::equal, L_skip);
   25.30 +        if (UseSSE == 0) {
   25.31 +          // UseSSE == 0 so float result should be left on TOS
   25.32 +          __ cmpl(rsi, T_FLOAT);
   25.33 +          __ jcc(Assembler::equal, L_skip);
   25.34 +        }
   25.35 +        __ ffree(0);
   25.36 +      }
   25.37 +      __ BIND(L_skip);
   25.38 +    }
   25.39 +#endif // COMPILER2
   25.40  
   25.41      // store result depending on type
   25.42      // (everything that is not T_LONG, T_FLOAT or T_DOUBLE is treated as T_INT)
   25.43 @@ -305,37 +326,6 @@
   25.44      }
   25.45      __ jmp(exit);
   25.46  
   25.47 -    // If we call compiled code directly from the call stub we will
   25.48 -    // need to adjust the return back to the call stub to a specialized
   25.49 -    // piece of code that can handle compiled results and cleaning the fpu
   25.50 -    // stack. compiled code will be set to return here instead of the
   25.51 -    // return above that handles interpreter returns.
   25.52 -
   25.53 -    BLOCK_COMMENT("call_stub_compiled_return:");
   25.54 -    StubRoutines::x86::set_call_stub_compiled_return( __ pc());
   25.55 -
   25.56 -#ifdef COMPILER2
   25.57 -    if (UseSSE >= 2) {
   25.58 -      __ verify_FPU(0, "call_stub_compiled_return");
   25.59 -    } else {
   25.60 -      for (int i = 1; i < 8; i++) {
   25.61 -        __ ffree(i);
   25.62 -      }
   25.63 -
   25.64 -      // UseSSE <= 1 so double result should be left on TOS
   25.65 -      __ movl(rsi, result_type);
   25.66 -      __ cmpl(rsi, T_DOUBLE);
   25.67 -      __ jcc(Assembler::equal, common_return);
   25.68 -      if (UseSSE == 0) {
   25.69 -        // UseSSE == 0 so float result should be left on TOS
   25.70 -        __ cmpl(rsi, T_FLOAT);
   25.71 -        __ jcc(Assembler::equal, common_return);
   25.72 -      }
   25.73 -      __ ffree(0);
   25.74 -    }
   25.75 -#endif /* COMPILER2 */
   25.76 -    __ jmp(common_return);
   25.77 -
   25.78      return start;
   25.79    }
   25.80  
    26.1 --- a/src/cpu/x86/vm/stubRoutines_x86_32.cpp	Fri Feb 25 11:42:03 2011 -0800
    26.2 +++ b/src/cpu/x86/vm/stubRoutines_x86_32.cpp	Fri Feb 25 12:46:46 2011 -0800
    26.3 @@ -1,5 +1,5 @@
    26.4  /*
    26.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    26.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    26.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    26.8   *
    26.9   * This code is free software; you can redistribute it and/or modify it
   26.10 @@ -39,6 +39,5 @@
   26.11  // Implementation of the platform-specific part of StubRoutines - for
   26.12  // a description of how to extend it, see the stubRoutines.hpp file.
   26.13  
   26.14 -address StubRoutines::x86::_verify_mxcsr_entry        = NULL;
   26.15 -address StubRoutines::x86::_verify_fpu_cntrl_wrd_entry= NULL;
   26.16 -address StubRoutines::x86::_call_stub_compiled_return = NULL;
   26.17 +address StubRoutines::x86::_verify_mxcsr_entry         = NULL;
   26.18 +address StubRoutines::x86::_verify_fpu_cntrl_wrd_entry = NULL;
    27.1 --- a/src/cpu/x86/vm/stubRoutines_x86_32.hpp	Fri Feb 25 11:42:03 2011 -0800
    27.2 +++ b/src/cpu/x86/vm/stubRoutines_x86_32.hpp	Fri Feb 25 12:46:46 2011 -0800
    27.3 @@ -1,5 +1,5 @@
    27.4  /*
    27.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    27.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    27.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    27.8   *
    27.9   * This code is free software; you can redistribute it and/or modify it
   27.10 @@ -44,24 +44,14 @@
   27.11   friend class VMStructs;
   27.12  
   27.13   private:
   27.14 -  // If we call compiled code directly from the call stub we will
   27.15 -  // need to adjust the return back to the call stub to a specialized
   27.16 -  // piece of code that can handle compiled results and cleaning the fpu
   27.17 -  // stack. The variable holds that location.
   27.18 -  static address _call_stub_compiled_return;
   27.19    static address _verify_mxcsr_entry;
   27.20    static address _verify_fpu_cntrl_wrd_entry;
   27.21 -  static jint    _mxcsr_std;
   27.22  
   27.23   public:
   27.24    static address verify_mxcsr_entry()                        { return _verify_mxcsr_entry; }
   27.25    static address verify_fpu_cntrl_wrd_entry()                { return _verify_fpu_cntrl_wrd_entry; }
   27.26 -
   27.27 -  static address get_call_stub_compiled_return()             { return _call_stub_compiled_return; }
   27.28 -  static void set_call_stub_compiled_return(address ret)     { _call_stub_compiled_return = ret; }
   27.29  };
   27.30  
   27.31 -  static bool    returns_to_call_stub(address return_pc)     { return (return_pc == _call_stub_return_address) ||
   27.32 -                                                                       return_pc == x86::get_call_stub_compiled_return(); }
   27.33 +  static bool    returns_to_call_stub(address return_pc)     { return return_pc == _call_stub_return_address; }
   27.34  
   27.35  #endif // CPU_X86_VM_STUBROUTINES_X86_32_HPP
    28.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Fri Feb 25 11:42:03 2011 -0800
    28.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Fri Feb 25 12:46:46 2011 -0800
    28.3 @@ -177,9 +177,7 @@
    28.4  
    28.5  address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) {
    28.6    TosState incoming_state = state;
    28.7 -
    28.8 -  Label interpreter_entry;
    28.9 -  address compiled_entry = __ pc();
   28.10 +  address entry = __ pc();
   28.11  
   28.12  #ifdef COMPILER2
   28.13    // The FPU stack is clean if UseSSE >= 2 but must be cleaned in other cases
   28.14 @@ -197,14 +195,6 @@
   28.15      __ MacroAssembler::verify_FPU(0, "generate_return_entry_for compiled");
   28.16    }
   28.17  
   28.18 -  __ jmp(interpreter_entry, relocInfo::none);
   28.19 -  // emit a sentinel we can test for when converting an interpreter
   28.20 -  // entry point to a compiled entry point.
   28.21 -  __ a_long(Interpreter::return_sentinel);
   28.22 -  __ a_long((int)compiled_entry);
   28.23 -  address entry = __ pc();
   28.24 -  __ bind(interpreter_entry);
   28.25 -
   28.26    // In SSE mode, interpreter returns FP results in xmm0 but they need
   28.27    // to end up back on the FPU so it can operate on them.
   28.28    if (incoming_state == ftos && UseSSE >= 1) {
    29.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Fri Feb 25 11:42:03 2011 -0800
    29.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Fri Feb 25 12:46:46 2011 -0800
    29.3 @@ -190,13 +190,7 @@
    29.4  }
    29.5  
    29.6  
    29.7 -address TemplateInterpreterGenerator::generate_return_entry_for(TosState state,
    29.8 -                                                                int step) {
    29.9 -
   29.10 -  // amd64 doesn't need to do anything special about compiled returns
   29.11 -  // to the interpreter so the code that exists on x86 to place a sentinel
   29.12 -  // here and the specialized cleanup code is not needed here.
   29.13 -
   29.14 +address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) {
   29.15    address entry = __ pc();
   29.16  
   29.17    // Restore stack bottom in case i2c adjusted stack
    30.1 --- a/src/cpu/x86/vm/templateTable_x86_32.cpp	Fri Feb 25 11:42:03 2011 -0800
    30.2 +++ b/src/cpu/x86/vm/templateTable_x86_32.cpp	Fri Feb 25 12:46:46 2011 -0800
    30.3 @@ -1710,39 +1710,6 @@
    30.4        __ pop(rdi);                               // get return address
    30.5        __ mov(rsp, rdx);                          // set sp to sender sp
    30.6  
    30.7 -
    30.8 -      Label skip;
    30.9 -      Label chkint;
   30.10 -
   30.11 -      // The interpreter frame we have removed may be returning to
   30.12 -      // either the callstub or the interpreter. Since we will
   30.13 -      // now be returning from a compiled (OSR) nmethod we must
   30.14 -      // adjust the return to the return were it can handler compiled
   30.15 -      // results and clean the fpu stack. This is very similar to
   30.16 -      // what a i2c adapter must do.
   30.17 -
   30.18 -      // Are we returning to the call stub?
   30.19 -
   30.20 -      __ cmp32(rdi, ExternalAddress(StubRoutines::_call_stub_return_address));
   30.21 -      __ jcc(Assembler::notEqual, chkint);
   30.22 -
   30.23 -      // yes adjust to the specialized call stub  return.
   30.24 -      assert(StubRoutines::x86::get_call_stub_compiled_return() != NULL, "must be set");
   30.25 -      __ lea(rdi, ExternalAddress(StubRoutines::x86::get_call_stub_compiled_return()));
   30.26 -      __ jmp(skip);
   30.27 -
   30.28 -      __ bind(chkint);
   30.29 -
   30.30 -      // Are we returning to the interpreter? Look for sentinel
   30.31 -
   30.32 -      __ cmpl(Address(rdi, -2*wordSize), Interpreter::return_sentinel);
   30.33 -      __ jcc(Assembler::notEqual, skip);
   30.34 -
   30.35 -      // Adjust to compiled return back to interpreter
   30.36 -
   30.37 -      __ movptr(rdi, Address(rdi, -wordSize));
   30.38 -      __ bind(skip);
   30.39 -
   30.40        // Align stack pointer for compiled code (note that caller is
   30.41        // responsible for undoing this fixup by remembering the old SP
   30.42        // in an rbp,-relative location)
    31.1 --- a/src/cpu/x86/vm/x86_32.ad	Fri Feb 25 11:42:03 2011 -0800
    31.2 +++ b/src/cpu/x86/vm/x86_32.ad	Fri Feb 25 12:46:46 2011 -0800
    31.3 @@ -12629,16 +12629,16 @@
    31.4    ins_pipe( pipe_slow );
    31.5  %}
    31.6  
    31.7 -instruct string_compare(eDIRegP str1, eCXRegI cnt1, eSIRegP str2, eBXRegI cnt2,
    31.8 -                        eAXRegI result, regXD tmp1, regXD tmp2, eFlagsReg cr) %{
    31.9 +instruct string_compare(eDIRegP str1, eCXRegI cnt1, eSIRegP str2, eDXRegI cnt2,
   31.10 +                        eAXRegI result, regXD tmp1, eFlagsReg cr) %{
   31.11    match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
   31.12 -  effect(TEMP tmp1, TEMP tmp2, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
   31.13 -
   31.14 -  format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   // KILL $tmp1, $tmp2" %}
   31.15 +  effect(TEMP tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
   31.16 +
   31.17 +  format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   // KILL $tmp1" %}
   31.18    ins_encode %{
   31.19      __ string_compare($str1$$Register, $str2$$Register,
   31.20                        $cnt1$$Register, $cnt2$$Register, $result$$Register,
   31.21 -                      $tmp1$$XMMRegister, $tmp2$$XMMRegister);
   31.22 +                      $tmp1$$XMMRegister);
   31.23    %}
   31.24    ins_pipe( pipe_slow );
   31.25  %}
    32.1 --- a/src/cpu/x86/vm/x86_64.ad	Fri Feb 25 11:42:03 2011 -0800
    32.2 +++ b/src/cpu/x86/vm/x86_64.ad	Fri Feb 25 12:46:46 2011 -0800
    32.3 @@ -11583,17 +11583,17 @@
    32.4    ins_pipe(pipe_slow);
    32.5  %}
    32.6  
    32.7 -instruct string_compare(rdi_RegP str1, rcx_RegI cnt1, rsi_RegP str2, rbx_RegI cnt2,
    32.8 -                        rax_RegI result, regD tmp1, regD tmp2, rFlagsReg cr)
    32.9 +instruct string_compare(rdi_RegP str1, rcx_RegI cnt1, rsi_RegP str2, rdx_RegI cnt2,
   32.10 +                        rax_RegI result, regD tmp1, rFlagsReg cr)
   32.11  %{
   32.12    match(Set result (StrComp (Binary str1 cnt1) (Binary str2 cnt2)));
   32.13 -  effect(TEMP tmp1, TEMP tmp2, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
   32.14 -
   32.15 -  format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   // KILL $tmp1, $tmp2" %}
   32.16 +  effect(TEMP tmp1, USE_KILL str1, USE_KILL str2, USE_KILL cnt1, USE_KILL cnt2, KILL cr);
   32.17 +
   32.18 +  format %{ "String Compare $str1,$cnt1,$str2,$cnt2 -> $result   // KILL $tmp1" %}
   32.19    ins_encode %{
   32.20      __ string_compare($str1$$Register, $str2$$Register,
   32.21                        $cnt1$$Register, $cnt2$$Register, $result$$Register,
   32.22 -                      $tmp1$$XMMRegister, $tmp2$$XMMRegister);
   32.23 +                      $tmp1$$XMMRegister);
   32.24    %}
   32.25    ins_pipe( pipe_slow );
   32.26  %}
    33.1 --- a/src/cpu/zero/vm/stubRoutines_zero.cpp	Fri Feb 25 11:42:03 2011 -0800
    33.2 +++ b/src/cpu/zero/vm/stubRoutines_zero.cpp	Fri Feb 25 12:46:46 2011 -0800
    33.3 @@ -1,5 +1,5 @@
    33.4  /*
    33.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    33.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    33.7   * Copyright 2008, 2009 Red Hat, Inc.
    33.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.9   *
   33.10 @@ -30,7 +30,3 @@
   33.11  #ifdef TARGET_OS_FAMILY_linux
   33.12  # include "thread_linux.inline.hpp"
   33.13  #endif
   33.14 -
   33.15 -#ifdef IA32
   33.16 -address StubRoutines::x86::_call_stub_compiled_return = NULL;
   33.17 -#endif // IA32
    34.1 --- a/src/cpu/zero/vm/stubRoutines_zero.hpp	Fri Feb 25 11:42:03 2011 -0800
    34.2 +++ b/src/cpu/zero/vm/stubRoutines_zero.hpp	Fri Feb 25 12:46:46 2011 -0800
    34.3 @@ -1,5 +1,5 @@
    34.4  /*
    34.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    34.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    34.7   * Copyright 2007, 2008, 2009, 2010 Red Hat, Inc.
    34.8   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.9   *
   34.10 @@ -48,13 +48,4 @@
   34.11      method_handles_adapters_code_size = 0
   34.12    };
   34.13  
   34.14 -#ifdef IA32
   34.15 -  class x86 {
   34.16 -    friend class VMStructs;
   34.17 -
   34.18 -   private:
   34.19 -    static address _call_stub_compiled_return;
   34.20 -  };
   34.21 -#endif // IA32
   34.22 -
   34.23  #endif // CPU_ZERO_VM_STUBROUTINES_ZERO_HPP
    35.1 --- a/src/os/solaris/vm/os_solaris.cpp	Fri Feb 25 11:42:03 2011 -0800
    35.2 +++ b/src/os/solaris/vm/os_solaris.cpp	Fri Feb 25 12:46:46 2011 -0800
    35.3 @@ -1975,7 +1975,11 @@
    35.4        #ifndef RTLD_DL_SYMENT
    35.5        #define RTLD_DL_SYMENT 1
    35.6        #endif
    35.7 -      Sym * info;
    35.8 +#ifdef _LP64
    35.9 +      Elf64_Sym * info;
   35.10 +#else
   35.11 +      Elf32_Sym * info;
   35.12 +#endif
   35.13        if (dladdr1_func((void *)addr, &dlinfo, (void **)&info,
   35.14                         RTLD_DL_SYMENT)) {
   35.15          if ((char *)dlinfo.dli_saddr + info->st_size > (char *)addr) {
   35.16 @@ -6424,4 +6428,3 @@
   35.17     INTERRUPTIBLE_RETURN_INT_NORESTART(::bind(fd, him, len),\
   35.18       os::Solaris::clear_interrupted);
   35.19  }
   35.20 -
    36.1 --- a/src/os/windows/vm/perfMemory_windows.cpp	Fri Feb 25 11:42:03 2011 -0800
    36.2 +++ b/src/os/windows/vm/perfMemory_windows.cpp	Fri Feb 25 12:46:46 2011 -0800
    36.3 @@ -1,5 +1,5 @@
    36.4  /*
    36.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    36.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    36.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.8   *
    36.9   * This code is free software; you can redistribute it and/or modify it
   36.10 @@ -298,8 +298,8 @@
   36.11  static char* get_user_name_slow(int vmid) {
   36.12  
   36.13    // directory search
   36.14 -  char* oldest_user = NULL;
   36.15 -  time_t oldest_ctime = 0;
   36.16 +  char* latest_user = NULL;
   36.17 +  time_t latest_ctime = 0;
   36.18  
   36.19    const char* tmpdirname = os::get_temp_directory();
   36.20  
   36.21 @@ -375,18 +375,29 @@
   36.22            continue;
   36.23          }
   36.24  
   36.25 -        // compare and save filename with latest creation time
   36.26 -        if (statbuf.st_size > 0 && statbuf.st_ctime > oldest_ctime) {
   36.27 +        // If we found a matching file with a newer creation time, then
   36.28 +        // save the user name. The newer creation time indicates that
   36.29 +        // we found a newer incarnation of the process associated with
   36.30 +        // vmid. Due to the way that Windows recycles pids and the fact
   36.31 +        // that we can't delete the file from the file system namespace
   36.32 +        // until last close, it is possible for there to be more than
   36.33 +        // one hsperfdata file with a name matching vmid (diff users).
   36.34 +        //
   36.35 +        // We no longer ignore hsperfdata files where (st_size == 0).
   36.36 +        // In this function, all we're trying to do is determine the
   36.37 +        // name of the user that owns the process associated with vmid
   36.38 +        // so the size doesn't matter. Very rarely, we have observed
   36.39 +        // hsperfdata files where (st_size == 0) and the st_size field
   36.40 +        // later becomes the expected value.
   36.41 +        //
   36.42 +        if (statbuf.st_ctime > latest_ctime) {
   36.43 +          char* user = strchr(dentry->d_name, '_') + 1;
   36.44  
   36.45 -          if (statbuf.st_ctime > oldest_ctime) {
   36.46 -            char* user = strchr(dentry->d_name, '_') + 1;
   36.47 +          if (latest_user != NULL) FREE_C_HEAP_ARRAY(char, latest_user);
   36.48 +          latest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1);
   36.49  
   36.50 -            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
   36.51 -            oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1);
   36.52 -
   36.53 -            strcpy(oldest_user, user);
   36.54 -            oldest_ctime = statbuf.st_ctime;
   36.55 -          }
   36.56 +          strcpy(latest_user, user);
   36.57 +          latest_ctime = statbuf.st_ctime;
   36.58          }
   36.59  
   36.60          FREE_C_HEAP_ARRAY(char, filename);
   36.61 @@ -399,7 +410,7 @@
   36.62    os::closedir(tmpdirp);
   36.63    FREE_C_HEAP_ARRAY(char, tdbuf);
   36.64  
   36.65 -  return(oldest_user);
   36.66 +  return(latest_user);
   36.67  }
   36.68  
   36.69  // return the name of the user that owns the process identified by vmid.
   36.70 @@ -1339,6 +1350,38 @@
   36.71      CloseHandle(fh);
   36.72      fh = NULL;
   36.73      return NULL;
   36.74 +  } else {
   36.75 +    // We created the file mapping, but rarely the size of the
   36.76 +    // backing store file is reported as zero (0) which can cause
   36.77 +    // failures when trying to use the hsperfdata file.
   36.78 +    struct stat statbuf;
   36.79 +    int ret_code = ::stat(filename, &statbuf);
   36.80 +    if (ret_code == OS_ERR) {
   36.81 +      if (PrintMiscellaneous && Verbose) {
   36.82 +        warning("Could not get status information from file %s: %s\n",
   36.83 +            filename, strerror(errno));
   36.84 +      }
   36.85 +      CloseHandle(fmh);
   36.86 +      CloseHandle(fh);
   36.87 +      fh = NULL;
   36.88 +      fmh = NULL;
   36.89 +      return NULL;
   36.90 +    }
   36.91 +
   36.92 +    // We could always call FlushFileBuffers() but the Microsoft
   36.93 +    // docs indicate that it is considered expensive so we only
   36.94 +    // call it when we observe the size as zero (0).
   36.95 +    if (statbuf.st_size == 0 && FlushFileBuffers(fh) != TRUE) {
   36.96 +      DWORD lasterror = GetLastError();
   36.97 +      if (PrintMiscellaneous && Verbose) {
   36.98 +        warning("could not flush file %s: %d\n", filename, lasterror);
   36.99 +      }
  36.100 +      CloseHandle(fmh);
  36.101 +      CloseHandle(fh);
  36.102 +      fh = NULL;
  36.103 +      fmh = NULL;
  36.104 +      return NULL;
  36.105 +    }
  36.106    }
  36.107  
  36.108    // the file has been successfully created and the file mapping
    37.1 --- a/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp	Fri Feb 25 11:42:03 2011 -0800
    37.2 +++ b/src/os_cpu/linux_zero/vm/atomic_linux_zero.inline.hpp	Fri Feb 25 12:46:46 2011 -0800
    37.3 @@ -1,6 +1,6 @@
    37.4  /*
    37.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    37.6 - * Copyright 2007, 2008 Red Hat, Inc.
    37.7 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    37.8 + * Copyright 2007, 2008, 2011 Red Hat, Inc.
    37.9   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   37.10   *
   37.11   * This code is free software; you can redistribute it and/or modify it
   37.12 @@ -300,4 +300,18 @@
   37.13                                (intptr_t) compare_value);
   37.14  }
   37.15  
   37.16 +inline jlong Atomic::load(volatile jlong* src) {
   37.17 +  volatile jlong dest;
   37.18 +  os::atomic_copy64(src, &dest);
   37.19 +  return dest;
   37.20 +}
   37.21 +
   37.22 +inline void Atomic::store(jlong store_value, jlong* dest) {
   37.23 +  os::atomic_copy64((volatile jlong*)&store_value, (volatile jlong*)dest);
   37.24 +}
   37.25 +
   37.26 +inline void Atomic::store(jlong store_value, volatile jlong* dest) {
   37.27 +  os::atomic_copy64((volatile jlong*)&store_value, dest);
   37.28 +}
   37.29 +
   37.30  #endif // OS_CPU_LINUX_ZERO_VM_ATOMIC_LINUX_ZERO_INLINE_HPP
    38.1 --- a/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp	Fri Feb 25 11:42:03 2011 -0800
    38.2 +++ b/src/os_cpu/solaris_sparc/vm/atomic_solaris_sparc.inline.hpp	Fri Feb 25 12:46:46 2011 -0800
    38.3 @@ -67,7 +67,6 @@
    38.4  inline void Atomic_move_long(volatile jlong* src, volatile jlong* dst) {
    38.5  #ifdef COMPILER2
    38.6    // Compiler2 does not support v8, it is used only for v9.
    38.7 -  assert (VM_Version::v9_instructions_work(), "only supported on v9");
    38.8    _Atomic_move_long_v9(src, dst);
    38.9  #else
   38.10    // The branch is cheaper then emulated LDD.
    39.1 --- a/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Fri Feb 25 11:42:03 2011 -0800
    39.2 +++ b/src/os_cpu/solaris_sparc/vm/vm_version_solaris_sparc.cpp	Fri Feb 25 12:46:46 2011 -0800
    39.3 @@ -1,5 +1,5 @@
    39.4  /*
    39.5 - * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
    39.6 + * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
    39.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    39.8   *
    39.9   * This code is free software; you can redistribute it and/or modify it
   39.10 @@ -189,14 +189,22 @@
   39.11                tty->print_cr("cpu_info.implementation: %s", implementation);
   39.12              }
   39.13  #endif
   39.14 -            if (strncmp(implementation, "SPARC64", 7) == 0) {
   39.15 +            // Convert to UPPER case before compare.
   39.16 +            char* impl = strdup(implementation);
   39.17 +
   39.18 +            for (int i = 0; impl[i] != 0; i++)
   39.19 +              impl[i] = (char)toupper((uint)impl[i]);
   39.20 +            if (strstr(impl, "SPARC64") != NULL) {
   39.21                features |= sparc64_family_m;
   39.22 -            } else if (strncmp(implementation, "UltraSPARC-T", 12) == 0) {
   39.23 +            } else if (strstr(impl, "SPARC-T") != NULL) {
   39.24                features |= T_family_m;
   39.25 -              if (strncmp(implementation, "UltraSPARC-T1", 13) == 0) {
   39.26 +              if (strstr(impl, "SPARC-T1") != NULL) {
   39.27                  features |= T1_model_m;
   39.28                }
   39.29 +            } else {
   39.30 +              assert(strstr(impl, "SPARC") != NULL, "should be sparc");
   39.31              }
   39.32 +            free((void*)impl);
   39.33              break;
   39.34            }
   39.35          } // for(
    40.1 --- a/src/os_cpu/windows_x86/vm/unwind_windows_x86.hpp	Fri Feb 25 11:42:03 2011 -0800
    40.2 +++ b/src/os_cpu/windows_x86/vm/unwind_windows_x86.hpp	Fri Feb 25 12:46:46 2011 -0800
    40.3 @@ -1,5 +1,5 @@
    40.4  /*
    40.5 - * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
    40.6 + * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
    40.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    40.8   *
    40.9   * This code is free software; you can redistribute it and/or modify it
   40.10 @@ -71,7 +71,7 @@
   40.11      PVOID HandlerData;
   40.12  } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
   40.13  
   40.14 -#if MSC_VER < 1500
   40.15 +#if _MSC_VER < 1500
   40.16  
   40.17  /* Not needed for VS2008 compiler, comes from winnt.h. */
   40.18  typedef EXCEPTION_DISPOSITION (*PEXCEPTION_ROUTINE) (
    41.1 --- a/src/share/tools/ProjectCreator/BuildConfig.java	Fri Feb 25 11:42:03 2011 -0800
    41.2 +++ b/src/share/tools/ProjectCreator/BuildConfig.java	Fri Feb 25 12:46:46 2011 -0800
    41.3 @@ -1,5 +1,5 @@
    41.4  /*
    41.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    41.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    41.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    41.8   *
    41.9   * This code is free software; you can redistribute it and/or modify it
   41.10 @@ -51,12 +51,14 @@
   41.11          if (vars == null) vars = new Hashtable();
   41.12  
   41.13          String flavourBuild =  flavour + "_" + build;
   41.14 +        String platformName = getFieldString(null, "PlatformName");
   41.15          System.out.println();
   41.16          System.out.println(flavourBuild);
   41.17  
   41.18 -        put("Name", getCI().makeCfgName(flavourBuild));
   41.19 +        put("Name", getCI().makeCfgName(flavourBuild, platformName));
   41.20          put("Flavour", flavour);
   41.21          put("Build", build);
   41.22 +        put("PlatformName", platformName);
   41.23  
   41.24          // ones mentioned above were needed to expand format
   41.25          String buildBase = expandFormat(getFieldString(null, "BuildBase"));
   41.26 @@ -93,7 +95,7 @@
   41.27      protected void initDefaultLinkerFlags() {
   41.28          Vector linkerFlags = new Vector();
   41.29  
   41.30 -        linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll")));
   41.31 +        linkerFlags.addAll(getCI().getBaseLinkerFlags( get("OutputDir"), get("OutputDll"), get("PlatformName")));
   41.32  
   41.33          put("LinkerFlags", linkerFlags);
   41.34      }
   41.35 @@ -115,18 +117,15 @@
   41.36      }
   41.37  
   41.38  
   41.39 -    Vector getPreferredPaths(MacroDefinitions macros) {
   41.40 +    Vector getPreferredPaths() {
   41.41          Vector preferredPaths = new Vector();
   41.42 +
   41.43          // In the case of multiple files with the same name in
   41.44 -        // different subdirectories, prefer the versions specified in
   41.45 -        // the platform file as the "os_family" and "arch" macros.
   41.46 -        for (Iterator iter = macros.getMacros(); iter.hasNext(); ) {
   41.47 -            Macro macro = (Macro) iter.next();
   41.48 -            if (macro.name.equals("os_family") ||
   41.49 -                macro.name.equals("arch")) {
   41.50 -                preferredPaths.add(macro.contents);
   41.51 -            }
   41.52 -        }
   41.53 +        // different subdirectories, prefer these versions
   41.54 +        preferredPaths.add("windows");
   41.55 +        preferredPaths.add("x86");
   41.56 +        preferredPaths.add("closed");
   41.57 +
   41.58          // Also prefer "opto" over "adlc" for adlcVMDeps.hpp
   41.59          preferredPaths.add("opto");
   41.60  
   41.61 @@ -137,18 +136,7 @@
   41.62      void handleDB() {
   41.63          WinGammaPlatform platform = (WinGammaPlatform)getField(null, "PlatformObject");
   41.64  
   41.65 -        File incls = new File(get("OutputDir")+Util.sep+"incls");
   41.66 -
   41.67 -        incls.mkdirs();
   41.68 -
   41.69 -        MacroDefinitions macros = new MacroDefinitions();
   41.70 -        try {
   41.71 -            macros.readFrom(getFieldString(null, "Platform"), false);
   41.72 -        } catch (Exception e) {
   41.73 -            throw new RuntimeException(e);
   41.74 -        }
   41.75 -
   41.76 -        putSpecificField("AllFilesHash", computeAllFiles(platform, macros));
   41.77 +        putSpecificField("AllFilesHash", computeAllFiles(platform));
   41.78      }
   41.79  
   41.80  
   41.81 @@ -190,10 +178,10 @@
   41.82          ht.put(expandFormat(key), expandFormat(value));
   41.83      }
   41.84  
   41.85 -    Hashtable computeAllFiles(WinGammaPlatform platform, MacroDefinitions macros) {
   41.86 +    Hashtable computeAllFiles(WinGammaPlatform platform) {
   41.87          Hashtable rv = new Hashtable();
   41.88          DirectoryTree tree = getSourceTree(get("SourceBase"), getFieldString(null, "StartAt"));
   41.89 -        Vector preferredPaths = getPreferredPaths(macros);
   41.90 +        Vector preferredPaths = getPreferredPaths();
   41.91  
   41.92          // Hold errors until end
   41.93          Vector filesNotFound = new Vector();
   41.94 @@ -228,8 +216,7 @@
   41.95              System.err.println("Error: some files were not found or " +
   41.96                                 "appeared in multiple subdirectories of " +
   41.97                                 "directory " + get("SourceBase") + " and could not " +
   41.98 -                               "be resolved with the os_family and arch " +
   41.99 -                               "macros in the platform file.");
  41.100 +                               "be resolved with os_family and arch.");
  41.101              if (filesNotFound.size() != 0) {
  41.102                  System.err.println("Files not found:");
  41.103                  for (Iterator iter = filesNotFound.iterator();
  41.104 @@ -254,10 +241,14 @@
  41.105          Vector sysDefines = new Vector();
  41.106          sysDefines.add("WIN32");
  41.107          sysDefines.add("_WINDOWS");
  41.108 -        sysDefines.add("HOTSPOT_BUILD_USER="+System.getProperty("user.name"));
  41.109 +        sysDefines.add("HOTSPOT_BUILD_USER=\\\""+System.getProperty("user.name")+"\\\"");
  41.110          sysDefines.add("HOTSPOT_BUILD_TARGET=\\\""+get("Build")+"\\\"");
  41.111          sysDefines.add("_JNI_IMPLEMENTATION_");
  41.112 -        sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
  41.113 +        if (vars.get("PlatformName").equals("Win32")) {
  41.114 +            sysDefines.add("HOTSPOT_LIB_ARCH=\\\"i386\\\"");
  41.115 +        } else {
  41.116 +            sysDefines.add("HOTSPOT_LIB_ARCH=\\\"amd64\\\"");
  41.117 +        }
  41.118  
  41.119          sysDefines.addAll(defines);
  41.120  
  41.121 @@ -710,7 +701,7 @@
  41.122  }
  41.123  abstract class CompilerInterface {
  41.124      abstract Vector getBaseCompilerFlags(Vector defines, Vector includes, String outDir);
  41.125 -    abstract Vector getBaseLinkerFlags(String outDir, String outDll);
  41.126 +    abstract Vector getBaseLinkerFlags(String outDir, String outDll, String platformName);
  41.127      abstract Vector getDebugCompilerFlags(String opt);
  41.128      abstract Vector getDebugLinkerFlags();
  41.129      abstract void   getAdditionalNonKernelLinkerFlags(Vector rv);
  41.130 @@ -718,7 +709,7 @@
  41.131      abstract Vector getProductLinkerFlags();
  41.132      abstract String getOptFlag();
  41.133      abstract String getNoOptFlag();
  41.134 -    abstract String makeCfgName(String flavourBuild);
  41.135 +    abstract String makeCfgName(String flavourBuild, String platformName);
  41.136  
  41.137      void addAttr(Vector receiver, String attr, String value) {
  41.138          receiver.add(attr); receiver.add(value);
    42.1 --- a/src/share/tools/ProjectCreator/DirectoryTree.java	Fri Feb 25 11:42:03 2011 -0800
    42.2 +++ b/src/share/tools/ProjectCreator/DirectoryTree.java	Fri Feb 25 12:46:46 2011 -0800
    42.3 @@ -1,5 +1,5 @@
    42.4  /*
    42.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    42.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    42.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    42.8   *
    42.9   * This code is free software; you can redistribute it and/or modify it
   42.10 @@ -55,6 +55,9 @@
   42.11          private Vector nodes = new Vector();
   42.12  
   42.13          public FileIterator(Node rootNode) {
   42.14 +            if(rootNode == null) {
   42.15 +                return;
   42.16 +            }
   42.17              nodes.add(rootNode);
   42.18              prune();
   42.19          }
   42.20 @@ -112,10 +115,7 @@
   42.21          throws IllegalArgumentException {
   42.22          File root = new File(Util.normalize(baseDirectory));
   42.23          if (!root.isDirectory()) {
   42.24 -            throw new IllegalArgumentException("baseDirectory \"" +
   42.25 -                                               baseDirectory +
   42.26 -                                               "\" does not exist or " +
   42.27 -                                               "is not a directory");
   42.28 +            return;
   42.29          }
   42.30          try {
   42.31              root = root.getCanonicalFile();
    43.1 --- a/src/share/tools/ProjectCreator/FileFormatException.java	Fri Feb 25 11:42:03 2011 -0800
    43.2 +++ b/src/share/tools/ProjectCreator/FileFormatException.java	Fri Feb 25 12:46:46 2011 -0800
    43.3 @@ -1,5 +1,5 @@
    43.4  /*
    43.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    43.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    43.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    43.8   *
    43.9   * This code is free software; you can redistribute it and/or modify it
   43.10 @@ -22,7 +22,9 @@
   43.11   *
   43.12   */
   43.13  
   43.14 +@SuppressWarnings("serial")
   43.15  public class FileFormatException extends Exception {
   43.16 +
   43.17      public FileFormatException() {
   43.18          super();
   43.19      }
    44.1 --- a/src/share/tools/ProjectCreator/Macro.java	Fri Feb 25 11:42:03 2011 -0800
    44.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.3 @@ -1,28 +0,0 @@
    44.4 -/*
    44.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    44.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    44.7 - *
    44.8 - * This code is free software; you can redistribute it and/or modify it
    44.9 - * under the terms of the GNU General Public License version 2 only, as
   44.10 - * published by the Free Software Foundation.
   44.11 - *
   44.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   44.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   44.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   44.15 - * version 2 for more details (a copy is included in the LICENSE file that
   44.16 - * accompanied this code).
   44.17 - *
   44.18 - * You should have received a copy of the GNU General Public License version
   44.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   44.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   44.21 - *
   44.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   44.23 - * or visit www.oracle.com if you need additional information or have any
   44.24 - * questions.
   44.25 - *
   44.26 - */
   44.27 -
   44.28 -public class Macro {
   44.29 -    public String name;
   44.30 -    public String contents;
   44.31 -}
    45.1 --- a/src/share/tools/ProjectCreator/MacroDefinitions.java	Fri Feb 25 11:42:03 2011 -0800
    45.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.3 @@ -1,154 +0,0 @@
    45.4 -/*
    45.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    45.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    45.7 - *
    45.8 - * This code is free software; you can redistribute it and/or modify it
    45.9 - * under the terms of the GNU General Public License version 2 only, as
   45.10 - * published by the Free Software Foundation.
   45.11 - *
   45.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
   45.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   45.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   45.15 - * version 2 for more details (a copy is included in the LICENSE file that
   45.16 - * accompanied this code).
   45.17 - *
   45.18 - * You should have received a copy of the GNU General Public License version
   45.19 - * 2 along with this work; if not, write to the Free Software Foundation,
   45.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   45.21 - *
   45.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   45.23 - * or visit www.oracle.com if you need additional information or have any
   45.24 - * questions.
   45.25 - *
   45.26 - */
   45.27 -
   45.28 -import java.io.*;
   45.29 -import java.util.*;
   45.30 -
   45.31 -public class MacroDefinitions {
   45.32 -    private Vector macros;
   45.33 -
   45.34 -    public MacroDefinitions() {
   45.35 -        macros = new Vector();
   45.36 -    }
   45.37 -
   45.38 -    public void addMacro(String name, String contents) {
   45.39 -        Macro macro = new Macro();
   45.40 -        macro.name = name;
   45.41 -        macro.contents = contents;
   45.42 -        macros.add(macro);
   45.43 -    }
   45.44 -
   45.45 -    private boolean lineIsEmpty(String s) {
   45.46 -        for (int i = 0; i < s.length(); i++) {
   45.47 -            if (!Character.isWhitespace(s.charAt(i))) {
   45.48 -                return false;
   45.49 -            }
   45.50 -        }
   45.51 -        return true;
   45.52 -    }
   45.53 -
   45.54 -    public void readFrom(String fileName, boolean missingOk)
   45.55 -        throws FileNotFoundException, FileFormatException, IOException {
   45.56 -        BufferedReader reader = null;
   45.57 -        try {
   45.58 -            reader = new BufferedReader(new FileReader(fileName));
   45.59 -        } catch (FileNotFoundException e) {
   45.60 -            if (missingOk) {
   45.61 -                return;
   45.62 -            } else {
   45.63 -                throw(e);
   45.64 -            }
   45.65 -        }
   45.66 -        String line;
   45.67 -        do {
   45.68 -            line = reader.readLine();
   45.69 -            if (line != null) {
   45.70 -                // This had to be rewritten (compare to Database.java)
   45.71 -                // because the Solaris platform file has been
   45.72 -                // repurposed and now contains "macros" with spaces in
   45.73 -                // them.
   45.74 -
   45.75 -                if ((!line.startsWith("//")) &&
   45.76 -                    (!lineIsEmpty(line))) {
   45.77 -                    int nameBegin = -1;
   45.78 -                    int nameEnd = -1;
   45.79 -                    boolean gotEquals = false;
   45.80 -                    int contentsBegin = -1;
   45.81 -                    int contentsEnd = -1;
   45.82 -
   45.83 -                    int i = 0;
   45.84 -                    // Scan forward for beginning of name
   45.85 -                    while (i < line.length()) {
   45.86 -                        if (!Character.isWhitespace(line.charAt(i))) {
   45.87 -                            break;
   45.88 -                        }
   45.89 -                        i++;
   45.90 -                    }
   45.91 -                    nameBegin = i;
   45.92 -
   45.93 -                    // Scan forward for end of name
   45.94 -                    while (i < line.length()) {
   45.95 -                        if (Character.isWhitespace(line.charAt(i))) {
   45.96 -                            break;
   45.97 -                        }
   45.98 -                        i++;
   45.99 -                    }
  45.100 -                    nameEnd = i;
  45.101 -
  45.102 -                    // Scan forward for equals sign
  45.103 -                    while (i < line.length()) {
  45.104 -                        if (line.charAt(i) == '=') {
  45.105 -                            gotEquals = true;
  45.106 -                            break;
  45.107 -                        }
  45.108 -                        i++;
  45.109 -                    }
  45.110 -
  45.111 -                    // Scan forward for start of contents
  45.112 -                    i++;
  45.113 -                    while (i < line.length()) {
  45.114 -                        if (!Character.isWhitespace(line.charAt(i))) {
  45.115 -                            break;
  45.116 -                        }
  45.117 -                        i++;
  45.118 -                    }
  45.119 -                    contentsBegin = i;
  45.120 -
  45.121 -                    // Scan *backward* for end of contents
  45.122 -                    i = line.length() - 1;
  45.123 -                    while (i >= 0) {
  45.124 -                        if (!Character.isWhitespace(line.charAt(i))) {
  45.125 -                            break;
  45.126 -                        }
  45.127 -                    }
  45.128 -                    contentsEnd = i+1;
  45.129 -
  45.130 -                    // Now do consistency check
  45.131 -                    if (!((nameBegin < nameEnd) &&
  45.132 -                          (nameEnd < contentsBegin) &&
  45.133 -                          (contentsBegin < contentsEnd) &&
  45.134 -                          (gotEquals == true))) {
  45.135 -                        throw new FileFormatException(
  45.136 -                            "Expected \"macroname = value\", " +
  45.137 -                            "but found: " + line
  45.138 -                        );
  45.139 -                    }
  45.140 -
  45.141 -                    String name = line.substring(nameBegin, nameEnd);
  45.142 -                    String contents = line.substring(contentsBegin,
  45.143 -                                                     contentsEnd);
  45.144 -                    addMacro(name, contents);
  45.145 -                }
  45.146 -            }
  45.147 -        } while (line != null);
  45.148 -        reader.close();
  45.149 -    }
  45.150 -
  45.151 -    /** This returns an Iterator of Macros. You should not mutate the
  45.152 -        returned Macro objects or use the Iterator to remove
  45.153 -        macros. */
  45.154 -    public Iterator getMacros() {
  45.155 -        return macros.iterator();
  45.156 -    }
  45.157 -}
    46.1 --- a/src/share/tools/ProjectCreator/Util.java	Fri Feb 25 11:42:03 2011 -0800
    46.2 +++ b/src/share/tools/ProjectCreator/Util.java	Fri Feb 25 12:46:46 2011 -0800
    46.3 @@ -1,5 +1,5 @@
    46.4  /*
    46.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    46.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    46.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    46.8   *
    46.9   * This code is free software; you can redistribute it and/or modify it
   46.10 @@ -47,7 +47,7 @@
   46.11          return sb.toString();
   46.12      }
   46.13  
   46.14 -     static String join(String padder, String v[]) {
   46.15 +    static String join(String padder, String v[]) {
   46.16          StringBuffer sb = new StringBuffer();
   46.17  
   46.18          for (int i=0; i<v.length; i++) {
   46.19 @@ -80,9 +80,16 @@
   46.20  
   46.21  
   46.22      static String normalize(String file) {
   46.23 -        return file.replace('\\', '/');
   46.24 +        file = file.replace('\\', '/');
   46.25 +        if (file.length() > 2) {
   46.26 +            if (file.charAt(1) == ':' && file.charAt(2) == '/') {
   46.27 +                // convert drive letter to uppercase
   46.28 +                String drive = file.substring(0, 1).toUpperCase();
   46.29 +                return drive + file.substring(1);
   46.30 +            }
   46.31 +        }
   46.32 +        return file;
   46.33      }
   46.34  
   46.35      static String sep = File.separator;
   46.36 -    static String os = "Win32"; //System.getProperty("os.name");
   46.37  }
    47.1 --- a/src/share/tools/ProjectCreator/WinGammaPlatform.java	Fri Feb 25 11:42:03 2011 -0800
    47.2 +++ b/src/share/tools/ProjectCreator/WinGammaPlatform.java	Fri Feb 25 12:46:46 2011 -0800
    47.3 @@ -1,5 +1,5 @@
    47.4  /*
    47.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    47.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    47.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    47.8   *
    47.9   * This code is free software; you can redistribute it and/or modify it
   47.10 @@ -235,13 +235,6 @@
   47.11              (locationsInTree.size() == 0)) {
   47.12              filesNotFound.add(fileName);
   47.13          } else if (locationsInTree.size() > 1) {
   47.14 -            // We shouldn't have duplicate file names in our workspace.
   47.15 -            System.err.println();
   47.16 -            System.err.println("There are multiple files named as: " + fileName);
   47.17 -            System.exit(-1);
   47.18 -            // The following code could be safely removed if we don't need duplicate
   47.19 -            // file names.
   47.20 -
   47.21              // Iterate through them, trying to find one with a
   47.22              // preferred path
   47.23          search:
   47.24 @@ -336,7 +329,7 @@
   47.25  
   47.26          String projectName = getProjectName(projectFileName, ext);
   47.27  
   47.28 -        writeProjectFile(projectFileName, projectName, createAllConfigs());
   47.29 +        writeProjectFile(projectFileName, projectName, createAllConfigs(BuildConfig.getFieldString(null, "PlatformName")));
   47.30      }
   47.31  
   47.32      protected void writePrologue(String[] args) {
   47.33 @@ -376,7 +369,13 @@
   47.34                                HsArgHandler.STRING
   47.35                                ),
   47.36  
   47.37 -                new HsArgRule("-projectFileName",
   47.38 +              new HsArgRule("-platformName",
   47.39 +                              "PlatformName",
   47.40 +                              null,
   47.41 +                              HsArgHandler.STRING
   47.42 +                              ),
   47.43 +
   47.44 +              new HsArgRule("-projectFileName",
   47.45                                "ProjectFileName",
   47.46                                null,
   47.47                                HsArgHandler.STRING
   47.48 @@ -394,12 +393,6 @@
   47.49                                HsArgHandler.STRING
   47.50                                ),
   47.51  
   47.52 -                new HsArgRule("-platform",
   47.53 -                              "Platform",
   47.54 -                              null,
   47.55 -                              HsArgHandler.STRING
   47.56 -                              ),
   47.57 -
   47.58                  new HsArgRule("-absoluteInclude",
   47.59                                "AbsoluteInclude",
   47.60                                null,
   47.61 @@ -590,28 +583,27 @@
   47.62          BuildConfig.putField(null, "PlatformObject", this);
   47.63      }
   47.64  
   47.65 -    Vector createAllConfigs() {
   47.66 +    Vector createAllConfigs(String platform) {
   47.67          Vector allConfigs = new Vector();
   47.68  
   47.69          allConfigs.add(new C1DebugConfig());
   47.70  
   47.71 -        boolean b = true;
   47.72 -        if (b) {
   47.73 -            allConfigs.add(new C1FastDebugConfig());
   47.74 -            allConfigs.add(new C1ProductConfig());
   47.75 +        allConfigs.add(new C1FastDebugConfig());
   47.76 +        allConfigs.add(new C1ProductConfig());
   47.77  
   47.78 -            allConfigs.add(new C2DebugConfig());
   47.79 -            allConfigs.add(new C2FastDebugConfig());
   47.80 -            allConfigs.add(new C2ProductConfig());
   47.81 +        allConfigs.add(new C2DebugConfig());
   47.82 +        allConfigs.add(new C2FastDebugConfig());
   47.83 +        allConfigs.add(new C2ProductConfig());
   47.84  
   47.85 -            allConfigs.add(new TieredDebugConfig());
   47.86 -            allConfigs.add(new TieredFastDebugConfig());
   47.87 -            allConfigs.add(new TieredProductConfig());
   47.88 +        allConfigs.add(new TieredDebugConfig());
   47.89 +        allConfigs.add(new TieredFastDebugConfig());
   47.90 +        allConfigs.add(new TieredProductConfig());
   47.91  
   47.92 -            allConfigs.add(new CoreDebugConfig());
   47.93 -            allConfigs.add(new CoreFastDebugConfig());
   47.94 -            allConfigs.add(new CoreProductConfig());
   47.95 +        allConfigs.add(new CoreDebugConfig());
   47.96 +        allConfigs.add(new CoreFastDebugConfig());
   47.97 +        allConfigs.add(new CoreProductConfig());
   47.98  
   47.99 +        if (platform.equals("Win32")) {
  47.100              allConfigs.add(new KernelDebugConfig());
  47.101              allConfigs.add(new KernelFastDebugConfig());
  47.102              allConfigs.add(new KernelProductConfig());
    48.1 --- a/src/share/tools/ProjectCreator/WinGammaPlatformVC6.java	Fri Feb 25 11:42:03 2011 -0800
    48.2 +++ b/src/share/tools/ProjectCreator/WinGammaPlatformVC6.java	Fri Feb 25 12:46:46 2011 -0800
    48.3 @@ -1,5 +1,5 @@
    48.4  /*
    48.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    48.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    48.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    48.8   *
    48.9   * This code is free software; you can redistribute it and/or modify it
   48.10 @@ -223,7 +223,7 @@
   48.11          return rv;
   48.12      }
   48.13  
   48.14 -    Vector getBaseLinkerFlags(String outDir, String outDll) {
   48.15 +    Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) {
   48.16          Vector rv = new Vector();
   48.17  
   48.18          rv.add("PROP Ignore_Export_Lib 0");
   48.19 @@ -231,8 +231,12 @@
   48.20          rv.add("ADD CPP /MD");
   48.21          rv.add("ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib " +
   48.22                 "           advapi32.lib shell32.lib ole32.lib oleaut32.lib winmm.lib");
   48.23 +        String machine = "/machine:I386";
   48.24 +        if (platformName.equals("x64")) {
   48.25 +                machine = "/machine:X64";
   48.26 +        }
   48.27          rv.add("ADD LINK32      /out:\""+outDll+"\" "+
   48.28 -               "                /nologo /subsystem:windows /machine:I386" +
   48.29 +               "                /nologo /subsystem:windows /machine:" + machine +
   48.30                 "                /nologo /base:\"0x8000000\" /subsystem:windows /dll" +
   48.31                 "                /export:JNI_GetDefaultJavaVMInitArgs /export:JNI_CreateJavaVM /export:JNI_GetCreatedJavaVMs "+
   48.32                 "                /export:jio_snprintf /export:jio_printf /export:jio_fprintf /export:jio_vfprintf "+
   48.33 @@ -287,7 +291,7 @@
   48.34          return "d";
   48.35      }
   48.36  
   48.37 -    String makeCfgName(String flavourBuild) {
   48.38 -        return "vm - "+ Util.os + " " + flavourBuild;
   48.39 +    String makeCfgName(String flavourBuild, String platform) {
   48.40 +        return "vm - "+ platform + " " + flavourBuild;
   48.41      }
   48.42  }
    49.1 --- a/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java	Fri Feb 25 11:42:03 2011 -0800
    49.2 +++ b/src/share/tools/ProjectCreator/WinGammaPlatformVC7.java	Fri Feb 25 12:46:46 2011 -0800
    49.3 @@ -1,5 +1,5 @@
    49.4  /*
    49.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    49.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    49.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    49.8   *
    49.9   * This code is free software; you can redistribute it and/or modify it
   49.10 @@ -37,7 +37,7 @@
   49.11      public void writeProjectFile(String projectFileName, String projectName,
   49.12                                   Vector allConfigs) throws IOException {
   49.13          System.out.println();
   49.14 -        System.out.println("    Writing .vcproj file...");
   49.15 +        System.out.println("    Writing .vcproj file: "+projectFileName);
   49.16          // If we got this far without an error, we're safe to actually
   49.17          // write the .vcproj file
   49.18          printWriter = new PrintWriter(new FileWriter(projectFileName));
   49.19 @@ -54,9 +54,8 @@
   49.20                  "SccLocalPath", ""
   49.21              }
   49.22              );
   49.23 -
   49.24          startTag("Platforms", null);
   49.25 -        tag("Platform", new String[] {"Name", Util.os});
   49.26 +        tag("Platform", new String[] {"Name", (String) BuildConfig.getField(null, "PlatformName")});
   49.27          endTag("Platforms");
   49.28  
   49.29          startTag("Configurations", null);
   49.30 @@ -81,12 +80,47 @@
   49.31  
   49.32  
   49.33      abstract class NameFilter {
   49.34 -        protected String fname;
   49.35 +                protected String fname;
   49.36  
   49.37          abstract boolean match(FileInfo fi);
   49.38  
   49.39          String  filterString() { return ""; }
   49.40          String name() { return this.fname;}
   49.41 +
   49.42 +        @Override
   49.43 +        // eclipse auto-generated
   49.44 +        public int hashCode() {
   49.45 +            final int prime = 31;
   49.46 +            int result = 1;
   49.47 +            result = prime * result + getOuterType().hashCode();
   49.48 +            result = prime * result + ((fname == null) ? 0 : fname.hashCode());
   49.49 +            return result;
   49.50 +        }
   49.51 +
   49.52 +        @Override
   49.53 +        // eclipse auto-generated
   49.54 +        public boolean equals(Object obj) {
   49.55 +            if (this == obj)
   49.56 +                return true;
   49.57 +            if (obj == null)
   49.58 +                return false;
   49.59 +            if (getClass() != obj.getClass())
   49.60 +                return false;
   49.61 +            NameFilter other = (NameFilter) obj;
   49.62 +            if (!getOuterType().equals(other.getOuterType()))
   49.63 +                return false;
   49.64 +            if (fname == null) {
   49.65 +                if (other.fname != null)
   49.66 +                    return false;
   49.67 +            } else if (!fname.equals(other.fname))
   49.68 +                return false;
   49.69 +            return true;
   49.70 +        }
   49.71 +
   49.72 +        // eclipse auto-generated
   49.73 +        private WinGammaPlatformVC7 getOuterType() {
   49.74 +            return WinGammaPlatformVC7.this;
   49.75 +        }
   49.76      }
   49.77  
   49.78      class DirectoryFilter extends NameFilter {
   49.79 @@ -109,9 +143,50 @@
   49.80  
   49.81  
   49.82          boolean match(FileInfo fi) {
   49.83 -           int lastSlashIndex = fi.full.lastIndexOf('/');
   49.84 -           String fullDir = fi.full.substring(0, lastSlashIndex);
   49.85 -           return fullDir.endsWith(dir);
   49.86 +            int lastSlashIndex = fi.full.lastIndexOf('/');
   49.87 +            String fullDir = fi.full.substring(0, lastSlashIndex);
   49.88 +            return fullDir.endsWith(dir);
   49.89 +        }
   49.90 +
   49.91 +        @Override
   49.92 +        // eclipse auto-generated
   49.93 +        public int hashCode() {
   49.94 +            final int prime = 31;
   49.95 +            int result = super.hashCode();
   49.96 +            result = prime * result + getOuterType().hashCode();
   49.97 +            result = prime * result + baseLen;
   49.98 +            result = prime * result + ((dir == null) ? 0 : dir.hashCode());
   49.99 +            result = prime * result + dirLen;
  49.100 +            return result;
  49.101 +        }
  49.102 +
  49.103 +        @Override
  49.104 +        // eclipse auto-generated
  49.105 +        public boolean equals(Object obj) {
  49.106 +            if (this == obj)
  49.107 +                return true;
  49.108 +            if (!super.equals(obj))
  49.109 +                return false;
  49.110 +            if (getClass() != obj.getClass())
  49.111 +                return false;
  49.112 +            DirectoryFilter other = (DirectoryFilter) obj;
  49.113 +            if (!getOuterType().equals(other.getOuterType()))
  49.114 +                return false;
  49.115 +            if (baseLen != other.baseLen)
  49.116 +                return false;
  49.117 +            if (dir == null) {
  49.118 +                if (other.dir != null)
  49.119 +                    return false;
  49.120 +            } else if (!dir.equals(other.dir))
  49.121 +                return false;
  49.122 +            if (dirLen != other.dirLen)
  49.123 +                return false;
  49.124 +            return true;
  49.125 +        }
  49.126 +
  49.127 +        // eclipse auto-generated
  49.128 +        private WinGammaPlatformVC7 getOuterType() {
  49.129 +            return WinGammaPlatformVC7.this;
  49.130          }
  49.131      }
  49.132  
  49.133 @@ -232,32 +307,39 @@
  49.134          DirectoryFilter container = null;
  49.135          for(FileInfo fileInfo : files) {
  49.136  
  49.137 -           if (!fileInfo.full.startsWith(sbase)) {
  49.138 -              continue;
  49.139 -           }
  49.140 +            if (!fileInfo.full.startsWith(sbase)) {
  49.141 +                continue;
  49.142 +            }
  49.143  
  49.144 -           int lastSlash = fileInfo.full.lastIndexOf('/');
  49.145 -           String dir = fileInfo.full.substring(sbase.length(), lastSlash);
  49.146 -           if(dir.equals("share/vm")) {
  49.147 -              // skip files directly in share/vm - should only be precompiled.hpp which is handled below
  49.148 -              continue;
  49.149 -           }
  49.150 -           if (!dir.equals(currentDir)) {
  49.151 -              currentDir = dir;
  49.152 -              if (container != null) {
  49.153 -                 rv.add(container);
  49.154 -              }
  49.155 +            int lastSlash = fileInfo.full.lastIndexOf('/');
  49.156 +            String dir = fileInfo.full.substring(sbase.length(), lastSlash);
  49.157 +            if(dir.equals("share/vm")) {
  49.158 +                // skip files directly in share/vm - should only be precompiled.hpp which is handled below
  49.159 +                continue;
  49.160 +            }
  49.161 +            if (!dir.equals(currentDir)) {
  49.162 +                currentDir = dir;
  49.163 +                if (container != null && !rv.contains(container)) {
  49.164 +                    rv.add(container);
  49.165 +                }
  49.166  
  49.167 -              // remove "share/vm/" from names
  49.168 -              String name = dir;
  49.169 -              if (dir.startsWith("share/vm/")) {
  49.170 -                 name = dir.substring("share/vm/".length(), dir.length());
  49.171 -              }
  49.172 -              container = new DirectoryFilter(name, dir, sbase);
  49.173 -           }
  49.174 +                // remove "share/vm/" from names
  49.175 +                String name = dir;
  49.176 +                if (dir.startsWith("share/vm/")) {
  49.177 +                    name = dir.substring("share/vm/".length(), dir.length());
  49.178 +                }
  49.179 +                DirectoryFilter newfilter = new DirectoryFilter(name, dir, sbase);
  49.180 +                int i = rv.indexOf(newfilter);
  49.181 +                if(i == -1) {
  49.182 +                    container = newfilter;
  49.183 +                } else {
  49.184 +                    // if the filter already exists, reuse it
  49.185 +                    container = (DirectoryFilter) rv.get(i);
  49.186 +                }
  49.187 +            }
  49.188          }
  49.189 -        if (container != null) {
  49.190 -           rv.add(container);
  49.191 +        if (container != null && !rv.contains(container)) {
  49.192 +            rv.add(container);
  49.193          }
  49.194  
  49.195          ContainerFilter generated = new ContainerFilter("Generated");
  49.196 @@ -583,7 +665,7 @@
  49.197          return rv;
  49.198      }
  49.199  
  49.200 -    Vector getBaseLinkerFlags(String outDir, String outDll) {
  49.201 +    Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) {
  49.202          Vector rv = new Vector();
  49.203  
  49.204          addAttr(rv, "Name", "VCLinkerTool");
  49.205 @@ -610,8 +692,13 @@
  49.206          addAttr(rv, "SubSystem", "2");
  49.207          addAttr(rv, "BaseAddress", "0x8000000");
  49.208          addAttr(rv, "ImportLibrary", outDir+Util.sep+"jvm.lib");
  49.209 -        // Set /MACHINE option. 1 is machineX86
  49.210 -        addAttr(rv, "TargetMachine", "1");
  49.211 +        if(platformName.equals("Win32")) {
  49.212 +            // Set /MACHINE option. 1 is X86
  49.213 +            addAttr(rv, "TargetMachine", "1");
  49.214 +        } else {
  49.215 +            // Set /MACHINE option. 17 is X64
  49.216 +            addAttr(rv, "TargetMachine", "17");
  49.217 +        }
  49.218  
  49.219          return rv;
  49.220      }
  49.221 @@ -656,12 +743,6 @@
  49.222          addAttr(rv, "Optimization", "2");
  49.223          // Set /Oy- option
  49.224          addAttr(rv, "OmitFramePointers", "FALSE");
  49.225 -    }
  49.226 -
  49.227 -    Vector getProductCompilerFlags() {
  49.228 -        Vector rv = new Vector();
  49.229 -
  49.230 -        getProductCompilerFlags_common(rv);
  49.231          // Set /Ob option.  1 is expandOnlyInline
  49.232          addAttr(rv, "InlineFunctionExpansion", "1");
  49.233          // Set /GF option.
  49.234 @@ -670,6 +751,12 @@
  49.235          addAttr(rv, "RuntimeLibrary", "2");
  49.236          // Set /Gy option
  49.237          addAttr(rv, "EnableFunctionLevelLinking", "TRUE");
  49.238 +    }
  49.239 +
  49.240 +    Vector getProductCompilerFlags() {
  49.241 +        Vector rv = new Vector();
  49.242 +
  49.243 +        getProductCompilerFlags_common(rv);
  49.244  
  49.245          return rv;
  49.246      }
  49.247 @@ -693,7 +780,7 @@
  49.248          return "0";
  49.249      }
  49.250  
  49.251 -    String makeCfgName(String flavourBuild) {
  49.252 -        return  flavourBuild + "|" + Util.os;
  49.253 +    String makeCfgName(String flavourBuild, String platform) {
  49.254 +        return  flavourBuild + "|" + platform;
  49.255      }
  49.256  }
    50.1 --- a/src/share/vm/adlc/adlc.hpp	Fri Feb 25 11:42:03 2011 -0800
    50.2 +++ b/src/share/vm/adlc/adlc.hpp	Fri Feb 25 12:46:46 2011 -0800
    50.3 @@ -1,5 +1,5 @@
    50.4  /*
    50.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    50.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
    50.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    50.8   *
    50.9   * This code is free software; you can redistribute it and/or modify it
   50.10 @@ -42,11 +42,6 @@
   50.11  using namespace std;
   50.12  #endif
   50.13  
   50.14 -// make sure the MSC_VER and _MSC_VER settings make sense
   50.15 -#if _MSC_VER != MSC_VER && (_MSC_VER != 1400 || MSC_VER != 1399)
   50.16 -#error "Something is wrong with the detection of MSC_VER in the makefiles"
   50.17 -#endif
   50.18 -
   50.19  #if _MSC_VER >= 1400
   50.20  #define strdup _strdup
   50.21  #endif
    51.1 --- a/src/share/vm/adlc/output_c.cpp	Fri Feb 25 11:42:03 2011 -0800
    51.2 +++ b/src/share/vm/adlc/output_c.cpp	Fri Feb 25 12:46:46 2011 -0800
    51.3 @@ -1698,7 +1698,75 @@
    51.4      fprintf(fp,"\n");
    51.5    } // done generating expand rule
    51.6  
    51.7 -  else if( node->_matrule != NULL ) {
    51.8 +  // Generate projections for instruction's additional DEFs and KILLs
    51.9 +  if( ! node->expands() && (node->needs_projections() || node->has_temps())) {
   51.10 +    // Get string representing the MachNode that projections point at
   51.11 +    const char *machNode = "this";
   51.12 +    // Generate the projections
   51.13 +    fprintf(fp,"  // Add projection edges for additional defs or kills\n");
   51.14 +
   51.15 +    // Examine each component to see if it is a DEF or KILL
   51.16 +    node->_components.reset();
   51.17 +    // Skip the first component, if already handled as (SET dst (...))
   51.18 +    Component *comp = NULL;
   51.19 +    // For kills, the choice of projection numbers is arbitrary
   51.20 +    int proj_no = 1;
   51.21 +    bool declared_def  = false;
   51.22 +    bool declared_kill = false;
   51.23 +
   51.24 +    while( (comp = node->_components.iter()) != NULL ) {
   51.25 +      // Lookup register class associated with operand type
   51.26 +      Form        *form = (Form*)_globalNames[comp->_type];
   51.27 +      assert( form, "component type must be a defined form");
   51.28 +      OperandForm *op   = form->is_operand();
   51.29 +
   51.30 +      if (comp->is(Component::TEMP)) {
   51.31 +        fprintf(fp, "  // TEMP %s\n", comp->_name);
   51.32 +        if (!declared_def) {
   51.33 +          // Define the variable "def" to hold new MachProjNodes
   51.34 +          fprintf(fp, "  MachTempNode *def;\n");
   51.35 +          declared_def = true;
   51.36 +        }
   51.37 +        if (op && op->_interface && op->_interface->is_RegInterface()) {
   51.38 +          fprintf(fp,"  def = new (C) MachTempNode(state->MachOperGenerator( %s, C ));\n",
   51.39 +                  machOperEnum(op->_ident));
   51.40 +          fprintf(fp,"  add_req(def);\n");
   51.41 +          // The operand for TEMP is already constructed during
   51.42 +          // this mach node construction, see buildMachNode().
   51.43 +          //
   51.44 +          // int idx  = node->operand_position_format(comp->_name);
   51.45 +          // fprintf(fp,"  set_opnd_array(%d, state->MachOperGenerator( %s, C ));\n",
   51.46 +          //         idx, machOperEnum(op->_ident));
   51.47 +        } else {
   51.48 +          assert(false, "can't have temps which aren't registers");
   51.49 +        }
   51.50 +      } else if (comp->isa(Component::KILL)) {
   51.51 +        fprintf(fp, "  // DEF/KILL %s\n", comp->_name);
   51.52 +
   51.53 +        if (!declared_kill) {
   51.54 +          // Define the variable "kill" to hold new MachProjNodes
   51.55 +          fprintf(fp, "  MachProjNode *kill;\n");
   51.56 +          declared_kill = true;
   51.57 +        }
   51.58 +
   51.59 +        assert( op, "Support additional KILLS for base operands");
   51.60 +        const char *regmask    = reg_mask(*op);
   51.61 +        const char *ideal_type = op->ideal_type(_globalNames, _register);
   51.62 +
   51.63 +        if (!op->is_bound_register()) {
   51.64 +          syntax_err(node->_linenum, "In %s only bound registers can be killed: %s %s\n",
   51.65 +                     node->_ident, comp->_type, comp->_name);
   51.66 +        }
   51.67 +
   51.68 +        fprintf(fp,"  kill = ");
   51.69 +        fprintf(fp,"new (C, 1) MachProjNode( %s, %d, (%s), Op_%s );\n",
   51.70 +                machNode, proj_no++, regmask, ideal_type);
   51.71 +        fprintf(fp,"  proj_list.push(kill);\n");
   51.72 +      }
   51.73 +    }
   51.74 +  }
   51.75 +
   51.76 +  if( !node->expands() && node->_matrule != NULL ) {
   51.77      // Remove duplicated operands and inputs which use the same name.
   51.78      // Seach through match operands for the same name usage.
   51.79      uint cur_num_opnds = node->num_opnds();
   51.80 @@ -1752,72 +1820,6 @@
   51.81      }
   51.82    }
   51.83  
   51.84 -
   51.85 -  // Generate projections for instruction's additional DEFs and KILLs
   51.86 -  if( ! node->expands() && (node->needs_projections() || node->has_temps())) {
   51.87 -    // Get string representing the MachNode that projections point at
   51.88 -    const char *machNode = "this";
   51.89 -    // Generate the projections
   51.90 -    fprintf(fp,"  // Add projection edges for additional defs or kills\n");
   51.91 -
   51.92 -    // Examine each component to see if it is a DEF or KILL
   51.93 -    node->_components.reset();
   51.94 -    // Skip the first component, if already handled as (SET dst (...))
   51.95 -    Component *comp = NULL;
   51.96 -    // For kills, the choice of projection numbers is arbitrary
   51.97 -    int proj_no = 1;
   51.98 -    bool declared_def  = false;
   51.99 -    bool declared_kill = false;
  51.100 -
  51.101 -    while( (comp = node->_components.iter()) != NULL ) {
  51.102 -      // Lookup register class associated with operand type
  51.103 -      Form        *form = (Form*)_globalNames[comp->_type];
  51.104 -      assert( form, "component type must be a defined form");
  51.105 -      OperandForm *op   = form->is_operand();
  51.106 -
  51.107 -      if (comp->is(Component::TEMP)) {
  51.108 -        fprintf(fp, "  // TEMP %s\n", comp->_name);
  51.109 -        if (!declared_def) {
  51.110 -          // Define the variable "def" to hold new MachProjNodes
  51.111 -          fprintf(fp, "  MachTempNode *def;\n");
  51.112 -          declared_def = true;
  51.113 -        }
  51.114 -        if (op && op->_interface && op->_interface->is_RegInterface()) {
  51.115 -          fprintf(fp,"  def = new (C) MachTempNode(state->MachOperGenerator( %s, C ));\n",
  51.116 -                  machOperEnum(op->_ident));
  51.117 -          fprintf(fp,"  add_req(def);\n");
  51.118 -          int idx  = node->operand_position_format(comp->_name);
  51.119 -          fprintf(fp,"  set_opnd_array(%d, state->MachOperGenerator( %s, C ));\n",
  51.120 -                  idx, machOperEnum(op->_ident));
  51.121 -        } else {
  51.122 -          assert(false, "can't have temps which aren't registers");
  51.123 -        }
  51.124 -      } else if (comp->isa(Component::KILL)) {
  51.125 -        fprintf(fp, "  // DEF/KILL %s\n", comp->_name);
  51.126 -
  51.127 -        if (!declared_kill) {
  51.128 -          // Define the variable "kill" to hold new MachProjNodes
  51.129 -          fprintf(fp, "  MachProjNode *kill;\n");
  51.130 -          declared_kill = true;
  51.131 -        }
  51.132 -
  51.133 -        assert( op, "Support additional KILLS for base operands");
  51.134 -        const char *regmask    = reg_mask(*op);
  51.135 -        const char *ideal_type = op->ideal_type(_globalNames, _register);
  51.136 -
  51.137 -        if (!op->is_bound_register()) {
  51.138 -          syntax_err(node->_linenum, "In %s only bound registers can be killed: %s %s\n",
  51.139 -                     node->_ident, comp->_type, comp->_name);
  51.140 -        }
  51.141 -
  51.142 -        fprintf(fp,"  kill = ");
  51.143 -        fprintf(fp,"new (C, 1) MachProjNode( %s, %d, (%s), Op_%s );\n",
  51.144 -                machNode, proj_no++, regmask, ideal_type);
  51.145 -        fprintf(fp,"  proj_list.push(kill);\n");
  51.146 -      }
  51.147 -    }
  51.148 -  }
  51.149 -
  51.150    // If the node is a MachConstantNode, insert the MachConstantBaseNode edge.
  51.151    // NOTE: this edge must be the last input (see MachConstantNode::mach_constant_base_node_input).
  51.152    if (node->is_mach_constant()) {
  51.153 @@ -3776,12 +3778,10 @@
  51.154        }
  51.155        dont_care = true;
  51.156        // For each operand not in the match rule, call MachOperGenerator
  51.157 -      // with the enum for the opcode that needs to be built
  51.158 -      // and the node just built, the parent of the operand.
  51.159 +      // with the enum for the opcode that needs to be built.
  51.160        ComponentList clist = inst->_components;
  51.161        int         index  = clist.operand_position(comp->_name, comp->_usedef);
  51.162        const char *opcode = machOperEnum(comp->_type);
  51.163 -      const char *parent = "node";
  51.164        fprintf(fp_cpp, "%s node->set_opnd_array(%d, ", indent, index);
  51.165        fprintf(fp_cpp, "MachOperGenerator(%s, C));\n", opcode);
  51.166        }
    52.1 --- a/src/share/vm/c1/c1_Compilation.cpp	Fri Feb 25 11:42:03 2011 -0800
    52.2 +++ b/src/share/vm/c1/c1_Compilation.cpp	Fri Feb 25 12:46:46 2011 -0800
    52.3 @@ -1,5 +1,5 @@
    52.4  /*
    52.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    52.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    52.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    52.8   *
    52.9   * This code is free software; you can redistribute it and/or modify it
   52.10 @@ -491,10 +491,11 @@
   52.11        // to start profiling on its own.
   52.12        _method->ensure_method_data();
   52.13      }
   52.14 -  } else if (is_profiling() && _would_profile) {
   52.15 +  } else if (is_profiling()) {
   52.16      ciMethodData *md = method->method_data_or_null();
   52.17 -    assert(md != NULL, "Sanity");
   52.18 -    md->set_would_profile(_would_profile);
   52.19 +    if (md != NULL) {
   52.20 +      md->set_would_profile(_would_profile);
   52.21 +    }
   52.22    }
   52.23  }
   52.24  
    53.1 --- a/src/share/vm/ci/ciEnv.cpp	Fri Feb 25 11:42:03 2011 -0800
    53.2 +++ b/src/share/vm/ci/ciEnv.cpp	Fri Feb 25 12:46:46 2011 -0800
    53.3 @@ -412,13 +412,17 @@
    53.4      fail_type = _unloaded_ciinstance_klass;
    53.5    }
    53.6    KlassHandle found_klass;
    53.7 -  if (!require_local) {
    53.8 -    klassOop kls = SystemDictionary::find_constrained_instance_or_array_klass(
    53.9 -        sym, loader, KILL_COMPILE_ON_FATAL_(fail_type));
   53.10 -    found_klass = KlassHandle(THREAD, kls);
   53.11 -  } else {
   53.12 -    klassOop kls = SystemDictionary::find_instance_or_array_klass(
   53.13 -        sym, loader, domain, KILL_COMPILE_ON_FATAL_(fail_type));
   53.14 +  {
   53.15 +    ttyUnlocker ttyul;  // release tty lock to avoid ordering problems
   53.16 +    MutexLocker ml(Compile_lock);
   53.17 +    klassOop kls;
   53.18 +    if (!require_local) {
   53.19 +      kls = SystemDictionary::find_constrained_instance_or_array_klass(sym, loader,
   53.20 +                                                                       KILL_COMPILE_ON_FATAL_(fail_type));
   53.21 +    } else {
   53.22 +      kls = SystemDictionary::find_instance_or_array_klass(sym, loader, domain,
   53.23 +                                                           KILL_COMPILE_ON_FATAL_(fail_type));
   53.24 +    }
   53.25      found_klass = KlassHandle(THREAD, kls);
   53.26    }
   53.27  
    54.1 --- a/src/share/vm/ci/ciField.cpp	Fri Feb 25 11:42:03 2011 -0800
    54.2 +++ b/src/share/vm/ci/ciField.cpp	Fri Feb 25 12:46:46 2011 -0800
    54.3 @@ -1,5 +1,5 @@
    54.4  /*
    54.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
    54.6 + * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
    54.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    54.8   *
    54.9   * This code is free software; you can redistribute it and/or modify it
   54.10 @@ -212,9 +212,9 @@
   54.11      //    may change.  The three examples are java.lang.System.in,
   54.12      //    java.lang.System.out, and java.lang.System.err.
   54.13  
   54.14 -    klassOop k = _holder->get_klassOop();
   54.15 +    Handle k = _holder->get_klassOop();
   54.16      assert( SystemDictionary::System_klass() != NULL, "Check once per vm");
   54.17 -    if( k == SystemDictionary::System_klass() ) {
   54.18 +    if( k() == SystemDictionary::System_klass() ) {
   54.19        // Check offsets for case 2: System.in, System.out, or System.err
   54.20        if( _offset == java_lang_System::in_offset_in_bytes()  ||
   54.21            _offset == java_lang_System::out_offset_in_bytes() ||
    55.1 --- a/src/share/vm/ci/ciInstanceKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
    55.2 +++ b/src/share/vm/ci/ciInstanceKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
    55.3 @@ -46,6 +46,7 @@
    55.4    ciKlass(h_k), _non_static_fields(NULL)
    55.5  {
    55.6    assert(get_Klass()->oop_is_instance(), "wrong type");
    55.7 +  assert(get_instanceKlass()->is_loaded(), "must be at least loaded");
    55.8    instanceKlass* ik = get_instanceKlass();
    55.9  
   55.10    AccessFlags access_flags = ik->access_flags();
    56.1 --- a/src/share/vm/classfile/classFileParser.cpp	Fri Feb 25 11:42:03 2011 -0800
    56.2 +++ b/src/share/vm/classfile/classFileParser.cpp	Fri Feb 25 12:46:46 2011 -0800
    56.3 @@ -331,7 +331,7 @@
    56.4      length, CHECK_(nullHandle));
    56.5    constantPoolOop constant_pool =
    56.6                        oopFactory::new_constantPool(length,
    56.7 -                                                   methodOopDesc::IsSafeConc,
    56.8 +                                                   oopDesc::IsSafeConc,
    56.9                                                     CHECK_(nullHandle));
   56.10    constantPoolHandle cp (THREAD, constant_pool);
   56.11  
   56.12 @@ -1929,10 +1929,9 @@
   56.13    }
   56.14  
   56.15    // All sizing information for a methodOop is finally available, now create it
   56.16 -  methodOop m_oop  = oopFactory::new_method(
   56.17 -    code_length, access_flags, linenumber_table_length,
   56.18 -    total_lvt_length, checked_exceptions_length,
   56.19 -    methodOopDesc::IsSafeConc, CHECK_(nullHandle));
   56.20 +  methodOop m_oop  = oopFactory::new_method(code_length, access_flags, linenumber_table_length,
   56.21 +                                            total_lvt_length, checked_exceptions_length,
   56.22 +                                            oopDesc::IsSafeConc, CHECK_(nullHandle));
   56.23    methodHandle m (THREAD, m_oop);
   56.24  
   56.25    ClassLoadingService::add_class_method_size(m_oop->size()*HeapWordSize);
    57.1 --- a/src/share/vm/classfile/classLoader.cpp	Fri Feb 25 11:42:03 2011 -0800
    57.2 +++ b/src/share/vm/classfile/classLoader.cpp	Fri Feb 25 12:46:46 2011 -0800
    57.3 @@ -1290,6 +1290,15 @@
    57.4  int ClassLoader::_compile_the_world_counter = 0;
    57.5  static int _codecache_sweep_counter = 0;
    57.6  
    57.7 +// Filter out all exceptions except OOMs
    57.8 +static void clear_pending_exception_if_not_oom(TRAPS) {
    57.9 +  if (HAS_PENDING_EXCEPTION &&
   57.10 +      !PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
   57.11 +    CLEAR_PENDING_EXCEPTION;
   57.12 +  }
   57.13 +  // The CHECK at the caller will propagate the exception out
   57.14 +}
   57.15 +
   57.16  void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
   57.17    int len = (int)strlen(name);
   57.18    if (len > 6 && strcmp(".class", name + len - 6) == 0) {
   57.19 @@ -1312,12 +1321,12 @@
   57.20          k->initialize(THREAD);
   57.21        }
   57.22        bool exception_occurred = HAS_PENDING_EXCEPTION;
   57.23 -      CLEAR_PENDING_EXCEPTION;
   57.24 +      clear_pending_exception_if_not_oom(CHECK);
   57.25        if (CompileTheWorldPreloadClasses && k.not_null()) {
   57.26          constantPoolKlass::preload_and_initialize_all_classes(k->constants(), THREAD);
   57.27          if (HAS_PENDING_EXCEPTION) {
   57.28            // If something went wrong in preloading we just ignore it
   57.29 -          CLEAR_PENDING_EXCEPTION;
   57.30 +          clear_pending_exception_if_not_oom(CHECK);
   57.31            tty->print_cr("Preloading failed for (%d) %s", _compile_the_world_counter, buffer);
   57.32          }
   57.33        }
   57.34 @@ -1344,7 +1353,7 @@
   57.35                CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_initial_compile,
   57.36                                              methodHandle(), 0, "CTW", THREAD);
   57.37                if (HAS_PENDING_EXCEPTION) {
   57.38 -                CLEAR_PENDING_EXCEPTION;
   57.39 +                clear_pending_exception_if_not_oom(CHECK);
   57.40                  tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string());
   57.41                }
   57.42                if (TieredCompilation) {
   57.43 @@ -1358,7 +1367,7 @@
   57.44                  CompileBroker::compile_method(m, InvocationEntryBci, CompLevel_full_optimization,
   57.45                                                methodHandle(), 0, "CTW", THREAD);
   57.46                  if (HAS_PENDING_EXCEPTION) {
   57.47 -                  CLEAR_PENDING_EXCEPTION;
   57.48 +                  clear_pending_exception_if_not_oom(CHECK);
   57.49                    tty->print_cr("CompileTheWorld (%d) : Skipping method: %s", _compile_the_world_counter, m->name()->as_C_string());
   57.50                  }
   57.51                }
    58.1 --- a/src/share/vm/classfile/loaderConstraints.cpp	Fri Feb 25 11:42:03 2011 -0800
    58.2 +++ b/src/share/vm/classfile/loaderConstraints.cpp	Fri Feb 25 12:46:46 2011 -0800
    58.3 @@ -322,8 +322,14 @@
    58.4  klassOop LoaderConstraintTable::find_constrained_klass(Symbol* name,
    58.5                                                         Handle loader) {
    58.6    LoaderConstraintEntry *p = *(find_loader_constraint(name, loader));
    58.7 -  if (p != NULL && p->klass() != NULL)
    58.8 +  if (p != NULL && p->klass() != NULL) {
    58.9 +    if (Klass::cast(p->klass())->oop_is_instance() && !instanceKlass::cast(p->klass())->is_loaded()) {
   58.10 +      // Only return fully loaded classes.  Classes found through the
   58.11 +      // constraints might still be in the process of loading.
   58.12 +      return NULL;
   58.13 +    }
   58.14      return p->klass();
   58.15 +  }
   58.16  
   58.17    // No constraints, or else no klass loaded yet.
   58.18    return NULL;
    59.1 --- a/src/share/vm/classfile/systemDictionary.cpp	Fri Feb 25 11:42:03 2011 -0800
    59.2 +++ b/src/share/vm/classfile/systemDictionary.cpp	Fri Feb 25 12:46:46 2011 -0800
    59.3 @@ -1690,6 +1690,8 @@
    59.4  
    59.5  void SystemDictionary::add_to_hierarchy(instanceKlassHandle k, TRAPS) {
    59.6    assert(k.not_null(), "just checking");
    59.7 +  assert_locked_or_safepoint(Compile_lock);
    59.8 +
    59.9    // Link into hierachy. Make sure the vtables are initialized before linking into
   59.10    k->append_to_sibling_list();                    // add to superklass/sibling list
   59.11    k->process_interfaces(THREAD);                  // handle all "implements" declarations
   59.12 @@ -2152,6 +2154,9 @@
   59.13  }
   59.14  
   59.15  
   59.16 +// Try to find a class name using the loader constraints.  The
   59.17 +// loader constraints might know about a class that isn't fully loaded
   59.18 +// yet and these will be ignored.
   59.19  klassOop SystemDictionary::find_constrained_instance_or_array_klass(
   59.20                      Symbol* class_name, Handle class_loader, TRAPS) {
   59.21  
    60.1 --- a/src/share/vm/compiler/compileBroker.cpp	Fri Feb 25 11:42:03 2011 -0800
    60.2 +++ b/src/share/vm/compiler/compileBroker.cpp	Fri Feb 25 12:46:46 2011 -0800
    60.3 @@ -768,7 +768,9 @@
    60.4  // Initialize the compilation queue
    60.5  void CompileBroker::init_compiler_threads(int c1_compiler_count, int c2_compiler_count) {
    60.6    EXCEPTION_MARK;
    60.7 +#ifndef ZERO
    60.8    assert(c2_compiler_count > 0 || c1_compiler_count > 0, "No compilers?");
    60.9 +#endif // !ZERO
   60.10    if (c2_compiler_count > 0) {
   60.11      _c2_method_queue  = new CompileQueue("C2MethodQueue",  MethodCompileQueue_lock);
   60.12    }
    61.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Fri Feb 25 11:42:03 2011 -0800
    61.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Fri Feb 25 12:46:46 2011 -0800
    61.3 @@ -1040,9 +1040,10 @@
    61.4      } else {
    61.5        // must read from what 'p' points to in each loop.
    61.6        klassOop k = ((volatile oopDesc*)p)->klass_or_null();
    61.7 -      if (k != NULL &&
    61.8 -          ((oopDesc*)p)->is_parsable() &&
    61.9 -          ((oopDesc*)p)->is_conc_safe()) {
   61.10 +      // We trust the size of any object that has a non-NULL
   61.11 +      // klass and (for those in the perm gen) is parsable
   61.12 +      // -- irrespective of its conc_safe-ty.
   61.13 +      if (k != NULL && ((oopDesc*)p)->is_parsable()) {
   61.14          assert(k->is_oop(), "Should really be klass oop.");
   61.15          oop o = (oop)p;
   61.16          assert(o->is_oop(), "Should be an oop");
   61.17 @@ -1051,6 +1052,7 @@
   61.18          assert(res != 0, "Block size should not be 0");
   61.19          return res;
   61.20        } else {
   61.21 +        // May return 0 if P-bits not present.
   61.22          return c->block_size_if_printezis_bits(p);
   61.23        }
   61.24      }
    62.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Feb 25 11:42:03 2011 -0800
    62.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Fri Feb 25 12:46:46 2011 -0800
    62.3 @@ -6360,18 +6360,16 @@
    62.4  // A variant of the above (block_size_using_printezis_bits()) except
    62.5  // that we return 0 if the P-bits are not yet set.
    62.6  size_t CMSCollector::block_size_if_printezis_bits(HeapWord* addr) const {
    62.7 -  if (_markBitMap.isMarked(addr)) {
    62.8 -    assert(_markBitMap.isMarked(addr + 1), "Missing Printezis bit?");
    62.9 +  if (_markBitMap.isMarked(addr + 1)) {
   62.10 +    assert(_markBitMap.isMarked(addr), "P-bit can be set only for marked objects");
   62.11      HeapWord* nextOneAddr = _markBitMap.getNextMarkedWordAddress(addr + 2);
   62.12      size_t size = pointer_delta(nextOneAddr + 1, addr);
   62.13      assert(size == CompactibleFreeListSpace::adjustObjectSize(size),
   62.14             "alignment problem");
   62.15      assert(size >= 3, "Necessary for Printezis marks to work");
   62.16      return size;
   62.17 -  } else {
   62.18 -    assert(!_markBitMap.isMarked(addr + 1), "Bit map inconsistency?");
   62.19 -    return 0;
   62.20 -  }
   62.21 +  }
   62.22 +  return 0;
   62.23  }
   62.24  
   62.25  HeapWord* CMSCollector::next_card_start_after_block(HeapWord* addr) const {
   62.26 @@ -9212,7 +9210,6 @@
   62.27  
   62.28  size_t MarkDeadObjectsClosure::do_blk(HeapWord* addr) {
   62.29    size_t res = _sp->block_size_no_stall(addr, _collector);
   62.30 -  assert(res != 0, "Should always be able to compute a size");
   62.31    if (_sp->block_is_obj(addr)) {
   62.32      if (_live_bit_map->isMarked(addr)) {
   62.33        // It can't have been dead in a previous cycle
   62.34 @@ -9221,6 +9218,7 @@
   62.35        _dead_bit_map->mark(addr);      // mark the dead object
   62.36      }
   62.37    }
   62.38 +  // Could be 0, if the block size could not be computed without stalling.
   62.39    return res;
   62.40  }
   62.41  
    63.1 --- a/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp	Fri Feb 25 11:42:03 2011 -0800
    63.2 +++ b/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp	Fri Feb 25 12:46:46 2011 -0800
    63.3 @@ -1,5 +1,5 @@
    63.4  /*
    63.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    63.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    63.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    63.8   *
    63.9   * This code is free software; you can redistribute it and/or modify it
   63.10 @@ -132,8 +132,7 @@
   63.11    VM_GenCollectFullConcurrent(unsigned int gc_count_before,
   63.12                                unsigned int full_gc_count_before,
   63.13                                GCCause::Cause gc_cause)
   63.14 -    : VM_GC_Operation(gc_count_before, full_gc_count_before, true /* full */) {
   63.15 -    _gc_cause = gc_cause;
   63.16 +    : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */) {
   63.17      assert(FullGCCount_lock != NULL, "Error");
   63.18      assert(UseAsyncConcMarkSweepGC, "Else will hang caller");
   63.19    }
    64.1 --- a/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp	Fri Feb 25 11:42:03 2011 -0800
    64.2 +++ b/src/share/vm/gc_implementation/g1/vm_operations_g1.hpp	Fri Feb 25 12:46:46 2011 -0800
    64.3 @@ -1,5 +1,5 @@
    64.4  /*
    64.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    64.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    64.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    64.8   *
    64.9   * This code is free software; you can redistribute it and/or modify it
   64.10 @@ -44,7 +44,7 @@
   64.11  public:
   64.12    VM_G1OperationWithAllocRequest(unsigned int gc_count_before,
   64.13                                   size_t       word_size)
   64.14 -    : VM_GC_Operation(gc_count_before),
   64.15 +    : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure),
   64.16        _word_size(word_size), _result(NULL), _pause_succeeded(false) { }
   64.17    HeapWord* result() { return _result; }
   64.18    bool pause_succeeded() { return _pause_succeeded; }
   64.19 @@ -55,9 +55,7 @@
   64.20    VM_G1CollectFull(unsigned int gc_count_before,
   64.21                     unsigned int full_gc_count_before,
   64.22                     GCCause::Cause cause)
   64.23 -    : VM_GC_Operation(gc_count_before, full_gc_count_before) {
   64.24 -    _gc_cause = cause;
   64.25 -  }
   64.26 +    : VM_GC_Operation(gc_count_before, cause, full_gc_count_before) { }
   64.27    virtual VMOp_Type type() const { return VMOp_G1CollectFull; }
   64.28    virtual void doit();
   64.29    virtual const char* name() const {
    65.1 --- a/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp	Fri Feb 25 11:42:03 2011 -0800
    65.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp	Fri Feb 25 12:46:46 2011 -0800
    65.3 @@ -1,5 +1,5 @@
    65.4  /*
    65.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
    65.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
    65.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    65.8   *
    65.9   * This code is free software; you can redistribute it and/or modify it
   65.10 @@ -112,9 +112,12 @@
   65.11    yg_cur_size = MAX2(yg_cur_size, yg_min_size);
   65.12  
   65.13    og_min_size = align_size_up(og_min_size, og_align);
   65.14 -  og_max_size = align_size_up(og_max_size, og_align);
   65.15 +  // Align old gen size down to preserve specified heap size.
   65.16 +  assert(og_align == yg_align, "sanity");
   65.17 +  og_max_size = align_size_down(og_max_size, og_align);
   65.18 +  og_max_size = MAX2(og_max_size, og_min_size);
   65.19    size_t og_cur_size =
   65.20 -    align_size_up(_collector_policy->old_gen_size(), og_align);
   65.21 +    align_size_down(_collector_policy->old_gen_size(), og_align);
   65.22    og_cur_size = MAX2(og_cur_size, og_min_size);
   65.23  
   65.24    pg_min_size = align_size_up(pg_min_size, pg_align);
    66.1 --- a/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Fri Feb 25 11:42:03 2011 -0800
    66.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Fri Feb 25 12:46:46 2011 -0800
    66.3 @@ -1,5 +1,5 @@
    66.4  /*
    66.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    66.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    66.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    66.8   *
    66.9   * This code is free software; you can redistribute it and/or modify it
   66.10 @@ -1196,11 +1196,6 @@
   66.11    static inline void adjust_pointer(oop* p)       { adjust_pointer(p, false); }
   66.12    static inline void adjust_pointer(narrowOop* p) { adjust_pointer(p, false); }
   66.13  
   66.14 -  template <class T>
   66.15 -  static inline void adjust_pointer(T* p,
   66.16 -                                    HeapWord* beg_addr,
   66.17 -                                    HeapWord* end_addr);
   66.18 -
   66.19    // Reference Processing
   66.20    static ReferenceProcessor* const ref_processor() { return _ref_processor; }
   66.21  
   66.22 @@ -1408,15 +1403,6 @@
   66.23    return ((HeapWord*) k) >= dense_prefix(perm_space_id);
   66.24  }
   66.25  
   66.26 -template <class T>
   66.27 -inline void PSParallelCompact::adjust_pointer(T* p,
   66.28 -                                              HeapWord* beg_addr,
   66.29 -                                              HeapWord* end_addr) {
   66.30 -  if (is_in((HeapWord*)p, beg_addr, end_addr)) {
   66.31 -    adjust_pointer(p);
   66.32 -  }
   66.33 -}
   66.34 -
   66.35  #ifdef ASSERT
   66.36  inline void
   66.37  PSParallelCompact::check_new_location(HeapWord* old_addr, HeapWord* new_addr)
    67.1 --- a/src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.cpp	Fri Feb 25 11:42:03 2011 -0800
    67.2 +++ b/src/share/vm/gc_implementation/parallelScavenge/vmPSOperations.cpp	Fri Feb 25 12:46:46 2011 -0800
    67.3 @@ -1,5 +1,5 @@
    67.4  /*
    67.5 - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
    67.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
    67.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    67.8   *
    67.9   * This code is free software; you can redistribute it and/or modify it
   67.10 @@ -34,7 +34,7 @@
   67.11  // The following methods are used by the parallel scavenge collector
   67.12  VM_ParallelGCFailedAllocation::VM_ParallelGCFailedAllocation(size_t size,
   67.13    bool is_tlab, unsigned int gc_count) :
   67.14 -  VM_GC_Operation(gc_count),
   67.15 +  VM_GC_Operation(gc_count, GCCause::_allocation_failure),
   67.16    _size(size),
   67.17    _is_tlab(is_tlab),
   67.18    _result(NULL)
   67.19 @@ -57,7 +57,7 @@
   67.20  
   67.21  VM_ParallelGCFailedPermanentAllocation::VM_ParallelGCFailedPermanentAllocation(size_t size,
   67.22    unsigned int gc_count, unsigned int full_gc_count) :
   67.23 -  VM_GC_Operation(gc_count, full_gc_count, true /* full */),
   67.24 +  VM_GC_Operation(gc_count, GCCause::_allocation_failure, full_gc_count, true /* full */),
   67.25    _size(size),
   67.26    _result(NULL)
   67.27  {
   67.28 @@ -80,9 +80,8 @@
   67.29  VM_ParallelGCSystemGC::VM_ParallelGCSystemGC(unsigned int gc_count,
   67.30                                               unsigned int full_gc_count,
   67.31                                               GCCause::Cause gc_cause) :
   67.32 -  VM_GC_Operation(gc_count, full_gc_count, true /* full */)
   67.33 +  VM_GC_Operation(gc_count, gc_cause, full_gc_count, true /* full */)
   67.34  {
   67.35 -  _gc_cause = gc_cause;
   67.36  }
   67.37  
   67.38  void VM_ParallelGCSystemGC::doit() {
    68.1 --- a/src/share/vm/gc_implementation/shared/vmGCOperations.cpp	Fri Feb 25 11:42:03 2011 -0800
    68.2 +++ b/src/share/vm/gc_implementation/shared/vmGCOperations.cpp	Fri Feb 25 12:46:46 2011 -0800
    68.3 @@ -1,5 +1,5 @@
    68.4  /*
    68.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    68.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    68.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    68.8   *
    68.9   * This code is free software; you can redistribute it and/or modify it
   68.10 @@ -87,6 +87,8 @@
   68.11  
   68.12  bool VM_GC_Operation::doit_prologue() {
   68.13    assert(Thread::current()->is_Java_thread(), "just checking");
   68.14 +  assert(((_gc_cause != GCCause::_no_gc) &&
   68.15 +          (_gc_cause != GCCause::_no_cause_specified)), "Illegal GCCause");
   68.16  
   68.17    acquire_pending_list_lock();
   68.18    // If the GC count has changed someone beat us to the collection
    69.1 --- a/src/share/vm/gc_implementation/shared/vmGCOperations.hpp	Fri Feb 25 11:42:03 2011 -0800
    69.2 +++ b/src/share/vm/gc_implementation/shared/vmGCOperations.hpp	Fri Feb 25 12:46:46 2011 -0800
    69.3 @@ -1,5 +1,5 @@
    69.4  /*
    69.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
    69.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
    69.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    69.8   *
    69.9   * This code is free software; you can redistribute it and/or modify it
   69.10 @@ -85,6 +85,7 @@
   69.11  
   69.12   public:
   69.13    VM_GC_Operation(unsigned int gc_count_before,
   69.14 +                  GCCause::Cause _cause,
   69.15                    unsigned int full_gc_count_before = 0,
   69.16                    bool full = false) {
   69.17      _full = full;
   69.18 @@ -92,7 +93,7 @@
   69.19      _gc_count_before    = gc_count_before;
   69.20  
   69.21      // A subclass constructor will likely overwrite the following
   69.22 -    _gc_cause           = GCCause::_no_cause_specified;
   69.23 +    _gc_cause           = _cause;
   69.24  
   69.25      _gc_locked = false;
   69.26  
   69.27 @@ -136,6 +137,7 @@
   69.28    VM_GC_HeapInspection(outputStream* out, bool request_full_gc,
   69.29                         bool need_prologue) :
   69.30      VM_GC_Operation(0 /* total collections,      dummy, ignored */,
   69.31 +                    GCCause::_heap_inspection /* GC Cause */,
   69.32                      0 /* total full collections, dummy, ignored */,
   69.33                      request_full_gc) {
   69.34      _out = out;
   69.35 @@ -160,7 +162,7 @@
   69.36    VM_GenCollectForAllocation(size_t size,
   69.37                               bool tlab,
   69.38                               unsigned int gc_count_before)
   69.39 -    : VM_GC_Operation(gc_count_before),
   69.40 +    : VM_GC_Operation(gc_count_before, GCCause::_allocation_failure),
   69.41        _size(size),
   69.42        _tlab(tlab) {
   69.43      _res = NULL;
   69.44 @@ -182,9 +184,8 @@
   69.45                      unsigned int full_gc_count_before,
   69.46                      GCCause::Cause gc_cause,
   69.47                        int max_level)
   69.48 -    : VM_GC_Operation(gc_count_before, full_gc_count_before, true /* full */),
   69.49 -      _max_level(max_level)
   69.50 -  { _gc_cause = gc_cause; }
   69.51 +    : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */),
   69.52 +      _max_level(max_level) { }
   69.53    ~VM_GenCollectFull() {}
   69.54    virtual VMOp_Type type() const { return VMOp_GenCollectFull; }
   69.55    virtual void doit();
   69.56 @@ -199,7 +200,7 @@
   69.57                                        unsigned int gc_count_before,
   69.58                                        unsigned int full_gc_count_before,
   69.59                                        GCCause::Cause gc_cause)
   69.60 -    : VM_GC_Operation(gc_count_before, full_gc_count_before, true),
   69.61 +    : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true),
   69.62        _size(size) {
   69.63      _res = NULL;
   69.64      _gc_cause = gc_cause;
    70.1 --- a/src/share/vm/gc_interface/collectedHeap.cpp	Fri Feb 25 11:42:03 2011 -0800
    70.2 +++ b/src/share/vm/gc_interface/collectedHeap.cpp	Fri Feb 25 12:46:46 2011 -0800
    70.3 @@ -100,8 +100,7 @@
    70.4    }
    70.5  }
    70.6  
    70.7 -void CollectedHeap::check_for_non_bad_heap_word_value(HeapWord* addr, size_t size)
    70.8 - {
    70.9 +void CollectedHeap::check_for_non_bad_heap_word_value(HeapWord* addr, size_t size) {
   70.10    if (CheckMemoryInitialization && ZapUnusedHeapArea) {
   70.11      for (size_t slot = 0; slot < size; slot += 1) {
   70.12        assert((*(intptr_t*) (addr + slot)) == ((intptr_t) badHeapWordVal),
    71.1 --- a/src/share/vm/gc_interface/gcCause.cpp	Fri Feb 25 11:42:03 2011 -0800
    71.2 +++ b/src/share/vm/gc_interface/gcCause.cpp	Fri Feb 25 12:46:46 2011 -0800
    71.3 @@ -1,5 +1,5 @@
    71.4  /*
    71.5 - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    71.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
    71.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    71.8   *
    71.9   * This code is free software; you can redistribute it and/or modify it
   71.10 @@ -92,28 +92,3 @@
   71.11    }
   71.12    ShouldNotReachHere();
   71.13  }
   71.14 -
   71.15 -#ifndef PRODUCT
   71.16 -
   71.17 -bool GCCause::is_for_full_collection(GCCause::Cause cause) {
   71.18 -  bool result;
   71.19 -
   71.20 -  // There are more GCCause::Cause types than listed here.
   71.21 -  // For brevity, we list only those that cause full collections.
   71.22 -  switch (cause) {
   71.23 -    case _allocation_failure:
   71.24 -    case _tenured_generation_full:
   71.25 -    case _permanent_generation_full:
   71.26 -    case _cms_generation_full:
   71.27 -    case _last_ditch_collection:
   71.28 -      result = true;
   71.29 -      break;
   71.30 -
   71.31 -    default:
   71.32 -      result = false;
   71.33 -      break;
   71.34 -  }
   71.35 -  return result;
   71.36 -}
   71.37 -
   71.38 -#endif // PRODUCT
    72.1 --- a/src/share/vm/gc_interface/gcCause.hpp	Fri Feb 25 11:42:03 2011 -0800
    72.2 +++ b/src/share/vm/gc_interface/gcCause.hpp	Fri Feb 25 12:46:46 2011 -0800
    72.3 @@ -1,5 +1,5 @@
    72.4  /*
    72.5 - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
    72.6 + * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
    72.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    72.8   *
    72.9   * This code is free software; you can redistribute it and/or modify it
   72.10 @@ -85,8 +85,6 @@
   72.11  
   72.12    // Return a string describing the GCCause.
   72.13    static const char* to_string(GCCause::Cause cause);
   72.14 -  // Return true if the GCCause is for a full collection.
   72.15 -  static bool is_for_full_collection(GCCause::Cause cause) PRODUCT_RETURN0;
   72.16  };
   72.17  
   72.18  #endif // SHARE_VM_GC_INTERFACE_GCCAUSE_HPP
    73.1 --- a/src/share/vm/interpreter/bytecodeInterpreter.cpp	Fri Feb 25 11:42:03 2011 -0800
    73.2 +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp	Fri Feb 25 12:46:46 2011 -0800
    73.3 @@ -1942,7 +1942,7 @@
    73.4          constantPoolOop constants = istate->method()->constants();
    73.5          if (!constants->tag_at(index).is_unresolved_klass()) {
    73.6            // Make sure klass is initialized and doesn't have a finalizer
    73.7 -          oop entry = (klassOop) *constants->obj_at_addr(index);
    73.8 +          oop entry = constants->slot_at(index).get_oop();
    73.9            assert(entry->is_klass(), "Should be resolved klass");
   73.10            klassOop k_entry = (klassOop) entry;
   73.11            assert(k_entry->klass_part()->oop_is_instance(), "Should be instanceKlass");
   73.12 @@ -2032,7 +2032,7 @@
   73.13              if (METHOD->constants()->tag_at(index).is_unresolved_klass()) {
   73.14                CALL_VM(InterpreterRuntime::quicken_io_cc(THREAD), handle_exception);
   73.15              }
   73.16 -            klassOop klassOf = (klassOop) *(METHOD->constants()->obj_at_addr(index));
   73.17 +            klassOop klassOf = (klassOop) METHOD->constants()->slot_at(index).get_oop();
   73.18              klassOop objKlassOop = STACK_OBJECT(-1)->klass(); //ebx
   73.19              //
   73.20              // Check for compatibilty. This check must not GC!!
   73.21 @@ -2067,7 +2067,7 @@
   73.22              if (METHOD->constants()->tag_at(index).is_unresolved_klass()) {
   73.23                CALL_VM(InterpreterRuntime::quicken_io_cc(THREAD), handle_exception);
   73.24              }
   73.25 -            klassOop klassOf = (klassOop) *(METHOD->constants()->obj_at_addr(index));
   73.26 +            klassOop klassOf = (klassOop) METHOD->constants()->slot_at(index).get_oop();
   73.27              klassOop objKlassOop = STACK_OBJECT(-1)->klass();
   73.28              //
   73.29              // Check for compatibilty. This check must not GC!!
    74.1 --- a/src/share/vm/interpreter/rewriter.cpp	Fri Feb 25 11:42:03 2011 -0800
    74.2 +++ b/src/share/vm/interpreter/rewriter.cpp	Fri Feb 25 12:46:46 2011 -0800
    74.3 @@ -67,13 +67,11 @@
    74.4  
    74.5  
    74.6  // Creates a constant pool cache given a CPC map
    74.7 -// This creates the constant pool cache initially in a state
    74.8 -// that is unsafe for concurrent GC processing but sets it to
    74.9 -// a safe mode before the constant pool cache is returned.
   74.10  void Rewriter::make_constant_pool_cache(TRAPS) {
   74.11    const int length = _cp_cache_map.length();
   74.12    constantPoolCacheOop cache =
   74.13 -      oopFactory::new_constantPoolCache(length, methodOopDesc::IsUnsafeConc, CHECK);
   74.14 +      oopFactory::new_constantPoolCache(length, CHECK);
   74.15 +  No_Safepoint_Verifier nsv;
   74.16    cache->initialize(_cp_cache_map);
   74.17  
   74.18    // Don't bother with the next pass if there is no JVM_CONSTANT_InvokeDynamic.
    75.1 --- a/src/share/vm/libadt/vectset.cpp	Fri Feb 25 11:42:03 2011 -0800
    75.2 +++ b/src/share/vm/libadt/vectset.cpp	Fri Feb 25 12:46:46 2011 -0800
    75.3 @@ -1,5 +1,5 @@
    75.4  /*
    75.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    75.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    75.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    75.8   *
    75.9   * This code is free software; you can redistribute it and/or modify it
   75.10 @@ -350,28 +350,11 @@
   75.11    return (int)_xor;
   75.12  }
   75.13  
   75.14 -//------------------------------iterate----------------------------------------
   75.15 -SetI_ *VectorSet::iterate(uint &elem) const
   75.16 -{
   75.17 -  VSetI_ *foo = (new(ResourceObj::C_HEAP) VSetI_(this));
   75.18 -  elem = foo->next();
   75.19 -  return foo;
   75.20 -}
   75.21 -
   75.22  //=============================================================================
   75.23 -//------------------------------VSetI_-----------------------------------------
   75.24 -// Initialize the innards of a VectorSet iterator
   75.25 -VSetI_::VSetI_( const VectorSet *vset ) : s(vset)
   75.26 -{
   75.27 -  i = (uint)-1L;
   75.28 -  j = (uint)-1L;
   75.29 -  mask = (unsigned)(1L<<31);
   75.30 -}
   75.31 -
   75.32  //------------------------------next-------------------------------------------
   75.33  // Find and return the next element of a vector set, or return garbage and
   75.34 -// make "VSetI_::test()" fail.
   75.35 -uint VSetI_::next(void)
   75.36 +// make "VectorSetI::test()" fail.
   75.37 +uint VectorSetI::next(void)
   75.38  {
   75.39    j++;                          // Next element in word
   75.40    mask = (mask & max_jint) << 1;// Next bit in word
    76.1 --- a/src/share/vm/libadt/vectset.hpp	Fri Feb 25 11:42:03 2011 -0800
    76.2 +++ b/src/share/vm/libadt/vectset.hpp	Fri Feb 25 12:46:46 2011 -0800
    76.3 @@ -1,5 +1,5 @@
    76.4  /*
    76.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    76.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    76.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    76.8   *
    76.9   * This code is free software; you can redistribute it and/or modify it
   76.10 @@ -98,6 +98,9 @@
   76.11    uint Size(void) const;            // Number of elements in the Set.
   76.12    void Sort(void);                  // Sort before iterating
   76.13    int hash() const;                 // Hash function
   76.14 +  void Reset(void) {                // Reset a set
   76.15 +    memset( data, 0, size*sizeof(uint32) );
   76.16 +  }
   76.17  
   76.18    /* Removed for MCC BUG
   76.19       operator const VectorSet* (void) const { return this; } */
   76.20 @@ -148,8 +151,7 @@
   76.21  
   76.22  
   76.23  private:
   76.24 -  friend class VSetI_;
   76.25 -  SetI_ *iterate(uint&) const;
   76.26 +  SetI_ *iterate(uint&) const { ShouldNotCallThis(); return NULL; } // Removed
   76.27  };
   76.28  
   76.29  //------------------------------Iteration--------------------------------------
   76.30 @@ -158,22 +160,26 @@
   76.31  // or may not be iterated over; untouched elements will be affected once.
   76.32  // Usage:  for( VectorSetI i(s); i.test(); i++ ) { body = i.elem; }
   76.33  
   76.34 -class VSetI_ : public SetI_ {
   76.35 +class VectorSetI : public StackObj {
   76.36    friend class VectorSet;
   76.37 -  friend class VectorSetI;
   76.38    const VectorSet *s;
   76.39    uint i, j;
   76.40    uint32 mask;
   76.41 -  VSetI_(const VectorSet *vset);
   76.42    uint next(void);
   76.43 +
   76.44 +public:
   76.45 +  uint elem;                    // The publically accessible element
   76.46 +
   76.47 +  VectorSetI( const VectorSet *vset ) :
   76.48 +    s(vset),
   76.49 +    i((uint)-1L),
   76.50 +    j((uint)-1L),
   76.51 +    mask((unsigned)(1L<<31)) {
   76.52 +    elem = next();
   76.53 +  }
   76.54 +
   76.55 +  void operator ++(void) { elem = next(); }
   76.56    int test(void) { return i < s->size; }
   76.57  };
   76.58  
   76.59 -class VectorSetI : public SetI {
   76.60 -public:
   76.61 -  VectorSetI( const VectorSet *s ) : SetI(s) { }
   76.62 -  void operator ++(void) { elem = ((VSetI_*)impl)->next(); }
   76.63 -  int test(void) { return ((VSetI_*)impl)->test(); }
   76.64 -};
   76.65 -
   76.66  #endif // SHARE_VM_LIBADT_VECTSET_HPP
    77.1 --- a/src/share/vm/memory/allocation.cpp	Fri Feb 25 11:42:03 2011 -0800
    77.2 +++ b/src/share/vm/memory/allocation.cpp	Fri Feb 25 12:46:46 2011 -0800
    77.3 @@ -1,5 +1,5 @@
    77.4  /*
    77.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    77.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    77.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    77.8   *
    77.9   * This code is free software; you can redistribute it and/or modify it
   77.10 @@ -157,7 +157,7 @@
   77.11  
   77.12  void trace_heap_malloc(size_t size, const char* name, void* p) {
   77.13    // A lock is not needed here - tty uses a lock internally
   77.14 -  tty->print_cr("Heap malloc " INTPTR_FORMAT " %7d %s", p, size, name == NULL ? "" : name);
   77.15 +  tty->print_cr("Heap malloc " INTPTR_FORMAT " " SIZE_FORMAT " %s", p, size, name == NULL ? "" : name);
   77.16  }
   77.17  
   77.18  
   77.19 @@ -573,22 +573,27 @@
   77.20    st->print("AllocatedObj(" INTPTR_FORMAT ")", this);
   77.21  }
   77.22  
   77.23 -size_t Arena::_bytes_allocated = 0;
   77.24 +julong Arena::_bytes_allocated = 0;
   77.25 +
   77.26 +void Arena::inc_bytes_allocated(size_t x) { inc_stat_counter(&_bytes_allocated, x); }
   77.27  
   77.28  AllocStats::AllocStats() {
   77.29 -  start_mallocs = os::num_mallocs;
   77.30 -  start_frees = os::num_frees;
   77.31 +  start_mallocs      = os::num_mallocs;
   77.32 +  start_frees        = os::num_frees;
   77.33    start_malloc_bytes = os::alloc_bytes;
   77.34 -  start_res_bytes = Arena::_bytes_allocated;
   77.35 +  start_mfree_bytes  = os::free_bytes;
   77.36 +  start_res_bytes    = Arena::_bytes_allocated;
   77.37  }
   77.38  
   77.39 -int     AllocStats::num_mallocs() { return os::num_mallocs - start_mallocs; }
   77.40 -size_t  AllocStats::alloc_bytes() { return os::alloc_bytes - start_malloc_bytes; }
   77.41 -size_t  AllocStats::resource_bytes() { return Arena::_bytes_allocated - start_res_bytes; }
   77.42 -int     AllocStats::num_frees() { return os::num_frees - start_frees; }
   77.43 +julong  AllocStats::num_mallocs() { return os::num_mallocs - start_mallocs; }
   77.44 +julong  AllocStats::alloc_bytes() { return os::alloc_bytes - start_malloc_bytes; }
   77.45 +julong  AllocStats::num_frees()   { return os::num_frees - start_frees; }
   77.46 +julong  AllocStats::free_bytes()  { return os::free_bytes - start_mfree_bytes; }
   77.47 +julong  AllocStats::resource_bytes() { return Arena::_bytes_allocated - start_res_bytes; }
   77.48  void    AllocStats::print() {
   77.49 -  tty->print("%d mallocs (%ldK), %d frees, %ldK resrc",
   77.50 -             num_mallocs(), alloc_bytes()/K, num_frees(), resource_bytes()/K);
   77.51 +  tty->print_cr(UINT64_FORMAT " mallocs (" UINT64_FORMAT "MB), "
   77.52 +                UINT64_FORMAT" frees (" UINT64_FORMAT "MB), " UINT64_FORMAT "MB resrc",
   77.53 +                num_mallocs(), alloc_bytes()/M, num_frees(), free_bytes()/M, resource_bytes()/M);
   77.54  }
   77.55  
   77.56  
    78.1 --- a/src/share/vm/memory/allocation.hpp	Fri Feb 25 11:42:03 2011 -0800
    78.2 +++ b/src/share/vm/memory/allocation.hpp	Fri Feb 25 12:46:46 2011 -0800
    78.3 @@ -1,5 +1,5 @@
    78.4  /*
    78.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    78.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    78.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    78.8   *
    78.9   * This code is free software; you can redistribute it and/or modify it
   78.10 @@ -202,10 +202,11 @@
   78.11    char *_hwm, *_max;            // High water mark and max in current chunk
   78.12    void* grow(size_t x);         // Get a new Chunk of at least size x
   78.13    NOT_PRODUCT(size_t _size_in_bytes;) // Size of arena (used for memory usage tracing)
   78.14 -  NOT_PRODUCT(static size_t _bytes_allocated;) // total #bytes allocated since start
   78.15 +  NOT_PRODUCT(static julong _bytes_allocated;) // total #bytes allocated since start
   78.16    friend class AllocStats;
   78.17    debug_only(void* malloc(size_t size);)
   78.18    debug_only(void* internal_malloc_4(size_t x);)
   78.19 +  NOT_PRODUCT(void inc_bytes_allocated(size_t x);)
   78.20   public:
   78.21    Arena();
   78.22    Arena(size_t init_size);
   78.23 @@ -219,7 +220,7 @@
   78.24      assert(is_power_of_2(ARENA_AMALLOC_ALIGNMENT) , "should be a power of 2");
   78.25      x = ARENA_ALIGN(x);
   78.26      debug_only(if (UseMallocOnly) return malloc(x);)
   78.27 -    NOT_PRODUCT(_bytes_allocated += x);
   78.28 +    NOT_PRODUCT(inc_bytes_allocated(x);)
   78.29      if (_hwm + x > _max) {
   78.30        return grow(x);
   78.31      } else {
   78.32 @@ -232,7 +233,7 @@
   78.33    void *Amalloc_4(size_t x) {
   78.34      assert( (x&(sizeof(char*)-1)) == 0, "misaligned size" );
   78.35      debug_only(if (UseMallocOnly) return malloc(x);)
   78.36 -    NOT_PRODUCT(_bytes_allocated += x);
   78.37 +    NOT_PRODUCT(inc_bytes_allocated(x);)
   78.38      if (_hwm + x > _max) {
   78.39        return grow(x);
   78.40      } else {
   78.41 @@ -252,7 +253,7 @@
   78.42      size_t delta = (((size_t)_hwm + DALIGN_M1) & ~DALIGN_M1) - (size_t)_hwm;
   78.43      x += delta;
   78.44  #endif
   78.45 -    NOT_PRODUCT(_bytes_allocated += x);
   78.46 +    NOT_PRODUCT(inc_bytes_allocated(x);)
   78.47      if (_hwm + x > _max) {
   78.48        return grow(x); // grow() returns a result aligned >= 8 bytes.
   78.49      } else {
   78.50 @@ -406,15 +407,16 @@
   78.51  // for statistics
   78.52  #ifndef PRODUCT
   78.53  class AllocStats : StackObj {
   78.54 -  int    start_mallocs, start_frees;
   78.55 -  size_t start_malloc_bytes, start_res_bytes;
   78.56 +  julong start_mallocs, start_frees;
   78.57 +  julong start_malloc_bytes, start_mfree_bytes, start_res_bytes;
   78.58   public:
   78.59    AllocStats();
   78.60  
   78.61 -  int    num_mallocs();    // since creation of receiver
   78.62 -  size_t alloc_bytes();
   78.63 -  size_t resource_bytes();
   78.64 -  int    num_frees();
   78.65 +  julong num_mallocs();    // since creation of receiver
   78.66 +  julong alloc_bytes();
   78.67 +  julong num_frees();
   78.68 +  julong free_bytes();
   78.69 +  julong resource_bytes();
   78.70    void   print();
   78.71  };
   78.72  #endif
    79.1 --- a/src/share/vm/memory/allocation.inline.hpp	Fri Feb 25 11:42:03 2011 -0800
    79.2 +++ b/src/share/vm/memory/allocation.inline.hpp	Fri Feb 25 12:46:46 2011 -0800
    79.3 @@ -1,5 +1,5 @@
    79.4  /*
    79.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    79.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    79.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    79.8   *
    79.9   * This code is free software; you can redistribute it and/or modify it
   79.10 @@ -32,6 +32,20 @@
   79.11  void trace_heap_malloc(size_t size, const char* name, void *p);
   79.12  void trace_heap_free(void *p);
   79.13  
   79.14 +#ifndef PRODUCT
   79.15 +// Increments unsigned long value for statistics (not atomic on MP).
   79.16 +inline void inc_stat_counter(volatile julong* dest, julong add_value) {
   79.17 +#if defined(SPARC) || defined(X86)
   79.18 +  // Sparc and X86 have atomic jlong (8 bytes) instructions
   79.19 +  julong value = Atomic::load((volatile jlong*)dest);
   79.20 +  value += add_value;
   79.21 +  Atomic::store((jlong)value, (volatile jlong*)dest);
   79.22 +#else
   79.23 +  // possible word-tearing during load/store
   79.24 +  *dest += add_value;
   79.25 +#endif
   79.26 +}
   79.27 +#endif
   79.28  
   79.29  // allocate using malloc; will fail if no memory available
   79.30  inline char* AllocateHeap(size_t size, const char* name = NULL) {
    80.1 --- a/src/share/vm/memory/oopFactory.cpp	Fri Feb 25 11:42:03 2011 -0800
    80.2 +++ b/src/share/vm/memory/oopFactory.cpp	Fri Feb 25 12:46:46 2011 -0800
    80.3 @@ -111,10 +111,9 @@
    80.4  
    80.5  
    80.6  constantPoolCacheOop oopFactory::new_constantPoolCache(int length,
    80.7 -                                                       bool is_conc_safe,
    80.8                                                         TRAPS) {
    80.9    constantPoolCacheKlass* ck = constantPoolCacheKlass::cast(Universe::constantPoolCacheKlassObj());
   80.10 -  return ck->allocate(length, is_conc_safe, CHECK_NULL);
   80.11 +  return ck->allocate(length, CHECK_NULL);
   80.12  }
   80.13  
   80.14  
    81.1 --- a/src/share/vm/memory/oopFactory.hpp	Fri Feb 25 11:42:03 2011 -0800
    81.2 +++ b/src/share/vm/memory/oopFactory.hpp	Fri Feb 25 12:46:46 2011 -0800
    81.3 @@ -69,7 +69,6 @@
    81.4                                                      bool is_conc_safe,
    81.5                                                      TRAPS);
    81.6    static constantPoolCacheOop new_constantPoolCache(int length,
    81.7 -                                                    bool is_conc_safe,
    81.8                                                      TRAPS);
    81.9  
   81.10    // Instance classes
    82.1 --- a/src/share/vm/oops/arrayKlassKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
    82.2 +++ b/src/share/vm/oops/arrayKlassKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
    82.3 @@ -1,5 +1,5 @@
    82.4  /*
    82.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    82.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    82.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    82.8   *
    82.9   * This code is free software; you can redistribute it and/or modify it
   82.10 @@ -128,27 +128,6 @@
   82.11    }
   82.12    return klassKlass::oop_update_pointers(cm, obj);
   82.13  }
   82.14 -
   82.15 -int
   82.16 -arrayKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
   82.17 -                                     HeapWord* beg_addr, HeapWord* end_addr) {
   82.18 -  assert(obj->is_klass(), "must be klass");
   82.19 -  arrayKlass* ak = arrayKlass::cast(klassOop(obj));
   82.20 -
   82.21 -  oop* p;
   82.22 -  p = ak->adr_component_mirror();
   82.23 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   82.24 -  p = ak->adr_lower_dimension();
   82.25 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   82.26 -  p = ak->adr_higher_dimension();
   82.27 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   82.28 -
   82.29 -  {
   82.30 -    HandleMark hm;
   82.31 -    ak->vtable()->oop_update_pointers(cm, beg_addr, end_addr);
   82.32 -  }
   82.33 -  return klassKlass::oop_update_pointers(cm, obj, beg_addr, end_addr);
   82.34 -}
   82.35  #endif // SERIALGC
   82.36  
   82.37  // Printing
    83.1 --- a/src/share/vm/oops/compiledICHolderKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
    83.2 +++ b/src/share/vm/oops/compiledICHolderKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
    83.3 @@ -1,5 +1,5 @@
    83.4  /*
    83.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    83.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
    83.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    83.8   *
    83.9   * This code is free software; you can redistribute it and/or modify it
   83.10 @@ -145,21 +145,6 @@
   83.11    PSParallelCompact::adjust_pointer(c->adr_holder_klass());
   83.12    return c->object_size();
   83.13  }
   83.14 -
   83.15 -int compiledICHolderKlass::oop_update_pointers(ParCompactionManager* cm,
   83.16 -                                               oop obj,
   83.17 -                                               HeapWord* beg_addr,
   83.18 -                                               HeapWord* end_addr) {
   83.19 -  assert(obj->is_compiledICHolder(), "must be compiledICHolder");
   83.20 -  compiledICHolderOop c = compiledICHolderOop(obj);
   83.21 -
   83.22 -  oop* p;
   83.23 -  p = c->adr_holder_method();
   83.24 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   83.25 -  p = c->adr_holder_klass();
   83.26 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   83.27 -  return c->object_size();
   83.28 -}
   83.29  #endif // SERIALGC
   83.30  
   83.31  // Printing
    84.1 --- a/src/share/vm/oops/constMethodKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
    84.2 +++ b/src/share/vm/oops/constMethodKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
    84.3 @@ -1,5 +1,5 @@
    84.4  /*
    84.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
    84.6 + * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    84.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    84.8   *
    84.9   * This code is free software; you can redistribute it and/or modify it
   84.10 @@ -184,21 +184,6 @@
   84.11    }
   84.12    return cm_oop->object_size();
   84.13  }
   84.14 -
   84.15 -int constMethodKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
   84.16 -                                          HeapWord* beg_addr,
   84.17 -                                          HeapWord* end_addr) {
   84.18 -  assert(obj->is_constMethod(), "should be constMethod");
   84.19 -  constMethodOop cm_oop = constMethodOop(obj);
   84.20 -
   84.21 -  oop* const beg_oop = MAX2((oop*)beg_addr, cm_oop->oop_block_beg());
   84.22 -  oop* const end_oop = MIN2((oop*)end_addr, cm_oop->oop_block_end());
   84.23 -  for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) {
   84.24 -    PSParallelCompact::adjust_pointer(cur_oop);
   84.25 -  }
   84.26 -
   84.27 -  return cm_oop->object_size();
   84.28 -}
   84.29  #endif // SERIALGC
   84.30  
   84.31  // Printing
    85.1 --- a/src/share/vm/oops/constantPoolKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
    85.2 +++ b/src/share/vm/oops/constantPoolKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
    85.3 @@ -1,5 +1,5 @@
    85.4  /*
    85.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    85.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    85.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    85.8   *
    85.9   * This code is free software; you can redistribute it and/or modify it
   85.10 @@ -55,26 +55,35 @@
   85.11  constantPoolOop constantPoolKlass::allocate(int length, bool is_conc_safe, TRAPS) {
   85.12    int size = constantPoolOopDesc::object_size(length);
   85.13    KlassHandle klass (THREAD, as_klassOop());
   85.14 -  constantPoolOop c =
   85.15 -    (constantPoolOop)CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
   85.16 +  assert(klass()->is_oop(), "Can't be null, else handlizing of c below won't work");
   85.17 +  constantPoolHandle pool;
   85.18 +  {
   85.19 +    constantPoolOop c =
   85.20 +      (constantPoolOop)CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
   85.21 +    assert(c->klass_or_null() != NULL, "Handlizing below won't work");
   85.22 +    pool = constantPoolHandle(THREAD, c);
   85.23 +  }
   85.24  
   85.25 -  c->set_length(length);
   85.26 -  c->set_tags(NULL);
   85.27 -  c->set_cache(NULL);
   85.28 -  c->set_operands(NULL);
   85.29 -  c->set_pool_holder(NULL);
   85.30 -  c->set_flags(0);
   85.31 +  pool->set_length(length);
   85.32 +  pool->set_tags(NULL);
   85.33 +  pool->set_cache(NULL);
   85.34 +  pool->set_operands(NULL);
   85.35 +  pool->set_pool_holder(NULL);
   85.36 +  pool->set_flags(0);
   85.37    // only set to non-zero if constant pool is merged by RedefineClasses
   85.38 -  c->set_orig_length(0);
   85.39 +  pool->set_orig_length(0);
   85.40    // if constant pool may change during RedefineClasses, it is created
   85.41    // unsafe for GC concurrent processing.
   85.42 -  c->set_is_conc_safe(is_conc_safe);
   85.43 +  pool->set_is_conc_safe(is_conc_safe);
   85.44    // all fields are initialized; needed for GC
   85.45  
   85.46 +  // Note: because we may be in this "conc_unsafe" state when allocating
   85.47 +  // t_oop below, which may in turn cause a GC, it is imperative that our
   85.48 +  // size be correct, consistent and henceforth stable, at this stage.
   85.49 +  assert(pool->is_oop() && pool->is_parsable(), "Else size() below is unreliable");
   85.50 +  assert(size == pool->size(), "size() is wrong");
   85.51 +
   85.52    // initialize tag array
   85.53 -  // Note: cannot introduce constant pool handle before since it is not
   85.54 -  //       completely initialized (no class) -> would cause assertion failure
   85.55 -  constantPoolHandle pool (THREAD, c);
   85.56    typeArrayOop t_oop = oopFactory::new_permanent_byteArray(length, CHECK_NULL);
   85.57    typeArrayHandle tags (THREAD, t_oop);
   85.58    for (int index = 0; index < length; index++) {
   85.59 @@ -82,6 +91,8 @@
   85.60    }
   85.61    pool->set_tags(tags());
   85.62  
   85.63 +  // Check that our size was stable at its old value.
   85.64 +  assert(size == pool->size(), "size() changed");
   85.65    return pool();
   85.66  }
   85.67  
   85.68 @@ -271,40 +282,6 @@
   85.69    return cp->object_size();
   85.70  }
   85.71  
   85.72 -int
   85.73 -constantPoolKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
   85.74 -                                       HeapWord* beg_addr, HeapWord* end_addr) {
   85.75 -  assert (obj->is_constantPool(), "obj must be constant pool");
   85.76 -  constantPoolOop cp = (constantPoolOop) obj;
   85.77 -
   85.78 -  // If the tags array is null we are in the middle of allocating this constant
   85.79 -  // pool.
   85.80 -  if (cp->tags() != NULL) {
   85.81 -    oop* base = (oop*)cp->base();
   85.82 -    oop* const beg_oop = MAX2((oop*)beg_addr, base);
   85.83 -    oop* const end_oop = MIN2((oop*)end_addr, base + cp->length());
   85.84 -    const size_t beg_idx = pointer_delta(beg_oop, base, sizeof(oop*));
   85.85 -    const size_t end_idx = pointer_delta(end_oop, base, sizeof(oop*));
   85.86 -    for (size_t cur_idx = beg_idx; cur_idx < end_idx; ++cur_idx, ++base) {
   85.87 -      if (cp->is_pointer_entry(int(cur_idx))) {
   85.88 -        PSParallelCompact::adjust_pointer(base);
   85.89 -      }
   85.90 -    }
   85.91 -  }
   85.92 -
   85.93 -  oop* p;
   85.94 -  p = cp->tags_addr();
   85.95 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   85.96 -  p = cp->cache_addr();
   85.97 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   85.98 -  p = cp->operands_addr();
   85.99 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
  85.100 -  p = cp->pool_holder_addr();
  85.101 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
  85.102 -
  85.103 -  return cp->object_size();
  85.104 -}
  85.105 -
  85.106  void constantPoolKlass::oop_push_contents(PSPromotionManager* pm, oop obj) {
  85.107    assert(obj->is_constantPool(), "should be constant pool");
  85.108    constantPoolOop cp = (constantPoolOop) obj;
    86.1 --- a/src/share/vm/oops/cpCacheKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
    86.2 +++ b/src/share/vm/oops/cpCacheKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
    86.3 @@ -1,5 +1,5 @@
    86.4  /*
    86.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    86.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
    86.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    86.8   *
    86.9   * This code is free software; you can redistribute it and/or modify it
   86.10 @@ -49,43 +49,31 @@
   86.11  
   86.12  
   86.13  constantPoolCacheOop constantPoolCacheKlass::allocate(int length,
   86.14 -                                                      bool is_conc_safe,
   86.15                                                        TRAPS) {
   86.16    // allocate memory
   86.17    int size = constantPoolCacheOopDesc::object_size(length);
   86.18  
   86.19    KlassHandle klass (THREAD, as_klassOop());
   86.20  
   86.21 -  // This is the original code.  The code from permanent_obj_allocate()
   86.22 -  // was in-lined to allow the setting of is_conc_safe before the klass
   86.23 -  // is installed.
   86.24 +  // Commented out below is the original code.  The code from
   86.25 +  // permanent_obj_allocate() was in-lined so that we could
   86.26 +  // set the _length field, necessary to correctly compute its
   86.27 +  // size(), before setting its klass word further below.
   86.28    // constantPoolCacheOop cache = (constantPoolCacheOop)
   86.29    //   CollectedHeap::permanent_obj_allocate(klass, size, CHECK_NULL);
   86.30  
   86.31    oop obj = CollectedHeap::permanent_obj_allocate_no_klass_install(klass, size, CHECK_NULL);
   86.32 -  constantPoolCacheOop cache = (constantPoolCacheOop) obj;
   86.33 -  cache->set_is_conc_safe(is_conc_safe);
   86.34 -  // The store to is_conc_safe must be visible before the klass
   86.35 -  // is set.  This should be done safely because _is_conc_safe has
   86.36 -  // been declared volatile.  If there are any problems, consider adding
   86.37 -  // OrderAccess::storestore();
   86.38 -  CollectedHeap::post_allocation_install_obj_klass(klass, obj, size);
   86.39    NOT_PRODUCT(Universe::heap()->check_for_bad_heap_word_value((HeapWord*) obj,
   86.40                                                                size));
   86.41 +  constantPoolCacheOop cache = (constantPoolCacheOop) obj;
   86.42 +  assert(!UseConcMarkSweepGC || obj->klass_or_null() == NULL,
   86.43 +         "klass should be NULL here when using CMS");
   86.44 +  cache->set_length(length);  // should become visible before klass is set below.
   86.45 +  cache->set_constant_pool(NULL);
   86.46  
   86.47 -  // The length field affects the size of the object.  The allocation
   86.48 -  // above allocates the correct size (see calculation of "size") but
   86.49 -  // the size() method of the constant pool cache oop will not reflect
   86.50 -  // that size until the correct length is set.
   86.51 -  cache->set_length(length);
   86.52 -
   86.53 -  // The store of the length must be visible before is_conc_safe is
   86.54 -  // set to a safe state.
   86.55 -  // This should be done safely because _is_conc_safe has
   86.56 -  // been declared volatile.  If there are any problems, consider adding
   86.57 -  // OrderAccess::storestore();
   86.58 -  cache->set_is_conc_safe(methodOopDesc::IsSafeConc);
   86.59 -  cache->set_constant_pool(NULL);
   86.60 +  OrderAccess::storestore();
   86.61 +  obj->set_klass(klass());
   86.62 +  assert(cache->size() == size, "Incorrect cache->size()");
   86.63    return cache;
   86.64  }
   86.65  
   86.66 @@ -176,11 +164,6 @@
   86.67    return size;
   86.68  }
   86.69  
   86.70 -bool constantPoolCacheKlass::oop_is_conc_safe(oop obj) const {
   86.71 -  assert(obj->is_constantPoolCache(), "should be constant pool");
   86.72 -  return constantPoolCacheOop(obj)->is_conc_safe();
   86.73 -}
   86.74 -
   86.75  #ifndef SERIALGC
   86.76  void constantPoolCacheKlass::oop_push_contents(PSPromotionManager* pm,
   86.77                                                 oop obj) {
   86.78 @@ -220,25 +203,6 @@
   86.79  
   86.80    return cache->object_size();
   86.81  }
   86.82 -
   86.83 -int
   86.84 -constantPoolCacheKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
   86.85 -                                            HeapWord* beg_addr,
   86.86 -                                            HeapWord* end_addr) {
   86.87 -  assert(obj->is_constantPoolCache(), "obj must be constant pool cache");
   86.88 -  constantPoolCacheOop cache = (constantPoolCacheOop)obj;
   86.89 -
   86.90 -  // Iteration over constant pool cache instance variables
   86.91 -  oop* p;
   86.92 -  p = (oop*)cache->constant_pool_addr();
   86.93 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   86.94 -
   86.95 -  // Iteration over constant pool cache entries
   86.96 -  for (int i = 0; i < cache->length(); ++i) {
   86.97 -    cache->entry_at(i)->update_pointers(beg_addr, end_addr);
   86.98 -  }
   86.99 -  return cache->object_size();
  86.100 -}
  86.101  #endif // SERIALGC
  86.102  
  86.103  void constantPoolCacheKlass::oop_print_on(oop obj, outputStream* st) {
    87.1 --- a/src/share/vm/oops/cpCacheKlass.hpp	Fri Feb 25 11:42:03 2011 -0800
    87.2 +++ b/src/share/vm/oops/cpCacheKlass.hpp	Fri Feb 25 12:46:46 2011 -0800
    87.3 @@ -39,7 +39,7 @@
    87.4  
    87.5    // Allocation
    87.6    DEFINE_ALLOCATE_PERMANENT(constantPoolCacheKlass);
    87.7 -  constantPoolCacheOop allocate(int length, bool is_conc_safe, TRAPS);
    87.8 +  constantPoolCacheOop allocate(int length, TRAPS);
    87.9    static klassOop create_klass(TRAPS);
   87.10  
   87.11    // Casting from klassOop
   87.12 @@ -55,7 +55,6 @@
   87.13    // Garbage collection
   87.14    void oop_follow_contents(oop obj);
   87.15    int oop_adjust_pointers(oop obj);
   87.16 -  virtual bool oop_is_conc_safe(oop obj) const;
   87.17  
   87.18    // Parallel Scavenge and Parallel Old
   87.19    PARALLEL_GC_DECLS
    88.1 --- a/src/share/vm/oops/cpCacheOop.cpp	Fri Feb 25 11:42:03 2011 -0800
    88.2 +++ b/src/share/vm/oops/cpCacheOop.cpp	Fri Feb 25 12:46:46 2011 -0800
    88.3 @@ -1,5 +1,5 @@
    88.4  /*
    88.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    88.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
    88.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    88.8   *
    88.9   * This code is free software; you can redistribute it and/or modify it
   88.10 @@ -98,15 +98,15 @@
   88.11  // Atomically sets f1 if it is still NULL, otherwise it keeps the
   88.12  // current value.
   88.13  void ConstantPoolCacheEntry::set_f1_if_null_atomic(oop f1) {
   88.14 -    // Use barriers as in oop_store
   88.15 -    HeapWord* f1_addr = (HeapWord*) &_f1;
   88.16 -    update_barrier_set_pre(f1_addr, f1);
   88.17 -    void* result = Atomic::cmpxchg_ptr(f1, f1_addr, NULL);
   88.18 -    bool success = (result == NULL);
   88.19 -    if (success) {
   88.20 -      update_barrier_set((void*) f1_addr, f1);
   88.21 -    }
   88.22 +  // Use barriers as in oop_store
   88.23 +  oop* f1_addr = (oop*) &_f1;
   88.24 +  update_barrier_set_pre(f1_addr, f1);
   88.25 +  void* result = Atomic::cmpxchg_ptr(f1, f1_addr, NULL);
   88.26 +  bool success = (result == NULL);
   88.27 +  if (success) {
   88.28 +    update_barrier_set(f1_addr, f1);
   88.29    }
   88.30 +}
   88.31  
   88.32  #ifdef ASSERT
   88.33  // It is possible to have two different dummy methodOops created
   88.34 @@ -368,16 +368,6 @@
   88.35      PSParallelCompact::adjust_pointer((oop*)&_f2);
   88.36    }
   88.37  }
   88.38 -
   88.39 -void ConstantPoolCacheEntry::update_pointers(HeapWord* beg_addr,
   88.40 -                                             HeapWord* end_addr) {
   88.41 -  assert(in_words(size()) == 4, "check code below - may need adjustment");
   88.42 -  // field[1] is always oop or NULL
   88.43 -  PSParallelCompact::adjust_pointer((oop*)&_f1, beg_addr, end_addr);
   88.44 -  if (is_vfinal()) {
   88.45 -    PSParallelCompact::adjust_pointer((oop*)&_f2, beg_addr, end_addr);
   88.46 -  }
   88.47 -}
   88.48  #endif // SERIALGC
   88.49  
   88.50  // RedefineClasses() API support:
    89.1 --- a/src/share/vm/oops/cpCacheOop.hpp	Fri Feb 25 11:42:03 2011 -0800
    89.2 +++ b/src/share/vm/oops/cpCacheOop.hpp	Fri Feb 25 12:46:46 2011 -0800
    89.3 @@ -1,5 +1,5 @@
    89.4  /*
    89.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
    89.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
    89.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    89.8   *
    89.9   * This code is free software; you can redistribute it and/or modify it
   89.10 @@ -287,7 +287,6 @@
   89.11  #endif // SERIALGC
   89.12  
   89.13    void update_pointers();
   89.14 -  void update_pointers(HeapWord* beg_addr, HeapWord* end_addr);
   89.15  
   89.16    // RedefineClasses() API support:
   89.17    // If this constantPoolCacheEntry refers to old_method then update it
   89.18 @@ -321,9 +320,6 @@
   89.19   private:
   89.20    int             _length;
   89.21    constantPoolOop _constant_pool;                // the corresponding constant pool
   89.22 -  // If true, safe for concurrent GC processing,
   89.23 -  // Set unconditionally in constantPoolCacheKlass::allocate()
   89.24 -  volatile bool        _is_conc_safe;
   89.25  
   89.26    // Sizing
   89.27    debug_only(friend class ClassVerifier;)
   89.28 @@ -390,12 +386,6 @@
   89.29      return entry_at(primary_index);
   89.30    }
   89.31  
   89.32 -  // GC support
   89.33 -  // If the _length field has not been set, the size of the
   89.34 -  // constantPoolCache cannot be correctly calculated.
   89.35 -  bool is_conc_safe()                            { return _is_conc_safe; }
   89.36 -  void set_is_conc_safe(bool v)                  { _is_conc_safe = v; }
   89.37 -
   89.38    // Code generation
   89.39    static ByteSize base_offset()                  { return in_ByteSize(sizeof(constantPoolCacheOopDesc)); }
   89.40    static ByteSize entry_offset(int raw_index) {
    90.1 --- a/src/share/vm/oops/instanceKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
    90.2 +++ b/src/share/vm/oops/instanceKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
    90.3 @@ -1,5 +1,5 @@
    90.4  /*
    90.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    90.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    90.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    90.8   *
    90.9   * This code is free software; you can redistribute it and/or modify it
   90.10 @@ -1736,14 +1736,6 @@
   90.11      PSParallelCompact::adjust_pointer(p), \
   90.12      assert_nothing)
   90.13  }
   90.14 -
   90.15 -void instanceKlass::update_static_fields(HeapWord* beg_addr, HeapWord* end_addr) {
   90.16 -  InstanceKlass_BOUNDED_OOP_ITERATE( \
   90.17 -    start_of_static_fields(), static_oop_field_size(), \
   90.18 -    beg_addr, end_addr, \
   90.19 -    PSParallelCompact::adjust_pointer(p), \
   90.20 -    assert_nothing )
   90.21 -}
   90.22  #endif // SERIALGC
   90.23  
   90.24  void instanceKlass::oop_follow_contents(oop obj) {
   90.25 @@ -1876,15 +1868,6 @@
   90.26    return size_helper();
   90.27  }
   90.28  
   90.29 -int instanceKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
   90.30 -                                       HeapWord* beg_addr, HeapWord* end_addr) {
   90.31 -  InstanceKlass_BOUNDED_OOP_MAP_ITERATE( \
   90.32 -    obj, beg_addr, end_addr, \
   90.33 -    PSParallelCompact::adjust_pointer(p), \
   90.34 -    assert_nothing)
   90.35 -  return size_helper();
   90.36 -}
   90.37 -
   90.38  void instanceKlass::push_static_fields(PSPromotionManager* pm) {
   90.39    InstanceKlass_OOP_ITERATE( \
   90.40      start_of_static_fields(), static_oop_field_size(), \
    91.1 --- a/src/share/vm/oops/instanceKlass.hpp	Fri Feb 25 11:42:03 2011 -0800
    91.2 +++ b/src/share/vm/oops/instanceKlass.hpp	Fri Feb 25 12:46:46 2011 -0800
    91.3 @@ -1,5 +1,5 @@
    91.4  /*
    91.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    91.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    91.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    91.8   *
    91.9   * This code is free software; you can redistribute it and/or modify it
   91.10 @@ -740,7 +740,6 @@
   91.11    void follow_static_fields(ParCompactionManager* cm);
   91.12    void copy_static_fields(ParCompactionManager* cm);
   91.13    void update_static_fields();
   91.14 -  void update_static_fields(HeapWord* beg_addr, HeapWord* end_addr);
   91.15  #endif // SERIALGC
   91.16  
   91.17    // Naming
    92.1 --- a/src/share/vm/oops/instanceKlassKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
    92.2 +++ b/src/share/vm/oops/instanceKlassKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
    92.3 @@ -1,5 +1,5 @@
    92.4  /*
    92.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    92.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    92.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    92.8   *
    92.9   * This code is free software; you can redistribute it and/or modify it
   92.10 @@ -353,35 +353,6 @@
   92.11    return ik->object_size();
   92.12  }
   92.13  
   92.14 -int instanceKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
   92.15 -                                            HeapWord* beg_addr,
   92.16 -                                            HeapWord* end_addr) {
   92.17 -  assert(obj->is_klass(),"must be a klass");
   92.18 -  assert(klassOop(obj)->klass_part()->oop_is_instance_slow(),
   92.19 -         "must be instance klass");
   92.20 -
   92.21 -  instanceKlass* ik = instanceKlass::cast(klassOop(obj));
   92.22 -  ik->update_static_fields(beg_addr, end_addr);
   92.23 -  ik->vtable()->oop_update_pointers(cm, beg_addr, end_addr);
   92.24 -  ik->itable()->oop_update_pointers(cm, beg_addr, end_addr);
   92.25 -
   92.26 -  oop* const beg_oop = MAX2((oop*)beg_addr, ik->oop_block_beg());
   92.27 -  oop* const end_oop = MIN2((oop*)end_addr, ik->oop_block_end());
   92.28 -  for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) {
   92.29 -    PSParallelCompact::adjust_pointer(cur_oop);
   92.30 -  }
   92.31 -
   92.32 -  // The oop_map_cache, jni_ids and jni_id_map are allocated from the C heap,
   92.33 -  // and so don't lie within any 'Chunk' boundaries.  Update them when the
   92.34 -  // lowest addressed oop in the instanceKlass 'oop_block' is updated.
   92.35 -  if (beg_oop == ik->oop_block_beg()) {
   92.36 -    OopClosure* closure = PSParallelCompact::adjust_root_pointer_closure();
   92.37 -    iterate_c_heap_oops(ik, closure);
   92.38 -  }
   92.39 -
   92.40 -  klassKlass::oop_update_pointers(cm, obj, beg_addr, end_addr);
   92.41 -  return ik->object_size();
   92.42 -}
   92.43  #endif // SERIALGC
   92.44  
   92.45  klassOop
    93.1 --- a/src/share/vm/oops/instanceRefKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
    93.2 +++ b/src/share/vm/oops/instanceRefKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
    93.3 @@ -1,5 +1,5 @@
    93.4  /*
    93.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    93.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    93.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    93.8   *
    93.9   * This code is free software; you can redistribute it and/or modify it
   93.10 @@ -344,33 +344,6 @@
   93.11    }
   93.12    return size_helper();
   93.13  }
   93.14 -
   93.15 -
   93.16 -template <class T> void
   93.17 -specialized_oop_update_pointers(ParCompactionManager* cm, oop obj,
   93.18 -                                HeapWord* beg_addr, HeapWord* end_addr) {
   93.19 -  T* p;
   93.20 -  T* referent_addr = p = (T*)java_lang_ref_Reference::referent_addr(obj);
   93.21 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   93.22 -  T* next_addr = p = (T*)java_lang_ref_Reference::next_addr(obj);
   93.23 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   93.24 -  T* discovered_addr = p = (T*)java_lang_ref_Reference::discovered_addr(obj);
   93.25 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   93.26 -  debug_only(trace_reference_gc("instanceRefKlass::oop_update_ptrs", obj,
   93.27 -                                referent_addr, next_addr, discovered_addr);)
   93.28 -}
   93.29 -
   93.30 -int
   93.31 -instanceRefKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
   93.32 -                                      HeapWord* beg_addr, HeapWord* end_addr) {
   93.33 -  instanceKlass::oop_update_pointers(cm, obj, beg_addr, end_addr);
   93.34 -  if (UseCompressedOops) {
   93.35 -    specialized_oop_update_pointers<narrowOop>(cm, obj, beg_addr, end_addr);
   93.36 -  } else {
   93.37 -    specialized_oop_update_pointers<oop>(cm, obj, beg_addr, end_addr);
   93.38 -  }
   93.39 -  return size_helper();
   93.40 -}
   93.41  #endif // SERIALGC
   93.42  
   93.43  void instanceRefKlass::update_nonstatic_oop_maps(klassOop k) {
    94.1 --- a/src/share/vm/oops/klassKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
    94.2 +++ b/src/share/vm/oops/klassKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
    94.3 @@ -1,5 +1,5 @@
    94.4  /*
    94.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    94.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    94.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    94.8   *
    94.9   * This code is free software; you can redistribute it and/or modify it
   94.10 @@ -188,19 +188,6 @@
   94.11  
   94.12    return oop_size(obj);
   94.13  }
   94.14 -
   94.15 -int klassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
   94.16 -                                    HeapWord* beg_addr, HeapWord* end_addr) {
   94.17 -  Klass* k = Klass::cast(klassOop(obj));
   94.18 -
   94.19 -  oop* const beg_oop = MAX2((oop*)beg_addr, k->oop_block_beg());
   94.20 -  oop* const end_oop = MIN2((oop*)end_addr, k->oop_block_end());
   94.21 -  for (oop* cur_oop = beg_oop; cur_oop < end_oop; ++cur_oop) {
   94.22 -    PSParallelCompact::adjust_pointer(cur_oop);
   94.23 -  }
   94.24 -
   94.25 -  return oop_size(obj);
   94.26 -}
   94.27  #endif // SERIALGC
   94.28  
   94.29  
    95.1 --- a/src/share/vm/oops/klassPS.hpp	Fri Feb 25 11:42:03 2011 -0800
    95.2 +++ b/src/share/vm/oops/klassPS.hpp	Fri Feb 25 12:46:46 2011 -0800
    95.3 @@ -1,5 +1,5 @@
    95.4  /*
    95.5 - * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
    95.6 + * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
    95.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    95.8   *
    95.9   * This code is free software; you can redistribute it and/or modify it
   95.10 @@ -37,17 +37,13 @@
   95.11     objects that do (or may) cross chunk boundaries; it updates only those   \
   95.12     oops that are in the region [beg_addr, end_addr).  */                    \
   95.13    virtual void oop_follow_contents(ParCompactionManager* cm, oop obj);      \
   95.14 -  virtual int  oop_update_pointers(ParCompactionManager* cm, oop obj);      \
   95.15 -  virtual int  oop_update_pointers(ParCompactionManager* cm, oop obj,       \
   95.16 -                                   HeapWord* beg_addr, HeapWord* end_addr);
   95.17 +  virtual int  oop_update_pointers(ParCompactionManager* cm, oop obj);
   95.18  
   95.19  // Pure virtual version for klass.hpp
   95.20  #define PARALLEL_GC_DECLS_PV \
   95.21    virtual void oop_push_contents(PSPromotionManager* pm, oop obj) = 0;      \
   95.22    virtual void oop_follow_contents(ParCompactionManager* cm, oop obj) = 0;  \
   95.23 -  virtual int  oop_update_pointers(ParCompactionManager* cm, oop obj) = 0;  \
   95.24 -  virtual int  oop_update_pointers(ParCompactionManager* cm, oop obj,       \
   95.25 -                                   HeapWord* beg_addr, HeapWord* end_addr) = 0;
   95.26 +  virtual int  oop_update_pointers(ParCompactionManager* cm, oop obj) = 0;
   95.27  #else  // SERIALGC
   95.28  #define PARALLEL_GC_DECLS
   95.29  #define PARALLEL_GC_DECLS_PV
    96.1 --- a/src/share/vm/oops/klassVtable.cpp	Fri Feb 25 11:42:03 2011 -0800
    96.2 +++ b/src/share/vm/oops/klassVtable.cpp	Fri Feb 25 12:46:46 2011 -0800
    96.3 @@ -1,5 +1,5 @@
    96.4  /*
    96.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    96.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    96.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    96.8   *
    96.9   * This code is free software; you can redistribute it and/or modify it
   96.10 @@ -677,25 +677,6 @@
   96.11      PSParallelCompact::adjust_pointer(adr_method_at(i));
   96.12    }
   96.13  }
   96.14 -
   96.15 -void klassVtable::oop_update_pointers(ParCompactionManager* cm,
   96.16 -                                      HeapWord* beg_addr, HeapWord* end_addr) {
   96.17 -  const int n = length();
   96.18 -  const int entry_size = vtableEntry::size();
   96.19 -
   96.20 -  int beg_idx = 0;
   96.21 -  HeapWord* const method_0 = (HeapWord*)adr_method_at(0);
   96.22 -  if (beg_addr > method_0) {
   96.23 -    // it's safe to use cast, as we have guarantees on vtable size to be sane
   96.24 -    beg_idx = int((pointer_delta(beg_addr, method_0) + entry_size - 1) / entry_size);
   96.25 -  }
   96.26 -
   96.27 -  oop* const beg_oop = adr_method_at(beg_idx);
   96.28 -  oop* const end_oop = MIN2((oop*)end_addr, adr_method_at(n));
   96.29 -  for (oop* cur_oop = beg_oop; cur_oop < end_oop; cur_oop += entry_size) {
   96.30 -    PSParallelCompact::adjust_pointer(cur_oop);
   96.31 -  }
   96.32 -}
   96.33  #endif // SERIALGC
   96.34  
   96.35  // Iterators
   96.36 @@ -820,25 +801,6 @@
   96.37      ime++;
   96.38    }
   96.39  }
   96.40 -
   96.41 -void klassItable::oop_update_pointers(ParCompactionManager* cm,
   96.42 -                                      HeapWord* beg_addr, HeapWord* end_addr) {
   96.43 -  // offset table
   96.44 -  itableOffsetEntry* ioe = offset_entry(0);
   96.45 -  for(int i = 0; i < _size_offset_table; i++) {
   96.46 -    oop* p = (oop*)&ioe->_interface;
   96.47 -    PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   96.48 -    ioe++;
   96.49 -  }
   96.50 -
   96.51 -  // method table
   96.52 -  itableMethodEntry* ime = method_entry(0);
   96.53 -  for(int j = 0; j < _size_method_table; j++) {
   96.54 -    oop* p = (oop*)&ime->_method;
   96.55 -    PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   96.56 -    ime++;
   96.57 -  }
   96.58 -}
   96.59  #endif // SERIALGC
   96.60  
   96.61  // Iterators
    97.1 --- a/src/share/vm/oops/klassVtable.hpp	Fri Feb 25 11:42:03 2011 -0800
    97.2 +++ b/src/share/vm/oops/klassVtable.hpp	Fri Feb 25 12:46:46 2011 -0800
    97.3 @@ -1,5 +1,5 @@
    97.4  /*
    97.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
    97.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
    97.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    97.8   *
    97.9   * This code is free software; you can redistribute it and/or modify it
   97.10 @@ -99,8 +99,6 @@
   97.11    // Parallel Old
   97.12    void oop_follow_contents(ParCompactionManager* cm);
   97.13    void oop_update_pointers(ParCompactionManager* cm);
   97.14 -  void oop_update_pointers(ParCompactionManager* cm,
   97.15 -                           HeapWord* beg_addr, HeapWord* end_addr);
   97.16  #endif // SERIALGC
   97.17  
   97.18    // Iterators
   97.19 @@ -295,8 +293,6 @@
   97.20    // Parallel Old
   97.21    void oop_follow_contents(ParCompactionManager* cm);
   97.22    void oop_update_pointers(ParCompactionManager* cm);
   97.23 -  void oop_update_pointers(ParCompactionManager* cm,
   97.24 -                           HeapWord* beg_addr, HeapWord* end_addr);
   97.25  #endif // SERIALGC
   97.26  
   97.27    // Iterators
    98.1 --- a/src/share/vm/oops/methodDataKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
    98.2 +++ b/src/share/vm/oops/methodDataKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
    98.3 @@ -1,5 +1,5 @@
    98.4  /*
    98.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
    98.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
    98.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    98.8   *
    98.9   * This code is free software; you can redistribute it and/or modify it
   98.10 @@ -188,25 +188,6 @@
   98.11    }
   98.12    return m->object_size();
   98.13  }
   98.14 -
   98.15 -int
   98.16 -methodDataKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
   98.17 -                                     HeapWord* beg_addr, HeapWord* end_addr) {
   98.18 -  assert(obj->is_methodData(), "should be method data");
   98.19 -
   98.20 -  oop* p;
   98.21 -  methodDataOop m = methodDataOop(obj);
   98.22 -
   98.23 -  p = m->adr_method();
   98.24 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
   98.25 -
   98.26 -  ResourceMark rm;
   98.27 -  ProfileData* data;
   98.28 -  for (data = m->first_data(); m->is_valid(data); data = m->next_data(data)) {
   98.29 -    data->update_pointers(beg_addr, end_addr);
   98.30 -  }
   98.31 -  return m->object_size();
   98.32 -}
   98.33  #endif // SERIALGC
   98.34  
   98.35  #ifndef PRODUCT
    99.1 --- a/src/share/vm/oops/methodDataOop.cpp	Fri Feb 25 11:42:03 2011 -0800
    99.2 +++ b/src/share/vm/oops/methodDataOop.cpp	Fri Feb 25 12:46:46 2011 -0800
    99.3 @@ -271,17 +271,6 @@
    99.4      }
    99.5    }
    99.6  }
    99.7 -
    99.8 -void ReceiverTypeData::update_pointers(HeapWord* beg_addr, HeapWord* end_addr) {
    99.9 -  // The loop bounds could be computed based on beg_addr/end_addr and the
   99.10 -  // boundary test hoisted outside the loop (see klassVTable for an example);
   99.11 -  // however, row_limit() is small enough (2) to make that less efficient.
   99.12 -  for (uint row = 0; row < row_limit(); row++) {
   99.13 -    if (receiver_unchecked(row) != NULL) {
   99.14 -      PSParallelCompact::adjust_pointer(adr_receiver(row), beg_addr, end_addr);
   99.15 -    }
   99.16 -  }
   99.17 -}
   99.18  #endif // SERIALGC
   99.19  
   99.20  #ifndef PRODUCT
   99.21 @@ -764,11 +753,13 @@
   99.22    if (TieredCompilation) {
   99.23      _invocation_counter.init();
   99.24      _backedge_counter.init();
   99.25 +    _invocation_counter_start = 0;
   99.26 +    _backedge_counter_start = 0;
   99.27      _num_loops = 0;
   99.28      _num_blocks = 0;
   99.29      _highest_comp_level = 0;
   99.30      _highest_osr_comp_level = 0;
   99.31 -    _would_profile = false;
   99.32 +    _would_profile = true;
   99.33    }
   99.34    set_creation_mileage(mileage_of(method()));
   99.35  
   100.1 --- a/src/share/vm/oops/methodDataOop.hpp	Fri Feb 25 11:42:03 2011 -0800
   100.2 +++ b/src/share/vm/oops/methodDataOop.hpp	Fri Feb 25 12:46:46 2011 -0800
   100.3 @@ -1,5 +1,5 @@
   100.4  /*
   100.5 - * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
   100.6 + * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
   100.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   100.8   *
   100.9   * This code is free software; you can redistribute it and/or modify it
  100.10 @@ -452,7 +452,6 @@
  100.11    // Parallel old support
  100.12    virtual void follow_contents(ParCompactionManager* cm) {}
  100.13    virtual void update_pointers() {}
  100.14 -  virtual void update_pointers(HeapWord* beg_addr, HeapWord* end_addr) {}
  100.15  #endif // SERIALGC
  100.16  
  100.17    // CI translation: ProfileData can represent both MethodDataOop data
  100.18 @@ -748,7 +747,6 @@
  100.19    // Parallel old support
  100.20    virtual void follow_contents(ParCompactionManager* cm);
  100.21    virtual void update_pointers();
  100.22 -  virtual void update_pointers(HeapWord* beg_addr, HeapWord* end_addr);
  100.23  #endif // SERIALGC
  100.24  
  100.25    oop* adr_receiver(uint row) {
  100.26 @@ -1224,6 +1222,9 @@
  100.27    InvocationCounter _invocation_counter;
  100.28    // Same for backedges.
  100.29    InvocationCounter _backedge_counter;
  100.30 +  // Counter values at the time profiling started.
  100.31 +  int               _invocation_counter_start;
  100.32 +  int               _backedge_counter_start;
  100.33    // Number of loops and blocks is computed when compiling the first
  100.34    // time with C1. It is used to determine if method is trivial.
  100.35    short             _num_loops;
  100.36 @@ -1333,6 +1334,28 @@
  100.37      return backedge_counter()->count();
  100.38    }
  100.39  
  100.40 +  int invocation_count_start() {
  100.41 +    if (invocation_counter()->carry()) {
  100.42 +      return 0;
  100.43 +    }
  100.44 +    return _invocation_counter_start;
  100.45 +  }
  100.46 +
  100.47 +  int backedge_count_start() {
  100.48 +    if (backedge_counter()->carry()) {
  100.49 +      return 0;
  100.50 +    }
  100.51 +    return _backedge_counter_start;
  100.52 +  }
  100.53 +
  100.54 +  int invocation_count_delta() { return invocation_count() - invocation_count_start(); }
  100.55 +  int backedge_count_delta()   { return backedge_count()   - backedge_count_start();   }
  100.56 +
  100.57 +  void reset_start_counters() {
  100.58 +    _invocation_counter_start = invocation_count();
  100.59 +    _backedge_counter_start = backedge_count();
  100.60 +  }
  100.61 +
  100.62    InvocationCounter* invocation_counter()     { return &_invocation_counter; }
  100.63    InvocationCounter* backedge_counter()       { return &_backedge_counter;   }
  100.64  
   101.1 --- a/src/share/vm/oops/methodKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
   101.2 +++ b/src/share/vm/oops/methodKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
   101.3 @@ -1,5 +1,5 @@
   101.4  /*
   101.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   101.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
   101.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   101.8   *
   101.9   * This code is free software; you can redistribute it and/or modify it
  101.10 @@ -214,27 +214,6 @@
  101.11  #endif // COMPILER2
  101.12    return m->object_size();
  101.13  }
  101.14 -
  101.15 -int methodKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
  101.16 -                                     HeapWord* beg_addr, HeapWord* end_addr) {
  101.17 -  assert(obj->is_method(), "should be method");
  101.18 -
  101.19 -  oop* p;
  101.20 -  methodOop m = methodOop(obj);
  101.21 -
  101.22 -  p = m->adr_constMethod();
  101.23 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
  101.24 -  p = m->adr_constants();
  101.25 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
  101.26 -
  101.27 -#ifdef COMPILER2
  101.28 -  if (m->method_data() != NULL) {
  101.29 -    p = m->adr_method_data();
  101.30 -    PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
  101.31 -  }
  101.32 -#endif // COMPILER2
  101.33 -  return m->object_size();
  101.34 -}
  101.35  #endif // SERIALGC
  101.36  
  101.37  #ifndef PRODUCT
   102.1 --- a/src/share/vm/oops/methodOop.cpp	Fri Feb 25 11:42:03 2011 -0800
   102.2 +++ b/src/share/vm/oops/methodOop.cpp	Fri Feb 25 12:46:46 2011 -0800
   102.3 @@ -934,7 +934,7 @@
   102.4    assert(m->signature() == signature, "");
   102.5    assert(m->is_method_handle_invoke(), "");
   102.6  #ifdef CC_INTERP
   102.7 -  ResultTypeFinder rtf(signature());
   102.8 +  ResultTypeFinder rtf(signature);
   102.9    m->set_result_index(rtf.type());
  102.10  #endif
  102.11    m->compute_size_of_parameters(THREAD);
  102.12 @@ -985,9 +985,11 @@
  102.13                                                IsUnsafeConc,
  102.14                                                CHECK_(methodHandle()));
  102.15    methodHandle newm (THREAD, newm_oop);
  102.16 +  NOT_PRODUCT(int nmsz = newm->is_parsable() ? newm->size() : -1;)
  102.17    int new_method_size = newm->method_size();
  102.18    // Create a shallow copy of methodOopDesc part, but be careful to preserve the new constMethodOop
  102.19    constMethodOop newcm = newm->constMethod();
  102.20 +  NOT_PRODUCT(int ncmsz = newcm->is_parsable() ? newcm->size() : -1;)
  102.21    int new_const_method_size = newm->constMethod()->object_size();
  102.22  
  102.23    memcpy(newm(), m(), sizeof(methodOopDesc));
  102.24 @@ -999,9 +1001,19 @@
  102.25    // or concurrent marking but those phases will be correct.  Setting and
  102.26    // resetting is done in preference to a careful copying into newcm to
  102.27    // avoid having to know the precise layout of a constMethodOop.
  102.28 -  m->constMethod()->set_is_conc_safe(false);
  102.29 +  m->constMethod()->set_is_conc_safe(oopDesc::IsUnsafeConc);
  102.30 +  assert(m->constMethod()->is_parsable(), "Should remain parsable");
  102.31 +
  102.32 +  // NOTE: this is a reachable object that transiently signals "conc_unsafe"
  102.33 +  // However, no allocations are done during this window
  102.34 +  // during which it is tagged conc_unsafe, so we are assured that any concurrent
  102.35 +  // thread will not wait forever for the object to revert to "conc_safe".
  102.36 +  // Further, any such conc_unsafe object will indicate a stable size
  102.37 +  // through the transition.
  102.38    memcpy(newcm, m->constMethod(), sizeof(constMethodOopDesc));
  102.39 -  m->constMethod()->set_is_conc_safe(true);
  102.40 +  m->constMethod()->set_is_conc_safe(oopDesc::IsSafeConc);
  102.41 +  assert(m->constMethod()->is_parsable(), "Should remain parsable");
  102.42 +
  102.43    // Reset correct method/const method, method size, and parameter info
  102.44    newcm->set_method(newm());
  102.45    newm->set_constMethod(newcm);
  102.46 @@ -1035,6 +1047,8 @@
  102.47  
  102.48    // Only set is_conc_safe to true when changes to newcm are
  102.49    // complete.
  102.50 +  assert(!newm->is_parsable()  || nmsz  < 0 || newm->size()  == nmsz,  "newm->size()  inconsistency");
  102.51 +  assert(!newcm->is_parsable() || ncmsz < 0 || newcm->size() == ncmsz, "newcm->size() inconsistency");
  102.52    newcm->set_is_conc_safe(true);
  102.53    return newm;
  102.54  }
  102.55 @@ -1372,7 +1386,7 @@
  102.56  }
  102.57  
  102.58  // See comment in methodOop.hpp which explains why this exists.
  102.59 -#if defined(_M_AMD64) && MSC_VER >= 1400
  102.60 +#if defined(_M_AMD64) && _MSC_VER >= 1400
  102.61  #pragma optimize("", off)
  102.62  void CompressedLineNumberWriteStream::write_pair(int bci, int line) {
  102.63    write_pair_inline(bci, line);
   103.1 --- a/src/share/vm/oops/methodOop.hpp	Fri Feb 25 11:42:03 2011 -0800
   103.2 +++ b/src/share/vm/oops/methodOop.hpp	Fri Feb 25 12:46:46 2011 -0800
   103.3 @@ -144,9 +144,6 @@
   103.4  
   103.5   public:
   103.6  
   103.7 -  static const bool IsUnsafeConc         = false;
   103.8 -  static const bool IsSafeConc           = true;
   103.9 -
  103.10    // accessors for instance variables
  103.11    constMethodOop constMethod() const             { return _constMethod; }
  103.12    void set_constMethod(constMethodOop xconst)    { oop_store_without_check((oop*)&_constMethod, (oop)xconst); }
  103.13 @@ -732,8 +729,8 @@
  103.14  // Disabling optimization doesn't work for methods in header files
  103.15  // so we force it to call through the non-optimized version in the .cpp.
  103.16  // It's gross, but it's the only way we can ensure that all callers are
  103.17 -// fixed.  MSC_VER is defined in build/windows/makefiles/compile.make.
  103.18 -#if defined(_M_AMD64) && MSC_VER >= 1400
  103.19 +// fixed.  _MSC_VER is defined by the windows compiler
  103.20 +#if defined(_M_AMD64) && _MSC_VER >= 1400
  103.21    void write_pair(int bci, int line);
  103.22  #else
  103.23    void write_pair(int bci, int line) { write_pair_inline(bci, line); }
   104.1 --- a/src/share/vm/oops/objArrayKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
   104.2 +++ b/src/share/vm/oops/objArrayKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
   104.3 @@ -470,16 +470,6 @@
   104.4    ObjArrayKlass_OOP_ITERATE(a, p, PSParallelCompact::adjust_pointer(p))
   104.5    return a->object_size();
   104.6  }
   104.7 -
   104.8 -int objArrayKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
   104.9 -                                       HeapWord* beg_addr, HeapWord* end_addr) {
  104.10 -  assert (obj->is_objArray(), "obj must be obj array");
  104.11 -  objArrayOop a = objArrayOop(obj);
  104.12 -  ObjArrayKlass_BOUNDED_OOP_ITERATE( \
  104.13 -     a, p, beg_addr, end_addr, \
  104.14 -     PSParallelCompact::adjust_pointer(p))
  104.15 -  return a->object_size();
  104.16 -}
  104.17  #endif // SERIALGC
  104.18  
  104.19  // JVM support
   105.1 --- a/src/share/vm/oops/objArrayKlassKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
   105.2 +++ b/src/share/vm/oops/objArrayKlassKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
   105.3 @@ -1,5 +1,5 @@
   105.4  /*
   105.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   105.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
   105.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   105.8   *
   105.9   * This code is free software; you can redistribute it and/or modify it
  105.10 @@ -254,22 +254,6 @@
  105.11  
  105.12    return arrayKlassKlass::oop_update_pointers(cm, obj);
  105.13  }
  105.14 -
  105.15 -int objArrayKlassKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
  105.16 -                                            HeapWord* beg_addr,
  105.17 -                                            HeapWord* end_addr) {
  105.18 -  assert(obj->is_klass(), "must be klass");
  105.19 -  assert(klassOop(obj)->klass_part()->oop_is_objArray_slow(), "must be obj array");
  105.20 -
  105.21 -  oop* p;
  105.22 -  objArrayKlass* oak = objArrayKlass::cast((klassOop)obj);
  105.23 -  p = oak->element_klass_addr();
  105.24 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
  105.25 -  p = oak->bottom_klass_addr();
  105.26 -  PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
  105.27 -
  105.28 -  return arrayKlassKlass::oop_update_pointers(cm, obj, beg_addr, end_addr);
  105.29 -}
  105.30  #endif // SERIALGC
  105.31  
  105.32  #ifndef PRODUCT
   106.1 --- a/src/share/vm/oops/oop.hpp	Fri Feb 25 11:42:03 2011 -0800
   106.2 +++ b/src/share/vm/oops/oop.hpp	Fri Feb 25 12:46:46 2011 -0800
   106.3 @@ -1,5 +1,5 @@
   106.4  /*
   106.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   106.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
   106.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   106.8   *
   106.9   * This code is free software; you can redistribute it and/or modify it
  106.10 @@ -71,6 +71,11 @@
  106.11    static BarrierSet* _bs;
  106.12  
  106.13   public:
  106.14 +  enum ConcSafeType {
  106.15 +    IsUnsafeConc = false,
  106.16 +    IsSafeConc   = true
  106.17 +  };
  106.18 +
  106.19    markOop  mark() const         { return _mark; }
  106.20    markOop* mark_addr() const    { return (markOop*) &_mark; }
  106.21  
  106.22 @@ -317,13 +322,6 @@
  106.23  
  106.24    // Parallel Old
  106.25    void update_contents(ParCompactionManager* cm);
  106.26 -  void update_contents(ParCompactionManager* cm,
  106.27 -                       HeapWord* begin_limit,
  106.28 -                       HeapWord* end_limit);
  106.29 -  void update_contents(ParCompactionManager* cm,
  106.30 -                       klassOop old_klass,
  106.31 -                       HeapWord* begin_limit,
  106.32 -                       HeapWord* end_limit);
  106.33  
  106.34    void follow_contents(ParCompactionManager* cm);
  106.35    void follow_header(ParCompactionManager* cm);
  106.36 @@ -364,7 +362,6 @@
  106.37  #ifndef SERIALGC
  106.38    // Parallel old
  106.39    void update_header();
  106.40 -  void update_header(HeapWord* beg_addr, HeapWord* end_addr);
  106.41  #endif // SERIALGC
  106.42  
  106.43    // mark-sweep support
   107.1 --- a/src/share/vm/oops/oop.pcgc.inline.hpp	Fri Feb 25 11:42:03 2011 -0800
   107.2 +++ b/src/share/vm/oops/oop.pcgc.inline.hpp	Fri Feb 25 12:46:46 2011 -0800
   107.3 @@ -1,5 +1,5 @@
   107.4  /*
   107.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
   107.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
   107.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   107.8   *
   107.9   * This code is free software; you can redistribute it and/or modify it
  107.10 @@ -57,41 +57,6 @@
  107.11    // Else skip it.  The typeArrayKlass in the header never needs scavenging.
  107.12  }
  107.13  
  107.14 -inline void oopDesc::update_contents(ParCompactionManager* cm,
  107.15 -                                     HeapWord* begin_limit,
  107.16 -                                     HeapWord* end_limit) {
  107.17 -  // The klass field must be updated before anything else
  107.18 -  // can be done.
  107.19 -  debug_only(klassOopDesc* original_klass = klass());
  107.20 -
  107.21 -  update_contents(cm, klass(), begin_limit, end_limit);
  107.22 -}
  107.23 -
  107.24 -inline void oopDesc::update_contents(ParCompactionManager* cm,
  107.25 -                                     klassOop old_klass,
  107.26 -                                     HeapWord* begin_limit,
  107.27 -                                     HeapWord* end_limit) {
  107.28 -
  107.29 -  klassOop updated_klass =
  107.30 -    PSParallelCompact::summary_data().calc_new_klass(old_klass);
  107.31 -
  107.32 -  // Needs to be boundary aware for the 64 bit case
  107.33 -  // update_header();
  107.34 -  // The klass has moved.  Is the location of the klass
  107.35 -  // within the limits?
  107.36 -  if ((((HeapWord*)&_metadata._klass) >= begin_limit) &&
  107.37 -      (((HeapWord*)&_metadata._klass) < end_limit)) {
  107.38 -    set_klass(updated_klass);
  107.39 -  }
  107.40 -
  107.41 -  Klass* klass = updated_klass->klass_part();
  107.42 -  if (!klass->oop_is_typeArray()) {
  107.43 -    // It might contain oops beyond the header, so take the virtual call.
  107.44 -    klass->oop_update_pointers(cm, this, begin_limit, end_limit);
  107.45 -  }
  107.46 -  // Else skip it.  The typeArrayKlass in the header never needs scavenging.
  107.47 -}
  107.48 -
  107.49  inline void oopDesc::follow_contents(ParCompactionManager* cm) {
  107.50    assert (PSParallelCompact::mark_bitmap()->is_marked(this),
  107.51      "should be marked");
  107.52 @@ -140,13 +105,4 @@
  107.53    }
  107.54  }
  107.55  
  107.56 -inline void oopDesc::update_header(HeapWord* beg_addr, HeapWord* end_addr) {
  107.57 -  if (UseCompressedOops) {
  107.58 -    PSParallelCompact::adjust_pointer(compressed_klass_addr(),
  107.59 -                                      beg_addr, end_addr);
  107.60 -  } else {
  107.61 -    PSParallelCompact::adjust_pointer(klass_addr(), beg_addr, end_addr);
  107.62 -  }
  107.63 -}
  107.64 -
  107.65  #endif // SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP
   108.1 --- a/src/share/vm/oops/typeArrayKlass.cpp	Fri Feb 25 11:42:03 2011 -0800
   108.2 +++ b/src/share/vm/oops/typeArrayKlass.cpp	Fri Feb 25 12:46:46 2011 -0800
   108.3 @@ -250,13 +250,6 @@
   108.4    assert(obj->is_typeArray(),"must be a type array");
   108.5    return typeArrayOop(obj)->object_size();
   108.6  }
   108.7 -
   108.8 -int
   108.9 -typeArrayKlass::oop_update_pointers(ParCompactionManager* cm, oop obj,
  108.10 -                                    HeapWord* beg_addr, HeapWord* end_addr) {
  108.11 -  assert(obj->is_typeArray(),"must be a type array");
  108.12 -  return typeArrayOop(obj)->object_size();
  108.13 -}
  108.14  #endif // SERIALGC
  108.15  
  108.16  void typeArrayKlass::initialize(TRAPS) {
   109.1 --- a/src/share/vm/opto/escape.cpp	Fri Feb 25 11:42:03 2011 -0800
   109.2 +++ b/src/share/vm/opto/escape.cpp	Fri Feb 25 12:46:46 2011 -0800
   109.3 @@ -1,5 +1,5 @@
   109.4  /*
   109.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
   109.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
   109.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   109.8   *
   109.9   * This code is free software; you can redistribute it and/or modify it
  109.10 @@ -93,6 +93,9 @@
  109.11  ConnectionGraph::ConnectionGraph(Compile * C, PhaseIterGVN *igvn) :
  109.12    _nodes(C->comp_arena(), C->unique(), C->unique(), PointsToNode()),
  109.13    _processed(C->comp_arena()),
  109.14 +  pt_ptset(C->comp_arena()),
  109.15 +  pt_visited(C->comp_arena()),
  109.16 +  pt_worklist(C->comp_arena(), 4, 0, 0),
  109.17    _collecting(true),
  109.18    _progress(false),
  109.19    _compile(C),
  109.20 @@ -220,9 +223,7 @@
  109.21    PointsToNode::EscapeState orig_es = es;
  109.22  
  109.23    // compute max escape state of anything this node could point to
  109.24 -  VectorSet ptset(Thread::current()->resource_area());
  109.25 -  PointsTo(ptset, n);
  109.26 -  for(VectorSetI i(&ptset); i.test() && es != PointsToNode::GlobalEscape; ++i) {
  109.27 +  for(VectorSetI i(PointsTo(n)); i.test() && es != PointsToNode::GlobalEscape; ++i) {
  109.28      uint pt = i.elem;
  109.29      PointsToNode::EscapeState pes = ptnode_adr(pt)->escape_state();
  109.30      if (pes > es)
  109.31 @@ -236,9 +237,10 @@
  109.32    return es;
  109.33  }
  109.34  
  109.35 -void ConnectionGraph::PointsTo(VectorSet &ptset, Node * n) {
  109.36 -  VectorSet visited(Thread::current()->resource_area());
  109.37 -  GrowableArray<uint>  worklist;
  109.38 +VectorSet* ConnectionGraph::PointsTo(Node * n) {
  109.39 +  pt_ptset.Reset();
  109.40 +  pt_visited.Reset();
  109.41 +  pt_worklist.clear();
  109.42  
  109.43  #ifdef ASSERT
  109.44    Node *orig_n = n;
  109.45 @@ -249,8 +251,8 @@
  109.46  
  109.47    // If we have a JavaObject, return just that object
  109.48    if (npt->node_type() == PointsToNode::JavaObject) {
  109.49 -    ptset.set(n->_idx);
  109.50 -    return;
  109.51 +    pt_ptset.set(n->_idx);
  109.52 +    return &pt_ptset;
  109.53    }
  109.54  #ifdef ASSERT
  109.55    if (npt->_node == NULL) {
  109.56 @@ -260,10 +262,10 @@
  109.57      assert(npt->_node != NULL, "unregistered node");
  109.58    }
  109.59  #endif
  109.60 -  worklist.push(n->_idx);
  109.61 -  while(worklist.length() > 0) {
  109.62 -    int ni = worklist.pop();
  109.63 -    if (visited.test_set(ni))
  109.64 +  pt_worklist.push(n->_idx);
  109.65 +  while(pt_worklist.length() > 0) {
  109.66 +    int ni = pt_worklist.pop();
  109.67 +    if (pt_visited.test_set(ni))
  109.68        continue;
  109.69  
  109.70      PointsToNode* pn = ptnode_adr(ni);
  109.71 @@ -276,10 +278,10 @@
  109.72        uint etgt = pn->edge_target(e);
  109.73        PointsToNode::EdgeType et = pn->edge_type(e);
  109.74        if (et == PointsToNode::PointsToEdge) {
  109.75 -        ptset.set(etgt);
  109.76 +        pt_ptset.set(etgt);
  109.77          edges_processed++;
  109.78        } else if (et == PointsToNode::DeferredEdge) {
  109.79 -        worklist.push(etgt);
  109.80 +        pt_worklist.push(etgt);
  109.81          edges_processed++;
  109.82        } else {
  109.83          assert(false,"neither PointsToEdge or DeferredEdge");
  109.84 @@ -288,16 +290,17 @@
  109.85      if (edges_processed == 0) {
  109.86        // no deferred or pointsto edges found.  Assume the value was set
  109.87        // outside this method.  Add the phantom object to the pointsto set.
  109.88 -      ptset.set(_phantom_object);
  109.89 +      pt_ptset.set(_phantom_object);
  109.90      }
  109.91    }
  109.92 +  return &pt_ptset;
  109.93  }
  109.94  
  109.95  void ConnectionGraph::remove_deferred(uint ni, GrowableArray<uint>* deferred_edges, VectorSet* visited) {
  109.96    // This method is most expensive during ConnectionGraph construction.
  109.97    // Reuse vectorSet and an additional growable array for deferred edges.
  109.98    deferred_edges->clear();
  109.99 -  visited->Clear();
 109.100 +  visited->Reset();
 109.101  
 109.102    visited->set(ni);
 109.103    PointsToNode *ptn = ptnode_adr(ni);
 109.104 @@ -1009,7 +1012,6 @@
 109.105    uint new_index_start = (uint) _compile->num_alias_types();
 109.106    Arena* arena = Thread::current()->resource_area();
 109.107    VectorSet visited(arena);
 109.108 -  VectorSet ptset(arena);
 109.109  
 109.110  
 109.111    //  Phase 1:  Process possible allocations from alloc_worklist.
 109.112 @@ -1137,10 +1139,9 @@
 109.113          }
 109.114        }
 109.115      } else if (n->is_AddP()) {
 109.116 -      ptset.Clear();
 109.117 -      PointsTo(ptset, get_addp_base(n));
 109.118 -      assert(ptset.Size() == 1, "AddP address is unique");
 109.119 -      uint elem = ptset.getelem(); // Allocation node's index
 109.120 +      VectorSet* ptset = PointsTo(get_addp_base(n));
 109.121 +      assert(ptset->Size() == 1, "AddP address is unique");
 109.122 +      uint elem = ptset->getelem(); // Allocation node's index
 109.123        if (elem == _phantom_object) {
 109.124          assert(false, "escaped allocation");
 109.125          continue; // Assume the value was set outside this method.
 109.126 @@ -1157,10 +1158,9 @@
 109.127          assert(n->is_Phi(), "loops only through Phi's");
 109.128          continue;  // already processed
 109.129        }
 109.130 -      ptset.Clear();
 109.131 -      PointsTo(ptset, n);
 109.132 -      if (ptset.Size() == 1) {
 109.133 -        uint elem = ptset.getelem(); // Allocation node's index
 109.134 +      VectorSet* ptset = PointsTo(n);
 109.135 +      if (ptset->Size() == 1) {
 109.136 +        uint elem = ptset->getelem(); // Allocation node's index
 109.137          if (elem == _phantom_object) {
 109.138            assert(false, "escaped allocation");
 109.139            continue; // Assume the value was set outside this method.
 109.140 @@ -1434,7 +1434,7 @@
 109.141    // Update the memory inputs of MemNodes with the value we computed
 109.142    // in Phase 2 and move stores memory users to corresponding memory slices.
 109.143  #ifdef ASSERT
 109.144 -  visited.Clear();
 109.145 +  visited.Reset();
 109.146    Node_Stack old_mems(arena, _compile->unique() >> 2);
 109.147  #endif
 109.148    for (uint i = 0; i < nodes_size(); i++) {
 109.149 @@ -1640,7 +1640,6 @@
 109.150  #undef CG_BUILD_ITER_LIMIT
 109.151  
 109.152    Arena* arena = Thread::current()->resource_area();
 109.153 -  VectorSet ptset(arena);
 109.154    VectorSet visited(arena);
 109.155    worklist.clear();
 109.156  
 109.157 @@ -1657,7 +1656,7 @@
 109.158        if (n->is_AddP()) {
 109.159          // Search for objects which are not scalar replaceable
 109.160          // and adjust their escape state.
 109.161 -        verify_escape_state(ni, ptset, igvn);
 109.162 +        adjust_escape_state(ni, igvn);
 109.163        }
 109.164      }
 109.165    }
 109.166 @@ -1776,8 +1775,8 @@
 109.167    return has_non_escaping_obj;
 109.168  }
 109.169  
 109.170 -// Search for objects which are not scalar replaceable.
 109.171 -void ConnectionGraph::verify_escape_state(int nidx, VectorSet& ptset, PhaseTransform* phase) {
 109.172 +// Adjust escape state after Connection Graph is built.
 109.173 +void ConnectionGraph::adjust_escape_state(int nidx, PhaseTransform* phase) {
 109.174    PointsToNode* ptn = ptnode_adr(nidx);
 109.175    Node* n = ptn->_node;
 109.176    assert(n->is_AddP(), "Should be called for AddP nodes only");
 109.177 @@ -1792,9 +1791,8 @@
 109.178  
 109.179    int offset = ptn->offset();
 109.180    Node* base = get_addp_base(n);
 109.181 -  ptset.Clear();
 109.182 -  PointsTo(ptset, base);
 109.183 -  int ptset_size = ptset.Size();
 109.184 +  VectorSet* ptset = PointsTo(base);
 109.185 +  int ptset_size = ptset->Size();
 109.186  
 109.187    // Check if a oop field's initializing value is recorded and add
 109.188    // a corresponding NULL field's value if it is not recorded.
 109.189 @@ -1814,7 +1812,7 @@
 109.190    // Do a simple control flow analysis to distinguish above cases.
 109.191    //
 109.192    if (offset != Type::OffsetBot && ptset_size == 1) {
 109.193 -    uint elem = ptset.getelem(); // Allocation node's index
 109.194 +    uint elem = ptset->getelem(); // Allocation node's index
 109.195      // It does not matter if it is not Allocation node since
 109.196      // only non-escaping allocations are scalar replaced.
 109.197      if (ptnode_adr(elem)->_node->is_Allocate() &&
 109.198 @@ -1913,7 +1911,7 @@
 109.199    //
 109.200    if (ptset_size > 1 || ptset_size != 0 &&
 109.201        (has_LoadStore || offset == Type::OffsetBot)) {
 109.202 -    for( VectorSetI j(&ptset); j.test(); ++j ) {
 109.203 +    for( VectorSetI j(ptset); j.test(); ++j ) {
 109.204        set_escape_state(j.elem, PointsToNode::ArgEscape);
 109.205        ptnode_adr(j.elem)->_scalar_replaceable = false;
 109.206      }
 109.207 @@ -1937,7 +1935,6 @@
 109.208        // Stub calls, objects do not escape but they are not scale replaceable.
 109.209        // Adjust escape state for outgoing arguments.
 109.210        const TypeTuple * d = call->tf()->domain();
 109.211 -      VectorSet ptset(Thread::current()->resource_area());
 109.212        for (uint i = TypeFunc::Parms; i < d->cnt(); i++) {
 109.213          const Type* at = d->field_at(i);
 109.214          Node *arg = call->in(i)->uncast();
 109.215 @@ -1970,9 +1967,7 @@
 109.216              //
 109.217              arg = get_addp_base(arg);
 109.218            }
 109.219 -          ptset.Clear();
 109.220 -          PointsTo(ptset, arg);
 109.221 -          for( VectorSetI j(&ptset); j.test(); ++j ) {
 109.222 +          for( VectorSetI j(PointsTo(arg)); j.test(); ++j ) {
 109.223              uint pt = j.elem;
 109.224              set_escape_state(pt, PointsToNode::ArgEscape);
 109.225            }
 109.226 @@ -1990,7 +1985,6 @@
 109.227        // fall-through if not a Java method or no analyzer information
 109.228        if (call_analyzer != NULL) {
 109.229          const TypeTuple * d = call->tf()->domain();
 109.230 -        VectorSet ptset(Thread::current()->resource_area());
 109.231          bool copy_dependencies = false;
 109.232          for (uint i = TypeFunc::Parms; i < d->cnt(); i++) {
 109.233            const Type* at = d->field_at(i);
 109.234 @@ -2015,9 +2009,7 @@
 109.235                copy_dependencies = true;
 109.236              }
 109.237  
 109.238 -            ptset.Clear();
 109.239 -            PointsTo(ptset, arg);
 109.240 -            for( VectorSetI j(&ptset); j.test(); ++j ) {
 109.241 +            for( VectorSetI j(PointsTo(arg)); j.test(); ++j ) {
 109.242                uint pt = j.elem;
 109.243                if (global_escapes) {
 109.244                  //The argument global escapes, mark everything it could point to
 109.245 @@ -2045,15 +2037,12 @@
 109.246      {
 109.247        // adjust escape state for  outgoing arguments
 109.248        const TypeTuple * d = call->tf()->domain();
 109.249 -      VectorSet ptset(Thread::current()->resource_area());
 109.250        for (uint i = TypeFunc::Parms; i < d->cnt(); i++) {
 109.251          const Type* at = d->field_at(i);
 109.252          if (at->isa_oopptr() != NULL) {
 109.253            Node *arg = call->in(i)->uncast();
 109.254            set_escape_state(arg->_idx, PointsToNode::GlobalEscape);
 109.255 -          ptset.Clear();
 109.256 -          PointsTo(ptset, arg);
 109.257 -          for( VectorSetI j(&ptset); j.test(); ++j ) {
 109.258 +          for( VectorSetI j(PointsTo(arg)); j.test(); ++j ) {
 109.259              uint pt = j.elem;
 109.260              set_escape_state(pt, PointsToNode::GlobalEscape);
 109.261            }
 109.262 @@ -2515,9 +2504,7 @@
 109.263      {
 109.264        Node *base = get_addp_base(n);
 109.265        // Create a field edge to this node from everything base could point to.
 109.266 -      VectorSet ptset(Thread::current()->resource_area());
 109.267 -      PointsTo(ptset, base);
 109.268 -      for( VectorSetI i(&ptset); i.test(); ++i ) {
 109.269 +      for( VectorSetI i(PointsTo(base)); i.test(); ++i ) {
 109.270          uint pt = i.elem;
 109.271          add_field_edge(pt, n_idx, address_offset(n, phase));
 109.272        }
 109.273 @@ -2583,10 +2570,8 @@
 109.274  
 109.275        // For everything "adr_base" could point to, create a deferred edge from
 109.276        // this node to each field with the same offset.
 109.277 -      VectorSet ptset(Thread::current()->resource_area());
 109.278 -      PointsTo(ptset, adr_base);
 109.279        int offset = address_offset(adr, phase);
 109.280 -      for( VectorSetI i(&ptset); i.test(); ++i ) {
 109.281 +      for( VectorSetI i(PointsTo(adr_base)); i.test(); ++i ) {
 109.282          uint pt = i.elem;
 109.283          add_deferred_edge_to_fields(n_idx, pt, offset);
 109.284        }
 109.285 @@ -2676,9 +2661,7 @@
 109.286        Node *val = n->in(MemNode::ValueIn)->uncast();
 109.287        // For everything "adr_base" could point to, create a deferred edge
 109.288        // to "val" from each field with the same offset.
 109.289 -      VectorSet ptset(Thread::current()->resource_area());
 109.290 -      PointsTo(ptset, adr_base);
 109.291 -      for( VectorSetI i(&ptset); i.test(); ++i ) {
 109.292 +      for( VectorSetI i(PointsTo(adr_base)); i.test(); ++i ) {
 109.293          uint pt = i.elem;
 109.294          add_edge_from_fields(pt, val->_idx, address_offset(adr, phase));
 109.295        }
   110.1 --- a/src/share/vm/opto/escape.hpp	Fri Feb 25 11:42:03 2011 -0800
   110.2 +++ b/src/share/vm/opto/escape.hpp	Fri Feb 25 12:46:46 2011 -0800
   110.3 @@ -1,5 +1,5 @@
   110.4  /*
   110.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
   110.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
   110.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   110.8   *
   110.9   * This code is free software; you can redistribute it and/or modify it
  110.10 @@ -268,7 +268,12 @@
  110.11    // walk the connection graph starting at the node corresponding to "n" and
  110.12    // add the index of everything it could point to, to "ptset".  This may cause
  110.13    // Phi's encountered to get (re)processed  (which requires "phase".)
  110.14 -  void PointsTo(VectorSet &ptset, Node * n);
  110.15 +  VectorSet* PointsTo(Node * n);
  110.16 +
  110.17 +  // Reused structures for PointsTo().
  110.18 +  VectorSet            pt_ptset;
  110.19 +  VectorSet            pt_visited;
  110.20 +  GrowableArray<uint>  pt_worklist;
  110.21  
  110.22    //  Edge manipulation.  The "from_i" and "to_i" arguments are the
  110.23    //  node indices of the source and destination of the edge
  110.24 @@ -334,8 +339,11 @@
  110.25    // Set the escape state of a node
  110.26    void set_escape_state(uint ni, PointsToNode::EscapeState es);
  110.27  
  110.28 -  // Search for objects which are not scalar replaceable.
  110.29 -  void verify_escape_state(int nidx, VectorSet& ptset, PhaseTransform* phase);
  110.30 +  // Adjust escape state after Connection Graph is built.
  110.31 +  void adjust_escape_state(int nidx, PhaseTransform* phase);
  110.32 +
  110.33 +  // Compute the escape information
  110.34 +  bool compute_escape();
  110.35  
  110.36  public:
  110.37    ConnectionGraph(Compile *C, PhaseIterGVN *igvn);
  110.38 @@ -346,9 +354,6 @@
  110.39    // Perform escape analysis
  110.40    static void do_analysis(Compile *C, PhaseIterGVN *igvn);
  110.41  
  110.42 -  // Compute the escape information
  110.43 -  bool compute_escape();
  110.44 -
  110.45    // escape state of a node
  110.46    PointsToNode::EscapeState escape_state(Node *n);
  110.47  
   111.1 --- a/src/share/vm/opto/indexSet.cpp	Fri Feb 25 11:42:03 2011 -0800
   111.2 +++ b/src/share/vm/opto/indexSet.cpp	Fri Feb 25 12:46:46 2011 -0800
   111.3 @@ -1,5 +1,5 @@
   111.4  /*
   111.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
   111.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
   111.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   111.8   *
   111.9   * This code is free software; you can redistribute it and/or modify it
  111.10 @@ -39,12 +39,12 @@
  111.11  
  111.12  #ifdef ASSERT
  111.13  // Initialize statistics counters
  111.14 -uint IndexSet::_alloc_new = 0;
  111.15 -uint IndexSet::_alloc_total = 0;
  111.16 +julong IndexSet::_alloc_new = 0;
  111.17 +julong IndexSet::_alloc_total = 0;
  111.18  
  111.19 -long IndexSet::_total_bits = 0;
  111.20 -long IndexSet::_total_used_blocks = 0;
  111.21 -long IndexSet::_total_unused_blocks = 0;
  111.22 +julong IndexSet::_total_bits = 0;
  111.23 +julong IndexSet::_total_used_blocks = 0;
  111.24 +julong IndexSet::_total_unused_blocks = 0;
  111.25  
  111.26  // Per set, or all sets operation tracing
  111.27  int IndexSet::_serial_count = 1;
  111.28 @@ -141,7 +141,7 @@
  111.29  
  111.30  #ifdef ASSERT
  111.31    if (CollectIndexSetStatistics) {
  111.32 -    _alloc_new += bitblock_alloc_chunk_size;
  111.33 +    inc_stat_counter(&_alloc_new, bitblock_alloc_chunk_size);
  111.34    }
  111.35  #endif
  111.36  }
  111.37 @@ -154,7 +154,7 @@
  111.38  IndexSet::BitBlock *IndexSet::alloc_block() {
  111.39  #ifdef ASSERT
  111.40    if (CollectIndexSetStatistics) {
  111.41 -    _alloc_total++;
  111.42 +    inc_stat_counter(&_alloc_total, 1);
  111.43    }
  111.44  #endif
  111.45    Compile *compile = Compile::current();
  111.46 @@ -391,13 +391,13 @@
  111.47  // Update block/bit counts to reflect that this set has been iterated over.
  111.48  
  111.49  void IndexSet::tally_iteration_statistics() const {
  111.50 -  _total_bits += count();
  111.51 +  inc_stat_counter(&_total_bits, count());
  111.52  
  111.53    for (uint i = 0; i < _max_blocks; i++) {
  111.54      if (_blocks[i] != &_empty_block) {
  111.55 -      _total_used_blocks++;
  111.56 +      inc_stat_counter(&_total_used_blocks, 1);
  111.57      } else {
  111.58 -      _total_unused_blocks++;
  111.59 +      inc_stat_counter(&_total_unused_blocks, 1);
  111.60      }
  111.61    }
  111.62  }
  111.63 @@ -406,17 +406,17 @@
  111.64  // Print statistics about IndexSet usage.
  111.65  
  111.66  void IndexSet::print_statistics() {
  111.67 -  long total_blocks = _total_used_blocks + _total_unused_blocks;
  111.68 +  julong total_blocks = _total_used_blocks + _total_unused_blocks;
  111.69    tty->print_cr ("Accumulated IndexSet usage statistics:");
  111.70    tty->print_cr ("--------------------------------------");
  111.71    tty->print_cr ("  Iteration:");
  111.72 -  tty->print_cr ("    blocks visited: %d", total_blocks);
  111.73 -  tty->print_cr ("    blocks empty: %4.2f%%", 100.0*_total_unused_blocks/total_blocks);
  111.74 -  tty->print_cr ("    bit density (bits/used blocks): %4.2f%%", (double)_total_bits/_total_used_blocks);
  111.75 -  tty->print_cr ("    bit density (bits/all blocks): %4.2f%%", (double)_total_bits/total_blocks);
  111.76 +  tty->print_cr ("    blocks visited: " UINT64_FORMAT, total_blocks);
  111.77 +  tty->print_cr ("    blocks empty: %4.2f%%", 100.0*(double)_total_unused_blocks/total_blocks);
  111.78 +  tty->print_cr ("    bit density (bits/used blocks): %4.2f", (double)_total_bits/_total_used_blocks);
  111.79 +  tty->print_cr ("    bit density (bits/all blocks): %4.2f", (double)_total_bits/total_blocks);
  111.80    tty->print_cr ("  Allocation:");
  111.81 -  tty->print_cr ("    blocks allocated: %d", _alloc_new);
  111.82 -  tty->print_cr ("    blocks used/reused: %d", _alloc_total);
  111.83 +  tty->print_cr ("    blocks allocated: " UINT64_FORMAT, _alloc_new);
  111.84 +  tty->print_cr ("    blocks used/reused: " UINT64_FORMAT, _alloc_total);
  111.85  }
  111.86  
  111.87  //---------------------------- IndexSet::verify() -----------------------------
   112.1 --- a/src/share/vm/opto/indexSet.hpp	Fri Feb 25 11:42:03 2011 -0800
   112.2 +++ b/src/share/vm/opto/indexSet.hpp	Fri Feb 25 12:46:46 2011 -0800
   112.3 @@ -1,5 +1,5 @@
   112.4  /*
   112.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
   112.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
   112.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   112.8   *
   112.9   * This code is free software; you can redistribute it and/or modify it
  112.10 @@ -352,13 +352,13 @@
  112.11    void tally_iteration_statistics() const;
  112.12  
  112.13    // BitBlock allocation statistics
  112.14 -  static uint _alloc_new;
  112.15 -  static uint _alloc_total;
  112.16 +  static julong _alloc_new;
  112.17 +  static julong _alloc_total;
  112.18  
  112.19    // Block density statistics
  112.20 -  static long _total_bits;
  112.21 -  static long _total_used_blocks;
  112.22 -  static long _total_unused_blocks;
  112.23 +  static julong _total_bits;
  112.24 +  static julong _total_used_blocks;
  112.25 +  static julong _total_unused_blocks;
  112.26  
  112.27    // Sanity tests
  112.28    void verify() const;
   113.1 --- a/src/share/vm/opto/loopnode.cpp	Fri Feb 25 11:42:03 2011 -0800
   113.2 +++ b/src/share/vm/opto/loopnode.cpp	Fri Feb 25 12:46:46 2011 -0800
   113.3 @@ -1,5 +1,5 @@
   113.4  /*
   113.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
   113.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
   113.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   113.8   *
   113.9   * This code is free software; you can redistribute it and/or modify it
  113.10 @@ -1480,6 +1480,8 @@
  113.11  // Create a PhaseLoop.  Build the ideal Loop tree.  Map each Ideal Node to
  113.12  // its corresponding LoopNode.  If 'optimize' is true, do some loop cleanups.
  113.13  void PhaseIdealLoop::build_and_optimize(bool do_split_ifs, bool do_loop_pred) {
  113.14 +  ResourceMark rm;
  113.15 +
  113.16    int old_progress = C->major_progress();
  113.17  
  113.18    // Reset major-progress flag for the driver's heuristics
  113.19 @@ -2013,7 +2015,7 @@
  113.20    if (_dom_stk == NULL) {
  113.21      uint init_size = C->unique() / 100; // Guess that 1/100 is a reasonable initial size.
  113.22      if (init_size < 10) init_size = 10;
  113.23 -    _dom_stk = new (C->node_arena()) GrowableArray<uint>(C->node_arena(), init_size, 0, 0);
  113.24 +    _dom_stk = new GrowableArray<uint>(init_size);
  113.25    }
  113.26    // Compute new depth for each node.
  113.27    for (i = 0; i < _idom_size; i++) {
   114.1 --- a/src/share/vm/opto/loopnode.hpp	Fri Feb 25 11:42:03 2011 -0800
   114.2 +++ b/src/share/vm/opto/loopnode.hpp	Fri Feb 25 12:46:46 2011 -0800
   114.3 @@ -1,5 +1,5 @@
   114.4  /*
   114.5 - * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
   114.6 + * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
   114.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   114.8   *
   114.9   * This code is free software; you can redistribute it and/or modify it
  114.10 @@ -700,7 +700,7 @@
  114.11    PhaseIdealLoop( PhaseIterGVN &igvn) :
  114.12      PhaseTransform(Ideal_Loop),
  114.13      _igvn(igvn),
  114.14 -    _dom_lca_tags(C->comp_arena()),
  114.15 +    _dom_lca_tags(arena()), // Thread::resource_area
  114.16      _verify_me(NULL),
  114.17      _verify_only(true) {
  114.18      build_and_optimize(false, false);
  114.19 @@ -721,7 +721,7 @@
  114.20    PhaseIdealLoop( PhaseIterGVN &igvn, bool do_split_ifs, bool do_loop_pred) :
  114.21      PhaseTransform(Ideal_Loop),
  114.22      _igvn(igvn),
  114.23 -    _dom_lca_tags(C->comp_arena()),
  114.24 +    _dom_lca_tags(arena()), // Thread::resource_area
  114.25      _verify_me(NULL),
  114.26      _verify_only(false) {
  114.27      build_and_optimize(do_split_ifs, do_loop_pred);
  114.28 @@ -731,7 +731,7 @@
  114.29    PhaseIdealLoop( PhaseIterGVN &igvn, const PhaseIdealLoop *verify_me) :
  114.30      PhaseTransform(Ideal_Loop),
  114.31      _igvn(igvn),
  114.32 -    _dom_lca_tags(C->comp_arena()),
  114.33 +    _dom_lca_tags(arena()), // Thread::resource_area
  114.34      _verify_me(verify_me),
  114.35      _verify_only(false) {
  114.36      build_and_optimize(false, false);
   115.1 --- a/src/share/vm/opto/node.cpp	Fri Feb 25 11:42:03 2011 -0800
   115.2 +++ b/src/share/vm/opto/node.cpp	Fri Feb 25 12:46:46 2011 -0800
   115.3 @@ -743,6 +743,9 @@
   115.4  //------------------------------del_req----------------------------------------
   115.5  // Delete the required edge and compact the edge array
   115.6  void Node::del_req( uint idx ) {
   115.7 +  assert( idx < _cnt, "oob");
   115.8 +  assert( !VerifyHashTableKeys || _hash_lock == 0,
   115.9 +          "remove node from hash table before modifying it");
  115.10    // First remove corresponding def-use edge
  115.11    Node *n = in(idx);
  115.12    if (n != NULL) n->del_out((Node *)this);
   116.1 --- a/src/share/vm/opto/phase.cpp	Fri Feb 25 11:42:03 2011 -0800
   116.2 +++ b/src/share/vm/opto/phase.cpp	Fri Feb 25 12:46:46 2011 -0800
   116.3 @@ -1,5 +1,5 @@
   116.4  /*
   116.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   116.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
   116.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   116.8   *
   116.9   * This code is free software; you can redistribute it and/or modify it
  116.10 @@ -99,16 +99,18 @@
  116.11    tty->print_cr ("    stub compilation     : %3.3f sec.", Phase::_t_stubCompilation.seconds());
  116.12    tty->print_cr ("  Phases:");
  116.13    tty->print_cr ("    parse          : %3.3f sec", Phase::_t_parser.seconds());
  116.14 -  if (DoEscapeAnalysis) {
  116.15 -    tty->print_cr ("    escape analysis   : %3.3f sec", Phase::_t_escapeAnalysis.seconds());
  116.16 -  }
  116.17    tty->print_cr ("    optimizer      : %3.3f sec", Phase::_t_optimizer.seconds());
  116.18    if( Verbose || WizardMode ) {
  116.19 +    if (DoEscapeAnalysis) {
  116.20 +      // EA is part of Optimizer.
  116.21 +      tty->print_cr ("      escape analysis: %3.3f sec", Phase::_t_escapeAnalysis.seconds());
  116.22 +    }
  116.23      tty->print_cr ("      iterGVN        : %3.3f sec", Phase::_t_iterGVN.seconds());
  116.24      tty->print_cr ("      idealLoop      : %3.3f sec", Phase::_t_idealLoop.seconds());
  116.25      tty->print_cr ("      idealLoopVerify: %3.3f sec", Phase::_t_idealLoopVerify.seconds());
  116.26      tty->print_cr ("      ccp            : %3.3f sec", Phase::_t_ccp.seconds());
  116.27      tty->print_cr ("      iterGVN2       : %3.3f sec", Phase::_t_iterGVN2.seconds());
  116.28 +    tty->print_cr ("      macroExpand    : %3.3f sec", Phase::_t_macroExpand.seconds());
  116.29      tty->print_cr ("      graphReshape   : %3.3f sec", Phase::_t_graphReshaping.seconds());
  116.30      double optimizer_subtotal = Phase::_t_iterGVN.seconds() +
  116.31        Phase::_t_idealLoop.seconds() + Phase::_t_ccp.seconds() +
  116.32 @@ -133,18 +135,15 @@
  116.33      double percent_of_regalloc = ((regalloc_subtotal == 0.0) ? 0.0 : (regalloc_subtotal / Phase::_t_registerAllocation.seconds() * 100.0));
  116.34      tty->print_cr ("      subtotal       : %3.3f sec,  %3.2f %%", regalloc_subtotal, percent_of_regalloc);
  116.35    }
  116.36 -  tty->print_cr ("    macroExpand    : %3.3f sec", Phase::_t_macroExpand.seconds());
  116.37    tty->print_cr ("    blockOrdering  : %3.3f sec", Phase::_t_blockOrdering.seconds());
  116.38    tty->print_cr ("    peephole       : %3.3f sec", Phase::_t_peephole.seconds());
  116.39    tty->print_cr ("    codeGen        : %3.3f sec", Phase::_t_codeGeneration.seconds());
  116.40    tty->print_cr ("    install_code   : %3.3f sec", Phase::_t_registerMethod.seconds());
  116.41    tty->print_cr ("    -------------- : ----------");
  116.42    double phase_subtotal = Phase::_t_parser.seconds() +
  116.43 -    (DoEscapeAnalysis ? Phase::_t_escapeAnalysis.seconds() : 0.0) +
  116.44      Phase::_t_optimizer.seconds() + Phase::_t_graphReshaping.seconds() +
  116.45      Phase::_t_matcher.seconds() + Phase::_t_scheduler.seconds() +
  116.46      Phase::_t_registerAllocation.seconds() + Phase::_t_blockOrdering.seconds() +
  116.47 -    Phase::_t_macroExpand.seconds() + Phase::_t_peephole.seconds() +
  116.48      Phase::_t_codeGeneration.seconds() + Phase::_t_registerMethod.seconds();
  116.49    double percent_of_method_compile = ((phase_subtotal == 0.0) ? 0.0 : phase_subtotal / Phase::_t_methodCompilation.seconds()) * 100.0;
  116.50    // counters inside Compile::CodeGen include time for adapters and stubs
   117.1 --- a/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri Feb 25 11:42:03 2011 -0800
   117.2 +++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp	Fri Feb 25 12:46:46 2011 -0800
   117.3 @@ -1247,12 +1247,12 @@
   117.4    // Constant pools are not easily reused so we allocate a new one
   117.5    // each time.
   117.6    // merge_cp is created unsafe for concurrent GC processing.  It
   117.7 -  // should be marked safe before discarding it because, even if
   117.8 -  // garbage.  If it crosses a card boundary, it may be scanned
   117.9 +  // should be marked safe before discarding it. Even though
  117.10 +  // garbage,  if it crosses a card boundary, it may be scanned
  117.11    // in order to find the start of the first complete object on the card.
  117.12    constantPoolHandle merge_cp(THREAD,
  117.13      oopFactory::new_constantPool(merge_cp_length,
  117.14 -                                 methodOopDesc::IsUnsafeConc,
  117.15 +                                 oopDesc::IsUnsafeConc,
  117.16                                   THREAD));
  117.17    int orig_length = old_cp->orig_length();
  117.18    if (orig_length == 0) {
  117.19 @@ -2343,7 +2343,7 @@
  117.20      // sized constant pool with the klass to save space.
  117.21      constantPoolHandle smaller_cp(THREAD,
  117.22        oopFactory::new_constantPool(scratch_cp_length,
  117.23 -                                   methodOopDesc::IsUnsafeConc,
  117.24 +                                   oopDesc::IsUnsafeConc,
  117.25                                     THREAD));
  117.26      // preserve orig_length() value in the smaller copy
  117.27      int orig_length = scratch_cp->orig_length();
   118.1 --- a/src/share/vm/prims/methodHandleWalk.cpp	Fri Feb 25 11:42:03 2011 -0800
   118.2 +++ b/src/share/vm/prims/methodHandleWalk.cpp	Fri Feb 25 12:46:46 2011 -0800
   118.3 @@ -1134,8 +1134,9 @@
   118.4  
   118.5  constantPoolHandle MethodHandleCompiler::get_constant_pool(TRAPS) const {
   118.6    constantPoolHandle nullHandle;
   118.7 -  bool is_conc_safe = true;
   118.8 -  constantPoolOop cpool_oop = oopFactory::new_constantPool(_constants.length(), is_conc_safe, CHECK_(nullHandle));
   118.9 +  constantPoolOop cpool_oop = oopFactory::new_constantPool(_constants.length(),
  118.10 +                                                           oopDesc::IsSafeConc,
  118.11 +                                                           CHECK_(nullHandle));
  118.12    constantPoolHandle cpool(THREAD, cpool_oop);
  118.13  
  118.14    // Fill the real constant pool skipping the zero element.
  118.15 @@ -1180,10 +1181,9 @@
  118.16    else
  118.17      flags_bits = (/*JVM_MH_INVOKE_BITS |*/ JVM_ACC_PUBLIC | JVM_ACC_FINAL | JVM_ACC_SYNTHETIC);
  118.18  
  118.19 -  bool is_conc_safe = true;
  118.20    methodOop m_oop = oopFactory::new_method(bytecode_length(),
  118.21                                             accessFlags_from(flags_bits),
  118.22 -                                           0, 0, 0, is_conc_safe, CHECK_(nullHandle));
  118.23 +                                           0, 0, 0, oopDesc::IsSafeConc, CHECK_(nullHandle));
  118.24    methodHandle m(THREAD, m_oop);
  118.25    m_oop = NULL;  // oop not GC safe
  118.26  
   119.1 --- a/src/share/vm/runtime/arguments.cpp	Fri Feb 25 11:42:03 2011 -0800
   119.2 +++ b/src/share/vm/runtime/arguments.cpp	Fri Feb 25 12:46:46 2011 -0800
   119.3 @@ -1410,7 +1410,7 @@
   119.4    // by ergonomics.
   119.5    if (MaxHeapSize <= max_heap_for_compressed_oops()) {
   119.6  #if !defined(COMPILER1) || defined(TIERED)
   119.7 -    if (FLAG_IS_DEFAULT(UseCompressedOops) && !UseG1GC) {
   119.8 +    if (FLAG_IS_DEFAULT(UseCompressedOops)) {
   119.9        FLAG_SET_ERGO(bool, UseCompressedOops, true);
  119.10      }
  119.11  #endif
  119.12 @@ -3103,6 +3103,19 @@
  119.13    // Set flags if Aggressive optimization flags (-XX:+AggressiveOpts) enabled.
  119.14    set_aggressive_opts_flags();
  119.15  
  119.16 +  // Turn off biased locking for locking debug mode flags,
  119.17 +  // which are subtlely different from each other but neither works with
  119.18 +  // biased locking.
  119.19 +  if (!UseFastLocking || UseHeavyMonitors) {
  119.20 +    if (!FLAG_IS_DEFAULT(UseBiasedLocking) && UseBiasedLocking) {
  119.21 +      // flag set to true on command line; warn the user that they
  119.22 +      // can't enable biased locking here
  119.23 +      warning("Biased Locking is not supported with locking debug flags"
  119.24 +              "; ignoring UseBiasedLocking flag." );
  119.25 +    }
  119.26 +    UseBiasedLocking = false;
  119.27 +  }
  119.28 +
  119.29  #ifdef CC_INTERP
  119.30    // Clear flags not supported by the C++ interpreter
  119.31    FLAG_SET_DEFAULT(ProfileInterpreter, false);
   120.1 --- a/src/share/vm/runtime/globals.hpp	Fri Feb 25 11:42:03 2011 -0800
   120.2 +++ b/src/share/vm/runtime/globals.hpp	Fri Feb 25 12:46:46 2011 -0800
   120.3 @@ -740,6 +740,9 @@
   120.4    develop(bool, PrintMalloc, false,                                         \
   120.5            "print all malloc/free calls")                                    \
   120.6                                                                              \
   120.7 +  develop(bool, PrintMallocStatistics, false,                               \
   120.8 +          "print malloc/free statistics")                                   \
   120.9 +                                                                            \
  120.10    develop(bool, ZapResourceArea, trueInDebug,                               \
  120.11            "Zap freed resource/arena space with 0xABABABAB")                 \
  120.12                                                                              \
  120.13 @@ -2664,25 +2667,6 @@
  120.14    product(bool, UseStringCache, false,                                      \
  120.15            "Enable String cache capabilities on String.java")                \
  120.16                                                                              \
  120.17 -  /* byte strings */                                                        \
  120.18 -  product(bool, UseCompressedStrings, false,                                \
  120.19 -          "Enable byte-valued strings")                                     \
  120.20 -                                                                            \
  120.21 -  product(bool, SpecialStringCompress, true,                                \
  120.22 -          "special version of string compress")                             \
  120.23 -                                                                            \
  120.24 -  product(bool, SpecialStringInflate, true,                                 \
  120.25 -          "special version of string inflate")                              \
  120.26 -                                                                            \
  120.27 -  product(bool, SpecialStringCompareToCC, true,                             \
  120.28 -          "special version of string compareToCC")                          \
  120.29 -                                                                            \
  120.30 -  product(bool, SpecialStringIndexOfCC, true,                               \
  120.31 -          "special version of string indexOfCC")                            \
  120.32 -                                                                            \
  120.33 -  product(bool, SpecialStringEqualsCC, true,                                \
  120.34 -          "special version of string equalsCC")                             \
  120.35 -                                                                            \
  120.36    /* statistics */                                                          \
  120.37    develop(bool, CountCompiledCalls, false,                                  \
  120.38            "counts method invocations")                                      \
  120.39 @@ -3692,7 +3676,7 @@
  120.40    product(uintx, SharedReadOnlySize,   10*M,                                \
  120.41            "Size of read-only space in permanent generation (in bytes)")     \
  120.42                                                                              \
  120.43 -  product(uintx, SharedMiscDataSize,    4*M,                                \
  120.44 +  product(uintx, SharedMiscDataSize,    NOT_LP64(4*M) LP64_ONLY(5*M),       \
  120.45            "Size of the shared data area adjacent to the heap (in bytes)")   \
  120.46                                                                              \
  120.47    product(uintx, SharedMiscCodeSize,    4*M,                                \
   121.1 --- a/src/share/vm/runtime/java.cpp	Fri Feb 25 11:42:03 2011 -0800
   121.2 +++ b/src/share/vm/runtime/java.cpp	Fri Feb 25 12:46:46 2011 -0800
   121.3 @@ -326,7 +326,7 @@
   121.4    }
   121.5  
   121.6    print_bytecode_count();
   121.7 -  if (WizardMode) {
   121.8 +  if (PrintMallocStatistics) {
   121.9      tty->print("allocation stats: ");
  121.10      alloc_stats.print();
  121.11      tty->cr();
   122.1 --- a/src/share/vm/runtime/os.cpp	Fri Feb 25 11:42:03 2011 -0800
   122.2 +++ b/src/share/vm/runtime/os.cpp	Fri Feb 25 12:46:46 2011 -0800
   122.3 @@ -1,5 +1,5 @@
   122.4  /*
   122.5 - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   122.6 + * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
   122.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   122.8   *
   122.9   * This code is free software; you can redistribute it and/or modify it
  122.10 @@ -72,9 +72,10 @@
  122.11  size_t            os::_page_sizes[os::page_sizes_max];
  122.12  
  122.13  #ifndef PRODUCT
  122.14 -int os::num_mallocs = 0;            // # of calls to malloc/realloc
  122.15 -size_t os::alloc_bytes = 0;         // # of bytes allocated
  122.16 -int os::num_frees = 0;              // # of calls to free
  122.17 +julong os::num_mallocs = 0;         // # of calls to malloc/realloc
  122.18 +julong os::alloc_bytes = 0;         // # of bytes allocated
  122.19 +julong os::num_frees = 0;           // # of calls to free
  122.20 +julong os::free_bytes = 0;          // # of bytes freed
  122.21  #endif
  122.22  
  122.23  // Fill in buffer with current local time as an ISO-8601 string.
  122.24 @@ -490,9 +491,9 @@
  122.25    }
  122.26  
  122.27    if (start_of_prev_block + space_before + size + space_after == start_of_this_block) {
  122.28 -    tty->print_cr("### previous object: %p (%ld bytes)", obj, size);
  122.29 +    tty->print_cr("### previous object: " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", obj, size);
  122.30    } else {
  122.31 -    tty->print_cr("### previous object (not sure if correct): %p (%ld bytes)", obj, size);
  122.32 +    tty->print_cr("### previous object (not sure if correct): " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", obj, size);
  122.33    }
  122.34  
  122.35    // now find successor block
  122.36 @@ -504,16 +505,16 @@
  122.37        start_of_next_block[1] == badResourceValue &&
  122.38        start_of_next_block[2] == badResourceValue &&
  122.39        start_of_next_block[3] == badResourceValue) {
  122.40 -    tty->print_cr("### next object: %p (%ld bytes)", next_obj, next_size);
  122.41 +    tty->print_cr("### next object: " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", next_obj, next_size);
  122.42    } else {
  122.43 -    tty->print_cr("### next object (not sure if correct): %p (%ld bytes)", next_obj, next_size);
  122.44 +    tty->print_cr("### next object (not sure if correct): " PTR_FORMAT " (" SSIZE_FORMAT " bytes)", next_obj, next_size);
  122.45    }
  122.46  }
  122.47  
  122.48  
  122.49  void report_heap_error(void* memblock, void* bad, const char* where) {
  122.50 -  tty->print_cr("## nof_mallocs = %d, nof_frees = %d", os::num_mallocs, os::num_frees);
  122.51 -  tty->print_cr("## memory stomp: byte at %p %s object %p", bad, where, memblock);
  122.52 +  tty->print_cr("## nof_mallocs = " UINT64_FORMAT ", nof_frees = " UINT64_FORMAT, os::num_mallocs, os::num_frees);
  122.53 +  tty->print_cr("## memory stomp: byte at " PTR_FORMAT " %s object " PTR_FORMAT, bad, where, memblock);
  122.54    print_neighbor_blocks(memblock);
  122.55    fatal("memory stomping error");
  122.56  }
  122.57 @@ -538,8 +539,8 @@
  122.58  #endif
  122.59  
  122.60  void* os::malloc(size_t size) {
  122.61 -  NOT_PRODUCT(num_mallocs++);
  122.62 -  NOT_PRODUCT(alloc_bytes += size);
  122.63 +  NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1));
  122.64 +  NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size));
  122.65  
  122.66    if (size == 0) {
  122.67      // return a valid pointer if size is zero
  122.68 @@ -562,26 +563,26 @@
  122.69  #endif
  122.70    u_char* memblock = ptr + space_before;
  122.71    if ((intptr_t)memblock == (intptr_t)MallocCatchPtr) {
  122.72 -    tty->print_cr("os::malloc caught, %lu bytes --> %p", size, memblock);
  122.73 +    tty->print_cr("os::malloc caught, " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, memblock);
  122.74      breakpoint();
  122.75    }
  122.76    debug_only(if (paranoid) verify_block(memblock));
  122.77 -  if (PrintMalloc && tty != NULL) tty->print_cr("os::malloc %lu bytes --> %p", size, memblock);
  122.78 +  if (PrintMalloc && tty != NULL) tty->print_cr("os::malloc " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, memblock);
  122.79    return memblock;
  122.80  }
  122.81  
  122.82  
  122.83  void* os::realloc(void *memblock, size_t size) {
  122.84 -  NOT_PRODUCT(num_mallocs++);
  122.85 -  NOT_PRODUCT(alloc_bytes += size);
  122.86  #ifndef ASSERT
  122.87 +  NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1));
  122.88 +  NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size));
  122.89    return ::realloc(memblock, size);
  122.90  #else
  122.91    if (memblock == NULL) {
  122.92 -    return os::malloc(size);
  122.93 +    return malloc(size);
  122.94    }
  122.95    if ((intptr_t)memblock == (intptr_t)MallocCatchPtr) {
  122.96 -    tty->print_cr("os::realloc caught %p", memblock);
  122.97 +    tty->print_cr("os::realloc caught " PTR_FORMAT, memblock);
  122.98      breakpoint();
  122.99    }
 122.100    verify_block(memblock);
 122.101 @@ -589,13 +590,13 @@
 122.102    if (size == 0) return NULL;
 122.103    // always move the block
 122.104    void* ptr = malloc(size);
 122.105 -  if (PrintMalloc) tty->print_cr("os::remalloc %lu bytes, %p --> %p", size, memblock, ptr);
 122.106 +  if (PrintMalloc) tty->print_cr("os::remalloc " SIZE_FORMAT " bytes, " PTR_FORMAT " --> " PTR_FORMAT, size, memblock, ptr);
 122.107    // Copy to new memory if malloc didn't fail
 122.108    if ( ptr != NULL ) {
 122.109      memcpy(ptr, memblock, MIN2(size, get_size(memblock)));
 122.110      if (paranoid) verify_block(ptr);
 122.111      if ((intptr_t)ptr == (intptr_t)MallocCatchPtr) {
 122.112 -      tty->print_cr("os::realloc caught, %lu bytes --> %p", size, ptr);
 122.113 +      tty->print_cr("os::realloc caught, " SIZE_FORMAT " bytes --> " PTR_FORMAT, size, ptr);
 122.114        breakpoint();
 122.115      }
 122.116      free(memblock);
 122.117 @@ -606,17 +607,14 @@
 122.118  
 122.119  
 122.120  void  os::free(void *memblock) {
 122.121 -  NOT_PRODUCT(num_frees++);
 122.122 +  NOT_PRODUCT(inc_stat_counter(&num_frees, 1));
 122.123  #ifdef ASSERT
 122.124    if (memblock == NULL) return;
 122.125    if ((intptr_t)memblock == (intptr_t)MallocCatchPtr) {
 122.126 -    if (tty != NULL) tty->print_cr("os::free caught %p", memblock);
 122.127 +    if (tty != NULL) tty->print_cr("os::free caught " PTR_FORMAT, memblock);
 122.128      breakpoint();
 122.129    }
 122.130    verify_block(memblock);
 122.131 -  if (PrintMalloc && tty != NULL)
 122.132 -    // tty->print_cr("os::free %p", memblock);
 122.133 -    fprintf(stderr, "os::free %p\n", memblock);
 122.134    NOT_PRODUCT(if (MallocVerifyInterval > 0) check_heap());
 122.135    // Added by detlefs.
 122.136    if (MallocCushion) {
 122.137 @@ -627,12 +625,18 @@
 122.138        *p = (u_char)freeBlockPad;
 122.139      }
 122.140      size_t size = get_size(memblock);
 122.141 +    inc_stat_counter(&free_bytes, size);
 122.142      u_char* end = ptr + space_before + size;
 122.143      for (u_char* q = end; q < end + MallocCushion; q++) {
 122.144        guarantee(*q == badResourceValue,
 122.145                  "Thing freed should be malloc result.");
 122.146        *q = (u_char)freeBlockPad;
 122.147      }
 122.148 +    if (PrintMalloc && tty != NULL)
 122.149 +      fprintf(stderr, "os::free " SIZE_FORMAT " bytes --> " PTR_FORMAT "\n", size, memblock);
 122.150 +  } else if (PrintMalloc && tty != NULL) {
 122.151 +    // tty->print_cr("os::free %p", memblock);
 122.152 +    fprintf(stderr, "os::free " PTR_FORMAT "\n", memblock);
 122.153    }
 122.154  #endif
 122.155    ::free((char*)memblock - space_before);
   123.1 --- a/src/share/vm/runtime/os.hpp	Fri Feb 25 11:42:03 2011 -0800
   123.2 +++ b/src/share/vm/runtime/os.hpp	Fri Feb 25 12:46:46 2011 -0800
   123.3 @@ -559,9 +559,10 @@
   123.4    static char* strdup(const char *);  // Like strdup
   123.5  
   123.6  #ifndef PRODUCT
   123.7 -  static int  num_mallocs;            // # of calls to malloc/realloc
   123.8 -  static size_t  alloc_bytes;         // # of bytes allocated
   123.9 -  static int  num_frees;              // # of calls to free
  123.10 +  static julong num_mallocs;         // # of calls to malloc/realloc
  123.11 +  static julong alloc_bytes;         // # of bytes allocated
  123.12 +  static julong num_frees;           // # of calls to free
  123.13 +  static julong free_bytes;          // # of bytes freed
  123.14  #endif
  123.15  
  123.16    // SocketInterface (ex HPI SocketInterface )
   124.1 --- a/src/share/vm/runtime/simpleThresholdPolicy.cpp	Fri Feb 25 11:42:03 2011 -0800
   124.2 +++ b/src/share/vm/runtime/simpleThresholdPolicy.cpp	Fri Feb 25 12:46:46 2011 -0800
   124.3 @@ -1,5 +1,5 @@
   124.4  /*
   124.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
   124.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
   124.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   124.8   *
   124.9   * This code is free software; you can redistribute it and/or modify it
  124.10 @@ -28,6 +28,7 @@
  124.11  #include "runtime/arguments.hpp"
  124.12  #include "runtime/simpleThresholdPolicy.hpp"
  124.13  #include "runtime/simpleThresholdPolicy.inline.hpp"
  124.14 +#include "code/scopeDesc.hpp"
  124.15  
  124.16  // Print an event.
  124.17  void SimpleThresholdPolicy::print_event(EventType type, methodHandle mh, methodHandle imh,
  124.18 @@ -48,6 +49,18 @@
  124.19      break;
  124.20    case COMPILE:
  124.21      tty->print("compile");
  124.22 +    break;
  124.23 +  case KILL:
  124.24 +    tty->print("kill");
  124.25 +    break;
  124.26 +  case UPDATE:
  124.27 +    tty->print("update");
  124.28 +    break;
  124.29 +  case REPROFILE:
  124.30 +    tty->print("reprofile");
  124.31 +    break;
  124.32 +  default:
  124.33 +    tty->print("unknown");
  124.34    }
  124.35  
  124.36    tty->print(" level: %d ", level);
  124.37 @@ -69,13 +82,17 @@
  124.38    if (type != COMPILE) {
  124.39      methodDataHandle mdh = mh->method_data();
  124.40      int mdo_invocations = 0, mdo_backedges = 0;
  124.41 +    int mdo_invocations_start = 0, mdo_backedges_start = 0;
  124.42      if (mdh() != NULL) {
  124.43        mdo_invocations = mdh->invocation_count();
  124.44        mdo_backedges = mdh->backedge_count();
  124.45 +      mdo_invocations_start = mdh->invocation_count_start();
  124.46 +      mdo_backedges_start = mdh->backedge_count_start();
  124.47      }
  124.48 -    tty->print(" total: %d,%d mdo: %d,%d",
  124.49 +    tty->print(" total: %d,%d mdo: %d(%d),%d(%d)",
  124.50                 invocation_count, backedge_count,
  124.51 -               mdo_invocations, mdo_backedges);
  124.52 +               mdo_invocations, mdo_invocations_start,
  124.53 +               mdo_backedges, mdo_backedges_start);
  124.54      tty->print(" max levels: %d,%d",
  124.55                  mh->highest_comp_level(), mh->highest_osr_comp_level());
  124.56      if (inlinee_event) {
  124.57 @@ -138,6 +155,20 @@
  124.58    return compile_queue->first();
  124.59  }
  124.60  
  124.61 +void SimpleThresholdPolicy::reprofile(ScopeDesc* trap_scope, bool is_osr) {
  124.62 +  for (ScopeDesc* sd = trap_scope;; sd = sd->sender()) {
  124.63 +    if (PrintTieredEvents) {
  124.64 +      methodHandle mh(sd->method());
  124.65 +      print_event(REPROFILE, mh, mh, InvocationEntryBci, CompLevel_none);
  124.66 +    }
  124.67 +    methodDataOop mdo = sd->method()->method_data();
  124.68 +    if (mdo != NULL) {
  124.69 +      mdo->reset_start_counters();
  124.70 +    }
  124.71 +    if (sd->is_top()) break;
  124.72 +  }
  124.73 +}
  124.74 +
  124.75  nmethod* SimpleThresholdPolicy::event(methodHandle method, methodHandle inlinee,
  124.76                                        int branch_bci, int bci, CompLevel comp_level, TRAPS) {
  124.77    if (comp_level == CompLevel_none &&
  124.78 @@ -254,46 +285,35 @@
  124.79  
  124.80  // Common transition function. Given a predicate determines if a method should transition to another level.
  124.81  CompLevel SimpleThresholdPolicy::common(Predicate p, methodOop method, CompLevel cur_level) {
  124.82 +  if (is_trivial(method)) return CompLevel_simple;
  124.83 +
  124.84    CompLevel next_level = cur_level;
  124.85    int i = method->invocation_count();
  124.86    int b = method->backedge_count();
  124.87  
  124.88    switch(cur_level) {
  124.89    case CompLevel_none:
  124.90 -    {
  124.91 -      methodDataOop mdo = method->method_data();
  124.92 -      if (mdo != NULL) {
  124.93 -        int mdo_i = mdo->invocation_count();
  124.94 -        int mdo_b = mdo->backedge_count();
  124.95 -        // If we were at full profile level, would we switch to full opt?
  124.96 -        if ((this->*p)(mdo_i, mdo_b, CompLevel_full_profile)) {
  124.97 -          next_level = CompLevel_full_optimization;
  124.98 -        }
  124.99 -      }
 124.100 -    }
 124.101 -    if (next_level == cur_level && (this->*p)(i, b, cur_level)) {
 124.102 -      if (is_trivial(method)) {
 124.103 -        next_level = CompLevel_simple;
 124.104 -      } else {
 124.105 -        next_level = CompLevel_full_profile;
 124.106 -      }
 124.107 +    // If we were at full profile level, would we switch to full opt?
 124.108 +    if (common(p, method, CompLevel_full_profile) == CompLevel_full_optimization) {
 124.109 +      next_level = CompLevel_full_optimization;
 124.110 +    } else if ((this->*p)(i, b, cur_level)) {
 124.111 +      next_level = CompLevel_full_profile;
 124.112      }
 124.113      break;
 124.114    case CompLevel_limited_profile:
 124.115    case CompLevel_full_profile:
 124.116 -    if (is_trivial(method)) {
 124.117 -      next_level = CompLevel_simple;
 124.118 -    } else {
 124.119 +    {
 124.120        methodDataOop mdo = method->method_data();
 124.121 -      guarantee(mdo != NULL, "MDO should always exist");
 124.122 -      if (mdo->would_profile()) {
 124.123 -        int mdo_i = mdo->invocation_count();
 124.124 -        int mdo_b = mdo->backedge_count();
 124.125 -        if ((this->*p)(mdo_i, mdo_b, cur_level)) {
 124.126 +      if (mdo != NULL) {
 124.127 +        if (mdo->would_profile()) {
 124.128 +          int mdo_i = mdo->invocation_count_delta();
 124.129 +          int mdo_b = mdo->backedge_count_delta();
 124.130 +          if ((this->*p)(mdo_i, mdo_b, cur_level)) {
 124.131 +            next_level = CompLevel_full_optimization;
 124.132 +          }
 124.133 +        } else {
 124.134            next_level = CompLevel_full_optimization;
 124.135          }
 124.136 -      } else {
 124.137 -        next_level = CompLevel_full_optimization;
 124.138        }
 124.139      }
 124.140      break;
 124.141 @@ -303,12 +323,6 @@
 124.142  
 124.143  // Determine if a method should be compiled with a normal entry point at a different level.
 124.144  CompLevel SimpleThresholdPolicy::call_event(methodOop method,  CompLevel cur_level) {
 124.145 -  CompLevel highest_level = (CompLevel)method->highest_comp_level();
 124.146 -  if (cur_level == CompLevel_none && highest_level > cur_level) {
 124.147 -    // TODO: We may want to try to do more extensive reprofiling in this case.
 124.148 -    return highest_level;
 124.149 -  }
 124.150 -
 124.151    CompLevel osr_level = (CompLevel) method->highest_osr_comp_level();
 124.152    CompLevel next_level = common(&SimpleThresholdPolicy::call_predicate, method, cur_level);
 124.153  
   125.1 --- a/src/share/vm/runtime/simpleThresholdPolicy.hpp	Fri Feb 25 11:42:03 2011 -0800
   125.2 +++ b/src/share/vm/runtime/simpleThresholdPolicy.hpp	Fri Feb 25 12:46:46 2011 -0800
   125.3 @@ -1,5 +1,5 @@
   125.4  /*
   125.5 - * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
   125.6 + * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
   125.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   125.8   *
   125.9   * This code is free software; you can redistribute it and/or modify it
  125.10 @@ -62,7 +62,7 @@
  125.11    void set_c1_count(int x) { _c1_count = x;    }
  125.12    void set_c2_count(int x) { _c2_count = x;    }
  125.13  
  125.14 -  enum EventType { CALL, LOOP, COMPILE };
  125.15 +  enum EventType { CALL, LOOP, COMPILE, KILL, UPDATE, REPROFILE };
  125.16    void print_event(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level);
  125.17    // Print policy-specific information if necessary
  125.18    virtual void print_specific(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level) { }
  125.19 @@ -103,7 +103,7 @@
  125.20    virtual void disable_compilation(methodOop method) { }
  125.21    // TODO: we should honour reprofiling requests in the future. Currently reprofiling
  125.22    // would happen but not to the extent we would ideally like.
  125.23 -  virtual void reprofile(ScopeDesc* trap_scope, bool is_osr) { }
  125.24 +  virtual void reprofile(ScopeDesc* trap_scope, bool is_osr);
  125.25    virtual nmethod* event(methodHandle method, methodHandle inlinee,
  125.26                           int branch_bci, int bci, CompLevel comp_level, TRAPS);
  125.27    // Select task is called by CompileBroker. We should return a task or NULL.
   126.1 --- a/src/share/vm/runtime/vmStructs.cpp	Fri Feb 25 11:42:03 2011 -0800
   126.2 +++ b/src/share/vm/runtime/vmStructs.cpp	Fri Feb 25 12:46:46 2011 -0800
   126.3 @@ -748,7 +748,6 @@
   126.4    /***********************************/                                                                                              \
   126.5                                                                                                                                       \
   126.6       static_field(StubRoutines,                _call_stub_return_address,                     address)                               \
   126.7 -     IA32_ONLY(static_field(StubRoutines::x86,_call_stub_compiled_return,                     address))                              \
   126.8                                                                                                                                       \
   126.9    /***************************************/                                                                                          \
  126.10    /* PcDesc and other compiled code info */                                                                                          \
   127.1 --- a/src/share/vm/services/heapDumper.cpp	Fri Feb 25 11:42:03 2011 -0800
   127.2 +++ b/src/share/vm/services/heapDumper.cpp	Fri Feb 25 12:46:46 2011 -0800
   127.3 @@ -1,5 +1,5 @@
   127.4  /*
   127.5 - * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
   127.6 + * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
   127.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   127.8   *
   127.9   * This code is free software; you can redistribute it and/or modify it
  127.10 @@ -1397,6 +1397,7 @@
  127.11   public:
  127.12    VM_HeapDumper(DumpWriter* writer, bool gc_before_heap_dump, bool oome) :
  127.13      VM_GC_Operation(0 /* total collections,      dummy, ignored */,
  127.14 +                    GCCause::_heap_dump /* GC Cause */,
  127.15                      0 /* total full collections, dummy, ignored */,
  127.16                      gc_before_heap_dump) {
  127.17      _local_writer = writer;
   128.1 --- a/src/share/vm/services/management.cpp	Fri Feb 25 11:42:03 2011 -0800
   128.2 +++ b/src/share/vm/services/management.cpp	Fri Feb 25 12:46:46 2011 -0800
   128.3 @@ -1311,7 +1311,7 @@
   128.4      if (locked_monitors) {
   128.5        // Constructs Object[] and int[] to contain the object monitor and the stack depth
   128.6        // where the thread locked it
   128.7 -      objArrayOop array = oopFactory::new_system_objArray(num_locked_monitors, CHECK_NULL);
   128.8 +      objArrayOop array = oopFactory::new_objArray(SystemDictionary::Object_klass(), num_locked_monitors, CHECK_NULL);
   128.9        objArrayHandle mh(THREAD, array);
  128.10        monitors_array = mh;
  128.11  
  128.12 @@ -1353,7 +1353,7 @@
  128.13        GrowableArray<instanceOop>* locks = (tcl != NULL ? tcl->owned_locks() : NULL);
  128.14        int num_locked_synchronizers = (locks != NULL ? locks->length() : 0);
  128.15  
  128.16 -      objArrayOop array = oopFactory::new_system_objArray(num_locked_synchronizers, CHECK_NULL);
  128.17 +      objArrayOop array = oopFactory::new_objArray(SystemDictionary::Object_klass(), num_locked_synchronizers, CHECK_NULL);
  128.18        objArrayHandle sh(THREAD, array);
  128.19        synchronizers_array = sh;
  128.20  
   129.1 --- a/src/share/vm/utilities/errorReporter.hpp	Fri Feb 25 11:42:03 2011 -0800
   129.2 +++ b/src/share/vm/utilities/errorReporter.hpp	Fri Feb 25 12:46:46 2011 -0800
   129.3 @@ -26,6 +26,7 @@
   129.4  #define SHARE_VM_UTILITIES_ERRORREPORTER_HPP
   129.5  
   129.6  #include "utilities/globalDefinitions.hpp"
   129.7 +#include "memory/allocation.hpp"
   129.8  
   129.9  class ErrorReporter : public StackObj {
  129.10  
   130.1 --- a/src/share/vm/utilities/hashtable.hpp	Fri Feb 25 11:42:03 2011 -0800
   130.2 +++ b/src/share/vm/utilities/hashtable.hpp	Fri Feb 25 12:46:46 2011 -0800
   130.3 @@ -276,7 +276,7 @@
   130.4    }
   130.5  
   130.6    int index_for(Symbol* name, Handle loader) {
   130.7 -    return hash_to_index(compute_hash(name, loader));
   130.8 +    return this->hash_to_index(compute_hash(name, loader));
   130.9    }
  130.10  };
  130.11  
   131.1 --- a/src/share/vm/utilities/ostream.cpp	Fri Feb 25 11:42:03 2011 -0800
   131.2 +++ b/src/share/vm/utilities/ostream.cpp	Fri Feb 25 12:46:46 2011 -0800
   131.3 @@ -699,6 +699,17 @@
   131.4    defaultStream::instance->release(holder);
   131.5  }
   131.6  
   131.7 +bool ttyLocker::release_tty_if_locked() {
   131.8 +  intx thread_id = os::current_thread_id();
   131.9 +  if (defaultStream::instance->writer() == thread_id) {
  131.10 +    // release the lock and return true so callers know if was
  131.11 +    // previously held.
  131.12 +    release_tty(thread_id);
  131.13 +    return true;
  131.14 +  }
  131.15 +  return false;
  131.16 +}
  131.17 +
  131.18  void ttyLocker::break_tty_lock_for_safepoint(intx holder) {
  131.19    if (defaultStream::instance != NULL &&
  131.20        defaultStream::instance->writer() == holder) {
   132.1 --- a/src/share/vm/utilities/ostream.hpp	Fri Feb 25 11:42:03 2011 -0800
   132.2 +++ b/src/share/vm/utilities/ostream.hpp	Fri Feb 25 12:46:46 2011 -0800
   132.3 @@ -123,18 +123,36 @@
   132.4  
   132.5  // advisory locking for the shared tty stream:
   132.6  class ttyLocker: StackObj {
   132.7 +  friend class ttyUnlocker;
   132.8   private:
   132.9    intx _holder;
  132.10  
  132.11   public:
  132.12    static intx  hold_tty();                // returns a "holder" token
  132.13    static void  release_tty(intx holder);  // must witness same token
  132.14 +  static bool  release_tty_if_locked();   // returns true if lock was released
  132.15    static void  break_tty_lock_for_safepoint(intx holder);
  132.16  
  132.17    ttyLocker()  { _holder = hold_tty(); }
  132.18    ~ttyLocker() { release_tty(_holder); }
  132.19  };
  132.20  
  132.21 +// Release the tty lock if it's held and reacquire it if it was
  132.22 +// locked.  Used to avoid lock ordering problems.
  132.23 +class ttyUnlocker: StackObj {
  132.24 + private:
  132.25 +  bool _was_locked;
  132.26 + public:
  132.27 +  ttyUnlocker()  {
  132.28 +    _was_locked = ttyLocker::release_tty_if_locked();
  132.29 +  }
  132.30 +  ~ttyUnlocker() {
  132.31 +    if (_was_locked) {
  132.32 +      ttyLocker::hold_tty();
  132.33 +    }
  132.34 +  }
  132.35 +};
  132.36 +
  132.37  // for writing to strings; buffer will expand automatically
  132.38  class stringStream : public outputStream {
  132.39   protected:
   133.1 --- a/test/compiler/6987555/Test6987555.java	Fri Feb 25 11:42:03 2011 -0800
   133.2 +++ b/test/compiler/6987555/Test6987555.java	Fri Feb 25 12:46:46 2011 -0800
   133.3 @@ -1,5 +1,5 @@
   133.4  /*
   133.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
   133.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
   133.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   133.8   *
   133.9   * This code is free software; you can redistribute it and/or modify it
  133.10 @@ -54,8 +54,8 @@
  133.11          if (DEBUG)  System.out.println("boolean=" + x);
  133.12          MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(boolean.class, boolean.class));
  133.13          MethodHandle mh2 = mh1.asType(MethodType.methodType(boolean.class, Boolean.class));
  133.14 -        boolean a = mh1.<boolean>invokeExact(x);
  133.15 -        boolean b = mh2.<boolean>invokeExact(Boolean.valueOf(x));
  133.16 +        boolean a = (boolean) mh1.invokeExact(x);
  133.17 +        boolean b = (boolean) mh2.invokeExact(Boolean.valueOf(x));
  133.18          assert a == b : a + " != " + b;
  133.19      }
  133.20  
  133.21 @@ -80,8 +80,8 @@
  133.22          if (DEBUG)  System.out.println("byte=" + x);
  133.23          MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(byte.class, byte.class));
  133.24          MethodHandle mh2 = mh1.asType(MethodType.methodType(byte.class, Byte.class));
  133.25 -        byte a = mh1.<byte>invokeExact(x);
  133.26 -        byte b = mh2.<byte>invokeExact(Byte.valueOf(x));
  133.27 +        byte a = (byte) mh1.invokeExact(x);
  133.28 +        byte b = (byte) mh2.invokeExact(Byte.valueOf(x));
  133.29          assert a == b : a + " != " + b;
  133.30      }
  133.31  
  133.32 @@ -104,8 +104,8 @@
  133.33          if (DEBUG)  System.out.println("char=" + x);
  133.34          MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(char.class, char.class));
  133.35          MethodHandle mh2 = mh1.asType(MethodType.methodType(char.class, Character.class));
  133.36 -        char a = mh1.<char>invokeExact(x);
  133.37 -        char b = mh2.<char>invokeExact(Character.valueOf(x));
  133.38 +        char a = (char) mh1.invokeExact(x);
  133.39 +        char b = (char) mh2.invokeExact(Character.valueOf(x));
  133.40          assert a == b : a + " != " + b;
  133.41      }
  133.42  
  133.43 @@ -134,8 +134,8 @@
  133.44          if (DEBUG)  System.out.println("short=" + x);
  133.45          MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(short.class, short.class));
  133.46          MethodHandle mh2 = mh1.asType(MethodType.methodType(short.class, Short.class));
  133.47 -        short a = mh1.<short>invokeExact(x);
  133.48 -        short b = mh2.<short>invokeExact(Short.valueOf(x));
  133.49 +        short a = (short) mh1.invokeExact(x);
  133.50 +        short b = (short) mh2.invokeExact(Short.valueOf(x));
  133.51          assert a == b : a + " != " + b;
  133.52      }
  133.53  
  133.54 @@ -164,8 +164,8 @@
  133.55          if (DEBUG)  System.out.println("int=" + x);
  133.56          MethodHandle mh1 = MethodHandles.lookup().findStatic(CLASS, NAME, MethodType.methodType(int.class, int.class));
  133.57          MethodHandle mh2 = mh1.asType(MethodType.methodType(int.class, Integer.class));
  133.58 -        int a = mh1.<int>invokeExact(x);
  133.59 -        int b = mh2.<int>invokeExact(Integer.valueOf(x));
  133.60 +        int a = (int) mh1.invokeExact(x);
  133.61 +        int b = (int) mh2.invokeExact(Integer.valueOf(x));
  133.62          assert a == b : a + " != " + b;
  133.63      }
  133.64  
   134.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
   134.2 +++ b/test/compiler/7017746/Test.java	Fri Feb 25 12:46:46 2011 -0800
   134.3 @@ -0,0 +1,50 @@
   134.4 +/*
   134.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
   134.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   134.7 + *
   134.8 + * This code is free software; you can redistribute it and/or modify it
   134.9 + * under the terms of the GNU General Public License version 2 only, as
  134.10 + * published by the Free Software Foundation.
  134.11 + *
  134.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
  134.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  134.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  134.15 + * version 2 for more details (a copy is included in the LICENSE file that
  134.16 + * accompanied this code).
  134.17 + *
  134.18 + * You should have received a copy of the GNU General Public License version
  134.19 + * 2 along with this work; if not, write to the Free Software Foundation,
  134.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  134.21 + *
  134.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  134.23 + * or visit www.oracle.com if you need additional information or have any
  134.24 + * questions.
  134.25 + */
  134.26 +
  134.27 +/**
  134.28 + * @test
  134.29 + * @bug 7017746
  134.30 + * @summary Regression : C2 compiler crash due to SIGSEGV in PhaseCFG::schedule_early()
  134.31 + *
  134.32 + * @run main/othervm -Xbatch Test
  134.33 + */
  134.34 +
  134.35 +public class Test {
  134.36 +
  134.37 +  int i;
  134.38 +
  134.39 +  static int test(Test t, int a, int b) {
  134.40 +    int j = t.i;
  134.41 +    int x = a - b;
  134.42 +    if (a < b) x = x + j;
  134.43 +    return x - j;
  134.44 +  }
  134.45 +
  134.46 +  public static void main(String args[]) {
  134.47 +    Test t = new Test();
  134.48 +    for (int n = 0; n < 1000000; n++) {
  134.49 +      int i = test(t, 1, 2);
  134.50 +    }
  134.51 +  }
  134.52 +}
  134.53 +

mercurial