提交 f083e9fa 编写于 作者: L lana

Merge

...@@ -109,3 +109,5 @@ bdc069d3f9101f89ec3f81c2950ee2d68fa846d3 jdk7-b130 ...@@ -109,3 +109,5 @@ bdc069d3f9101f89ec3f81c2950ee2d68fa846d3 jdk7-b130
6bbc7a4734952ae7604578f270e1566639fa8752 jdk7-b132 6bbc7a4734952ae7604578f270e1566639fa8752 jdk7-b132
5e5f68a01d12a4432172f384d5201f3a05254493 jdk7-b133 5e5f68a01d12a4432172f384d5201f3a05254493 jdk7-b133
554adcfb615e63e62af530b1c10fcf7813a75b26 jdk7-b134 554adcfb615e63e62af530b1c10fcf7813a75b26 jdk7-b134
d8ced728159fbb2caa8b6adb477fd8efdbbdf179 jdk7-b135
aa13e7702cd9d8aca9aa38f1227f966990866944 jdk7-b136
...@@ -68,40 +68,10 @@ PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME) ...@@ -68,40 +68,10 @@ PLATFORM_INCLUDE = $(INCLUDEDIR)/$(PLATFORM_INCLUDE_NAME)
# The following DLL's are considered MS runtime libraries and should # The following DLL's are considered MS runtime libraries and should
# not to be REBASEd, see deploy/make/common/Release.gmk. # not to be REBASEd, see deploy/make/common/Release.gmk.
# msvcr*.dll: Microsoft runtimes # msvcr*.dll: Microsoft runtimes
ifeq ($(ARCH_DATA_MODEL), 32) ifeq ($(COMPILER_VERSION), VS2010)
ifeq ($(COMPILER_VERSION), VS2003) MSVCRNN_DLL = msvcr100.dll
MSVCRNN_DLL = msvcr71.dll MSVCPNN_DLL = msvcp100.dll
MSVCPNN_DLL = msvcp71.dll MS_RUNTIME_LIBRARIES = $(MSVCRNN_DLL)
MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
endif
ifeq ($(COMPILER_VERSION), VS2005)
MSVCRNN_DLL = msvcr80.dll
MSVCPNN_DLL = msvcp80.dll
MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
endif
ifeq ($(COMPILER_VERSION), VS2008)
MSVCRNN_DLL = msvcr90.dll
MSVCPNN_DLL = msvcp90.dll
MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
endif
ifeq ($(COMPILER_VERSION), VS2010)
MSVCRNN_DLL = msvcr100.dll
MSVCPNN_DLL = msvcp100.dll
MS_RUNTIME_LIBRARIES = $(MSVCRNN_DLL)
endif
endif
ifeq ($(ARCH_DATA_MODEL), 64)
ifeq ($(COMPILER_VERSION), VS2008)
MSVCRNN_DLL = msvcr90.dll
MSVCPNN_DLL = msvcp90.dll
MS_RUNTIME_LIBRARIES = msvcrt.dll $(MSVCRNN_DLL)
endif
ifeq ($(COMPILER_VERSION), VS2010)
MSVCRNN_DLL = msvcr100.dll
MSVCPNN_DLL = msvcp100.dll
MS_RUNTIME_LIBRARIES = $(MSVCRNN_DLL)
endif
endif endif
EXTRA_LFLAGS += /LIBPATH:$(DXSDK_LIB_PATH) EXTRA_LFLAGS += /LIBPATH:$(DXSDK_LIB_PATH)
...@@ -124,109 +94,31 @@ ifndef FASTDEBUG_OPTIMIZATION_LEVEL ...@@ -124,109 +94,31 @@ ifndef FASTDEBUG_OPTIMIZATION_LEVEL
endif endif
ifeq ($(CC_VERSION),msvc) ifeq ($(CC_VERSION),msvc)
# Visual Studio .NET 2003 or VS2003 compiler option definitions: # Visual Studio compiler option definitions:
# -O1 Favors reduced size over speed (-Og -Os -Oy -Ob2 -Gs -GF -Gy) # -O1 Favors reduced size over speed (-Og -Os -Oy -Ob2 -Gs -GF -Gy)
# -O2 Favors speed over reduced size (-Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy) # -O2 Favors speed over reduced size (-Og -Oi -Ot -Oy -Ob2 -Gs -GF -Gy)
# -Ox Full optimization (use -O2) (-Og -Oi -Ot -Oy -Ob2)
# (Removed in Visual Studio 2005 or VS2005)
# -Ob2 More aggressive inlining # -Ob2 More aggressive inlining
# -Og Global optimizations # -Og Global optimizations
# -Oi Replace some functions with intrinsic or special forms # -Oi Replace some functions with intrinsic or special forms
# -Op Improve floating point calculations (disables some optimizations) # -fp:precise (should be the default)
# (Replaced with -fp:precise in VS2005, /Op is default now) # Improve floating point calculations (disables some optimizations)
# -Os Favor small code # -Os Favor small code
# -Ot Favor faster code # -Ot Favor faster code
# -Oy Frame pointer omission # -Oy Frame pointer omission
# -GB Optimize for pentium (old VC6 option?) # -G6 Used to be -GB?
# -G6 VS2003 version of -GB?
# -GF Pool strings in read-only memory # -GF Pool strings in read-only memory
# -Gf Pool strings in read-write memory (the default) # -Gf Pool strings in read-write memory (the default)
# -Gs Controls stack probess # -Gs Controls stack probess
# -GS Adds buffer overflow checks on stacks # -GS Adds buffer overflow checks on stacks (the default)
# (Default in VS2005) # -EHsc Enables exception handling
# -GX Enables exception handling
# (Replaced with /EHsc in VS2005)
# -Gy Function level linking only # -Gy Function level linking only
# #
# NOTE: With VC6, -Ox included -Gs.
# NOTE: With VC6, -Ox, -O1, and -O2 used -Ob1, not -Ob2.
# NOTE: With VC6, -O1 and -O2 used -Gf, not -GF.
#
CC_OPT/NONE = -Od CC_OPT/NONE = -Od
CC_OPT/LOWER = -O2 CC_OPT/LOWER = -O2
CC_OPT/HIGHER = -O3 CC_OPT/HIGHER = -O3
CC_OPT/HIGHEST = -O3 CC_OPT/HIGHEST = -O3
ifeq ($(COMPILER_VERSION), VC6)
# VC6 (6.2) msvc compiler (the way Tiger and early Mustang were built)
# Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
AUTOMATIC_PCH_OPTION =
GX_OPTION = -GX
GZ_OPTION = -GZ
ifeq ($(ARCH_DATA_MODEL), 32)
CC_OPT/HIGHEST = -Ox -Gy -Os -GB
CC_OPT/HIGHER = -Ox -Gy -Os -GB
CC_OPT/LOWER = -Ox -Gy -Os -GB
else
CC_OPT/HIGHEST = -Ox -Gy -Op
CC_OPT/HIGHER = -Ox -Gy -Op
CC_OPT/LOWER = -Ox -Gy -Op
endif
endif
ifeq ($(COMPILER_VERSION), VS2003)
# Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
AUTOMATIC_PCH_OPTION = -YX
# Also known as VC7 compiler
GX_OPTION = -GX
GZ_OPTION = -GZ
ifeq ($(ARCH_DATA_MODEL), 32)
# Lowered opt level to try and reduce footprint, dll size especially.
# Was: CC_OPT/HIGHEST = -O2 -G6
# Was: CC_OPT/HIGHER = -O2
CC_OPT/HIGHEST = -O2
CC_OPT/HIGHER = -O1
CC_OPT/LOWER = -O1
else
CC_OPT/HIGHEST = -O2 -Op
CC_OPT/HIGHER = -O2 -Op
CC_OPT/LOWER = -O1 -Op
endif
endif
ifeq ($(COMPILER_VERSION), VS2005)
# Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
AUTOMATIC_PCH_OPTION =
# VS2005 compiler, only with Platform SDK right now?
GX_OPTION = -EHsc
GZ_OPTION = -RTC1
ifeq ($(ARCH_DATA_MODEL), 32)
CC_OPT/HIGHEST = -O2
CC_OPT/HIGHER = -O1
CC_OPT/LOWER = -O1
else
CC_OPT/HIGHEST = -O2
CC_OPT/HIGHER = -O1
CC_OPT/LOWER = -O1
endif
endif
ifeq ($(COMPILER_VERSION), VS2008)
# Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
AUTOMATIC_PCH_OPTION =
GX_OPTION = -EHsc
GZ_OPTION = -RTC1
ifeq ($(ARCH_DATA_MODEL), 32)
CC_OPT/HIGHEST = -O2
CC_OPT/HIGHER = -O1
CC_OPT/LOWER = -O1
else
CC_OPT/HIGHEST = -O2
CC_OPT/HIGHER = -O1
CC_OPT/LOWER = -O1
endif
endif
ifeq ($(COMPILER_VERSION), VS2010) ifeq ($(COMPILER_VERSION), VS2010)
# Automatic precompiled header option to use (if COMPILE_APPROACH=batch) # Automatic precompiled header option to use (if COMPILE_APPROACH=batch)
AUTOMATIC_PCH_OPTION = AUTOMATIC_PCH_OPTION =
...@@ -256,7 +148,7 @@ CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL)) ...@@ -256,7 +148,7 @@ CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL))
# Select the runtime support library carefully, need to be consistent # Select the runtime support library carefully, need to be consistent
# #
# VS2003 compiler option definitions: # Visual Studio Runtime compiler option definitions:
# -MD Use dynamic multi-threaded runtime library # -MD Use dynamic multi-threaded runtime library
# -MDd Use debug version (don't use, doesn't mix with -MD DLL's) # -MDd Use debug version (don't use, doesn't mix with -MD DLL's)
# -MT Use static multi-threaded runtime library (-ML is going away) # -MT Use static multi-threaded runtime library (-ML is going away)
...@@ -265,12 +157,9 @@ CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL)) ...@@ -265,12 +157,9 @@ CC_OPT = $(CC_OPT/$(OPTIMIZATION_LEVEL))
# #
# NOTE: We also will use /D _STATIC_CPPLIB so we don't need msvcpnn.dll # NOTE: We also will use /D _STATIC_CPPLIB so we don't need msvcpnn.dll
# #
# If MS_RUNTIME_STATIC is requested, use -MT only with VS2003. # If MS_RUNTIME_STATIC is requested we may have a problem, it is no longer
ifeq ($(MS_RUNTIME_STATIC),true) # supported by VS2010
ifeq ($(COMPILER_VERSION), VS2003) ifneq ($(MS_RUNTIME_STATIC),true)
MS_RUNTIME_OPTION=-MT
endif
else
MS_RUNTIME_OPTION=-MD MS_RUNTIME_OPTION=-MD
endif endif
# The _DEBUG macro option (changes things like malloc to use debug version) # The _DEBUG macro option (changes things like malloc to use debug version)
...@@ -302,7 +191,7 @@ endif ...@@ -302,7 +191,7 @@ endif
MS_RUNTIME_OPTION += $(STATIC_CPPLIB_OPTION) MS_RUNTIME_OPTION += $(STATIC_CPPLIB_OPTION)
ifeq ($(CC_VERSION),msvc) ifeq ($(CC_VERSION),msvc)
# VS2003 compiler option definitions: # Visual Studio compiler option definitions:
# -Zi Cause *.pdb file to be created, full debug information # -Zi Cause *.pdb file to be created, full debug information
# -Z7 Full debug inside the .obj, no .pdb # -Z7 Full debug inside the .obj, no .pdb
# -Zd Basic debug, no local variables? In the .obj # -Zd Basic debug, no local variables? In the .obj
...@@ -317,31 +206,10 @@ ifeq ($(CC_VERSION),msvc) ...@@ -317,31 +206,10 @@ ifeq ($(CC_VERSION),msvc)
CFLAGS_OPT = $(CC_OPT) CFLAGS_OPT = $(CC_OPT)
CFLAGS_DBG = -Od $(MS_RUNTIME_DEBUG_OPTION) CFLAGS_DBG = -Od $(MS_RUNTIME_DEBUG_OPTION)
# REMIND: I don't see where CFLAGS_VS2005 is used. I suspect its
# pulled in as a combined "CFLAGS_$(COMPILER_VERSION)" string
# but the lack of this isn't causing any apparent build problems
# with VS 2010 but it could be causing compiler warnings.
# For now, I will add it for all cases :
CFLAGS_VS2010 += -Zc:wchar_t- CFLAGS_VS2010 += -Zc:wchar_t-
#
# Starting from VS2005 the wchar_t is handled as a built-in C/C++ data type
# by default. However, we expect the wchar_t to be a typedef to the
# unsigned short data type. The -Zc:wchar_t- option restores the old
# behavior (as seen in VS2003) to avoid massive code modifications.
# When/if our code will be "C/C++ Standard"-compliant (at least in the area
# of handling the wchar_t type), the option won't be necessary.
ifeq ($(ARCH_DATA_MODEL), 32)
CFLAGS_VS2005 += -Zc:wchar_t-
else
# The 64bit Platform SDK we use (April 2005) doesn't like this option
ifneq ($(CC_VER), 14.00.40310.41)
CFLAGS_VS2005 += -Zc:wchar_t-
endif
endif
# All builds get the same runtime setting # All builds get the same runtime setting
CFLAGS_COMMON += $(MS_RUNTIME_OPTION) $(CFLAGS_$(COMPILER_VERSION)) CFLAGS_COMMON += $(MS_RUNTIME_OPTION) $(CFLAGS_$(COMPILER_VERSION))
LDEBUG = /debug LDEBUG = /debug
...@@ -350,21 +218,9 @@ ifeq ($(CC_VERSION),msvc) ...@@ -350,21 +218,9 @@ ifeq ($(CC_VERSION),msvc)
LDEBUG += /pdb:NONE LDEBUG += /pdb:NONE
endif endif
# The new Platform SDK and VS2005 has /GS as a default and requires
# bufferoverflowU.lib on the link command line, otherwise
# we get missing __security_check_cookie externals at link time.
BUFFEROVERFLOWLIB = bufferoverflowU.lib
# Always add bufferoverflowU.lib to VS2005 link commands (pack uses LDDFLAGS)
LFLAGS_VS2005 = $(BUFFEROVERFLOWLIB)
# VS2008 has bufferoverflow baked in:
LFLAGS_VS2008 =
# VS2010, always need safe exception handlers, not needed on 64bit # VS2010, always need safe exception handlers, not needed on 64bit
ifeq ($(ARCH_DATA_MODEL), 32) ifeq ($(ARCH_DATA_MODEL), 32)
LFLAGS_VS2010 = -SAFESEH LFLAGS_VS2010 += -SAFESEH
else
LFLAGS_VS2010 =
endif endif
# LFLAGS are the flags given to $(LINK) and used to build the actual DLL file # LFLAGS are the flags given to $(LINK) and used to build the actual DLL file
......
...@@ -524,6 +524,10 @@ else ...@@ -524,6 +524,10 @@ else
COPYRIGHT_YEAR := $(shell $(DATE) '+%Y') COPYRIGHT_YEAR := $(shell $(DATE) '+%Y')
endif endif
ifndef OPENJDK
include $(JDK_TOPDIR)/make/closed/common/Defs.gmk
endif
# Install of imported file (JDK_IMPORT_PATH, or some other external location) # Install of imported file (JDK_IMPORT_PATH, or some other external location)
define install-importonly-file define install-importonly-file
@$(ECHO) "ASSEMBLY_IMPORT: $@" @$(ECHO) "ASSEMBLY_IMPORT: $@"
......
...@@ -54,9 +54,6 @@ EXCLUDE_PROPWARN_PKGS = com.sun.java.swing.plaf.windows \ ...@@ -54,9 +54,6 @@ EXCLUDE_PROPWARN_PKGS = com.sun.java.swing.plaf.windows \
com.sun.java.swing.plaf.motif \ com.sun.java.swing.plaf.motif \
com.sun.java.swing.plaf.gtk com.sun.java.swing.plaf.gtk
# This is a stopgap until 6839872 is fixed.
EXCLUDE_PROPWARN_PKGS += sun.dyn
# #
# Include the exported private packages in ct.sym. # Include the exported private packages in ct.sym.
# This is an interim solution until the ct.sym is replaced # This is an interim solution until the ct.sym is replaced
...@@ -86,14 +83,7 @@ ifdef OPENJDK ...@@ -86,14 +83,7 @@ ifdef OPENJDK
IMAGE_DOCLIST_JDK = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README IMAGE_DOCLIST_JDK = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
IMAGE_DOCLIST_JRE = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README IMAGE_DOCLIST_JRE = LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
else else
# Where to find these files # make/closed/common/Defs.gmk for closed location of SHARE_JDK_DOC_SRC
ifeq ($(J4B), true)
SHARE_JDK_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jdkfb
SHARE_JRE_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jrefb
else
SHARE_JDK_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jdk
SHARE_JRE_DOC_SRC = $(CLOSED_SHARE_SRC)/doc/jre
endif
IMAGE_DOCLIST_JDK = COPYRIGHT README.html THIRDPARTYLICENSEREADME.txt IMAGE_DOCLIST_JDK = COPYRIGHT README.html THIRDPARTYLICENSEREADME.txt
IMAGE_DOCLIST_JRE = COPYRIGHT Welcome.html THIRDPARTYLICENSEREADME.txt IMAGE_DOCLIST_JRE = COPYRIGHT Welcome.html THIRDPARTYLICENSEREADME.txt
...@@ -932,11 +922,6 @@ initial-image-jdk:: initial-image-jdk-setup \ ...@@ -932,11 +922,6 @@ initial-image-jdk:: initial-image-jdk-setup \
ifeq ($(COMPILER_VERSION), VS2010) ifeq ($(COMPILER_VERSION), VS2010)
$(CP) $(BINDIR)/msvc*100.$(LIBRARY_SUFFIX) $(JDK_IMAGE_DIR)/bin $(CP) $(BINDIR)/msvc*100.$(LIBRARY_SUFFIX) $(JDK_IMAGE_DIR)/bin
endif endif
ifeq ($(ARCH_DATA_MODEL), 32)
ifeq ($(COMPILER_VERSION), VS2003)
$(CP) $(BINDIR)/msvc*71.$(LIBRARY_SUFFIX) $(JDK_IMAGE_DIR)/bin
endif
endif
else # PLATFORM else # PLATFORM
@# @#
@# bin/ @# bin/
......
...@@ -47,82 +47,8 @@ ifeq ($(PLATFORM), windows) ...@@ -47,82 +47,8 @@ ifeq ($(PLATFORM), windows)
# Compiler version and type (Always get word after "Version") # Compiler version and type (Always get word after "Version")
CC_VER := $(shell $(CC) 2>&1 | $(HEAD) -n 1 | $(SED) 's/.*\(Version.*\)/\1/' | $(NAWK) '{print $$2}') CC_VER := $(shell $(CC) 2>&1 | $(HEAD) -n 1 | $(SED) 's/.*\(Version.*\)/\1/' | $(NAWK) '{print $$2}')
# The MSDEVTOOLS_PATH is for older compilers, place for rc, mt, etc. LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}')
_OTHER_TOOLS_PATH = $(MSDEVTOOLS_PATH) CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
# SDK-64 and MSVC6 put REBASE.EXE in a different places - go figure...
ifeq ($(ARCH_DATA_MODEL), 32)
LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}')
CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
ifeq ($(CC_MAJORVER), 13)
# This should be: CC_VER=13.10.3077 LINK_VER=7.10.3077
COMPILER_NAME=Visual Studio .NET 2003 Professional C++
COMPILER_VERSION=VS2003
RC = $(_OTHER_TOOLS_PATH)rc
REBASE = $(COMPILER_PATH)../../Common7/Tools/Bin/rebase
MTL = $(COMPILER_PATH)../../Common7/Tools/Bin/midl
endif
ifeq ($(CC_MAJORVER), 14)
COMPILER_NAME=Visual Studio 8
COMPILER_VERSION=VS2005
RC = $(_OTHER_TOOLS_PATH)rc
REBASE = $(COMPILER_PATH)../../Common8/Tools/Bin/rebase
MTL = $(COMPILER_PATH)../../Common8/Tools/Bin/midl
MT = $(_OTHER_TOOLS_PATH)/mt
endif
ifeq ($(CC_MAJORVER), 15)
COMPILER_NAME=Visual Studio 9
COMPILER_VERSION=VS2008
RC = $(_OTHER_TOOLS_PATH)rc
#rebase and midl moved out of Visual Studio into the SDK:
REBASE = $(_OTHER_TOOLS_PATH)/rebase
MTL = $(_OTHER_TOOLS_PATH)/midl.exe
MT = $(_OTHER_TOOLS_PATH)mt
endif
else
# else ARCH_DATA_MODEL is 64
LINK_VER := $(shell $(LINK) | $(HEAD) -n 1 | $(NAWK) '{print $$6}')
CC_MAJORVER :=$(call MajorVersion,$(CC_VER))
CC_MINORVER :=$(call MinorVersion,$(CC_VER))
CC_MICROVER :=$(call MicroVersion,$(CC_VER))
ifeq ($(CC_MAJORVER), 13)
ifeq ($(ARCH), ia64)
# This should be: CC_VER=13.00.9337.7 LINK_VER=7.00.9337.7
COMPILER_NAME=Microsoft Platform SDK - November 2001 Edition
COMPILER_VERSION=VS2003
RC = $(_OTHER_TOOLS_PATH)rc
endif
endif
ifeq ($(CC_MAJORVER), 14)
ifeq ($(ARCH), amd64)
#rebase and midl moved out of Visual Studio into the SDK:
RC = $(_OTHER_TOOLS_PATH)/rc
REBASE = $(_OTHER_TOOLS_PATH)/rebase
MTL = $(_OTHER_TOOLS_PATH)/midl.exe
ifeq ($(CC_MICROVER), 30701)
# This should be: CC_VER=14.00.30701 LINK_VER=8.00.30701
# WARNING: it says 14, but it is such an early build it doesn't
# have all the VS2005 compiler option changes, so treat
# this like a VS2003 compiler.
COMPILER_NAME=Microsoft Platform SDK - February 2003 Edition
COMPILER_VERSION=VS2003
else
# This should be: CC_VER=14.00.40310.41 LINK_VER=8.00.40310.39
COMPILER_NAME=Microsoft Platform SDK - April 2005 Edition (3790.1830)
COMPILER_VERSION=VS2005
endif
else
REBASE = $(COMPILER_PATH)../rebase
endif
endif
ifeq ($(CC_MAJORVER), 15)
COMPILER_NAME=Microsoft Windows SDK with Visual Studio 9 (6001.18000.367)
COMPILER_VERSION=VS2008
RC = $(MSSDK61)/Bin/X64/rc.exe
MT = $(MSSDK61)/Bin/X64/mt.exe
MTL = $(MSSDK61)/Bin/X64/midl.exe
endif
endif
# The VS2010 compiler is the same one used on both 32bit and 64bit # The VS2010 compiler is the same one used on both 32bit and 64bit
ifeq ($(CC_MAJORVER), 16) ifeq ($(CC_MAJORVER), 16)
......
...@@ -190,25 +190,10 @@ ifeq ($(PLATFORM), windows) ...@@ -190,25 +190,10 @@ ifeq ($(PLATFORM), windows)
REQUIRED_FREE_SPACE = 500000 REQUIRED_FREE_SPACE = 500000
REQUIRED_DXSDK_VER = 0x0900 REQUIRED_DXSDK_VER = 0x0900
ifeq ($(CC_VERSION),msvc) ifeq ($(CC_VERSION),msvc)
ifeq ($(ARCH_DATA_MODEL), 32) REQUIRED_COMPILER_NAME = Visual Studio 10
REQUIRED_COMPILER_NAME = Visual Studio 10 REQUIRED_COMPILER_VERSION = VS2010
REQUIRED_COMPILER_VERSION = VS2010 REQUIRED_CC_VER = 16.00.30319.01
REQUIRED_CC_VER = 16.00.30319.01 REQUIRED_LINK_VER = 10.00.30319.01
REQUIRED_LINK_VER = 10.00.30319.01
else
ifeq ($(ARCH), ia64)
REQUIRED_COMPILER_NAME = Microsoft Platform SDK - November 2001 Edition
REQUIRED_COMPILER_VERSION = VS2003
REQUIRED_CC_VER = 13.00.9337.7
REQUIRED_LINK_VER = 7.00.9337.7
endif
ifeq ($(ARCH), amd64)
REQUIRED_COMPILER_NAME = Visual Studio 10
REQUIRED_COMPILER_VERSION = VS2010
REQUIRED_CC_VER = 16.00.30319.01
REQUIRED_LINK_VER = 10.00.30319.01
endif
endif
endif endif
ifeq ($(CC_VERSION),gcc) ifeq ($(CC_VERSION),gcc)
REQUIRED_CC_VER = 3.4.3 REQUIRED_CC_VER = 3.4.3
......
...@@ -333,136 +333,26 @@ ifndef VS2010_EXISTS ...@@ -333,136 +333,26 @@ ifndef VS2010_EXISTS
export WINDOWSSDKDIR export WINDOWSSDKDIR
endif endif
# Setup for VS2010 is simple, others logic is historic ifneq ($(VS2010_EXISTS),true)
ifeq ($(VS2010_EXISTS),true) x:=$(error ERROR: No VS2010 found on system.)
endif
# VS2010 Compiler root directory
_msvc_dir :=$(VS100COMNTOOLS)/../../Vc # VS2010 Compiler root directory
# SDK root directory _msvc_dir :=$(VS100COMNTOOLS)/../../Vc
_ms_sdk :=$(WINDOWSSDKDIR) # SDK root directory
# Compiler bin directory and redist directory _ms_sdk :=$(WINDOWSSDKDIR)
ifeq ($(ARCH_DATA_MODEL), 32) # Compiler bin directory and redist directory
_compiler_bin :=$(_msvc_dir)/Bin ifeq ($(ARCH_DATA_MODEL), 32)
_redist_sdk :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC100.CRT) _compiler_bin :=$(_msvc_dir)/Bin
endif _redist_sdk :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC100.CRT)
ifeq ($(ARCH_DATA_MODEL), 64) endif
_compiler_bin :=$(_msvc_dir)/bin/amd64 ifeq ($(ARCH_DATA_MODEL), 64)
_redist_sdk :=$(call FullPath,$(_msvc_dir)/redist/x64/Microsoft.VC100.CRT) _compiler_bin :=$(_msvc_dir)/bin/amd64
endif _redist_sdk :=$(call FullPath,$(_msvc_dir)/redist/x64/Microsoft.VC100.CRT)
ifeq ($(_redist_sdk),) endif
_redist_sdk :=$(_system_root)/system32 ifeq ($(_redist_sdk),)
endif _redist_sdk :=$(_system_root)/system32
endif
else # Not VS2010
# Compilers, SDK, and Visual Studio (MSDEV) [32bit is different from 64bit]
ifeq ($(ARCH_DATA_MODEL), 32)
# Try looking in MSVCDIR or MSVCDir area first
# (set by vcvars32.bat for VC .NET, not defined in the VC 2008/2010)
ifdef MSVCDIR
xMSVCDIR :="$(subst \,/,$(MSVCDIR))"
_msvc_dir :=$(call FullPath,$(xMSVCDIR))
else
ifdef MSVCDir
xMSVCDIR :="$(subst \,/,$(MSVCDir))"
_msvc_dir :=$(call FullPath,$(xMSVCDIR))
endif
endif
# If we still don't have it, look for VSnnCOMNTOOLS (newest first),
# set by installer?
ifeq ($(_msvc_dir),)
ifdef VS90COMNTOOLS # /Common/Tools directory, use ../../Vc
xVS90COMNTOOLS :="$(subst \,/,$(VS90COMNTOOLS))"
_vs90tools :=$(call FullPath,$(xVS90COMNTOOLS))
endif
ifneq ($(_vs90tools),)
_msvc_dir :=$(_vs90tools)/../../Vc
else
ifdef VS80COMNTOOLS # /Common/Tools directory, use ../../Vc
xVS80COMNTOOLS :="$(subst \,/,$(VS80COMNTOOLS))"
_vs80tools :=$(call FullPath,$(xVS80COMNTOOLS))
endif
ifneq ($(_vs80tools),)
_msvc_dir :=$(_vs80tools)/../../Vc
else
ifdef VS71COMNTOOLS # /Common/Tools directory, use ../../Vc7
xVS71COMNTOOLS :="$(subst \,/,$(VS71COMNTOOLS))"
_vs71tools :=$(call FullPath,$(xVS71COMNTOOLS))
endif
ifneq ($(_vs71tools),)
_msvc_dir :=$(_vs71tools)/../../Vc7
endif
endif
endif
endif
ifneq ($(_msvc_dir),)
_compiler_bin :=$(_msvc_dir)/Bin
# Assume PlatformSDK is in VS71 (will be empty if VS90)
_ms_sdk :=$(call FullPath,$(_msvc_dir)/PlatformSDK)
_redist_sdk :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC90.CRT)
ifeq ($(_redist_sdk),)
_redist_sdk :=$(call FullPath,$(_msvc_dir)/redist/x86/Microsoft.VC80.CRT)
ifeq ($(_redist_sdk),)
_redist_sdk :=$(call FullPath,$(_msvc_dir)/../SDK/v1.1/Bin)
endif
endif
endif
endif
# The Microsoft Platform SDK installed by itself
ifneq ($(_program_files),)
_PSDK :="$(_program_files)/Microsoft SDKs/Windows/v6.1/"
_psdk :=$(call FullPath,$(xMSSDK61))
ifeq ($(_psdk),)
xPSDK :="$(_program_files)/Microsoft Platform SDK"
_psdk :=$(call FullPath,$(xPSDK))
ifeq ($(_psdk),)
xPSDK :="$(_program_files)/Microsoft SDK"
_psdk :=$(call FullPath,$(xMSSDK))
endif
endif
endif
# If no SDK found yet, look in other places
ifeq ($(_ms_sdk),)
ifdef MSSDK
xMSSDK :="$(subst \,/,$(MSSDK))"
_ms_sdk :=$(call FullPath,$(xMSSDK))
else
ifdef MSSdk
xMSSDK :="$(subst \,/,$(MSSdk))"
_ms_sdk :=$(call FullPath,$(xMSSDK))
else
_ms_sdk :=$(_psdk)
endif
endif
endif
# Compilers for 64bit may be from the free SDK, or Visual Studio Professional.
ifeq ($(ARCH_DATA_MODEL), 64)
xVS2008 :="$(_program_files32)/Microsoft Visual Studio 9.0/"
VS2008 :=$(call FullPath,$(xVS2008))
ifneq ($(VS2008),)
_compiler_bin :=$(VS2008)/VC/Bin/$(ARCH)
xMSSDK61 :="$(_program_files)/Microsoft SDKs/Windows/v6.1/"
MSSDK61 :=$(call FullPath,$(xMSSDK61))
_redist_sdk :=$(VS2008)/VC/redist/x64/Microsoft.VC90.CRT
else
ifneq ($(_ms_sdk),)
ifeq ($(ARCH), ia64)
_compiler_bin :=$(_ms_sdk)/Bin/Win64
endif
ifeq ($(ARCH), amd64)
_compiler_bin :=$(_ms_sdk)/Bin/Win64/x86/$(ARCH)
_redist_sdk :=$(_ms_sdk)/redist/win64/AMD64
endif
endif
endif
endif
endif # VS2010_EXISTS
# Location on system where jdk installs might be # Location on system where jdk installs might be
ifneq ($(_program_files),) ifneq ($(_program_files),)
...@@ -566,20 +456,8 @@ ifndef ALT_BOOTDIR ...@@ -566,20 +456,8 @@ ifndef ALT_BOOTDIR
_BOOTDIR3 =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH) _BOOTDIR3 =$(SLASH_JAVA)/re/jdk/$(PREVIOUS_JDK_VERSION)/archive/fcs/binaries/$(PLATFORM)-$(ARCH)
endif endif
# 32bit always needs the MSVCRNN runtime, 64bit does when using VS2008 # Everybody needs the MSVCRNN runtime starting with VS2010
ifeq ($(ARCH_DATA_MODEL), 32) _NEEDS_MSVCRNN = true
_NEEDS_MSVCRNN = true
else
ifeq ($(VS2010_EXISTS),true)
_NEEDS_MSVCRNN = true
else
ifneq ($(VS2008),)
_NEEDS_MSVCRNN = true
else
_NEEDS_MSVCRNN = false
endif
endif
endif
ifeq ($(_NEEDS_MSVCRNN), true) ifeq ($(_NEEDS_MSVCRNN), true)
# MSVCRNN_DLL_PATH: location of msvcrnn.dll that will be re-distributed # MSVCRNN_DLL_PATH: location of msvcrnn.dll that will be re-distributed
...@@ -758,8 +636,6 @@ HOTSPOT_LIB_PATH:=$(call AltCheckValue,HOTSPOT_LIB_PATH) ...@@ -758,8 +636,6 @@ HOTSPOT_LIB_PATH:=$(call AltCheckValue,HOTSPOT_LIB_PATH)
# Special define for checking the binaries # Special define for checking the binaries
ifeq ($(VS2010_EXISTS),true)
# All windows dll and exe files should have been built with /NXCOMPAT # All windows dll and exe files should have been built with /NXCOMPAT
# and be setup for dynamic base addresses. # and be setup for dynamic base addresses.
# In addition, we should not be dependent on certain dll files that # In addition, we should not be dependent on certain dll files that
...@@ -841,12 +717,3 @@ define binary_file_verification # binary_file ...@@ -841,12 +717,3 @@ define binary_file_verification # binary_file
endef endef
endif endif
else
# Macro to check it's input file for banned dependencies and verify the
# binary was built properly. Relies on process exit code.
define binary_file_verification # binary_file
endef
endif
...@@ -996,25 +996,15 @@ endif ...@@ -996,25 +996,15 @@ endif
###################################################### ######################################################
sane-msdevtools_path: sane-msdevtools_path:
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
ifneq ($(COMPILER_VERSION), VS2010) ifeq ($(wildcard $(RC)),)
@if [ "$(MSDEVTOOLS_PATH)" != "" -a ! -r "$(MSDEVTOOLS_PATH)" ]; then \
$(ECHO) "ERROR: You do not have a valid MSDEVTOOLS_PATH setting. \n" \
" Please check your access to \n" \
" $(MSDEVTOOLS_PATH) \n" \
" and/or check your value of ALT_MSDEVTOOLS_PATH. \n" \
"" >> $(ERROR_FILE) ; \
fi
else
ifeq ($(wildcard $(RC)),)
@$(ECHO) "ERROR: Cannot find the RC utility from path: $(RC)\n" \ @$(ECHO) "ERROR: Cannot find the RC utility from path: $(RC)\n" \
" This is normally obtained from the WINDOWSSDKDIR." \ " This is normally obtained from the WINDOWSSDKDIR." \
"" >> $(ERROR_FILE) "" >> $(ERROR_FILE)
endif endif
ifeq ($(wildcard $(DUMPBIN)),) ifeq ($(wildcard $(DUMPBIN)),)
@$(ECHO) "ERROR: Cannot find the DUMPBIN utility from path: $(DUMPBIN)\n" \ @$(ECHO) "ERROR: Cannot find the DUMPBIN utility from path: $(DUMPBIN)\n" \
" This is normally obtained from the COMPILER_PATH." \ " This is normally obtained from the COMPILER_PATH." \
"" >> $(ERROR_FILE) "" >> $(ERROR_FILE)
endif
endif endif
endif endif
...@@ -1432,7 +1422,6 @@ endif ...@@ -1432,7 +1422,6 @@ endif
###################################################### ######################################################
sane-install-mssdk_path: sane-install-mssdk_path:
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
ifeq ($(COMPILER_VERSION), VS2010)
@if [ -z "$(WINDOWSSDKDIR)" ]; then \ @if [ -z "$(WINDOWSSDKDIR)" ]; then \
$(ECHO) "WARNING: Your WINDOWSSDKDIR setting is empty.\n" \ $(ECHO) "WARNING: Your WINDOWSSDKDIR setting is empty.\n" \
" It is recommended to set ALT_WINDOWSSDKDIR.\n" \ " It is recommended to set ALT_WINDOWSSDKDIR.\n" \
...@@ -1445,7 +1434,6 @@ ifeq ($(PLATFORM), windows) ...@@ -1445,7 +1434,6 @@ ifeq ($(PLATFORM), windows)
" and/or check your value of ALT_WINDOWSSDKDIR. \n" \ " and/or check your value of ALT_WINDOWSSDKDIR. \n" \
"" >> $(ERROR_FILE) ; \ "" >> $(ERROR_FILE) ; \
fi fi
endif
@if [ -z "$(INSTALL_MSSDK)" ]; then \ @if [ -z "$(INSTALL_MSSDK)" ]; then \
$(ECHO) "WARNING: Your INSTALL_MSSDK setting is empty.\n" \ $(ECHO) "WARNING: Your INSTALL_MSSDK setting is empty.\n" \
" It is recommended to set ALT_INSTALL_MSSDK.\n" \ " It is recommended to set ALT_INSTALL_MSSDK.\n" \
......
# #
# Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -55,7 +55,7 @@ EXCLUDE_PKGS = \ ...@@ -55,7 +55,7 @@ EXCLUDE_PKGS = \
# This is a list of regular expressions. So foo.* matches "foo" and "foo.bar". # This is a list of regular expressions. So foo.* matches "foo" and "foo.bar".
# #
ACTIVE_JSR_PKGS= \ ACTIVE_JSR_PKGS= \
java.dyn \ java.lang.invoke \
java.sql \ java.sql \
javax.activation \ javax.activation \
javax.annotation.* \ javax.annotation.* \
...@@ -97,11 +97,11 @@ CORE_PKGS = \ ...@@ -97,11 +97,11 @@ CORE_PKGS = \
java.awt.print \ java.awt.print \
java.beans \ java.beans \
java.beans.beancontext \ java.beans.beancontext \
java.dyn \
java.io \ java.io \
java.lang \ java.lang \
java.lang.annotation \ java.lang.annotation \
java.lang.instrument \ java.lang.instrument \
java.lang.invoke \
java.lang.management \ java.lang.management \
java.lang.ref \ java.lang.ref \
java.lang.reflect \ java.lang.reflect \
......
# #
# Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -44,7 +44,7 @@ SUBDIRS += security math util text net nio jar ...@@ -44,7 +44,7 @@ SUBDIRS += security math util text net nio jar
SUBDIRS_desktop = awt applet beans SUBDIRS_desktop = awt applet beans
SUBDIRS_management = management SUBDIRS_management = management
SUBDIRS_misc = npt java_crw_demo java_hprof_demo \ SUBDIRS_misc = npt java_crw_demo java_hprof_demo \
logging instrument dyn sql rmi logging instrument invoke sql rmi
ifeq ($(PLATFORM), solaris) ifeq ($(PLATFORM), solaris)
......
# #
# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -25,18 +25,18 @@ ...@@ -25,18 +25,18 @@
BUILDDIR = ../.. BUILDDIR = ../..
PACKAGE = java.dyn PACKAGE = java.lang.invoke
PRODUCT = java PRODUCT = java
include $(BUILDDIR)/common/Defs.gmk include $(BUILDDIR)/common/Defs.gmk
AUTO_FILES_JAVA_DIRS = java/dyn sun/dyn AUTO_FILES_JAVA_DIRS = java/lang/invoke sun/invoke
FILES_java = \
java/lang/ClassValue.java \
java/lang/BootstrapMethodError.java
# The sources built here use new language syntax to generate # The sources built here use new language syntax to generate
# method handle calls. Let's be sure we are using that format. # method handle calls. Let's be sure we are using that format.
LANGUAGE_VERSION = -source 7 LANGUAGE_VERSION = -source 7
CLASS_VERSION = -target 7 CLASS_VERSION = -target 7
# Tell the compiler not to accept transitional forms.
OTHER_JAVACFLAGS = -XDallowTransitionalJSR292=no
include $(BUILDDIR)/common/Classes.gmk include $(BUILDDIR)/common/Classes.gmk
...@@ -136,6 +136,7 @@ FILES_java = \ ...@@ -136,6 +136,7 @@ FILES_java = \
sun/text/resources/CollationData_sl.java \ sun/text/resources/CollationData_sl.java \
sun/text/resources/CollationData_sq.java \ sun/text/resources/CollationData_sq.java \
sun/text/resources/CollationData_sr.java \ sun/text/resources/CollationData_sr.java \
sun/text/resources/CollationData_sr_Latn.java \
sun/text/resources/CollationData_sv.java \ sun/text/resources/CollationData_sv.java \
sun/text/resources/CollationData_tr.java \ sun/text/resources/CollationData_tr.java \
sun/text/resources/CollationData_uk.java \ sun/text/resources/CollationData_uk.java \
...@@ -251,6 +252,10 @@ FILES_java = \ ...@@ -251,6 +252,10 @@ FILES_java = \
sun/text/resources/FormatData_sr_CS.java \ sun/text/resources/FormatData_sr_CS.java \
sun/text/resources/FormatData_sr_ME.java \ sun/text/resources/FormatData_sr_ME.java \
sun/text/resources/FormatData_sr_RS.java \ sun/text/resources/FormatData_sr_RS.java \
sun/text/resources/FormatData_sr_Latn.java \
sun/text/resources/FormatData_sr_Latn_BA.java \
sun/text/resources/FormatData_sr_Latn_ME.java \
sun/text/resources/FormatData_sr_Latn_RS.java \
sun/text/resources/FormatData_sv.java \ sun/text/resources/FormatData_sv.java \
sun/text/resources/FormatData_sv_SE.java \ sun/text/resources/FormatData_sv_SE.java \
sun/text/resources/FormatData_tr.java \ sun/text/resources/FormatData_tr.java \
......
...@@ -65,6 +65,7 @@ FILES_compiled_properties = \ ...@@ -65,6 +65,7 @@ FILES_compiled_properties = \
sun/util/resources/LocaleNames_sl.properties \ sun/util/resources/LocaleNames_sl.properties \
sun/util/resources/LocaleNames_sq.properties \ sun/util/resources/LocaleNames_sq.properties \
sun/util/resources/LocaleNames_sr.properties \ sun/util/resources/LocaleNames_sr.properties \
sun/util/resources/LocaleNames_sr_Latn.properties \
sun/util/resources/LocaleNames_sv.properties \ sun/util/resources/LocaleNames_sv.properties \
sun/util/resources/LocaleNames_tr.properties \ sun/util/resources/LocaleNames_tr.properties \
sun/util/resources/LocaleNames_uk.properties \ sun/util/resources/LocaleNames_uk.properties \
...@@ -111,6 +112,9 @@ FILES_compiled_properties = \ ...@@ -111,6 +112,9 @@ FILES_compiled_properties = \
sun/util/resources/CalendarData_sl.properties \ sun/util/resources/CalendarData_sl.properties \
sun/util/resources/CalendarData_sq.properties \ sun/util/resources/CalendarData_sq.properties \
sun/util/resources/CalendarData_sr.properties \ sun/util/resources/CalendarData_sr.properties \
sun/util/resources/CalendarData_sr_Latn_BA.properties \
sun/util/resources/CalendarData_sr_Latn_ME.properties \
sun/util/resources/CalendarData_sr_Latn_RS.properties \
sun/util/resources/CalendarData_sv.properties \ sun/util/resources/CalendarData_sv.properties \
sun/util/resources/CalendarData_tr.properties \ sun/util/resources/CalendarData_tr.properties \
sun/util/resources/CalendarData_uk.properties \ sun/util/resources/CalendarData_uk.properties \
...@@ -186,6 +190,7 @@ FILES_compiled_properties = \ ...@@ -186,6 +190,7 @@ FILES_compiled_properties = \
sun/util/resources/CurrencyNames_nl_NL.properties \ sun/util/resources/CurrencyNames_nl_NL.properties \
sun/util/resources/CurrencyNames_no_NO.properties \ sun/util/resources/CurrencyNames_no_NO.properties \
sun/util/resources/CurrencyNames_pl_PL.properties \ sun/util/resources/CurrencyNames_pl_PL.properties \
sun/util/resources/CurrencyNames_pt.properties \
sun/util/resources/CurrencyNames_pt_BR.properties \ sun/util/resources/CurrencyNames_pt_BR.properties \
sun/util/resources/CurrencyNames_pt_PT.properties \ sun/util/resources/CurrencyNames_pt_PT.properties \
sun/util/resources/CurrencyNames_ro_RO.properties \ sun/util/resources/CurrencyNames_ro_RO.properties \
...@@ -196,6 +201,10 @@ FILES_compiled_properties = \ ...@@ -196,6 +201,10 @@ FILES_compiled_properties = \
sun/util/resources/CurrencyNames_sr_BA.properties \ sun/util/resources/CurrencyNames_sr_BA.properties \
sun/util/resources/CurrencyNames_sr_CS.properties \ sun/util/resources/CurrencyNames_sr_CS.properties \
sun/util/resources/CurrencyNames_sr_ME.properties \ sun/util/resources/CurrencyNames_sr_ME.properties \
sun/util/resources/CurrencyNames_sr_RS.properties \
sun/util/resources/CurrencyNames_sr_Latn_BA.properties \
sun/util/resources/CurrencyNames_sr_Latn_ME.properties \
sun/util/resources/CurrencyNames_sr_Latn_RS.properties \
sun/util/resources/CurrencyNames_sv.properties \ sun/util/resources/CurrencyNames_sv.properties \
sun/util/resources/CurrencyNames_sv_SE.properties \ sun/util/resources/CurrencyNames_sv_SE.properties \
sun/util/resources/CurrencyNames_tr_TR.properties \ sun/util/resources/CurrencyNames_tr_TR.properties \
......
#
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 2 only, as
# published by the Free Software Foundation. Oracle designates this
# particular file as subject to the "Classpath" exception as provided
# by Oracle in the LICENSE file that accompanied this code.
#
# This code is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# version 2 for more details (a copy is included in the LICENSE file that
# accompanied this code).
#
# You should have received a copy of the GNU General Public License version
# 2 along with this work; if not, write to the Free Software Foundation,
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
# or visit www.oracle.com if you need additional information or have any
# questions.
#
#
# Makefile to build the Laffy demo.
#
BUILDDIR = ../../..
PRODUCT = demo/jfc
DEMONAME = Laffy
include $(BUILDDIR)/common/Defs.gmk
DEMO_ROOT = $(CLOSED_SRC)/share/demo/jfc/$(DEMONAME)
DEMO_DESTDIR = $(DEMODIR)/jfc/$(DEMONAME)
DEMO_TOPFILES = ./readme.html ./laffy.png
DEMO_SKIP_SRCZIP = true
#
# Demo jar building rules.
#
include $(BUILDDIR)/common/Demo.gmk
...@@ -43,7 +43,7 @@ SUBDIRS = \ ...@@ -43,7 +43,7 @@ SUBDIRS = \
# Some demos aren't currently included in OpenJDK # Some demos aren't currently included in OpenJDK
ifndef OPENJDK ifndef OPENJDK
SUBDIRS += Java2D SwingSet2 SwingSet3 Stylepad SUBDIRS += Java2D Laffy SwingSet2 SwingSet3 Stylepad
endif endif
include $(BUILDDIR)/common/Subdirs.gmk include $(BUILDDIR)/common/Subdirs.gmk
......
...@@ -71,7 +71,8 @@ $(SERVICEDIR)/%: $(CLOSED_SRC)/share/classes/sun/java2d/cmm/kcms/META-INF/servic ...@@ -71,7 +71,8 @@ $(SERVICEDIR)/%: $(CLOSED_SRC)/share/classes/sun/java2d/cmm/kcms/META-INF/servic
# Extra rules # Extra rules
# #
ifeq ($(PLATFORM), linux) ifeq ($(PLATFORM), linux)
LDLIBS += -lpthread LDLIBS += -lpthread
OTHER_CFLAGS += -Wno-missing-field-initializers
endif endif
clean clobber:: clean clobber::
...@@ -103,6 +104,5 @@ CPPFLAGS += -I$(CLASSHDRDIR) \ ...@@ -103,6 +104,5 @@ CPPFLAGS += -I$(CLASSHDRDIR) \
endif # PLATFORM endif # PLATFORM
#CFLAGS += -DJAVACMM -DFUT_CALC_EX -DNO_FUT_GCONST CFLAGS += -DJAVACMM -DFUT_CALC_EX -DNO_FUT_GCONST
CFLAGS += -DFUT_CALC_EX -DNO_FUT_GCONST
...@@ -81,10 +81,6 @@ vpath %.c $(SHARE_SRC)/native/sun/java2d ...@@ -81,10 +81,6 @@ vpath %.c $(SHARE_SRC)/native/sun/java2d
ifeq ($(PLATFORM), windows) ifeq ($(PLATFORM), windows)
OTHER_CFLAGS += -DCMS_IS_WINDOWS_ OTHER_CFLAGS += -DCMS_IS_WINDOWS_
ifeq ($(COMPILER_VERSION), VS2003)
OTHER_CFLAGS += -Dsqrtf=sqrt
endif
OTHER_LDLIBS = $(OBJDIR)/../../../sun.awt/awt/$(OBJDIRNAME)/awt.lib OTHER_LDLIBS = $(OBJDIR)/../../../sun.awt/awt/$(OBJDIRNAME)/awt.lib
OTHER_INCLUDES += -I$(SHARE_SRC)/native/sun/java2d \ OTHER_INCLUDES += -I$(SHARE_SRC)/native/sun/java2d \
-I$(SHARE_SRC)/native/sun/awt/debug -I$(SHARE_SRC)/native/sun/awt/debug
......
...@@ -21,4 +21,4 @@ ...@@ -21,4 +21,4 @@
# or visit www.oracle.com if you need additional information or have any # or visit www.oracle.com if you need additional information or have any
# questions. # questions.
# #
tzdata2011b tzdata2011d
...@@ -531,11 +531,31 @@ Zone Pacific/Pago_Pago 12:37:12 - LMT 1879 Jul 5 ...@@ -531,11 +531,31 @@ Zone Pacific/Pago_Pago 12:37:12 - LMT 1879 Jul 5
# to 01:00am and First Sunday April 2011 (03/04/11) - adjust clocks # to 01:00am and First Sunday April 2011 (03/04/11) - adjust clocks
# backwards from 1:00am to 12:00am" # backwards from 1:00am to 12:00am"
# From Raymond Hughes (2011-03-07)
# I believe this will be posted shortly on the website
# <a href="http://www.mcil.gov.ws">
# www.mcil.gov.ws
# </a>
#
# PUBLIC NOTICE ON DAYLIGHT SAVING TIME
#
# Pursuant to the Daylight Saving Act 2009 and Cabinets decision,
# businesses and the general public are hereby advised that daylight
# saving time is on the first Saturday of April 2011 (02/04/11).
#
# The public is therefore advised that when the standard time strikes
# the hour of four oclock (4.00am or 0400 Hours) on the 2nd April 2011,
# then all instruments used to measure standard time are to be
# adjusted/changed to three oclock (3:00am or 0300Hrs).
#
# Margaret Fruean ACTING CHIEF EXECUTIVE OFFICER MINISTRY OF COMMERCE,
# INDUSTRY AND LABOUR 28th February 2011
Zone Pacific/Apia 12:33:04 - LMT 1879 Jul 5 Zone Pacific/Apia 12:33:04 - LMT 1879 Jul 5
-11:26:56 - LMT 1911 -11:26:56 - LMT 1911
-11:30 - SAMT 1950 # Samoa Time -11:30 - SAMT 1950 # Samoa Time
-11:00 - WST 2010 Sep 26 -11:00 - WST 2010 Sep 26
-11:00 1:00 WSDT 2011 Apr 3 1:00 -11:00 1:00 WSDT 2011 Apr 2 4:00
-11:00 - WST -11:00 - WST
# Solomon Is # Solomon Is
......
...@@ -58,8 +58,7 @@ Link Etc/GMT Etc/GMT0 ...@@ -58,8 +58,7 @@ Link Etc/GMT Etc/GMT0
# (i.e. west of Greenwich) even though many people would expect it to # (i.e. west of Greenwich) even though many people would expect it to
# mean 4 hours ahead of UTC (i.e. east of Greenwich). # mean 4 hours ahead of UTC (i.e. east of Greenwich).
# #
# In the draft 5 of POSIX 1003.1-200x, the angle bracket notation # In the draft 5 of POSIX 1003.1-200x, the angle bracket notation allows for
# (which is not yet supported by the tz code) allows for
# TZ='<GMT-4>+4'; if you want time zone abbreviations conforming to # TZ='<GMT-4>+4'; if you want time zone abbreviations conforming to
# ISO 8601 you can use TZ='<-0400>+4'. Thus the commonly-expected # ISO 8601 you can use TZ='<-0400>+4'. Thus the commonly-expected
# offset is kept within the angle bracket (and is used for display) # offset is kept within the angle bracket (and is used for display)
......
...@@ -2505,25 +2505,18 @@ Zone Europe/Zurich 0:34:08 - LMT 1848 Sep 12 ...@@ -2505,25 +2505,18 @@ Zone Europe/Zurich 0:34:08 - LMT 1848 Sep 12
# (on a non-government server though) describing dates between 2002 and 2006: # (on a non-government server though) describing dates between 2002 and 2006:
# http://www.alomaliye.com/bkk_2002_3769.htm # http://www.alomaliye.com/bkk_2002_3769.htm
# From Sue Williams (2008-08-11): # From G&ouml;kdeniz Karada&#x011f; (2011-03-10):
# I spotted this news article about a potential change in Turkey. #
# # According to the articles linked below, Turkey will change into summer
# <a href="http://www.hurriyet.com.tr/english/domestic/9626174.asp?scr=1"> # time zone (GMT+3) on March 28, 2011 at 3:00 a.m. instead of March 27.
# http://www.hurriyet.com.tr/english/domestic/9626174.asp?scr=1 # This change is due to a nationwide exam on 27th.
#
# <a href="http://www.worldbulletin.net/?aType=haber&ArticleID=70872">
# http://www.worldbulletin.net/?aType=haber&ArticleID=70872
# </a> # </a>
# Turkish:
# From Sue Williams (2008-08-20): # <a href="http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373">
# This article says that around the end of March 2011, Turkey wants to # http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373
# adjust the clocks forward by 1/2 hour and stay that way permanently.
# The article indicates that this is a change in timezone offset in addition
# to stopping observance of DST.
# This proposal has not yet been approved.
#
# Read more here...
#
# Turkey to abandon daylight saving time in 2011
# <a href="http://www.turkishdailynews.com.tr/article.php?enewsid=112989">
# http://www.turkishdailynews.com.tr/article.php?enewsid=112989
# </a> # </a>
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
...@@ -2591,6 +2584,8 @@ Zone Europe/Istanbul 1:55:52 - LMT 1880 ...@@ -2591,6 +2584,8 @@ Zone Europe/Istanbul 1:55:52 - LMT 1880
2:00 Turkey EE%sT 1978 Oct 15 2:00 Turkey EE%sT 1978 Oct 15
3:00 Turkey TR%sT 1985 Apr 20 # Turkey Time 3:00 Turkey TR%sT 1985 Apr 20 # Turkey Time
2:00 Turkey EE%sT 2007 2:00 Turkey EE%sT 2007
2:00 EU EE%sT 2011 Mar 27 1:00u
2:00 - EET 2011 Mar 28 1:00u
2:00 EU EE%sT 2:00 EU EE%sT
Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents. Link Europe/Istanbul Asia/Istanbul # Istanbul is in both continents.
......
...@@ -78,13 +78,13 @@ Leap 2008 Dec 31 23:59:60 + S ...@@ -78,13 +78,13 @@ Leap 2008 Dec 31 23:59:60 + S
# SERVICE DE LA ROTATION TERRESTRE # SERVICE DE LA ROTATION TERRESTRE
# OBSERVATOIRE DE PARIS # OBSERVATOIRE DE PARIS
# 61, Av. de l'Observatoire 75014 PARIS (France) # 61, Av. de l'Observatoire 75014 PARIS (France)
# Tel. : 33 (0) 1 40 51 22 26 # Tel. : 33 (0) 1 40 51 22 29
# FAX : 33 (0) 1 40 51 22 91 # FAX : 33 (0) 1 40 51 22 91
# Internet : services.iers@obspm.fr # Internet : services.iers@obspm.fr
# #
# Paris, 14 July 2010 # Paris, 2 February 2011
# #
# Bulletin C 40 # Bulletin C 41
# #
# To authorities responsible # To authorities responsible
# for the measurement and # for the measurement and
...@@ -92,9 +92,9 @@ Leap 2008 Dec 31 23:59:60 + S ...@@ -92,9 +92,9 @@ Leap 2008 Dec 31 23:59:60 + S
# #
# INFORMATION ON UTC - TAI # INFORMATION ON UTC - TAI
# #
# NO positive leap second will be introduced at the end of December 2010. # NO positive leap second will be introduced at the end of June 2011.
# The difference between Coordinated Universal Time UTC and the # The difference between Coordinated Universal Time UTC and the
# International Atomic Time TAI is : # International Atomic Time TAI is :
# #
# from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s # from 2009 January 1, 0h UTC, until further notice : UTC-TAI = -34 s
# #
...@@ -104,6 +104,6 @@ Leap 2008 Dec 31 23:59:60 + S ...@@ -104,6 +104,6 @@ Leap 2008 Dec 31 23:59:60 + S
# will be no time step at the next possible date. # will be no time step at the next possible date.
# #
# Daniel GAMBIS # Daniel GAMBIS
# Director # Head
# Earth Orientation Center of IERS # Earth Orientation Center of the IERS
# Observatoire de Paris, France # Observatoire de Paris, France
...@@ -448,15 +448,74 @@ Zone America/Los_Angeles -7:52:58 - LMT 1883 Nov 18 12:07:02 ...@@ -448,15 +448,74 @@ Zone America/Los_Angeles -7:52:58 - LMT 1883 Nov 18 12:07:02
# were nearby inhabitants in some cases and for our purposes perhaps # were nearby inhabitants in some cases and for our purposes perhaps
# it's best to simply use the official transition. # it's best to simply use the official transition.
# #
# From Steve Ferguson (2011-01-31):
# The author lives in Alaska and many of the references listed are only
# available to Alaskan residents.
#
# <a href="http://www.alaskahistoricalsociety.org/index.cfm?section=discover%20alaska&page=Glimpses%20of%20the%20Past&viewpost=2&ContentId=98">
# http://www.alaskahistoricalsociety.org/index.cfm?section=discover%20alaska&page=Glimpses%20of%20the%20Past&viewpost=2&ContentId=98
# </a>
# From Arthur David Olson (2011-02-01):
# Here's database-relevant material from the 2001 "Alaska History" article:
#
# On September 20 [1979]...DOT...officials decreed that on April 27,
# 1980, Juneau and other nearby communities would move to Yukon Time.
# Sitka, Petersburg, Wrangell, and Ketchikan, however, would remain on
# Pacific Time.
#
# ...on September 22, 1980, DOT Secretary Neil E. Goldschmidt rescinded the
# Department's September 1979 decision. Juneau and other communities in
# northern Southeast reverted to Pacific Time on October 26.
#
# On October 28 [1983]...the Metlakatla Indian Community Council voted
# unanimously to keep the reservation on Pacific Time.
#
# According to DOT official Joanne Petrie, Indian reservations are not
# bound to follow time zones imposed by neighboring jurisdictions.
#
# (The last is consistent with how the database now handles the Navajo
# Nation.)
# From Arthur David Olson (2011-02-09):
# I just spoke by phone with a staff member at the Metlakatla Indian
# Community office (using contact information available at
# <a href="http://www.commerce.state.ak.us/dca/commdb/CIS.cfm?Comm_Boro_name=Metlakatla">
# http://www.commerce.state.ak.us/dca/commdb/CIS.cfm?Comm_Boro_name=Metlakatla
# </a>).
# It's shortly after 1:00 here on the east coast of the United States;
# the staffer said it was shortly after 10:00 there. When I asked whether
# that meant they were on Pacific time, they said no--they were on their
# own time. I asked about daylight saving; they said it wasn't used. I
# did not inquire about practices in the past.
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Juneau 15:02:19 - LMT 1867 Oct 18 Zone America/Juneau 15:02:19 - LMT 1867 Oct 18
-8:57:41 - LMT 1900 Aug 20 12:00 -8:57:41 - LMT 1900 Aug 20 12:00
-8:00 - PST 1942 -8:00 - PST 1942
-8:00 US P%sT 1946 -8:00 US P%sT 1946
-8:00 - PST 1969 -8:00 - PST 1969
-8:00 US P%sT 1980 Apr 27 2:00
-9:00 US Y%sT 1980 Oct 26 2:00
-8:00 US P%sT 1983 Oct 30 2:00
-9:00 US Y%sT 1983 Nov 30
-9:00 US AK%sT
Zone America/Sitka -14:58:47 - LMT 1867 Oct 18
-9:01:13 - LMT 1900 Aug 20 12:00
-8:00 - PST 1942
-8:00 US P%sT 1946
-8:00 - PST 1969
-8:00 US P%sT 1983 Oct 30 2:00 -8:00 US P%sT 1983 Oct 30 2:00
-9:00 US Y%sT 1983 Nov 30 -9:00 US Y%sT 1983 Nov 30
-9:00 US AK%sT -9:00 US AK%sT
Zone America/Metlakatla 15:13:42 - LMT 1867 Oct 18
-8:46:18 - LMT 1900 Aug 20 12:00
-8:00 - PST 1942
-8:00 US P%sT 1946
-8:00 - PST 1969
-8:00 US P%sT 1983 Oct 30 2:00
-8:00 US MeST
Zone America/Yakutat 14:41:05 - LMT 1867 Oct 18 Zone America/Yakutat 14:41:05 - LMT 1867 Oct 18
-9:18:55 - LMT 1900 Aug 20 12:00 -9:18:55 - LMT 1900 Aug 20 12:00
-9:00 - YST 1942 -9:00 - YST 1942
...@@ -2569,6 +2628,21 @@ Zone America/Costa_Rica -5:36:20 - LMT 1890 # San Jose ...@@ -2569,6 +2628,21 @@ Zone America/Costa_Rica -5:36:20 - LMT 1890 # San Jose
# the time was announced as "diez cinco"--the same time as here, indicating # the time was announced as "diez cinco"--the same time as here, indicating
# that has indeed switched to DST. Assume second Sunday from 2009 forward. # that has indeed switched to DST. Assume second Sunday from 2009 forward.
# From Steffen Thorsen (2011-03-08):
# Granma announced that Cuba is going to start DST on 2011-03-20 00:00:00
# this year. Nothing about the end date known so far (if that has
# changed at all).
#
# Source:
# <a href="http://granma.co.cu/2011/03/08/nacional/artic01.html">
# http://granma.co.cu/2011/03/08/nacional/artic01.html
# </a>
#
# Our info:
# <a href="http://www.timeanddate.com/news/time/cuba-starts-dst-2011.html">
# http://www.timeanddate.com/news/time/cuba-starts-dst-2011.html
# </a>
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Cuba 1928 only - Jun 10 0:00 1:00 D Rule Cuba 1928 only - Jun 10 0:00 1:00 D
Rule Cuba 1928 only - Oct 10 0:00 0 S Rule Cuba 1928 only - Oct 10 0:00 0 S
...@@ -2602,7 +2676,9 @@ Rule Cuba 2000 2004 - Apr Sun>=1 0:00s 1:00 D ...@@ -2602,7 +2676,9 @@ Rule Cuba 2000 2004 - Apr Sun>=1 0:00s 1:00 D
Rule Cuba 2006 max - Oct lastSun 0:00s 0 S Rule Cuba 2006 max - Oct lastSun 0:00s 0 S
Rule Cuba 2007 only - Mar Sun>=8 0:00s 1:00 D Rule Cuba 2007 only - Mar Sun>=8 0:00s 1:00 D
Rule Cuba 2008 only - Mar Sun>=15 0:00s 1:00 D Rule Cuba 2008 only - Mar Sun>=15 0:00s 1:00 D
Rule Cuba 2009 max - Mar Sun>=8 0:00s 1:00 D Rule Cuba 2009 2010 - Mar Sun>=8 0:00s 1:00 D
Rule Cuba 2011 only - Mar Sun>=15 0:00s 1:00 D
Rule Cuba 2012 max - Mar Sun>=8 0:00s 1:00 D
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
Zone America/Havana -5:29:28 - LMT 1890 Zone America/Havana -5:29:28 - LMT 1890
......
...@@ -1176,6 +1176,23 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 ...@@ -1176,6 +1176,23 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914
# From Arthur Daivd Olson (2010-03-06): # From Arthur Daivd Olson (2010-03-06):
# Angel Chiang's message confirmed by Julio Pacheco; Julio provided a patch. # Angel Chiang's message confirmed by Julio Pacheco; Julio provided a patch.
# From Glenn Eychaner (2011-03-02): [geychaner@mac.com]
# It appears that the Chilean government has decided to postpone the
# change from summer time to winter time again, by three weeks to April
# 2nd:
# <a href="http://www.emol.com/noticias/nacional/detalle/detallenoticias.asp?idnoticia=467651">
# http://www.emol.com/noticias/nacional/detalle/detallenoticias.asp?idnoticia=467651
# </a>
#
# This is not yet reflected in the offical "cambio de hora" site, but
# probably will be soon:
# <a href="http://www.horaoficial.cl/cambio.htm">
# http://www.horaoficial.cl/cambio.htm
# </a>
# From Arthur David Olson (2011-03-02):
# The emol.com article mentions a water shortage as the cause of the
# postponement, which may mean that it's not a permanent change.
# Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
Rule Chile 1927 1932 - Sep 1 0:00 1:00 S Rule Chile 1927 1932 - Sep 1 0:00 1:00 S
Rule Chile 1928 1932 - Apr 1 0:00 0 - Rule Chile 1928 1932 - Apr 1 0:00 0 -
...@@ -1211,8 +1228,8 @@ Rule Chile 2000 2007 - Mar Sun>=9 3:00u 0 - ...@@ -1211,8 +1228,8 @@ Rule Chile 2000 2007 - Mar Sun>=9 3:00u 0 -
# which is used below in specifying the transition. # which is used below in specifying the transition.
Rule Chile 2008 only - Mar 30 3:00u 0 - Rule Chile 2008 only - Mar 30 3:00u 0 -
Rule Chile 2009 only - Mar Sun>=9 3:00u 0 - Rule Chile 2009 only - Mar Sun>=9 3:00u 0 -
Rule Chile 2010 only - Apr 4 3:00u 0 - Rule Chile 2010 2011 - Apr Sun>=1 3:00u 0 -
Rule Chile 2011 max - Mar Sun>=9 3:00u 0 - Rule Chile 2012 max - Mar Sun>=9 3:00u 0 -
# IATA SSIM anomalies: (1992-02) says 1992-03-14; # IATA SSIM anomalies: (1992-02) says 1992-03-14;
# (1996-09) says 1998-03-08. Ignore these. # (1996-09) says 1998-03-08. Ignore these.
# Zone NAME GMTOFF RULES FORMAT [UNTIL] # Zone NAME GMTOFF RULES FORMAT [UNTIL]
......
...@@ -434,9 +434,11 @@ US +332654-1120424 America/Phoenix Mountain Standard Time - Arizona ...@@ -434,9 +434,11 @@ US +332654-1120424 America/Phoenix Mountain Standard Time - Arizona
US +340308-1181434 America/Los_Angeles Pacific Time US +340308-1181434 America/Los_Angeles Pacific Time
US +611305-1495401 America/Anchorage Alaska Time US +611305-1495401 America/Anchorage Alaska Time
US +581807-1342511 America/Juneau Alaska Time - Alaska panhandle US +581807-1342511 America/Juneau Alaska Time - Alaska panhandle
US +571035-1351807 America/Sitka Alaska Time - southeast Alaska panhandle
US +593249-1394338 America/Yakutat Alaska Time - Alaska panhandle neck US +593249-1394338 America/Yakutat Alaska Time - Alaska panhandle neck
US +643004-1652423 America/Nome Alaska Time - west Alaska US +643004-1652423 America/Nome Alaska Time - west Alaska
US +515248-1763929 America/Adak Aleutian Islands US +515248-1763929 America/Adak Aleutian Islands
US +550737-1313435 America/Metlakatla Metlakatla Time - Annette Island
US +211825-1575130 Pacific/Honolulu Hawaii US +211825-1575130 Pacific/Honolulu Hawaii
UY -3453-05611 America/Montevideo UY -3453-05611 America/Montevideo
UZ +3940+06648 Asia/Samarkand west Uzbekistan UZ +3940+06648 Asia/Samarkand west Uzbekistan
......
# #
# Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
...@@ -34,6 +34,7 @@ FILES_java = \ ...@@ -34,6 +34,7 @@ FILES_java = \
sun/net/ProgressListener.java \ sun/net/ProgressListener.java \
sun/net/ProgressMeteringPolicy.java \ sun/net/ProgressMeteringPolicy.java \
sun/net/SocksProxy.java \ sun/net/SocksProxy.java \
sun/net/ResourceManager.java \
sun/net/TelnetInputStream.java \ sun/net/TelnetInputStream.java \
sun/net/TelnetOutputStream.java \ sun/net/TelnetOutputStream.java \
sun/net/TelnetProtocolException.java \ sun/net/TelnetProtocolException.java \
...@@ -100,6 +101,7 @@ FILES_java = \ ...@@ -100,6 +101,7 @@ FILES_java = \
sun/net/www/protocol/http/NegotiateAuthentication.java \ sun/net/www/protocol/http/NegotiateAuthentication.java \
sun/net/www/protocol/http/Negotiator.java \ sun/net/www/protocol/http/Negotiator.java \
sun/net/www/protocol/http/ntlm/NTLMAuthentication.java \ sun/net/www/protocol/http/ntlm/NTLMAuthentication.java \
sun/net/www/protocol/http/ntlm/NTLMAuthenticationCallback.java \
sun/net/www/protocol/http/spnego/NegotiatorImpl.java \ sun/net/www/protocol/http/spnego/NegotiatorImpl.java \
sun/net/www/protocol/http/spnego/NegotiateCallbackHandler.java \ sun/net/www/protocol/http/spnego/NegotiateCallbackHandler.java \
sun/net/www/protocol/http/logging/HttpLogFormatter.java \ sun/net/www/protocol/http/logging/HttpLogFormatter.java \
......
...@@ -210,6 +210,8 @@ public final class Transform extends SignatureElementProxy { ...@@ -210,6 +210,8 @@ public final class Transform extends SignatureElementProxy {
public static void init() { public static void init() {
if (!alreadyInitialized) { if (!alreadyInitialized) {
transformClassHash = new HashMap(10); transformClassHash = new HashMap(10);
// make sure builtin algorithms are all registered first
com.sun.org.apache.xml.internal.security.Init.init();
alreadyInitialized = true; alreadyInitialized = true;
} }
} }
...@@ -236,12 +238,7 @@ public final class Transform extends SignatureElementProxy { ...@@ -236,12 +238,7 @@ public final class Transform extends SignatureElementProxy {
"algorithm.alreadyRegistered", exArgs); "algorithm.alreadyRegistered", exArgs);
} }
ClassLoader cl = (ClassLoader) AccessController.doPrivileged( ClassLoader cl = Thread.currentThread().getContextClassLoader();
new PrivilegedAction() {
public Object run() {
return Thread.currentThread().getContextClassLoader();
}
});
try { try {
transformClassHash.put transformClassHash.put
......
...@@ -33,6 +33,11 @@ import java.lang.reflect.Field; ...@@ -33,6 +33,11 @@ import java.lang.reflect.Field;
import sun.awt.AWTAccessor; import sun.awt.AWTAccessor;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
import java.security.AccessControlContext;
import java.security.AccessController;
import java.io.ObjectInputStream;
import java.io.IOException;
/** /**
* The root event class for all AWT events. * The root event class for all AWT events.
* This class and its subclasses supercede the original * This class and its subclasses supercede the original
...@@ -97,6 +102,22 @@ public abstract class AWTEvent extends EventObject { ...@@ -97,6 +102,22 @@ public abstract class AWTEvent extends EventObject {
*/ */
protected boolean consumed = false; protected boolean consumed = false;
/*
* The event's AccessControlContext.
*/
private transient volatile AccessControlContext acc =
AccessController.getContext();
/*
* Returns the acc this event was constructed with.
*/
final AccessControlContext getAccessControlContext() {
if (acc == null) {
throw new SecurityException("AWTEvent is missing AccessControlContext");
}
return acc;
}
transient boolean focusManagerIsDispatching = false; transient boolean focusManagerIsDispatching = false;
transient boolean isPosted; transient boolean isPosted;
...@@ -247,6 +268,10 @@ public abstract class AWTEvent extends EventObject { ...@@ -247,6 +268,10 @@ public abstract class AWTEvent extends EventObject {
public boolean isSystemGenerated(AWTEvent ev) { public boolean isSystemGenerated(AWTEvent ev) {
return ev.isSystemGenerated; return ev.isSystemGenerated;
} }
public AccessControlContext getAccessControlContext(AWTEvent ev) {
return ev.getAccessControlContext();
}
}); });
} }
......
...@@ -59,6 +59,7 @@ import java.lang.reflect.InvocationTargetException; ...@@ -59,6 +59,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.security.AccessController; import java.security.AccessController;
import java.security.PrivilegedAction; import java.security.PrivilegedAction;
import java.security.AccessControlContext;
import javax.accessibility.*; import javax.accessibility.*;
import java.applet.Applet; import java.applet.Applet;
...@@ -471,6 +472,12 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -471,6 +472,12 @@ public abstract class Component implements ImageObserver, MenuContainer,
static final Object LOCK = new AWTTreeLock(); static final Object LOCK = new AWTTreeLock();
static class AWTTreeLock {} static class AWTTreeLock {}
/*
* The component's AccessControlContext.
*/
private transient volatile AccessControlContext acc =
AccessController.getContext();
/** /**
* Minimum size. * Minimum size.
* (This field perhaps should have been transient). * (This field perhaps should have been transient).
...@@ -671,6 +678,16 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -671,6 +678,16 @@ public abstract class Component implements ImageObserver, MenuContainer,
return objectLock; return objectLock;
} }
/*
* Returns the acc this component was constructed with.
*/
final AccessControlContext getAccessControlContext() {
if (acc == null) {
throw new SecurityException("Component is missing AccessControlContext");
}
return acc;
}
boolean isPacked = false; boolean isPacked = false;
/** /**
...@@ -950,6 +967,10 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -950,6 +967,10 @@ public abstract class Component implements ImageObserver, MenuContainer,
public void processEvent(Component comp, AWTEvent e) { public void processEvent(Component comp, AWTEvent e) {
comp.processEvent(e); comp.processEvent(e);
} }
public AccessControlContext getAccessControlContext(Component comp) {
return comp.getAccessControlContext();
}
}); });
} }
...@@ -3873,6 +3894,11 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -3873,6 +3894,11 @@ public abstract class Component implements ImageObserver, MenuContainer,
* supported or met * supported or met
* @exception ClassCastException if the component is not a canvas or * @exception ClassCastException if the component is not a canvas or
* window. * window.
* @exception IllegalStateException if the component has no peer
* @exception IllegalArgumentException if {@code numBuffers} is less than two,
* or if {@code BufferCapabilities.isPageFlipping} is not
* {@code true}.
* @see #createBuffers(int, BufferCapabilities)
*/ */
protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps) protected FlipBufferStrategy(int numBuffers, BufferCapabilities caps)
throws AWTException throws AWTException
...@@ -8608,6 +8634,8 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -8608,6 +8634,8 @@ public abstract class Component implements ImageObserver, MenuContainer,
{ {
objectLock = new Object(); objectLock = new Object();
acc = AccessController.getContext();
s.defaultReadObject(); s.defaultReadObject();
appContext = AppContext.getAppContext(); appContext = AppContext.getAppContext();
......
...@@ -48,6 +48,12 @@ import sun.awt.AWTAccessor; ...@@ -48,6 +48,12 @@ import sun.awt.AWTAccessor;
import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.security.AccessControlContext;
import java.security.ProtectionDomain;
import sun.misc.SharedSecrets;
import sun.misc.JavaSecurityAccess;
/** /**
* <code>EventQueue</code> is a platform-independent class * <code>EventQueue</code> is a platform-independent class
* that queues events, both from the underlying peer classes * that queues events, both from the underlying peer classes
...@@ -612,6 +618,9 @@ public class EventQueue { ...@@ -612,6 +618,9 @@ public class EventQueue {
return null; return null;
} }
private static final JavaSecurityAccess javaSecurityAccess =
SharedSecrets.getJavaSecurityAccess();
/** /**
* Dispatches an event. The manner in which the event is * Dispatches an event. The manner in which the event is
* dispatched depends upon the type of the event and the * dispatched depends upon the type of the event and the
...@@ -650,13 +659,49 @@ public class EventQueue { ...@@ -650,13 +659,49 @@ public class EventQueue {
* @throws NullPointerException if <code>event</code> is <code>null</code> * @throws NullPointerException if <code>event</code> is <code>null</code>
* @since 1.2 * @since 1.2
*/ */
protected void dispatchEvent(AWTEvent event) { protected void dispatchEvent(final AWTEvent event) {
final Object src = event.getSource();
final PrivilegedAction<Void> action = new PrivilegedAction<Void>() {
public Void run() {
dispatchEventImpl(event, src);
return null;
}
};
final AccessControlContext stack = AccessController.getContext();
final AccessControlContext srcAcc = getAccessControlContextFrom(src);
final AccessControlContext eventAcc = event.getAccessControlContext();
if (srcAcc == null) {
javaSecurityAccess.doIntersectionPrivilege(action, stack, eventAcc);
} else {
javaSecurityAccess.doIntersectionPrivilege(
new PrivilegedAction<Void>() {
public Void run() {
javaSecurityAccess.doIntersectionPrivilege(action, eventAcc);
return null;
}
}, stack, srcAcc);
}
}
private static AccessControlContext getAccessControlContextFrom(Object src) {
return src instanceof Component ?
((Component)src).getAccessControlContext() :
src instanceof MenuComponent ?
((MenuComponent)src).getAccessControlContext() :
src instanceof TrayIcon ?
((TrayIcon)src).getAccessControlContext() :
null;
}
/**
* Called from dispatchEvent() under a correct AccessControlContext
*/
private void dispatchEventImpl(final AWTEvent event, final Object src) {
event.isPosted = true; event.isPosted = true;
Object src = event.getSource();
if (event instanceof ActiveEvent) { if (event instanceof ActiveEvent) {
// This could become the sole method of dispatching in time. // This could become the sole method of dispatching in time.
setCurrentEventAndMostRecentTimeImpl(event); setCurrentEventAndMostRecentTimeImpl(event);
((ActiveEvent)event).dispatch(); ((ActiveEvent)event).dispatch();
} else if (src instanceof Component) { } else if (src instanceof Component) {
((Component)src).dispatchEvent(event); ((Component)src).dispatchEvent(event);
......
...@@ -57,8 +57,14 @@ import java.beans.ConstructorProperties; ...@@ -57,8 +57,14 @@ import java.beans.ConstructorProperties;
* </pre> * </pre>
* *
* <p> * <p>
* The user may also select what action the {@code LinearGradientPaint} * The user may also select what action the {@code LinearGradientPaint} object
* should take when filling color outside the start and end points. * takes when it is filling the space outside the start and end points by
* setting {@code CycleMethod} to either {@code REFLECTION} or {@code REPEAT}.
* The distances between any two colors in any of the reflected or repeated
* copies of the gradient are the same as the distance between those same two
* colors between the start and end points.
* Note that some minor variations in distances may occur due to sampling at
* the granularity of a pixel.
* If no cycle method is specified, {@code NO_CYCLE} will be chosen by * If no cycle method is specified, {@code NO_CYCLE} will be chosen by
* default, which means the endpoint colors will be used to fill the * default, which means the endpoint colors will be used to fill the
* remaining area. * remaining area.
......
...@@ -33,6 +33,9 @@ import sun.awt.SunToolkit; ...@@ -33,6 +33,9 @@ import sun.awt.SunToolkit;
import sun.awt.AWTAccessor; import sun.awt.AWTAccessor;
import javax.accessibility.*; import javax.accessibility.*;
import java.security.AccessControlContext;
import java.security.AccessController;
/** /**
* The abstract class <code>MenuComponent</code> is the superclass * The abstract class <code>MenuComponent</code> is the superclass
* of all menu-related components. In this respect, the class * of all menu-related components. In this respect, the class
...@@ -99,6 +102,23 @@ public abstract class MenuComponent implements java.io.Serializable { ...@@ -99,6 +102,23 @@ public abstract class MenuComponent implements java.io.Serializable {
*/ */
boolean newEventsOnly = false; boolean newEventsOnly = false;
/*
* The menu's AccessControlContext.
*/
private transient volatile AccessControlContext acc =
AccessController.getContext();
/*
* Returns the acc this menu component was constructed with.
*/
final AccessControlContext getAccessControlContext() {
if (acc == null) {
throw new SecurityException(
"MenuComponent is missing AccessControlContext");
}
return acc;
}
/* /*
* Internal constants for serialization. * Internal constants for serialization.
*/ */
...@@ -402,6 +422,9 @@ public abstract class MenuComponent implements java.io.Serializable { ...@@ -402,6 +422,9 @@ public abstract class MenuComponent implements java.io.Serializable {
throws ClassNotFoundException, IOException, HeadlessException throws ClassNotFoundException, IOException, HeadlessException
{ {
GraphicsEnvironment.checkHeadless(); GraphicsEnvironment.checkHeadless();
acc = AccessController.getContext();
s.defaultReadObject(); s.defaultReadObject();
appContext = AppContext.getAppContext(); appContext = AppContext.getAppContext();
......
...@@ -286,6 +286,10 @@ public abstract class MultipleGradientPaint implements Paint { ...@@ -286,6 +286,10 @@ public abstract class MultipleGradientPaint implements Paint {
/** /**
* Returns a copy of the transform applied to the gradient. * Returns a copy of the transform applied to the gradient.
* *
* <p>
* Note that if no transform is applied to the gradient
* when it is created, the identity transform is used.
*
* @return a copy of the transform applied to the gradient * @return a copy of the transform applied to the gradient
*/ */
public final AffineTransform getTransform() { public final AffineTransform getTransform() {
...@@ -293,10 +297,12 @@ public abstract class MultipleGradientPaint implements Paint { ...@@ -293,10 +297,12 @@ public abstract class MultipleGradientPaint implements Paint {
} }
/** /**
* Returns the transparency mode for this Paint object. * Returns the transparency mode for this {@code Paint} object.
* *
* @return an integer value representing the transparency mode for * @return {@code OPAQUE} if all colors used by this
* this Paint object * {@code Paint} object are opaque,
* {@code TRANSLUCENT} if at least one of the
* colors used by this {@code Paint} object is not opaque.
* @see java.awt.Transparency * @see java.awt.Transparency
*/ */
public final int getTransparency() { public final int getTransparency() {
......
...@@ -71,8 +71,24 @@ import java.beans.ConstructorProperties; ...@@ -71,8 +71,24 @@ import java.beans.ConstructorProperties;
* </pre> * </pre>
* *
* <p> * <p>
* The user may also select what action the {@code RadialGradientPaint} * The user may also select what action the {@code RadialGradientPaint} object
* should take when filling color outside the bounds of the circle's radius. * takes when it is filling the space outside the circle's radius by
* setting {@code CycleMethod} to either {@code REFLECTION} or {@code REPEAT}.
* The gradient color proportions are equal for any particular line drawn
* from the focus point. The following figure shows that the distance AB
* is equal to the distance BC, and the distance AD is equal to the distance DE.
* <center>
* <img src = "doc-files/RadialGradientPaint-3.png">
* </center>
* If the gradient and graphics rendering transforms are uniformly scaled and
* the user sets the focus so that it coincides with the center of the circle,
* the gradient color proportions are equal for any line drawn from the center.
* The following figure shows the distances AB, BC, AD, and DE. They are all equal.
* <center>
* <img src = "doc-files/RadialGradientPaint-4.png">
* </center>
* Note that some minor variations in distances may occur due to sampling at
* the granularity of a pixel.
* If no cycle method is specified, {@code NO_CYCLE} will be chosen by * If no cycle method is specified, {@code NO_CYCLE} will be chosen by
* default, which means the the last keyframe color will be used to fill the * default, which means the the last keyframe color will be used to fill the
* remaining area. * remaining area.
...@@ -604,7 +620,7 @@ public final class RadialGradientPaint extends MultipleGradientPaint { ...@@ -604,7 +620,7 @@ public final class RadialGradientPaint extends MultipleGradientPaint {
} }
/** /**
* Returns a copy of the end point of the gradient axis. * Returns a copy of the focus point of the radial gradient.
* *
* @return a {@code Point2D} object that is a copy of the focus point * @return a {@code Point2D} object that is a copy of the focus point
*/ */
......
...@@ -40,6 +40,8 @@ import sun.awt.AppContext; ...@@ -40,6 +40,8 @@ import sun.awt.AppContext;
import sun.awt.SunToolkit; import sun.awt.SunToolkit;
import sun.awt.HeadlessToolkit; import sun.awt.HeadlessToolkit;
import java.util.EventObject; import java.util.EventObject;
import java.security.AccessControlContext;
import java.security.AccessController;
/** /**
* A <code>TrayIcon</code> object represents a tray icon that can be * A <code>TrayIcon</code> object represents a tray icon that can be
...@@ -90,6 +92,7 @@ import java.util.EventObject; ...@@ -90,6 +92,7 @@ import java.util.EventObject;
* @author Anton Tarasov * @author Anton Tarasov
*/ */
public class TrayIcon { public class TrayIcon {
private Image image; private Image image;
private String tooltip; private String tooltip;
private PopupMenu popup; private PopupMenu popup;
...@@ -103,6 +106,24 @@ public class TrayIcon { ...@@ -103,6 +106,24 @@ public class TrayIcon {
transient MouseMotionListener mouseMotionListener; transient MouseMotionListener mouseMotionListener;
transient ActionListener actionListener; transient ActionListener actionListener;
/*
* The tray icon's AccessControlContext.
*
* Unlike the acc in Component, this field is made final
* because TrayIcon is not serializable.
*/
private final AccessControlContext acc = AccessController.getContext();
/*
* Returns the acc this tray icon was constructed with.
*/
final AccessControlContext getAccessControlContext() {
if (acc == null) {
throw new SecurityException("TrayIcon is missing AccessControlContext");
}
return acc;
}
static { static {
Toolkit.loadLibraries(); Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) { if (!GraphicsEnvironment.isHeadless()) {
......
...@@ -343,8 +343,13 @@ public abstract class PackedColorModel extends ColorModel { ...@@ -343,8 +343,13 @@ public abstract class PackedColorModel extends ColorModel {
if (bitMasks.length != maskArray.length) { if (bitMasks.length != maskArray.length) {
return false; return false;
} }
/* compare 'effective' masks only, i.e. only part of the mask
* which fits the capacity of the transfer type.
*/
int maxMask = (int)((1L << DataBuffer.getDataTypeSize(transferType)) - 1);
for (int i=0; i < bitMasks.length; i++) { for (int i=0; i < bitMasks.length; i++) {
if (bitMasks[i] != maskArray[i]) { if ((maxMask & bitMasks[i]) != (maxMask & maskArray[i])) {
return false; return false;
} }
} }
......
...@@ -35,7 +35,7 @@ import sun.reflect.misc.*; ...@@ -35,7 +35,7 @@ import sun.reflect.misc.*;
* is the delegate used by default for classes about * is the delegate used by default for classes about
* which no information is available. The <code>DefaultPersistenceDelegate</code> * which no information is available. The <code>DefaultPersistenceDelegate</code>
* provides, version resilient, public API-based persistence for * provides, version resilient, public API-based persistence for
* classes that follow the JavaBeans conventions without any class specific * classes that follow the JavaBeans&trade; conventions without any class specific
* configuration. * configuration.
* <p> * <p>
* The key assumptions are that the class has a nullary constructor * The key assumptions are that the class has a nullary constructor
......
...@@ -31,7 +31,7 @@ package java.beans; ...@@ -31,7 +31,7 @@ package java.beans;
* of java.beans.beancontext.BeanContext, in order to propagate to its nested hierarchy * of java.beans.beancontext.BeanContext, in order to propagate to its nested hierarchy
* of java.beans.beancontext.BeanContextChild instances, the current "designTime" property. * of java.beans.beancontext.BeanContextChild instances, the current "designTime" property.
* <p> * <p>
* The JavaBeans specification defines the notion of design time as is a * The JavaBeans&trade; specification defines the notion of design time as is a
* mode in which JavaBeans instances should function during their composition * mode in which JavaBeans instances should function during their composition
* and customization in a interactive design, composition or construction tool, * and customization in a interactive design, composition or construction tool,
* as opposed to runtime when the JavaBean is part of an applet, application, * as opposed to runtime when the JavaBean is part of an applet, application,
......
...@@ -26,7 +26,7 @@ package java.beans; ...@@ -26,7 +26,7 @@ package java.beans;
/** /**
* An "IndexedPropertyChange" event gets delivered whenever a component that * An "IndexedPropertyChange" event gets delivered whenever a component that
* conforms to the JavaBeans<TM> specification (a "bean") changes a bound * conforms to the JavaBeans&trade; specification (a "bean") changes a bound
* indexed property. This class is an extension of <code>PropertyChangeEvent</code> * indexed property. This class is an extension of <code>PropertyChangeEvent</code>
* but contains the index of the property that has changed. * but contains the index of the property that has changed.
* <P> * <P>
......
...@@ -87,7 +87,7 @@ import sun.reflect.misc.ReflectUtil; ...@@ -87,7 +87,7 @@ import sun.reflect.misc.ReflectUtil;
* <p> * <p>
* For more information about introspection and design patterns, please * For more information about introspection and design patterns, please
* consult the * consult the
* <a href="http://java.sun.com/products/javabeans/docs/index.html">JavaBeans specification</a>. * <a href="http://java.sun.com/products/javabeans/docs/index.html">JavaBeans&trade; specification</a>.
*/ */
public class Introspector { public class Introspector {
...@@ -1245,7 +1245,7 @@ public class Introspector { ...@@ -1245,7 +1245,7 @@ public class Introspector {
try { try {
type = ClassFinder.findClass(name, type.getClassLoader()); type = ClassFinder.findClass(name, type.getClassLoader());
// Each customizer should inherit java.awt.Component and implement java.beans.Customizer // Each customizer should inherit java.awt.Component and implement java.beans.Customizer
// according to the section 9.3 of JavaBeans specification // according to the section 9.3 of JavaBeans&trade; specification
if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) { if (Component.class.isAssignableFrom(type) && Customizer.class.isAssignableFrom(type)) {
return type; return type;
} }
......
...@@ -474,7 +474,7 @@ public class VetoableChangeSupport implements Serializable { ...@@ -474,7 +474,7 @@ public class VetoableChangeSupport implements Serializable {
/** /**
* @serialField children Hashtable * @serialField children Hashtable
* @serialField source Object * @serialField source Object
* @serialField propertyChangeSupportSerializedDataVersion int * @serialField vetoableChangeSupportSerializedDataVersion int
*/ */
private static final ObjectStreamField[] serialPersistentFields = { private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("children", Hashtable.class), new ObjectStreamField("children", Hashtable.class),
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
Contains classes related to developing Contains classes related to developing
<em>beans</em> -- components <em>beans</em> -- components
based on the JavaBeans<sup><font size=-2>TM</font></sup> architecture. based on the JavaBeans&trade; architecture.
A few of the A few of the
classes are used by beans while they run in an application. classes are used by beans while they run in an application.
For example, the event classes are For example, the event classes are
......
/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.dyn;
import java.dyn.MethodHandles.Lookup;
import java.util.WeakHashMap;
import sun.dyn.Access;
import sun.dyn.MethodHandleImpl;
import sun.dyn.util.VerifyAccess;
import sun.reflect.Reflection;
import static sun.dyn.MemberName.newIllegalArgumentException;
/**
* <em>CLASS WILL BE REMOVED FOR PFD:</em>
* Static routines for controlling invokedynamic behavior.
* Replaced by non-static APIs.
* @author John Rose, JSR 292 EG
* @deprecated This class will be removed in the Public Final Draft.
*/
public class Linkage {
private static final Access IMPL_TOKEN = Access.getToken();
private Linkage() {} // do not instantiate
/**
* <em>METHOD WILL BE REMOVED FOR PFD:</em>
* Register a <em>bootstrap method</em> to use when linking dynamic call sites within
* a given caller class.
* @deprecated Use @{@link BootstrapMethod} annotations instead.
*/
public static
void registerBootstrapMethod(Class callerClass, MethodHandle bootstrapMethod) {
Class callc = Reflection.getCallerClass(2);
if (callc != null && !VerifyAccess.isSamePackage(callerClass, callc))
throw new IllegalArgumentException("cannot set bootstrap method on "+callerClass);
MethodHandleImpl.registerBootstrap(IMPL_TOKEN, callerClass, bootstrapMethod);
}
/**
* <em>METHOD WILL BE REMOVED FOR PFD:</em>
* Simplified version of {@code registerBootstrapMethod} for self-registration,
* to be called from a static initializer.
* @deprecated Use @{@link BootstrapMethod} annotations instead.
*/
public static
void registerBootstrapMethod(Class<?> runtime, String name) {
Class callerClass = Reflection.getCallerClass(2);
registerBootstrapMethodLookup(callerClass, runtime, name);
}
/**
* <em>METHOD WILL BE REMOVED FOR PFD:</em>
* Simplified version of {@code registerBootstrapMethod} for self-registration,
* @deprecated Use @{@link BootstrapMethod} annotations instead.
*/
public static
void registerBootstrapMethod(String name) {
Class callerClass = Reflection.getCallerClass(2);
registerBootstrapMethodLookup(callerClass, callerClass, name);
}
private static
void registerBootstrapMethodLookup(Class<?> callerClass, Class<?> runtime, String name) {
Lookup lookup = new Lookup(IMPL_TOKEN, callerClass);
MethodHandle bootstrapMethod;
try {
bootstrapMethod = lookup.findStatic(runtime, name, BOOTSTRAP_METHOD_TYPE);
} catch (ReflectiveOperationException ex) {
throw new IllegalArgumentException("no such bootstrap method in "+runtime+": "+name, ex);
}
MethodHandleImpl.registerBootstrap(IMPL_TOKEN, callerClass, bootstrapMethod);
}
private static final MethodType BOOTSTRAP_METHOD_TYPE
= MethodType.methodType(CallSite.class,
Class.class, String.class, MethodType.class);
/**
* <em>METHOD WILL BE REMOVED FOR PFD:</em>
* Invalidate all <code>invokedynamic</code> call sites everywhere.
* @deprecated Use {@linkplain MutableCallSite#setTarget call site target setting},
* {@link MutableCallSite#syncAll call site update pushing},
* and {@link SwitchPoint#guardWithTest target switching} instead.
*/
public static
Object invalidateAll() {
throw new UnsupportedOperationException();
}
/**
* <em>METHOD WILL BE REMOVED FOR PFD:</em>
* Invalidate all {@code invokedynamic} call sites in the bytecodes
* of any methods of the given class.
* @deprecated Use {@linkplain MutableCallSite#setTarget call site target setting},
* {@link MutableCallSite#syncAll call site update pushing},
* and {@link SwitchPoint#guardWithTest target switching} instead.
*/
public static
Object invalidateCallerClass(Class<?> callerClass) {
throw new UnsupportedOperationException();
}
}
/* /*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,58 +23,56 @@ ...@@ -23,58 +23,56 @@
* questions. * questions.
*/ */
package java.dyn; package java.lang;
/** /**
* Thrown to indicate that an {@code invokedynamic} instruction has * Thrown to indicate that an {@code invokedynamic} instruction has
* failed to find its * failed to find its bootstrap method,
* {@linkplain BootstrapMethod bootstrap method}, * or the bootstrap method has failed to provide a
* or the bootstrap method has * {@linkplain java.lang.invoke.CallSite call site} with a {@linkplain java.lang.invoke.CallSite#getTarget target}
* failed to provide a * of the correct {@linkplain java.lang.invoke.MethodHandle#type method type}.
* {@linkplain CallSite call site} with a {@linkplain CallSite#getTarget target}
* of the correct {@linkplain MethodHandle#type method type}.
* *
* @author John Rose, JSR 292 EG * @author John Rose, JSR 292 EG
* @since 1.7 * @since 1.7
*/ */
public class InvokeDynamicBootstrapError extends LinkageError { public class BootstrapMethodError extends LinkageError {
private static final long serialVersionUID = 292L; private static final long serialVersionUID = 292L;
/** /**
* Constructs an {@code InvokeDynamicBootstrapError} with no detail message. * Constructs an {@code BootstrapMethodError} with no detail message.
*/ */
public InvokeDynamicBootstrapError() { public BootstrapMethodError() {
super(); super();
} }
/** /**
* Constructs an {@code InvokeDynamicBootstrapError} with the specified * Constructs an {@code BootstrapMethodError} with the specified
* detail message. * detail message.
* *
* @param s the detail message. * @param s the detail message.
*/ */
public InvokeDynamicBootstrapError(String s) { public BootstrapMethodError(String s) {
super(s); super(s);
} }
/** /**
* Constructs a {@code InvokeDynamicBootstrapError} with the specified * Constructs a {@code BootstrapMethodError} with the specified
* detail message and cause. * detail message and cause.
* *
* @param s the detail message. * @param s the detail message.
* @param cause the cause, may be {@code null}. * @param cause the cause, may be {@code null}.
*/ */
public InvokeDynamicBootstrapError(String s, Throwable cause) { public BootstrapMethodError(String s, Throwable cause) {
super(s, cause); super(s, cause);
} }
/** /**
* Constructs a {@code InvokeDynamicBootstrapError} with the specified * Constructs a {@code BootstrapMethodError} with the specified
* cause. * cause.
* *
* @param cause the cause, may be {@code null}. * @param cause the cause, may be {@code null}.
*/ */
public InvokeDynamicBootstrapError(Throwable cause) { public BootstrapMethodError(Throwable cause) {
// cf. Throwable(Throwable cause) constructor. // cf. Throwable(Throwable cause) constructor.
super(cause == null ? null : cause.toString()); super(cause == null ? null : cause.toString());
initCause(cause); initCause(cause);
......
...@@ -23,12 +23,10 @@ ...@@ -23,12 +23,10 @@
* questions. * questions.
*/ */
package java.dyn; package java.lang;
import java.util.WeakHashMap; import java.util.WeakHashMap;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicReference;
import java.lang.reflect.UndeclaredThrowableException;
/** /**
* Lazily associate a computed value with (potentially) every type. * Lazily associate a computed value with (potentially) every type.
...@@ -37,10 +35,11 @@ import java.lang.reflect.UndeclaredThrowableException; ...@@ -37,10 +35,11 @@ import java.lang.reflect.UndeclaredThrowableException;
* it can use a {@code ClassValue} to cache information needed to * it can use a {@code ClassValue} to cache information needed to
* perform the message send quickly, for each class encountered. * perform the message send quickly, for each class encountered.
* @author John Rose, JSR 292 EG * @author John Rose, JSR 292 EG
* @since 1.7
*/ */
public abstract class ClassValue<T> { public abstract class ClassValue<T> {
/** /**
* Compute the given class's derived value for this {@code ClassValue}. * Computes the given class's derived value for this {@code ClassValue}.
* <p> * <p>
* This method will be invoked within the first thread that accesses * This method will be invoked within the first thread that accesses
* the value with the {@link #get get} method. * the value with the {@link #get get} method.
...@@ -159,13 +158,7 @@ public abstract class ClassValue<T> { ...@@ -159,13 +158,7 @@ public abstract class ClassValue<T> {
} }
/// Implementation... /// Implementation...
// FIXME: Use a data structure here similar that of ThreadLocal (7030453).
// The hash code for this type is based on the identity of the object,
// and is well-dispersed for power-of-two tables.
/** @deprecated This override, which is implementation-specific, will be removed for PFD. */
public final int hashCode() { return hashCode; }
private final int hashCode = HASH_CODES.getAndAdd(0x61c88647);
private static final AtomicInteger HASH_CODES = new AtomicInteger();
private static final AtomicInteger STORE_BARRIER = new AtomicInteger(); private static final AtomicInteger STORE_BARRIER = new AtomicInteger();
......
/* /*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,15 +23,11 @@ ...@@ -23,15 +23,11 @@
* questions. * questions.
*/ */
package sun.dyn; package java.lang.invoke;
import sun.dyn.util.VerifyType; import sun.invoke.util.VerifyType;
import sun.dyn.util.Wrapper; import sun.invoke.util.Wrapper;
import java.dyn.*; import static java.lang.invoke.MethodHandleStatics.*;
import java.util.List;
import sun.dyn.MethodHandleNatives.Constants;
import static sun.dyn.MethodHandleImpl.IMPL_LOOKUP;
import static sun.dyn.MemberName.newIllegalArgumentException;
/** /**
* The flavor of method handle which emulates an invoke instruction * The flavor of method handle which emulates an invoke instruction
...@@ -39,37 +35,29 @@ import static sun.dyn.MemberName.newIllegalArgumentException; ...@@ -39,37 +35,29 @@ import static sun.dyn.MemberName.newIllegalArgumentException;
* when the handle is created, not when it is invoked. * when the handle is created, not when it is invoked.
* @author jrose * @author jrose
*/ */
public class BoundMethodHandle extends MethodHandle { class BoundMethodHandle extends MethodHandle {
//MethodHandle vmtarget; // next BMH or final DMH or methodOop //MethodHandle vmtarget; // next BMH or final DMH or methodOop
private final Object argument; // argument to insert private final Object argument; // argument to insert
private final int vmargslot; // position at which it is inserted private final int vmargslot; // position at which it is inserted
private static final Access IMPL_TOKEN = Access.getToken();
private static final MemberName.Factory IMPL_NAMES = MemberName.getFactory(IMPL_TOKEN);
// Constructors in this class *must* be package scoped or private. // Constructors in this class *must* be package scoped or private.
/** Bind a direct MH to its receiver (or first ref. argument). /** Bind a direct MH to its receiver (or first ref. argument).
* The JVM will pre-dispatch the MH if it is not already static. * The JVM will pre-dispatch the MH if it is not already static.
*/ */
BoundMethodHandle(DirectMethodHandle mh, Object argument) { /*non-public*/ BoundMethodHandle(DirectMethodHandle mh, Object argument) {
super(Access.TOKEN, mh.type().dropParameterTypes(0, 1)); super(mh.type().dropParameterTypes(0, 1));
// check the type now, once for all: // check the type now, once for all:
this.argument = checkReferenceArgument(argument, mh, 0); this.argument = checkReferenceArgument(argument, mh, 0);
this.vmargslot = this.type().parameterSlotCount(); this.vmargslot = this.type().parameterSlotCount();
if (MethodHandleNatives.JVM_SUPPORT) { initTarget(mh, 0);
this.vmtarget = null; // maybe updated by JVM
MethodHandleNatives.init(this, mh, 0);
} else {
this.vmtarget = mh;
}
} }
/** Insert an argument into an arbitrary method handle. /** Insert an argument into an arbitrary method handle.
* If argnum is zero, inserts the first argument, etc. * If argnum is zero, inserts the first argument, etc.
* The argument type must be a reference. * The argument type must be a reference.
*/ */
BoundMethodHandle(MethodHandle mh, Object argument, int argnum) { /*non-public*/ BoundMethodHandle(MethodHandle mh, Object argument, int argnum) {
this(mh.type().dropParameterTypes(argnum, argnum+1), this(mh.type().dropParameterTypes(argnum, argnum+1),
mh, argument, argnum); mh, argument, argnum);
} }
...@@ -77,8 +65,8 @@ public class BoundMethodHandle extends MethodHandle { ...@@ -77,8 +65,8 @@ public class BoundMethodHandle extends MethodHandle {
/** Insert an argument into an arbitrary method handle. /** Insert an argument into an arbitrary method handle.
* If argnum is zero, inserts the first argument, etc. * If argnum is zero, inserts the first argument, etc.
*/ */
BoundMethodHandle(MethodType type, MethodHandle mh, Object argument, int argnum) { /*non-public*/ BoundMethodHandle(MethodType type, MethodHandle mh, Object argument, int argnum) {
super(Access.TOKEN, type); super(type);
if (mh.type().parameterType(argnum).isPrimitive()) if (mh.type().parameterType(argnum).isPrimitive())
this.argument = bindPrimitiveArgument(argument, mh, argnum); this.argument = bindPrimitiveArgument(argument, mh, argnum);
else { else {
...@@ -89,18 +77,14 @@ public class BoundMethodHandle extends MethodHandle { ...@@ -89,18 +77,14 @@ public class BoundMethodHandle extends MethodHandle {
} }
private void initTarget(MethodHandle mh, int argnum) { private void initTarget(MethodHandle mh, int argnum) {
if (MethodHandleNatives.JVM_SUPPORT) { //this.vmtarget = mh; // maybe updated by JVM
this.vmtarget = null; // maybe updated by JVM MethodHandleNatives.init(this, mh, argnum);
MethodHandleNatives.init(this, mh, argnum);
} else {
this.vmtarget = mh;
}
} }
/** For the AdapterMethodHandle subclass. /** For the AdapterMethodHandle subclass.
*/ */
BoundMethodHandle(MethodType type, Object argument, int vmargslot) { /*non-public*/ BoundMethodHandle(MethodType type, Object argument, int vmargslot) {
super(Access.TOKEN, type); super(type);
this.argument = argument; this.argument = argument;
this.vmargslot = vmargslot; this.vmargslot = vmargslot;
assert(this instanceof AdapterMethodHandle); assert(this instanceof AdapterMethodHandle);
...@@ -112,8 +96,8 @@ public class BoundMethodHandle extends MethodHandle { ...@@ -112,8 +96,8 @@ public class BoundMethodHandle extends MethodHandle {
* same as {@code entryPoint}, except that the first argument * same as {@code entryPoint}, except that the first argument
* type will be dropped. * type will be dropped.
*/ */
protected BoundMethodHandle(Access token, MethodHandle entryPoint) { /*non-public*/ BoundMethodHandle(MethodHandle entryPoint) {
super(token, entryPoint.type().dropParameterTypes(0, 1)); super(entryPoint.type().dropParameterTypes(0, 1));
this.argument = this; // kludge; get rid of this.argument = this; // kludge; get rid of
this.vmargslot = this.type().parameterSlotDepth(0); this.vmargslot = this.type().parameterSlotDepth(0);
initTarget(entryPoint, 0); initTarget(entryPoint, 0);
...@@ -172,7 +156,7 @@ public class BoundMethodHandle extends MethodHandle { ...@@ -172,7 +156,7 @@ public class BoundMethodHandle extends MethodHandle {
@Override @Override
public String toString() { public String toString() {
return MethodHandleImpl.addTypeString(baseName(), this); return addTypeString(baseName(), this);
} }
/** Component of toString() before the type string. */ /** Component of toString() before the type string. */
......
...@@ -23,12 +23,12 @@ ...@@ -23,12 +23,12 @@
* questions. * questions.
*/ */
package java.dyn; package java.lang.invoke;
import sun.dyn.*; import sun.invoke.empty.Empty;
import sun.dyn.empty.Empty;
import sun.misc.Unsafe; import sun.misc.Unsafe;
import java.util.Collection; import static java.lang.invoke.MethodHandleStatics.*;
import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
/** /**
* A {@code CallSite} is a holder for a variable {@link MethodHandle}, * A {@code CallSite} is a holder for a variable {@link MethodHandle},
...@@ -85,7 +85,6 @@ private static CallSite bootstrapDynamic(MethodHandles.Lookup caller, String nam ...@@ -85,7 +85,6 @@ private static CallSite bootstrapDynamic(MethodHandles.Lookup caller, String nam
*/ */
abstract abstract
public class CallSite { public class CallSite {
private static final Access IMPL_TOKEN = Access.getToken();
static { MethodHandleImpl.initStatics(); } static { MethodHandleImpl.initStatics(); }
// Fields used only by the JVM. Do not use or change. // Fields used only by the JVM. Do not use or change.
...@@ -96,9 +95,6 @@ public class CallSite { ...@@ -96,9 +95,6 @@ public class CallSite {
/*package-private*/ /*package-private*/
MethodHandle target; MethodHandle target;
// Remove this field for PFD and delete deprecated methods:
private MemberName calleeNameRemoveForPFD;
/** /**
* Make a blank call site object with the given method type. * Make a blank call site object with the given method type.
* An initial target method is supplied which will throw * An initial target method is supplied which will throw
...@@ -111,7 +107,7 @@ public class CallSite { ...@@ -111,7 +107,7 @@ public class CallSite {
*/ */
/*package-private*/ /*package-private*/
CallSite(MethodType type) { CallSite(MethodType type) {
target = MethodHandles.invokers(type).uninitializedCallSite(); target = type.invokers().uninitializedCallSite();
} }
/** /**
...@@ -145,7 +141,7 @@ public class CallSite { ...@@ -145,7 +141,7 @@ public class CallSite {
int callerBCI) { int callerBCI) {
if (this.vmmethod != null) { if (this.vmmethod != null) {
// FIXME // FIXME
throw new InvokeDynamicBootstrapError("call site has already been linked to an invokedynamic instruction"); throw new BootstrapMethodError("call site has already been linked to an invokedynamic instruction");
} }
if (!this.type().equals(type)) { if (!this.type().equals(type)) {
throw wrongTargetType(target, type); throw wrongTargetType(target, type);
...@@ -202,7 +198,7 @@ public class CallSite { ...@@ -202,7 +198,7 @@ public class CallSite {
} }
/** /**
* Produce a method handle equivalent to an invokedynamic instruction * Produces a method handle equivalent to an invokedynamic instruction
* which has been linked to this call site. * which has been linked to this call site.
* <p> * <p>
* This method is equivalent to the following code: * This method is equivalent to the following code:
...@@ -218,7 +214,7 @@ public class CallSite { ...@@ -218,7 +214,7 @@ public class CallSite {
public abstract MethodHandle dynamicInvoker(); public abstract MethodHandle dynamicInvoker();
/*non-public*/ MethodHandle makeDynamicInvoker() { /*non-public*/ MethodHandle makeDynamicInvoker() {
MethodHandle getTarget = MethodHandleImpl.bindReceiver(IMPL_TOKEN, GET_TARGET, this); MethodHandle getTarget = MethodHandleImpl.bindReceiver(GET_TARGET, this);
MethodHandle invoker = MethodHandles.exactInvoker(this.type()); MethodHandle invoker = MethodHandles.exactInvoker(this.type());
return MethodHandles.foldArguments(invoker, getTarget); return MethodHandles.foldArguments(invoker, getTarget);
} }
...@@ -226,7 +222,7 @@ public class CallSite { ...@@ -226,7 +222,7 @@ public class CallSite {
private static final MethodHandle GET_TARGET; private static final MethodHandle GET_TARGET;
static { static {
try { try {
GET_TARGET = MethodHandles.Lookup.IMPL_LOOKUP. GET_TARGET = IMPL_LOOKUP.
findVirtual(CallSite.class, "getTarget", MethodType.methodType(MethodHandle.class)); findVirtual(CallSite.class, "getTarget", MethodType.methodType(MethodHandle.class));
} catch (ReflectiveOperationException ignore) { } catch (ReflectiveOperationException ignore) {
throw new InternalError(); throw new InternalError();
...@@ -252,7 +248,6 @@ public class CallSite { ...@@ -252,7 +248,6 @@ public class CallSite {
/*package-private*/ /*package-private*/
void setTargetNormal(MethodHandle newTarget) { void setTargetNormal(MethodHandle newTarget) {
target = newTarget; target = newTarget;
//CallSiteImpl.setCallSiteTarget(IMPL_TOKEN, this, newTarget);
} }
/*package-private*/ /*package-private*/
MethodHandle getTargetVolatile() { MethodHandle getTargetVolatile() {
...@@ -261,6 +256,68 @@ public class CallSite { ...@@ -261,6 +256,68 @@ public class CallSite {
/*package-private*/ /*package-private*/
void setTargetVolatile(MethodHandle newTarget) { void setTargetVolatile(MethodHandle newTarget) {
unsafe.putObjectVolatile(this, TARGET_OFFSET, newTarget); unsafe.putObjectVolatile(this, TARGET_OFFSET, newTarget);
//CallSiteImpl.setCallSiteTarget(IMPL_TOKEN, this, newTarget); }
// this implements the upcall from the JVM, MethodHandleNatives.makeDynamicCallSite:
static CallSite makeSite(MethodHandle bootstrapMethod,
// Callee information:
String name, MethodType type,
// Extra arguments for BSM, if any:
Object info,
// Caller information:
MemberName callerMethod, int callerBCI) {
Class<?> callerClass = callerMethod.getDeclaringClass();
Object caller = IMPL_LOOKUP.in(callerClass);
CallSite site;
try {
Object binding;
info = maybeReBox(info);
if (info == null) {
binding = bootstrapMethod.invokeGeneric(caller, name, type);
} else if (!info.getClass().isArray()) {
binding = bootstrapMethod.invokeGeneric(caller, name, type, info);
} else {
Object[] argv = (Object[]) info;
maybeReBoxElements(argv);
if (3 + argv.length > 255)
throw new BootstrapMethodError("too many bootstrap method arguments");
MethodType bsmType = bootstrapMethod.type();
if (bsmType.parameterCount() == 4 && bsmType.parameterType(3) == Object[].class)
binding = bootstrapMethod.invokeGeneric(caller, name, type, argv);
else
binding = MethodHandles.spreadInvoker(bsmType, 3)
.invokeGeneric(bootstrapMethod, caller, name, type, argv);
}
//System.out.println("BSM for "+name+type+" => "+binding);
if (binding instanceof CallSite) {
site = (CallSite) binding;
} else {
throw new ClassCastException("bootstrap method failed to produce a CallSite");
}
assert(site.getTarget() != null);
assert(site.getTarget().type().equals(type));
} catch (Throwable ex) {
BootstrapMethodError bex;
if (ex instanceof BootstrapMethodError)
bex = (BootstrapMethodError) ex;
else
bex = new BootstrapMethodError("call site initialization exception", ex);
throw bex;
}
return site;
}
private static Object maybeReBox(Object x) {
if (x instanceof Integer) {
int xi = (int) x;
if (xi == (byte) xi)
x = xi; // must rebox; see JLS 5.1.7
}
return x;
}
private static void maybeReBoxElements(Object[] xa) {
for (int i = 0; i < xa.length; i++) {
xa[i] = maybeReBox(xa[i]);
}
} }
} }
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* questions. * questions.
*/ */
package java.dyn; package java.lang.invoke;
/** /**
* A {@code ConstantCallSite} is a {@link CallSite} whose target is permanent, and can never be changed. * A {@code ConstantCallSite} is a {@link CallSite} whose target is permanent, and can never be changed.
......
/* /*
* Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,10 +23,9 @@ ...@@ -23,10 +23,9 @@
* questions. * questions.
*/ */
package sun.dyn; package java.lang.invoke;
import java.dyn.*; import static java.lang.invoke.MethodHandleNatives.Constants.*;
import static sun.dyn.MethodHandleNatives.Constants.*;
/** /**
* The flavor of method handle which emulates invokespecial or invokestatic. * The flavor of method handle which emulates invokespecial or invokestatic.
...@@ -39,7 +38,7 @@ class DirectMethodHandle extends MethodHandle { ...@@ -39,7 +38,7 @@ class DirectMethodHandle extends MethodHandle {
// Constructors in this class *must* be package scoped or private. // Constructors in this class *must* be package scoped or private.
DirectMethodHandle(MethodType mtype, MemberName m, boolean doDispatch, Class<?> lookupClass) { DirectMethodHandle(MethodType mtype, MemberName m, boolean doDispatch, Class<?> lookupClass) {
super(Access.TOKEN, mtype); super(mtype);
assert(m.isMethod() || !doDispatch && m.isConstructor()); assert(m.isMethod() || !doDispatch && m.isConstructor());
if (!m.isResolved()) if (!m.isResolved())
......
/* /*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,11 +23,11 @@ ...@@ -23,11 +23,11 @@
* questions. * questions.
*/ */
package sun.dyn; package java.lang.invoke;
import java.dyn.*;
import java.lang.reflect.*; import java.lang.reflect.*;
import static sun.dyn.MemberName.newIllegalArgumentException; import static java.lang.invoke.MethodHandleStatics.*;
import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
/** /**
* These adapters apply arbitrary conversions to arguments * These adapters apply arbitrary conversions to arguments
...@@ -123,7 +123,7 @@ class FilterGeneric { ...@@ -123,7 +123,7 @@ class FilterGeneric {
MethodType entryType = entryType(kind, pos, filterType, targetType); MethodType entryType = entryType(kind, pos, filterType, targetType);
if (entryType.generic() != entryType) if (entryType.generic() != entryType)
throw newIllegalArgumentException("must be generic: "+entryType); throw newIllegalArgumentException("must be generic: "+entryType);
MethodTypeImpl form = MethodTypeImpl.of(entryType); MethodTypeForm form = entryType.form();
FilterGeneric filterGen = form.filterGeneric; FilterGeneric filterGen = form.filterGeneric;
if (filterGen == null) if (filterGen == null)
form.filterGeneric = filterGen = new FilterGeneric(entryType); form.filterGeneric = filterGen = new FilterGeneric(entryType);
...@@ -186,7 +186,7 @@ class FilterGeneric { ...@@ -186,7 +186,7 @@ class FilterGeneric {
// see if it has the required invoke method // see if it has the required invoke method
MethodHandle entryPoint = null; MethodHandle entryPoint = null;
try { try {
entryPoint = MethodHandleImpl.IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls); entryPoint = IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls);
} catch (ReflectiveOperationException ex) { } catch (ReflectiveOperationException ex) {
} }
if (entryPoint == null) continue; if (entryPoint == null) continue;
...@@ -231,7 +231,7 @@ class FilterGeneric { ...@@ -231,7 +231,7 @@ class FilterGeneric {
@Override @Override
public String toString() { public String toString() {
return MethodHandleImpl.addTypeString(target, this); return addTypeString(target, this);
} }
protected boolean isPrototype() { return target == null; } protected boolean isPrototype() { return target == null; }
...@@ -246,7 +246,7 @@ class FilterGeneric { ...@@ -246,7 +246,7 @@ class FilterGeneric {
protected Adapter(MethodHandle entryPoint, protected Adapter(MethodHandle entryPoint,
MethodHandle filter, MethodHandle target) { MethodHandle filter, MethodHandle target) {
super(Access.TOKEN, entryPoint); super(entryPoint);
this.filter = filter; this.filter = filter;
this.target = target; this.target = target;
} }
...@@ -256,7 +256,7 @@ class FilterGeneric { ...@@ -256,7 +256,7 @@ class FilterGeneric {
MethodHandle filter, MethodHandle target); MethodHandle filter, MethodHandle target);
// { return new ThisType(entryPoint, filter, target); } // { return new ThisType(entryPoint, filter, target); }
static private final String CLASS_PREFIX; // "sun.dyn.FilterGeneric$" static private final String CLASS_PREFIX; // "java.lang.invoke.FilterGeneric$"
static { static {
String aname = Adapter.class.getName(); String aname = Adapter.class.getName();
String sname = Adapter.class.getSimpleName(); String sname = Adapter.class.getSimpleName();
......
/* /*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,10 +23,10 @@ ...@@ -23,10 +23,10 @@
* questions. * questions.
*/ */
package sun.dyn; package java.lang.invoke;
import java.dyn.*; import static java.lang.invoke.MethodHandleStatics.*;
import static sun.dyn.MemberName.uncaughtException; import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
/** /**
* Unary function composition, useful for many small plumbing jobs. * Unary function composition, useful for many small plumbing jobs.
...@@ -36,7 +36,7 @@ import static sun.dyn.MemberName.uncaughtException; ...@@ -36,7 +36,7 @@ import static sun.dyn.MemberName.uncaughtException;
* final method type is the responsibility of a JVM-level adapter. * final method type is the responsibility of a JVM-level adapter.
* @author jrose * @author jrose
*/ */
public class FilterOneArgument extends BoundMethodHandle { class FilterOneArgument extends BoundMethodHandle {
protected final MethodHandle filter; // Object -> Object protected final MethodHandle filter; // Object -> Object
protected final MethodHandle target; // Object -> Object protected final MethodHandle target; // Object -> Object
...@@ -54,15 +54,15 @@ public class FilterOneArgument extends BoundMethodHandle { ...@@ -54,15 +54,15 @@ public class FilterOneArgument extends BoundMethodHandle {
static { static {
try { try {
INVOKE = INVOKE =
MethodHandleImpl.IMPL_LOOKUP.findVirtual(FilterOneArgument.class, "invoke", IMPL_LOOKUP.findVirtual(FilterOneArgument.class, "invoke",
MethodType.genericMethodType(1)); MethodType.genericMethodType(1));
} catch (ReflectiveOperationException ex) { } catch (ReflectiveOperationException ex) {
throw uncaughtException(ex); throw uncaughtException(ex);
} }
} }
protected FilterOneArgument(MethodHandle filter, MethodHandle target) { protected FilterOneArgument(MethodHandle filter, MethodHandle target) {
super(Access.TOKEN, INVOKE); super(INVOKE);
this.filter = filter; this.filter = filter;
this.target = target; this.target = target;
} }
......
...@@ -23,12 +23,13 @@ ...@@ -23,12 +23,13 @@
* questions. * questions.
*/ */
package sun.dyn; package java.lang.invoke;
import java.dyn.*; import sun.invoke.util.ValueConversions;
import sun.invoke.util.Wrapper;
import java.lang.reflect.*; import java.lang.reflect.*;
import sun.dyn.util.*; import static java.lang.invoke.MethodHandleStatics.*;
import static sun.dyn.MethodTypeImpl.invokers; import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
/** /**
* Adapters which mediate between incoming calls which are generic * Adapters which mediate between incoming calls which are generic
...@@ -82,8 +83,8 @@ class FromGeneric { ...@@ -82,8 +83,8 @@ class FromGeneric {
} }
// outgoing primitive arguments will be wrapped; unwrap them // outgoing primitive arguments will be wrapped; unwrap them
MethodType primsAsObj = MethodTypeImpl.of(targetType).primArgsAsBoxes(); MethodType primsAsObj = targetType.form().primArgsAsBoxes();
MethodType objArgsRawRet = MethodTypeImpl.of(primsAsObj).primsAsInts(); MethodType objArgsRawRet = primsAsObj.form().primsAsInts();
if (objArgsRawRet != targetType) if (objArgsRawRet != targetType)
ad = findAdapter(internalType0 = objArgsRawRet); ad = findAdapter(internalType0 = objArgsRawRet);
if (ad == null) { if (ad == null) {
...@@ -129,16 +130,16 @@ class FromGeneric { ...@@ -129,16 +130,16 @@ class FromGeneric {
MethodType targetType, MethodType internalType) { MethodType targetType, MethodType internalType) {
// All the adapters we have here have reference-untyped internal calls. // All the adapters we have here have reference-untyped internal calls.
assert(internalType == internalType.erase()); assert(internalType == internalType.erase());
MethodHandle invoker = invokers(targetType).exactInvoker(); MethodHandle invoker = targetType.invokers().exactInvoker();
// cast all narrow reference types, unbox all primitive arguments: // cast all narrow reference types, unbox all primitive arguments:
MethodType fixArgsType = internalType.changeReturnType(targetType.returnType()); MethodType fixArgsType = internalType.changeReturnType(targetType.returnType());
MethodHandle fixArgs = AdapterMethodHandle.convertArguments(Access.TOKEN, MethodHandle fixArgs = MethodHandleImpl.convertArguments(
invoker, Invokers.invokerType(fixArgsType), invoker, Invokers.invokerType(fixArgsType),
invoker.type(), null); invoker.type(), null);
if (fixArgs == null) if (fixArgs == null)
throw new InternalError("bad fixArgs"); throw new InternalError("bad fixArgs");
// reinterpret the calling sequence as raw: // reinterpret the calling sequence as raw:
MethodHandle retyper = AdapterMethodHandle.makeRetypeRaw(Access.TOKEN, MethodHandle retyper = AdapterMethodHandle.makeRetypeRaw(
Invokers.invokerType(internalType), fixArgs); Invokers.invokerType(internalType), fixArgs);
if (retyper == null) if (retyper == null)
throw new InternalError("bad retyper"); throw new InternalError("bad retyper");
...@@ -171,7 +172,7 @@ class FromGeneric { ...@@ -171,7 +172,7 @@ class FromGeneric {
/** Return the adapter information for this type's erasure. */ /** Return the adapter information for this type's erasure. */
static FromGeneric of(MethodType type) { static FromGeneric of(MethodType type) {
MethodTypeImpl form = MethodTypeImpl.of(type); MethodTypeForm form = type.form();
FromGeneric fromGen = form.fromGeneric; FromGeneric fromGen = form.fromGeneric;
if (fromGen == null) if (fromGen == null)
form.fromGeneric = fromGen = new FromGeneric(form.erasedType()); form.fromGeneric = fromGen = new FromGeneric(form.erasedType());
...@@ -185,7 +186,7 @@ class FromGeneric { ...@@ -185,7 +186,7 @@ class FromGeneric {
/* Create an adapter that handles spreading calls for the given type. */ /* Create an adapter that handles spreading calls for the given type. */
static Adapter findAdapter(MethodType internalType) { static Adapter findAdapter(MethodType internalType) {
MethodType entryType = internalType.generic(); MethodType entryType = internalType.generic();
MethodTypeImpl form = MethodTypeImpl.of(internalType); MethodTypeForm form = internalType.form();
Class<?> rtype = internalType.returnType(); Class<?> rtype = internalType.returnType();
int argc = form.parameterCount(); int argc = form.parameterCount();
int lac = form.longPrimitiveParameterCount(); int lac = form.longPrimitiveParameterCount();
...@@ -203,7 +204,7 @@ class FromGeneric { ...@@ -203,7 +204,7 @@ class FromGeneric {
// see if it has the required invoke method // see if it has the required invoke method
MethodHandle entryPoint = null; MethodHandle entryPoint = null;
try { try {
entryPoint = MethodHandleImpl.IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls); entryPoint = IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls);
} catch (ReflectiveOperationException ex) { } catch (ReflectiveOperationException ex) {
} }
if (entryPoint == null) continue; if (entryPoint == null) continue;
...@@ -257,7 +258,7 @@ class FromGeneric { ...@@ -257,7 +258,7 @@ class FromGeneric {
@Override @Override
public String toString() { public String toString() {
return MethodHandleImpl.addTypeString(target, this); return addTypeString(target, this);
} }
protected boolean isPrototype() { return target == null; } protected boolean isPrototype() { return target == null; }
...@@ -272,7 +273,7 @@ class FromGeneric { ...@@ -272,7 +273,7 @@ class FromGeneric {
protected Adapter(MethodHandle entryPoint, protected Adapter(MethodHandle entryPoint,
MethodHandle invoker, MethodHandle convert, MethodHandle target) { MethodHandle invoker, MethodHandle convert, MethodHandle target) {
super(Access.TOKEN, entryPoint); super(entryPoint);
this.invoker = invoker; this.invoker = invoker;
this.convert = convert; this.convert = convert;
this.target = target; this.target = target;
...@@ -290,7 +291,7 @@ class FromGeneric { ...@@ -290,7 +291,7 @@ class FromGeneric {
protected Object convert_F(float result) throws Throwable { return convert.invokeExact(result); } protected Object convert_F(float result) throws Throwable { return convert.invokeExact(result); }
protected Object convert_D(double result) throws Throwable { return convert.invokeExact(result); } protected Object convert_D(double result) throws Throwable { return convert.invokeExact(result); }
static private final String CLASS_PREFIX; // "sun.dyn.FromGeneric$" static private final String CLASS_PREFIX; // "java.lang.invoke.FromGeneric$"
static { static {
String aname = Adapter.class.getName(); String aname = Adapter.class.getName();
String sname = Adapter.class.getSimpleName(); String sname = Adapter.class.getSimpleName();
......
/* /*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* questions. * questions.
*/ */
package java.dyn; package java.lang.invoke;
/** /**
* This is a place-holder class. Some HotSpot implementations need to see it. * This is a place-holder class. Some HotSpot implementations need to see it.
......
...@@ -23,15 +23,13 @@ ...@@ -23,15 +23,13 @@
* questions. * questions.
*/ */
package sun.dyn; package java.lang.invoke;
import java.dyn.*; import sun.invoke.util.*;
import java.lang.reflect.*; import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
import sun.dyn.util.*;
import static sun.dyn.MethodTypeImpl.invokers;
/** /**
* Adapters which manage MethodHanndle.invokeGeneric calls. * Adapters which manage MethodHandle.invokeGeneric calls.
* The JVM calls one of these when the exact type match fails. * The JVM calls one of these when the exact type match fails.
* @author jrose * @author jrose
*/ */
...@@ -44,7 +42,8 @@ class InvokeGeneric { ...@@ -44,7 +42,8 @@ class InvokeGeneric {
/** Compute and cache information for this adapter, so that it can /** Compute and cache information for this adapter, so that it can
* call out to targets of the erasure-family of the given erased type. * call out to targets of the erasure-family of the given erased type.
*/ */
private InvokeGeneric(MethodType erasedCallerType) throws ReflectiveOperationException { /*non-public*/ InvokeGeneric(MethodType erasedCallerType) throws ReflectiveOperationException {
assert(erasedCallerType.equals(erasedCallerType.erase()));
this.erasedCallerType = erasedCallerType; this.erasedCallerType = erasedCallerType;
this.initialInvoker = makeInitialInvoker(); this.initialInvoker = makeInitialInvoker();
assert initialInvoker.type().equals(erasedCallerType assert initialInvoker.type().equals(erasedCallerType
...@@ -53,22 +52,13 @@ class InvokeGeneric { ...@@ -53,22 +52,13 @@ class InvokeGeneric {
} }
private static MethodHandles.Lookup lookup() { private static MethodHandles.Lookup lookup() {
return MethodHandleImpl.IMPL_LOOKUP; return IMPL_LOOKUP;
} }
/** Return the adapter information for this type's erasure. */ /** Return the adapter information for this type's erasure. */
static MethodHandle genericInvokerOf(MethodType type) { /*non-public*/ static MethodHandle genericInvokerOf(MethodType erasedCallerType) throws ReflectiveOperationException {
MethodTypeImpl form = MethodTypeImpl.of(type); InvokeGeneric gen = new InvokeGeneric(erasedCallerType);
MethodHandle genericInvoker = form.genericInvoker; return gen.initialInvoker;
if (genericInvoker == null) {
try {
InvokeGeneric gen = new InvokeGeneric(form.erasedType());
form.genericInvoker = genericInvoker = gen.initialInvoker;
} catch (ReflectiveOperationException ex) {
throw new RuntimeException(ex);
}
}
return genericInvoker;
} }
private MethodHandle makeInitialInvoker() throws ReflectiveOperationException { private MethodHandle makeInitialInvoker() throws ReflectiveOperationException {
...@@ -88,7 +78,7 @@ class InvokeGeneric { ...@@ -88,7 +78,7 @@ class InvokeGeneric {
private MethodHandle makePostDispatchInvoker() { private MethodHandle makePostDispatchInvoker() {
// Take (MH'; MT, MH; A...) and run MH'(MT, MH; A...). // Take (MH'; MT, MH; A...) and run MH'(MT, MH; A...).
MethodType invokerType = erasedCallerType.insertParameterTypes(0, EXTRA_ARGS); MethodType invokerType = erasedCallerType.insertParameterTypes(0, EXTRA_ARGS);
return invokers(invokerType).exactInvoker(); return invokerType.invokers().exactInvoker();
} }
private MethodHandle dropDispatchArguments(MethodHandle targetInvoker) { private MethodHandle dropDispatchArguments(MethodHandle targetInvoker) {
assert(targetInvoker.type().parameterType(0) == MethodHandle.class); assert(targetInvoker.type().parameterType(0) == MethodHandle.class);
...@@ -112,7 +102,7 @@ class InvokeGeneric { ...@@ -112,7 +102,7 @@ class InvokeGeneric {
if (USE_AS_TYPE_PATH || target.isVarargsCollector()) { if (USE_AS_TYPE_PATH || target.isVarargsCollector()) {
MethodHandle newTarget = target.asType(callerType); MethodHandle newTarget = target.asType(callerType);
targetType = callerType; targetType = callerType;
Invokers invokers = MethodTypeImpl.invokers(Access.TOKEN, targetType); Invokers invokers = targetType.invokers();
MethodHandle invoker = invokers.erasedInvokerWithDrops; MethodHandle invoker = invokers.erasedInvokerWithDrops;
if (invoker == null) { if (invoker == null) {
invokers.erasedInvokerWithDrops = invoker = invokers.erasedInvokerWithDrops = invoker =
......
...@@ -23,16 +23,16 @@ ...@@ -23,16 +23,16 @@
* questions. * questions.
*/ */
package sun.dyn; package java.lang.invoke;
import java.dyn.*; import sun.invoke.empty.Empty;
import sun.dyn.empty.Empty; import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
/** /**
* Construction and caching of often-used invokers. * Construction and caching of often-used invokers.
* @author jrose * @author jrose
*/ */
public class Invokers { class Invokers {
// exact type (sans leading taget MH) for the outgoing call // exact type (sans leading taget MH) for the outgoing call
private final MethodType targetType; private final MethodType targetType;
...@@ -60,15 +60,15 @@ public class Invokers { ...@@ -60,15 +60,15 @@ public class Invokers {
this.spreadInvokers = new MethodHandle[targetType.parameterCount()+1]; this.spreadInvokers = new MethodHandle[targetType.parameterCount()+1];
} }
public static MethodType invokerType(MethodType targetType) { /*non-public*/ static MethodType invokerType(MethodType targetType) {
return targetType.insertParameterTypes(0, MethodHandle.class); return targetType.insertParameterTypes(0, MethodHandle.class);
} }
public MethodHandle exactInvoker() { /*non-public*/ MethodHandle exactInvoker() {
MethodHandle invoker = exactInvoker; MethodHandle invoker = exactInvoker;
if (invoker != null) return invoker; if (invoker != null) return invoker;
try { try {
invoker = MethodHandleImpl.IMPL_LOOKUP.findVirtual(MethodHandle.class, "invokeExact", targetType); invoker = IMPL_LOOKUP.findVirtual(MethodHandle.class, "invokeExact", targetType);
} catch (ReflectiveOperationException ex) { } catch (ReflectiveOperationException ex) {
throw new InternalError("JVM cannot find invoker for "+targetType); throw new InternalError("JVM cannot find invoker for "+targetType);
} }
...@@ -77,7 +77,7 @@ public class Invokers { ...@@ -77,7 +77,7 @@ public class Invokers {
return invoker; return invoker;
} }
public MethodHandle genericInvoker() { /*non-public*/ MethodHandle genericInvoker() {
MethodHandle invoker1 = exactInvoker(); MethodHandle invoker1 = exactInvoker();
MethodHandle invoker = genericInvoker; MethodHandle invoker = genericInvoker;
if (invoker != null) return invoker; if (invoker != null) return invoker;
...@@ -87,7 +87,7 @@ public class Invokers { ...@@ -87,7 +87,7 @@ public class Invokers {
return invoker; return invoker;
} }
public MethodHandle erasedInvoker() { /*non-public*/ MethodHandle erasedInvoker() {
MethodHandle invoker1 = exactInvoker(); MethodHandle invoker1 = exactInvoker();
MethodHandle invoker = erasedInvoker; MethodHandle invoker = erasedInvoker;
if (invoker != null) return invoker; if (invoker != null) return invoker;
...@@ -100,7 +100,7 @@ public class Invokers { ...@@ -100,7 +100,7 @@ public class Invokers {
return invoker; return invoker;
} }
public MethodHandle spreadInvoker(int objectArgCount) { /*non-public*/ MethodHandle spreadInvoker(int objectArgCount) {
MethodHandle vaInvoker = spreadInvokers[objectArgCount]; MethodHandle vaInvoker = spreadInvokers[objectArgCount];
if (vaInvoker != null) return vaInvoker; if (vaInvoker != null) return vaInvoker;
MethodHandle gInvoker = genericInvoker(); MethodHandle gInvoker = genericInvoker();
...@@ -111,12 +111,12 @@ public class Invokers { ...@@ -111,12 +111,12 @@ public class Invokers {
private static MethodHandle THROW_UCS = null; private static MethodHandle THROW_UCS = null;
public MethodHandle uninitializedCallSite() { /*non-public*/ MethodHandle uninitializedCallSite() {
MethodHandle invoker = uninitializedCallSite; MethodHandle invoker = uninitializedCallSite;
if (invoker != null) return invoker; if (invoker != null) return invoker;
if (targetType.parameterCount() > 0) { if (targetType.parameterCount() > 0) {
MethodType type0 = targetType.dropParameterTypes(0, targetType.parameterCount()); MethodType type0 = targetType.dropParameterTypes(0, targetType.parameterCount());
Invokers invokers0 = MethodTypeImpl.invokers(type0); Invokers invokers0 = type0.invokers();
invoker = MethodHandles.dropArguments(invokers0.uninitializedCallSite(), invoker = MethodHandles.dropArguments(invokers0.uninitializedCallSite(),
0, targetType.parameterList()); 0, targetType.parameterList());
assert(invoker.type().equals(targetType)); assert(invoker.type().equals(targetType));
...@@ -125,14 +125,14 @@ public class Invokers { ...@@ -125,14 +125,14 @@ public class Invokers {
} }
if (THROW_UCS == null) { if (THROW_UCS == null) {
try { try {
THROW_UCS = MethodHandleImpl.IMPL_LOOKUP THROW_UCS = IMPL_LOOKUP
.findStatic(CallSite.class, "uninitializedCallSite", .findStatic(CallSite.class, "uninitializedCallSite",
MethodType.methodType(Empty.class)); MethodType.methodType(Empty.class));
} catch (ReflectiveOperationException ex) { } catch (ReflectiveOperationException ex) {
throw new RuntimeException(ex); throw new RuntimeException(ex);
} }
} }
invoker = AdapterMethodHandle.makeRetypeRaw(Access.TOKEN, targetType, THROW_UCS); invoker = AdapterMethodHandle.makeRetypeRaw(targetType, THROW_UCS);
assert(invoker.type().equals(targetType)); assert(invoker.type().equals(targetType));
uninitializedCallSite = invoker; uninitializedCallSite = invoker;
return invoker; return invoker;
......
...@@ -23,10 +23,9 @@ ...@@ -23,10 +23,9 @@
* questions. * questions.
*/ */
package sun.dyn; package java.lang.invoke;
import sun.dyn.util.BytecodeDescriptor; import sun.invoke.util.BytecodeDescriptor;
import java.dyn.*;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
...@@ -37,7 +36,8 @@ import java.util.Arrays; ...@@ -37,7 +36,8 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import static sun.dyn.MethodHandleNatives.Constants.*; import static java.lang.invoke.MethodHandleNatives.Constants.*;
import static java.lang.invoke.MethodHandleStatics.*;
/** /**
* A {@code MemberName} is a compact symbolic datum which fully characterizes * A {@code MemberName} is a compact symbolic datum which fully characterizes
...@@ -66,7 +66,7 @@ import static sun.dyn.MethodHandleNatives.Constants.*; ...@@ -66,7 +66,7 @@ import static sun.dyn.MethodHandleNatives.Constants.*;
* and those seven fields omit much of the information in Method. * and those seven fields omit much of the information in Method.
* @author jrose * @author jrose
*/ */
public final class MemberName implements Member, Cloneable { /*non-public*/ final class MemberName implements Member, Cloneable {
private Class<?> clazz; // class in which the method is defined private Class<?> clazz; // class in which the method is defined
private String name; // may be null if not yet materialized private String name; // may be null if not yet materialized
private Object type; // may be null if not yet materialized private Object type; // may be null if not yet materialized
...@@ -435,7 +435,7 @@ public final class MemberName implements Member, Cloneable { ...@@ -435,7 +435,7 @@ public final class MemberName implements Member, Cloneable {
/** Query whether this member name is resolved to a non-static, non-final method. /** Query whether this member name is resolved to a non-static, non-final method.
*/ */
public boolean hasReceiverTypeDispatch() { public boolean hasReceiverTypeDispatch() {
return (isMethod() && getVMIndex(Access.TOKEN) >= 0); return (isMethod() && getVMIndex() >= 0);
} }
/** Produce a string form of this member name. /** Produce a string form of this member name.
...@@ -490,59 +490,38 @@ public final class MemberName implements Member, Cloneable { ...@@ -490,59 +490,38 @@ public final class MemberName implements Member, Cloneable {
// Queries to the JVM: // Queries to the JVM:
/** Document? */ /** Document? */
public int getVMIndex(Access token) { /*non-public*/ int getVMIndex() {
Access.check(token);
if (!isResolved()) if (!isResolved())
throw newIllegalStateException("not resolved"); throw newIllegalStateException("not resolved", this);
return vmindex; return vmindex;
} }
// public Object getVMTarget(Access token) { // /*non-public*/ Object getVMTarget() {
// Access.check(token);
// if (!isResolved()) // if (!isResolved())
// throw newIllegalStateException("not resolved"); // throw newIllegalStateException("not resolved", this);
// return vmtarget; // return vmtarget;
// } // }
private RuntimeException newIllegalStateException(String message) {
return new IllegalStateException(message+": "+this);
}
// handy shared exception makers (they simplify the common case code) public IllegalAccessException makeAccessException(String message, Object from) {
public static RuntimeException newIllegalArgumentException(String message) { message = message + ": "+ toString();
return new IllegalArgumentException(message);
}
public static IllegalAccessException newNoAccessException(MemberName name, Object from) {
return newNoAccessException("cannot access", name, from);
}
public static IllegalAccessException newNoAccessException(String message,
MemberName name, Object from) {
message += ": " + name;
if (from != null) message += ", from " + from; if (from != null) message += ", from " + from;
return new IllegalAccessException(message); return new IllegalAccessException(message);
} }
public static ReflectiveOperationException newNoAccessException(MemberName name) { public ReflectiveOperationException makeAccessException(String message) {
if (name.isResolved()) message = message + ": "+ toString();
return new IllegalAccessException(name.toString()); if (isResolved())
else if (name.isConstructor()) return new IllegalAccessException(message);
return new NoSuchMethodException(name.toString()); else if (isConstructor())
else if (name.isMethod()) return new NoSuchMethodException(message);
return new NoSuchMethodException(name.toString()); else if (isMethod())
return new NoSuchMethodException(message);
else else
return new NoSuchFieldException(name.toString()); return new NoSuchFieldException(message);
}
public static Error uncaughtException(Exception ex) {
Error err = new InternalError("uncaught exception");
err.initCause(ex);
return err;
} }
/** Actually making a query requires an access check. */ /** Actually making a query requires an access check. */
public static Factory getFactory(Access token) { /*non-public*/ static Factory getFactory() {
Access.check(token);
return Factory.INSTANCE; return Factory.INSTANCE;
} }
public static Factory getFactory() {
return getFactory(Access.getToken());
}
/** A factory type for resolving member names with the help of the VM. /** A factory type for resolving member names with the help of the VM.
* TBD: Define access-safe public constructors for this factory. * TBD: Define access-safe public constructors for this factory.
*/ */
...@@ -662,7 +641,7 @@ public final class MemberName implements Member, Cloneable { ...@@ -662,7 +641,7 @@ public final class MemberName implements Member, Cloneable {
MemberName result = resolveOrNull(m, searchSupers, lookupClass); MemberName result = resolveOrNull(m, searchSupers, lookupClass);
if (result != null) if (result != null)
return result; return result;
ReflectiveOperationException ex = newNoAccessException(m); ReflectiveOperationException ex = m.makeAccessException("no access");
if (ex instanceof IllegalAccessException) throw (IllegalAccessException) ex; if (ex instanceof IllegalAccessException) throw (IllegalAccessException) ex;
throw nsmClass.cast(ex); throw nsmClass.cast(ex);
} }
......
/* /*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,14 +23,13 @@ ...@@ -23,14 +23,13 @@
* questions. * questions.
*/ */
package sun.dyn; package java.lang.invoke;
import java.dyn.*; import java.lang.invoke.MethodHandles.Lookup;
import java.dyn.MethodHandles.Lookup;
import java.lang.reflect.AccessibleObject; import java.lang.reflect.AccessibleObject;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import static sun.dyn.MethodHandleNatives.Constants.*; import static java.lang.invoke.MethodHandleNatives.Constants.*;
import static sun.dyn.MethodHandleImpl.IMPL_LOOKUP; import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
/** /**
* The JVM interface for the method handles package is all here. * The JVM interface for the method handles package is all here.
...@@ -81,14 +80,12 @@ class MethodHandleNatives { ...@@ -81,14 +80,12 @@ class MethodHandleNatives {
* This routine is for debugging and reflection. * This routine is for debugging and reflection.
*/ */
static MemberName getMethodName(MethodHandle self) { static MemberName getMethodName(MethodHandle self) {
if (!JVM_SUPPORT) return null;
return (MemberName) getTarget(self, ETF_METHOD_NAME); return (MemberName) getTarget(self, ETF_METHOD_NAME);
} }
/** Fetch the reflective version of the handled method, if available. /** Fetch the reflective version of the handled method, if available.
*/ */
static AccessibleObject getTargetMethod(MethodHandle self) { static AccessibleObject getTargetMethod(MethodHandle self) {
if (!JVM_SUPPORT) return null;
return (AccessibleObject) getTarget(self, ETF_REFLECT_METHOD); return (AccessibleObject) getTarget(self, ETF_REFLECT_METHOD);
} }
...@@ -97,7 +94,6 @@ class MethodHandleNatives { ...@@ -97,7 +94,6 @@ class MethodHandleNatives {
* If it is chained to another method handle, return that handle. * If it is chained to another method handle, return that handle.
*/ */
static Object getTargetInfo(MethodHandle self) { static Object getTargetInfo(MethodHandle self) {
if (!JVM_SUPPORT) return null;
return getTarget(self, ETF_HANDLE_OR_METHOD_NAME); return getTarget(self, ETF_HANDLE_OR_METHOD_NAME);
} }
...@@ -111,11 +107,6 @@ class MethodHandleNatives { ...@@ -111,11 +107,6 @@ class MethodHandleNatives {
*/ */
static native int getConstant(int which); static native int getConstant(int which);
/** True iff this HotSpot JVM has built-in support for method handles.
* If false, some test cases might run, but functionality will be missing.
*/
public static final boolean JVM_SUPPORT;
/** Java copy of MethodHandlePushLimit in range 2..255. */ /** Java copy of MethodHandlePushLimit in range 2..255. */
static final int JVM_PUSH_LIMIT; static final int JVM_PUSH_LIMIT;
/** JVM stack motion (in words) after one slot is pushed, usually -1. /** JVM stack motion (in words) after one slot is pushed, usually -1.
...@@ -127,31 +118,24 @@ class MethodHandleNatives { ...@@ -127,31 +118,24 @@ class MethodHandleNatives {
private static native void registerNatives(); private static native void registerNatives();
static { static {
boolean JVM_SUPPORT_;
int JVM_PUSH_LIMIT_; int JVM_PUSH_LIMIT_;
int JVM_STACK_MOVE_UNIT_; int JVM_STACK_MOVE_UNIT_;
int CONV_OP_IMPLEMENTED_MASK_; int CONV_OP_IMPLEMENTED_MASK_;
try { try {
registerNatives(); registerNatives();
JVM_SUPPORT_ = true;
JVM_PUSH_LIMIT_ = getConstant(Constants.GC_JVM_PUSH_LIMIT); JVM_PUSH_LIMIT_ = getConstant(Constants.GC_JVM_PUSH_LIMIT);
JVM_STACK_MOVE_UNIT_ = getConstant(Constants.GC_JVM_STACK_MOVE_UNIT); JVM_STACK_MOVE_UNIT_ = getConstant(Constants.GC_JVM_STACK_MOVE_UNIT);
CONV_OP_IMPLEMENTED_MASK_ = getConstant(Constants.GC_CONV_OP_IMPLEMENTED_MASK); CONV_OP_IMPLEMENTED_MASK_ = getConstant(Constants.GC_CONV_OP_IMPLEMENTED_MASK);
//sun.reflect.Reflection.registerMethodsToFilter(MethodHandleImpl.class, "init"); //sun.reflect.Reflection.registerMethodsToFilter(MethodHandleImpl.class, "init");
} catch (UnsatisfiedLinkError ee) { } catch (UnsatisfiedLinkError ee) {
// ignore; if we use init() methods later we'll see linkage errors // ignore; if we use init() methods later we'll see linkage errors
JVM_SUPPORT_ = false;
JVM_PUSH_LIMIT_ = 3; // arbitrary JVM_PUSH_LIMIT_ = 3; // arbitrary
JVM_STACK_MOVE_UNIT_ = -1; // arbitrary JVM_STACK_MOVE_UNIT_ = -1; // arbitrary
CONV_OP_IMPLEMENTED_MASK_ = 0; CONV_OP_IMPLEMENTED_MASK_ = 0;
//System.out.println("Warning: Running with JVM_SUPPORT=false");
//System.out.println(ee);
JVM_SUPPORT = JVM_SUPPORT_;
JVM_PUSH_LIMIT = JVM_PUSH_LIMIT_; JVM_PUSH_LIMIT = JVM_PUSH_LIMIT_;
JVM_STACK_MOVE_UNIT = JVM_STACK_MOVE_UNIT_; JVM_STACK_MOVE_UNIT = JVM_STACK_MOVE_UNIT_;
throw ee; // just die; hopeless to try to run with an older JVM throw ee; // just die; hopeless to try to run with an older JVM
} }
JVM_SUPPORT = JVM_SUPPORT_;
JVM_PUSH_LIMIT = JVM_PUSH_LIMIT_; JVM_PUSH_LIMIT = JVM_PUSH_LIMIT_;
JVM_STACK_MOVE_UNIT = JVM_STACK_MOVE_UNIT_; JVM_STACK_MOVE_UNIT = JVM_STACK_MOVE_UNIT_;
if (CONV_OP_IMPLEMENTED_MASK_ == 0) if (CONV_OP_IMPLEMENTED_MASK_ == 0)
...@@ -189,9 +173,15 @@ class MethodHandleNatives { ...@@ -189,9 +173,15 @@ class MethodHandleNatives {
MN_SEARCH_INTERFACES = 0x00200000, // for MHN.getMembers MN_SEARCH_INTERFACES = 0x00200000, // for MHN.getMembers
VM_INDEX_UNINITIALIZED = -99; VM_INDEX_UNINITIALIZED = -99;
// BoundMethodHandle
/** Constants for decoding the vmargslot field, which contains 2 values. */
static final int
ARG_SLOT_PUSH_SHIFT = 16,
ARG_SLOT_MASK = (1<<ARG_SLOT_PUSH_SHIFT)-1;
// AdapterMethodHandle // AdapterMethodHandle
/** Conversions recognized by the JVM. /** Conversions recognized by the JVM.
* They must align with the constants in sun.dyn_AdapterMethodHandle, * They must align with the constants in java.lang.invoke.AdapterMethodHandle,
* in the JVM file hotspot/src/share/vm/classfile/javaClasses.hpp. * in the JVM file hotspot/src/share/vm/classfile/javaClasses.hpp.
*/ */
static final int static final int
...@@ -292,7 +282,7 @@ class MethodHandleNatives { ...@@ -292,7 +282,7 @@ class MethodHandleNatives {
return true; return true;
} }
static { static {
if (JVM_SUPPORT) verifyConstants(); verifyConstants();
} }
// Up-calls from the JVM. // Up-calls from the JVM.
...@@ -305,28 +295,47 @@ class MethodHandleNatives { ...@@ -305,28 +295,47 @@ class MethodHandleNatives {
String name, MethodType type, String name, MethodType type,
Object info, Object info,
MemberName callerMethod, int callerBCI) { MemberName callerMethod, int callerBCI) {
return CallSiteImpl.makeSite(bootstrapMethod, name, type, info, callerMethod, callerBCI); return CallSite.makeSite(bootstrapMethod, name, type, info, callerMethod, callerBCI);
}
/**
* Called by the JVM to check the length of a spread array.
*/
static void checkSpreadArgument(Object av, int n) {
MethodHandleStatics.checkSpreadArgument(av, n);
} }
/** /**
* The JVM wants a pointer to a MethodType. Oblige it by finding or creating one. * The JVM wants a pointer to a MethodType. Oblige it by finding or creating one.
*/ */
static MethodType findMethodHandleType(Class<?> rtype, Class<?>[] ptypes) { static MethodType findMethodHandleType(Class<?> rtype, Class<?>[] ptypes) {
MethodType.genericMethodType(0); // trigger initialization return MethodType.makeImpl(rtype, ptypes, true);
return MethodTypeImpl.makeImpl(Access.TOKEN, rtype, ptypes, true);
} }
/** /**
* The JVM wants to use a MethodType with invokeGeneric. Give the runtime fair warning. * The JVM wants to use a MethodType with invokeGeneric. Give the runtime fair warning.
*/ */
static void notifyGenericMethodType(MethodType type) { static void notifyGenericMethodType(MethodType type) {
try { type.form().notifyGenericMethodType();
// Trigger adapter creation. }
InvokeGeneric.genericInvokerOf(type);
} catch (Exception ex) { /**
Error err = new InternalError("Exception while resolving invokeGeneric"); * The JVM wants to raise an exception. Here's the path.
err.initCause(ex); */
throw err; static void raiseException(int code, Object actual, Object required) {
String message;
// disregard the identity of the actual object, if it is not a class:
if (!(actual instanceof Class) && !(actual instanceof MethodType))
actual = actual.getClass();
if (actual != null)
message = "required "+required+" but encountered "+actual;
else
message = "required "+required;
switch (code) {
case 192: // checkcast
throw new ClassCastException(message);
default:
throw new InternalError("unexpected code "+code+": "+message);
} }
} }
......
/*
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package java.lang.invoke;
/**
* This class consists exclusively of static names internal to the
* method handle implementation.
* Usage: {@code import static java.lang.invoke.MethodHandleStatics.*}
* @author John Rose, JSR 292 EG
*/
/*non-public*/ class MethodHandleStatics {
private MethodHandleStatics() { } // do not instantiate
/*non-public*/ static String getNameString(MethodHandle target, MethodType type) {
if (type == null)
type = target.type();
MemberName name = null;
if (target != null)
name = MethodHandleNatives.getMethodName(target);
if (name == null)
return "invoke" + type;
return name.getName() + type;
}
/*non-public*/ static String getNameString(MethodHandle target, MethodHandle typeHolder) {
return getNameString(target, typeHolder == null ? (MethodType) null : typeHolder.type());
}
/*non-public*/ static String getNameString(MethodHandle target) {
return getNameString(target, (MethodType) null);
}
/*non-public*/ static String addTypeString(Object obj, MethodHandle target) {
String str = String.valueOf(obj);
if (target == null) return str;
int paren = str.indexOf('(');
if (paren >= 0) str = str.substring(0, paren);
return str + target.type();
}
static void checkSpreadArgument(Object av, int n) {
if (av == null ? n != 0 : ((Object[])av).length != n)
throw newIllegalArgumentException("Array is not of length "+n);
}
// handy shared exception makers (they simplify the common case code)
/*non-public*/ static RuntimeException newIllegalStateException(String message) {
return new IllegalStateException(message);
}
/*non-public*/ static RuntimeException newIllegalStateException(String message, Object obj) {
return new IllegalStateException(message(message, obj));
}
/*non-public*/ static RuntimeException newIllegalArgumentException(String message) {
return new IllegalArgumentException(message);
}
/*non-public*/ static RuntimeException newIllegalArgumentException(String message, Object obj) {
return new IllegalArgumentException(message(message, obj));
}
/*non-public*/ static Error uncaughtException(Exception ex) {
Error err = new InternalError("uncaught exception");
err.initCause(ex);
return err;
}
private static String message(String message, Object obj) {
if (obj != null) message = message + ": " + obj;
return message;
}
}
...@@ -23,18 +23,14 @@ ...@@ -23,18 +23,14 @@
* questions. * questions.
*/ */
package java.dyn; package java.lang.invoke;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import sun.dyn.Access; import sun.invoke.util.BytecodeDescriptor;
import sun.dyn.Invokers; import static java.lang.invoke.MethodHandleStatics.*;
import sun.dyn.MethodHandleImpl;
import sun.dyn.MethodTypeImpl;
import sun.dyn.util.BytecodeDescriptor;
import static sun.dyn.MemberName.newIllegalArgumentException;
/** /**
* A method type represents the arguments and return type accepted and * A method type represents the arguments and return type accepted and
...@@ -96,34 +92,6 @@ class MethodType implements java.io.Serializable { ...@@ -96,34 +92,6 @@ class MethodType implements java.io.Serializable {
private MethodType wrapAlt; // alternative wrapped/unwrapped version private MethodType wrapAlt; // alternative wrapped/unwrapped version
private Invokers invokers; // cache of handy higher-order adapters private Invokers invokers; // cache of handy higher-order adapters
private static final Access IMPL_TOKEN = Access.getToken();
// share a cache with a friend in this package
Invokers getInvokers() { return invokers; }
void setInvokers(Invokers inv) { invokers = inv; }
static {
// This hack allows the implementation package special access to
// the internals of MethodType. In particular, the MTImpl has all sorts
// of cached information useful to the implementation code.
MethodTypeImpl.setMethodTypeFriend(IMPL_TOKEN, new MethodTypeImpl.MethodTypeFriend() {
public Class<?>[] ptypes(MethodType mt) { return mt.ptypes; }
public MethodTypeImpl form(MethodType mt) { return mt.form; }
public void setForm(MethodType mt, MethodTypeImpl form) {
assert(mt.form == null);
mt.form = (MethodTypeForm) form;
}
public MethodType makeImpl(Class<?> rtype, Class<?>[] ptypes, boolean trusted) {
return MethodType.makeImpl(rtype, ptypes, trusted);
}
public MethodTypeImpl newMethodTypeForm(MethodType mt) {
return new MethodTypeForm(mt);
}
public Invokers getInvokers(MethodType mt) { return mt.invokers; }
public void setInvokers(MethodType mt, Invokers inv) { mt.invokers = inv; }
});
}
/** /**
* Check the given parameters for validity and store them into the final fields. * Check the given parameters for validity and store them into the final fields.
*/ */
...@@ -134,6 +102,10 @@ class MethodType implements java.io.Serializable { ...@@ -134,6 +102,10 @@ class MethodType implements java.io.Serializable {
this.ptypes = ptypes; this.ptypes = ptypes;
} }
/*trusted*/ MethodTypeForm form() { return form; }
/*trusted*/ Class<?> rtype() { return rtype; }
/*trusted*/ Class<?>[] ptypes() { return ptypes; }
private static void checkRtype(Class<?> rtype) { private static void checkRtype(Class<?> rtype) {
rtype.equals(rtype); // null check rtype.equals(rtype); // null check
} }
...@@ -168,7 +140,7 @@ class MethodType implements java.io.Serializable { ...@@ -168,7 +140,7 @@ class MethodType implements java.io.Serializable {
static final Class<?>[] NO_PTYPES = {}; static final Class<?>[] NO_PTYPES = {};
/** /**
* Find or create an instance of the given method type. * Finds or creates an instance of the given method type.
* @param rtype the return type * @param rtype the return type
* @param ptypes the parameter types * @param ptypes the parameter types
* @return a method type with the given components * @return a method type with the given components
...@@ -253,7 +225,7 @@ class MethodType implements java.io.Serializable { ...@@ -253,7 +225,7 @@ class MethodType implements java.io.Serializable {
* @param trusted whether the ptypes can be used without cloning * @param trusted whether the ptypes can be used without cloning
* @return the unique method type of the desired structure * @return the unique method type of the desired structure
*/ */
private static /*trusted*/ static
MethodType makeImpl(Class<?> rtype, Class<?>[] ptypes, boolean trusted) { MethodType makeImpl(Class<?> rtype, Class<?>[] ptypes, boolean trusted) {
if (ptypes == null || ptypes.length == 0) { if (ptypes == null || ptypes.length == 0) {
ptypes = NO_PTYPES; trusted = true; ptypes = NO_PTYPES; trusted = true;
...@@ -269,7 +241,12 @@ class MethodType implements java.io.Serializable { ...@@ -269,7 +241,12 @@ class MethodType implements java.io.Serializable {
// defensively copy the array passed in by the user // defensively copy the array passed in by the user
mt1 = new MethodType(rtype, ptypes.clone()); mt1 = new MethodType(rtype, ptypes.clone());
// promote the object to the Real Thing, and reprobe // promote the object to the Real Thing, and reprobe
MethodTypeImpl.initForm(IMPL_TOKEN, mt1); MethodTypeForm form = MethodTypeForm.findForm(mt1);
mt1.form = form;
if (form.erasedType == mt1) {
// This is a principal (erased) type; show it to the JVM.
MethodHandleNatives.init(mt1);
}
synchronized (internTable) { synchronized (internTable) {
mt0 = internTable.get(mt1); mt0 = internTable.get(mt1);
if (mt0 != null) if (mt0 != null)
...@@ -279,12 +256,6 @@ class MethodType implements java.io.Serializable { ...@@ -279,12 +256,6 @@ class MethodType implements java.io.Serializable {
return mt1; return mt1;
} }
// Entry point from JVM. TODO: Change the name & signature.
private static MethodType makeImpl(Class<?> rtype, Class<?>[] ptypes,
boolean ignore1, boolean ignore2) {
return makeImpl(rtype, ptypes, true);
}
private static final MethodType[] objectOnlyTypes = new MethodType[20]; private static final MethodType[] objectOnlyTypes = new MethodType[20];
/** /**
...@@ -519,7 +490,7 @@ class MethodType implements java.io.Serializable { ...@@ -519,7 +490,7 @@ class MethodType implements java.io.Serializable {
} }
/** /**
* Convert all wrapper types to their corresponding primitive types. * Converts all wrapper types to their corresponding primitive types.
* Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
* All primitive types (including {@code void}) will remain unchanged. * All primitive types (including {@code void}) will remain unchanged.
* A return type of {@code java.lang.Void} is changed to {@code void}. * A return type of {@code java.lang.Void} is changed to {@code void}.
...@@ -535,7 +506,7 @@ class MethodType implements java.io.Serializable { ...@@ -535,7 +506,7 @@ class MethodType implements java.io.Serializable {
MethodType wt = pt.wrapAlt; MethodType wt = pt.wrapAlt;
if (wt == null) { if (wt == null) {
// fill in lazily // fill in lazily
wt = MethodTypeImpl.canonicalize(pt, MethodTypeImpl.WRAP, MethodTypeImpl.WRAP); wt = MethodTypeForm.canonicalize(pt, MethodTypeForm.WRAP, MethodTypeForm.WRAP);
assert(wt != null); assert(wt != null);
pt.wrapAlt = wt; pt.wrapAlt = wt;
} }
...@@ -547,7 +518,7 @@ class MethodType implements java.io.Serializable { ...@@ -547,7 +518,7 @@ class MethodType implements java.io.Serializable {
MethodType uwt = wt.wrapAlt; MethodType uwt = wt.wrapAlt;
if (uwt == null) { if (uwt == null) {
// fill in lazily // fill in lazily
uwt = MethodTypeImpl.canonicalize(wt, MethodTypeImpl.UNWRAP, MethodTypeImpl.UNWRAP); uwt = MethodTypeForm.canonicalize(wt, MethodTypeForm.UNWRAP, MethodTypeForm.UNWRAP);
if (uwt == null) if (uwt == null)
uwt = wt; // type has no wrappers or prims at all uwt = wt; // type has no wrappers or prims at all
wt.wrapAlt = uwt; wt.wrapAlt = uwt;
...@@ -658,7 +629,7 @@ class MethodType implements java.io.Serializable { ...@@ -658,7 +629,7 @@ class MethodType implements java.io.Serializable {
/// Queries which have to do with the bytecode architecture /// Queries which have to do with the bytecode architecture
/** Reports the number of JVM stack slots required to invoke a method /** Reports the number of JVM stack slots required to invoke a method
* of this type. Note that (for historic reasons) the JVM requires * of this type. Note that (for historical reasons) the JVM requires
* a second stack slot to pass long and double arguments. * a second stack slot to pass long and double arguments.
* So this method returns {@link #parameterCount() parameterCount} plus the * So this method returns {@link #parameterCount() parameterCount} plus the
* number of long and double parameters (if any). * number of long and double parameters (if any).
...@@ -666,12 +637,18 @@ class MethodType implements java.io.Serializable { ...@@ -666,12 +637,18 @@ class MethodType implements java.io.Serializable {
* This method is included for the benfit of applications that must * This method is included for the benfit of applications that must
* generate bytecodes that process method handles and invokedynamic. * generate bytecodes that process method handles and invokedynamic.
* @return the number of JVM stack slots for this type's parameters * @return the number of JVM stack slots for this type's parameters
* @deprecated Will be removed for PFD.
*/ */
public int parameterSlotCount() { /*non-public*/ int parameterSlotCount() {
return form.parameterSlotCount(); return form.parameterSlotCount();
} }
/*non-public*/ Invokers invokers() {
Invokers inv = invokers;
if (inv != null) return inv;
invokers = inv = new Invokers(this);
return inv;
}
/** Reports the number of JVM stack slots which carry all parameters including and after /** Reports the number of JVM stack slots which carry all parameters including and after
* the given position, which must be in the range of 0 to * the given position, which must be in the range of 0 to
* {@code parameterCount} inclusive. Successive parameters are * {@code parameterCount} inclusive. Successive parameters are
...@@ -694,9 +671,8 @@ class MethodType implements java.io.Serializable { ...@@ -694,9 +671,8 @@ class MethodType implements java.io.Serializable {
* @return the index of the (shallowest) JVM stack slot transmitting the * @return the index of the (shallowest) JVM stack slot transmitting the
* given parameter * given parameter
* @throws IllegalArgumentException if {@code num} is negative or greater than {@code parameterCount()} * @throws IllegalArgumentException if {@code num} is negative or greater than {@code parameterCount()}
* @deprecated Will be removed for PFD.
*/ */
public int parameterSlotDepth(int num) { /*non-public*/ int parameterSlotDepth(int num) {
if (num < 0 || num > ptypes.length) if (num < 0 || num > ptypes.length)
parameterType(num); // force a range check parameterType(num); // force a range check
return form.parameterToArgSlot(num-1); return form.parameterToArgSlot(num-1);
...@@ -710,14 +686,14 @@ class MethodType implements java.io.Serializable { ...@@ -710,14 +686,14 @@ class MethodType implements java.io.Serializable {
* This method is included for the benfit of applications that must * This method is included for the benfit of applications that must
* generate bytecodes that process method handles and invokedynamic. * generate bytecodes that process method handles and invokedynamic.
* @return the number of JVM stack slots (0, 1, or 2) for this type's return value * @return the number of JVM stack slots (0, 1, or 2) for this type's return value
* @deprecated Will be removed for PFD. * Will be removed for PFD.
*/ */
public int returnSlotCount() { /*non-public*/ int returnSlotCount() {
return form.returnSlotCount(); return form.returnSlotCount();
} }
/** /**
* Find or create an instance of a method type, given the spelling of its bytecode descriptor. * Finds or creates an instance of a method type, given the spelling of its bytecode descriptor.
* Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}. * Convenience method for {@link #methodType(java.lang.Class, java.lang.Class[]) methodType}.
* Any class or interface name embedded in the descriptor string * Any class or interface name embedded in the descriptor string
* will be resolved by calling {@link ClassLoader#loadClass(java.lang.String)} * will be resolved by calling {@link ClassLoader#loadClass(java.lang.String)}
......
...@@ -23,11 +23,10 @@ ...@@ -23,11 +23,10 @@
* questions. * questions.
*/ */
package sun.dyn; package java.lang.invoke;
import java.dyn.*; import sun.invoke.util.Wrapper;
import sun.dyn.util.Wrapper; import static java.lang.invoke.MethodHandleStatics.*;
import static sun.dyn.MemberName.newIllegalArgumentException;
/** /**
* Shared information for a group of method types, which differ * Shared information for a group of method types, which differ
...@@ -42,7 +41,7 @@ import static sun.dyn.MemberName.newIllegalArgumentException; ...@@ -42,7 +41,7 @@ import static sun.dyn.MemberName.newIllegalArgumentException;
* No more than half of these are likely to be loaded at once. * No more than half of these are likely to be loaded at once.
* @author John Rose * @author John Rose
*/ */
public class MethodTypeImpl { class MethodTypeForm {
final int[] argToSlotTable, slotToArgTable; final int[] argToSlotTable, slotToArgTable;
final long argCounts; // packed slot & value counts final long argCounts; // packed slot & value counts
final long primCounts; // packed prim & double counts final long primCounts; // packed prim & double counts
...@@ -66,39 +65,10 @@ public class MethodTypeImpl { ...@@ -66,39 +65,10 @@ public class MethodTypeImpl {
return erasedType; return erasedType;
} }
public static MethodTypeImpl of(MethodType type) { protected MethodTypeForm(MethodType erasedType) {
return METHOD_TYPE_FRIEND.form(type);
}
/** Access methods for the internals of MethodType, supplied to
* MethodTypeImpl as a trusted agent.
*/
static public interface MethodTypeFriend {
Class<?>[] ptypes(MethodType mt);
MethodTypeImpl form(MethodType mt);
void setForm(MethodType mt, MethodTypeImpl form);
MethodType makeImpl(Class<?> rtype, Class<?>[] ptypes, boolean trusted);
MethodTypeImpl newMethodTypeForm(MethodType mt);
Invokers getInvokers(MethodType mt);
void setInvokers(MethodType mt, Invokers inv);
}
public static void setMethodTypeFriend(Access token, MethodTypeFriend am) {
Access.check(token);
if (METHOD_TYPE_FRIEND != null)
throw new InternalError(); // just once
METHOD_TYPE_FRIEND = am;
}
static private MethodTypeFriend METHOD_TYPE_FRIEND;
static MethodType makeImpl(Access token, Class<?> rtype, Class<?>[] ptypes, boolean trusted) {
Access.check(token);
return METHOD_TYPE_FRIEND.makeImpl(rtype, ptypes, trusted);
}
protected MethodTypeImpl(MethodType erasedType) {
this.erasedType = erasedType; this.erasedType = erasedType;
Class<?>[] ptypes = METHOD_TYPE_FRIEND.ptypes(erasedType); Class<?>[] ptypes = erasedType.ptypes();
int ptypeCount = ptypes.length; int ptypeCount = ptypes.length;
int pslotCount = ptypeCount; // temp. estimate int pslotCount = ptypeCount; // temp. estimate
int rtypeCount = 1; // temp. estimate int rtypeCount = 1; // temp. estimate
...@@ -260,7 +230,7 @@ public class MethodTypeImpl { ...@@ -260,7 +230,7 @@ public class MethodTypeImpl {
* the type {@code (Object,int)Object} produces {@code null}. * the type {@code (Object,int)Object} produces {@code null}.
*/ */
public static int[] primsAtEndOrder(MethodType mt) { public static int[] primsAtEndOrder(MethodType mt) {
MethodTypeImpl form = METHOD_TYPE_FRIEND.form(mt); MethodTypeForm form = mt.form();
if (form.primsAtEnd == form.erasedType) if (form.primsAtEnd == form.erasedType)
// quick check shows no reordering is necessary // quick check shows no reordering is necessary
return null; return null;
...@@ -273,7 +243,7 @@ public class MethodTypeImpl { ...@@ -273,7 +243,7 @@ public class MethodTypeImpl {
int lac = form.longPrimitiveParameterCount(); int lac = form.longPrimitiveParameterCount();
int rfill = 0, ifill = argc - pac, lfill = argc - lac; int rfill = 0, ifill = argc - pac, lfill = argc - lac;
Class<?>[] ptypes = METHOD_TYPE_FRIEND.ptypes(mt); Class<?>[] ptypes = mt.ptypes();
boolean changed = false; boolean changed = false;
for (int i = 0; i < ptypes.length; i++) { for (int i = 0; i < ptypes.length; i++) {
Class<?> pt = ptypes[i]; Class<?> pt = ptypes[i];
...@@ -300,7 +270,7 @@ public class MethodTypeImpl { ...@@ -300,7 +270,7 @@ public class MethodTypeImpl {
*/ */
public static MethodType reorderParameters(MethodType mt, int[] newParamOrder, Class<?>[] moreParams) { public static MethodType reorderParameters(MethodType mt, int[] newParamOrder, Class<?>[] moreParams) {
if (newParamOrder == null) return mt; // no-op reordering if (newParamOrder == null) return mt; // no-op reordering
Class<?>[] ptypes = METHOD_TYPE_FRIEND.ptypes(mt); Class<?>[] ptypes = mt.ptypes();
Class<?>[] ntypes = new Class<?>[newParamOrder.length]; Class<?>[] ntypes = new Class<?>[newParamOrder.length];
int maxParam = ptypes.length + (moreParams == null ? 0 : moreParams.length); int maxParam = ptypes.length + (moreParams == null ? 0 : moreParams.length);
boolean changed = (ntypes.length != ptypes.length); boolean changed = (ntypes.length != ptypes.length);
...@@ -314,7 +284,7 @@ public class MethodTypeImpl { ...@@ -314,7 +284,7 @@ public class MethodTypeImpl {
ntypes[i] = nt; ntypes[i] = nt;
} }
if (!changed) return mt; if (!changed) return mt;
return METHOD_TYPE_FRIEND.makeImpl(mt.returnType(), ntypes, true); return MethodType.makeImpl(mt.returnType(), ntypes, true);
} }
private static boolean hasTwoArgSlots(Class<?> type) { private static boolean hasTwoArgSlots(Class<?> type) {
...@@ -376,28 +346,18 @@ public class MethodTypeImpl { ...@@ -376,28 +346,18 @@ public class MethodTypeImpl {
return slotToArgTable[argSlot] - 1; return slotToArgTable[argSlot] - 1;
} }
public static void initForm(Access token, MethodType mt) { static MethodTypeForm findForm(MethodType mt) {
Access.check(token);
MethodTypeImpl form = findForm(mt);
METHOD_TYPE_FRIEND.setForm(mt, form);
if (form.erasedType == mt) {
// This is a principal (erased) type; show it to the JVM.
MethodHandleImpl.init(token, mt);
}
}
static MethodTypeImpl findForm(MethodType mt) {
MethodType erased = canonicalize(mt, ERASE, ERASE); MethodType erased = canonicalize(mt, ERASE, ERASE);
if (erased == null) { if (erased == null) {
// It is already erased. Make a new MethodTypeImpl. // It is already erased. Make a new MethodTypeForm.
return METHOD_TYPE_FRIEND.newMethodTypeForm(mt); return new MethodTypeForm(mt);
} else { } else {
// Share the MethodTypeImpl with the erased version. // Share the MethodTypeForm with the erased version.
return METHOD_TYPE_FRIEND.form(erased); return erased.form();
} }
} }
/** Codes for {@link #canonicalize(java.lang.Class, int). /** Codes for {@link #canonicalize(java.lang.Class, int)}.
* ERASE means change every reference to {@code Object}. * ERASE means change every reference to {@code Object}.
* WRAP means convert primitives (including {@code void} to their * WRAP means convert primitives (including {@code void} to their
* corresponding wrapper types. UNWRAP means the reverse of WRAP. * corresponding wrapper types. UNWRAP means the reverse of WRAP.
...@@ -414,10 +374,10 @@ public class MethodTypeImpl { ...@@ -414,10 +374,10 @@ public class MethodTypeImpl {
* Otherwise return null. * Otherwise return null.
*/ */
public static MethodType canonicalize(MethodType mt, int howRet, int howArgs) { public static MethodType canonicalize(MethodType mt, int howRet, int howArgs) {
Class<?>[] ptypes = METHOD_TYPE_FRIEND.ptypes(mt); Class<?>[] ptypes = mt.ptypes();
Class<?>[] ptc = MethodTypeImpl.canonicalizes(ptypes, howArgs); Class<?>[] ptc = MethodTypeForm.canonicalizes(ptypes, howArgs);
Class<?> rtype = mt.returnType(); Class<?> rtype = mt.returnType();
Class<?> rtc = MethodTypeImpl.canonicalize(rtype, howRet); Class<?> rtc = MethodTypeForm.canonicalize(rtype, howRet);
if (ptc == null && rtc == null) { if (ptc == null && rtc == null) {
// It is already canonical. // It is already canonical.
return null; return null;
...@@ -425,7 +385,7 @@ public class MethodTypeImpl { ...@@ -425,7 +385,7 @@ public class MethodTypeImpl {
// Find the erased version of the method type: // Find the erased version of the method type:
if (rtc == null) rtc = rtype; if (rtc == null) rtc = rtype;
if (ptc == null) ptc = ptypes; if (ptc == null) ptc = ptypes;
return METHOD_TYPE_FRIEND.makeImpl(rtc, ptc, true); return MethodType.makeImpl(rtc, ptc, true);
} }
/** Canonicalize the given return or param type. /** Canonicalize the given return or param type.
...@@ -496,16 +456,16 @@ public class MethodTypeImpl { ...@@ -496,16 +456,16 @@ public class MethodTypeImpl {
return cs; return cs;
} }
public static Invokers invokers(Access token, MethodType type) { /*non-public*/ void notifyGenericMethodType() {
Access.check(token); if (genericInvoker != null) return;
return invokers(type); try {
} // Trigger adapter creation.
/*non-public*/ static Invokers invokers(MethodType type) { genericInvoker = InvokeGeneric.genericInvokerOf(erasedType);
Invokers inv = METHOD_TYPE_FRIEND.getInvokers(type); } catch (Exception ex) {
if (inv != null) return inv; Error err = new InternalError("Exception while resolving invokeGeneric");
inv = new Invokers(type); err.initCause(ex);
METHOD_TYPE_FRIEND.setInvokers(type, inv); throw err;
return inv; }
} }
@Override @Override
......
...@@ -23,10 +23,8 @@ ...@@ -23,10 +23,8 @@
* questions. * questions.
*/ */
package java.dyn; package java.lang.invoke;
import sun.dyn.*;
import sun.dyn.empty.Empty;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
/** /**
......
/* /*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,14 +23,14 @@ ...@@ -23,14 +23,14 @@
* questions. * questions.
*/ */
package sun.dyn; package java.lang.invoke;
import java.dyn.*; import sun.invoke.util.ValueConversions;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList; import java.util.ArrayList;
import sun.dyn.util.ValueConversions; import static java.lang.invoke.MethodHandleStatics.*;
import static sun.dyn.MemberName.newIllegalArgumentException; import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
/** /**
* Generic spread adapter. * Generic spread adapter.
...@@ -110,7 +110,7 @@ class SpreadGeneric { ...@@ -110,7 +110,7 @@ class SpreadGeneric {
static SpreadGeneric of(MethodType targetType, int spreadCount) { static SpreadGeneric of(MethodType targetType, int spreadCount) {
if (targetType != targetType.generic()) if (targetType != targetType.generic())
throw new UnsupportedOperationException("NYI type="+targetType); throw new UnsupportedOperationException("NYI type="+targetType);
MethodTypeImpl form = MethodTypeImpl.of(targetType); MethodTypeForm form = targetType.form();
int outcount = form.parameterCount(); int outcount = form.parameterCount();
assert(spreadCount <= outcount); assert(spreadCount <= outcount);
SpreadGeneric[] spreadGens = form.spreadGeneric; SpreadGeneric[] spreadGens = form.spreadGeneric;
...@@ -129,7 +129,7 @@ class SpreadGeneric { ...@@ -129,7 +129,7 @@ class SpreadGeneric {
// This mini-api is called from an Adapter to manage the spread. // This mini-api is called from an Adapter to manage the spread.
/** A check/coercion that happens once before any selections. */ /** A check/coercion that happens once before any selections. */
protected Object check(Object av, int n) { protected Object check(Object av, int n) {
MethodHandleImpl.checkSpreadArgument(av, n); checkSpreadArgument(av, n);
return av; return av;
} }
...@@ -166,7 +166,7 @@ class SpreadGeneric { ...@@ -166,7 +166,7 @@ class SpreadGeneric {
// see if it has the required invoke method // see if it has the required invoke method
MethodHandle entryPoint = null; MethodHandle entryPoint = null;
try { try {
entryPoint = MethodHandleImpl.IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls); entryPoint = IMPL_LOOKUP.findSpecial(acls, iname, entryType, acls);
} catch (ReflectiveOperationException ex) { } catch (ReflectiveOperationException ex) {
} }
if (entryPoint == null) continue; if (entryPoint == null) continue;
...@@ -221,21 +221,21 @@ class SpreadGeneric { ...@@ -221,21 +221,21 @@ class SpreadGeneric {
@Override @Override
public String toString() { public String toString() {
return MethodHandleImpl.addTypeString(target, this); return addTypeString(target, this);
} }
static final MethodHandle NO_ENTRY = ValueConversions.identity(); static final MethodHandle NO_ENTRY = ValueConversions.identity();
protected boolean isPrototype() { return target == null; } protected boolean isPrototype() { return target == null; }
protected Adapter(SpreadGeneric outer) { protected Adapter(SpreadGeneric outer) {
super(Access.TOKEN, NO_ENTRY); super(NO_ENTRY);
this.outer = outer; this.outer = outer;
this.target = null; this.target = null;
assert(isPrototype()); assert(isPrototype());
} }
protected Adapter(SpreadGeneric outer, MethodHandle target) { protected Adapter(SpreadGeneric outer, MethodHandle target) {
super(Access.TOKEN, outer.entryPoint); super(outer.entryPoint);
this.outer = outer; this.outer = outer;
this.target = target; this.target = target;
} }
...@@ -251,7 +251,7 @@ class SpreadGeneric { ...@@ -251,7 +251,7 @@ class SpreadGeneric {
return outer.select(av, n); return outer.select(av, n);
} }
static private final String CLASS_PREFIX; // "sun.dyn.SpreadGeneric$" static private final String CLASS_PREFIX; // "java.lang.invoke.SpreadGeneric$"
static { static {
String aname = Adapter.class.getName(); String aname = Adapter.class.getName();
String sname = Adapter.class.getSimpleName(); String sname = Adapter.class.getSimpleName();
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* questions. * questions.
*/ */
package java.dyn; package java.lang.invoke;
/** /**
* <p> * <p>
...@@ -73,6 +73,10 @@ assertEquals("hodmet", (String) worker.invokeExact("met", "hod")); ...@@ -73,6 +73,10 @@ assertEquals("hodmet", (String) worker.invokeExact("met", "hod"));
* Switch points are useful without subclassing. They may also be subclassed. * Switch points are useful without subclassing. They may also be subclassed.
* This may be useful in order to associate application-specific invalidation logic * This may be useful in order to associate application-specific invalidation logic
* with the switch point. * with the switch point.
* Notice that there is no permanent association between a switch point and
* the method handles it produces and consumes.
* The garbage collector may collect method handles produced or consumed
* by a switch point independently of the lifetime of the switch point itself.
* <p style="font-size:smaller;"> * <p style="font-size:smaller;">
* <em>Implementation Note:</em> * <em>Implementation Note:</em>
* A switch point behaves as if implemented on top of {@link MutableCallSite}, * A switch point behaves as if implemented on top of {@link MutableCallSite},
......
...@@ -23,9 +23,7 @@ ...@@ -23,9 +23,7 @@
* questions. * questions.
*/ */
package java.dyn; package java.lang.invoke;
import java.util.List;
/** /**
* A {@code VolatileCallSite} is a {@link CallSite} whose target acts like a volatile variable. * A {@code VolatileCallSite} is a {@link CallSite} whose target acts like a volatile variable.
......
/* /*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
* questions. * questions.
*/ */
package java.dyn; package java.lang.invoke;
/** /**
* Thrown to indicate that code has attempted to call a method handle * Thrown to indicate that code has attempted to call a method handle
......
...@@ -28,6 +28,7 @@ import java.io.FileDescriptor; ...@@ -28,6 +28,7 @@ import java.io.FileDescriptor;
import java.io.IOException; import java.io.IOException;
import java.io.InterruptedIOException; import java.io.InterruptedIOException;
import java.util.Enumeration; import java.util.Enumeration;
import sun.net.ResourceManager;
/** /**
* Abstract datagram and multicast socket implementation base class. * Abstract datagram and multicast socket implementation base class.
...@@ -66,7 +67,14 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl ...@@ -66,7 +67,14 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
*/ */
protected synchronized void create() throws SocketException { protected synchronized void create() throws SocketException {
fd = new FileDescriptor(); fd = new FileDescriptor();
datagramSocketCreate(); ResourceManager.beforeUdpCreate();
try {
datagramSocketCreate();
} catch (SocketException ioe) {
ResourceManager.afterUdpClose();
fd = null;
throw ioe;
}
} }
/** /**
...@@ -211,6 +219,7 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl ...@@ -211,6 +219,7 @@ abstract class AbstractPlainDatagramSocketImpl extends DatagramSocketImpl
protected void close() { protected void close() {
if (fd != null) { if (fd != null) {
datagramSocketClose(); datagramSocketClose();
ResourceManager.afterUdpClose();
fd = null; fd = null;
} }
} }
......
...@@ -32,6 +32,7 @@ import java.io.FileDescriptor; ...@@ -32,6 +32,7 @@ import java.io.FileDescriptor;
import sun.net.ConnectionResetException; import sun.net.ConnectionResetException;
import sun.net.NetHooks; import sun.net.NetHooks;
import sun.net.ResourceManager;
/** /**
* Default Socket Implementation. This implementation does * Default Socket Implementation. This implementation does
...@@ -68,6 +69,10 @@ abstract class AbstractPlainSocketImpl extends SocketImpl ...@@ -68,6 +69,10 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
private int resetState; private int resetState;
private final Object resetLock = new Object(); private final Object resetLock = new Object();
/* whether this Socket is a stream (TCP) socket or not (UDP)
*/
private boolean stream;
/** /**
* Load net library into runtime. * Load net library into runtime.
*/ */
...@@ -82,7 +87,19 @@ abstract class AbstractPlainSocketImpl extends SocketImpl ...@@ -82,7 +87,19 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
*/ */
protected synchronized void create(boolean stream) throws IOException { protected synchronized void create(boolean stream) throws IOException {
fd = new FileDescriptor(); fd = new FileDescriptor();
socketCreate(stream); this.stream = stream;
if (!stream) {
ResourceManager.beforeUdpCreate();
try {
socketCreate(false);
} catch (IOException ioe) {
ResourceManager.afterUdpClose();
fd = null;
throw ioe;
}
} else {
socketCreate(true);
}
if (socket != null) if (socket != null)
socket.setCreated(); socket.setCreated();
if (serverSocket != null) if (serverSocket != null)
...@@ -479,6 +496,9 @@ abstract class AbstractPlainSocketImpl extends SocketImpl ...@@ -479,6 +496,9 @@ abstract class AbstractPlainSocketImpl extends SocketImpl
protected void close() throws IOException { protected void close() throws IOException {
synchronized(fdLock) { synchronized(fdLock) {
if (fd != null) { if (fd != null) {
if (!stream) {
ResourceManager.afterUdpClose();
}
if (fdUseCount == 0) { if (fdUseCount == 0) {
if (closePending) { if (closePending) {
return; return;
......
...@@ -29,6 +29,9 @@ import java.util.ArrayList; ...@@ -29,6 +29,9 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import sun.security.util.Debug; import sun.security.util.Debug;
import sun.security.util.SecurityConstants; import sun.security.util.SecurityConstants;
import sun.misc.JavaSecurityAccess;
import sun.misc.SharedSecrets;
/** /**
* An AccessControlContext is used to make system resource access decisions * An AccessControlContext is used to make system resource access decisions
...@@ -196,6 +199,24 @@ public final class AccessControlContext { ...@@ -196,6 +199,24 @@ public final class AccessControlContext {
this.isPrivileged = isPrivileged; this.isPrivileged = isPrivileged;
} }
/**
* Constructor for JavaSecurityAccess.doIntersectionPrivilege()
*/
AccessControlContext(ProtectionDomain[] context,
AccessControlContext privilegedContext)
{
this.context = context;
this.privilegedContext = privilegedContext;
this.isPrivileged = true;
}
/**
* Returns this context's context.
*/
ProtectionDomain[] getContext() {
return context;
}
/** /**
* Returns true if this context is privileged. * Returns true if this context is privileged.
*/ */
......
...@@ -36,6 +36,8 @@ import static sun.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache; ...@@ -36,6 +36,8 @@ import static sun.misc.JavaSecurityProtectionDomainAccess.ProtectionDomainCache;
import sun.misc.SharedSecrets; import sun.misc.SharedSecrets;
import sun.security.util.Debug; import sun.security.util.Debug;
import sun.security.util.SecurityConstants; import sun.security.util.SecurityConstants;
import sun.misc.JavaSecurityAccess;
import sun.misc.SharedSecrets;
/** /**
* *
...@@ -59,6 +61,36 @@ import sun.security.util.SecurityConstants; ...@@ -59,6 +61,36 @@ import sun.security.util.SecurityConstants;
public class ProtectionDomain { public class ProtectionDomain {
static {
// Set up JavaSecurityAccess in SharedSecrets
SharedSecrets.setJavaSecurityAccess(
new JavaSecurityAccess() {
public <T> T doIntersectionPrivilege(
PrivilegedAction<T> action,
final AccessControlContext stack,
final AccessControlContext context)
{
if (action == null) {
throw new NullPointerException();
}
return AccessController.doPrivileged(
action,
new AccessControlContext(
stack.getContext(), context).optimize()
);
}
public <T> T doIntersectionPrivilege(
PrivilegedAction<T> action,
AccessControlContext context)
{
return doIntersectionPrivilege(action,
AccessController.getContext(), context);
}
}
);
}
/* CodeSource */ /* CodeSource */
private CodeSource codesource ; private CodeSource codesource ;
......
...@@ -33,7 +33,7 @@ questions. ...@@ -33,7 +33,7 @@ questions.
<body> <body>
This document is the API specification for version&nbsp;6 of the Java&#x2122; This document is the API specification for the Java&#x2122;
Platform, Standard Edition. Platform, Standard Edition.
</body> </body>
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册