Merge

Thu, 06 Jun 2013 11:02:25 -0700

author
kvn
date
Thu, 06 Jun 2013 11:02:25 -0700
changeset 5232
ef1818846c22
parent 5219
f8c8cace25ad
parent 5231
609aad72004a
child 5233
3c78a14da19d

Merge

src/os/bsd/vm/os_bsd.cpp file | annotate | diff | comparison | revisions
     1.1 --- a/make/bsd/makefiles/adlc.make	Thu Jun 06 05:56:33 2013 -0700
     1.2 +++ b/make/bsd/makefiles/adlc.make	Thu Jun 06 11:02:25 2013 -0700
     1.3 @@ -69,7 +69,7 @@
     1.4  # CFLAGS_WARN holds compiler options to suppress/enable warnings.
     1.5  # Compiler warnings are treated as errors
     1.6  ifneq ($(COMPILER_WARNINGS_FATAL),false)
     1.7 -  CFLAGS_WARN = -Werror
     1.8 +  CFLAGS_WARN = $(WARNINGS_ARE_ERRORS)
     1.9  endif
    1.10  CFLAGS += $(CFLAGS_WARN)
    1.11  
     2.1 --- a/make/bsd/makefiles/gcc.make	Thu Jun 06 05:56:33 2013 -0700
     2.2 +++ b/make/bsd/makefiles/gcc.make	Thu Jun 06 11:02:25 2013 -0700
     2.3 @@ -71,6 +71,11 @@
     2.4        CC  = $(CC32)
     2.5      endif
     2.6  
     2.7 +    ifeq ($(USE_CLANG), true)
     2.8 +      CXX = clang++
     2.9 +      CC  = clang
    2.10 +    endif
    2.11 +
    2.12      HOSTCXX = $(CXX)
    2.13      HOSTCC  = $(CC)
    2.14    endif
    2.15 @@ -79,21 +84,79 @@
    2.16  endif
    2.17  
    2.18  
    2.19 -# -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
    2.20 -# prints the numbers (e.g. "2.95", "3.2.1")
    2.21 -CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
    2.22 -CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
    2.23 -
    2.24 -# check for precompiled headers support
    2.25 -ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
    2.26 -# Allow the user to turn off precompiled headers from the command line.
    2.27 -ifneq ($(USE_PRECOMPILED_HEADER),0)
    2.28 -PRECOMPILED_HEADER_DIR=.
    2.29 -PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
    2.30 -PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
    2.31 -endif
    2.32 +ifeq ($(USE_CLANG), true)
    2.33 +  CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1)
    2.34 +  CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2)
    2.35 +else
    2.36 +  # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
    2.37 +  # prints the numbers (e.g. "2.95", "3.2.1")
    2.38 +  CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
    2.39 +  CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
    2.40  endif
    2.41  
    2.42 +ifeq ($(USE_CLANG), true)
    2.43 +  # clang has precompiled headers support by default, but the user can switch
    2.44 +  # it off by using 'USE_PRECOMPILED_HEADER=0'.
    2.45 +  ifdef LP64
    2.46 +    ifeq ($(USE_PRECOMPILED_HEADER),)
    2.47 +      USE_PRECOMPILED_HEADER=1
    2.48 +    endif
    2.49 +  else
    2.50 +    # We don't support precompiled headers on 32-bit builds because there some files are
    2.51 +    # compiled with -fPIC while others are compiled without (see 'NONPIC_OBJ_FILES' rules.make)
    2.52 +    # Clang produces an error if the PCH file was compiled with other options than the actual compilation unit.
    2.53 +    USE_PRECOMPILED_HEADER=0
    2.54 +  endif
    2.55 +  
    2.56 +  ifeq ($(USE_PRECOMPILED_HEADER),1)
    2.57 +  
    2.58 +    ifndef LP64
    2.59 +      $(error " Precompiled Headers only supported on 64-bit platforms!")
    2.60 +    endif
    2.61 +  
    2.62 +    PRECOMPILED_HEADER_DIR=.
    2.63 +    PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
    2.64 +    PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.pch
    2.65 +  
    2.66 +    PCH_FLAG = -include precompiled.hpp
    2.67 +    PCH_FLAG/DEFAULT = $(PCH_FLAG)
    2.68 +    PCH_FLAG/NO_PCH = -DNO_PCH
    2.69 +    PCH_FLAG/BY_FILE = $(PCH_FLAG/$@)$(PCH_FLAG/DEFAULT$(PCH_FLAG/$@))
    2.70 +  
    2.71 +    VM_PCH_FLAG/LIBJVM = $(PCH_FLAG/BY_FILE)
    2.72 +    VM_PCH_FLAG/AOUT =
    2.73 +    VM_PCH_FLAG = $(VM_PCH_FLAG/$(LINK_INTO))
    2.74 +  
    2.75 +    # We only use precompiled headers for the JVM build
    2.76 +    CFLAGS += $(VM_PCH_FLAG)
    2.77 +  
    2.78 +    # There are some files which don't like precompiled headers
    2.79 +    # The following files are build with 'OPT_CFLAGS/NOOPT' (-O0) in the opt build.
    2.80 +    # But Clang doesn't support a precompiled header which was compiled with -O3
    2.81 +    # to be used in a compilation unit which uses '-O0'. We could also prepare an
    2.82 +    # extra '-O0' PCH file for the opt build and use it here, but it's probably
    2.83 +    # not worth the effort as long as only two files need this special handling.
    2.84 +    PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH)
    2.85 +    PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH)
    2.86 +    PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH)
    2.87 +  
    2.88 +  endif
    2.89 +else # ($(USE_CLANG), true)
    2.90 +  # check for precompiled headers support
    2.91 +  ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
    2.92 +    # Allow the user to turn off precompiled headers from the command line.
    2.93 +    ifneq ($(USE_PRECOMPILED_HEADER),0)
    2.94 +      PRECOMPILED_HEADER_DIR=.
    2.95 +      PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
    2.96 +      PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
    2.97 +    endif
    2.98 +  endif
    2.99 +endif
   2.100 +
   2.101 +# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
   2.102 +ifeq ($(USE_PRECOMPILED_HEADER),0)
   2.103 +  CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
   2.104 +endif
   2.105  
   2.106  #------------------------------------------------------------------------
   2.107  # Compiler flags
   2.108 @@ -115,17 +178,31 @@
   2.109  CFLAGS += $(VM_PICFLAG)
   2.110  CFLAGS += -fno-rtti
   2.111  CFLAGS += -fno-exceptions
   2.112 -CFLAGS += -pthread
   2.113 -CFLAGS += -fcheck-new
   2.114 -# version 4 and above support fvisibility=hidden (matches jni_x86.h file)
   2.115 -# except 4.1.2 gives pointless warnings that can't be disabled (afaik)
   2.116 -ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
   2.117 -CFLAGS += -fvisibility=hidden
   2.118 +ifeq ($(USE_CLANG),)
   2.119 +  CFLAGS += -pthread
   2.120 +  CFLAGS += -fcheck-new
   2.121 +  # version 4 and above support fvisibility=hidden (matches jni_x86.h file)
   2.122 +  # except 4.1.2 gives pointless warnings that can't be disabled (afaik)
   2.123 +  ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
   2.124 +    CFLAGS += -fvisibility=hidden
   2.125 +  endif
   2.126 +else
   2.127 +  CFLAGS += -fvisibility=hidden
   2.128 +endif
   2.129 +
   2.130 +ifeq ($(USE_CLANG), true)
   2.131 +  # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm'
   2.132 +  # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment')
   2.133 +  ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0"
   2.134 +    STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16
   2.135 +  else
   2.136 +    STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16
   2.137 +  endif
   2.138  endif
   2.139  
   2.140  ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
   2.141  ARCHFLAG/i486    = -m32 -march=i586
   2.142 -ARCHFLAG/amd64   = -m64
   2.143 +ARCHFLAG/amd64   = -m64 $(STACK_ALIGNMENT_OPT)
   2.144  ARCHFLAG/ia64    =
   2.145  ARCHFLAG/sparc   = -m32 -mcpu=v9
   2.146  ARCHFLAG/sparcv9 = -m64 -mcpu=v9
   2.147 @@ -163,14 +240,25 @@
   2.148    WARNINGS_ARE_ERRORS = -Werror
   2.149  endif
   2.150  
   2.151 -# Except for a few acceptable ones
   2.152 -# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
   2.153 -# conversions which might affect the values. To avoid that, we need to turn
   2.154 -# it off explicitly. 
   2.155 -ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
   2.156 +ifeq ($(USE_CLANG), true)
   2.157 +  # However we need to clean the code up before we can unrestrictedly enable this option with Clang
   2.158 +  WARNINGS_ARE_ERRORS += -Wno-unused-value -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses
   2.159 +  WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-compare
   2.160 +# Not yet supported by clang in Xcode 4.6.2
   2.161 +#  WARNINGS_ARE_ERRORS += -Wno-tautological-constant-out-of-range-compare
   2.162 +  WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess
   2.163 +  WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body
   2.164 +endif
   2.165 +
   2.166  WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef
   2.167 -else
   2.168 -WARNING_FLAGS = -Wpointer-arith -Wconversion -Wsign-compare -Wundef
   2.169 +
   2.170 +ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
   2.171 +  # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
   2.172 +  # conversions which might affect the values. Only enable it in earlier versions.
   2.173 +  WARNING_FLAGS = -Wunused-function
   2.174 +  ifeq ($(USE_CLANG),)
   2.175 +    WARNINGS_FLAGS += -Wconversion
   2.176 +  endif
   2.177  endif
   2.178  
   2.179  CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS)
   2.180 @@ -214,14 +302,24 @@
   2.181  
   2.182  OPT_CFLAGS/NOOPT=-O0
   2.183  
   2.184 -# 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. 
   2.185 -ifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0"
   2.186 -OPT_CFLAGS/mulnode.o += -O0
   2.187 +# Work around some compiler bugs.
   2.188 +ifeq ($(USE_CLANG), true)
   2.189 +  ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
   2.190 +    OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
   2.191 +  endif
   2.192 +else
   2.193 +  # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
   2.194 +  ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
   2.195 +    OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT)
   2.196 +  endif
   2.197  endif
   2.198  
   2.199  # Flags for generating make dependency flags.
   2.200 -ifneq ("${CC_VER_MAJOR}", "2")
   2.201 -DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
   2.202 +DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
   2.203 +ifeq ($(USE_CLANG),)
   2.204 +  ifneq ($(CC_VER_MAJOR), 2)
   2.205 +    DEPFLAGS += -fpch-deps
   2.206 +  endif
   2.207  endif
   2.208  
   2.209  # -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
   2.210 @@ -249,13 +347,15 @@
   2.211  # statically link libstdc++.so, work with gcc but ignored by g++
   2.212  STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
   2.213  
   2.214 -# statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
   2.215 -ifneq ("${CC_VER_MAJOR}", "2")
   2.216 -STATIC_LIBGCC += -static-libgcc
   2.217 -endif
   2.218 +ifeq ($(USE_CLANG),)
   2.219 +  # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
   2.220 +  ifneq ("${CC_VER_MAJOR}", "2")
   2.221 +    STATIC_LIBGCC += -static-libgcc
   2.222 +  endif
   2.223  
   2.224 -ifeq ($(BUILDARCH), ia64)
   2.225 -LFLAGS += -Wl,-relax
   2.226 +  ifeq ($(BUILDARCH), ia64)
   2.227 +    LFLAGS += -Wl,-relax
   2.228 +  endif
   2.229  endif
   2.230  
   2.231  # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
   2.232 @@ -296,25 +396,31 @@
   2.233  #------------------------------------------------------------------------
   2.234  # Debug flags
   2.235  
   2.236 -# Use the stabs format for debugging information (this is the default
   2.237 -# on gcc-2.91). It's good enough, has all the information about line
   2.238 -# numbers and local variables, and libjvm.so is only about 16M.
   2.239 -# Change this back to "-g" if you want the most expressive format.
   2.240 -# (warning: that could easily inflate libjvm.so to 150M!)
   2.241 -# Note: The Itanium gcc compiler crashes when using -gstabs.
   2.242 -DEBUG_CFLAGS/ia64  = -g
   2.243 -DEBUG_CFLAGS/amd64 = -g
   2.244 -DEBUG_CFLAGS/arm   = -g
   2.245 -DEBUG_CFLAGS/ppc   = -g
   2.246 -DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
   2.247 -ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
   2.248 -DEBUG_CFLAGS += -gstabs
   2.249 +ifeq ($(USE_CLANG), true)
   2.250 +  # Restrict the debug information created by Clang to avoid
   2.251 +  # too big object files and speed the build up a little bit
   2.252 +  # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
   2.253 +  CFLAGS += -flimit-debug-info
   2.254  endif
   2.255  
   2.256 -# DEBUG_BINARIES overrides everything, use full -g debug information
   2.257 +# DEBUG_BINARIES uses full -g debug information for all configs
   2.258  ifeq ($(DEBUG_BINARIES), true)
   2.259 -  DEBUG_CFLAGS = -g
   2.260 -  CFLAGS += $(DEBUG_CFLAGS)
   2.261 +  CFLAGS += -g
   2.262 +else
   2.263 +  # Use the stabs format for debugging information (this is the default
   2.264 +  # on gcc-2.91). It's good enough, has all the information about line
   2.265 +  # numbers and local variables, and libjvm.so is only about 16M.
   2.266 +  # Change this back to "-g" if you want the most expressive format.
   2.267 +  # (warning: that could easily inflate libjvm.so to 150M!)
   2.268 +  # Note: The Itanium gcc compiler crashes when using -gstabs.
   2.269 +  DEBUG_CFLAGS/ia64  = -g
   2.270 +  DEBUG_CFLAGS/amd64 = -g
   2.271 +  DEBUG_CFLAGS/arm   = -g
   2.272 +  DEBUG_CFLAGS/ppc   = -g
   2.273 +  DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
   2.274 +  ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
   2.275 +  DEBUG_CFLAGS += -gstabs
   2.276 +  endif
   2.277  endif
   2.278  
   2.279  # If we are building HEADLESS, pass on to VM
     3.1 --- a/make/bsd/makefiles/vm.make	Thu Jun 06 05:56:33 2013 -0700
     3.2 +++ b/make/bsd/makefiles/vm.make	Thu Jun 06 11:02:25 2013 -0700
     3.3 @@ -126,7 +126,11 @@
     3.4  LFLAGS += -Xlinker -z -Xlinker noexecstack
     3.5  endif
     3.6  
     3.7 -LIBS += -lm -pthread
     3.8 +LIBS += -lm
     3.9 +
    3.10 +ifeq ($(USE_CLANG),)
    3.11 +  LIBS += -pthread
    3.12 +endif
    3.13  
    3.14  # By default, link the *.o into the library, not the executable.
    3.15  LINK_INTO$(LINK_INTO) = LIBJVM
     4.1 --- a/make/linux/makefiles/adlc.make	Thu Jun 06 05:56:33 2013 -0700
     4.2 +++ b/make/linux/makefiles/adlc.make	Thu Jun 06 11:02:25 2013 -0700
     4.3 @@ -68,7 +68,7 @@
     4.4  
     4.5  # CFLAGS_WARN holds compiler options to suppress/enable warnings.
     4.6  # Compiler warnings are treated as errors
     4.7 -CFLAGS_WARN = -Werror
     4.8 +CFLAGS_WARN = $(WARNINGS_ARE_ERRORS)
     4.9  CFLAGS += $(CFLAGS_WARN)
    4.10  
    4.11  OBJECTNAMES = \
     5.1 --- a/make/linux/makefiles/gcc.make	Thu Jun 06 05:56:33 2013 -0700
     5.2 +++ b/make/linux/makefiles/gcc.make	Thu Jun 06 11:02:25 2013 -0700
     5.3 @@ -36,8 +36,14 @@
     5.4      HOSTCC  = gcc
     5.5      STRIP = $(ALT_COMPILER_PATH)/strip
     5.6    else
     5.7 -    CXX = g++
     5.8 -    CC  = gcc
     5.9 +    ifeq ($(USE_CLANG), true)
    5.10 +      CXX = clang++
    5.11 +      CC  = clang
    5.12 +    else
    5.13 +      CXX = g++
    5.14 +      CC  = gcc
    5.15 +    endif
    5.16 +
    5.17      HOSTCXX = $(CXX)
    5.18      HOSTCC  = $(CC)
    5.19      STRIP = strip
    5.20 @@ -46,19 +52,79 @@
    5.21  endif
    5.22  
    5.23  
    5.24 -# -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
    5.25 -# prints the numbers (e.g. "2.95", "3.2.1")
    5.26 -CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
    5.27 -CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
    5.28 +ifeq ($(USE_CLANG), true)
    5.29 +  CC_VER_MAJOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f1)
    5.30 +  CC_VER_MINOR := $(shell $(CC) -v 2>&1 | grep version | sed "s/.*version \([0-9]*\.[0-9]*\).*/\1/" | cut -d'.' -f2)
    5.31 +else
    5.32 +  # -dumpversion in gcc-2.91 shows "egcs-2.91.66". In later version, it only
    5.33 +  # prints the numbers (e.g. "2.95", "3.2.1")
    5.34 +  CC_VER_MAJOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f1)
    5.35 +  CC_VER_MINOR := $(shell $(CC) -dumpversion | sed 's/egcs-//' | cut -d'.' -f2)
    5.36 +endif
    5.37  
    5.38 -# check for precompiled headers support
    5.39 -ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
    5.40 -# Allow the user to turn off precompiled headers from the command line.
    5.41 -ifneq ($(USE_PRECOMPILED_HEADER),0)
    5.42 -PRECOMPILED_HEADER_DIR=.
    5.43 -PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
    5.44 -PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
    5.45 +
    5.46 +ifeq ($(USE_CLANG), true)
    5.47 +  # Clang has precompiled headers support by default, but the user can switch
    5.48 +  # it off by using 'USE_PRECOMPILED_HEADER=0'.
    5.49 +  ifdef LP64
    5.50 +    ifeq ($(USE_PRECOMPILED_HEADER),)
    5.51 +      USE_PRECOMPILED_HEADER=1
    5.52 +    endif
    5.53 +  else
    5.54 +    # We don't support precompiled headers on 32-bit builds because there some files are
    5.55 +    # compiled with -fPIC while others are compiled without (see 'NONPIC_OBJ_FILES' rules.make)
    5.56 +    # Clang produces an error if the PCH file was compiled with other options than the actual compilation unit.
    5.57 +    USE_PRECOMPILED_HEADER=0
    5.58 +  endif
    5.59 +
    5.60 +  ifeq ($(USE_PRECOMPILED_HEADER),1)
    5.61 +
    5.62 +    ifndef LP64
    5.63 +      $(error " Precompiled Headers only supported on 64-bit platforms!")
    5.64 +    endif
    5.65 +
    5.66 +    PRECOMPILED_HEADER_DIR=.
    5.67 +    PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
    5.68 +    PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.pch
    5.69 +
    5.70 +    PCH_FLAG = -include precompiled.hpp
    5.71 +    PCH_FLAG/DEFAULT = $(PCH_FLAG)
    5.72 +    PCH_FLAG/NO_PCH = -DNO_PCH
    5.73 +    PCH_FLAG/BY_FILE = $(PCH_FLAG/$@)$(PCH_FLAG/DEFAULT$(PCH_FLAG/$@))
    5.74 +
    5.75 +    VM_PCH_FLAG/LIBJVM = $(PCH_FLAG/BY_FILE)
    5.76 +    VM_PCH_FLAG/AOUT =
    5.77 +    VM_PCH_FLAG = $(VM_PCH_FLAG/$(LINK_INTO))
    5.78 +
    5.79 +    # We only use precompiled headers for the JVM build
    5.80 +    CFLAGS += $(VM_PCH_FLAG)
    5.81 +
    5.82 +    # There are some files which don't like precompiled headers
    5.83 +    # The following files are build with 'OPT_CFLAGS/NOOPT' (-O0) in the opt build.
    5.84 +    # But Clang doesn't support a precompiled header which was compiled with -O3
    5.85 +    # to be used in a compilation unit which uses '-O0'. We could also prepare an
    5.86 +    # extra '-O0' PCH file for the opt build and use it here, but it's probably
    5.87 +    # not worth the effoert as long as only two files need this special handling.
    5.88 +    PCH_FLAG/loopTransform.o = $(PCH_FLAG/NO_PCH)
    5.89 +    PCH_FLAG/sharedRuntimeTrig.o = $(PCH_FLAG/NO_PCH)
    5.90 +    PCH_FLAG/sharedRuntimeTrans.o = $(PCH_FLAG/NO_PCH)
    5.91 +
    5.92 +  endif
    5.93 +else # ($(USE_CLANG), true)
    5.94 +  # check for precompiled headers support
    5.95 +  ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 4 \) \))" "0"
    5.96 +    # Allow the user to turn off precompiled headers from the command line.
    5.97 +    ifneq ($(USE_PRECOMPILED_HEADER),0)
    5.98 +      PRECOMPILED_HEADER_DIR=.
    5.99 +      PRECOMPILED_HEADER_SRC=$(GAMMADIR)/src/share/vm/precompiled/precompiled.hpp
   5.100 +      PRECOMPILED_HEADER=$(PRECOMPILED_HEADER_DIR)/precompiled.hpp.gch
   5.101 +    endif
   5.102 +  endif
   5.103  endif
   5.104 +
   5.105 +# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
   5.106 +ifeq ($(USE_PRECOMPILED_HEADER),0)
   5.107 +  CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
   5.108  endif
   5.109  
   5.110  
   5.111 @@ -83,16 +149,30 @@
   5.112  CFLAGS += -fno-rtti
   5.113  CFLAGS += -fno-exceptions
   5.114  CFLAGS += -D_REENTRANT
   5.115 -CFLAGS += -fcheck-new
   5.116 -# version 4 and above support fvisibility=hidden (matches jni_x86.h file)
   5.117 -# except 4.1.2 gives pointless warnings that can't be disabled (afaik)
   5.118 -ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
   5.119 -CFLAGS += -fvisibility=hidden
   5.120 +ifeq ($(USE_CLANG),)
   5.121 +  CFLAGS += -fcheck-new
   5.122 +  # version 4 and above support fvisibility=hidden (matches jni_x86.h file)
   5.123 +  # except 4.1.2 gives pointless warnings that can't be disabled (afaik)
   5.124 +  ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
   5.125 +    CFLAGS += -fvisibility=hidden
   5.126 +  endif
   5.127 +else
   5.128 +  CFLAGS += -fvisibility=hidden
   5.129 +endif
   5.130 +
   5.131 +ifeq ($(USE_CLANG), true)
   5.132 +  # Before Clang 3.1, we had to pass the stack alignment specification directly to llvm with the help of '-mllvm'
   5.133 +  # Starting with version 3.1, Clang understands the '-mstack-alignment' (and rejects '-mllvm -stack-alignment')
   5.134 +  ifneq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) \| \( \( $(CC_VER_MAJOR) = 3 \) \& \( $(CC_VER_MINOR) \>= 1 \) \))" "0"
   5.135 +    STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mstack-alignment=16
   5.136 +  else
   5.137 +    STACK_ALIGNMENT_OPT = -mno-omit-leaf-frame-pointer -mllvm -stack-alignment=16
   5.138 +  endif
   5.139  endif
   5.140  
   5.141  ARCHFLAG = $(ARCHFLAG/$(BUILDARCH))
   5.142  ARCHFLAG/i486    = -m32 -march=i586
   5.143 -ARCHFLAG/amd64   = -m64
   5.144 +ARCHFLAG/amd64   = -m64 $(STACK_ALIGNMENT_OPT)
   5.145  ARCHFLAG/ia64    =
   5.146  ARCHFLAG/sparc   = -m32 -mcpu=v9
   5.147  ARCHFLAG/sparcv9 = -m64 -mcpu=v9
   5.148 @@ -126,12 +206,22 @@
   5.149  # Compiler warnings are treated as errors
   5.150  WARNINGS_ARE_ERRORS = -Werror
   5.151  
   5.152 +ifeq ($(USE_CLANG), true)
   5.153 +  # However we need to clean the code up before we can unrestrictedly enable this option with Clang
   5.154 +  WARNINGS_ARE_ERRORS += -Wno-unused-value -Wno-logical-op-parentheses -Wno-parentheses-equality -Wno-parentheses
   5.155 +  WARNINGS_ARE_ERRORS += -Wno-switch -Wno-tautological-constant-out-of-range-compare -Wno-tautological-compare
   5.156 +  WARNINGS_ARE_ERRORS += -Wno-delete-non-virtual-dtor -Wno-deprecated -Wno-format -Wno-dynamic-class-memaccess
   5.157 +  WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body
   5.158 +endif
   5.159 +
   5.160  WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function
   5.161  
   5.162 -# Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
   5.163 -# conversions which might affect the values. Only enable it in earlier versions.
   5.164 -ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
   5.165 -WARNING_FLAGS += -Wconversion
   5.166 +ifeq ($(USE_CLANG),)
   5.167 +  # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
   5.168 +  # conversions which might affect the values. Only enable it in earlier versions.
   5.169 +  ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 4 \) \| \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) \>= 3 \) \))" "0"
   5.170 +    WARNING_FLAGS += -Wconversion
   5.171 +  endif
   5.172  endif
   5.173  
   5.174  CFLAGS_WARN/DEFAULT = $(WARNINGS_ARE_ERRORS) $(WARNING_FLAGS)
   5.175 @@ -165,19 +255,24 @@
   5.176  
   5.177  OPT_CFLAGS/NOOPT=-O0
   5.178  
   5.179 -# 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation. 
   5.180 -ifneq "$(shell expr \( \( $(CC_VER_MAJOR) = 4 \) \& \( $(CC_VER_MINOR) = 3 \) \))" "0"
   5.181 -OPT_CFLAGS/mulnode.o += -O0
   5.182 +# Work around some compiler bugs.
   5.183 +ifeq ($(USE_CLANG), true)
   5.184 +  ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 2), 1)
   5.185 +    OPT_CFLAGS/loopTransform.o += $(OPT_CFLAGS/NOOPT)
   5.186 +  endif
   5.187 +else
   5.188 +  # 6835796. Problem in GCC 4.3.0 with mulnode.o optimized compilation.
   5.189 +  ifeq ($(shell expr $(CC_VER_MAJOR) = 4 \& $(CC_VER_MINOR) = 3), 1)
   5.190 +    OPT_CFLAGS/mulnode.o += $(OPT_CFLAGS/NOOPT)
   5.191 +  endif
   5.192  endif
   5.193  
   5.194  # Flags for generating make dependency flags.
   5.195 -ifneq ("${CC_VER_MAJOR}", "2")
   5.196 -DEPFLAGS = -fpch-deps -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
   5.197 -endif
   5.198 -
   5.199 -# -DDONT_USE_PRECOMPILED_HEADER will exclude all includes in precompiled.hpp.
   5.200 -ifeq ($(USE_PRECOMPILED_HEADER),0)
   5.201 -CFLAGS += -DDONT_USE_PRECOMPILED_HEADER
   5.202 +DEPFLAGS = -MMD -MP -MF $(DEP_DIR)/$(@:%=%.d)
   5.203 +ifeq ($(USE_CLANG),)
   5.204 +  ifneq ("${CC_VER_MAJOR}", "2")
   5.205 +    DEPFLAGS += -fpch-deps
   5.206 +  endif
   5.207  endif
   5.208  
   5.209  #------------------------------------------------------------------------
   5.210 @@ -186,24 +281,33 @@
   5.211  # statically link libstdc++.so, work with gcc but ignored by g++
   5.212  STATIC_STDCXX = -Wl,-Bstatic -lstdc++ -Wl,-Bdynamic
   5.213  
   5.214 -# statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
   5.215 -ifneq ("${CC_VER_MAJOR}", "2")
   5.216 -STATIC_LIBGCC += -static-libgcc
   5.217 -endif
   5.218 +ifeq ($(USE_CLANG),)
   5.219 +  # statically link libgcc and/or libgcc_s, libgcc does not exist before gcc-3.x.
   5.220 +  ifneq ("${CC_VER_MAJOR}", "2")
   5.221 +    STATIC_LIBGCC += -static-libgcc
   5.222 +  endif
   5.223  
   5.224 -ifeq ($(BUILDARCH), ia64)
   5.225 -LFLAGS += -Wl,-relax
   5.226 +  ifeq ($(BUILDARCH), ia64)
   5.227 +    LFLAGS += -Wl,-relax
   5.228 +  endif
   5.229  endif
   5.230  
   5.231  # Enable linker optimization
   5.232  LFLAGS += -Xlinker -O1
   5.233  
   5.234 -# If this is a --hash-style=gnu system, use --hash-style=both
   5.235 -#   The gnu .hash section won't work on some Linux systems like SuSE 10.
   5.236 -_HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu')
   5.237 -ifneq ($(_HAS_HASH_STYLE_GNU),)
   5.238 +ifeq ($(USE_CLANG),)
   5.239 +  # If this is a --hash-style=gnu system, use --hash-style=both
   5.240 +  #   The gnu .hash section won't work on some Linux systems like SuSE 10.
   5.241 +  _HAS_HASH_STYLE_GNU:=$(shell $(CC) -dumpspecs | grep -- '--hash-style=gnu')
   5.242 +  ifneq ($(_HAS_HASH_STYLE_GNU),)
   5.243 +    LDFLAGS_HASH_STYLE = -Wl,--hash-style=both
   5.244 +  endif
   5.245 +else
   5.246 +  # Don't know how to find out the 'hash style' of a system as '-dumpspecs'
   5.247 +  # doesn't work for Clang. So for now we'll alwys use --hash-style=both
   5.248    LDFLAGS_HASH_STYLE = -Wl,--hash-style=both
   5.249  endif
   5.250 +
   5.251  LFLAGS += $(LDFLAGS_HASH_STYLE)
   5.252  
   5.253  # Use $(MAPFLAG:FILENAME=real_file_name) to specify a map file.
   5.254 @@ -221,6 +325,13 @@
   5.255  #------------------------------------------------------------------------
   5.256  # Debug flags
   5.257  
   5.258 +ifeq ($(USE_CLANG), true)
   5.259 +  # Restrict the debug information created by Clang to avoid
   5.260 +  # too big object files and speed the build up a little bit
   5.261 +  # (see http://llvm.org/bugs/show_bug.cgi?id=7554)
   5.262 +  CFLAGS += -flimit-debug-info
   5.263 +endif
   5.264 +
   5.265  # DEBUG_BINARIES uses full -g debug information for all configs
   5.266  ifeq ($(DEBUG_BINARIES), true)
   5.267    CFLAGS += -g
   5.268 @@ -237,7 +348,12 @@
   5.269    DEBUG_CFLAGS/ppc   = -g
   5.270    DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
   5.271    ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
   5.272 -    DEBUG_CFLAGS += -gstabs
   5.273 +      ifeq ($(USE_CLANG), true)
   5.274 +        # Clang doesn't understand -gstabs
   5.275 +        OPT_CFLAGS += -g
   5.276 +      else
   5.277 +        OPT_CFLAGS += -gstabs
   5.278 +      endif
   5.279    endif
   5.280    
   5.281    ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   5.282 @@ -247,7 +363,12 @@
   5.283      FASTDEBUG_CFLAGS/ppc   = -g
   5.284      FASTDEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
   5.285      ifeq ($(FASTDEBUG_CFLAGS/$(BUILDARCH)),)
   5.286 -      FASTDEBUG_CFLAGS += -gstabs
   5.287 +      ifeq ($(USE_CLANG), true)
   5.288 +        # Clang doesn't understand -gstabs
   5.289 +        OPT_CFLAGS += -g
   5.290 +      else
   5.291 +        OPT_CFLAGS += -gstabs
   5.292 +      endif
   5.293      endif
   5.294    
   5.295      OPT_CFLAGS/ia64  = -g
   5.296 @@ -256,7 +377,12 @@
   5.297      OPT_CFLAGS/ppc   = -g
   5.298      OPT_CFLAGS += $(OPT_CFLAGS/$(BUILDARCH))
   5.299      ifeq ($(OPT_CFLAGS/$(BUILDARCH)),)
   5.300 -      OPT_CFLAGS += -gstabs
   5.301 +      ifeq ($(USE_CLANG), true)
   5.302 +        # Clang doesn't understand -gstabs
   5.303 +        OPT_CFLAGS += -g
   5.304 +      else
   5.305 +        OPT_CFLAGS += -gstabs
   5.306 +      endif
   5.307      endif
   5.308    endif
   5.309  endif
     6.1 --- a/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Thu Jun 06 05:56:33 2013 -0700
     6.2 +++ b/src/cpu/sparc/vm/cppInterpreter_sparc.cpp	Thu Jun 06 11:02:25 2013 -0700
     6.3 @@ -1065,7 +1065,7 @@
     6.4    const int slop_factor = 2*wordSize;
     6.5  
     6.6    const int fixed_size = ((sizeof(BytecodeInterpreter) + slop_factor) >> LogBytesPerWord) + // what is the slop factor?
     6.7 -                         //6815692//Method::extra_stack_words() +  // extra push slots for MH adapters
     6.8 +                         Method::extra_stack_entries() + // extra stack for jsr 292
     6.9                           frame::memory_parameter_word_sp_offset +  // register save area + param window
    6.10                           (native ?  frame::interpreter_frame_extra_outgoing_argument_words : 0); // JNI, class
    6.11  
    6.12 @@ -1221,9 +1221,7 @@
    6.13    // Full size expression stack
    6.14    __ ld_ptr(constMethod, O3);
    6.15    __ lduh(O3, in_bytes(ConstMethod::max_stack_offset()), O3);
    6.16 -  guarantee(!EnableInvokeDynamic, "no support yet for java.lang.invoke.MethodHandle"); //6815692
    6.17 -  //6815692//if (EnableInvokeDynamic)
    6.18 -  //6815692//  __ inc(O3, Method::extra_stack_entries());
    6.19 +  __ inc(O3, Method::extra_stack_entries());
    6.20    __ sll(O3, LogBytesPerWord, O3);
    6.21    __ sub(O2, O3, O3);
    6.22  //  __ sub(O3, wordSize, O3);                    // so prepush doesn't look out of bounds
    6.23 @@ -2084,9 +2082,7 @@
    6.24  
    6.25    const int fixed_size = sizeof(BytecodeInterpreter)/wordSize +           // interpreter state object
    6.26                           frame::memory_parameter_word_sp_offset;   // register save area + param window
    6.27 -  const int extra_stack = 0; //6815692//Method::extra_stack_entries();
    6.28    return (round_to(max_stack +
    6.29 -                   extra_stack +
    6.30                     slop_factor +
    6.31                     fixed_size +
    6.32                     monitor_size +
    6.33 @@ -2173,8 +2169,7 @@
    6.34    // Need +1 here because stack_base points to the word just above the first expr stack entry
    6.35    // and stack_limit is supposed to point to the word just below the last expr stack entry.
    6.36    // See generate_compute_interpreter_state.
    6.37 -  int extra_stack = 0; //6815692//Method::extra_stack_entries();
    6.38 -  to_fill->_stack_limit = stack_base - (method->max_stack() + 1 + extra_stack);
    6.39 +  to_fill->_stack_limit = stack_base - (method->max_stack() + 1);
    6.40    to_fill->_monitor_base = (BasicObjectLock*) monitor_base;
    6.41  
    6.42    // sparc specific
     7.1 --- a/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu Jun 06 05:56:33 2013 -0700
     7.2 +++ b/src/cpu/sparc/vm/interp_masm_sparc.cpp	Thu Jun 06 11:02:25 2013 -0700
     7.3 @@ -521,7 +521,7 @@
     7.4    // Compute max expression stack+register save area
     7.5    ld_ptr(Lmethod, in_bytes(Method::const_offset()), Gframe_size);
     7.6    lduh(Gframe_size, in_bytes(ConstMethod::max_stack_offset()), Gframe_size);  // Load max stack.
     7.7 -  add( Gframe_size, frame::memory_parameter_word_sp_offset, Gframe_size );
     7.8 +  add(Gframe_size, frame::memory_parameter_word_sp_offset+Method::extra_stack_entries(), Gframe_size );
     7.9  
    7.10    //
    7.11    // now set up a stack frame with the size computed above
     8.1 --- a/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Thu Jun 06 05:56:33 2013 -0700
     8.2 +++ b/src/cpu/sparc/vm/templateInterpreter_sparc.cpp	Thu Jun 06 11:02:25 2013 -0700
     8.3 @@ -507,7 +507,7 @@
     8.4  
     8.5    const int extra_space =
     8.6      rounded_vm_local_words +                   // frame local scratch space
     8.7 -    //6815692//Method::extra_stack_words() +       // extra push slots for MH adapters
     8.8 +    Method::extra_stack_entries() +            // extra stack for jsr 292
     8.9      frame::memory_parameter_word_sp_offset +   // register save area
    8.10      (native_call ? frame::interpreter_frame_extra_outgoing_argument_words : 0);
    8.11  
    8.12 @@ -1558,7 +1558,6 @@
    8.13         round_to(callee_extra_locals * Interpreter::stackElementWords, WordsPerLong);
    8.14    const int max_stack_words = max_stack * Interpreter::stackElementWords;
    8.15    return (round_to((max_stack_words
    8.16 -                   //6815692//+ Method::extra_stack_words()
    8.17                     + rounded_vm_local_words
    8.18                     + frame::memory_parameter_word_sp_offset), WordsPerLong)
    8.19                     // already rounded
     9.1 --- a/src/cpu/x86/vm/cppInterpreter_x86.cpp	Thu Jun 06 05:56:33 2013 -0700
     9.2 +++ b/src/cpu/x86/vm/cppInterpreter_x86.cpp	Thu Jun 06 11:02:25 2013 -0700
     9.3 @@ -539,12 +539,11 @@
     9.4  
     9.5      // compute full expression stack limit
     9.6  
     9.7 -    const int extra_stack = 0; //6815692//Method::extra_stack_words();
     9.8      __ movptr(rdx, Address(rbx, Method::const_offset()));
     9.9      __ load_unsigned_short(rdx, Address(rdx, ConstMethod::max_stack_offset())); // get size of expression stack in words
    9.10      __ negptr(rdx);                                                       // so we can subtract in next step
    9.11      // Allocate expression stack
    9.12 -    __ lea(rsp, Address(rsp, rdx, Address::times_ptr, -extra_stack));
    9.13 +    __ lea(rsp, Address(rsp, rdx, Address::times_ptr, -Method::extra_stack_words()));
    9.14      __ movptr(STATE(_stack_limit), rsp);
    9.15    }
    9.16  
    9.17 @@ -692,10 +691,9 @@
    9.18    // Always give one monitor to allow us to start interp if sync method.
    9.19    // Any additional monitors need a check when moving the expression stack
    9.20    const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize;
    9.21 -  const int extra_stack = 0; //6815692//Method::extra_stack_entries();
    9.22    __ movptr(rax, Address(rbx, Method::const_offset()));
    9.23    __ load_unsigned_short(rax, Address(rax, ConstMethod::max_stack_offset())); // get size of expression stack in words
    9.24 -  __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), extra_stack + one_monitor));
    9.25 +  __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), one_monitor+Method::extra_stack_words()));
    9.26    __ lea(rax, Address(rax, rdx, Interpreter::stackElementScale(), overhead_size));
    9.27  
    9.28  #ifdef ASSERT
    9.29 @@ -2265,8 +2263,7 @@
    9.30    const int overhead_size = sizeof(BytecodeInterpreter)/wordSize +
    9.31      ( frame::sender_sp_offset - frame::link_offset) + 2;
    9.32  
    9.33 -  const int extra_stack = 0; //6815692//Method::extra_stack_entries();
    9.34 -  const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) *
    9.35 +  const int method_stack = (method->max_locals() + method->max_stack()) *
    9.36                             Interpreter::stackElementWords;
    9.37    return overhead_size + method_stack + stub_code;
    9.38  }
    9.39 @@ -2331,8 +2328,7 @@
    9.40    // Need +1 here because stack_base points to the word just above the first expr stack entry
    9.41    // and stack_limit is supposed to point to the word just below the last expr stack entry.
    9.42    // See generate_compute_interpreter_state.
    9.43 -  int extra_stack = 0; //6815692//Method::extra_stack_entries();
    9.44 -  to_fill->_stack_limit = stack_base - (method->max_stack() + extra_stack + 1);
    9.45 +  to_fill->_stack_limit = stack_base - (method->max_stack() + 1);
    9.46    to_fill->_monitor_base = (BasicObjectLock*) monitor_base;
    9.47  
    9.48    to_fill->_self_link = to_fill;
    9.49 @@ -2380,8 +2376,7 @@
    9.50                                                  monitor_size);
    9.51  
    9.52    // Now with full size expression stack
    9.53 -  int extra_stack = 0; //6815692//Method::extra_stack_entries();
    9.54 -  int full_frame_size = short_frame_size + (method->max_stack() + extra_stack) * BytesPerWord;
    9.55 +  int full_frame_size = short_frame_size + method->max_stack() * BytesPerWord;
    9.56  
    9.57    // and now with only live portion of the expression stack
    9.58    short_frame_size = short_frame_size + tempcount * BytesPerWord;
    10.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Thu Jun 06 05:56:33 2013 -0700
    10.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_32.cpp	Thu Jun 06 11:02:25 2013 -0700
    10.3 @@ -1565,8 +1565,7 @@
    10.4    // be sure to change this if you add/subtract anything to/from the overhead area
    10.5    const int overhead_size = -frame::interpreter_frame_initial_sp_offset;
    10.6  
    10.7 -  const int extra_stack = Method::extra_stack_entries();
    10.8 -  const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) *
    10.9 +  const int method_stack = (method->max_locals() + method->max_stack()) *
   10.10                             Interpreter::stackElementWords;
   10.11    return overhead_size + method_stack + stub_code;
   10.12  }
    11.1 --- a/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Thu Jun 06 05:56:33 2013 -0700
    11.2 +++ b/src/cpu/x86/vm/templateInterpreter_x86_64.cpp	Thu Jun 06 11:02:25 2013 -0700
    11.3 @@ -1574,8 +1574,7 @@
    11.4      -(frame::interpreter_frame_initial_sp_offset) + entry_size;
    11.5  
    11.6    const int stub_code = frame::entry_frame_after_call_words;
    11.7 -  const int extra_stack = Method::extra_stack_entries();
    11.8 -  const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) *
    11.9 +  const int method_stack = (method->max_locals() + method->max_stack()) *
   11.10                             Interpreter::stackElementWords;
   11.11    return (overhead_size + method_stack + stub_code);
   11.12  }
    12.1 --- a/src/os/bsd/vm/os_bsd.cpp	Thu Jun 06 05:56:33 2013 -0700
    12.2 +++ b/src/os/bsd/vm/os_bsd.cpp	Thu Jun 06 11:02:25 2013 -0700
    12.3 @@ -626,8 +626,6 @@
    12.4  //////////////////////////////////////////////////////////////////////////////
    12.5  // create new thread
    12.6  
    12.7 -static address highest_vm_reserved_address();
    12.8 -
    12.9  // check if it's safe to start a new thread
   12.10  static bool _thread_safety_check(Thread* thread) {
   12.11    return true;
   12.12 @@ -2112,10 +2110,6 @@
   12.13    return anon_munmap(addr, size);
   12.14  }
   12.15  
   12.16 -static address highest_vm_reserved_address() {
   12.17 -  return _highest_vm_reserved_address;
   12.18 -}
   12.19 -
   12.20  static bool bsd_mprotect(char* addr, size_t size, int prot) {
   12.21    // Bsd wants the mprotect address argument to be page aligned.
   12.22    char* bottom = (char*)align_size_down((intptr_t)addr, os::Bsd::page_size());
   12.23 @@ -2159,43 +2153,6 @@
   12.24    return false;
   12.25  }
   12.26  
   12.27 -/*
   12.28 -* Set the coredump_filter bits to include largepages in core dump (bit 6)
   12.29 -*
   12.30 -* From the coredump_filter documentation:
   12.31 -*
   12.32 -* - (bit 0) anonymous private memory
   12.33 -* - (bit 1) anonymous shared memory
   12.34 -* - (bit 2) file-backed private memory
   12.35 -* - (bit 3) file-backed shared memory
   12.36 -* - (bit 4) ELF header pages in file-backed private memory areas (it is
   12.37 -*           effective only if the bit 2 is cleared)
   12.38 -* - (bit 5) hugetlb private memory
   12.39 -* - (bit 6) hugetlb shared memory
   12.40 -*/
   12.41 -static void set_coredump_filter(void) {
   12.42 -  FILE *f;
   12.43 -  long cdm;
   12.44 -
   12.45 -  if ((f = fopen("/proc/self/coredump_filter", "r+")) == NULL) {
   12.46 -    return;
   12.47 -  }
   12.48 -
   12.49 -  if (fscanf(f, "%lx", &cdm) != 1) {
   12.50 -    fclose(f);
   12.51 -    return;
   12.52 -  }
   12.53 -
   12.54 -  rewind(f);
   12.55 -
   12.56 -  if ((cdm & LARGEPAGES_BIT) == 0) {
   12.57 -    cdm |= LARGEPAGES_BIT;
   12.58 -    fprintf(f, "%#lx", cdm);
   12.59 -  }
   12.60 -
   12.61 -  fclose(f);
   12.62 -}
   12.63 -
   12.64  // Large page support
   12.65  
   12.66  static size_t _large_page_size = 0;
    13.1 --- a/src/os_cpu/linux_x86/vm/linux_x86_32.s	Thu Jun 06 05:56:33 2013 -0700
    13.2 +++ b/src/os_cpu/linux_x86/vm/linux_x86_32.s	Thu Jun 06 11:02:25 2013 -0700
    13.3 @@ -241,7 +241,7 @@
    13.4          jbe      2f                   # <= 32 dwords
    13.5          rep;     smovl
    13.6          jmp      4f
    13.7 -	.=.+8
    13.8 +	.space 8
    13.9  2:      subl     %esi,%edi
   13.10          .p2align 4,,15
   13.11  3:      movl     (%esi),%edx
   13.12 @@ -378,7 +378,7 @@
   13.13          rep;     smovl
   13.14          jmp      4f 
   13.15          # copy aligned dwords
   13.16 -        .=.+5
   13.17 +        .space 5
   13.18  2:      subl     %esi,%edi 
   13.19          .p2align 4,,15
   13.20  3:      movl     (%esi),%edx
   13.21 @@ -454,7 +454,7 @@
   13.22          popl     %edi
   13.23          popl     %esi
   13.24          ret
   13.25 -        .=.+10
   13.26 +        .space 10
   13.27  2:      subl     %esi,%edi
   13.28          jmp      4f
   13.29          .p2align 4,,15
    14.1 --- a/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Thu Jun 06 05:56:33 2013 -0700
    14.2 +++ b/src/os_cpu/linux_x86/vm/os_linux_x86.cpp	Thu Jun 06 11:02:25 2013 -0700
    14.3 @@ -93,6 +93,10 @@
    14.4    register void *esp;
    14.5    __asm__("mov %%"SPELL_REG_SP", %0":"=r"(esp));
    14.6    return (address) ((char*)esp + sizeof(long)*2);
    14.7 +#elif defined(__clang__)
    14.8 +  intptr_t* esp;
    14.9 +  __asm__ __volatile__ ("mov %%"SPELL_REG_SP", %0":"=r"(esp):);
   14.10 +  return (address) esp;
   14.11  #else
   14.12    register void *esp __asm__ (SPELL_REG_SP);
   14.13    return (address) esp;
   14.14 @@ -175,6 +179,9 @@
   14.15  #ifdef SPARC_WORKS
   14.16    register intptr_t **ebp;
   14.17    __asm__("mov %%"SPELL_REG_FP", %0":"=r"(ebp));
   14.18 +#elif defined(__clang__)
   14.19 +  intptr_t **ebp;
   14.20 +  __asm__ __volatile__ ("mov %%"SPELL_REG_FP", %0":"=r"(ebp):);
   14.21  #else
   14.22    register intptr_t **ebp __asm__ (SPELL_REG_FP);
   14.23  #endif
    15.1 --- a/src/share/vm/adlc/archDesc.cpp	Thu Jun 06 05:56:33 2013 -0700
    15.2 +++ b/src/share/vm/adlc/archDesc.cpp	Thu Jun 06 11:02:25 2013 -0700
    15.3 @@ -29,8 +29,8 @@
    15.4  static FILE *errfile = stderr;
    15.5  
    15.6  //--------------------------- utility functions -----------------------------
    15.7 -inline char  toUpper(char lower) {
    15.8 -  return (('a' <= lower && lower <= 'z') ? (lower + ('A'-'a')) : lower);
    15.9 +inline char toUpper(char lower) {
   15.10 +  return (('a' <= lower && lower <= 'z') ? ((char) (lower + ('A'-'a'))) : lower);
   15.11  }
   15.12  char *toUpper(const char *str) {
   15.13    char *upper  = new char[strlen(str)+1];
    16.1 --- a/src/share/vm/adlc/dict2.cpp	Thu Jun 06 05:56:33 2013 -0700
    16.2 +++ b/src/share/vm/adlc/dict2.cpp	Thu Jun 06 11:02:25 2013 -0700
    16.3 @@ -64,18 +64,18 @@
    16.4    int i;
    16.5  
    16.6    // Precompute table of null character hashes
    16.7 -  if( !initflag ) {             // Not initializated yet?
    16.8 -    xsum[0] = (1<<shft[0])+1;   // Initialize
    16.9 +  if (!initflag) {              // Not initializated yet?
   16.10 +    xsum[0] = (short) ((1 << shft[0]) + 1);  // Initialize
   16.11      for( i = 1; i < MAXID; i++) {
   16.12 -      xsum[i] = (1<<shft[i])+1+xsum[i-1];
   16.13 +      xsum[i] = (short) ((1 << shft[i]) + 1 + xsum[i-1]);
   16.14      }
   16.15      initflag = 1;               // Never again
   16.16    }
   16.17  
   16.18    _size = 16;                   // Size is a power of 2
   16.19    _cnt = 0;                     // Dictionary is empty
   16.20 -  _bin = (bucket*)_arena->Amalloc_4(sizeof(bucket)*_size);
   16.21 -  memset(_bin,0,sizeof(bucket)*_size);
   16.22 +  _bin = (bucket*)_arena->Amalloc_4(sizeof(bucket) * _size);
   16.23 +  memset(_bin, 0, sizeof(bucket) * _size);
   16.24  }
   16.25  
   16.26  //------------------------------~Dict------------------------------------------
   16.27 @@ -287,11 +287,11 @@
   16.28    register int sum = 0;
   16.29    register const char *s = (const char *)t;
   16.30  
   16.31 -  while( ((c = s[k]) != '\0') && (k < MAXID-1) ) { // Get characters till nul
   16.32 -    c = (c<<1)+1;               // Characters are always odd!
   16.33 -    sum += c + (c<<shft[k++]);  // Universal hash function
   16.34 +  while (((c = s[k]) != '\0') && (k < MAXID-1)) { // Get characters till nul
   16.35 +    c = (char) ((c << 1) + 1);    // Characters are always odd!
   16.36 +    sum += c + (c << shft[k++]);  // Universal hash function
   16.37    }
   16.38 -  assert( k < (MAXID), "Exceeded maximum name length");
   16.39 +  assert(k < (MAXID), "Exceeded maximum name length");
   16.40    return (int)((sum+xsum[k]) >> 1); // Hash key, un-modulo'd table size
   16.41  }
   16.42  
    17.1 --- a/src/share/vm/adlc/formssel.cpp	Thu Jun 06 05:56:33 2013 -0700
    17.2 +++ b/src/share/vm/adlc/formssel.cpp	Thu Jun 06 11:02:25 2013 -0700
    17.3 @@ -796,11 +796,11 @@
    17.4    return num_opnds;
    17.5  }
    17.6  
    17.7 -const char *InstructForm::opnd_ident(int idx) {
    17.8 +const char* InstructForm::opnd_ident(int idx) {
    17.9    return _components.at(idx)->_name;
   17.10  }
   17.11  
   17.12 -const char *InstructForm::unique_opnd_ident(int idx) {
   17.13 +const char* InstructForm::unique_opnd_ident(uint idx) {
   17.14    uint i;
   17.15    for (i = 1; i < num_opnds(); ++i) {
   17.16      if (unique_opnds_idx(i) == idx) {
   17.17 @@ -1315,36 +1315,36 @@
   17.18  // Seach through operands to determine parameters unique positions.
   17.19  void InstructForm::set_unique_opnds() {
   17.20    uint* uniq_idx = NULL;
   17.21 -  int  nopnds = num_opnds();
   17.22 +  uint  nopnds = num_opnds();
   17.23    uint  num_uniq = nopnds;
   17.24 -  int i;
   17.25 +  uint i;
   17.26    _uniq_idx_length = 0;
   17.27 -  if ( nopnds > 0 ) {
   17.28 +  if (nopnds > 0) {
   17.29      // Allocate index array.  Worst case we're mapping from each
   17.30      // component back to an index and any DEF always goes at 0 so the
   17.31      // length of the array has to be the number of components + 1.
   17.32      _uniq_idx_length = _components.count() + 1;
   17.33 -    uniq_idx = (uint*) malloc(sizeof(uint)*(_uniq_idx_length));
   17.34 -    for( i = 0; i < _uniq_idx_length; i++ ) {
   17.35 +    uniq_idx = (uint*) malloc(sizeof(uint) * _uniq_idx_length);
   17.36 +    for (i = 0; i < _uniq_idx_length; i++) {
   17.37        uniq_idx[i] = i;
   17.38      }
   17.39    }
   17.40    // Do it only if there is a match rule and no expand rule.  With an
   17.41    // expand rule it is done by creating new mach node in Expand()
   17.42    // method.
   17.43 -  if ( nopnds > 0 && _matrule != NULL && _exprule == NULL ) {
   17.44 +  if (nopnds > 0 && _matrule != NULL && _exprule == NULL) {
   17.45      const char *name;
   17.46      uint count;
   17.47      bool has_dupl_use = false;
   17.48  
   17.49      _parameters.reset();
   17.50 -    while( (name = _parameters.iter()) != NULL ) {
   17.51 +    while ((name = _parameters.iter()) != NULL) {
   17.52        count = 0;
   17.53 -      int position = 0;
   17.54 -      int uniq_position = 0;
   17.55 +      uint position = 0;
   17.56 +      uint uniq_position = 0;
   17.57        _components.reset();
   17.58        Component *comp = NULL;
   17.59 -      if( sets_result() ) {
   17.60 +      if (sets_result()) {
   17.61          comp = _components.iter();
   17.62          position++;
   17.63        }
   17.64 @@ -1352,11 +1352,11 @@
   17.65        for (; (comp = _components.iter()) != NULL; ++position) {
   17.66          // When the first component is not a DEF,
   17.67          // leave space for the result operand!
   17.68 -        if ( position==0 && (! comp->isa(Component::DEF)) ) {
   17.69 +        if (position==0 && (!comp->isa(Component::DEF))) {
   17.70            ++position;
   17.71          }
   17.72 -        if( strcmp(name, comp->_name)==0 ) {
   17.73 -          if( ++count > 1 ) {
   17.74 +        if (strcmp(name, comp->_name) == 0) {
   17.75 +          if (++count > 1) {
   17.76              assert(position < _uniq_idx_length, "out of bounds");
   17.77              uniq_idx[position] = uniq_position;
   17.78              has_dupl_use = true;
   17.79 @@ -1364,22 +1364,25 @@
   17.80              uniq_position = position;
   17.81            }
   17.82          }
   17.83 -        if( comp->isa(Component::DEF)
   17.84 -            && comp->isa(Component::USE) ) {
   17.85 +        if (comp->isa(Component::DEF) && comp->isa(Component::USE)) {
   17.86            ++position;
   17.87 -          if( position != 1 )
   17.88 +          if (position != 1)
   17.89              --position;   // only use two slots for the 1st USE_DEF
   17.90          }
   17.91        }
   17.92      }
   17.93 -    if( has_dupl_use ) {
   17.94 -      for( i = 1; i < nopnds; i++ )
   17.95 -        if( i != uniq_idx[i] )
   17.96 +    if (has_dupl_use) {
   17.97 +      for (i = 1; i < nopnds; i++) {
   17.98 +        if (i != uniq_idx[i]) {
   17.99            break;
  17.100 -      int  j = i;
  17.101 -      for( ; i < nopnds; i++ )
  17.102 -        if( i == uniq_idx[i] )
  17.103 +        }
  17.104 +      }
  17.105 +      uint j = i;
  17.106 +      for (; i < nopnds; i++) {
  17.107 +        if (i == uniq_idx[i]) {
  17.108            uniq_idx[i] = j++;
  17.109 +        }
  17.110 +      }
  17.111        num_uniq = j;
  17.112      }
  17.113    }
  17.114 @@ -2216,21 +2219,27 @@
  17.115  
  17.116  
  17.117  bool OperandForm::is_bound_register() const {
  17.118 -  RegClass *reg_class  = get_RegClass();
  17.119 -  if (reg_class == NULL) return false;
  17.120 -
  17.121 -  const char * name = ideal_type(globalAD->globalNames());
  17.122 -  if (name == NULL) return false;
  17.123 -
  17.124 -  int size = 0;
  17.125 -  if (strcmp(name,"RegFlags")==0) size =  1;
  17.126 -  if (strcmp(name,"RegI")==0) size =  1;
  17.127 -  if (strcmp(name,"RegF")==0) size =  1;
  17.128 -  if (strcmp(name,"RegD")==0) size =  2;
  17.129 -  if (strcmp(name,"RegL")==0) size =  2;
  17.130 -  if (strcmp(name,"RegN")==0) size =  1;
  17.131 -  if (strcmp(name,"RegP")==0) size =  globalAD->get_preproc_def("_LP64") ? 2 : 1;
  17.132 -  if (size == 0) return false;
  17.133 +  RegClass* reg_class = get_RegClass();
  17.134 +  if (reg_class == NULL) {
  17.135 +    return false;
  17.136 +  }
  17.137 +
  17.138 +  const char* name = ideal_type(globalAD->globalNames());
  17.139 +  if (name == NULL) {
  17.140 +    return false;
  17.141 +  }
  17.142 +
  17.143 +  uint size = 0;
  17.144 +  if (strcmp(name, "RegFlags") == 0) size = 1;
  17.145 +  if (strcmp(name, "RegI") == 0) size = 1;
  17.146 +  if (strcmp(name, "RegF") == 0) size = 1;
  17.147 +  if (strcmp(name, "RegD") == 0) size = 2;
  17.148 +  if (strcmp(name, "RegL") == 0) size = 2;
  17.149 +  if (strcmp(name, "RegN") == 0) size = 1;
  17.150 +  if (strcmp(name, "RegP") == 0) size = globalAD->get_preproc_def("_LP64") ? 2 : 1;
  17.151 +  if (size == 0) {
  17.152 +    return false;
  17.153 +  }
  17.154    return size == reg_class->size();
  17.155  }
  17.156  
    18.1 --- a/src/share/vm/adlc/formssel.hpp	Thu Jun 06 05:56:33 2013 -0700
    18.2 +++ b/src/share/vm/adlc/formssel.hpp	Thu Jun 06 11:02:25 2013 -0700
    18.3 @@ -106,7 +106,7 @@
    18.4    const char    *_ins_pipe;        // Instruction Scheduling description class
    18.5  
    18.6    uint          *_uniq_idx;        // Indexes of unique operands
    18.7 -  int            _uniq_idx_length; // Length of _uniq_idx array
    18.8 +  uint           _uniq_idx_length; // Length of _uniq_idx array
    18.9    uint           _num_uniq;        // Number  of unique operands
   18.10    ComponentList  _components;      // List of Components matches MachNode's
   18.11                                     // operand structure
   18.12 @@ -272,14 +272,14 @@
   18.13    void                set_unique_opnds();
   18.14    uint                num_unique_opnds() { return _num_uniq; }
   18.15    uint                unique_opnds_idx(int idx) {
   18.16 -                        if( _uniq_idx != NULL && idx > 0 ) {
   18.17 -                          assert(idx < _uniq_idx_length, "out of bounds");
   18.18 -                          return _uniq_idx[idx];
   18.19 -                        } else {
   18.20 -                          return idx;
   18.21 -                        }
   18.22 +    if (_uniq_idx != NULL && idx > 0) {
   18.23 +      assert((uint)idx < _uniq_idx_length, "out of bounds");
   18.24 +      return _uniq_idx[idx];
   18.25 +    } else {
   18.26 +      return idx;
   18.27 +    }
   18.28    }
   18.29 -  const char         *unique_opnd_ident(int idx);  // Name of operand at unique idx.
   18.30 +  const char         *unique_opnd_ident(uint idx);  // Name of operand at unique idx.
   18.31  
   18.32    // Operands which are only KILLs aren't part of the input array and
   18.33    // require special handling in some cases.  Their position in this
    19.1 --- a/src/share/vm/adlc/output_c.cpp	Thu Jun 06 05:56:33 2013 -0700
    19.2 +++ b/src/share/vm/adlc/output_c.cpp	Thu Jun 06 11:02:25 2013 -0700
    19.3 @@ -463,8 +463,9 @@
    19.4    uint resources_used_exclusively = 0;
    19.5  
    19.6    for (pipeclass->_resUsage.reset();
    19.7 -       (piperesource = (const PipeClassResourceForm *)pipeclass->_resUsage.iter()) != NULL; )
    19.8 +       (piperesource = (const PipeClassResourceForm*)pipeclass->_resUsage.iter()) != NULL; ) {
    19.9      element_count++;
   19.10 +  }
   19.11  
   19.12    // Pre-compute the string length
   19.13    int templen;
   19.14 @@ -482,8 +483,8 @@
   19.15    for (i = rescount; i > 0; i /= 10)
   19.16      maskdigit++;
   19.17  
   19.18 -  static const char * pipeline_use_cycle_mask = "Pipeline_Use_Cycle_Mask";
   19.19 -  static const char * pipeline_use_element    = "Pipeline_Use_Element";
   19.20 +  static const char* pipeline_use_cycle_mask = "Pipeline_Use_Cycle_Mask";
   19.21 +  static const char* pipeline_use_element    = "Pipeline_Use_Element";
   19.22  
   19.23    templen = 1 +
   19.24      (int)(strlen(pipeline_use_cycle_mask) + (int)strlen(pipeline_use_element) +
   19.25 @@ -496,11 +497,12 @@
   19.26    templen = 0;
   19.27  
   19.28    for (pipeclass->_resUsage.reset();
   19.29 -       (piperesource = (const PipeClassResourceForm *)pipeclass->_resUsage.iter()) != NULL; ) {
   19.30 +       (piperesource = (const PipeClassResourceForm*)pipeclass->_resUsage.iter()) != NULL; ) {
   19.31      int used_mask = pipeline->_resdict[piperesource->_resource]->is_resource()->mask();
   19.32  
   19.33 -    if (!used_mask)
   19.34 +    if (!used_mask) {
   19.35        fprintf(stderr, "*** used_mask is 0 ***\n");
   19.36 +    }
   19.37  
   19.38      resources_used |= used_mask;
   19.39  
   19.40 @@ -509,8 +511,9 @@
   19.41      for (lb =  0; (used_mask & (1 << lb)) == 0; lb++);
   19.42      for (ub = 31; (used_mask & (1 << ub)) == 0; ub--);
   19.43  
   19.44 -    if (lb == ub)
   19.45 +    if (lb == ub) {
   19.46        resources_used_exclusively |= used_mask;
   19.47 +    }
   19.48  
   19.49      int formatlen =
   19.50        sprintf(&resource_mask[templen], "  %s(0x%0*x, %*d, %*d, %s %s(",
   19.51 @@ -526,7 +529,7 @@
   19.52  
   19.53      int cycles = piperesource->_cycles;
   19.54      uint stage          = pipeline->_stages.index(piperesource->_stage);
   19.55 -    if (NameList::Not_in_list == stage) {
   19.56 +    if ((uint)NameList::Not_in_list == stage) {
   19.57        fprintf(stderr,
   19.58                "pipeline_res_mask_initializer: "
   19.59                "semantic error: "
   19.60 @@ -534,8 +537,8 @@
   19.61                piperesource->_stage);
   19.62        exit(1);
   19.63      }
   19.64 -    uint upper_limit    = stage+cycles-1;
   19.65 -    uint lower_limit    = stage-1;
   19.66 +    uint upper_limit    = stage + cycles - 1;
   19.67 +    uint lower_limit    = stage - 1;
   19.68      uint upper_idx      = upper_limit >> 5;
   19.69      uint lower_idx      = lower_limit >> 5;
   19.70      uint upper_position = upper_limit & 0x1f;
   19.71 @@ -543,7 +546,7 @@
   19.72  
   19.73      uint mask = (((uint)1) << upper_position) - 1;
   19.74  
   19.75 -    while ( upper_idx > lower_idx ) {
   19.76 +    while (upper_idx > lower_idx) {
   19.77        res_mask[upper_idx--] |= mask;
   19.78        mask = (uint)-1;
   19.79      }
   19.80 @@ -565,8 +568,9 @@
   19.81    }
   19.82  
   19.83    resource_mask[templen] = 0;
   19.84 -  if (last_comma)
   19.85 +  if (last_comma) {
   19.86      last_comma[0] = ' ';
   19.87 +  }
   19.88  
   19.89    // See if the same string is in the table
   19.90    int ndx = pipeline_res_mask.index(resource_mask);
   19.91 @@ -580,7 +584,7 @@
   19.92        fprintf(fp_cpp, "static const Pipeline_Use_Element pipeline_res_mask_%03d[%d] = {\n%s};\n\n",
   19.93          ndx+1, element_count, resource_mask);
   19.94  
   19.95 -    char * args = new char [9 + 2*masklen + maskdigit];
   19.96 +    char* args = new char [9 + 2*masklen + maskdigit];
   19.97  
   19.98      sprintf(args, "0x%0*x, 0x%0*x, %*d",
   19.99        masklen, resources_used,
  19.100 @@ -589,8 +593,9 @@
  19.101  
  19.102      pipeline_res_args.addName(args);
  19.103    }
  19.104 -  else
  19.105 +  else {
  19.106      delete [] resource_mask;
  19.107 +  }
  19.108  
  19.109    delete [] res_mask;
  19.110  //delete [] res_masks;
  19.111 @@ -1787,7 +1792,7 @@
  19.112        // Skip first unique operands.
  19.113        for( i = 1; i < cur_num_opnds; i++ ) {
  19.114          comp = node->_components.iter();
  19.115 -        if( (int)i != node->unique_opnds_idx(i) ) {
  19.116 +        if (i != node->unique_opnds_idx(i)) {
  19.117            break;
  19.118          }
  19.119          new_num_opnds++;
  19.120 @@ -1795,7 +1800,7 @@
  19.121        // Replace not unique operands with next unique operands.
  19.122        for( ; i < cur_num_opnds; i++ ) {
  19.123          comp = node->_components.iter();
  19.124 -        int j = node->unique_opnds_idx(i);
  19.125 +        uint j = node->unique_opnds_idx(i);
  19.126          // unique_opnds_idx(i) is unique if unique_opnds_idx(j) is not unique.
  19.127          if( j != node->unique_opnds_idx(j) ) {
  19.128            fprintf(fp,"  set_opnd_array(%d, opnd_array(%d)->clone(C)); // %s\n",
    20.1 --- a/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Jun 06 05:56:33 2013 -0700
    20.2 +++ b/src/share/vm/c1/c1_LIRGenerator.cpp	Thu Jun 06 11:02:25 2013 -0700
    20.3 @@ -2232,6 +2232,7 @@
    20.4        // We still need to continue with the checks.
    20.5        if (src.is_constant()) {
    20.6          ciObject* src_con = src.get_jobject_constant();
    20.7 +        guarantee(src_con != NULL, "no source constant");
    20.8  
    20.9          if (src_con->is_null_object()) {
   20.10            // The constant src object is null - We can skip
    21.1 --- a/src/share/vm/code/nmethod.cpp	Thu Jun 06 05:56:33 2013 -0700
    21.2 +++ b/src/share/vm/code/nmethod.cpp	Thu Jun 06 11:02:25 2013 -0700
    21.3 @@ -1976,11 +1976,10 @@
    21.4    if (!method()->is_native()) {
    21.5      SimpleScopeDesc ssd(this, fr.pc());
    21.6      Bytecode_invoke call(ssd.method(), ssd.bci());
    21.7 -    // compiled invokedynamic call sites have an implicit receiver at
    21.8 -    // resolution time, so make sure it gets GC'ed.
    21.9 -    bool has_receiver = !call.is_invokestatic();
   21.10 +    bool has_receiver = call.has_receiver();
   21.11 +    bool has_appendix = call.has_appendix();
   21.12      Symbol* signature = call.signature();
   21.13 -    fr.oops_compiled_arguments_do(signature, has_receiver, reg_map, f);
   21.14 +    fr.oops_compiled_arguments_do(signature, has_receiver, has_appendix, reg_map, f);
   21.15    }
   21.16  #endif // !SHARK
   21.17  }
    22.1 --- a/src/share/vm/compiler/compileBroker.cpp	Thu Jun 06 05:56:33 2013 -0700
    22.2 +++ b/src/share/vm/compiler/compileBroker.cpp	Thu Jun 06 11:02:25 2013 -0700
    22.3 @@ -1642,42 +1642,37 @@
    22.4  // Set up state required by +LogCompilation.
    22.5  void CompileBroker::init_compiler_thread_log() {
    22.6      CompilerThread* thread = CompilerThread::current();
    22.7 -    char  fileBuf[4*K];
    22.8 +    char  file_name[4*K];
    22.9      FILE* fp = NULL;
   22.10 -    char* file = NULL;
   22.11      intx thread_id = os::current_thread_id();
   22.12      for (int try_temp_dir = 1; try_temp_dir >= 0; try_temp_dir--) {
   22.13        const char* dir = (try_temp_dir ? os::get_temp_directory() : NULL);
   22.14        if (dir == NULL) {
   22.15 -        jio_snprintf(fileBuf, sizeof(fileBuf), "hs_c" UINTX_FORMAT "_pid%u.log",
   22.16 +        jio_snprintf(file_name, sizeof(file_name), "hs_c" UINTX_FORMAT "_pid%u.log",
   22.17                       thread_id, os::current_process_id());
   22.18        } else {
   22.19 -        jio_snprintf(fileBuf, sizeof(fileBuf),
   22.20 +        jio_snprintf(file_name, sizeof(file_name),
   22.21                       "%s%shs_c" UINTX_FORMAT "_pid%u.log", dir,
   22.22                       os::file_separator(), thread_id, os::current_process_id());
   22.23        }
   22.24 -      fp = fopen(fileBuf, "at");
   22.25 +
   22.26 +      fp = fopen(file_name, "at");
   22.27        if (fp != NULL) {
   22.28 -        file = NEW_C_HEAP_ARRAY(char, strlen(fileBuf)+1, mtCompiler);
   22.29 -        strcpy(file, fileBuf);
   22.30 -        break;
   22.31 +        if (LogCompilation && Verbose) {
   22.32 +          tty->print_cr("Opening compilation log %s", file_name);
   22.33 +        }
   22.34 +        CompileLog* log = new(ResourceObj::C_HEAP, mtCompiler) CompileLog(file_name, fp, thread_id);
   22.35 +        thread->init_log(log);
   22.36 +
   22.37 +        if (xtty != NULL) {
   22.38 +          ttyLocker ttyl;
   22.39 +          // Record any per thread log files
   22.40 +          xtty->elem("thread_logfile thread='%d' filename='%s'", thread_id, file_name);
   22.41 +        }
   22.42 +        return;
   22.43        }
   22.44      }
   22.45 -    if (fp == NULL) {
   22.46 -      warning("Cannot open log file: %s", fileBuf);
   22.47 -    } else {
   22.48 -      if (LogCompilation && Verbose)
   22.49 -        tty->print_cr("Opening compilation log %s", file);
   22.50 -      CompileLog* log = new(ResourceObj::C_HEAP, mtCompiler) CompileLog(file, fp, thread_id);
   22.51 -      thread->init_log(log);
   22.52 -
   22.53 -      if (xtty != NULL) {
   22.54 -        ttyLocker ttyl;
   22.55 -
   22.56 -        // Record any per thread log files
   22.57 -        xtty->elem("thread_logfile thread='%d' filename='%s'", thread_id, file);
   22.58 -      }
   22.59 -    }
   22.60 +    warning("Cannot open log file: %s", file_name);
   22.61  }
   22.62  
   22.63  // ------------------------------------------------------------------
    23.1 --- a/src/share/vm/compiler/compileLog.cpp	Thu Jun 06 05:56:33 2013 -0700
    23.2 +++ b/src/share/vm/compiler/compileLog.cpp	Thu Jun 06 11:02:25 2013 -0700
    23.3 @@ -34,17 +34,18 @@
    23.4  
    23.5  // ------------------------------------------------------------------
    23.6  // CompileLog::CompileLog
    23.7 -CompileLog::CompileLog(const char* file, FILE* fp, intx thread_id)
    23.8 +CompileLog::CompileLog(const char* file_name, FILE* fp, intx thread_id)
    23.9    : _context(_context_buffer, sizeof(_context_buffer))
   23.10  {
   23.11 -  initialize(new(ResourceObj::C_HEAP, mtCompiler) fileStream(fp));
   23.12 -  _file = file;
   23.13 +  initialize(new(ResourceObj::C_HEAP, mtCompiler) fileStream(fp, true));
   23.14    _file_end = 0;
   23.15    _thread_id = thread_id;
   23.16  
   23.17    _identities_limit = 0;
   23.18    _identities_capacity = 400;
   23.19    _identities = NEW_C_HEAP_ARRAY(char, _identities_capacity, mtCompiler);
   23.20 +  _file = NEW_C_HEAP_ARRAY(char, strlen(file_name)+1, mtCompiler);
   23.21 +   strcpy((char*)_file, file_name);
   23.22  
   23.23    // link into the global list
   23.24    { MutexLocker locker(CompileTaskAlloc_lock);
   23.25 @@ -57,6 +58,7 @@
   23.26    delete _out;
   23.27    _out = NULL;
   23.28    FREE_C_HEAP_ARRAY(char, _identities, mtCompiler);
   23.29 +  FREE_C_HEAP_ARRAY(char, _file, mtCompiler);
   23.30  }
   23.31  
   23.32  
   23.33 @@ -188,7 +190,8 @@
   23.34    if (called_exit)  return;
   23.35    called_exit = true;
   23.36  
   23.37 -  for (CompileLog* log = _first; log != NULL; log = log->_next) {
   23.38 +  CompileLog* log = _first;
   23.39 +  while (log != NULL) {
   23.40      log->flush();
   23.41      const char* partial_file = log->file();
   23.42      int partial_fd = open(partial_file, O_RDONLY);
   23.43 @@ -267,7 +270,11 @@
   23.44        close(partial_fd);
   23.45        unlink(partial_file);
   23.46      }
   23.47 +    CompileLog* next_log = log->_next;
   23.48 +    delete log;
   23.49 +    log = next_log;
   23.50    }
   23.51 +  _first = NULL;
   23.52  }
   23.53  
   23.54  // ------------------------------------------------------------------
    24.1 --- a/src/share/vm/compiler/compileLog.hpp	Thu Jun 06 05:56:33 2013 -0700
    24.2 +++ b/src/share/vm/compiler/compileLog.hpp	Thu Jun 06 11:02:25 2013 -0700
    24.3 @@ -57,7 +57,7 @@
    24.4    void va_tag(bool push, const char* format, va_list ap);
    24.5  
    24.6   public:
    24.7 -  CompileLog(const char* file, FILE* fp, intx thread_id);
    24.8 +  CompileLog(const char* file_name, FILE* fp, intx thread_id);
    24.9    ~CompileLog();
   24.10  
   24.11    intx          thread_id()                      { return _thread_id; }
    25.1 --- a/src/share/vm/interpreter/bytecodeInterpreter.cpp	Thu Jun 06 05:56:33 2013 -0700
    25.2 +++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp	Thu Jun 06 11:02:25 2013 -0700
    25.3 @@ -468,7 +468,25 @@
    25.4  
    25.5  #ifdef ASSERT
    25.6    if (istate->_msg != initialize) {
    25.7 -    assert(abs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit");
    25.8 +    // We have a problem here if we are running with a pre-hsx24 JDK (for example during bootstrap)
    25.9 +    // because in that case, EnableInvokeDynamic is true by default but will be later switched off
   25.10 +    // if java_lang_invoke_MethodHandle::compute_offsets() detects that the JDK only has the classes
   25.11 +    // for the old JSR292 implementation.
   25.12 +    // This leads to a situation where 'istate->_stack_limit' always accounts for
   25.13 +    // methodOopDesc::extra_stack_entries() because it is computed in
   25.14 +    // CppInterpreterGenerator::generate_compute_interpreter_state() which was generated while
   25.15 +    // EnableInvokeDynamic was still true. On the other hand, istate->_method->max_stack() doesn't
   25.16 +    // account for extra_stack_entries() anymore because at the time when it is called
   25.17 +    // EnableInvokeDynamic was already set to false.
   25.18 +    // So we have a second version of the assertion which handles the case where EnableInvokeDynamic was
   25.19 +    // switched off because of the wrong classes.
   25.20 +    if (EnableInvokeDynamic || FLAG_IS_CMDLINE(EnableInvokeDynamic)) {
   25.21 +      assert(abs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit");
   25.22 +    } else {
   25.23 +      const int extra_stack_entries = Method::extra_stack_entries_for_indy;
   25.24 +      assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + extra_stack_entries
   25.25 +                                                                                               + 1), "bad stack limit");
   25.26 +    }
   25.27  #ifndef SHARK
   25.28      IA32_ONLY(assert(istate->_stack_limit == istate->_thread->last_Java_sp() + 1, "wrong"));
   25.29  #endif // !SHARK
    26.1 --- a/src/share/vm/oops/method.hpp	Thu Jun 06 05:56:33 2013 -0700
    26.2 +++ b/src/share/vm/oops/method.hpp	Thu Jun 06 11:02:25 2013 -0700
    26.3 @@ -671,13 +671,15 @@
    26.4                                                     Symbol* signature, //anything at all
    26.5                                                     TRAPS);
    26.6    static Klass* check_non_bcp_klass(Klass* klass);
    26.7 -  // these operate only on invoke methods:
    26.8 +
    26.9 +  // How many extra stack entries for invokedynamic when it's enabled
   26.10 +  static const int extra_stack_entries_for_jsr292 = 1;
   26.11 +
   26.12 +  // this operates only on invoke methods:
   26.13    // presize interpreter frames for extra interpreter stack entries, if needed
   26.14 -  // method handles want to be able to push a few extra values (e.g., a bound receiver), and
   26.15 -  // invokedynamic sometimes needs to push a bootstrap method, call site, and arglist,
   26.16 -  // all without checking for a stack overflow
   26.17 -  static int extra_stack_entries() { return EnableInvokeDynamic ? 2 : 0; }
   26.18 -  static int extra_stack_words();  // = extra_stack_entries() * Interpreter::stackElementSize()
   26.19 +  // Account for the extra appendix argument for invokehandle/invokedynamic
   26.20 +  static int extra_stack_entries() { return EnableInvokeDynamic ? extra_stack_entries_for_jsr292 : 0; }
   26.21 +  static int extra_stack_words();  // = extra_stack_entries() * Interpreter::stackElementSize
   26.22  
   26.23    // RedefineClasses() support:
   26.24    bool is_old() const                               { return access_flags().is_old(); }
    27.1 --- a/src/share/vm/opto/escape.cpp	Thu Jun 06 05:56:33 2013 -0700
    27.2 +++ b/src/share/vm/opto/escape.cpp	Thu Jun 06 11:02:25 2013 -0700
    27.3 @@ -2202,7 +2202,7 @@
    27.4      int opcode = uncast_base->Opcode();
    27.5      assert(opcode == Op_ConP || opcode == Op_ThreadLocal ||
    27.6             opcode == Op_CastX2P || uncast_base->is_DecodeNarrowPtr() ||
    27.7 -           (uncast_base->is_Mem() && uncast_base->bottom_type() == TypeRawPtr::NOTNULL) ||
    27.8 +           (uncast_base->is_Mem() && (uncast_base->bottom_type()->isa_rawptr() != NULL)) ||
    27.9             (uncast_base->is_Proj() && uncast_base->in(0)->is_Allocate()), "sanity");
   27.10    }
   27.11    return base;
    28.1 --- a/src/share/vm/opto/matcher.cpp	Thu Jun 06 05:56:33 2013 -0700
    28.2 +++ b/src/share/vm/opto/matcher.cpp	Thu Jun 06 11:02:25 2013 -0700
    28.3 @@ -1282,16 +1282,6 @@
    28.4      mcall->_argsize = out_arg_limit_per_call - begin_out_arg_area;
    28.5    }
    28.6  
    28.7 -  if (is_method_handle_invoke) {
    28.8 -    // Kill some extra stack space in case method handles want to do
    28.9 -    // a little in-place argument insertion.
   28.10 -    // FIXME: Is this still necessary?
   28.11 -    int regs_per_word  = NOT_LP64(1) LP64_ONLY(2); // %%% make a global const!
   28.12 -    out_arg_limit_per_call += Method::extra_stack_entries() * regs_per_word;
   28.13 -    // Do not update mcall->_argsize because (a) the extra space is not
   28.14 -    // pushed as arguments and (b) _argsize is dead (not used anywhere).
   28.15 -  }
   28.16 -
   28.17    // Compute the max stack slot killed by any call.  These will not be
   28.18    // available for debug info, and will be used to adjust FIRST_STACK_mask
   28.19    // after all call sites have been visited.
    29.1 --- a/src/share/vm/opto/reg_split.cpp	Thu Jun 06 05:56:33 2013 -0700
    29.2 +++ b/src/share/vm/opto/reg_split.cpp	Thu Jun 06 11:02:25 2013 -0700
    29.3 @@ -51,6 +51,15 @@
    29.4  
    29.5  static const char out_of_nodes[] = "out of nodes during split";
    29.6  
    29.7 +static bool contains_no_live_range_input(const Node* def) {
    29.8 +  for (uint i = 1; i < def->req(); ++i) {
    29.9 +    if (def->in(i) != NULL && def->in_RegMask(i).is_NotEmpty()) {
   29.10 +      return false;
   29.11 +    }
   29.12 +  }
   29.13 +  return true;
   29.14 +}
   29.15 +
   29.16  //------------------------------get_spillcopy_wide-----------------------------
   29.17  // Get a SpillCopy node with wide-enough masks.  Use the 'wide-mask', the
   29.18  // wide ideal-register spill-mask if possible.  If the 'wide-mask' does
   29.19 @@ -1312,7 +1321,7 @@
   29.20        Node *def = Reaches[pidx][slidx];
   29.21        assert( def, "must have reaching def" );
   29.22        // If input up/down sense and reg-pressure DISagree
   29.23 -      if( def->rematerialize() ) {
   29.24 +      if (def->rematerialize() && contains_no_live_range_input(def)) {
   29.25          // Place the rematerialized node above any MSCs created during
   29.26          // phi node splitting.  end_idx points at the insertion point
   29.27          // so look at the node before it.
    30.1 --- a/src/share/vm/prims/unsafe.cpp	Thu Jun 06 05:56:33 2013 -0700
    30.2 +++ b/src/share/vm/prims/unsafe.cpp	Thu Jun 06 11:02:25 2013 -0700
    30.3 @@ -115,8 +115,6 @@
    30.4  
    30.5  inline void* index_oop_from_field_offset_long(oop p, jlong field_offset) {
    30.6    jlong byte_offset = field_offset_to_byte_offset(field_offset);
    30.7 -  // Don't allow unsafe to be used to read or write the header word of oops
    30.8 -  assert(p == NULL || field_offset >= oopDesc::header_size(), "offset must be outside of header");
    30.9  #ifdef ASSERT
   30.10    if (p != NULL) {
   30.11      assert(byte_offset >= 0 && byte_offset <= (jlong)MAX_OBJECT_SIZE, "sane offset");
    31.1 --- a/src/share/vm/runtime/arguments.cpp	Thu Jun 06 05:56:33 2013 -0700
    31.2 +++ b/src/share/vm/runtime/arguments.cpp	Thu Jun 06 11:02:25 2013 -0700
    31.3 @@ -2217,6 +2217,13 @@
    31.4      status = false;
    31.5    }
    31.6  
    31.7 +  if (ReservedCodeCacheSize < InitialCodeCacheSize) {
    31.8 +    jio_fprintf(defaultStream::error_stream(),
    31.9 +                "Invalid ReservedCodeCacheSize: %dK. Should be greater than InitialCodeCacheSize=%dK\n",
   31.10 +                ReservedCodeCacheSize/K, InitialCodeCacheSize/K);
   31.11 +    status = false;
   31.12 +  }
   31.13 +
   31.14    return status;
   31.15  }
   31.16  
   31.17 @@ -2619,13 +2626,10 @@
   31.18      } else if (match_option(option, "-Xmaxjitcodesize", &tail) ||
   31.19                 match_option(option, "-XX:ReservedCodeCacheSize=", &tail)) {
   31.20        julong long_ReservedCodeCacheSize = 0;
   31.21 -      ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize,
   31.22 -                                            (size_t)InitialCodeCacheSize);
   31.23 +      ArgsRange errcode = parse_memory_size(tail, &long_ReservedCodeCacheSize, 1);
   31.24        if (errcode != arg_in_range) {
   31.25          jio_fprintf(defaultStream::error_stream(),
   31.26 -                    "Invalid maximum code cache size: %s. Should be greater than InitialCodeCacheSize=%dK\n",
   31.27 -                    option->optionString, InitialCodeCacheSize/K);
   31.28 -        describe_range_error(errcode);
   31.29 +                    "Invalid maximum code cache size: %s.\n", option->optionString);
   31.30          return JNI_EINVAL;
   31.31        }
   31.32        FLAG_SET_CMDLINE(uintx, ReservedCodeCacheSize, (uintx)long_ReservedCodeCacheSize);
    32.1 --- a/src/share/vm/runtime/deoptimization.cpp	Thu Jun 06 05:56:33 2013 -0700
    32.2 +++ b/src/share/vm/runtime/deoptimization.cpp	Thu Jun 06 11:02:25 2013 -0700
    32.3 @@ -635,18 +635,22 @@
    32.4        // at an uncommon trap for an invoke (where the compiler
    32.5        // generates debug info before the invoke has executed)
    32.6        Bytecodes::Code cur_code = str.next();
    32.7 -      if (cur_code == Bytecodes::_invokevirtual ||
    32.8 -          cur_code == Bytecodes::_invokespecial ||
    32.9 -          cur_code == Bytecodes::_invokestatic  ||
   32.10 -          cur_code == Bytecodes::_invokeinterface) {
   32.11 +      if (cur_code == Bytecodes::_invokevirtual   ||
   32.12 +          cur_code == Bytecodes::_invokespecial   ||
   32.13 +          cur_code == Bytecodes::_invokestatic    ||
   32.14 +          cur_code == Bytecodes::_invokeinterface ||
   32.15 +          cur_code == Bytecodes::_invokedynamic) {
   32.16          Bytecode_invoke invoke(mh, iframe->interpreter_frame_bci());
   32.17          Symbol* signature = invoke.signature();
   32.18          ArgumentSizeComputer asc(signature);
   32.19          cur_invoke_parameter_size = asc.size();
   32.20 -        if (cur_code != Bytecodes::_invokestatic) {
   32.21 +        if (invoke.has_receiver()) {
   32.22            // Add in receiver
   32.23            ++cur_invoke_parameter_size;
   32.24          }
   32.25 +        if (i != 0 && !invoke.is_invokedynamic() && MethodHandles::has_member_arg(invoke.klass(), invoke.name())) {
   32.26 +          callee_size_of_parameters++;
   32.27 +        }
   32.28        }
   32.29        if (str.bci() < max_bci) {
   32.30          Bytecodes::Code bc = str.next();
   32.31 @@ -661,6 +665,7 @@
   32.32              case Bytecodes::_invokespecial:
   32.33              case Bytecodes::_invokestatic:
   32.34              case Bytecodes::_invokeinterface:
   32.35 +            case Bytecodes::_invokedynamic:
   32.36              case Bytecodes::_athrow:
   32.37                break;
   32.38              default: {
    33.1 --- a/src/share/vm/runtime/frame.cpp	Thu Jun 06 05:56:33 2013 -0700
    33.2 +++ b/src/share/vm/runtime/frame.cpp	Thu Jun 06 11:02:25 2013 -0700
    33.3 @@ -1008,6 +1008,7 @@
    33.4    OopClosure*     _f;
    33.5    int             _offset;        // the current offset, incremented with each argument
    33.6    bool            _has_receiver;  // true if the callee has a receiver
    33.7 +  bool            _has_appendix;  // true if the call has an appendix
    33.8    frame           _fr;
    33.9    RegisterMap*    _reg_map;
   33.10    int             _arg_size;
   33.11 @@ -1027,19 +1028,20 @@
   33.12    }
   33.13  
   33.14   public:
   33.15 -  CompiledArgumentOopFinder(Symbol* signature, bool has_receiver, OopClosure* f, frame fr,  const RegisterMap* reg_map)
   33.16 +  CompiledArgumentOopFinder(Symbol* signature, bool has_receiver, bool has_appendix, OopClosure* f, frame fr,  const RegisterMap* reg_map)
   33.17      : SignatureInfo(signature) {
   33.18  
   33.19      // initialize CompiledArgumentOopFinder
   33.20      _f         = f;
   33.21      _offset    = 0;
   33.22      _has_receiver = has_receiver;
   33.23 +    _has_appendix = has_appendix;
   33.24      _fr        = fr;
   33.25      _reg_map   = (RegisterMap*)reg_map;
   33.26 -    _arg_size  = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0);
   33.27 +    _arg_size  = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0) + (has_appendix ? 1 : 0);
   33.28  
   33.29      int arg_size;
   33.30 -    _regs = SharedRuntime::find_callee_arguments(signature, has_receiver, &arg_size);
   33.31 +    _regs = SharedRuntime::find_callee_arguments(signature, has_receiver, has_appendix, &arg_size);
   33.32      assert(arg_size == _arg_size, "wrong arg size");
   33.33    }
   33.34  
   33.35 @@ -1049,12 +1051,16 @@
   33.36        _offset++;
   33.37      }
   33.38      iterate_parameters();
   33.39 +    if (_has_appendix) {
   33.40 +      handle_oop_offset();
   33.41 +      _offset++;
   33.42 +    }
   33.43    }
   33.44  };
   33.45  
   33.46 -void frame::oops_compiled_arguments_do(Symbol* signature, bool has_receiver, const RegisterMap* reg_map, OopClosure* f) {
   33.47 +void frame::oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix, const RegisterMap* reg_map, OopClosure* f) {
   33.48    ResourceMark rm;
   33.49 -  CompiledArgumentOopFinder finder(signature, has_receiver, f, *this, reg_map);
   33.50 +  CompiledArgumentOopFinder finder(signature, has_receiver, has_appendix, f, *this, reg_map);
   33.51    finder.oops_do();
   33.52  }
   33.53  
    34.1 --- a/src/share/vm/runtime/frame.hpp	Thu Jun 06 05:56:33 2013 -0700
    34.2 +++ b/src/share/vm/runtime/frame.hpp	Thu Jun 06 11:02:25 2013 -0700
    34.3 @@ -411,7 +411,7 @@
    34.4    oop* oopmapreg_to_location(VMReg reg, const RegisterMap* regmap) const;
    34.5  
    34.6    // Oops-do's
    34.7 -  void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, const RegisterMap* reg_map, OopClosure* f);
    34.8 +  void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix, const RegisterMap* reg_map, OopClosure* f);
    34.9    void oops_interpreted_do(OopClosure* f, CLDToOopClosure* cld_f, const RegisterMap* map, bool query_oop_map_cache = true);
   34.10  
   34.11   private:
    35.1 --- a/src/share/vm/runtime/sharedRuntime.cpp	Thu Jun 06 05:56:33 2013 -0700
    35.2 +++ b/src/share/vm/runtime/sharedRuntime.cpp	Thu Jun 06 11:02:25 2013 -0700
    35.3 @@ -2726,7 +2726,7 @@
    35.4    return regs.first();
    35.5  }
    35.6  
    35.7 -VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver, int* arg_size) {
    35.8 +VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver, bool has_appendix, int* arg_size) {
    35.9    // This method is returning a data structure allocating as a
   35.10    // ResourceObject, so do not put any ResourceMarks in here.
   35.11    char *s = sig->as_C_string();
   35.12 @@ -2770,6 +2770,11 @@
   35.13      default : ShouldNotReachHere();
   35.14      }
   35.15    }
   35.16 +
   35.17 +  if (has_appendix) {
   35.18 +    sig_bt[cnt++] = T_OBJECT;
   35.19 +  }
   35.20 +
   35.21    assert( cnt < 256, "grow table size" );
   35.22  
   35.23    int comp_args_on_stack;
    36.1 --- a/src/share/vm/runtime/sharedRuntime.hpp	Thu Jun 06 05:56:33 2013 -0700
    36.2 +++ b/src/share/vm/runtime/sharedRuntime.hpp	Thu Jun 06 11:02:25 2013 -0700
    36.3 @@ -410,7 +410,7 @@
    36.4  
    36.5    // Convert a sig into a calling convention register layout
    36.6    // and find interesting things about it.
    36.7 -  static VMRegPair* find_callee_arguments(Symbol* sig, bool has_receiver, int *arg_size);
    36.8 +  static VMRegPair* find_callee_arguments(Symbol* sig, bool has_receiver, bool has_appendix, int *arg_size);
    36.9    static VMReg     name_for_receiver();
   36.10  
   36.11    // "Top of Stack" slots that may be unused by the calling convention but must
    37.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    37.2 +++ b/test/compiler/8011771/Test8011771.java	Thu Jun 06 11:02:25 2013 -0700
    37.3 @@ -0,0 +1,77 @@
    37.4 +/*
    37.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    37.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    37.7 + *
    37.8 + * This code is free software; you can redistribute it and/or modify it
    37.9 + * under the terms of the GNU General Public License version 2 only, as
   37.10 + * published by the Free Software Foundation.
   37.11 + *
   37.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   37.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   37.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   37.15 + * version 2 for more details (a copy is included in the LICENSE file that
   37.16 + * accompanied this code).
   37.17 + *
   37.18 + * You should have received a copy of the GNU General Public License version
   37.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   37.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   37.21 + *
   37.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   37.23 + * or visit www.oracle.com if you need additional information or have any
   37.24 + * questions.
   37.25 + */
   37.26 +
   37.27 +/*
   37.28 + * @test
   37.29 + * @bug 8011771
   37.30 + * @summary Array bound check elimination's in block motion doesn't always reset its data structures from one step to the other.
   37.31 + * @run main/othervm -XX:-BackgroundCompilation Test8011771
   37.32 + *
   37.33 + */
   37.34 +
   37.35 +public class Test8011771 {
   37.36 +
   37.37 +    static void m(int[] a, int[] b, int j) {
   37.38 +        // Array bound check elimination inserts a predicate before
   37.39 +        // the loop. We'll have the predicate fail, so the method is
   37.40 +        // recompiled without optimistic optimizations
   37.41 +        for (int i = 0; i < 10; i++) {
   37.42 +            a[i] = i;
   37.43 +        }
   37.44 +
   37.45 +        // The test itself
   37.46 +        a[j] = 0;
   37.47 +        a[j+5] = 0;
   37.48 +        b[j+4] = 0; // this range check shouldn't be eliminated
   37.49 +    }
   37.50 +
   37.51 +    static public void main(String[] args) {
   37.52 +        int[] arr1 = new int[10], arr2 = new int[10];
   37.53 +        // force compilation:
   37.54 +        for (int i = 0; i < 5000; i++) {
   37.55 +            m(arr1, arr2, 0);
   37.56 +        }
   37.57 +
   37.58 +        try {
   37.59 +            m(new int[1], null, 0); // force predicate failure
   37.60 +        } catch(ArrayIndexOutOfBoundsException e) {}
   37.61 +
   37.62 +        // force compilation again (no optimistic opts):
   37.63 +        for (int i = 0; i < 5000; i++) {
   37.64 +            m(arr1, arr2, 0);
   37.65 +        }
   37.66 +
   37.67 +        // Check that the range check  on the second array wasn't optimized out
   37.68 +        boolean success = false;
   37.69 +        try {
   37.70 +            m(arr1, new int[1], 0);
   37.71 +        } catch(ArrayIndexOutOfBoundsException e) {
   37.72 +            success = true;
   37.73 +        }
   37.74 +        if (success) {
   37.75 +            System.out.println("TEST PASSED");
   37.76 +        } else {
   37.77 +            throw new RuntimeException("TEST FAILED: erroneous bound check elimination");
   37.78 +        }
   37.79 +    }
   37.80 +}
    38.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    38.2 +++ b/test/compiler/8013496/Test8013496.sh	Thu Jun 06 11:02:25 2013 -0700
    38.3 @@ -0,0 +1,55 @@
    38.4 +#!/bin/sh
    38.5 +# 
    38.6 +# Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    38.7 +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    38.8 +# 
    38.9 +# This code is free software; you can redistribute it and/or modify it
   38.10 +# under the terms of the GNU General Public License version 2 only, as
   38.11 +# published by the Free Software Foundation.
   38.12 +# 
   38.13 +# This code is distributed in the hope that it will be useful, but WITHOUT
   38.14 +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   38.15 +# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   38.16 +# version 2 for more details (a copy is included in the LICENSE file that
   38.17 +# accompanied this code).
   38.18 +# 
   38.19 +# You should have received a copy of the GNU General Public License version
   38.20 +# 2 along with this work; if not, write to the Free Software Foundation,
   38.21 +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   38.22 +# 
   38.23 +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   38.24 +# or visit www.oracle.com if you need additional information or have any
   38.25 +# questions.
   38.26 +# 
   38.27 +#
   38.28 +# @test
   38.29 +# @bug 8013496
   38.30 +# @summary Test checks that the order in which ReversedCodeCacheSize and 
   38.31 +#          InitialCodeCacheSize are passed to the VM is irrelevant.  
   38.32 +# @run shell Test8013496.sh
   38.33 +#
   38.34 +#
   38.35 +## some tests require path to find test source dir
   38.36 +if [ "${TESTSRC}" = "" ]
   38.37 +then
   38.38 +  TESTSRC=${PWD}
   38.39 +  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
   38.40 +fi
   38.41 +echo "TESTSRC=${TESTSRC}"
   38.42 +## Adding common setup Variables for running shell tests.
   38.43 +. ${TESTSRC}/../../test_env.sh
   38.44 +set -x
   38.45 +
   38.46 +${TESTJAVA}/bin/java ${TESTVMOPTS} -XX:ReservedCodeCacheSize=2m -XX:InitialCodeCacheSize=500K -version > 1.out 2>&1
   38.47 +${TESTJAVA}/bin/java ${TESTVMOPTS} -XX:InitialCodeCacheSize=500K -XX:ReservedCodeCacheSize=2m -version > 2.out 2>&1
   38.48 +
   38.49 +diff 1.out 2.out
   38.50 +
   38.51 +result=$?
   38.52 +if [ $result -eq 0 ] ; then  
   38.53 +  echo "Test Passed"
   38.54 +  exit 0
   38.55 +else
   38.56 +  echo "Test Failed"
   38.57 +  exit 1
   38.58 +fi

mercurial