# HG changeset patch # User lana # Date 1472784097 0 # Node ID de9ff562c1129876a63611fc500cda8cb1f153db # Parent b079fff22b3cabf8347a69385eb351d6a93a5b2c# Parent 48879ea67e2a111319492c7e3beb0656ac1b413e Merge diff -r b079fff22b3c -r de9ff562c112 jdk/make/GenerateClasslist.gmk --- a/jdk/make/GenerateClasslist.gmk Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/make/GenerateClasslist.gmk Fri Sep 02 02:41:37 2016 +0000 @@ -50,6 +50,8 @@ CLASSLIST_FILE := $(SUPPORT_OUTPUTDIR)/classlist/classlist +JLI_TRACE_FILE := $(SUPPORT_OUTPUTDIR)/classlist/jli_trace.out + # If an external buildjdk has been supplied, we don't build a separate interim # image, so just use the external build jdk instead. ifeq ($(EXTERNAL_BUILDJDK), true) @@ -59,13 +61,11 @@ $(CLASSLIST_FILE): $(INTERIM_IMAGE_DIR)/bin/java$(EXE_SUFFIX) $(CLASSLIST_JAR) $(call MakeDir, $(@D)) $(call LogInfo, Generating lib/classlist) - $(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@.tmp \ + $(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@ \ + -Djava.lang.invoke.MethodHandle.TRACE_RESOLVE=true \ -cp $(SUPPORT_OUTPUTDIR)/classlist.jar \ - build.tools.classlist.HelloClasslist $(LOG_DEBUG) 2>&1 - # Filter out generated classes, remove after JDK-8149977 - $(FIXPATH) $(INTERIM_IMAGE_DIR)/bin/java -XX:DumpLoadedClassList=$@ \ - -Xshare:dump -XX:SharedClassListFile=$@.tmp $(LOG_DEBUG) 2>&1 - $(RM) $@.tmp + build.tools.classlist.HelloClasslist \ + $(LOG_DEBUG) 2>&1 > $(JLI_TRACE_FILE) TARGETS += $(CLASSLIST_FILE) diff -r b079fff22b3c -r de9ff562c112 jdk/make/gensrc/GensrcVarHandles.gmk --- a/jdk/make/gensrc/GensrcVarHandles.gmk Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/make/gensrc/GensrcVarHandles.gmk Fri Sep 02 02:41:37 2016 +0000 @@ -44,6 +44,10 @@ $1_ARGS += -KAtomicAdd endif + ifneq ($$(findstring $$($1_Type), Boolean Byte Short Char Int Long), ) + $1_ARGS += -KBitwise + endif + ifneq ($$(findstring $$($1_Type), Byte Short Char), ) $1_ARGS += -KShorterThanInt endif @@ -101,6 +105,7 @@ $1_ARGS += -KCAS $1_ARGS += -KAtomicAdd + $1_ARGS += -KBitwise endif ifeq ($$($1_Type), Long) @@ -113,6 +118,7 @@ $1_ARGS += -KCAS $1_ARGS += -KAtomicAdd + $1_ARGS += -KBitwise endif ifeq ($$($1_Type), Float) diff -r b079fff22b3c -r de9ff562c112 jdk/make/mapfiles/libawt/mapfile-mawt-vers --- a/jdk/make/mapfiles/libawt/mapfile-mawt-vers Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/make/mapfiles/libawt/mapfile-mawt-vers Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2001, 2016, 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 @@ -22,259 +22,261 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -# Java_java_awt_KeyboardFocusManager_getGlobalHeavyweightFocusOwner; # Define public interface. # These are the libmawt exports. See mapfile-vers for the libawt exports SUNWprivate_1.1 { - global: - JNI_OnLoad; + global: + JNI_OnLoad; - Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords; - Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse; - Java_java_awt_AWTEvent_nativeSetSource; - Java_java_awt_Checkbox_initIDs; - Java_java_awt_Component_initIDs; - Java_java_awt_Dialog_initIDs; - Java_java_awt_Font_initIDs; - Java_java_awt_KeyboardFocusManager_initIDs; - Java_java_awt_Menu_initIDs; - Java_java_awt_MenuComponent_initIDs; - Java_java_awt_MenuItem_initIDs; - Java_java_awt_Scrollbar_initIDs; - Java_java_awt_ScrollPane_initIDs; - Java_java_awt_TextArea_initIDs; - Java_sun_awt_FontDescriptor_initIDs; - Java_sun_awt_KeyboardFocusManagerPeerImpl_clearNativeGlobalFocusOwner; - Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusOwner; - Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusedWindow; - Java_sun_awt_UNIXToolkit_check_1gtk; - Java_sun_awt_UNIXToolkit_load_1gtk; - Java_sun_awt_UNIXToolkit_unload_1gtk; - Java_sun_awt_UNIXToolkit_load_1stock_1icon; - Java_sun_awt_UNIXToolkit_load_1gtk_1icon; - Java_sun_awt_UNIXToolkit_nativeSync; - Java_sun_awt_X11InputMethod_disposeXIC; - Java_sun_awt_X11InputMethod_isCompositionEnabledNative; - Java_sun_awt_X11InputMethod_resetXIC; - Java_sun_awt_X11InputMethod_setCompositionEnabledNative; - Java_sun_awt_X11InputMethod_turnoffStatusWindow; - Java_sun_awt_SunToolkit_closeSplashScreen; - Java_sun_awt_PlatformFont_initIDs; - Java_sun_awt_X11GraphicsConfig_init; - Java_sun_awt_X11GraphicsConfig_dispose; - Java_sun_awt_X11GraphicsConfig_pGetBounds; - Java_sun_awt_X11GraphicsConfig_getNumColors; - Java_sun_awt_X11GraphicsConfig_getXResolution; - Java_sun_awt_X11GraphicsConfig_getYResolution; - Java_sun_awt_X11GraphicsConfig_createBackBuffer; - Java_sun_awt_X11GraphicsConfig_destroyBackBuffer; - Java_sun_awt_X11GraphicsConfig_swapBuffers; - Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable; - Java_sun_awt_X11GraphicsDevice_isDBESupported; - Java_sun_awt_X11GraphicsDevice_getDisplay; - Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals; - Java_sun_awt_X11GraphicsDevice_getNumConfigs; - Java_sun_awt_X11GraphicsDevice_initIDs; - Java_sun_awt_X11GraphicsDevice_initXrandrExtension; - Java_sun_awt_X11GraphicsDevice_enterFullScreenExclusive; - Java_sun_awt_X11GraphicsDevice_exitFullScreenExclusive; - Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode; - Java_sun_awt_X11GraphicsDevice_enumDisplayModes; - Java_sun_awt_X11GraphicsDevice_configDisplayMode; - Java_sun_awt_X11GraphicsDevice_resetNativeData; - Java_sun_awt_X11GraphicsEnvironment_checkShmExt; - Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum; - Java_sun_awt_X11GraphicsEnvironment_getDisplayString; - Java_sun_awt_X11GraphicsEnvironment_getNumScreens; - Java_sun_awt_X11GraphicsEnvironment_initDisplay; - Java_sun_awt_X11GraphicsEnvironment_initGLX; - Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama; - Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint; - Java_sun_awt_X11GraphicsEnvironment_initXRender; - Java_java_awt_AWTEvent_initIDs; - Java_java_awt_Button_initIDs; - Java_java_awt_Container_initIDs; - Java_java_awt_Cursor_finalizeImpl; - Java_java_awt_Cursor_initIDs; - Java_java_awt_Event_initIDs; - Java_java_awt_event_InputEvent_initIDs; - Java_java_awt_event_KeyEvent_initIDs; - Java_java_awt_FileDialog_initIDs; - Java_java_awt_Frame_initIDs; - Java_java_awt_Insets_initIDs; - Java_java_awt_TextField_initIDs; - Java_java_awt_Window_initIDs; - Java_sun_awt_X11GraphicsConfig_init; - Java_sun_awt_X11GraphicsConfig_initIDs; - Java_sun_awt_X11GraphicsConfig_makeColorModel; - Java_sun_awt_X11GraphicsDevice_getConfigVisualId; - Java_sun_awt_X11GraphicsDevice_getConfigColormap; - Java_sun_awt_X11GraphicsDevice_getConfigDepth; + Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords; + Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse; + Java_java_awt_AWTEvent_nativeSetSource; + Java_java_awt_Checkbox_initIDs; + Java_java_awt_Component_initIDs; + Java_java_awt_Dialog_initIDs; + Java_java_awt_Font_initIDs; + Java_java_awt_KeyboardFocusManager_initIDs; + Java_java_awt_Menu_initIDs; + Java_java_awt_MenuComponent_initIDs; + Java_java_awt_MenuItem_initIDs; + Java_java_awt_Scrollbar_initIDs; + Java_java_awt_ScrollPane_initIDs; + Java_java_awt_TextArea_initIDs; + Java_sun_awt_FontDescriptor_initIDs; + Java_sun_awt_KeyboardFocusManagerPeerImpl_clearNativeGlobalFocusOwner; + Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusOwner; + Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusedWindow; + Java_sun_awt_UNIXToolkit_check_1gtk; + Java_sun_awt_UNIXToolkit_load_1gtk; + Java_sun_awt_UNIXToolkit_unload_1gtk; + Java_sun_awt_UNIXToolkit_load_1stock_1icon; + Java_sun_awt_UNIXToolkit_load_1gtk_1icon; + Java_sun_awt_UNIXToolkit_nativeSync; + Java_sun_awt_X11InputMethod_disposeXIC; + Java_sun_awt_X11InputMethod_isCompositionEnabledNative; + Java_sun_awt_X11InputMethod_resetXIC; + Java_sun_awt_X11InputMethod_setCompositionEnabledNative; + Java_sun_awt_X11InputMethod_turnoffStatusWindow; + Java_sun_awt_SunToolkit_closeSplashScreen; + Java_sun_awt_PlatformFont_initIDs; + Java_sun_awt_X11GraphicsConfig_init; + Java_sun_awt_X11GraphicsConfig_dispose; + Java_sun_awt_X11GraphicsConfig_pGetBounds; + Java_sun_awt_X11GraphicsConfig_getNumColors; + Java_sun_awt_X11GraphicsConfig_getXResolution; + Java_sun_awt_X11GraphicsConfig_getYResolution; + Java_sun_awt_X11GraphicsConfig_createBackBuffer; + Java_sun_awt_X11GraphicsConfig_destroyBackBuffer; + Java_sun_awt_X11GraphicsConfig_swapBuffers; + Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable; + Java_sun_awt_X11GraphicsDevice_isDBESupported; + Java_sun_awt_X11GraphicsDevice_getDisplay; + Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals; + Java_sun_awt_X11GraphicsDevice_getNumConfigs; + Java_sun_awt_X11GraphicsDevice_initIDs; + Java_sun_awt_X11GraphicsDevice_initXrandrExtension; + Java_sun_awt_X11GraphicsDevice_enterFullScreenExclusive; + Java_sun_awt_X11GraphicsDevice_exitFullScreenExclusive; + Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode; + Java_sun_awt_X11GraphicsDevice_enumDisplayModes; + Java_sun_awt_X11GraphicsDevice_configDisplayMode; + Java_sun_awt_X11GraphicsDevice_resetNativeData; + Java_sun_awt_X11GraphicsEnvironment_checkShmExt; + Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum; + Java_sun_awt_X11GraphicsEnvironment_getDisplayString; + Java_sun_awt_X11GraphicsEnvironment_getNumScreens; + Java_sun_awt_X11GraphicsEnvironment_initDisplay; + Java_sun_awt_X11GraphicsEnvironment_initGLX; + Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama; + Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint; + Java_sun_awt_X11GraphicsEnvironment_initXRender; + Java_java_awt_AWTEvent_initIDs; + Java_java_awt_Button_initIDs; + Java_java_awt_Container_initIDs; + Java_java_awt_Cursor_finalizeImpl; + Java_java_awt_Cursor_initIDs; + Java_java_awt_Event_initIDs; + Java_java_awt_event_InputEvent_initIDs; + Java_java_awt_event_KeyEvent_initIDs; + Java_java_awt_FileDialog_initIDs; + Java_java_awt_Frame_initIDs; + Java_java_awt_Insets_initIDs; + Java_java_awt_TextField_initIDs; + Java_java_awt_Window_initIDs; + Java_sun_awt_X11GraphicsConfig_init; + Java_sun_awt_X11GraphicsConfig_initIDs; + Java_sun_awt_X11GraphicsConfig_makeColorModel; + Java_sun_awt_X11GraphicsDevice_getConfigVisualId; + Java_sun_awt_X11GraphicsDevice_getConfigColormap; + Java_sun_awt_X11GraphicsDevice_getConfigDepth; - Java_sun_java2d_x11_X11PMBlitLoops_nativeBlit; - Java_sun_java2d_x11_X11PMBlitLoops_updateBitmask; - Java_sun_java2d_x11_X11PMBlitBgLoops_nativeBlitBg; - Java_sun_java2d_x11_X11Renderer_XFillSpans; - Java_sun_java2d_x11_X11Renderer_XDrawArc; - Java_sun_java2d_x11_X11Renderer_XDrawLine; - Java_sun_java2d_x11_X11Renderer_XDrawOval; - Java_sun_java2d_x11_X11Renderer_XDrawPoly; - Java_sun_java2d_x11_X11Renderer_XDrawRect; - Java_sun_java2d_x11_X11Renderer_XDrawRoundRect; - Java_sun_java2d_x11_X11Renderer_XDoPath; - Java_sun_java2d_x11_X11Renderer_XFillArc; - Java_sun_java2d_x11_X11Renderer_XFillOval; - Java_sun_java2d_x11_X11Renderer_XFillPoly; - Java_sun_java2d_x11_X11Renderer_XFillRect; - Java_sun_java2d_x11_X11Renderer_XFillRoundRect; - Java_sun_java2d_x11_X11Renderer_devCopyArea; - Java_sun_java2d_x11_X11SurfaceData_initIDs; - Java_sun_java2d_x11_X11SurfaceData_initOps; - Java_sun_java2d_x11_X11SurfaceData_initSurface; - Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable; - Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable; - Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; - Java_sun_java2d_x11_X11SurfaceData_XSetXorMode; - Java_sun_java2d_x11_X11SurfaceData_XSetForeground; + Java_sun_java2d_x11_X11PMBlitLoops_nativeBlit; + Java_sun_java2d_x11_X11PMBlitLoops_updateBitmask; + Java_sun_java2d_x11_X11PMBlitBgLoops_nativeBlitBg; + Java_sun_java2d_x11_X11Renderer_XFillSpans; + Java_sun_java2d_x11_X11Renderer_XDrawArc; + Java_sun_java2d_x11_X11Renderer_XDrawLine; + Java_sun_java2d_x11_X11Renderer_XDrawOval; + Java_sun_java2d_x11_X11Renderer_XDrawPoly; + Java_sun_java2d_x11_X11Renderer_XDrawRect; + Java_sun_java2d_x11_X11Renderer_XDrawRoundRect; + Java_sun_java2d_x11_X11Renderer_XDoPath; + Java_sun_java2d_x11_X11Renderer_XFillArc; + Java_sun_java2d_x11_X11Renderer_XFillOval; + Java_sun_java2d_x11_X11Renderer_XFillPoly; + Java_sun_java2d_x11_X11Renderer_XFillRect; + Java_sun_java2d_x11_X11Renderer_XFillRoundRect; + Java_sun_java2d_x11_X11Renderer_devCopyArea; + Java_sun_java2d_x11_X11SurfaceData_initIDs; + Java_sun_java2d_x11_X11SurfaceData_initOps; + Java_sun_java2d_x11_X11SurfaceData_initSurface; + Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable; + Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable; + Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; + Java_sun_java2d_x11_X11SurfaceData_XSetXorMode; + Java_sun_java2d_x11_X11SurfaceData_XSetForeground; - Java_sun_java2d_x11_XSurfaceData_initOps; - Java_sun_java2d_x11_XSurfaceData_XCreateGC; - Java_sun_java2d_x11_XSurfaceData_XResetClip; - Java_sun_java2d_x11_XSurfaceData_XSetClip; - Java_sun_java2d_x11_XSurfaceData_flushNativeSurface; - Java_sun_java2d_x11_XSurfaceData_isDrawableValid; - Java_sun_java2d_x11_XSurfaceData_setInvalid; - Java_sun_java2d_x11_XSurfaceData_XSetGraphicsExposures; - Java_sun_java2d_xr_XRSurfaceData_initXRPicture; - Java_sun_java2d_xr_XRSurfaceData_initIDs; - Java_sun_java2d_xr_XRSurfaceData_XRInitSurface; - Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture; - Java_sun_java2d_xr_XRBackendNative_initIDs; - Java_sun_java2d_xr_XIDGenerator_bufferXIDs; - Java_sun_java2d_xr_XRBackendNative_freeGC; - Java_sun_java2d_xr_XRBackendNative_createGC; - Java_sun_java2d_xr_XRBackendNative_createPixmap; - Java_sun_java2d_xr_XRBackendNative_createPictureNative; - Java_sun_java2d_xr_XRBackendNative_freePicture; - Java_sun_java2d_xr_XRBackendNative_freePixmap; - Java_sun_java2d_xr_XRBackendNative_setPictureRepeat; - Java_sun_java2d_xr_XRBackendNative_setGCExposures; - Java_sun_java2d_xr_XRBackendNative_setGCForeground; - Java_sun_java2d_xr_XRBackendNative_copyArea; - Java_sun_java2d_xr_XRBackendNative_renderComposite; - Java_sun_java2d_xr_XRBackendNative_renderRectangle; - Java_sun_java2d_xr_XRBackendNative_XRenderRectanglesNative; - Java_sun_java2d_xr_XRBackendNative_XRSetTransformNative; - Java_sun_java2d_xr_XRBackendNative_XRCreateLinearGradientPaintNative; - Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative; - Java_sun_java2d_xr_XRBackendNative_setFilter; - Java_sun_java2d_xr_XRBackendNative_XRSetClipNative; - Java_sun_java2d_xr_XRBackendNative_putMaskNative; - Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative; - Java_sun_java2d_xr_XRBackendNative_XRFreeGlyphsNative; - Java_sun_java2d_xr_XRBackendNative_XRenderCreateGlyphSetNative; - Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative; - Java_sun_java2d_xr_XRBackendNative_setGCMode; - Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; - Java_sun_java2d_xr_XRUtils_initFormatPtrs; - Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; - XRT_DrawGlyphList; + Java_sun_java2d_x11_XSurfaceData_initOps; + Java_sun_java2d_x11_XSurfaceData_XCreateGC; + Java_sun_java2d_x11_XSurfaceData_XResetClip; + Java_sun_java2d_x11_XSurfaceData_XSetClip; + Java_sun_java2d_x11_XSurfaceData_flushNativeSurface; + Java_sun_java2d_x11_XSurfaceData_isDrawableValid; + Java_sun_java2d_x11_XSurfaceData_setInvalid; + Java_sun_java2d_x11_XSurfaceData_XSetGraphicsExposures; + Java_sun_java2d_xr_XRSurfaceData_initXRPicture; + Java_sun_java2d_xr_XRSurfaceData_initIDs; + Java_sun_java2d_xr_XRSurfaceData_XRInitSurface; + Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture; + Java_sun_java2d_xr_XRBackendNative_initIDs; + Java_sun_java2d_xr_XIDGenerator_bufferXIDs; + Java_sun_java2d_xr_XRBackendNative_freeGC; + Java_sun_java2d_xr_XRBackendNative_createGC; + Java_sun_java2d_xr_XRBackendNative_createPixmap; + Java_sun_java2d_xr_XRBackendNative_createPictureNative; + Java_sun_java2d_xr_XRBackendNative_freePicture; + Java_sun_java2d_xr_XRBackendNative_freePixmap; + Java_sun_java2d_xr_XRBackendNative_setPictureRepeat; + Java_sun_java2d_xr_XRBackendNative_setGCExposures; + Java_sun_java2d_xr_XRBackendNative_setGCForeground; + Java_sun_java2d_xr_XRBackendNative_copyArea; + Java_sun_java2d_xr_XRBackendNative_renderComposite; + Java_sun_java2d_xr_XRBackendNative_renderRectangle; + Java_sun_java2d_xr_XRBackendNative_XRenderRectanglesNative; + Java_sun_java2d_xr_XRBackendNative_XRSetTransformNative; + Java_sun_java2d_xr_XRBackendNative_XRCreateLinearGradientPaintNative; + Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative; + Java_sun_java2d_xr_XRBackendNative_setFilter; + Java_sun_java2d_xr_XRBackendNative_XRSetClipNative; + Java_sun_java2d_xr_XRBackendNative_putMaskNative; + Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative; + Java_sun_java2d_xr_XRBackendNative_XRFreeGlyphsNative; + Java_sun_java2d_xr_XRBackendNative_XRenderCreateGlyphSetNative; + Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative; + Java_sun_java2d_xr_XRBackendNative_setGCMode; + Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; + Java_sun_java2d_xr_XRUtils_initFormatPtrs; + Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; + XRT_DrawGlyphList; - Java_sun_java2d_opengl_OGLContext_getOGLIdString; - Java_sun_java2d_opengl_OGLMaskFill_maskFill; - Java_sun_java2d_opengl_OGLRenderer_drawPoly; - Java_sun_java2d_opengl_OGLRenderQueue_flushBuffer; - Java_sun_java2d_opengl_OGLSurfaceData_initTexture; - Java_sun_java2d_opengl_OGLSurfaceData_initFBObject; - Java_sun_java2d_opengl_OGLSurfaceData_initFlipBackbuffer; - Java_sun_java2d_opengl_OGLSurfaceData_getTextureID; - Java_sun_java2d_opengl_OGLSurfaceData_getTextureTarget; - Java_sun_java2d_opengl_OGLTextRenderer_drawGlyphList; - Java_sun_java2d_opengl_GLXGraphicsConfig_getGLXConfigInfo; - Java_sun_java2d_opengl_GLXGraphicsConfig_initConfig; - Java_sun_java2d_opengl_GLXGraphicsConfig_getOGLCapabilities; - Java_sun_java2d_opengl_GLXSurfaceData_initOps; + Java_sun_java2d_opengl_OGLContext_getOGLIdString; + Java_sun_java2d_opengl_OGLMaskFill_maskFill; + Java_sun_java2d_opengl_OGLRenderer_drawPoly; + Java_sun_java2d_opengl_OGLRenderQueue_flushBuffer; + Java_sun_java2d_opengl_OGLSurfaceData_initTexture; + Java_sun_java2d_opengl_OGLSurfaceData_initFBObject; + Java_sun_java2d_opengl_OGLSurfaceData_initFlipBackbuffer; + Java_sun_java2d_opengl_OGLSurfaceData_getTextureID; + Java_sun_java2d_opengl_OGLSurfaceData_getTextureTarget; + Java_sun_java2d_opengl_OGLTextRenderer_drawGlyphList; + Java_sun_java2d_opengl_GLXGraphicsConfig_getGLXConfigInfo; + Java_sun_java2d_opengl_GLXGraphicsConfig_initConfig; + Java_sun_java2d_opengl_GLXGraphicsConfig_getOGLCapabilities; + Java_sun_java2d_opengl_GLXSurfaceData_initOps; - Java_sun_print_CUPSPrinter_initIDs; - Java_sun_print_CUPSPrinter_getCupsServer; - Java_sun_print_CUPSPrinter_getCupsPort; - Java_sun_print_CUPSPrinter_getCupsDefaultPrinter; - Java_sun_print_CUPSPrinter_canConnect; - Java_sun_print_CUPSPrinter_getMedia; - Java_sun_print_CUPSPrinter_getPageSizes; - Java_sun_print_CUPSPrinter_getResolutions; + Java_sun_print_CUPSPrinter_initIDs; + Java_sun_print_CUPSPrinter_getCupsServer; + Java_sun_print_CUPSPrinter_getCupsPort; + Java_sun_print_CUPSPrinter_getCupsDefaultPrinter; + Java_sun_print_CUPSPrinter_canConnect; + Java_sun_print_CUPSPrinter_getMedia; + Java_sun_print_CUPSPrinter_getPageSizes; + Java_sun_print_CUPSPrinter_getResolutions; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1arrow; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box_1gap; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1check; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1expander; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1extension; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1flat_1box; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1focus; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1handle; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1hline; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1option; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1shadow; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1slider; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1vline; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1background; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeStartPainting; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeFinishPainting; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1switch_1theme; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1get_1gtk_1setting; - Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeSetRangeValue; - Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetXThickness; - Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetYThickness; - Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetColorForState; - Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetClassValue; - Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetPangoFontName; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1arrow; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box_1gap; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1check; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1expander; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1extension; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1flat_1box; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1focus; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1handle; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1hline; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1option; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1shadow; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1slider; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1vline; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1background; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeStartPainting; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeFinishPainting; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1switch_1theme; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1get_1gtk_1setting; + Java_com_sun_java_swing_plaf_gtk_GTKEngine_nativeSetRangeValue; + Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetXThickness; + Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetYThickness; + Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetColorForState; + Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetClassValue; + Java_com_sun_java_swing_plaf_gtk_GTKStyle_nativeGetPangoFontName; - awt_display; - awt_Lock; - awt_Unlock; - awt_GetDrawingSurface; - awt_FreeDrawingSurface; - awt_GetComponent; + awt_display; + awt_Lock; + awt_Unlock; + awt_GetDrawingSurface; + awt_FreeDrawingSurface; + awt_GetComponent; + awt_CreateEmbeddedFrame; + awt_SetBounds; + awt_SynthesizeWindowActivation; - X11SurfaceData_GetOps; - getDefaultConfig; - Java_sun_font_FontConfigManager_getFontConfig; - Java_sun_font_FontConfigManager_getFontConfigAASettings; - Java_sun_awt_FcFontManager_getFontPathNative; - Java_sun_font_SunFontManager_populateFontFileNameMap; + X11SurfaceData_GetOps; + getDefaultConfig; + Java_sun_font_FontConfigManager_getFontConfig; + Java_sun_font_FontConfigManager_getFontConfigAASettings; + Java_sun_awt_FcFontManager_getFontPathNative; + Java_sun_font_SunFontManager_populateFontFileNameMap; - # CDE private entry point - Java_sun_awt_motif_XsessionWMcommand; - Java_sun_awt_motif_XsessionWMcommand_New; + # CDE private entry point + Java_sun_awt_motif_XsessionWMcommand; + Java_sun_awt_motif_XsessionWMcommand_New; - # libfontmanager entry points - AWTIsHeadless; - AWTCountFonts; - AWTLoadFont; - AWTFreeFont; - AWTFontAscent; - AWTFontDescent; - AWTFontMinByte1; - AWTFontMaxByte1; - AWTFontMinCharOrByte2; - AWTFontMaxCharOrByte2; - AWTFontDefaultChar; - AWTFontPerChar; - AWTFontMaxBounds; - AWTFontTextExtents16; - AWTFreeChar; - AWTFontGenerateImage; - AWTCharAdvance; - AWTCharLBearing; - AWTCharRBearing; - AWTCharAscent; - AWTCharDescent; - AWTDrawGlyphList; - AccelGlyphCache_RemoveAllCellInfos; + # libfontmanager entry points + AWTIsHeadless; + AWTCountFonts; + AWTLoadFont; + AWTFreeFont; + AWTFontAscent; + AWTFontDescent; + AWTFontMinByte1; + AWTFontMaxByte1; + AWTFontMinCharOrByte2; + AWTFontMaxCharOrByte2; + AWTFontDefaultChar; + AWTFontPerChar; + AWTFontMaxBounds; + AWTFontTextExtents16; + AWTFreeChar; + AWTFontGenerateImage; + AWTCharAdvance; + AWTCharLBearing; + AWTCharRBearing; + AWTCharAscent; + AWTCharDescent; + AWTDrawGlyphList; + AccelGlyphCache_RemoveAllCellInfos; - local: - *; + local: + *; }; diff -r b079fff22b3c -r de9ff562c112 jdk/make/mapfiles/libawt/mapfile-vers --- a/jdk/make/mapfiles/libawt/mapfile-vers Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/make/mapfiles/libawt/mapfile-vers Fri Sep 02 02:41:37 2016 +0000 @@ -27,163 +27,163 @@ # These are the libawt exports, mapfile-mawt-vers contains the libmawt exports. SUNWprivate_1.1 { - global: - JNI_OnLoad; + global: + JNI_OnLoad; - Java_java_awt_CheckboxMenuItem_initIDs; - Java_java_awt_Color_initIDs; - Java_java_awt_FontMetrics_initIDs; - Java_java_awt_image_BufferedImage_initIDs; - Java_sun_awt_image_DataBufferNative_getElem; - Java_sun_awt_image_DataBufferNative_setElem; - Java_java_awt_image_ColorModel_initIDs; - Java_java_awt_image_IndexColorModel_initIDs; - Java_java_awt_image_Kernel_initIDs; - Java_java_awt_image_Raster_initIDs; - Java_java_awt_image_SampleModel_initIDs; - Java_java_awt_Label_initIDs; - Java_java_awt_MenuBar_initIDs; - Java_java_awt_ScrollPaneAdjustable_initIDs; - Java_java_awt_Toolkit_initIDs; - Java_sun_awt_DebugSettings_setCTracingOn__Z; - Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2; - Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2I; - Java_sun_awt_image_ByteComponentRaster_initIDs; - Java_sun_awt_image_GifImageDecoder_initIDs; - Java_sun_awt_image_GifImageDecoder_parseImage; - Java_sun_awt_image_ImageRepresentation_initIDs; - Java_sun_awt_image_ImageRepresentation_setDiffICM; - Java_sun_awt_image_ImageRepresentation_setICMpixels; - Java_sun_awt_image_ImagingLib_convolveBI; - Java_sun_awt_image_ImagingLib_convolveRaster; - Java_sun_awt_image_ImagingLib_init; - Java_sun_awt_image_ImagingLib_transformBI; - Java_sun_awt_image_ImagingLib_transformRaster; - Java_sun_awt_image_IntegerComponentRaster_initIDs; - Java_sun_awt_image_ShortComponentRaster_initIDs; - Java_sun_java2d_pipe_BufferedMaskBlit_enqueueTile; - Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans; - Java_sun_java2d_pipe_SpanClipRenderer_eraseTile; - Java_sun_java2d_pipe_SpanClipRenderer_fillTile; - Java_sun_java2d_pipe_ShapeSpanIterator_addSegment; - Java_sun_java2d_pipe_ShapeSpanIterator_moveTo; - Java_sun_java2d_pipe_ShapeSpanIterator_lineTo; - Java_sun_java2d_pipe_ShapeSpanIterator_quadTo; - Java_sun_java2d_pipe_ShapeSpanIterator_curveTo; - Java_sun_java2d_pipe_ShapeSpanIterator_closePath; - Java_sun_java2d_pipe_ShapeSpanIterator_pathDone; - Java_sun_java2d_pipe_ShapeSpanIterator_getNativeConsumer; - Java_sun_java2d_pipe_ShapeSpanIterator_appendPoly; - Java_sun_java2d_pipe_ShapeSpanIterator_dispose; - Java_sun_java2d_pipe_ShapeSpanIterator_getNativeIterator; - Java_sun_java2d_pipe_ShapeSpanIterator_getPathBox; - Java_sun_java2d_pipe_ShapeSpanIterator_initIDs; - Java_sun_java2d_pipe_ShapeSpanIterator_intersectClipBox; - Java_sun_java2d_pipe_ShapeSpanIterator_nextSpan; - Java_sun_java2d_pipe_ShapeSpanIterator_setNormalize; - Java_sun_java2d_pipe_ShapeSpanIterator_setOutputAreaXYXY; - Java_sun_java2d_pipe_ShapeSpanIterator_setRule; - Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo; + Java_java_awt_CheckboxMenuItem_initIDs; + Java_java_awt_Color_initIDs; + Java_java_awt_FontMetrics_initIDs; + Java_java_awt_image_BufferedImage_initIDs; + Java_sun_awt_image_DataBufferNative_getElem; + Java_sun_awt_image_DataBufferNative_setElem; + Java_java_awt_image_ColorModel_initIDs; + Java_java_awt_image_IndexColorModel_initIDs; + Java_java_awt_image_Kernel_initIDs; + Java_java_awt_image_Raster_initIDs; + Java_java_awt_image_SampleModel_initIDs; + Java_java_awt_Label_initIDs; + Java_java_awt_MenuBar_initIDs; + Java_java_awt_ScrollPaneAdjustable_initIDs; + Java_java_awt_Toolkit_initIDs; + Java_sun_awt_DebugSettings_setCTracingOn__Z; + Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2; + Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2I; + Java_sun_awt_image_ByteComponentRaster_initIDs; + Java_sun_awt_image_GifImageDecoder_initIDs; + Java_sun_awt_image_GifImageDecoder_parseImage; + Java_sun_awt_image_ImageRepresentation_initIDs; + Java_sun_awt_image_ImageRepresentation_setDiffICM; + Java_sun_awt_image_ImageRepresentation_setICMpixels; + Java_sun_awt_image_ImagingLib_convolveBI; + Java_sun_awt_image_ImagingLib_convolveRaster; + Java_sun_awt_image_ImagingLib_init; + Java_sun_awt_image_ImagingLib_transformBI; + Java_sun_awt_image_ImagingLib_transformRaster; + Java_sun_awt_image_IntegerComponentRaster_initIDs; + Java_sun_awt_image_ShortComponentRaster_initIDs; + Java_sun_java2d_pipe_BufferedMaskBlit_enqueueTile; + Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans; + Java_sun_java2d_pipe_SpanClipRenderer_eraseTile; + Java_sun_java2d_pipe_SpanClipRenderer_fillTile; + Java_sun_java2d_pipe_ShapeSpanIterator_addSegment; + Java_sun_java2d_pipe_ShapeSpanIterator_moveTo; + Java_sun_java2d_pipe_ShapeSpanIterator_lineTo; + Java_sun_java2d_pipe_ShapeSpanIterator_quadTo; + Java_sun_java2d_pipe_ShapeSpanIterator_curveTo; + Java_sun_java2d_pipe_ShapeSpanIterator_closePath; + Java_sun_java2d_pipe_ShapeSpanIterator_pathDone; + Java_sun_java2d_pipe_ShapeSpanIterator_getNativeConsumer; + Java_sun_java2d_pipe_ShapeSpanIterator_appendPoly; + Java_sun_java2d_pipe_ShapeSpanIterator_dispose; + Java_sun_java2d_pipe_ShapeSpanIterator_getNativeIterator; + Java_sun_java2d_pipe_ShapeSpanIterator_getPathBox; + Java_sun_java2d_pipe_ShapeSpanIterator_initIDs; + Java_sun_java2d_pipe_ShapeSpanIterator_intersectClipBox; + Java_sun_java2d_pipe_ShapeSpanIterator_nextSpan; + Java_sun_java2d_pipe_ShapeSpanIterator_setNormalize; + Java_sun_java2d_pipe_ShapeSpanIterator_setOutputAreaXYXY; + Java_sun_java2d_pipe_ShapeSpanIterator_setRule; + Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo; - Java_java_awt_Choice_initIDs; - Java_java_awt_Dimension_initIDs; - Java_java_awt_event_MouseEvent_initIDs; - Java_java_awt_image_SinglePixelPackedSampleModel_initIDs; - Java_java_awt_Rectangle_initIDs; - Java_sun_awt_image_BufImgSurfaceData_initIDs; - Java_sun_awt_image_BufImgSurfaceData_initRaster; - Java_sun_awt_image_BufImgSurfaceData_freeNativeICMData; - Java_sun_awt_image_BytePackedRaster_initIDs; - Java_sun_awt_image_ImagingLib_lookupByteBI; - Java_sun_awt_image_ImagingLib_lookupByteRaster; - Java_sun_java2d_SurfaceData_initIDs; - Java_sun_java2d_SurfaceData_isOpaqueGray; - Java_sun_java2d_Disposer_initIDs; - Java_sun_java2d_DefaultDisposerRecord_invokeNativeDispose; - Java_sun_java2d_loops_BlitBg_BlitBg; - Java_sun_java2d_loops_Blit_Blit; - Java_sun_java2d_loops_ScaledBlit_Scale; - Java_sun_java2d_loops_DrawLine_DrawLine; - Java_sun_java2d_loops_DrawPolygons_DrawPolygons; - Java_sun_java2d_loops_DrawPath_DrawPath; - Java_sun_java2d_loops_FillPath_FillPath; + Java_java_awt_Choice_initIDs; + Java_java_awt_Dimension_initIDs; + Java_java_awt_event_MouseEvent_initIDs; + Java_java_awt_image_SinglePixelPackedSampleModel_initIDs; + Java_java_awt_Rectangle_initIDs; + Java_sun_awt_image_BufImgSurfaceData_initIDs; + Java_sun_awt_image_BufImgSurfaceData_initRaster; + Java_sun_awt_image_BufImgSurfaceData_freeNativeICMData; + Java_sun_awt_image_BytePackedRaster_initIDs; + Java_sun_awt_image_ImagingLib_lookupByteBI; + Java_sun_awt_image_ImagingLib_lookupByteRaster; + Java_sun_java2d_SurfaceData_initIDs; + Java_sun_java2d_SurfaceData_isOpaqueGray; + Java_sun_java2d_Disposer_initIDs; + Java_sun_java2d_DefaultDisposerRecord_invokeNativeDispose; + Java_sun_java2d_loops_BlitBg_BlitBg; + Java_sun_java2d_loops_Blit_Blit; + Java_sun_java2d_loops_ScaledBlit_Scale; + Java_sun_java2d_loops_DrawLine_DrawLine; + Java_sun_java2d_loops_DrawPolygons_DrawPolygons; + Java_sun_java2d_loops_DrawPath_DrawPath; + Java_sun_java2d_loops_FillPath_FillPath; - Java_sun_java2d_loops_DrawRect_DrawRect; - Java_sun_java2d_loops_FillRect_FillRect; - Java_sun_java2d_loops_FillSpans_FillSpans; - Java_sun_java2d_loops_FillParallelogram_FillParallelogram; - Java_sun_java2d_loops_DrawParallelogram_DrawParallelogram; - Java_sun_java2d_loops_GraphicsPrimitiveMgr_initIDs; - Java_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops; - Java_sun_java2d_loops_MaskBlit_MaskBlit; - Java_sun_java2d_loops_MaskFill_MaskFill; - Java_sun_java2d_loops_MaskFill_FillAAPgram; - Java_sun_java2d_loops_MaskFill_DrawAAPgram; - Java_sun_java2d_loops_TransformHelper_Transform; - Java_sun_java2d_pipe_Region_initIDs; - Java_sun_java2d_pipe_SpanClipRenderer_initIDs; - sun_awt_image_GifImageDecoder_initIDs; + Java_sun_java2d_loops_DrawRect_DrawRect; + Java_sun_java2d_loops_FillRect_FillRect; + Java_sun_java2d_loops_FillSpans_FillSpans; + Java_sun_java2d_loops_FillParallelogram_FillParallelogram; + Java_sun_java2d_loops_DrawParallelogram_DrawParallelogram; + Java_sun_java2d_loops_GraphicsPrimitiveMgr_initIDs; + Java_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops; + Java_sun_java2d_loops_MaskBlit_MaskBlit; + Java_sun_java2d_loops_MaskFill_MaskFill; + Java_sun_java2d_loops_MaskFill_FillAAPgram; + Java_sun_java2d_loops_MaskFill_DrawAAPgram; + Java_sun_java2d_loops_TransformHelper_Transform; + Java_sun_java2d_pipe_Region_initIDs; + Java_sun_java2d_pipe_SpanClipRenderer_initIDs; + sun_awt_image_GifImageDecoder_initIDs; - # libmawt entry points - SurfaceData_InitOps; - SurfaceData_ThrowInvalidPipeException; - SurfaceData_IntersectBlitBounds; - SurfaceData_IntersectBoundsXYXY; - Region_GetBounds; - Region_GetInfo; - Region_StartIteration; - Region_CountIterationRects; - Region_NextIteration; - Region_EndIteration; - RegionToYXBandedRectangles; - GrPrim_CompGetXorInfo; - GrPrim_CompGetAlphaInfo; - J2dTraceImpl; - J2dTraceInit; - img_makePalette; - initInverseGrayLut; - make_dither_arrays; - make_uns_ordered_dither_array; + # libmawt entry points + SurfaceData_InitOps; + SurfaceData_ThrowInvalidPipeException; + SurfaceData_IntersectBlitBounds; + SurfaceData_IntersectBoundsXYXY; + Region_GetBounds; + Region_GetInfo; + Region_StartIteration; + Region_CountIterationRects; + Region_NextIteration; + Region_EndIteration; + RegionToYXBandedRectangles; + GrPrim_CompGetXorInfo; + GrPrim_CompGetAlphaInfo; + J2dTraceImpl; + J2dTraceInit; + img_makePalette; + initInverseGrayLut; + make_dither_arrays; + make_uns_ordered_dither_array; - # variables exported to libmawt - std_img_oda_red; - std_img_oda_blue; - std_img_oda_green; - std_odas_computed; - g_CMpDataID; - colorValueID; - mul8table; - div8table; - jvm; + # variables exported to libmawt + std_img_oda_red; + std_img_oda_blue; + std_img_oda_green; + std_odas_computed; + g_CMpDataID; + colorValueID; + mul8table; + div8table; + jvm; - # ProcessPath entry points and data - doDrawPath; - doFillPath; - path2DNumTypesID; - path2DTypesID; - path2DWindingRuleID; - path2DFloatCoordsID; - sg2dStrokeHintID; - sunHints_INTVAL_STROKE_PURE; + # ProcessPath entry points and data + doDrawPath; + doFillPath; + path2DNumTypesID; + path2DTypesID; + path2DWindingRuleID; + path2DFloatCoordsID; + sg2dStrokeHintID; + sunHints_INTVAL_STROKE_PURE; - # CDE private entry points - # These are in awt_LoadLibrary.c and falls through to libmawt. - # Evidently CDE needs this for backward compatability. - Java_sun_awt_motif_XsessionWMcommand; - Java_sun_awt_motif_XsessionWMcommand_New; + # CDE private entry points + # These are in awt_LoadLibrary.c and falls through to libmawt. + # Evidently CDE needs this for backward compatability. + Java_sun_awt_motif_XsessionWMcommand; + Java_sun_awt_motif_XsessionWMcommand_New; - # libfontmanager entry points - AWTIsHeadless; - GrPrim_Sg2dGetCompInfo; - GrPrim_Sg2dGetClip; - GetNativePrim; - SurfaceData_IntersectBounds; - SurfaceData_GetOps; - Disposer_AddRecord; - GrPrim_Sg2dGetEaRGB; - GrPrim_Sg2dGetPixel; - GrPrim_Sg2dGetLCDTextContrast; + # libfontmanager entry points + AWTIsHeadless; + GrPrim_Sg2dGetCompInfo; + GrPrim_Sg2dGetClip; + GetNativePrim; + SurfaceData_IntersectBounds; + SurfaceData_GetOps; + Disposer_AddRecord; + GrPrim_Sg2dGetEaRGB; + GrPrim_Sg2dGetPixel; + GrPrim_Sg2dGetLCDTextContrast; - local: - *; + local: + *; }; diff -r b079fff22b3c -r de9ff562c112 jdk/make/mapfiles/libawt/mapfile-vers-linux --- a/jdk/make/mapfiles/libawt/mapfile-vers-linux Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/make/mapfiles/libawt/mapfile-vers-linux Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ # -# Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2002, 2016, 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 @@ -27,277 +27,278 @@ # Linux port does not use mawt, all public symbols are in libawt.so SUNWprivate_1.1 { - global: - JNI_OnLoad; + global: + JNI_OnLoad; - Java_java_awt_CheckboxMenuItem_initIDs; - Java_java_awt_Color_initIDs; - Java_java_awt_FontMetrics_initIDs; - Java_java_awt_image_BufferedImage_initIDs; - Java_sun_awt_image_DataBufferNative_getElem; - Java_sun_awt_image_DataBufferNative_setElem; - Java_java_awt_image_ColorModel_initIDs; - Java_java_awt_image_IndexColorModel_initIDs; - Java_java_awt_image_Kernel_initIDs; - Java_java_awt_image_Raster_initIDs; - Java_java_awt_image_SampleModel_initIDs; - Java_java_awt_Label_initIDs; - Java_java_awt_MenuBar_initIDs; - Java_java_awt_ScrollPaneAdjustable_initIDs; - Java_java_awt_Toolkit_initIDs; - Java_java_awt_TrayIcon_initIDs; - Java_sun_awt_DebugSettings_setCTracingOn__Z; - Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2; - Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2I; - Java_sun_awt_image_ByteComponentRaster_initIDs; - Java_sun_awt_image_GifImageDecoder_initIDs; - Java_sun_awt_image_GifImageDecoder_parseImage; - Java_sun_awt_image_Image_initIDs; - Java_sun_awt_image_ImageRepresentation_initIDs; - Java_sun_awt_image_ImageRepresentation_setDiffICM; - Java_sun_awt_image_ImageRepresentation_setICMpixels; - Java_sun_awt_image_ImagingLib_convolveBI; - Java_sun_awt_image_ImagingLib_convolveRaster; - Java_sun_awt_image_ImagingLib_init; - Java_sun_awt_image_ImagingLib_transformBI; - Java_sun_awt_image_ImagingLib_transformRaster; - Java_sun_awt_image_IntegerComponentRaster_initIDs; - Java_sun_awt_image_ShortComponentRaster_initIDs; - Java_sun_java2d_pipe_SpanClipRenderer_eraseTile; - Java_sun_java2d_pipe_SpanClipRenderer_fillTile; - Java_sun_java2d_pipe_ShapeSpanIterator_addSegment; - Java_sun_java2d_pipe_ShapeSpanIterator_moveTo; - Java_sun_java2d_pipe_ShapeSpanIterator_lineTo; - Java_sun_java2d_pipe_ShapeSpanIterator_quadTo; - Java_sun_java2d_pipe_ShapeSpanIterator_curveTo; - Java_sun_java2d_pipe_ShapeSpanIterator_closePath; - Java_sun_java2d_pipe_ShapeSpanIterator_pathDone; - Java_sun_java2d_pipe_ShapeSpanIterator_getNativeConsumer; - Java_sun_java2d_pipe_ShapeSpanIterator_appendPoly; - Java_sun_java2d_pipe_ShapeSpanIterator_dispose; - Java_sun_java2d_pipe_ShapeSpanIterator_getNativeIterator; - Java_sun_java2d_pipe_ShapeSpanIterator_getPathBox; - Java_sun_java2d_pipe_ShapeSpanIterator_initIDs; - Java_sun_java2d_pipe_ShapeSpanIterator_intersectClipBox; - Java_sun_java2d_pipe_ShapeSpanIterator_nextSpan; - Java_sun_java2d_pipe_ShapeSpanIterator_setNormalize; - Java_sun_java2d_pipe_ShapeSpanIterator_setOutputAreaXYXY; - Java_sun_java2d_pipe_ShapeSpanIterator_setRule; - Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo; + Java_java_awt_CheckboxMenuItem_initIDs; + Java_java_awt_Color_initIDs; + Java_java_awt_FontMetrics_initIDs; + Java_java_awt_image_BufferedImage_initIDs; + Java_sun_awt_image_DataBufferNative_getElem; + Java_sun_awt_image_DataBufferNative_setElem; + Java_java_awt_image_ColorModel_initIDs; + Java_java_awt_image_IndexColorModel_initIDs; + Java_java_awt_image_Kernel_initIDs; + Java_java_awt_image_Raster_initIDs; + Java_java_awt_image_SampleModel_initIDs; + Java_java_awt_Label_initIDs; + Java_java_awt_MenuBar_initIDs; + Java_java_awt_ScrollPaneAdjustable_initIDs; + Java_java_awt_Toolkit_initIDs; + Java_java_awt_TrayIcon_initIDs; + Java_sun_awt_DebugSettings_setCTracingOn__Z; + Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2; + Java_sun_awt_DebugSettings_setCTracingOn__ZLjava_lang_String_2I; + Java_sun_awt_image_ByteComponentRaster_initIDs; + Java_sun_awt_image_GifImageDecoder_initIDs; + Java_sun_awt_image_GifImageDecoder_parseImage; + Java_sun_awt_image_Image_initIDs; + Java_sun_awt_image_ImageRepresentation_initIDs; + Java_sun_awt_image_ImageRepresentation_setDiffICM; + Java_sun_awt_image_ImageRepresentation_setICMpixels; + Java_sun_awt_image_ImagingLib_convolveBI; + Java_sun_awt_image_ImagingLib_convolveRaster; + Java_sun_awt_image_ImagingLib_init; + Java_sun_awt_image_ImagingLib_transformBI; + Java_sun_awt_image_ImagingLib_transformRaster; + Java_sun_awt_image_IntegerComponentRaster_initIDs; + Java_sun_awt_image_ShortComponentRaster_initIDs; + Java_sun_java2d_pipe_SpanClipRenderer_eraseTile; + Java_sun_java2d_pipe_SpanClipRenderer_fillTile; + Java_sun_java2d_pipe_ShapeSpanIterator_addSegment; + Java_sun_java2d_pipe_ShapeSpanIterator_moveTo; + Java_sun_java2d_pipe_ShapeSpanIterator_lineTo; + Java_sun_java2d_pipe_ShapeSpanIterator_quadTo; + Java_sun_java2d_pipe_ShapeSpanIterator_curveTo; + Java_sun_java2d_pipe_ShapeSpanIterator_closePath; + Java_sun_java2d_pipe_ShapeSpanIterator_pathDone; + Java_sun_java2d_pipe_ShapeSpanIterator_getNativeConsumer; + Java_sun_java2d_pipe_ShapeSpanIterator_appendPoly; + Java_sun_java2d_pipe_ShapeSpanIterator_dispose; + Java_sun_java2d_pipe_ShapeSpanIterator_getNativeIterator; + Java_sun_java2d_pipe_ShapeSpanIterator_getPathBox; + Java_sun_java2d_pipe_ShapeSpanIterator_initIDs; + Java_sun_java2d_pipe_ShapeSpanIterator_intersectClipBox; + Java_sun_java2d_pipe_ShapeSpanIterator_nextSpan; + Java_sun_java2d_pipe_ShapeSpanIterator_setNormalize; + Java_sun_java2d_pipe_ShapeSpanIterator_setOutputAreaXYXY; + Java_sun_java2d_pipe_ShapeSpanIterator_setRule; + Java_sun_java2d_pipe_ShapeSpanIterator_skipDownTo; - Java_java_awt_Choice_initIDs; - Java_java_awt_Dimension_initIDs; - Java_java_awt_event_MouseEvent_initIDs; - Java_java_awt_image_SinglePixelPackedSampleModel_initIDs; - Java_java_awt_Rectangle_initIDs; - Java_sun_awt_image_BufImgSurfaceData_getSurfaceData; - Java_sun_awt_image_BufImgSurfaceData_initIDs; - Java_sun_awt_image_BufImgSurfaceData_initRaster; - Java_sun_awt_image_BufImgSurfaceData_setSurfaceData; - Java_sun_awt_image_BufImgSurfaceData_freeNativeICMData; - Java_sun_awt_image_BytePackedRaster_initIDs; - Java_sun_awt_image_ImagingLib_lookupByteBI; - Java_sun_awt_image_ImagingLib_lookupByteRaster; - Java_sun_java2d_SurfaceData_initIDs; - Java_sun_java2d_SurfaceData_isOpaqueGray; - Java_sun_java2d_Disposer_initIDs; - Java_sun_java2d_DefaultDisposerRecord_invokeNativeDispose; - Java_sun_java2d_loops_BlitBg_BlitBg; - Java_sun_java2d_loops_Blit_Blit; - Java_sun_java2d_loops_ScaledBlit_Scale; - Java_sun_java2d_loops_DrawLine_DrawLine; - Java_sun_java2d_loops_DrawPolygons_DrawPolygons; - Java_sun_java2d_loops_DrawRect_DrawRect; - Java_sun_java2d_loops_FillRect_FillRect; - Java_sun_java2d_loops_FillSpans_FillSpans; - Java_sun_java2d_loops_GraphicsPrimitiveMgr_initIDs; - Java_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops; - Java_sun_java2d_loops_MaskBlit_MaskBlit; - Java_sun_java2d_loops_MaskFill_MaskFill; - Java_sun_java2d_loops_MaskFill_FillAAPgram; - Java_sun_java2d_loops_MaskFill_DrawAAPgram; - Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans; - Java_sun_java2d_pipe_SpanClipRenderer_initIDs; - sun_awt_image_GifImageDecoder_initIDs; + Java_java_awt_Choice_initIDs; + Java_java_awt_Dimension_initIDs; + Java_java_awt_event_MouseEvent_initIDs; + Java_java_awt_image_SinglePixelPackedSampleModel_initIDs; + Java_java_awt_Rectangle_initIDs; + Java_sun_awt_image_BufImgSurfaceData_getSurfaceData; + Java_sun_awt_image_BufImgSurfaceData_initIDs; + Java_sun_awt_image_BufImgSurfaceData_initRaster; + Java_sun_awt_image_BufImgSurfaceData_setSurfaceData; + Java_sun_awt_image_BufImgSurfaceData_freeNativeICMData; + Java_sun_awt_image_BytePackedRaster_initIDs; + Java_sun_awt_image_ImagingLib_lookupByteBI; + Java_sun_awt_image_ImagingLib_lookupByteRaster; + Java_sun_java2d_SurfaceData_initIDs; + Java_sun_java2d_SurfaceData_isOpaqueGray; + Java_sun_java2d_Disposer_initIDs; + Java_sun_java2d_DefaultDisposerRecord_invokeNativeDispose; + Java_sun_java2d_loops_BlitBg_BlitBg; + Java_sun_java2d_loops_Blit_Blit; + Java_sun_java2d_loops_ScaledBlit_Scale; + Java_sun_java2d_loops_DrawLine_DrawLine; + Java_sun_java2d_loops_DrawPolygons_DrawPolygons; + Java_sun_java2d_loops_DrawRect_DrawRect; + Java_sun_java2d_loops_FillRect_FillRect; + Java_sun_java2d_loops_FillSpans_FillSpans; + Java_sun_java2d_loops_GraphicsPrimitiveMgr_initIDs; + Java_sun_java2d_loops_GraphicsPrimitiveMgr_registerNativeLoops; + Java_sun_java2d_loops_MaskBlit_MaskBlit; + Java_sun_java2d_loops_MaskFill_MaskFill; + Java_sun_java2d_loops_MaskFill_FillAAPgram; + Java_sun_java2d_loops_MaskFill_DrawAAPgram; + Java_sun_java2d_pipe_BufferedRenderPipe_fillSpans; + Java_sun_java2d_pipe_SpanClipRenderer_initIDs; + sun_awt_image_GifImageDecoder_initIDs; - # libmawt entry points - SurfaceData_InitOps; - SurfaceData_ThrowInvalidPipeException; - Region_GetBounds; - Region_GetInfo; - Region_StartIteration; - Region_CountIterationRects; - Region_NextIteration; - Region_EndIteration; - GrPrim_CompGetXorInfo; - GrPrim_CompGetAlphaInfo; - img_makePalette; - initInverseGrayLut; - make_dither_arrays; - make_uns_ordered_dither_array; + # libmawt entry points + SurfaceData_InitOps; + SurfaceData_ThrowInvalidPipeException; + Region_GetBounds; + Region_GetInfo; + Region_StartIteration; + Region_CountIterationRects; + Region_NextIteration; + Region_EndIteration; + GrPrim_CompGetXorInfo; + GrPrim_CompGetAlphaInfo; + img_makePalette; + initInverseGrayLut; + make_dither_arrays; + make_uns_ordered_dither_array; - # variables exported to libmawt - std_img_oda_red; - std_img_oda_blue; - std_img_oda_green; - std_odas_computed; - g_CMpDataID; - colorValueID; - jvm; + # variables exported to libmawt + std_img_oda_red; + std_img_oda_blue; + std_img_oda_green; + std_odas_computed; + g_CMpDataID; + colorValueID; + jvm; - # CDE private entry point - # This is in awt_LoadLibrary.c and falls through to libmawt. - # Evidently CDE needs this for backward compatability. - Java_sun_awt_motif_XsessionWMcommand; + # CDE private entry point + # This is in awt_LoadLibrary.c and falls through to libmawt. + # Evidently CDE needs this for backward compatability. + Java_sun_awt_motif_XsessionWMcommand; - # libfontmanager entry points - AWTIsHeadless; - GrPrim_Sg2dGetCompInfo; - GrPrim_Sg2dGetClip; - GetNativePrim; - SurfaceData_IntersectBounds; - SurfaceData_GetOps; - Disposer_AddRecord; - GrPrim_Sg2dGetEaRGB; - GrPrim_Sg2dGetPixel; - GrPrim_Sg2dGetLCDTextContrast; + # libfontmanager entry points + AWTIsHeadless; + GrPrim_Sg2dGetCompInfo; + GrPrim_Sg2dGetClip; + GetNativePrim; + SurfaceData_IntersectBounds; + SurfaceData_GetOps; + Disposer_AddRecord; + GrPrim_Sg2dGetEaRGB; + GrPrim_Sg2dGetPixel; + GrPrim_Sg2dGetLCDTextContrast; - Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords; - Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse; - Java_java_awt_AWTEvent_nativeSetSource; - Java_java_awt_Checkbox_initIDs; - Java_java_awt_Component_initIDs; - Java_java_awt_Dialog_initIDs; - Java_java_awt_Font_initIDs; - Java_sun_awt_KeyboardFocusManagerPeerImpl_clearNativeGlobalFocusOwner; - Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusOwner; - Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusedWindow; - Java_java_awt_KeyboardFocusManager_initIDs; - Java_java_awt_Menu_initIDs; - Java_java_awt_MenuComponent_initIDs; - Java_java_awt_MenuItem_initIDs; - Java_java_awt_Scrollbar_initIDs; - Java_java_awt_ScrollPane_initIDs; - Java_java_awt_TextArea_initIDs; - Java_sun_awt_FontDescriptor_initIDs; - Java_sun_awt_X11InputMethod_disposeXIC; - Java_sun_awt_X11InputMethod_isCompositionEnabledNative; - Java_sun_awt_X11InputMethod_resetXIC; - Java_sun_awt_X11InputMethod_setCompositionEnabledNative; - Java_sun_awt_X11InputMethod_turnoffStatusWindow; - Java_sun_awt_SunToolkit_closeSplashScreen; - Java_sun_awt_PlatformFont_initIDs; - Java_sun_awt_X11GraphicsConfig_init; - Java_sun_awt_X11GraphicsConfig_dispose; - Java_sun_awt_X11GraphicsConfig_pGetBounds; - Java_sun_awt_X11GraphicsConfig_getNumColors; - Java_sun_awt_X11GraphicsConfig_getXResolution; - Java_sun_awt_X11GraphicsConfig_getYResolution; - Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable; - Java_sun_awt_X11GraphicsDevice_isDBESupported; - Java_sun_awt_X11GraphicsDevice_getDisplay; - Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals; - Java_sun_awt_X11GraphicsDevice_getNumConfigs; - Java_sun_awt_X11GraphicsDevice_initIDs; - Java_sun_awt_X11GraphicsDevice_initXrandrExtension; - Java_sun_awt_X11GraphicsDevice_enterFullScreenExclusive; - Java_sun_awt_X11GraphicsDevice_exitFullScreenExclusive; - Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode; - Java_sun_awt_X11GraphicsDevice_enumDisplayModes; - Java_sun_awt_X11GraphicsDevice_configDisplayMode; - Java_sun_awt_X11GraphicsDevice_resetNativeData; - Java_sun_awt_X11GraphicsDevice_getNativeScaleFactor; - Java_sun_awt_X11GraphicsEnvironment_checkShmExt; - Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum; - Java_sun_awt_X11GraphicsEnvironment_getDisplayString; - Java_sun_awt_X11GraphicsEnvironment_getNumScreens; - Java_sun_awt_X11GraphicsEnvironment_initDisplay; - Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama; - Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint; - Java_sun_awt_X11GraphicsEnvironment_initXRender; - - + Java_sun_awt_DefaultMouseInfoPeer_fillPointWithCoords; + Java_sun_awt_DefaultMouseInfoPeer_isWindowUnderMouse; + Java_java_awt_AWTEvent_nativeSetSource; + Java_java_awt_Checkbox_initIDs; + Java_java_awt_Component_initIDs; + Java_java_awt_Dialog_initIDs; + Java_java_awt_Font_initIDs; + Java_sun_awt_KeyboardFocusManagerPeerImpl_clearNativeGlobalFocusOwner; + Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusOwner; + Java_sun_awt_KeyboardFocusManagerPeerImpl_getNativeFocusedWindow; + Java_java_awt_KeyboardFocusManager_initIDs; + Java_java_awt_Menu_initIDs; + Java_java_awt_MenuComponent_initIDs; + Java_java_awt_MenuItem_initIDs; + Java_java_awt_Scrollbar_initIDs; + Java_java_awt_ScrollPane_initIDs; + Java_java_awt_TextArea_initIDs; + Java_sun_awt_FontDescriptor_initIDs; + Java_sun_awt_X11InputMethod_disposeXIC; + Java_sun_awt_X11InputMethod_isCompositionEnabledNative; + Java_sun_awt_X11InputMethod_resetXIC; + Java_sun_awt_X11InputMethod_setCompositionEnabledNative; + Java_sun_awt_X11InputMethod_turnoffStatusWindow; + Java_sun_awt_SunToolkit_closeSplashScreen; + Java_sun_awt_PlatformFont_initIDs; + Java_sun_awt_X11GraphicsConfig_init; + Java_sun_awt_X11GraphicsConfig_dispose; + Java_sun_awt_X11GraphicsConfig_pGetBounds; + Java_sun_awt_X11GraphicsConfig_getNumColors; + Java_sun_awt_X11GraphicsConfig_getXResolution; + Java_sun_awt_X11GraphicsConfig_getYResolution; + Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable; + Java_sun_awt_X11GraphicsDevice_isDBESupported; + Java_sun_awt_X11GraphicsDevice_getDisplay; + Java_sun_awt_X11GraphicsDevice_getDoubleBufferVisuals; + Java_sun_awt_X11GraphicsDevice_getNumConfigs; + Java_sun_awt_X11GraphicsDevice_initIDs; + Java_sun_awt_X11GraphicsDevice_initXrandrExtension; + Java_sun_awt_X11GraphicsDevice_enterFullScreenExclusive; + Java_sun_awt_X11GraphicsDevice_exitFullScreenExclusive; + Java_sun_awt_X11GraphicsDevice_getCurrentDisplayMode; + Java_sun_awt_X11GraphicsDevice_enumDisplayModes; + Java_sun_awt_X11GraphicsDevice_configDisplayMode; + Java_sun_awt_X11GraphicsDevice_resetNativeData; + Java_sun_awt_X11GraphicsDevice_getNativeScaleFactor; + Java_sun_awt_X11GraphicsEnvironment_checkShmExt; + Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum; + Java_sun_awt_X11GraphicsEnvironment_getDisplayString; + Java_sun_awt_X11GraphicsEnvironment_getNumScreens; + Java_sun_awt_X11GraphicsEnvironment_initDisplay; + Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama; + Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint; + Java_sun_awt_X11GraphicsEnvironment_initXRender; - Java_java_awt_AWTEvent_initIDs; - Java_java_awt_Button_initIDs; - Java_java_awt_Container_initIDs; - Java_java_awt_Cursor_finalizeImpl; - Java_java_awt_Cursor_initIDs; - Java_java_awt_Event_initIDs; - Java_java_awt_event_InputEvent_initIDs; - Java_java_awt_event_KeyEvent_initIDs; - Java_java_awt_FileDialog_initIDs; - Java_java_awt_Frame_initIDs; - Java_java_awt_Insets_initIDs; - Java_java_awt_TextField_initIDs; - Java_java_awt_Window_initIDs; - Java_sun_awt_motif_X11OffScreenImage_updateBitmask; - Java_sun_awt_X11GraphicsConfig_init; - Java_sun_awt_X11GraphicsConfig_initIDs; - Java_sun_awt_X11GraphicsConfig_makeColorModel; - Java_sun_awt_X11GraphicsDevice_getConfigVisualId; - Java_sun_awt_X11PMBlitLoops_Blit; - Java_sun_awt_X11PMBlitBgLoops_nativeBlitBg; - Java_sun_awt_X11Renderer_devFillSpans; - Java_sun_awt_X11Renderer_doDrawArc; - Java_sun_awt_X11Renderer_doDrawLine; - Java_sun_awt_X11Renderer_doDrawOval; - Java_sun_awt_X11Renderer_doDrawPoly; - Java_sun_awt_X11Renderer_doDrawRect; - Java_sun_awt_X11Renderer_doDrawRoundRect; - Java_sun_awt_X11Renderer_doFillArc; - Java_sun_awt_X11Renderer_doFillOval; - Java_sun_awt_X11Renderer_doFillPoly; - Java_sun_awt_X11Renderer_doFillRect; - Java_sun_awt_X11Renderer_doFillRoundRect; - Java_sun_awt_X11Renderer_devCopyArea; - Java_sun_awt_X11SurfaceData_initIDs; - Java_sun_awt_X11SurfaceData_initOps; - Java_sun_awt_X11SurfaceData_initSurface; - Java_sun_awt_X11SurfaceData_isDgaAvailable; - Java_sun_awt_X11SurfaceData_setInvalid; - Java_sun_awt_X11SurfaceData_flushNativeSurface; - awt_display; - awt_lock; - awt_Lock; - awt_Unlock; - awt_GetDrawingSurface; - awt_FreeDrawingSurface; - awt_GetComponent; + Java_java_awt_AWTEvent_initIDs; + Java_java_awt_Button_initIDs; + Java_java_awt_Container_initIDs; + Java_java_awt_Cursor_finalizeImpl; + Java_java_awt_Cursor_initIDs; + Java_java_awt_Event_initIDs; + Java_java_awt_event_InputEvent_initIDs; + Java_java_awt_event_KeyEvent_initIDs; + Java_java_awt_FileDialog_initIDs; + Java_java_awt_Frame_initIDs; + Java_java_awt_Insets_initIDs; + Java_java_awt_TextField_initIDs; + Java_java_awt_Window_initIDs; + Java_sun_awt_motif_X11OffScreenImage_updateBitmask; + Java_sun_awt_X11GraphicsConfig_init; + Java_sun_awt_X11GraphicsConfig_initIDs; + Java_sun_awt_X11GraphicsConfig_makeColorModel; + Java_sun_awt_X11GraphicsDevice_getConfigVisualId; + Java_sun_awt_X11PMBlitLoops_Blit; + Java_sun_awt_X11PMBlitBgLoops_nativeBlitBg; + Java_sun_awt_X11Renderer_devFillSpans; + Java_sun_awt_X11Renderer_doDrawArc; + Java_sun_awt_X11Renderer_doDrawLine; + Java_sun_awt_X11Renderer_doDrawOval; + Java_sun_awt_X11Renderer_doDrawPoly; + Java_sun_awt_X11Renderer_doDrawRect; + Java_sun_awt_X11Renderer_doDrawRoundRect; + Java_sun_awt_X11Renderer_doFillArc; + Java_sun_awt_X11Renderer_doFillOval; + Java_sun_awt_X11Renderer_doFillPoly; + Java_sun_awt_X11Renderer_doFillRect; + Java_sun_awt_X11Renderer_doFillRoundRect; + Java_sun_awt_X11Renderer_devCopyArea; + Java_sun_awt_X11SurfaceData_initIDs; + Java_sun_awt_X11SurfaceData_initOps; + Java_sun_awt_X11SurfaceData_initSurface; + Java_sun_awt_X11SurfaceData_isDgaAvailable; + Java_sun_awt_X11SurfaceData_setInvalid; + Java_sun_awt_X11SurfaceData_flushNativeSurface; + awt_display; + awt_lock; + awt_Lock; + awt_Unlock; + awt_GetDrawingSurface; + awt_FreeDrawingSurface; + awt_GetComponent; + awt_CreateEmbeddedFrame; + awt_SetBounds; + awt_SynthesizeWindowActivation; - X11SurfaceData_GetOps; - getDefaultConfig; - Java_sun_font_FontConfigManager_getFontConfig; - Java_sun_font_FontConfigManager_getFontConfigAASettings; - Java_sun_awt_FcFontManager_getFontPathNative; - Java_sun_font_SunFontManager_populateFontFileNameMap; + X11SurfaceData_GetOps; + getDefaultConfig; + Java_sun_font_FontConfigManager_getFontConfig; + Java_sun_font_FontConfigManager_getFontConfigAASettings; + Java_sun_awt_FcFontManager_getFontPathNative; + Java_sun_font_SunFontManager_populateFontFileNameMap; - # CDE private entry point - Java_sun_awt_motif_XsessionWMcommand; + # CDE private entry point + Java_sun_awt_motif_XsessionWMcommand; - # libfontmanager entry points - AWTIsHeadless; - AWTCountFonts; - AWTLoadFont; - AWTFreeFont; - AWTFontMinByte1; - AWTFontMaxByte1; - AWTFontMinCharOrByte2; - AWTFontMaxCharOrByte2; - AWTFontDefaultChar; - AWTFontPerChar; - AWTFontMaxBounds; - AWTFontTextExtents16; - AWTFreeChar; - AWTFontGenerateImage; - AWTCharAdvance; - AWTCharLBearing; - AWTCharRBearing; - AWTCharAscent; - AWTCharDescent; - AWTDrawGlyphList; - AccelGlyphCache_RemoveAllCellInfos; + # libfontmanager entry points + AWTIsHeadless; + AWTCountFonts; + AWTLoadFont; + AWTFreeFont; + AWTFontMinByte1; + AWTFontMaxByte1; + AWTFontMinCharOrByte2; + AWTFontMaxCharOrByte2; + AWTFontDefaultChar; + AWTFontPerChar; + AWTFontMaxBounds; + AWTFontTextExtents16; + AWTFreeChar; + AWTFontGenerateImage; + AWTCharAdvance; + AWTCharLBearing; + AWTCharRBearing; + AWTCharAscent; + AWTCharDescent; + AWTDrawGlyphList; + AccelGlyphCache_RemoveAllCellInfos; - local: - *; + local: + *; }; diff -r b079fff22b3c -r de9ff562c112 jdk/make/mapfiles/libawt_headless/mapfile-vers --- a/jdk/make/mapfiles/libawt_headless/mapfile-vers Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/make/mapfiles/libawt_headless/mapfile-vers Fri Sep 02 02:41:37 2016 +0000 @@ -26,85 +26,84 @@ # Define public interface. SUNWprivate_1.1 { - global: - JNI_OnLoad; + global: + JNI_OnLoad; - Java_sun_java2d_x11_X11PMBlitLoops_nativeBlit; - Java_sun_java2d_x11_X11PMBlitBgLoops_nativeBlitBg; - Java_sun_java2d_x11_X11Renderer_XFillSpans; - Java_sun_java2d_x11_X11Renderer_XDrawArc; - Java_sun_java2d_x11_X11Renderer_XDrawLine; - Java_sun_java2d_x11_X11Renderer_XDrawOval; - Java_sun_java2d_x11_X11Renderer_XDrawPoly; - Java_sun_java2d_x11_X11Renderer_XDrawRect; - Java_sun_java2d_x11_X11Renderer_XDrawRoundRect; - Java_sun_java2d_x11_X11Renderer_XDoPath; - Java_sun_java2d_x11_X11Renderer_XFillArc; - Java_sun_java2d_x11_X11Renderer_XFillOval; - Java_sun_java2d_x11_X11Renderer_XFillPoly; - Java_sun_java2d_x11_X11Renderer_XFillRect; - Java_sun_java2d_x11_X11Renderer_XFillRoundRect; - Java_sun_java2d_x11_X11Renderer_devCopyArea; - Java_sun_java2d_x11_X11SurfaceData_initIDs; - Java_sun_java2d_x11_X11SurfaceData_initSurface; - Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; - Java_sun_java2d_x11_X11SurfaceData_XSetXorMode; - Java_sun_java2d_x11_X11SurfaceData_XSetForeground; + Java_sun_java2d_x11_X11PMBlitLoops_nativeBlit; + Java_sun_java2d_x11_X11PMBlitBgLoops_nativeBlitBg; + Java_sun_java2d_x11_X11Renderer_XFillSpans; + Java_sun_java2d_x11_X11Renderer_XDrawArc; + Java_sun_java2d_x11_X11Renderer_XDrawLine; + Java_sun_java2d_x11_X11Renderer_XDrawOval; + Java_sun_java2d_x11_X11Renderer_XDrawPoly; + Java_sun_java2d_x11_X11Renderer_XDrawRect; + Java_sun_java2d_x11_X11Renderer_XDrawRoundRect; + Java_sun_java2d_x11_X11Renderer_XDoPath; + Java_sun_java2d_x11_X11Renderer_XFillArc; + Java_sun_java2d_x11_X11Renderer_XFillOval; + Java_sun_java2d_x11_X11Renderer_XFillPoly; + Java_sun_java2d_x11_X11Renderer_XFillRect; + Java_sun_java2d_x11_X11Renderer_XFillRoundRect; + Java_sun_java2d_x11_X11Renderer_devCopyArea; + Java_sun_java2d_x11_X11SurfaceData_initIDs; + Java_sun_java2d_x11_X11SurfaceData_initSurface; + Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; + Java_sun_java2d_x11_X11SurfaceData_XSetXorMode; + Java_sun_java2d_x11_X11SurfaceData_XSetForeground; - Java_sun_java2d_x11_XSurfaceData_initOps; - Java_sun_java2d_x11_XSurfaceData_XCreateGC; - Java_sun_java2d_x11_XSurfaceData_XResetClip; - Java_sun_java2d_x11_XSurfaceData_XSetClip; - Java_sun_java2d_x11_XSurfaceData_flushNativeSurface; - Java_sun_java2d_x11_XSurfaceData_isDrawableValid; - Java_sun_java2d_x11_XSurfaceData_setInvalid; - Java_sun_java2d_x11_XSurfaceData_XSetGraphicsExposures; + Java_sun_java2d_x11_XSurfaceData_initOps; + Java_sun_java2d_x11_XSurfaceData_XCreateGC; + Java_sun_java2d_x11_XSurfaceData_XResetClip; + Java_sun_java2d_x11_XSurfaceData_XSetClip; + Java_sun_java2d_x11_XSurfaceData_flushNativeSurface; + Java_sun_java2d_x11_XSurfaceData_isDrawableValid; + Java_sun_java2d_x11_XSurfaceData_setInvalid; + Java_sun_java2d_x11_XSurfaceData_XSetGraphicsExposures; - X11SurfaceData_GetOps; - Java_java_awt_Font_initIDs; - Java_sun_font_FontConfigManager_getFontConfig; - Java_sun_font_FontConfigManager_getFontConfigAASettings; - Java_sun_font_FontConfigManager_getFontConfigVersion; - Java_sun_awt_FcFontManager_getFontPathNative; + X11SurfaceData_GetOps; + Java_java_awt_Font_initIDs; + Java_sun_font_FontConfigManager_getFontConfig; + Java_sun_font_FontConfigManager_getFontConfigAASettings; + Java_sun_font_FontConfigManager_getFontConfigVersion; + Java_sun_awt_FcFontManager_getFontPathNative; - Java_sun_awt_FontDescriptor_initIDs; - Java_sun_awt_PlatformFont_initIDs; + Java_sun_awt_FontDescriptor_initIDs; + Java_sun_awt_PlatformFont_initIDs; - Java_sun_print_CUPSPrinter_initIDs; - Java_sun_print_CUPSPrinter_getCupsServer; - Java_sun_print_CUPSPrinter_getCupsPort; - Java_sun_print_CUPSPrinter_getCupsDefaultPrinter; - Java_sun_print_CUPSPrinter_canConnect; - Java_sun_print_CUPSPrinter_getMedia; - Java_sun_print_CUPSPrinter_getPageSizes; - Java_sun_print_CUPSPrinter_getResolutions; + Java_sun_print_CUPSPrinter_initIDs; + Java_sun_print_CUPSPrinter_getCupsServer; + Java_sun_print_CUPSPrinter_getCupsPort; + Java_sun_print_CUPSPrinter_getCupsDefaultPrinter; + Java_sun_print_CUPSPrinter_canConnect; + Java_sun_print_CUPSPrinter_getMedia; + Java_sun_print_CUPSPrinter_getPageSizes; + Java_sun_print_CUPSPrinter_getResolutions; - # libfontmanager entry points - AWTIsHeadless; - AWTCountFonts; - AWTLoadFont; - AWTFreeFont; - AWTFontAscent; - AWTFontDescent; - AWTFontMinByte1; - AWTFontMaxByte1; - AWTFontMinCharOrByte2; - AWTFontMaxCharOrByte2; - AWTFontDefaultChar; - AWTFontPerChar; - AWTFontMaxBounds; - AWTFontTextExtents16; - AWTFreeChar; - AWTFontGenerateImage; - AWTCharAdvance; - AWTCharLBearing; - AWTCharRBearing; - AWTCharAscent; - AWTCharDescent; - AWTDrawGlyphList; - AccelGlyphCache_RemoveAllCellInfos; + # libfontmanager entry points + AWTIsHeadless; + AWTCountFonts; + AWTLoadFont; + AWTFreeFont; + AWTFontAscent; + AWTFontDescent; + AWTFontMinByte1; + AWTFontMaxByte1; + AWTFontMinCharOrByte2; + AWTFontMaxCharOrByte2; + AWTFontDefaultChar; + AWTFontPerChar; + AWTFontMaxBounds; + AWTFontTextExtents16; + AWTFreeChar; + AWTFontGenerateImage; + AWTCharAdvance; + AWTCharLBearing; + AWTCharRBearing; + AWTCharAscent; + AWTCharDescent; + AWTDrawGlyphList; + AccelGlyphCache_RemoveAllCellInfos; - - local: - *; + local: + *; }; diff -r b079fff22b3c -r de9ff562c112 jdk/make/mapfiles/libawt_xawt/mapfile-vers --- a/jdk/make/mapfiles/libawt_xawt/mapfile-vers Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/make/mapfiles/libawt_xawt/mapfile-vers Fri Sep 02 02:41:37 2016 +0000 @@ -26,7 +26,7 @@ # Define public interface. SUNWprivate_1.1 { - global: + global: JNI_OnLoad; Java_sun_awt_X11_XlibWrapper_copyIntArray; Java_sun_awt_X11_XlibWrapper_copyLongArray; @@ -58,8 +58,8 @@ Java_sun_awt_X11_XlibWrapper_XSetLocaleModifiers; Java_sun_awt_X11_XlibWrapper_XPeekEvent; Java_sun_awt_X11_XlibWrapper_DefaultScreen; - Java_sun_awt_X11_XlibWrapper_ScreenOfDisplay; - Java_sun_awt_X11_XlibWrapper_DoesBackingStore; + Java_sun_awt_X11_XlibWrapper_ScreenOfDisplay; + Java_sun_awt_X11_XlibWrapper_DoesBackingStore; Java_sun_awt_X11_XlibWrapper_RootWindow; Java_sun_awt_X11_XlibWrapper_DisplayHeight; Java_sun_awt_X11_XlibWrapper_DisplayWidthMM; @@ -172,7 +172,7 @@ Java_java_awt_Scrollbar_initIDs; Java_java_awt_Window_initIDs; Java_java_awt_Frame_initIDs; - Java_sun_awt_SunToolkit_closeSplashScreen; + Java_sun_awt_SunToolkit_closeSplashScreen; Java_sun_awt_UNIXToolkit_check_1gtk; Java_sun_awt_UNIXToolkit_load_1gtk; Java_sun_awt_UNIXToolkit_unload_1gtk; @@ -196,17 +196,16 @@ Java_sun_font_FontConfigManager_getFontConfig; Java_sun_font_FontConfigManager_getFontConfigAASettings; Java_sun_font_FontConfigManager_getFontConfigVersion; - Java_sun_awt_FcFontManager_getFontPathNative; + Java_sun_awt_FcFontManager_getFontPathNative; Java_sun_awt_X11GraphicsEnvironment_initDisplay; Java_sun_awt_X11GraphicsEnvironment_initGLX; - Java_sun_awt_X11GraphicsEnvironment_initXRender; + Java_sun_awt_X11GraphicsEnvironment_initXRender; Java_sun_awt_X11GraphicsEnvironment_checkShmExt; Java_sun_awt_X11GraphicsEnvironment_getNumScreens; Java_sun_awt_X11GraphicsEnvironment_getDefaultScreenNum; Java_sun_awt_X11GraphicsEnvironment_pRunningXinerama; Java_sun_awt_X11GraphicsEnvironment_getXineramaCenterPoint; Java_sun_awt_X11GraphicsEnvironment_getDisplayString; -# Java_sun_awt_X11GraphicsEnvironment_getNativeFonts; Java_sun_awt_X11GraphicsDevice_initIDs; Java_sun_awt_X11GraphicsDevice_getConfigVisualId; Java_sun_awt_X11GraphicsDevice_getConfigDepth; @@ -231,16 +230,16 @@ Java_sun_awt_X11GraphicsConfig_makeColorModel; Java_sun_awt_X11GraphicsConfig_pGetBounds; Java_sun_awt_X11GraphicsConfig_createBackBuffer; - Java_sun_awt_X11GraphicsConfig_destroyBackBuffer; - Java_sun_awt_X11GraphicsConfig_swapBuffers; - Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable; + Java_sun_awt_X11GraphicsConfig_destroyBackBuffer; + Java_sun_awt_X11GraphicsConfig_swapBuffers; + Java_sun_awt_X11GraphicsConfig_isTranslucencyCapable; Java_sun_awt_X11_XToolkit_getTrayIconDisplayTimeout; Java_java_awt_Insets_initIDs; Java_java_awt_KeyboardFocusManager_initIDs; Java_java_awt_Font_initIDs; # libfontmanager entry points AWTIsHeadless; - AWTCountFonts; + AWTCountFonts; AWTLoadFont; AWTFreeFont; AWTFontAscent; @@ -303,7 +302,7 @@ Java_sun_awt_X11_XlibWrapper_XGetIconSizes; Java_sun_awt_X11_XlibWrapper_XKeycodeToKeysym; Java_sun_awt_X11_XlibWrapper_XKeysymToKeycode; - Java_sun_awt_X11_XlibWrapper_XQueryKeymap; + Java_sun_awt_X11_XlibWrapper_XQueryKeymap; Java_sun_awt_X11_XlibWrapper_XkbGetEffectiveGroup; Java_sun_awt_X11_XlibWrapper_XkbSelectEvents; Java_sun_awt_X11_XlibWrapper_XkbSelectEventDetails; @@ -350,23 +349,23 @@ Java_sun_java2d_x11_X11PMBlitBgLoops_nativeBlitBg; Java_sun_java2d_x11_X11PMBlitLoops_nativeBlit; Java_sun_java2d_x11_X11PMBlitLoops_updateBitmask; - Java_sun_java2d_x11_X11Renderer_XFillSpans; - Java_sun_java2d_x11_X11Renderer_XDrawArc; - Java_sun_java2d_x11_X11Renderer_XDrawLine; - Java_sun_java2d_x11_X11Renderer_XDrawOval; - Java_sun_java2d_x11_X11Renderer_XDrawPoly; - Java_sun_java2d_x11_X11Renderer_XDrawRect; - Java_sun_java2d_x11_X11Renderer_XDrawRoundRect; + Java_sun_java2d_x11_X11Renderer_XFillSpans; + Java_sun_java2d_x11_X11Renderer_XDrawArc; + Java_sun_java2d_x11_X11Renderer_XDrawLine; + Java_sun_java2d_x11_X11Renderer_XDrawOval; + Java_sun_java2d_x11_X11Renderer_XDrawPoly; + Java_sun_java2d_x11_X11Renderer_XDrawRect; + Java_sun_java2d_x11_X11Renderer_XDrawRoundRect; Java_sun_java2d_x11_X11Renderer_XDoPath; - Java_sun_java2d_x11_X11Renderer_XFillArc; - Java_sun_java2d_x11_X11Renderer_XFillOval; - Java_sun_java2d_x11_X11Renderer_XFillPoly; - Java_sun_java2d_x11_X11Renderer_XFillRect; - Java_sun_java2d_x11_X11Renderer_XFillRoundRect; + Java_sun_java2d_x11_X11Renderer_XFillArc; + Java_sun_java2d_x11_X11Renderer_XFillOval; + Java_sun_java2d_x11_X11Renderer_XFillPoly; + Java_sun_java2d_x11_X11Renderer_XFillRect; + Java_sun_java2d_x11_X11Renderer_XFillRoundRect; Java_sun_java2d_x11_X11Renderer_devCopyArea; Java_sun_java2d_x11_X11SurfaceData_initIDs; Java_sun_java2d_x11_X11SurfaceData_isDgaAvailable; - Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable; + Java_sun_java2d_x11_X11SurfaceData_isShmPMAvailable; Java_sun_java2d_x11_X11SurfaceData_initSurface; Java_sun_java2d_x11_X11SurfaceData_XSetCopyMode; Java_sun_java2d_x11_X11SurfaceData_XSetXorMode; @@ -377,40 +376,40 @@ Java_sun_java2d_x11_XSurfaceData_XResetClip; Java_sun_java2d_x11_XSurfaceData_XSetClip; Java_sun_java2d_x11_XSurfaceData_flushNativeSurface; - Java_sun_java2d_x11_XSurfaceData_isDrawableValid; + Java_sun_java2d_x11_XSurfaceData_isDrawableValid; Java_sun_java2d_x11_XSurfaceData_setInvalid; Java_sun_java2d_x11_XSurfaceData_XSetGraphicsExposures; Java_sun_java2d_xr_XRSurfaceData_initXRPicture; Java_sun_java2d_xr_XRSurfaceData_initIDs; Java_sun_java2d_xr_XRSurfaceData_XRInitSurface; - Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture; - Java_sun_java2d_xr_XRBackendNative_initIDs; - Java_sun_java2d_xr_XRBackendNative_freeGC; - Java_sun_java2d_xr_XRBackendNative_createGC; - Java_sun_java2d_xr_XRBackendNative_createPixmap; - Java_sun_java2d_xr_XRBackendNative_createPictureNative; - Java_sun_java2d_xr_XRBackendNative_freePicture; - Java_sun_java2d_xr_XRBackendNative_freePixmap; - Java_sun_java2d_xr_XRBackendNative_setPictureRepeat; - Java_sun_java2d_xr_XRBackendNative_setGCExposures; - Java_sun_java2d_xr_XRBackendNative_setGCForeground; - Java_sun_java2d_xr_XRBackendNative_copyArea; - Java_sun_java2d_xr_XRBackendNative_renderComposite; - Java_sun_java2d_xr_XRBackendNative_renderRectangle; - Java_sun_java2d_xr_XRBackendNative_XRenderRectanglesNative; - Java_sun_java2d_xr_XRBackendNative_XRSetTransformNative; - Java_sun_java2d_xr_XRBackendNative_XRCreateLinearGradientPaintNative; - Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative; - Java_sun_java2d_xr_XRBackendNative_setFilter; - Java_sun_java2d_xr_XRBackendNative_XRSetClipNative; - Java_sun_java2d_xr_XRBackendNative_putMaskNative; - Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative; - Java_sun_java2d_xr_XRBackendNative_XRFreeGlyphsNative; - Java_sun_java2d_xr_XRBackendNative_XRenderCreateGlyphSetNative; - Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative; - Java_sun_java2d_xr_XRBackendNative_setGCMode; - Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; - Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; + Java_sun_java2d_xr_XRSurfaceData_freeXSDOPicture; + Java_sun_java2d_xr_XRBackendNative_initIDs; + Java_sun_java2d_xr_XRBackendNative_freeGC; + Java_sun_java2d_xr_XRBackendNative_createGC; + Java_sun_java2d_xr_XRBackendNative_createPixmap; + Java_sun_java2d_xr_XRBackendNative_createPictureNative; + Java_sun_java2d_xr_XRBackendNative_freePicture; + Java_sun_java2d_xr_XRBackendNative_freePixmap; + Java_sun_java2d_xr_XRBackendNative_setPictureRepeat; + Java_sun_java2d_xr_XRBackendNative_setGCExposures; + Java_sun_java2d_xr_XRBackendNative_setGCForeground; + Java_sun_java2d_xr_XRBackendNative_copyArea; + Java_sun_java2d_xr_XRBackendNative_renderComposite; + Java_sun_java2d_xr_XRBackendNative_renderRectangle; + Java_sun_java2d_xr_XRBackendNative_XRenderRectanglesNative; + Java_sun_java2d_xr_XRBackendNative_XRSetTransformNative; + Java_sun_java2d_xr_XRBackendNative_XRCreateLinearGradientPaintNative; + Java_sun_java2d_xr_XRBackendNative_XRCreateRadialGradientPaintNative; + Java_sun_java2d_xr_XRBackendNative_setFilter; + Java_sun_java2d_xr_XRBackendNative_XRSetClipNative; + Java_sun_java2d_xr_XRBackendNative_putMaskNative; + Java_sun_java2d_xr_XRBackendNative_XRAddGlyphsNative; + Java_sun_java2d_xr_XRBackendNative_XRFreeGlyphsNative; + Java_sun_java2d_xr_XRBackendNative_XRenderCreateGlyphSetNative; + Java_sun_java2d_xr_XRBackendNative_XRenderCompositeTextNative; + Java_sun_java2d_xr_XRBackendNative_setGCMode; + Java_sun_java2d_xr_XRBackendNative_GCRectanglesNative; + Java_sun_java2d_xr_XRBackendNative_renderCompositeTrapezoidsNative; Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1arrow; Java_com_sun_java_swing_plaf_gtk_GTKEngine_native_1paint_1box; @@ -444,25 +443,28 @@ Java_sun_awt_X11_GtkFileDialogPeer_toFront; Java_sun_awt_X11_GtkFileDialogPeer_setBounds; - Java_sun_print_CUPSPrinter_initIDs; - Java_sun_print_CUPSPrinter_getCupsServer; - Java_sun_print_CUPSPrinter_getCupsPort; - Java_sun_print_CUPSPrinter_getCupsDefaultPrinter; - Java_sun_print_CUPSPrinter_canConnect; - Java_sun_print_CUPSPrinter_getMedia; - Java_sun_print_CUPSPrinter_getPageSizes; - Java_sun_print_CUPSPrinter_getResolutions; + Java_sun_print_CUPSPrinter_initIDs; + Java_sun_print_CUPSPrinter_getCupsServer; + Java_sun_print_CUPSPrinter_getCupsPort; + Java_sun_print_CUPSPrinter_getCupsDefaultPrinter; + Java_sun_print_CUPSPrinter_canConnect; + Java_sun_print_CUPSPrinter_getMedia; + Java_sun_print_CUPSPrinter_getPageSizes; + Java_sun_print_CUPSPrinter_getResolutions; awt_GetDrawingSurface; awt_FreeDrawingSurface; awt_Unlock; awt_Lock; awt_GetComponent; + awt_CreateEmbeddedFrame; + awt_SetBounds; + awt_SynthesizeWindowActivation; #XAWT entry point for CDE Java_sun_awt_motif_XsessionWMcommand; Java_sun_awt_motif_XsessionWMcommand_New; - local: - *; + local: + *; }; diff -r b079fff22b3c -r de9ff562c112 jdk/make/mapfiles/libjawt/mapfile-vers --- a/jdk/make/mapfiles/libjawt/mapfile-vers Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/make/mapfiles/libjawt/mapfile-vers Fri Sep 02 02:41:37 2016 +0000 @@ -26,8 +26,8 @@ # Define library interface. SUNWprivate_1.1 { - global: - JAWT_GetAWT; - local: - *; + global: + JAWT_GetAWT; + local: + *; }; diff -r b079fff22b3c -r de9ff562c112 jdk/make/mapfiles/libjpeg/mapfile-vers --- a/jdk/make/mapfiles/libjpeg/mapfile-vers Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/make/mapfiles/libjpeg/mapfile-vers Fri Sep 02 02:41:37 2016 +0000 @@ -26,30 +26,30 @@ # Define public interface. SUNWprivate_1.1 { - global: - JNI_OnLoad; + global: + JNI_OnLoad; - Java_sun_awt_image_JPEGImageDecoder_initIDs; - Java_sun_awt_image_JPEGImageDecoder_readImage; + Java_sun_awt_image_JPEGImageDecoder_initIDs; + Java_sun_awt_image_JPEGImageDecoder_readImage; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initReaderIDs; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initJPEGImageReader; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_setSource; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImageHeader; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_setOutColorSpace; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_abortRead; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetReader; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_disposeReader; - Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetLibraryState; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initWriterIDs; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initJPEGImageWriter; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_setDest; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeTables; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_abortWrite; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_resetWriter; - Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_disposeWriter; - local: - *; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initReaderIDs; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_initJPEGImageReader; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_setSource; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImageHeader; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_setOutColorSpace; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_readImage; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_abortRead; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetReader; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_disposeReader; + Java_com_sun_imageio_plugins_jpeg_JPEGImageReader_resetLibraryState; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initWriterIDs; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_initJPEGImageWriter; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_setDest; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeTables; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_abortWrite; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_resetWriter; + Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_disposeWriter; + local: + *; }; diff -r b079fff22b3c -r de9ff562c112 jdk/make/mapfiles/libjsound/mapfile-vers --- a/jdk/make/mapfiles/libjsound/mapfile-vers Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/make/mapfiles/libjsound/mapfile-vers Fri Sep 02 02:41:37 2016 +0000 @@ -26,60 +26,60 @@ # Define library interface. SUNWprivate_1.1 { - global: - Java_com_sun_media_sound_DirectAudioDevice_nAvailable; - Java_com_sun_media_sound_DirectAudioDevice_nClose; - Java_com_sun_media_sound_DirectAudioDevice_nFlush; - Java_com_sun_media_sound_DirectAudioDevice_nGetBufferSize; - Java_com_sun_media_sound_DirectAudioDevice_nGetBytePosition; - Java_com_sun_media_sound_DirectAudioDevice_nGetFormats; - Java_com_sun_media_sound_DirectAudioDevice_nIsStillDraining; - Java_com_sun_media_sound_DirectAudioDevice_nOpen; - Java_com_sun_media_sound_DirectAudioDevice_nRead; - Java_com_sun_media_sound_DirectAudioDevice_nRequiresServicing; - Java_com_sun_media_sound_DirectAudioDevice_nService; - Java_com_sun_media_sound_DirectAudioDevice_nSetBytePosition; - Java_com_sun_media_sound_DirectAudioDevice_nStart; - Java_com_sun_media_sound_DirectAudioDevice_nStop; - Java_com_sun_media_sound_DirectAudioDevice_nWrite; - Java_com_sun_media_sound_DirectAudioDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_DirectAudioDeviceProvider_nNewDirectAudioDeviceInfo; - Java_com_sun_media_sound_MidiInDevice_nClose; - Java_com_sun_media_sound_MidiInDevice_nGetMessages; - Java_com_sun_media_sound_MidiInDevice_nGetTimeStamp; - Java_com_sun_media_sound_MidiInDevice_nOpen; - Java_com_sun_media_sound_MidiInDevice_nStart; - Java_com_sun_media_sound_MidiInDevice_nStop; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetDescription; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetName; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetVendor; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetVersion; - Java_com_sun_media_sound_MidiOutDevice_nClose; - Java_com_sun_media_sound_MidiOutDevice_nGetTimeStamp; - Java_com_sun_media_sound_MidiOutDevice_nOpen; - Java_com_sun_media_sound_MidiOutDevice_nSendLongMessage; - Java_com_sun_media_sound_MidiOutDevice_nSendShortMessage; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetDescription; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetName; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVendor; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVersion; - Java_com_sun_media_sound_Platform_nGetExtraLibraries; - Java_com_sun_media_sound_Platform_nGetLibraryForFeature; - Java_com_sun_media_sound_Platform_nIsBigEndian; - Java_com_sun_media_sound_PortMixer_nClose; - Java_com_sun_media_sound_PortMixer_nControlGetFloatValue; - Java_com_sun_media_sound_PortMixer_nControlGetIntValue; - Java_com_sun_media_sound_PortMixer_nControlSetFloatValue; - Java_com_sun_media_sound_PortMixer_nControlSetIntValue; - Java_com_sun_media_sound_PortMixer_nGetControls; - Java_com_sun_media_sound_PortMixer_nGetPortCount; - Java_com_sun_media_sound_PortMixer_nGetPortName; - Java_com_sun_media_sound_PortMixer_nGetPortType; - Java_com_sun_media_sound_PortMixer_nOpen; - Java_com_sun_media_sound_PortMixerProvider_nGetNumDevices; - Java_com_sun_media_sound_PortMixerProvider_nNewPortMixerInfo; - local: - *; + global: + Java_com_sun_media_sound_DirectAudioDevice_nAvailable; + Java_com_sun_media_sound_DirectAudioDevice_nClose; + Java_com_sun_media_sound_DirectAudioDevice_nFlush; + Java_com_sun_media_sound_DirectAudioDevice_nGetBufferSize; + Java_com_sun_media_sound_DirectAudioDevice_nGetBytePosition; + Java_com_sun_media_sound_DirectAudioDevice_nGetFormats; + Java_com_sun_media_sound_DirectAudioDevice_nIsStillDraining; + Java_com_sun_media_sound_DirectAudioDevice_nOpen; + Java_com_sun_media_sound_DirectAudioDevice_nRead; + Java_com_sun_media_sound_DirectAudioDevice_nRequiresServicing; + Java_com_sun_media_sound_DirectAudioDevice_nService; + Java_com_sun_media_sound_DirectAudioDevice_nSetBytePosition; + Java_com_sun_media_sound_DirectAudioDevice_nStart; + Java_com_sun_media_sound_DirectAudioDevice_nStop; + Java_com_sun_media_sound_DirectAudioDevice_nWrite; + Java_com_sun_media_sound_DirectAudioDeviceProvider_nGetNumDevices; + Java_com_sun_media_sound_DirectAudioDeviceProvider_nNewDirectAudioDeviceInfo; + Java_com_sun_media_sound_MidiInDevice_nClose; + Java_com_sun_media_sound_MidiInDevice_nGetMessages; + Java_com_sun_media_sound_MidiInDevice_nGetTimeStamp; + Java_com_sun_media_sound_MidiInDevice_nOpen; + Java_com_sun_media_sound_MidiInDevice_nStart; + Java_com_sun_media_sound_MidiInDevice_nStop; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetDescription; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetName; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetNumDevices; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetVendor; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetVersion; + Java_com_sun_media_sound_MidiOutDevice_nClose; + Java_com_sun_media_sound_MidiOutDevice_nGetTimeStamp; + Java_com_sun_media_sound_MidiOutDevice_nOpen; + Java_com_sun_media_sound_MidiOutDevice_nSendLongMessage; + Java_com_sun_media_sound_MidiOutDevice_nSendShortMessage; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetDescription; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetName; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetNumDevices; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVendor; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVersion; + Java_com_sun_media_sound_Platform_nGetExtraLibraries; + Java_com_sun_media_sound_Platform_nGetLibraryForFeature; + Java_com_sun_media_sound_Platform_nIsBigEndian; + Java_com_sun_media_sound_PortMixer_nClose; + Java_com_sun_media_sound_PortMixer_nControlGetFloatValue; + Java_com_sun_media_sound_PortMixer_nControlGetIntValue; + Java_com_sun_media_sound_PortMixer_nControlSetFloatValue; + Java_com_sun_media_sound_PortMixer_nControlSetIntValue; + Java_com_sun_media_sound_PortMixer_nGetControls; + Java_com_sun_media_sound_PortMixer_nGetPortCount; + Java_com_sun_media_sound_PortMixer_nGetPortName; + Java_com_sun_media_sound_PortMixer_nGetPortType; + Java_com_sun_media_sound_PortMixer_nOpen; + Java_com_sun_media_sound_PortMixerProvider_nGetNumDevices; + Java_com_sun_media_sound_PortMixerProvider_nNewPortMixerInfo; + local: + *; }; diff -r b079fff22b3c -r de9ff562c112 jdk/make/mapfiles/libjsoundalsa/mapfile-vers --- a/jdk/make/mapfiles/libjsoundalsa/mapfile-vers Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/make/mapfiles/libjsoundalsa/mapfile-vers Fri Sep 02 02:41:37 2016 +0000 @@ -26,57 +26,57 @@ # Define library interface. SUNWprivate_1.1 { - global: - Java_com_sun_media_sound_DirectAudioDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_DirectAudioDeviceProvider_nNewDirectAudioDeviceInfo; - Java_com_sun_media_sound_DirectAudioDevice_nAvailable; - Java_com_sun_media_sound_DirectAudioDevice_nClose; - Java_com_sun_media_sound_DirectAudioDevice_nFlush; - Java_com_sun_media_sound_DirectAudioDevice_nGetBufferSize; - Java_com_sun_media_sound_DirectAudioDevice_nGetBytePosition; - Java_com_sun_media_sound_DirectAudioDevice_nGetFormats; - Java_com_sun_media_sound_DirectAudioDevice_nIsStillDraining; - Java_com_sun_media_sound_DirectAudioDevice_nOpen; - Java_com_sun_media_sound_DirectAudioDevice_nRead; - Java_com_sun_media_sound_DirectAudioDevice_nRequiresServicing; - Java_com_sun_media_sound_DirectAudioDevice_nService; - Java_com_sun_media_sound_DirectAudioDevice_nSetBytePosition; - Java_com_sun_media_sound_DirectAudioDevice_nStart; - Java_com_sun_media_sound_DirectAudioDevice_nStop; - Java_com_sun_media_sound_DirectAudioDevice_nWrite; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetDescription; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetName; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetVendor; - Java_com_sun_media_sound_MidiInDeviceProvider_nGetVersion; - Java_com_sun_media_sound_MidiInDevice_nClose; - Java_com_sun_media_sound_MidiInDevice_nGetMessages; - Java_com_sun_media_sound_MidiInDevice_nGetTimeStamp; - Java_com_sun_media_sound_MidiInDevice_nOpen; - Java_com_sun_media_sound_MidiInDevice_nStart; - Java_com_sun_media_sound_MidiInDevice_nStop; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetDescription; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetName; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetNumDevices; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVendor; - Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVersion; - Java_com_sun_media_sound_MidiOutDevice_nClose; - Java_com_sun_media_sound_MidiOutDevice_nGetTimeStamp; - Java_com_sun_media_sound_MidiOutDevice_nOpen; - Java_com_sun_media_sound_MidiOutDevice_nSendLongMessage; - Java_com_sun_media_sound_MidiOutDevice_nSendShortMessage; - Java_com_sun_media_sound_PortMixerProvider_nGetNumDevices; - Java_com_sun_media_sound_PortMixerProvider_nNewPortMixerInfo; - Java_com_sun_media_sound_PortMixer_nClose; - Java_com_sun_media_sound_PortMixer_nControlGetFloatValue; - Java_com_sun_media_sound_PortMixer_nControlGetIntValue; - Java_com_sun_media_sound_PortMixer_nControlSetFloatValue; - Java_com_sun_media_sound_PortMixer_nControlSetIntValue; - Java_com_sun_media_sound_PortMixer_nGetControls; - Java_com_sun_media_sound_PortMixer_nGetPortCount; - Java_com_sun_media_sound_PortMixer_nGetPortName; - Java_com_sun_media_sound_PortMixer_nGetPortType; - Java_com_sun_media_sound_PortMixer_nOpen; - local: - *; + global: + Java_com_sun_media_sound_DirectAudioDeviceProvider_nGetNumDevices; + Java_com_sun_media_sound_DirectAudioDeviceProvider_nNewDirectAudioDeviceInfo; + Java_com_sun_media_sound_DirectAudioDevice_nAvailable; + Java_com_sun_media_sound_DirectAudioDevice_nClose; + Java_com_sun_media_sound_DirectAudioDevice_nFlush; + Java_com_sun_media_sound_DirectAudioDevice_nGetBufferSize; + Java_com_sun_media_sound_DirectAudioDevice_nGetBytePosition; + Java_com_sun_media_sound_DirectAudioDevice_nGetFormats; + Java_com_sun_media_sound_DirectAudioDevice_nIsStillDraining; + Java_com_sun_media_sound_DirectAudioDevice_nOpen; + Java_com_sun_media_sound_DirectAudioDevice_nRead; + Java_com_sun_media_sound_DirectAudioDevice_nRequiresServicing; + Java_com_sun_media_sound_DirectAudioDevice_nService; + Java_com_sun_media_sound_DirectAudioDevice_nSetBytePosition; + Java_com_sun_media_sound_DirectAudioDevice_nStart; + Java_com_sun_media_sound_DirectAudioDevice_nStop; + Java_com_sun_media_sound_DirectAudioDevice_nWrite; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetDescription; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetName; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetNumDevices; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetVendor; + Java_com_sun_media_sound_MidiInDeviceProvider_nGetVersion; + Java_com_sun_media_sound_MidiInDevice_nClose; + Java_com_sun_media_sound_MidiInDevice_nGetMessages; + Java_com_sun_media_sound_MidiInDevice_nGetTimeStamp; + Java_com_sun_media_sound_MidiInDevice_nOpen; + Java_com_sun_media_sound_MidiInDevice_nStart; + Java_com_sun_media_sound_MidiInDevice_nStop; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetDescription; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetName; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetNumDevices; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVendor; + Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVersion; + Java_com_sun_media_sound_MidiOutDevice_nClose; + Java_com_sun_media_sound_MidiOutDevice_nGetTimeStamp; + Java_com_sun_media_sound_MidiOutDevice_nOpen; + Java_com_sun_media_sound_MidiOutDevice_nSendLongMessage; + Java_com_sun_media_sound_MidiOutDevice_nSendShortMessage; + Java_com_sun_media_sound_PortMixerProvider_nGetNumDevices; + Java_com_sun_media_sound_PortMixerProvider_nNewPortMixerInfo; + Java_com_sun_media_sound_PortMixer_nClose; + Java_com_sun_media_sound_PortMixer_nControlGetFloatValue; + Java_com_sun_media_sound_PortMixer_nControlGetIntValue; + Java_com_sun_media_sound_PortMixer_nControlSetFloatValue; + Java_com_sun_media_sound_PortMixer_nControlSetIntValue; + Java_com_sun_media_sound_PortMixer_nGetControls; + Java_com_sun_media_sound_PortMixer_nGetPortCount; + Java_com_sun_media_sound_PortMixer_nGetPortName; + Java_com_sun_media_sound_PortMixer_nGetPortType; + Java_com_sun_media_sound_PortMixer_nOpen; + local: + *; }; diff -r b079fff22b3c -r de9ff562c112 jdk/make/mapfiles/libsplashscreen/mapfile-vers --- a/jdk/make/mapfiles/libsplashscreen/mapfile-vers Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/make/mapfiles/libsplashscreen/mapfile-vers Fri Sep 02 02:41:37 2016 +0000 @@ -26,24 +26,24 @@ # Define public interface. SUNWprivate_1.1 { - global: - Java_java_awt_SplashScreen__1update; - Java_java_awt_SplashScreen__1isVisible; - Java_java_awt_SplashScreen__1getBounds; - Java_java_awt_SplashScreen__1getInstance; - Java_java_awt_SplashScreen__1close; - Java_java_awt_SplashScreen__1getImageFileName; - Java_java_awt_SplashScreen__1getImageJarName; - Java_java_awt_SplashScreen__1setImageData; - Java_java_awt_SplashScreen__1getScaleFactor; + global: + Java_java_awt_SplashScreen__1update; + Java_java_awt_SplashScreen__1isVisible; + Java_java_awt_SplashScreen__1getBounds; + Java_java_awt_SplashScreen__1getInstance; + Java_java_awt_SplashScreen__1close; + Java_java_awt_SplashScreen__1getImageFileName; + Java_java_awt_SplashScreen__1getImageJarName; + Java_java_awt_SplashScreen__1setImageData; + Java_java_awt_SplashScreen__1getScaleFactor; - SplashLoadMemory; - SplashLoadFile; - SplashInit; - SplashClose; - SplashSetFileJarName; - SplashSetScaleFactor; - SplashGetScaledImageName; - local: - *; + SplashLoadMemory; + SplashLoadFile; + SplashInit; + SplashClose; + SplashSetFileJarName; + SplashSetScaleFactor; + SplashGetScaledImageName; + local: + *; }; diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Fri Sep 02 02:41:37 2016 +0000 @@ -1207,11 +1207,16 @@ * the following conditions: * *

* If the field is declared {@code volatile} then the returned VarHandle @@ -1326,11 +1331,16 @@ * the following conditions: *

*

* If the field is declared {@code volatile} then the returned VarHandle @@ -1631,11 +1641,16 @@ * the following conditions: *

*

* If the field is declared {@code volatile} then the returned VarHandle @@ -2353,9 +2368,13 @@ * the following conditions: *

*

* If the component type is {@code float} or {@code double} then numeric @@ -2426,7 +2445,9 @@ * If access is aligned then following access modes are supported and are * guaranteed to support atomic access: *

*

* Misaligned access, and therefore atomicity guarantees, may be determined @@ -2508,7 +2532,9 @@ * If access is aligned then following access modes are supported and are * guaranteed to support atomic access: *

*

* Misaligned access, and therefore atomicity guarantees, may be determined diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java --- a/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/VarHandle.java Fri Sep 02 02:41:37 2016 +0000 @@ -134,21 +134,39 @@ * The set of corresponding access mode methods belonging to this group * consists of the methods * {@link #compareAndSet compareAndSet}, + * {@link #weakCompareAndSetPlain weakCompareAndSetPlain}, * {@link #weakCompareAndSet weakCompareAndSet}, - * {@link #weakCompareAndSetVolatile weakCompareAndSetVolatile}, * {@link #weakCompareAndSetAcquire weakCompareAndSetAcquire}, * {@link #weakCompareAndSetRelease weakCompareAndSetRelease}, * {@link #compareAndExchangeAcquire compareAndExchangeAcquire}, * {@link #compareAndExchange compareAndExchange}, * {@link #compareAndExchangeRelease compareAndExchangeRelease}, - * {@link #getAndSet getAndSet}. + * {@link #getAndSet getAndSet}, + * {@link #getAndSetAcquire getAndSetAcquire}, + * {@link #getAndSetRelease getAndSetRelease}. *

  • numeric atomic update access modes that, for example, atomically get and * set with addition the value of a variable under specified memory ordering * effects. * The set of corresponding access mode methods belonging to this group * consists of the methods * {@link #getAndAdd getAndAdd}, + * {@link #getAndAddAcquire getAndAddAcquire}, + * {@link #getAndAddRelease getAndAddRelease}, * {@link #addAndGet addAndGet}. + *
  • bitwise atomic update access modes that, for example, atomically get and + * bitwise OR the value of a variable under specified memory ordering + * effects. + * The set of corresponding access mode methods belonging to this group + * consists of the methods + * {@link #getAndBitwiseOr getAndBitwiseOr}, + * {@link #getAndBitwiseOrAcquire getAndBitwiseOrAcquire}, + * {@link #getAndBitwiseOrRelease getAndBitwiseOrRelease}, + * {@link #getAndBitwiseAnd getAndBitwiseAnd}, + * {@link #getAndBitwiseAndAcquire getAndBitwiseAndAcquire}, + * {@link #getAndBitwiseAndRelease getAndBitwiseAndRelease}, + * {@link #getAndBitwiseXor getAndBitwiseXor}, + * {@link #getAndBitwiseXorAcquire getAndBitwiseXorAcquire}, + * {@link #getAndBitwiseXorRelease getAndBitwiseXorRelease}. * * *

    Factory methods that produce or {@link java.lang.invoke.MethodHandles.Lookup @@ -163,8 +181,8 @@ * VarHandle instances and the corresponding method never throws * {@code UnsupportedOperationException}. * If a VarHandle references a read-only variable (for example a {@code final} - * field) then write, atomic update and numeric atomic update access modes are - * not supported and corresponding methods throw + * field) then write, atomic update, numeric atomic update, and bitwise atomic + * update access modes are not supported and corresponding methods throw * {@code UnsupportedOperationException}. * Read/write access modes (if supported), with the exception of * {@code get} and {@code set}, provide atomic access for @@ -816,8 +834,8 @@ *

    The method signature is of the form {@code (CT, T expectedValue, T newValue)boolean}. * *

    The symbolic type descriptor at the call site of {@code - * weakCompareAndSet} must match the access mode type that is the result of - * calling {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)} + * weakCompareAndSetPlain} must match the access mode type that is the result of + * calling {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)} * on this VarHandle. * * @param args the signature-polymorphic parameter list of the form @@ -838,7 +856,7 @@ public final native @MethodHandle.PolymorphicSignature @HotSpotIntrinsicCandidate - boolean weakCompareAndSet(Object... args); + boolean weakCompareAndSetPlain(Object... args); /** * Possibly atomically sets the value of a variable to the {@code newValue} @@ -853,8 +871,8 @@ *

    The method signature is of the form {@code (CT, T expectedValue, T newValue)boolean}. * *

    The symbolic type descriptor at the call site of {@code - * weakCompareAndSetVolatile} must match the access mode type that is the - * result of calling {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)} + * weakCompareAndSet} must match the access mode type that is the + * result of calling {@code accessModeType(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)} * on this VarHandle. * * @param args the signature-polymorphic parameter list of the form @@ -875,7 +893,7 @@ public final native @MethodHandle.PolymorphicSignature @HotSpotIntrinsicCandidate - boolean weakCompareAndSetVolatile(Object... args); + boolean weakCompareAndSet(Object... args); /** * Possibly atomically sets the value of a variable to the {@code newValue} @@ -986,6 +1004,71 @@ @HotSpotIntrinsicCandidate Object getAndSet(Object... args); + /** + * Atomically sets the value of a variable to the {@code newValue} with the + * memory semantics of {@link #set} and returns the variable's + * previous value, as accessed with the memory semantics of + * {@link #getAcquire}. + * + *

    The method signature is of the form {@code (CT, T newValue)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndSetAcquire} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T newValue)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setVolatile(Object...) + * @see #getVolatile(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndSetAcquire(Object... args); + + /** + * Atomically sets the value of a variable to the {@code newValue} with the + * memory semantics of {@link #setRelease} and returns the variable's + * previous value, as accessed with the memory semantics of + * {@link #get}. + * + *

    The method signature is of the form {@code (CT, T newValue)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndSetRelease} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_SET_RELEASE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T newValue)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setVolatile(Object...) + * @see #getVolatile(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndSetRelease(Object... args); // Primitive adders // Throw UnsupportedOperationException for refs @@ -1025,21 +1108,95 @@ /** * Atomically adds the {@code value} to the current value of a variable with - * the memory semantics of {@link #setVolatile}, and returns the variable's - * current (updated) value, as accessed with the memory semantics of - * {@link #getVolatile}. + * the memory semantics of {@link #set}, and returns the variable's + * previous value, as accessed with the memory semantics of + * {@link #getAcquire}. * *

    The method signature is of the form {@code (CT, T value)T}. * - *

    The symbolic type descriptor at the call site of {@code addAndGet} + *

    The symbolic type descriptor at the call site of {@code getAndAddAcquire} * must match the access mode type that is the result of calling - * {@code accessModeType(VarHandle.AccessMode.ADD_AND_GET)} on this + * {@code accessModeType(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)} on this * VarHandle. * * @param args the signature-polymorphic parameter list of the form * {@code (CT, T value)} * , statically represented using varargs. - * @return the signature-polymorphic result that is the current value of + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setVolatile(Object...) + * @see #getVolatile(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndAddAcquire(Object... args); + + /** + * Atomically adds the {@code value} to the current value of a variable with + * the memory semantics of {@link #setRelease}, and returns the variable's + * previous value, as accessed with the memory semantics of + * {@link #get}. + * + *

    The method signature is of the form {@code (CT, T value)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndAddRelease} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_ADD_RELEASE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T value)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setVolatile(Object...) + * @see #getVolatile(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndAddRelease(Object... args); + + + // Bitwise operations + // Throw UnsupportedOperationException for refs + + /** + * Atomically sets the value of a variable to the result of + * bitwise OR between the variable's current value and the {@code mask} + * with the memory semantics of {@link #setVolatile} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #getVolatile}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical OR is performed instead of a bitwise OR. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseOr} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_OR)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of * the variable * , statically represented using {@code Object}. * @throws UnsupportedOperationException if the access mode is unsupported @@ -1054,7 +1211,304 @@ public final native @MethodHandle.PolymorphicSignature @HotSpotIntrinsicCandidate - Object addAndGet(Object... args); + Object getAndBitwiseOr(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise OR between the variable's current value and the {@code mask} + * with the memory semantics of {@link #set} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #getAcquire}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical OR is performed instead of a bitwise OR. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseOrAcquire} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #set(Object...) + * @see #getAcquire(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseOrAcquire(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise OR between the variable's current value and the {@code mask} + * with the memory semantics of {@link #setRelease} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #get}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical OR is performed instead of a bitwise OR. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseOrRelease} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setRelease(Object...) + * @see #get(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseOrRelease(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise AND between the variable's current value and the {@code mask} + * with the memory semantics of {@link #setVolatile} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #getVolatile}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical AND is performed instead of a bitwise AND. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseAnd} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_AND)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setVolatile(Object...) + * @see #getVolatile(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseAnd(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise AND between the variable's current value and the {@code mask} + * with the memory semantics of {@link #set} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #getAcquire}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical AND is performed instead of a bitwise AND. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseAndAcquire} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #set(Object...) + * @see #getAcquire(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseAndAcquire(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise AND between the variable's current value and the {@code mask} + * with the memory semantics of {@link #setRelease} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #get}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical AND is performed instead of a bitwise AND. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseAndRelease} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setRelease(Object...) + * @see #get(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseAndRelease(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise XOR between the variable's current value and the {@code mask} + * with the memory semantics of {@link #setVolatile} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #getVolatile}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical XOR is performed instead of a bitwise XOR. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseXor} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_XOR)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setVolatile(Object...) + * @see #getVolatile(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseXor(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise XOR between the variable's current value and the {@code mask} + * with the memory semantics of {@link #set} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #getAcquire}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical XOR is performed instead of a bitwise XOR. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseXorAcquire} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #set(Object...) + * @see #getAcquire(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseXorAcquire(Object... args); + + /** + * Atomically sets the value of a variable to the result of + * bitwise XOR between the variable's current value and the {@code mask} + * with the memory semantics of {@link #setRelease} and returns the + * variable's previous value, as accessed with the memory semantics of + * {@link #get}. + * + *

    If the variable type is the non-integral {@code boolean} type then a + * logical XOR is performed instead of a bitwise XOR. + * + *

    The method signature is of the form {@code (CT, T mask)T}. + * + *

    The symbolic type descriptor at the call site of {@code getAndBitwiseXorRelease} + * must match the access mode type that is the result of calling + * {@code accessModeType(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)} on this + * VarHandle. + * + * @param args the signature-polymorphic parameter list of the form + * {@code (CT, T mask)} + * , statically represented using varargs. + * @return the signature-polymorphic result that is the previous value of + * the variable + * , statically represented using {@code Object}. + * @throws UnsupportedOperationException if the access mode is unsupported + * for this VarHandle. + * @throws WrongMethodTypeException if the access mode type is not + * compatible with the caller's symbolic type descriptor. + * @throws ClassCastException if the access mode type is compatible with the + * caller's symbolic type descriptor, but a reference cast fails. + * @see #setRelease(Object...) + * @see #get(Object...) + */ + public final native + @MethodHandle.PolymorphicSignature + @HotSpotIntrinsicCandidate + Object getAndBitwiseXorRelease(Object... args); + enum AccessType { GET(Object.class), @@ -1204,18 +1658,18 @@ /** * The access mode whose access is specified by the corresponding * method + * {@link VarHandle#weakCompareAndSetPlain VarHandle.weakCompareAndSetPlain} + */ + WEAK_COMPARE_AND_SET_PLAIN("weakCompareAndSetPlain", AccessType.COMPARE_AND_SWAP), + /** + * The access mode whose access is specified by the corresponding + * method * {@link VarHandle#weakCompareAndSet VarHandle.weakCompareAndSet} */ WEAK_COMPARE_AND_SET("weakCompareAndSet", AccessType.COMPARE_AND_SWAP), /** * The access mode whose access is specified by the corresponding * method - * {@link VarHandle#weakCompareAndSetVolatile VarHandle.weakCompareAndSetVolatile} - */ - WEAK_COMPARE_AND_SET_VOLATILE("weakCompareAndSetVolatile", AccessType.COMPARE_AND_SWAP), - /** - * The access mode whose access is specified by the corresponding - * method * {@link VarHandle#weakCompareAndSetAcquire VarHandle.weakCompareAndSetAcquire} */ WEAK_COMPARE_AND_SET_ACQUIRE("weakCompareAndSetAcquire", AccessType.COMPARE_AND_SWAP), @@ -1234,15 +1688,87 @@ /** * The access mode whose access is specified by the corresponding * method + * {@link VarHandle#getAndSetAcquire VarHandle.getAndSetAcquire} + */ + GET_AND_SET_ACQUIRE("getAndSetAcquire", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndSetRelease VarHandle.getAndSetRelease} + */ + GET_AND_SET_RELEASE("getAndSetRelease", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method * {@link VarHandle#getAndAdd VarHandle.getAndAdd} */ GET_AND_ADD("getAndAdd", AccessType.GET_AND_UPDATE), /** * The access mode whose access is specified by the corresponding * method - * {@link VarHandle#addAndGet VarHandle.addAndGet} + * {@link VarHandle#getAndAddAcquire VarHandle.getAndAddAcquire} + */ + GET_AND_ADD_ACQUIRE("getAndAddAcquire", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndAddRelease VarHandle.getAndAddRelease} + */ + GET_AND_ADD_RELEASE("getAndAddRelease", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseOr VarHandle.getAndBitwiseOr} + */ + GET_AND_BITWISE_OR("getAndBitwiseOr", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseOrRelease VarHandle.getAndBitwiseOrRelease} + */ + GET_AND_BITWISE_OR_RELEASE("getAndBitwiseOrRelease", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseOrAcquire VarHandle.getAndBitwiseOrAcquire} + */ + GET_AND_BITWISE_OR_ACQUIRE("getAndBitwiseOrAcquire", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseAnd VarHandle.getAndBitwiseAnd} */ - ADD_AND_GET("addAndGet", AccessType.GET_AND_UPDATE), + GET_AND_BITWISE_AND("getAndBitwiseAnd", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseAndRelease VarHandle.getAndBitwiseAndRelease} + */ + GET_AND_BITWISE_AND_RELEASE("getAndBitwiseAndRelease", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseAndAcquire VarHandle.getAndBitwiseAndAcquire} + */ + GET_AND_BITWISE_AND_ACQUIRE("getAndBitwiseAndAcquire", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseXor VarHandle.getAndBitwiseXor} + */ + GET_AND_BITWISE_XOR("getAndBitwiseXor", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseXorRelease VarHandle.getAndBitwiseXorRelease} + */ + GET_AND_BITWISE_XOR_RELEASE("getAndBitwiseXorRelease", AccessType.GET_AND_UPDATE), + /** + * The access mode whose access is specified by the corresponding + * method + * {@link VarHandle#getAndBitwiseXorAcquire VarHandle.getAndBitwiseXorAcquire} + */ + GET_AND_BITWISE_XOR_ACQUIRE("getAndBitwiseXorAcquire", AccessType.GET_AND_UPDATE), ; static final Map methodNameToAccessMode; diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template --- a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandle.java.template Fri Sep 02 02:41:37 2016 +0000 @@ -156,7 +156,7 @@ } @ForceInline - static boolean weakCompareAndSet(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { + static boolean weakCompareAndSetPlain(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { return UNSAFE.weakCompareAndSwap$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), handle.fieldOffset, {#if[Object]?handle.fieldType.cast(expected):expected}, @@ -164,7 +164,7 @@ } @ForceInline - static boolean weakCompareAndSetVolatile(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { + static boolean weakCompareAndSet(FieldInstanceReadWrite handle, Object holder, $type$ expected, $type$ value) { return UNSAFE.weakCompareAndSwap$Type$Volatile(Objects.requireNonNull(handle.receiverType.cast(holder)), handle.fieldOffset, {#if[Object]?handle.fieldType.cast(expected):expected}, @@ -193,6 +193,20 @@ handle.fieldOffset, {#if[Object]?handle.fieldType.cast(value):value}); } + + @ForceInline + static $type$ getAndSetAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndSet$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + {#if[Object]?handle.fieldType.cast(value):value}); + } + + @ForceInline + static $type$ getAndSetRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndSet$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + {#if[Object]?handle.fieldType.cast(value):value}); + } #end[CAS] #if[AtomicAdd] @@ -204,12 +218,85 @@ } @ForceInline - static $type$ addAndGet(FieldInstanceReadWrite handle, Object holder, $type$ value) { - return {#if[ShorterThanInt]?($type$)}(UNSAFE.getAndAdd$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), + static $type$ getAndAddAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndAdd$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndAddRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndAdd$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + +#end[AtomicAdd] +#if[Bitwise] + + @ForceInline + static $type$ getAndBitwiseOr(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseOr$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseOrRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseOr$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseOrAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseOr$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)), handle.fieldOffset, - value) + value); + value); + } + + @ForceInline + static $type$ getAndBitwiseAnd(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseAnd$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseAndRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseAnd$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseAndAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseAnd$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); } -#end[AtomicAdd] + + @ForceInline + static $type$ getAndBitwiseXor(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseXor$Type$(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseXorRelease(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseXor$Type$Release(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseXorAcquire(FieldInstanceReadWrite handle, Object holder, $type$ value) { + return UNSAFE.getAndBitwiseXor$Type$Acquire(Objects.requireNonNull(handle.receiverType.cast(holder)), + handle.fieldOffset, + value); + } +#end[Bitwise] static final VarForm FORM = new VarForm(FieldInstanceReadWrite.class, Object.class, $type$.class); } @@ -337,7 +424,7 @@ } @ForceInline - static boolean weakCompareAndSet(FieldStaticReadWrite handle, $type$ expected, $type$ value) { + static boolean weakCompareAndSetPlain(FieldStaticReadWrite handle, $type$ expected, $type$ value) { return UNSAFE.weakCompareAndSwap$Type$(handle.base, handle.fieldOffset, {#if[Object]?handle.fieldType.cast(expected):expected}, @@ -345,7 +432,7 @@ } @ForceInline - static boolean weakCompareAndSetVolatile(FieldStaticReadWrite handle, $type$ expected, $type$ value) { + static boolean weakCompareAndSet(FieldStaticReadWrite handle, $type$ expected, $type$ value) { return UNSAFE.weakCompareAndSwap$Type$Volatile(handle.base, handle.fieldOffset, {#if[Object]?handle.fieldType.cast(expected):expected}, @@ -374,6 +461,20 @@ handle.fieldOffset, {#if[Object]?handle.fieldType.cast(value):value}); } + + @ForceInline + static $type$ getAndSetAcquire(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndSet$Type$Acquire(handle.base, + handle.fieldOffset, + {#if[Object]?handle.fieldType.cast(value):value}); + } + + @ForceInline + static $type$ getAndSetRelease(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndSet$Type$Release(handle.base, + handle.fieldOffset, + {#if[Object]?handle.fieldType.cast(value):value}); + } #end[CAS] #if[AtomicAdd] @@ -385,12 +486,84 @@ } @ForceInline - static $type$ addAndGet(FieldStaticReadWrite handle, $type$ value) { - return {#if[ShorterThanInt]?($type$)}(UNSAFE.getAndAdd$Type$(handle.base, + static $type$ getAndAddAcquire(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndAdd$Type$Acquire(handle.base, handle.fieldOffset, - value) + value); + value); + } + + @ForceInline + static $type$ getAndAddRelease(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndAdd$Type$Release(handle.base, + handle.fieldOffset, + value); } #end[AtomicAdd] +#if[Bitwise] + + @ForceInline + static $type$ getAndBitwiseOr(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseOr$Type$(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseOrRelease(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseOr$Type$Release(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseOrAcquire(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseOr$Type$Acquire(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseAnd(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseAnd$Type$(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseAndRelease(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseAnd$Type$Release(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseAndAcquire(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseAnd$Type$Acquire(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseXor(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseXor$Type$(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseXorRelease(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseXor$Type$Release(handle.base, + handle.fieldOffset, + value); + } + + @ForceInline + static $type$ getAndBitwiseXorAcquire(FieldStaticReadWrite handle, $type$ value) { + return UNSAFE.getAndBitwiseXor$Type$Acquire(handle.base, + handle.fieldOffset, + value); + } +#end[Bitwise] static final VarForm FORM = new VarForm(FieldStaticReadWrite.class, null, $type$.class); } @@ -562,7 +735,7 @@ } @ForceInline - static boolean weakCompareAndSet(Array handle, Object oarray, int index, $type$ expected, $type$ value) { + static boolean weakCompareAndSetPlain(Array handle, Object oarray, int index, $type$ expected, $type$ value) { #if[Object] Object[] array = (Object[]) handle.arrayType.cast(oarray); #else[Object] @@ -575,7 +748,7 @@ } @ForceInline - static boolean weakCompareAndSetVolatile(Array handle, Object oarray, int index, $type$ expected, $type$ value) { + static boolean weakCompareAndSet(Array handle, Object oarray, int index, $type$ expected, $type$ value) { #if[Object] Object[] array = (Object[]) handle.arrayType.cast(oarray); #else[Object] @@ -624,33 +797,131 @@ (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, {#if[Object]?handle.componentType.cast(value):value}); } + + @ForceInline + static $type$ getAndSetAcquire(Array handle, Object oarray, int index, $type$ value) { +#if[Object] + Object[] array = (Object[]) handle.arrayType.cast(oarray); +#else[Object] + $type$[] array = ($type$[]) oarray; +#end[Object] + return UNSAFE.getAndSet$Type$Acquire(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + {#if[Object]?handle.componentType.cast(value):value}); + } + + @ForceInline + static $type$ getAndSetRelease(Array handle, Object oarray, int index, $type$ value) { +#if[Object] + Object[] array = (Object[]) handle.arrayType.cast(oarray); +#else[Object] + $type$[] array = ($type$[]) oarray; +#end[Object] + return UNSAFE.getAndSet$Type$Release(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + {#if[Object]?handle.componentType.cast(value):value}); + } #end[CAS] #if[AtomicAdd] @ForceInline static $type$ getAndAdd(Array handle, Object oarray, int index, $type$ value) { -#if[Object] - Object[] array = (Object[]) handle.arrayType.cast(oarray); -#else[Object] $type$[] array = ($type$[]) oarray; -#end[Object] return UNSAFE.getAndAdd$Type$(array, (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, value); } @ForceInline - static $type$ addAndGet(Array handle, Object oarray, int index, $type$ value) { -#if[Object] - Object[] array = (Object[]) handle.arrayType.cast(oarray); -#else[Object] + static $type$ getAndAddAcquire(Array handle, Object oarray, int index, $type$ value) { $type$[] array = ($type$[]) oarray; -#end[Object] - return {#if[ShorterThanInt]?($type$)}(UNSAFE.getAndAdd$Type$(array, + return UNSAFE.getAndAdd$Type$Acquire(array, (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, - value) + value); + value); + } + + @ForceInline + static $type$ getAndAddRelease(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndAdd$Type$Release(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); } #end[AtomicAdd] +#if[Bitwise] + + @ForceInline + static $type$ getAndBitwiseOr(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseOr$Type$(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseOrRelease(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseOr$Type$Release(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseOrAcquire(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseOr$Type$Acquire(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseAnd(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseAnd$Type$(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseAndRelease(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseAnd$Type$Release(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseAndAcquire(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseAnd$Type$Acquire(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseXor(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseXor$Type$(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseXorRelease(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseXor$Type$Release(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } + + @ForceInline + static $type$ getAndBitwiseXorAcquire(Array handle, Object oarray, int index, $type$ value) { + $type$[] array = ($type$[]) oarray; + return UNSAFE.getAndBitwiseXor$Type$Acquire(array, + (((long) Preconditions.checkIndex(index, array.length, AIOOBE_SUPPLIER)) << handle.ashift) + handle.abase, + value); + } +#end[Bitwise] static final VarForm FORM = new VarForm(Array.class, {#if[Object]?Object[].class:$type$[].class}, {#if[Object]?Object.class:$type$.class}, int.class); } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template --- a/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/lang/invoke/X-VarHandleByteArrayView.java.template Fri Sep 02 02:41:37 2016 +0000 @@ -223,7 +223,7 @@ } @ForceInline - static boolean weakCompareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { + static boolean weakCompareAndSetPlain(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { byte[] ba = (byte[]) oba; return UNSAFE.weakCompareAndSwap$RawType$( ba, @@ -232,7 +232,7 @@ } @ForceInline - static boolean weakCompareAndSetVolatile(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { + static boolean weakCompareAndSet(ArrayHandle handle, Object oba, int index, $type$ expected, $type$ value) { byte[] ba = (byte[]) oba; return UNSAFE.weakCompareAndSwap$RawType$Volatile( ba, @@ -267,6 +267,26 @@ address(ba, index(ba, index)), convEndian(handle.be, value))); } + + @ForceInline + static $type$ getAndSetAcquire(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + return convEndian(handle.be, + UNSAFE.getAndSet$RawType$Acquire( + ba, + address(ba, index(ba, index)), + convEndian(handle.be, value))); + } + + @ForceInline + static $type$ getAndSetRelease(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + return convEndian(handle.be, + UNSAFE.getAndSet$RawType$Release( + ba, + address(ba, index(ba, index)), + convEndian(handle.be, value))); + } #end[CAS] #if[AtomicAdd] @@ -284,6 +304,32 @@ } @ForceInline + static $type$ getAndAddAcquire(ArrayHandle handle, Object oba, int index, $type$ delta) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndAdd$RawType$Acquire( + ba, + address(ba, index(ba, index)), + delta); + } else { + return getAndAddConvEndianWithCAS(ba, index, delta); + } + } + + @ForceInline + static $type$ getAndAddRelease(ArrayHandle handle, Object oba, int index, $type$ delta) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndAdd$RawType$Release( + ba, + address(ba, index(ba, index)), + delta); + } else { + return getAndAddConvEndianWithCAS(ba, index, delta); + } + } + + @ForceInline static $type$ getAndAddConvEndianWithCAS(byte[] ba, int index, $type$ delta) { $type$ nativeExpectedValue, expectedValue; long offset = address(ba, index(ba, index)); @@ -294,12 +340,162 @@ nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta))); return expectedValue; } +#end[AtomicAdd] +#if[Bitwise] + + @ForceInline + static $type$ getAndBitwiseOr(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseOr$RawType$( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseOrConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseOrRelease(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseOr$RawType$Release( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseOrConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseOrAcquire(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseOr$RawType$Acquire( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseOrConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseOrConvEndianWithCAS(byte[] ba, int index, $type$ value) { + $type$ nativeExpectedValue, expectedValue; + long offset = address(ba, index(ba, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value))); + return expectedValue; + } + + @ForceInline + static $type$ getAndBitwiseAnd(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseAnd$RawType$( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseAndConvEndianWithCAS(ba, index, value); + } + } @ForceInline - static $type$ addAndGet(ArrayHandle handle, Object oba, int index, $type$ delta) { - return getAndAdd(handle, oba, index, delta) + delta; + static $type$ getAndBitwiseAndRelease(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseAnd$RawType$Release( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseAndConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseAndAcquire(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseAnd$RawType$Acquire( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseAndConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseAndConvEndianWithCAS(byte[] ba, int index, $type$ value) { + $type$ nativeExpectedValue, expectedValue; + long offset = address(ba, index(ba, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value))); + return expectedValue; } -#end[AtomicAdd] + + @ForceInline + static $type$ getAndBitwiseXor(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseXor$RawType$( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseXorConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseXorRelease(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseXor$RawType$Release( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseXorConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseXorAcquire(ArrayHandle handle, Object oba, int index, $type$ value) { + byte[] ba = (byte[]) oba; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseXor$RawType$Acquire( + ba, + address(ba, index(ba, index)), + value); + } else { + return getAndBitwiseXorConvEndianWithCAS(ba, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseXorConvEndianWithCAS(byte[] ba, int index, $type$ value) { + $type$ nativeExpectedValue, expectedValue; + long offset = address(ba, index(ba, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(ba, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(ba, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value))); + return expectedValue; + } +#end[Bitwise] static final VarForm FORM = new VarForm(ArrayHandle.class, byte[].class, $type$.class, int.class); } @@ -466,7 +662,7 @@ } @ForceInline - static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { + static boolean weakCompareAndSetPlain(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { ByteBuffer bb = (ByteBuffer) obb; return UNSAFE.weakCompareAndSwap$RawType$( UNSAFE.getObject(bb, BYTE_BUFFER_HB), @@ -475,7 +671,7 @@ } @ForceInline - static boolean weakCompareAndSetVolatile(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { + static boolean weakCompareAndSet(ByteBufferHandle handle, Object obb, int index, $type$ expected, $type$ value) { ByteBuffer bb = (ByteBuffer) obb; return UNSAFE.weakCompareAndSwap$RawType$Volatile( UNSAFE.getObject(bb, BYTE_BUFFER_HB), @@ -510,6 +706,26 @@ address(bb, indexRO(bb, index)), convEndian(handle.be, value))); } + + @ForceInline + static $type$ getAndSetAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + return convEndian(handle.be, + UNSAFE.getAndSet$RawType$Acquire( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + convEndian(handle.be, value))); + } + + @ForceInline + static $type$ getAndSetRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + return convEndian(handle.be, + UNSAFE.getAndSet$RawType$Release( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + convEndian(handle.be, value))); + } #end[CAS] #if[AtomicAdd] @@ -527,6 +743,32 @@ } @ForceInline + static $type$ getAndAddAcquire(ByteBufferHandle handle, Object obb, int index, $type$ delta) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndAdd$RawType$Acquire( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + delta); + } else { + return getAndAddConvEndianWithCAS(bb, index, delta); + } + } + + @ForceInline + static $type$ getAndAddRelease(ByteBufferHandle handle, Object obb, int index, $type$ delta) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndAdd$RawType$Release( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + delta); + } else { + return getAndAddConvEndianWithCAS(bb, index, delta); + } + } + + @ForceInline static $type$ getAndAddConvEndianWithCAS(ByteBuffer bb, int index, $type$ delta) { $type$ nativeExpectedValue, expectedValue; Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB); @@ -538,12 +780,166 @@ nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue + delta))); return expectedValue; } +#end[AtomicAdd] +#if[Bitwise] + + @ForceInline + static $type$ getAndBitwiseOr(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseOr$RawType$( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseOrConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseOrRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseOr$RawType$Release( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseOrConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseOrAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseOr$RawType$Acquire( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseOrConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseOrConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) { + $type$ nativeExpectedValue, expectedValue; + Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB); + long offset = address(bb, indexRO(bb, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue | value))); + return expectedValue; + } + + @ForceInline + static $type$ getAndBitwiseAnd(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseAnd$RawType$( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseAndConvEndianWithCAS(bb, index, value); + } + } @ForceInline - static $type$ addAndGet(ByteBufferHandle handle, Object obb, int index, $type$ delta) { - return getAndAdd(handle, obb, index, delta) + delta; + static $type$ getAndBitwiseAndRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseAnd$RawType$Release( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseAndConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseAndAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseAnd$RawType$Acquire( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseAndConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseAndConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) { + $type$ nativeExpectedValue, expectedValue; + Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB); + long offset = address(bb, indexRO(bb, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue & value))); + return expectedValue; } -#end[AtomicAdd] + + + @ForceInline + static $type$ getAndBitwiseXor(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseXor$RawType$( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseXorConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseXorRelease(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseXor$RawType$Release( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseXorConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseXorAcquire(ByteBufferHandle handle, Object obb, int index, $type$ value) { + ByteBuffer bb = (ByteBuffer) obb; + if (handle.be == BE) { + return UNSAFE.getAndBitwiseXor$RawType$Acquire( + UNSAFE.getObject(bb, BYTE_BUFFER_HB), + address(bb, indexRO(bb, index)), + value); + } else { + return getAndBitwiseXorConvEndianWithCAS(bb, index, value); + } + } + + @ForceInline + static $type$ getAndBitwiseXorConvEndianWithCAS(ByteBuffer bb, int index, $type$ value) { + $type$ nativeExpectedValue, expectedValue; + Object base = UNSAFE.getObject(bb, BYTE_BUFFER_HB); + long offset = address(bb, indexRO(bb, index)); + do { + nativeExpectedValue = UNSAFE.get$RawType$Volatile(base, offset); + expectedValue = $RawBoxType$.reverseBytes(nativeExpectedValue); + } while (!UNSAFE.weakCompareAndSwap$RawType$Volatile(base, offset, + nativeExpectedValue, $RawBoxType$.reverseBytes(expectedValue ^ value))); + return expectedValue; + } +#end[Bitwise] static final VarForm FORM = new VarForm(ByteBufferHandle.class, ByteBuffer.class, $type$.class, int.class); } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/net/ServerSocket.java --- a/jdk/src/java.base/share/classes/java/net/ServerSocket.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/net/ServerSocket.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,8 +25,13 @@ package java.net; +import jdk.internal.misc.JavaNetSocketAccess; +import jdk.internal.misc.SharedSecrets; + import java.io.FileDescriptor; import java.io.IOException; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; import java.nio.channels.ServerSocketChannel; import java.security.AccessController; import java.security.PrivilegedExceptionAction; @@ -1011,4 +1016,27 @@ return options; } } + + static { + SharedSecrets.setJavaNetSocketAccess( + new JavaNetSocketAccess() { + @Override + public ServerSocket newServerSocket(SocketImpl impl) { + return new ServerSocket(impl); + } + + @Override + public SocketImpl newSocketImpl(Class implClass) { + try { + Constructor ctor = + implClass.getDeclaredConstructor(); + return ctor.newInstance(); + } catch (NoSuchMethodException | InstantiationException | + IllegalAccessException | InvocationTargetException e) { + throw new AssertionError(e); + } + } + } + ); + } } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/CompletableFuture.java Fri Sep 02 02:41:37 2016 +0000 @@ -521,7 +521,7 @@ else break; } - else if (STACK.weakCompareAndSetVolatile(this, p, (p = p.next))) + else if (STACK.weakCompareAndSet(this, p, (p = p.next))) unlinked = true; else p = stack; @@ -532,7 +532,7 @@ if (q.isLive()) { p = q; q = s; - } else if (NEXT.weakCompareAndSetVolatile(p, q, s)) + } else if (NEXT.weakCompareAndSet(p, q, s)) break; else q = p.next; diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedDeque.java Fri Sep 02 02:41:37 2016 +0000 @@ -330,7 +330,7 @@ // for e to become an element of this deque, // and for newNode to become "live". if (p != h) // hop two nodes at a time; failure is OK - HEAD.weakCompareAndSetVolatile(this, h, newNode); + HEAD.weakCompareAndSet(this, h, newNode); return; } // Lost CAS race to another thread; re-read prev @@ -362,7 +362,7 @@ // for e to become an element of this deque, // and for newNode to become "live". if (p != t) // hop two nodes at a time; failure is OK - TAIL.weakCompareAndSetVolatile(this, t, newNode); + TAIL.weakCompareAndSet(this, t, newNode); return; } // Lost CAS race to another thread; re-read next @@ -1153,12 +1153,12 @@ if (NEXT.compareAndSet(p, null, beginningOfTheEnd)) { // Successful CAS is the linearization point // for all elements to be added to this deque. - if (!TAIL.weakCompareAndSetVolatile(this, t, last)) { + if (!TAIL.weakCompareAndSet(this, t, last)) { // Try a little harder to update tail, // since we may be adding many elements. t = tail; if (last.next == null) - TAIL.weakCompareAndSetVolatile(this, t, last); + TAIL.weakCompareAndSet(this, t, last); } return true; } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ConcurrentLinkedQueue.java Fri Sep 02 02:41:37 2016 +0000 @@ -308,7 +308,7 @@ // for e to become an element of this queue, // and for newNode to become "live". if (p != t) // hop two nodes at a time; failure is OK - TAIL.weakCompareAndSetVolatile(this, t, newNode); + TAIL.weakCompareAndSet(this, t, newNode); return true; } // Lost CAS race to another thread; re-read next @@ -477,7 +477,7 @@ next = succ(p); if (pred != null && next != null) // unlink - NEXT.weakCompareAndSetVolatile(pred, p, next); + NEXT.weakCompareAndSet(pred, p, next); if (removed) return true; } @@ -524,12 +524,12 @@ if (NEXT.compareAndSet(p, null, beginningOfTheEnd)) { // Successful CAS is the linearization point // for all elements to be added to this queue. - if (!TAIL.weakCompareAndSetVolatile(this, t, last)) { + if (!TAIL.weakCompareAndSet(this, t, last)) { // Try a little harder to update tail, // since we may be adding many elements. t = tail; if (last.next == null) - TAIL.weakCompareAndSetVolatile(this, t, last); + TAIL.weakCompareAndSet(this, t, last); } return true; } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/CountedCompleter.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/CountedCompleter.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/CountedCompleter.java Fri Sep 02 02:41:37 2016 +0000 @@ -551,7 +551,7 @@ public final int decrementPendingCountUnlessZero() { int c; do {} while ((c = pending) != 0 && - !PENDING.weakCompareAndSetVolatile(this, c, c - 1)); + !PENDING.weakCompareAndSet(this, c, c - 1)); return c; } @@ -584,7 +584,7 @@ return; } } - else if (PENDING.weakCompareAndSetVolatile(a, c, c - 1)) + else if (PENDING.weakCompareAndSet(a, c, c - 1)) return; } } @@ -607,7 +607,7 @@ return; } } - else if (PENDING.weakCompareAndSetVolatile(a, c, c - 1)) + else if (PENDING.weakCompareAndSet(a, c, c - 1)) return; } } @@ -652,7 +652,7 @@ for (int c;;) { if ((c = pending) == 0) return this; - else if (PENDING.weakCompareAndSetVolatile(this, c, c - 1)) + else if (PENDING.weakCompareAndSet(this, c, c - 1)) return null; } } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java Fri Sep 02 02:41:37 2016 +0000 @@ -42,15 +42,10 @@ import java.security.Permissions; import java.security.ProtectionDomain; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.function.Predicate; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.CountedCompleter; -import java.util.concurrent.ForkJoinTask; -import java.util.concurrent.ForkJoinWorkerThread; import java.util.concurrent.locks.LockSupport; /** @@ -1413,7 +1408,7 @@ } if (phase != QUIET) { // else pre-adjusted long c; // decrement counts - do {} while (!CTL.weakCompareAndSetVolatile + do {} while (!CTL.weakCompareAndSet (this, c = ctl, ((RC_MASK & (c - RC_UNIT)) | (TC_MASK & (c - TC_UNIT)) | (SP_MASK & c)))); @@ -1608,7 +1603,7 @@ do { w.stackPred = (int)(c = ctl); nc = ((c - RC_UNIT) & UC_MASK) | (SP_MASK & np); - } while (!CTL.weakCompareAndSetVolatile(this, c, nc)); + } while (!CTL.weakCompareAndSet(this, c, nc)); } else { // already queued int pred = w.stackPred; diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/FutureTask.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/FutureTask.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/FutureTask.java Fri Sep 02 02:41:37 2016 +0000 @@ -361,7 +361,7 @@ private void finishCompletion() { // assert state > COMPLETING; for (WaitNode q; (q = waiters) != null;) { - if (WAITERS.weakCompareAndSetVolatile(this, q, null)) { + if (WAITERS.weakCompareAndSet(this, q, null)) { for (;;) { Thread t = q.thread; if (t != null) { @@ -423,7 +423,7 @@ q = new WaitNode(); } else if (!queued) - queued = WAITERS.weakCompareAndSetVolatile(this, q.next = waiters, q); + queued = WAITERS.weakCompareAndSet(this, q.next = waiters, q); else if (timed) { final long parkNanos; if (startTime == 0L) { // first time diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/Phaser.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/Phaser.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/Phaser.java Fri Sep 02 02:41:37 2016 +0000 @@ -456,7 +456,7 @@ // finish registration whenever parent registration // succeeded, even when racing with termination, // since these are part of the same "transaction". - while (!STATE.weakCompareAndSetVolatile + while (!STATE.weakCompareAndSet (this, s, ((long)phase << PHASE_SHIFT) | adjust)) { s = state; @@ -488,7 +488,7 @@ // CAS to root phase with current parties, tripping unarrived while ((phase = (int)(root.state >>> PHASE_SHIFT)) != (int)(s >>> PHASE_SHIFT) && - !STATE.weakCompareAndSetVolatile + !STATE.weakCompareAndSet (this, s, s = (((long)phase << PHASE_SHIFT) | ((phase < 0) ? (s & COUNTS_MASK) : diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/SubmissionPublisher.java Fri Sep 02 02:41:37 2016 +0000 @@ -1203,7 +1203,7 @@ } catch (RuntimeException | Error ex) { // back out do {} while (((c = ctl) & DISABLED) == 0 && (c & ACTIVE) != 0 && - !CTL.weakCompareAndSetVolatile + !CTL.weakCompareAndSet (this, c, c & ~ACTIVE)); throw ex; } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicBoolean.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicBoolean.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicBoolean.java Fri Sep 02 02:41:37 2016 +0000 @@ -106,16 +106,16 @@ /** * Possibly atomically sets the value to {@code newValue} * if the current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param expectedValue the expected value * @param newValue the new value * @return {@code true} if successful */ public boolean weakCompareAndSet(boolean expectedValue, boolean newValue) { - return VALUE.weakCompareAndSet(this, - (expectedValue ? 1 : 0), - (newValue ? 1 : 0)); + return VALUE.weakCompareAndSetPlain(this, + (expectedValue ? 1 : 0), + (newValue ? 1 : 0)); } /** @@ -285,7 +285,7 @@ * Possibly atomically sets the value to {@code newValue} if the current * value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param expectedValue the expected value * @param newValue the new value @@ -293,9 +293,9 @@ * @since 9 */ public final boolean weakCompareAndSetVolatile(boolean expectedValue, boolean newValue) { - return VALUE.weakCompareAndSetVolatile(this, - (expectedValue ? 1 : 0), - (newValue ? 1 : 0)); + return VALUE.weakCompareAndSet(this, + (expectedValue ? 1 : 0), + (newValue ? 1 : 0)); } /** diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicInteger.java Fri Sep 02 02:41:37 2016 +0000 @@ -146,7 +146,7 @@ /** * Possibly atomically sets the value to {@code newValue} * if the current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param expectedValue the expected value * @param newValue the new value @@ -217,7 +217,7 @@ /** * Atomically adds the given value to the current value, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * * @param delta the value to add * @return the updated value @@ -490,7 +490,7 @@ * Possibly atomically sets the value to {@code newValue} if * the current value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param expectedValue the expected value * @param newValue the new value diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerArray.java Fri Sep 02 02:41:37 2016 +0000 @@ -149,7 +149,7 @@ /** * Possibly atomically sets the element at index {@code i} to * {@code newValue} if the element's current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param i the index * @param expectedValue the expected value @@ -157,7 +157,7 @@ * @return {@code true} if successful */ public final boolean weakCompareAndSet(int i, int expectedValue, int newValue) { - return AA.weakCompareAndSet(array, i, expectedValue, newValue); + return AA.weakCompareAndSetPlain(array, i, expectedValue, newValue); } /** @@ -200,7 +200,7 @@ /** * Atomically increments the value of the element at index {@code i}, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * *

    Equivalent to {@code addAndGet(i, 1)}. * @@ -208,12 +208,12 @@ * @return the updated value */ public final int incrementAndGet(int i) { - return (int)AA.addAndGet(array, i, 1); + return (int)AA.getAndAdd(array, i, 1) + 1; } /** * Atomically decrements the value of the element at index {@code i}, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * *

    Equivalent to {@code addAndGet(i, -1)}. * @@ -221,19 +221,19 @@ * @return the updated value */ public final int decrementAndGet(int i) { - return (int)AA.addAndGet(array, i, -1); + return (int)AA.getAndAdd(array, i, -1) - 1; } /** * Atomically adds the given value to the element at index {@code i}, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * * @param i the index * @param delta the value to add * @return the updated value */ public final int addAndGet(int i, int delta) { - return (int)AA.addAndGet(array, i, delta); + return (int)AA.getAndAdd(array, i, delta) + delta; } /** @@ -489,7 +489,7 @@ * Possibly atomically sets the element at index {@code i} to * {@code newValue} if the element's current value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param i the index * @param expectedValue the expected value @@ -498,7 +498,7 @@ * @since 9 */ public final boolean weakCompareAndSetVolatile(int i, int expectedValue, int newValue) { - return AA.weakCompareAndSetVolatile(array, i, expectedValue, newValue); + return AA.weakCompareAndSet(array, i, expectedValue, newValue); } /** diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLong.java Fri Sep 02 02:41:37 2016 +0000 @@ -162,7 +162,7 @@ /** * Possibly atomically sets the value to {@code newValue} * if the current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param expectedValue the expected value * @param newValue the new value @@ -209,7 +209,7 @@ /** * Atomically increments the current value, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * *

    Equivalent to {@code addAndGet(1)}. * @@ -221,7 +221,7 @@ /** * Atomically decrements the current value, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * *

    Equivalent to {@code addAndGet(-1)}. * @@ -233,7 +233,7 @@ /** * Atomically adds the given value to the current value, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * * @param delta the value to add * @return the updated value @@ -504,7 +504,7 @@ * Possibly atomically sets the value to {@code newValue} * if the current value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param expectedValue the expected value * @param newValue the new value diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongArray.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongArray.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongArray.java Fri Sep 02 02:41:37 2016 +0000 @@ -149,7 +149,7 @@ /** * Possibly atomically sets the element at index {@code i} to * {@code newValue} if the element's current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param i the index * @param expectedValue the expected value @@ -157,7 +157,7 @@ * @return {@code true} if successful */ public final boolean weakCompareAndSet(int i, long expectedValue, long newValue) { - return AA.weakCompareAndSet(array, i, expectedValue, newValue); + return AA.weakCompareAndSetPlain(array, i, expectedValue, newValue); } /** @@ -200,7 +200,7 @@ /** * Atomically increments the value of the element at index {@code i}, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * *

    Equivalent to {@code addAndGet(i, 1)}. * @@ -208,12 +208,12 @@ * @return the updated value */ public final long incrementAndGet(int i) { - return (long)AA.addAndGet(array, i, 1L); + return (long)AA.getAndAdd(array, i, 1L) + 1L; } /** * Atomically decrements the value of the element at index {@code i}, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * *

    Equivalent to {@code addAndGet(i, -1)}. * @@ -221,19 +221,19 @@ * @return the updated value */ public final long decrementAndGet(int i) { - return (long)AA.addAndGet(array, i, -1L); + return (long)AA.getAndAdd(array, i, -1L) - 1L; } /** * Atomically adds the given value to the element at index {@code i}, - * with memory effects as specified by {@link VarHandle#addAndGet}. + * with memory effects as specified by {@link VarHandle#getAndAdd}. * * @param i the index * @param delta the value to add * @return the updated value */ public long addAndGet(int i, long delta) { - return (long)AA.addAndGet(array, i, delta); + return (long)AA.getAndAdd(array, i, delta) + delta; } /** @@ -489,7 +489,7 @@ * Possibly atomically sets the element at index {@code i} to * {@code newValue} if the element's current value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param i the index * @param expectedValue the expected value @@ -498,7 +498,7 @@ * @since 9 */ public final boolean weakCompareAndSetVolatile(int i, long expectedValue, long newValue) { - return AA.weakCompareAndSetVolatile(array, i, expectedValue, newValue); + return AA.weakCompareAndSet(array, i, expectedValue, newValue); } /** diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReference.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReference.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReference.java Fri Sep 02 02:41:37 2016 +0000 @@ -125,14 +125,14 @@ /** * Possibly atomically sets the value to {@code newValue} * if the current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param expectedValue the expected value * @param newValue the new value * @return {@code true} if successful */ public final boolean weakCompareAndSet(V expectedValue, V newValue) { - return VALUE.weakCompareAndSet(this, expectedValue, newValue); + return VALUE.weakCompareAndSetPlain(this, expectedValue, newValue); } /** @@ -370,7 +370,7 @@ * Possibly atomically sets the value to {@code newValue} * if the current value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param expectedValue the expected value * @param newValue the new value @@ -378,7 +378,7 @@ * @since 9 */ public final boolean weakCompareAndSetVolatile(V expectedValue, V newValue) { - return VALUE.weakCompareAndSetVolatile(this, expectedValue, newValue); + return VALUE.weakCompareAndSet(this, expectedValue, newValue); } /** diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceArray.java Fri Sep 02 02:41:37 2016 +0000 @@ -155,7 +155,7 @@ /** * Possibly atomically sets the element at index {@code i} to * {@code newValue} if the element's current value {@code == expectedValue}, - * with memory effects as specified by {@link VarHandle#weakCompareAndSet}. + * with memory effects as specified by {@link VarHandle#weakCompareAndSetPlain}. * * @param i the index * @param expectedValue the expected value @@ -163,7 +163,7 @@ * @return {@code true} if successful */ public final boolean weakCompareAndSet(int i, E expectedValue, E newValue) { - return AA.weakCompareAndSet(array, i, expectedValue, newValue); + return AA.weakCompareAndSetPlain(array, i, expectedValue, newValue); } /** @@ -451,7 +451,7 @@ * Possibly atomically sets the element at index {@code i} to * {@code newValue} if the element's current value {@code == expectedValue}, * with memory effects as specified by - * {@link VarHandle#weakCompareAndSetVolatile}. + * {@link VarHandle#weakCompareAndSet}. * * @param i the index * @param expectedValue the expected value @@ -460,7 +460,7 @@ * @since 9 */ public final boolean weakCompareAndSetVolatile(int i, E expectedValue, E newValue) { - return AA.weakCompareAndSetVolatile(array, i, expectedValue, newValue); + return AA.weakCompareAndSet(array, i, expectedValue, newValue); } /** diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java --- a/jdk/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/java/util/concurrent/locks/StampedLock.java Fri Sep 02 02:41:37 2016 +0000 @@ -1123,14 +1123,14 @@ } else if ((p = wtail) == null) { // initialize queue WNode hd = new WNode(WMODE, null); - if (WHEAD.weakCompareAndSetVolatile(this, null, hd)) + if (WHEAD.weakCompareAndSet(this, null, hd)) wtail = hd; } else if (node == null) node = new WNode(WMODE, p); else if (node.prev != p) node.prev = p; - else if (WTAIL.weakCompareAndSetVolatile(this, p, node)) { + else if (WTAIL.weakCompareAndSet(this, p, node)) { p.next = node; break; } @@ -1162,7 +1162,7 @@ else if (h != null) { // help release stale waiters WNode c; Thread w; while ((c = h.cowait) != null) { - if (WCOWAIT.weakCompareAndSetVolatile(h, c, c.cowait) && + if (WCOWAIT.weakCompareAndSet(h, c, c.cowait) && (w = c.thread) != null) LockSupport.unpark(w); } @@ -1247,7 +1247,7 @@ } if (p == null) { // initialize queue WNode hd = new WNode(WMODE, null); - if (WHEAD.weakCompareAndSetVolatile(this, null, hd)) + if (WHEAD.weakCompareAndSet(this, null, hd)) wtail = hd; } else if (node == null) @@ -1255,7 +1255,7 @@ else if (h == p || p.mode != RMODE) { if (node.prev != p) node.prev = p; - else if (WTAIL.weakCompareAndSetVolatile(this, p, node)) { + else if (WTAIL.weakCompareAndSet(this, p, node)) { p.next = node; break; } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/jdk/internal/misc/JavaNetSocketAccess.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaNetSocketAccess.java Fri Sep 02 02:41:37 2016 +0000 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2016, 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 jdk.internal.misc; + +import java.net.ServerSocket; +import java.net.SocketImpl; + +public interface JavaNetSocketAccess { + /** + * Creates a ServerSocket associated with the given SocketImpl. + */ + ServerSocket newServerSocket(SocketImpl impl); + + /* + * Constructs a SocketImpl instance of the given class. + */ + SocketImpl newSocketImpl(Class implClass); +} diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java --- a/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/SharedSecrets.java Fri Sep 02 02:41:37 2016 +0000 @@ -55,6 +55,7 @@ private static JavaNetAccess javaNetAccess; private static JavaNetInetAddressAccess javaNetInetAddressAccess; private static JavaNetHttpCookieAccess javaNetHttpCookieAccess; + private static JavaNetSocketAccess javaNetSocketAccess; private static JavaNioAccess javaNioAccess; private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess; private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess; @@ -161,6 +162,16 @@ return javaNetHttpCookieAccess; } + public static void setJavaNetSocketAccess(JavaNetSocketAccess jnsa) { + javaNetSocketAccess = jnsa; + } + + public static JavaNetSocketAccess getJavaNetSocketAccess() { + if (javaNetSocketAccess == null) + unsafe.ensureClassInitialized(java.net.ServerSocket.class); + return javaNetSocketAccess; + } + public static void setJavaNioAccess(JavaNioAccess jna) { javaNioAccess = jna; } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java --- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java Fri Sep 02 02:41:37 2016 +0000 @@ -2278,6 +2278,24 @@ return v; } + @ForceInline + public final int getAndAddIntRelease(Object o, long offset, int delta) { + int v; + do { + v = getInt(o, offset); + } while (!weakCompareAndSwapIntRelease(o, offset, v, v + delta)); + return v; + } + + @ForceInline + public final int getAndAddIntAcquire(Object o, long offset, int delta) { + int v; + do { + v = getIntAcquire(o, offset); + } while (!weakCompareAndSwapIntAcquire(o, offset, v, v + delta)); + return v; + } + /** * Atomically adds the given value to the current value of a field * or array element within the given object {@code o} @@ -2298,6 +2316,24 @@ return v; } + @ForceInline + public final long getAndAddLongRelease(Object o, long offset, long delta) { + long v; + do { + v = getLong(o, offset); + } while (!weakCompareAndSwapLongRelease(o, offset, v, v + delta)); + return v; + } + + @ForceInline + public final long getAndAddLongAcquire(Object o, long offset, long delta) { + long v; + do { + v = getLongAcquire(o, offset); + } while (!weakCompareAndSwapLongAcquire(o, offset, v, v + delta)); + return v; + } + @HotSpotIntrinsicCandidate public final byte getAndAddByte(Object o, long offset, byte delta) { byte v; @@ -2307,6 +2343,24 @@ return v; } + @ForceInline + public final byte getAndAddByteRelease(Object o, long offset, byte delta) { + byte v; + do { + v = getByte(o, offset); + } while (!weakCompareAndSwapByteRelease(o, offset, v, (byte) (v + delta))); + return v; + } + + @ForceInline + public final byte getAndAddByteAcquire(Object o, long offset, byte delta) { + byte v; + do { + v = getByteAcquire(o, offset); + } while (!weakCompareAndSwapByteAcquire(o, offset, v, (byte) (v + delta))); + return v; + } + @HotSpotIntrinsicCandidate public final short getAndAddShort(Object o, long offset, short delta) { short v; @@ -2317,11 +2371,39 @@ } @ForceInline + public final short getAndAddShortRelease(Object o, long offset, short delta) { + short v; + do { + v = getShort(o, offset); + } while (!weakCompareAndSwapShortRelease(o, offset, v, (short) (v + delta))); + return v; + } + + @ForceInline + public final short getAndAddShortAcquire(Object o, long offset, short delta) { + short v; + do { + v = getShortAcquire(o, offset); + } while (!weakCompareAndSwapShortAcquire(o, offset, v, (short) (v + delta))); + return v; + } + + @ForceInline public final char getAndAddChar(Object o, long offset, char delta) { return (char) getAndAddShort(o, offset, (short) delta); } @ForceInline + public final char getAndAddCharRelease(Object o, long offset, char delta) { + return (char) getAndAddShortRelease(o, offset, (short) delta); + } + + @ForceInline + public final char getAndAddCharAcquire(Object o, long offset, char delta) { + return (char) getAndAddShortAcquire(o, offset, (short) delta); + } + + @ForceInline public final float getAndAddFloat(Object o, long offset, float delta) { int expectedBits; float v; @@ -2337,6 +2419,36 @@ } @ForceInline + public final float getAndAddFloatRelease(Object o, long offset, float delta) { + int expectedBits; + float v; + do { + // Load and CAS with the raw bits to avoid issues with NaNs and + // possible bit conversion from signaling NaNs to quiet NaNs that + // may result in the loop not terminating. + expectedBits = getInt(o, offset); + v = Float.intBitsToFloat(expectedBits); + } while (!weakCompareAndSwapIntRelease(o, offset, + expectedBits, Float.floatToRawIntBits(v + delta))); + return v; + } + + @ForceInline + public final float getAndAddFloatAcquire(Object o, long offset, float delta) { + int expectedBits; + float v; + do { + // Load and CAS with the raw bits to avoid issues with NaNs and + // possible bit conversion from signaling NaNs to quiet NaNs that + // may result in the loop not terminating. + expectedBits = getIntAcquire(o, offset); + v = Float.intBitsToFloat(expectedBits); + } while (!weakCompareAndSwapIntAcquire(o, offset, + expectedBits, Float.floatToRawIntBits(v + delta))); + return v; + } + + @ForceInline public final double getAndAddDouble(Object o, long offset, double delta) { long expectedBits; double v; @@ -2351,6 +2463,36 @@ return v; } + @ForceInline + public final double getAndAddDoubleRelease(Object o, long offset, double delta) { + long expectedBits; + double v; + do { + // Load and CAS with the raw bits to avoid issues with NaNs and + // possible bit conversion from signaling NaNs to quiet NaNs that + // may result in the loop not terminating. + expectedBits = getLong(o, offset); + v = Double.longBitsToDouble(expectedBits); + } while (!weakCompareAndSwapLongRelease(o, offset, + expectedBits, Double.doubleToRawLongBits(v + delta))); + return v; + } + + @ForceInline + public final double getAndAddDoubleAcquire(Object o, long offset, double delta) { + long expectedBits; + double v; + do { + // Load and CAS with the raw bits to avoid issues with NaNs and + // possible bit conversion from signaling NaNs to quiet NaNs that + // may result in the loop not terminating. + expectedBits = getLongAcquire(o, offset); + v = Double.longBitsToDouble(expectedBits); + } while (!weakCompareAndSwapLongAcquire(o, offset, + expectedBits, Double.doubleToRawLongBits(v + delta))); + return v; + } + /** * Atomically exchanges the given value with the current value of * a field or array element within the given object {@code o} @@ -2371,6 +2513,24 @@ return v; } + @ForceInline + public final int getAndSetIntRelease(Object o, long offset, int newValue) { + int v; + do { + v = getInt(o, offset); + } while (!weakCompareAndSwapIntRelease(o, offset, v, newValue)); + return v; + } + + @ForceInline + public final int getAndSetIntAcquire(Object o, long offset, int newValue) { + int v; + do { + v = getIntAcquire(o, offset); + } while (!weakCompareAndSwapIntAcquire(o, offset, v, newValue)); + return v; + } + /** * Atomically exchanges the given value with the current value of * a field or array element within the given object {@code o} @@ -2391,6 +2551,24 @@ return v; } + @ForceInline + public final long getAndSetLongRelease(Object o, long offset, long newValue) { + long v; + do { + v = getLong(o, offset); + } while (!weakCompareAndSwapLongRelease(o, offset, v, newValue)); + return v; + } + + @ForceInline + public final long getAndSetLongAcquire(Object o, long offset, long newValue) { + long v; + do { + v = getLongAcquire(o, offset); + } while (!weakCompareAndSwapLongAcquire(o, offset, v, newValue)); + return v; + } + /** * Atomically exchanges the given reference value with the current * reference value of a field or array element within the given @@ -2411,6 +2589,24 @@ return v; } + @ForceInline + public final Object getAndSetObjectRelease(Object o, long offset, Object newValue) { + Object v; + do { + v = getObject(o, offset); + } while (!weakCompareAndSwapObjectRelease(o, offset, v, newValue)); + return v; + } + + @ForceInline + public final Object getAndSetObjectAcquire(Object o, long offset, Object newValue) { + Object v; + do { + v = getObjectAcquire(o, offset); + } while (!weakCompareAndSwapObjectAcquire(o, offset, v, newValue)); + return v; + } + @HotSpotIntrinsicCandidate public final byte getAndSetByte(Object o, long offset, byte newValue) { byte v; @@ -2421,10 +2617,38 @@ } @ForceInline + public final byte getAndSetByteRelease(Object o, long offset, byte newValue) { + byte v; + do { + v = getByte(o, offset); + } while (!weakCompareAndSwapByteRelease(o, offset, v, newValue)); + return v; + } + + @ForceInline + public final byte getAndSetByteAcquire(Object o, long offset, byte newValue) { + byte v; + do { + v = getByteAcquire(o, offset); + } while (!weakCompareAndSwapByteAcquire(o, offset, v, newValue)); + return v; + } + + @ForceInline public final boolean getAndSetBoolean(Object o, long offset, boolean newValue) { return byte2bool(getAndSetByte(o, offset, bool2byte(newValue))); } + @ForceInline + public final boolean getAndSetBooleanRelease(Object o, long offset, boolean newValue) { + return byte2bool(getAndSetByteRelease(o, offset, bool2byte(newValue))); + } + + @ForceInline + public final boolean getAndSetBooleanAcquire(Object o, long offset, boolean newValue) { + return byte2bool(getAndSetByteAcquire(o, offset, bool2byte(newValue))); + } + @HotSpotIntrinsicCandidate public final short getAndSetShort(Object o, long offset, short newValue) { short v; @@ -2435,22 +2659,558 @@ } @ForceInline + public final short getAndSetShortRelease(Object o, long offset, short newValue) { + short v; + do { + v = getShort(o, offset); + } while (!weakCompareAndSwapShortRelease(o, offset, v, newValue)); + return v; + } + + @ForceInline + public final short getAndSetShortAcquire(Object o, long offset, short newValue) { + short v; + do { + v = getShortAcquire(o, offset); + } while (!weakCompareAndSwapShortAcquire(o, offset, v, newValue)); + return v; + } + + @ForceInline public final char getAndSetChar(Object o, long offset, char newValue) { return s2c(getAndSetShort(o, offset, c2s(newValue))); } @ForceInline + public final char getAndSetCharRelease(Object o, long offset, char newValue) { + return s2c(getAndSetShortRelease(o, offset, c2s(newValue))); + } + + @ForceInline + public final char getAndSetCharAcquire(Object o, long offset, char newValue) { + return s2c(getAndSetShortAcquire(o, offset, c2s(newValue))); + } + + @ForceInline public final float getAndSetFloat(Object o, long offset, float newValue) { int v = getAndSetInt(o, offset, Float.floatToRawIntBits(newValue)); return Float.intBitsToFloat(v); } @ForceInline + public final float getAndSetFloatRelease(Object o, long offset, float newValue) { + int v = getAndSetIntRelease(o, offset, Float.floatToRawIntBits(newValue)); + return Float.intBitsToFloat(v); + } + + @ForceInline + public final float getAndSetFloatAcquire(Object o, long offset, float newValue) { + int v = getAndSetIntAcquire(o, offset, Float.floatToRawIntBits(newValue)); + return Float.intBitsToFloat(v); + } + + @ForceInline public final double getAndSetDouble(Object o, long offset, double newValue) { long v = getAndSetLong(o, offset, Double.doubleToRawLongBits(newValue)); return Double.longBitsToDouble(v); } + @ForceInline + public final double getAndSetDoubleRelease(Object o, long offset, double newValue) { + long v = getAndSetLongRelease(o, offset, Double.doubleToRawLongBits(newValue)); + return Double.longBitsToDouble(v); + } + + @ForceInline + public final double getAndSetDoubleAcquire(Object o, long offset, double newValue) { + long v = getAndSetLongAcquire(o, offset, Double.doubleToRawLongBits(newValue)); + return Double.longBitsToDouble(v); + } + + + // The following contain CAS-based Java implementations used on + // platforms not supporting native instructions + + @ForceInline + public final boolean getAndBitwiseOrBoolean(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseOrByte(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseOrBooleanRelease(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseOrByteRelease(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseOrBooleanAcquire(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseOrByteAcquire(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseAndBoolean(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseAndByte(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseAndBooleanRelease(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseAndByteRelease(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseAndBooleanAcquire(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseAndByteAcquire(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseXorBoolean(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseXorByte(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseXorBooleanRelease(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseXorByteRelease(o, offset, bool2byte(mask))); + } + + @ForceInline + public final boolean getAndBitwiseXorBooleanAcquire(Object o, long offset, boolean mask) { + return byte2bool(getAndBitwiseXorByteAcquire(o, offset, bool2byte(mask))); + } + + + @ForceInline + public final byte getAndBitwiseOrByte(Object o, long offset, byte mask) { + byte current; + do { + current = getByteVolatile(o, offset); + } while (!weakCompareAndSwapByteVolatile(o, offset, + current, (byte) (current | mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseOrByteRelease(Object o, long offset, byte mask) { + byte current; + do { + current = getByte(o, offset); + } while (!weakCompareAndSwapByteRelease(o, offset, + current, (byte) (current | mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseOrByteAcquire(Object o, long offset, byte mask) { + byte current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getByte(o, offset); + } while (!weakCompareAndSwapByteAcquire(o, offset, + current, (byte) (current | mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseAndByte(Object o, long offset, byte mask) { + byte current; + do { + current = getByteVolatile(o, offset); + } while (!weakCompareAndSwapByteVolatile(o, offset, + current, (byte) (current & mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseAndByteRelease(Object o, long offset, byte mask) { + byte current; + do { + current = getByte(o, offset); + } while (!weakCompareAndSwapByteRelease(o, offset, + current, (byte) (current & mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseAndByteAcquire(Object o, long offset, byte mask) { + byte current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getByte(o, offset); + } while (!weakCompareAndSwapByteAcquire(o, offset, + current, (byte) (current & mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseXorByte(Object o, long offset, byte mask) { + byte current; + do { + current = getByteVolatile(o, offset); + } while (!weakCompareAndSwapByteVolatile(o, offset, + current, (byte) (current ^ mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseXorByteRelease(Object o, long offset, byte mask) { + byte current; + do { + current = getByte(o, offset); + } while (!weakCompareAndSwapByteRelease(o, offset, + current, (byte) (current ^ mask))); + return current; + } + + @ForceInline + public final byte getAndBitwiseXorByteAcquire(Object o, long offset, byte mask) { + byte current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getByte(o, offset); + } while (!weakCompareAndSwapByteAcquire(o, offset, + current, (byte) (current ^ mask))); + return current; + } + + + @ForceInline + public final char getAndBitwiseOrChar(Object o, long offset, char mask) { + return s2c(getAndBitwiseOrShort(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseOrCharRelease(Object o, long offset, char mask) { + return s2c(getAndBitwiseOrShortRelease(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseOrCharAcquire(Object o, long offset, char mask) { + return s2c(getAndBitwiseOrShortAcquire(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseAndChar(Object o, long offset, char mask) { + return s2c(getAndBitwiseAndShort(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseAndCharRelease(Object o, long offset, char mask) { + return s2c(getAndBitwiseAndShortRelease(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseAndCharAcquire(Object o, long offset, char mask) { + return s2c(getAndBitwiseAndShortAcquire(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseXorChar(Object o, long offset, char mask) { + return s2c(getAndBitwiseXorShort(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseXorCharRelease(Object o, long offset, char mask) { + return s2c(getAndBitwiseXorShortRelease(o, offset, c2s(mask))); + } + + @ForceInline + public final char getAndBitwiseXorCharAcquire(Object o, long offset, char mask) { + return s2c(getAndBitwiseXorShortAcquire(o, offset, c2s(mask))); + } + + + @ForceInline + public final short getAndBitwiseOrShort(Object o, long offset, short mask) { + short current; + do { + current = getShortVolatile(o, offset); + } while (!weakCompareAndSwapShortVolatile(o, offset, + current, (short) (current | mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseOrShortRelease(Object o, long offset, short mask) { + short current; + do { + current = getShort(o, offset); + } while (!weakCompareAndSwapShortRelease(o, offset, + current, (short) (current | mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseOrShortAcquire(Object o, long offset, short mask) { + short current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getShort(o, offset); + } while (!weakCompareAndSwapShortAcquire(o, offset, + current, (short) (current | mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseAndShort(Object o, long offset, short mask) { + short current; + do { + current = getShortVolatile(o, offset); + } while (!weakCompareAndSwapShortVolatile(o, offset, + current, (short) (current & mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseAndShortRelease(Object o, long offset, short mask) { + short current; + do { + current = getShort(o, offset); + } while (!weakCompareAndSwapShortRelease(o, offset, + current, (short) (current & mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseAndShortAcquire(Object o, long offset, short mask) { + short current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getShort(o, offset); + } while (!weakCompareAndSwapShortAcquire(o, offset, + current, (short) (current & mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseXorShort(Object o, long offset, short mask) { + short current; + do { + current = getShortVolatile(o, offset); + } while (!weakCompareAndSwapShortVolatile(o, offset, + current, (short) (current ^ mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseXorShortRelease(Object o, long offset, short mask) { + short current; + do { + current = getShort(o, offset); + } while (!weakCompareAndSwapShortRelease(o, offset, + current, (short) (current ^ mask))); + return current; + } + + @ForceInline + public final short getAndBitwiseXorShortAcquire(Object o, long offset, short mask) { + short current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getShort(o, offset); + } while (!weakCompareAndSwapShortAcquire(o, offset, + current, (short) (current ^ mask))); + return current; + } + + + @ForceInline + public final int getAndBitwiseOrInt(Object o, long offset, int mask) { + int current; + do { + current = getIntVolatile(o, offset); + } while (!weakCompareAndSwapIntVolatile(o, offset, + current, current | mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseOrIntRelease(Object o, long offset, int mask) { + int current; + do { + current = getInt(o, offset); + } while (!weakCompareAndSwapIntRelease(o, offset, + current, current | mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseOrIntAcquire(Object o, long offset, int mask) { + int current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getInt(o, offset); + } while (!weakCompareAndSwapIntAcquire(o, offset, + current, current | mask)); + return current; + } + + /** + * Atomically replaces the current value of a field or array element within + * the given object with the result of bitwise AND between the current value + * and mask. + * + * @param o object/array to update the field/element in + * @param offset field/element offset + * @param mask the mask value + * @return the previous value + * @since 1.9 + */ + @ForceInline + public final int getAndBitwiseAndInt(Object o, long offset, int mask) { + int current; + do { + current = getIntVolatile(o, offset); + } while (!weakCompareAndSwapIntVolatile(o, offset, + current, current & mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseAndIntRelease(Object o, long offset, int mask) { + int current; + do { + current = getInt(o, offset); + } while (!weakCompareAndSwapIntRelease(o, offset, + current, current & mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseAndIntAcquire(Object o, long offset, int mask) { + int current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getInt(o, offset); + } while (!weakCompareAndSwapIntAcquire(o, offset, + current, current & mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseXorInt(Object o, long offset, int mask) { + int current; + do { + current = getIntVolatile(o, offset); + } while (!weakCompareAndSwapIntVolatile(o, offset, + current, current ^ mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseXorIntRelease(Object o, long offset, int mask) { + int current; + do { + current = getInt(o, offset); + } while (!weakCompareAndSwapIntRelease(o, offset, + current, current ^ mask)); + return current; + } + + @ForceInline + public final int getAndBitwiseXorIntAcquire(Object o, long offset, int mask) { + int current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getInt(o, offset); + } while (!weakCompareAndSwapIntAcquire(o, offset, + current, current ^ mask)); + return current; + } + + + @ForceInline + public final long getAndBitwiseOrLong(Object o, long offset, long mask) { + long current; + do { + current = getLongVolatile(o, offset); + } while (!weakCompareAndSwapLongVolatile(o, offset, + current, current | mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseOrLongRelease(Object o, long offset, long mask) { + long current; + do { + current = getLong(o, offset); + } while (!weakCompareAndSwapLongRelease(o, offset, + current, current | mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseOrLongAcquire(Object o, long offset, long mask) { + long current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getLong(o, offset); + } while (!weakCompareAndSwapLongAcquire(o, offset, + current, current | mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseAndLong(Object o, long offset, long mask) { + long current; + do { + current = getLongVolatile(o, offset); + } while (!weakCompareAndSwapLongVolatile(o, offset, + current, current & mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseAndLongRelease(Object o, long offset, long mask) { + long current; + do { + current = getLong(o, offset); + } while (!weakCompareAndSwapLongRelease(o, offset, + current, current & mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseAndLongAcquire(Object o, long offset, long mask) { + long current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getLong(o, offset); + } while (!weakCompareAndSwapLongAcquire(o, offset, + current, current & mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseXorLong(Object o, long offset, long mask) { + long current; + do { + current = getLongVolatile(o, offset); + } while (!weakCompareAndSwapLongVolatile(o, offset, + current, current ^ mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseXorLongRelease(Object o, long offset, long mask) { + long current; + do { + current = getLong(o, offset); + } while (!weakCompareAndSwapLongRelease(o, offset, + current, current ^ mask)); + return current; + } + + @ForceInline + public final long getAndBitwiseXorLongAcquire(Object o, long offset, long mask) { + long current; + do { + // Plain read, the value is a hint, the acquire CAS does the work + current = getLong(o, offset); + } while (!weakCompareAndSwapLongAcquire(o, offset, + current, current ^ mask)); + return current; + } + + + /** * Ensures that loads before the fence will not be reordered with loads and * stores after the fence; a "LoadLoad plus LoadStore barrier". diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java --- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Fri Sep 02 02:41:37 2016 +0000 @@ -1496,7 +1496,7 @@ } } catch (CertPathValidatorException cpve) { throw new CertificateException( - "Certificates does not conform to algorithm constraints"); + "Certificates do not conform to algorithm constraints", cpve); } } } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/native/libjli/java.c --- a/jdk/src/java.base/share/native/libjli/java.c Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/native/libjli/java.c Fri Sep 02 02:41:37 2016 +0000 @@ -556,20 +556,6 @@ JLI_StrCmp(name, "--list-modules") == 0; } -#ifndef OLD_MODULE_OPTIONS -/* - * Old module options for transition - */ -static jboolean -IsOldModuleOption(const char* name) { - return JLI_StrCmp(name, "-modulepath") == 0 || - JLI_StrCmp(name, "-mp") == 0 || - JLI_StrCmp(name, "-upgrademodulepath") == 0 || - JLI_StrCmp(name, "-addmods") == 0 || - JLI_StrCmp(name, "-limitmods") == 0; -} -#endif - /* * Test if the given name is a module-system white-space option that * will be passed to the VM with its corresponding long-form option @@ -584,8 +570,7 @@ JLI_StrCmp(name, "--limit-modules") == 0 || JLI_StrCmp(name, "--add-exports") == 0 || JLI_StrCmp(name, "--add-reads") == 0 || - JLI_StrCmp(name, "--patch-module") == 0 || - IsOldModuleOption(name); + JLI_StrCmp(name, "--patch-module") == 0; } /* @@ -1224,32 +1209,6 @@ } } -#ifndef OLD_MODULE_OPTIONS - // for transition to support both old and new syntax - if (JLI_StrCmp(arg, "-modulepath") == 0 || - JLI_StrCmp(arg, "-mp") == 0) { - option = "--module-path"; - } else if (JLI_StrCmp(arg, "-upgrademodulepath") == 0) { - option = "--upgrade-module-path"; - } else if (JLI_StrCmp(arg, "-addmods") == 0) { - option = "--add-modules"; - } else if (JLI_StrCmp(arg, "-limitmods") == 0) { - option = "--limit-modules"; - } else if (JLI_StrCCmp(arg, "-XaddExports:") == 0) { - option = "--add-exports"; - value = arg + 13; - kind = VM_LONG_OPTION_WITH_ARGUMENT; - } else if (JLI_StrCCmp(arg, "-XaddReads:") == 0) { - option = "--add-reads"; - value = arg + 11; - kind = VM_LONG_OPTION_WITH_ARGUMENT; - } else if (JLI_StrCCmp(arg, "-Xpatch:") == 0) { - option = "--patch-module"; - value = arg + 8; - kind = VM_LONG_OPTION_WITH_ARGUMENT; - } -#endif - *pargc = argc; *pargv = argv; *poption = option; @@ -1340,16 +1299,6 @@ JLI_StrCmp(arg, "--patch-module") == 0) { REPORT_ERROR (has_arg, ARG_ERROR6, arg); } -#ifndef OLD_MODULE_OPTIONS - else if (JLI_StrCmp(arg, "-modulepath") == 0 || - JLI_StrCmp(arg, "-mp") == 0 || - JLI_StrCmp(arg, "-upgrademodulepath") == 0) { - REPORT_ERROR (has_arg, ARG_ERROR4, arg); - } else if (JLI_StrCmp(arg, "-addmods") == 0 || - JLI_StrCmp(arg, "-limitmods") == 0) { - REPORT_ERROR (has_arg, ARG_ERROR6, arg); - } -#endif /* * The following cases will cause the argument parsing to stop */ @@ -1548,6 +1497,7 @@ NULL_CHECK0(cls = FindBootStrapClass(env, "java/lang/String")); NULL_CHECK0(ary = (*env)->NewObjectArray(env, strc, cls, 0)); + CHECK_EXCEPTION_RETURN_VALUE(0); for (i = 0; i < strc; i++) { jstring str = NewPlatformString(env, *strv++); NULL_CHECK0(str); diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.base/share/native/libjli/java.h --- a/jdk/src/java.base/share/native/libjli/java.h Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.base/share/native/libjli/java.h Fri Sep 02 02:41:37 2016 +0000 @@ -253,6 +253,13 @@ #define NULL_CHECK(NC_check_pointer) \ NULL_CHECK_RETURN_VALUE(NC_check_pointer, ) +#define CHECK_EXCEPTION_RETURN_VALUE(CER_value) \ + do { \ + if ((*env)->ExceptionOccurred(env)) { \ + return CER_value; \ + } \ + } while (JNI_FALSE) + #define CHECK_EXCEPTION_RETURN() \ do { \ if ((*env)->ExceptionOccurred(env)) { \ diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIConstants.java --- a/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIConstants.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/classes/apple/laf/JRSUIConstants.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,7 +25,6 @@ package apple.laf; -import java.lang.reflect.Field; import java.nio.ByteBuffer; import java.lang.annotation.Native; @@ -70,6 +69,21 @@ throw new RuntimeException("Constant not implemented in native: " + this); } + private String getConstantName(Key hit) { + if (hit == VALUE) { + return "VALUE"; + } else if (hit == THUMB_PROPORTION) { + return "THUMB_PROPORTION"; + } else if (hit == THUMB_START) { + return "THUMB_START"; + } else if (hit == WINDOW_TITLE_BAR_HEIGHT) { + return "WINDOW_TITLE_BAR_HEIGHT"; + } else if (hit == THUMB_START) { + return "ANIMATION_FRAME"; + } + return getClass().getSimpleName(); + } + public String toString() { return getConstantName(this) + (ptr == 0 ? "(unlinked)" : ""); } @@ -138,7 +152,7 @@ } public String toString() { - return getConstantName(this); + return getClass().getSimpleName(); } } @@ -779,6 +793,17 @@ return hit > 0; } + private String getConstantName(Hit hit) { + if (hit == UNKNOWN) { + return "UNKNOWN"; + } else if (hit == NONE) { + return "NONE"; + } else if (hit == HIT) { + return "HIT"; + } + return getClass().getSimpleName(); + } + public String toString() { return getConstantName(this); } @@ -829,16 +854,4 @@ } return Hit.UNKNOWN; } - - static String getConstantName(final Object object) { - final Class clazz = object.getClass(); - try { - for (final Field field : clazz.getFields()) { - if (field.get(null) == object) { - return field.getName(); - } - } - } catch (final Exception e) {} - return clazz.getSimpleName(); - } } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java --- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppDockIconHandler.java Fri Sep 02 02:41:37 2016 +0000 @@ -72,7 +72,7 @@ public void setDockIconImage(final Image image) { try { - final CImage cImage = getCImageCreator().createFromImage(image); + final CImage cImage = CImage.createFromImage(image); final long nsImagePtr = getNSImagePtrFrom(cImage); nativeSetDockIconImage(nsImagePtr); } catch (final Throwable e) { @@ -84,7 +84,11 @@ try { final long dockNSImage = nativeGetDockIconImage(); if (dockNSImage == 0) return null; - return getCImageCreator().createImageUsingNativeSize(dockNSImage); + final Method getCreatorMethod = CImage.class.getDeclaredMethod( + "getCreator", new Class[]{}); + getCreatorMethod.setAccessible(true); + Creator imageCreator = (Creator) getCreatorMethod.invoke(null, new Object[]{}); + return imageCreator.createImageUsingNativeSize(dockNSImage); } catch (final Throwable e) { throw new RuntimeException(e); } @@ -98,16 +102,6 @@ nativeSetDockIconProgress(value); } - static Creator getCImageCreator() { - try { - final Method getCreatorMethod = CImage.class.getDeclaredMethod("getCreator", new Class[] {}); - getCreatorMethod.setAccessible(true); - return (Creator)getCreatorMethod.invoke(null, new Object[] {}); - } catch (final Throwable e) { - throw new RuntimeException(e); - } - } - static long getNSImagePtrFrom(final CImage cImage) { if (cImage == null) return 0; diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppEventHandler.java --- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppEventHandler.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppEventHandler.java Fri Sep 02 02:41:37 2016 +0000 @@ -171,7 +171,8 @@ currentQuitResponse = null; try { - if (defaultQuitAction == QuitStrategy.NORMAL_EXIT) System.exit(0); + if (defaultQuitAction == QuitStrategy.NORMAL_EXIT + || _AppMiscHandlers.isSuddenTerminationEnbaled()) System.exit(0); if (defaultQuitAction != QuitStrategy.CLOSE_ALL_WINDOWS) { throw new RuntimeException("Unknown quit action"); @@ -422,6 +423,10 @@ } void performUsing(final QuitHandler handler, final _NativeEvent event) { + if (_AppMiscHandlers.isSuddenTerminationEnbaled()) { + performDefaultAction(event); + return; + } final MacQuitResponse response = obtainQuitResponse(); // obtains the "current" quit response handler.handleQuitRequestWith(new QuitEvent(), response); } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMiscHandlers.java --- a/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMiscHandlers.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/classes/com/apple/eawt/_AppMiscHandlers.java Fri Sep 02 02:41:37 2016 +0000 @@ -26,6 +26,8 @@ package com.apple.eawt; class _AppMiscHandlers { + private static boolean isSuddenTerminationEnabled; + private static native void nativeOpenHelpViewer(); private static native void nativeRequestActivation(final boolean allWindows); @@ -47,10 +49,16 @@ } static void enableSuddenTermination() { + isSuddenTerminationEnabled = true; nativeEnableSuddenTermination(); } static void disableSuddenTermination() { + isSuddenTerminationEnabled = false; nativeDisableSuddenTermination(); } + + public static boolean isSuddenTerminationEnbaled() { + return isSuddenTerminationEnabled; + } } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaIcon.java --- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaIcon.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaIcon.java Fri Sep 02 02:41:37 2016 +0000 @@ -37,6 +37,7 @@ import com.apple.laf.AquaUtilControlSize.*; import com.apple.laf.AquaUtils.RecyclableSingleton; +import sun.lwawt.macosx.CImage; public class AquaIcon { interface InvertableIcon extends Icon { @@ -226,7 +227,7 @@ } Image createImage() { - return AquaUtils.getCImageCreator().createImageOfFile(file.getAbsolutePath(), getIconWidth(), getIconHeight()); + return CImage.createImageOfFile(file.getAbsolutePath(), getIconWidth(), getIconHeight()); } } @@ -299,7 +300,7 @@ } Image createImage() { - return AquaUtils.getCImageCreator().createSystemImageFromSelector( + return CImage.createSystemImageFromSelector( selector, getIconWidth(), getIconHeight()); } } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java --- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaImageFactory.java Fri Sep 02 02:41:37 2016 +0000 @@ -46,8 +46,8 @@ import com.apple.laf.AquaIcon.SystemIcon; import com.apple.laf.AquaUtils.RecyclableObject; import com.apple.laf.AquaUtils.RecyclableSingleton; -import java.awt.image.MultiResolutionImage; import sun.awt.image.MultiResolutionCachedImage; +import sun.lwawt.macosx.CImage; public class AquaImageFactory { public static IconUIResource getConfirmImageIcon() { @@ -73,7 +73,7 @@ public static IconUIResource getLockImageIcon() { // public, because UIDefaults.ProxyLazyValue uses reflection to get this value if (JRSUIUtils.Images.shouldUseLegacySecurityUIPath()) { - final Image lockIcon = AquaUtils.getCImageCreator().createImageFromFile("/System/Library/CoreServices/SecurityAgent.app/Contents/Resources/Security.icns", kAlertIconSize, kAlertIconSize); + final Image lockIcon = CImage.createImageFromFile("/System/Library/CoreServices/SecurityAgent.app/Contents/Resources/Security.icns", kAlertIconSize, kAlertIconSize); return getAppIconCompositedOn(lockIcon); } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtils.java --- a/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtils.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/classes/com/apple/laf/AquaUtils.java Fri Sep 02 02:41:37 2016 +0000 @@ -41,8 +41,6 @@ import sun.awt.AppContext; -import sun.lwawt.macosx.CImage; -import sun.lwawt.macosx.CImage.Creator; import sun.lwawt.macosx.CPlatformWindow; import sun.reflect.misc.ReflectUtil; import sun.security.action.GetPropertyAction; @@ -50,6 +48,7 @@ import com.apple.laf.AquaImageFactory.SlicedImageControl; import sun.awt.image.MultiResolutionCachedImage; +import sun.swing.SwingAccessor; final class AquaUtils { @@ -78,63 +77,43 @@ } } - private static Creator getCImageCreatorInternal() { - return AccessController.doPrivileged(new PrivilegedAction() { - @Override - public Creator run() { - try { - final Method getCreatorMethod = CImage.class.getDeclaredMethod( - "getCreator", new Class[] {}); - getCreatorMethod.setAccessible(true); - return (Creator)getCreatorMethod.invoke(null, new Object[] {}); - } catch (final Exception ignored) { - return null; - } - } - }); - } - - private static final RecyclableSingleton cImageCreator = new RecyclableSingleton() { - @Override - protected Creator getInstance() { - return getCImageCreatorInternal(); - } - }; - static Creator getCImageCreator() { - return cImageCreator.get(); - } - static Image generateSelectedDarkImage(final Image image) { - final ImageProducer prod = new FilteredImageSource(image.getSource(), new IconImageFilter() { + final ImageFilter filter = new IconImageFilter() { @Override int getGreyFor(final int gray) { return gray * 75 / 100; } - }); - return Toolkit.getDefaultToolkit().createImage(prod); + }; + return map(image, filter); } static Image generateDisabledImage(final Image image) { - final ImageProducer prod = new FilteredImageSource(image.getSource(), new IconImageFilter() { + final ImageFilter filter = new IconImageFilter() { @Override int getGreyFor(final int gray) { return 255 - ((255 - gray) * 65 / 100); } - }); - return Toolkit.getDefaultToolkit().createImage(prod); + }; + return map(image, filter); } static Image generateLightenedImage(final Image image, final int percent) { final GrayFilter filter = new GrayFilter(true, percent); - return (image instanceof MultiResolutionCachedImage) - ? ((MultiResolutionCachedImage) image).map( - rv -> generateLightenedImage(rv, filter)) - : generateLightenedImage(image, filter); + return map(image, filter); + } + + static Image generateFilteredImage(Image image, ImageFilter filter) { + final ImageProducer prod = new FilteredImageSource(image.getSource(), filter); + return Toolkit.getDefaultToolkit().createImage(prod); } - static Image generateLightenedImage(Image image, ImageFilter filter) { - final ImageProducer prod = new FilteredImageSource(image.getSource(), filter); - return Toolkit.getDefaultToolkit().createImage(prod); + private static Image map(Image image, ImageFilter filter) { + if (image instanceof MultiResolutionImage) { + return MultiResolutionCachedImage + .map((MultiResolutionImage) image, + (img) -> generateFilteredImage(img, filter)); + } + return generateFilteredImage(image, filter); } private abstract static class IconImageFilter extends RGBImageFilter { @@ -399,15 +378,9 @@ } }; - private static final Integer OPAQUE_SET_FLAG = 24; // private int JComponent.OPAQUE_SET + private static final int OPAQUE_SET_FLAG = 24; // private int JComponent.OPAQUE_SET static boolean hasOpaqueBeenExplicitlySet(final JComponent c) { - final Method method = getJComponentGetFlagMethod.get(); - if (method == null) return false; - try { - return Boolean.TRUE.equals(method.invoke(c, OPAQUE_SET_FLAG)); - } catch (final Throwable ignored) { - return false; - } + return SwingAccessor.getJComponentAccessor().getFlag(c, OPAQUE_SET_FLAG); } private static boolean isWindowTextured(final Component c) { diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/classes/sun/font/CFont.java --- a/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFont.java Fri Sep 02 02:41:37 2016 +0000 @@ -278,6 +278,18 @@ return getStrike(font, DEFAULT_FRC); } + public boolean equals(Object o) { + if (!super.equals(o)) { + return false; + } + + return ((Font2D)o).getStyle() == this.getStyle(); + } + + public int hashCode() { + return super.hashCode() ^ this.getStyle(); + } + public String toString() { return "CFont { fullName: " + fullName + ", familyName: " + familyName + ", style: " + style + diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessibility.java Fri Sep 02 02:41:37 2016 +0000 @@ -37,6 +37,7 @@ import javax.accessibility.*; import javax.swing.*; +import sun.awt.AWTAccessor; class CAccessibility implements PropertyChangeListener { private static Set ignoredRoles; @@ -205,33 +206,12 @@ }, c); } - static Field getAccessibleBundleKeyFieldWithReflection() { - try { - final Field fieldKey = AccessibleBundle.class.getDeclaredField("key"); - fieldKey.setAccessible(true); - return fieldKey; - } catch (final SecurityException e) { - e.printStackTrace(); - } catch (final NoSuchFieldException e) { - e.printStackTrace(); - } - return null; - } - private static final Field FIELD_KEY = getAccessibleBundleKeyFieldWithReflection(); - static String getAccessibleRoleFor(final Accessible a) { final AccessibleContext ac = a.getAccessibleContext(); if (ac == null) return null; final AccessibleRole role = ac.getAccessibleRole(); - try { - return (String)FIELD_KEY.get(role); - } catch (final IllegalArgumentException e) { - e.printStackTrace(); - } catch (final IllegalAccessException e) { - e.printStackTrace(); - } - return null; + return AWTAccessor.getAccessibleBundleAccessor().getKey(role); } public static String getAccessibleRole(final Accessible a, final Component c) { diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java Fri Sep 02 02:41:37 2016 +0000 @@ -28,7 +28,6 @@ import java.awt.Component; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; -import java.lang.reflect.Field; import javax.accessibility.Accessible; import javax.accessibility.AccessibleContext; @@ -41,36 +40,23 @@ import static javax.accessibility.AccessibleContext.ACCESSIBLE_CARET_PROPERTY; import static javax.accessibility.AccessibleContext.ACCESSIBLE_SELECTION_PROPERTY; import static javax.accessibility.AccessibleContext.ACCESSIBLE_TEXT_PROPERTY; +import sun.awt.AWTAccessor; class CAccessible extends CFRetainedResource implements Accessible { - static Field getNativeAXResourceField() { - try { - final Field field = AccessibleContext.class.getDeclaredField("nativeAXResource"); - field.setAccessible(true); - return field; - } catch (final Exception e) { - e.printStackTrace(); - return null; - } - } - - private static Field nativeAXResourceField = getNativeAXResourceField(); public static CAccessible getCAccessible(final Accessible a) { if (a == null) return null; AccessibleContext context = a.getAccessibleContext(); - try { - final CAccessible cachedCAX = (CAccessible) nativeAXResourceField.get(context); - if (cachedCAX != null) return cachedCAX; - - final CAccessible newCAX = new CAccessible(a); - nativeAXResourceField.set(context, newCAX); - return newCAX; - } catch (final Exception e) { - e.printStackTrace(); - return null; + AWTAccessor.AccessibleContextAccessor accessor + = AWTAccessor.getAccessibleContextAccessor(); + final CAccessible cachedCAX = (CAccessible) accessor.getNativeAXResource(context); + if (cachedCAX != null) { + return cachedCAX; } + final CAccessible newCAX = new CAccessible(a); + accessor.setNativeAXResource(context, newCAX); + return newCAX; } private static native void unregisterFromCocoaAXSystem(long ptr); diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CDataTransferer.java Fri Sep 02 02:41:37 2016 +0000 @@ -36,7 +36,7 @@ import java.text.Normalizer; import java.text.Normalizer.Form; import java.util.*; - +import java.util.regex.*; import java.awt.datatransfer.*; import sun.awt.datatransfer.*; @@ -129,12 +129,21 @@ long format, Transferable transferable) throws IOException { if (format == CF_URL && URL.class.equals(flavor.getRepresentationClass())) { - String[] strings = dragQueryFile(bytes); - if(strings == null || strings.length == 0) { - return null; + String charset = Charset.defaultCharset().name(); + if (transferable != null && transferable.isDataFlavorSupported(javaTextEncodingFlavor)) { + try { + charset = new String((byte[]) transferable.getTransferData(javaTextEncodingFlavor), "UTF-8"); + } catch (UnsupportedFlavorException cannotHappen) { + } } - return new URL(strings[0]); - } else if(isUriListFlavor(flavor)) { + + String xml = new String(bytes, charset); + // macosx pasteboard returns a property list that consists of one URL + // let's extract it. + return new URL(extractURL(xml)); + } + + if(isUriListFlavor(flavor) && format == CF_FILE) { // dragQueryFile works fine with files and url, // it parses and extracts values from property list. // maxosx always returns property list for @@ -156,6 +165,16 @@ return super.translateBytes(bytes, flavor, format, transferable); } + private String extractURL(String xml) { + Pattern urlExtractorPattern = Pattern.compile("(.*)"); + Matcher matcher = urlExtractorPattern.matcher(xml); + if (matcher.find()) { + return matcher.group(1); + } else { + return null; + } + } + @Override protected synchronized Long getFormatForNativeAsLong(String str) { Long format = predefinedClipboardNameMap.get(str); diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java --- a/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/classes/sun/lwawt/macosx/CImage.java Fri Sep 02 02:41:37 2016 +0000 @@ -56,6 +56,25 @@ return creator; } + // This is used to create a CImage that represents the icon of the given file. + public static Image createImageOfFile(String file, int width, int height) { + return getCreator().createImageOfFile(file, width, height); + } + + public static Image createSystemImageFromSelector(String iconSelector, + int width, int height) { + return getCreator().createSystemImageFromSelector(iconSelector, width, height); + } + + public static Image createImageFromFile(String file, double width, double height) { + return getCreator().createImageFromFile(file, width, height); + } + + // This is used to create a CImage from a Image + public static CImage createFromImage(final Image image) { + return getCreator().createFromImage(image); + } + public static class Creator { Creator() { } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/awt_DrawingSurface.m --- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/awt_DrawingSurface.m Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/awt_DrawingSurface.m Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -27,6 +27,8 @@ #import "AWTSurfaceLayers.h" +#import "jni_util.h" + JNIEXPORT JAWT_DrawingSurfaceInfo* JNICALL awt_DrawingSurface_GetDrawingSurfaceInfo (JAWT_DrawingSurface* ds) { @@ -130,3 +132,47 @@ // TODO: implement return NULL; } + +// EmbeddedFrame support + +static char *const embeddedClassName = "sun/lwawt/macosx/CViewEmbeddedFrame"; + +JNIEXPORT jobject JNICALL awt_CreateEmbeddedFrame +(JNIEnv* env, void* platformInfo) +{ + static jmethodID mid = NULL; + static jclass cls; + if (mid == NULL) { + cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL_RETURN(cls, NULL); + mid = (*env)->GetMethodID(env, cls, "", "(J)V"); + CHECK_NULL_RETURN(mid, NULL); + } + return (*env)->NewObject(env, cls, mid, platformInfo); +} + +JNIEXPORT void JNICALL awt_SetBounds +(JNIEnv *env, jobject embeddedFrame, jint x, jint y, jint w, jint h) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL(cls); + mid = (*env)->GetMethodID(env, cls, "setBoundsPrivate", "(IIII)V"); + CHECK_NULL(mid); + } + (*env)->CallVoidMethod(env, embeddedFrame, mid, x, y, w, h); +} + +JNIEXPORT void JNICALL awt_SynthesizeWindowActivation +(JNIEnv *env, jobject embeddedFrame, jboolean doActivate) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL(cls); + mid = (*env)->GetMethodID(env, cls, "synthesizeWindowActivation", "(Z)V"); + CHECK_NULL(mid); + } + (*env)->CallVoidMethod(env, embeddedFrame, mid, doActivate); +} diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/macosx/native/libjawt/jawt.m --- a/jdk/src/java.desktop/macosx/native/libjawt/jawt.m Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/macosx/native/libjawt/jawt.m Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,8 +46,9 @@ return JNI_FALSE; } - if (awt->version != (JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER) && - awt->version != JAWT_VERSION_1_7) + if (awt->version != (JAWT_VERSION_1_4 | JAWT_MACOSX_USE_CALAYER) + && awt->version != JAWT_VERSION_1_7 + && awt->version != JAWT_VERSION_9) { return JNI_FALSE; } @@ -58,6 +59,11 @@ awt->Lock = awt_Lock; awt->Unlock = awt_Unlock; awt->GetComponent = awt_GetComponent; + if (awt->version >= JAWT_VERSION_9) { + awt->CreateEmbeddedFrame = awt_CreateEmbeddedFrame; + awt->SetBounds = awt_SetBounds; + awt->SynthesizeWindowActivation = awt_SynthesizeWindowActivation; + } } return JNI_TRUE; diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java --- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/ModelByteBuffer.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -200,11 +200,13 @@ public void writeTo(OutputStream out) throws IOException { if (root.file != null && root.buffer == null) { - InputStream is = getInputStream(); - byte[] buff = new byte[1024]; - int ret; - while ((ret = is.read(buff)) != -1) - out.write(buff, 0, ret); + try (InputStream is = getInputStream()) { + byte[] buff = new byte[1024]; + int ret; + while ((ret = is.read(buff)) != -1) { + out.write(buff, 0, ret); + } + } } else out.write(array(), (int) arrayOffset(), (int) capacity()); } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/java/awt/AWTEvent.java --- a/jdk/src/java.desktop/share/classes/java/awt/AWTEvent.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/java/awt/AWTEvent.java Fri Sep 02 02:41:37 2016 +0000 @@ -284,35 +284,6 @@ }); } - private static synchronized Field get_InputEvent_CanAccessSystemClipboard() { - if (inputEvent_CanAccessSystemClipboard_Field == null) { - inputEvent_CanAccessSystemClipboard_Field = - java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { - public Field run() { - Field field = null; - try { - field = InputEvent.class. - getDeclaredField("canAccessSystemClipboard"); - field.setAccessible(true); - return field; - } catch (SecurityException e) { - if (log.isLoggable(PlatformLogger.Level.FINE)) { - log.fine("AWTEvent.get_InputEvent_CanAccessSystemClipboard() got SecurityException ", e); - } - } catch (NoSuchFieldException e) { - if (log.isLoggable(PlatformLogger.Level.FINE)) { - log.fine("AWTEvent.get_InputEvent_CanAccessSystemClipboard() got NoSuchFieldException ", e); - } - } - return null; - } - }); - } - - return inputEvent_CanAccessSystemClipboard_Field; - } - /** * Initialize JNI field and method IDs for fields that may be * accessed from C. @@ -593,33 +564,20 @@ that.bdata = this.bdata; // Copy canAccessSystemClipboard value from this into that. if (this instanceof InputEvent && that instanceof InputEvent) { - Field field = get_InputEvent_CanAccessSystemClipboard(); - if (field != null) { - try { - boolean b = field.getBoolean(this); - field.setBoolean(that, b); - } catch(IllegalAccessException e) { - if (log.isLoggable(PlatformLogger.Level.FINE)) { - log.fine("AWTEvent.copyPrivateDataInto() got IllegalAccessException ", e); - } - } - } + + AWTAccessor.InputEventAccessor accessor + = AWTAccessor.getInputEventAccessor(); + + boolean b = accessor.canAccessSystemClipboard((InputEvent) this); + accessor.setCanAccessSystemClipboard((InputEvent) that, b); } that.isSystemGenerated = this.isSystemGenerated; } void dispatched() { if (this instanceof InputEvent) { - Field field = get_InputEvent_CanAccessSystemClipboard(); - if (field != null) { - try { - field.setBoolean(this, false); - } catch(IllegalAccessException e) { - if (log.isLoggable(PlatformLogger.Level.FINE)) { - log.fine("AWTEvent.dispatched() got IllegalAccessException ", e); - } - } - } + AWTAccessor.getInputEventAccessor(). + setCanAccessSystemClipboard((InputEvent) this, false); } } } // class AWTEvent diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/java/awt/Component.java --- a/jdk/src/java.desktop/share/classes/java/awt/Component.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/java/awt/Component.java Fri Sep 02 02:41:37 2016 +0000 @@ -53,13 +53,11 @@ import java.awt.im.InputContext; import java.awt.im.InputMethodRequests; import java.awt.dnd.DropTarget; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; import java.security.AccessController; -import java.security.PrivilegedAction; import java.security.AccessControlContext; import javax.accessibility.*; import java.applet.Applet; +import javax.swing.JComponent; import sun.awt.ComponentFactory; import sun.security.action.GetPropertyAction; @@ -81,6 +79,7 @@ import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*; import sun.awt.RequestFocusController; import sun.java2d.SunGraphicsEnvironment; +import sun.swing.SwingAccessor; import sun.util.logging.PlatformLogger; /** @@ -8695,6 +8694,9 @@ * the Swing package private method {@code compWriteObjectNotify}. */ private void doSwingSerialization() { + if (!(this instanceof JComponent)) { + return; + } @SuppressWarnings("deprecation") Package swingPackage = Package.getPackage("javax.swing"); // For Swing serialization to correctly work Swing needs to @@ -8707,36 +8709,10 @@ klass = klass.getSuperclass()) { if (klass.getPackage() == swingPackage && klass.getClassLoader() == null) { - final Class swingClass = klass; - // Find the first override of the compWriteObjectNotify method - Method[] methods = AccessController.doPrivileged( - new PrivilegedAction() { - public Method[] run() { - return swingClass.getDeclaredMethods(); - } - }); - for (int counter = methods.length - 1; counter >= 0; - counter--) { - final Method method = methods[counter]; - if (method.getName().equals("compWriteObjectNotify")){ - // We found it, use doPrivileged to make it accessible - // to use. - AccessController.doPrivileged(new PrivilegedAction() { - public Void run() { - method.setAccessible(true); - return null; - } - }); - // Invoke the method - try { - method.invoke(this, (Object[]) null); - } catch (IllegalAccessException iae) { - } catch (InvocationTargetException ite) { - } - // We're done, bail. - return; - } - } + + SwingAccessor.getJComponentAccessor() + .compWriteObjectNotify((JComponent) this); + return; } } } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java --- a/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/java/awt/KeyboardFocusManager.java Fri Sep 02 02:41:37 2016 +0000 @@ -40,8 +40,6 @@ import java.lang.ref.WeakReference; -import java.lang.reflect.Field; - import java.security.AccessController; import java.security.PrivilegedAction; @@ -140,6 +138,10 @@ public void removeLastFocusRequest(Component heavyweight) { KeyboardFocusManager.removeLastFocusRequest(heavyweight); } + @Override + public Component getMostRecentFocusOwner(Window window) { + return KeyboardFocusManager.getMostRecentFocusOwner(window); + } public void setMostRecentFocusOwner(Window window, Component component) { KeyboardFocusManager.setMostRecentFocusOwner(window, component); } @@ -3053,32 +3055,9 @@ } } - static Field proxyActive; // Accessor to private field isProxyActive of KeyEvent private static boolean isProxyActiveImpl(KeyEvent e) { - if (proxyActive == null) { - proxyActive = AccessController.doPrivileged(new PrivilegedAction() { - public Field run() { - Field field = null; - try { - field = KeyEvent.class.getDeclaredField("isProxyActive"); - if (field != null) { - field.setAccessible(true); - } - } catch (NoSuchFieldException nsf) { - assert(false); - } - return field; - } - }); - } - - try { - return proxyActive.getBoolean(e); - } catch (IllegalAccessException iae) { - assert(false); - } - return false; + return AWTAccessor.getKeyEventAccessor().isProxyActive(e); } // Returns the value of this KeyEvent's field isProxyActive diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/java/awt/SequencedEvent.java --- a/jdk/src/java.desktop/share/classes/java/awt/SequencedEvent.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/java/awt/SequencedEvent.java Fri Sep 02 02:41:37 2016 +0000 @@ -63,6 +63,10 @@ public boolean isSequencedEvent(AWTEvent event) { return event instanceof SequencedEvent; } + + public AWTEvent create(AWTEvent event) { + return new SequencedEvent(event); + } }); } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/java/awt/event/InputEvent.java --- a/jdk/src/java.desktop/share/classes/java/awt/event/InputEvent.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/java/awt/event/InputEvent.java Fri Sep 02 02:41:37 2016 +0000 @@ -302,6 +302,12 @@ public boolean canAccessSystemClipboard(InputEvent event) { return event.canAccessSystemClipboard; } + + @Override + public void setCanAccessSystemClipboard(InputEvent event, + boolean canAccessSystemClipboard) { + event.canAccessSystemClipboard = canAccessSystemClipboard; + } }); } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/java/awt/event/KeyEvent.java --- a/jdk/src/java.desktop/share/classes/java/awt/event/KeyEvent.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/java/awt/event/KeyEvent.java Fri Sep 02 02:41:37 2016 +0000 @@ -1091,6 +1091,11 @@ public Component getOriginalSource( KeyEvent ev ) { return ev.originalSource; } + + @Override + public boolean isProxyActive(KeyEvent ev) { + return ev.isProxyActive; + } }); } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/java/awt/font/JavaAWTFontAccessImpl.java --- a/jdk/src/java.desktop/share/classes/java/awt/font/JavaAWTFontAccessImpl.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/java/awt/font/JavaAWTFontAccessImpl.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -25,7 +25,6 @@ package java.awt.font; -import java.lang.reflect.Field; import jdk.internal.misc.JavaAWTFontAccess; class JavaAWTFontAccessImpl implements JavaAWTFontAccess { @@ -33,19 +32,17 @@ // java.awt.font.TextAttribute constants public Object getTextAttributeConstant(String name) { switch (name) { - case "RUN_DIRECTION": - case "NUMERIC_SHAPING": - case "BIDI_EMBEDDING": - case "RUN_DIRECTION_LTR": - try { - Field f = TextAttribute.class.getField(name); - return f.get(null); - } catch (NoSuchFieldException | IllegalAccessException x) { - throw new AssertionError(x); - } + case "RUN_DIRECTION": + return TextAttribute.RUN_DIRECTION; + case "NUMERIC_SHAPING": + return TextAttribute.NUMERIC_SHAPING; + case "BIDI_EMBEDDING": + return TextAttribute.BIDI_EMBEDDING; + case "RUN_DIRECTION_LTR": + return TextAttribute.RUN_DIRECTION_LTR; + default: + throw new AssertionError("Constant name is not recognized"); } - - throw new AssertionError("Constant name is not recognized"); } // java.awt.font.NumericShaper diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleBundle.java --- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleBundle.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleBundle.java Fri Sep 02 02:41:37 2016 +0000 @@ -31,6 +31,7 @@ import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; +import sun.awt.AWTAccessor; /** *

    Base class used to maintain a strongly typed enumeration. This is @@ -53,6 +54,17 @@ private final String defaultResourceBundleName = "com.sun.accessibility.internal.resources.accessibility"; + static { + AWTAccessor.setAccessibleBundleAccessor( + new AWTAccessor.AccessibleBundleAccessor() { + + @Override + public String getKey(AccessibleBundle accessibleBundle) { + return accessibleBundle.key; + } + }); + } + /** * Construct an {@code AccessibleBundle}. */ diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java --- a/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/accessibility/AccessibleContext.java Fri Sep 02 02:41:37 2016 +0000 @@ -99,6 +99,16 @@ public AppContext getAppContext(AccessibleContext accessibleContext) { return accessibleContext.targetAppContext; } + + @Override + public Object getNativeAXResource(AccessibleContext accessibleContext) { + return accessibleContext.nativeAXResource; + } + + @Override + public void setNativeAXResource(AccessibleContext accessibleContext, Object value) { + accessibleContext.nativeAXResource = value; + } }); } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/javax/imageio/ImageIO.java --- a/jdk/src/java.desktop/share/classes/javax/imageio/ImageIO.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/imageio/ImageIO.java Fri Sep 02 02:41:37 2016 +0000 @@ -462,10 +462,13 @@ return new String[0]; } - HashSet s = new HashSet(); + HashSet s = new HashSet<>(); while (iter.hasNext()) { ImageReaderWriterSpi spi = iter.next(); - Collections.addAll(s, spiInfo.info(spi)); + String[] info = spiInfo.info(spi); + if (info != null) { + Collections.addAll(s, info); + } } return s.toArray(new String[s.size()]); diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java --- a/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/imageio/plugins/tiff/TIFFField.java Fri Sep 02 02:41:37 2016 +0000 @@ -412,7 +412,7 @@ /** * Creates a {@code TIFFField} from a TIFF native image - * metadata node. If the value of the "number" attribute + * metadata node. If the value of the {@code "number"} attribute * of the node is not found in {@code tagSet} then a new * {@code TIFFTag} with name {@code TIFFTag.UNKNOWN_TAG_NAME} * will be created and assigned to the field. @@ -420,20 +420,22 @@ * @param tagSet The {@code TIFFTagSet} to which the * {@code TIFFTag} of the field belongs. * @param node A native TIFF image metadata {@code TIFFField} node. - * @throws NullPointerException if {@code node} is - * {@code null}. - * @throws IllegalArgumentException if the name of the node is not - * {@code "TIFFField"}. - * @throws NullPointerException if the node does not contain any data. - * @throws IllegalArgumentException if the combination of node attributes - * and data is not legal per the {@link #TIFFField(TIFFTag,int,int,Object)} - * constructor specification. + * @throws IllegalArgumentException If the {@code Node} parameter content + * does not adhere to the {@code TIFFField} element structure defined by + * the + * TIFF native image metadata format specification, or if the + * combination of node attributes and data is not legal per the + * {@link #TIFFField(TIFFTag,int,int,Object)} constructor specification. + * Note that a cause might be set on such an exception. * @return A new {@code TIFFField}. */ public static TIFFField createFromMetadataNode(TIFFTagSet tagSet, Node node) { if (node == null) { - throw new NullPointerException("node == null!"); + // This method is specified to throw only IllegalArgumentExceptions + // so we create an IAE with a NullPointerException as its cause. + throw new IllegalArgumentException(new NullPointerException + ("node == null!")); } String name = node.getNodeName(); if (!name.equals("TIFFField")) { @@ -487,7 +489,17 @@ tag = new TIFFTag(TIFFTag.UNKNOWN_TAG_NAME, tagNumber, 1 << type); } - return new TIFFField(tag, type, count, data); + TIFFField field; + try { + field = new TIFFField(tag, type, count, data); + } catch (NullPointerException npe) { + // This method is specified to throw only IllegalArgumentExceptions + // so we catch the NullPointerException and set it as the cause of + // the IAE which is thrown. + throw new IllegalArgumentException(npe); + } + + return field; } /** diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java --- a/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/print/ServiceUI.java Fri Sep 02 02:41:37 2016 +0000 @@ -40,6 +40,7 @@ import javax.print.attribute.PrintRequestAttributeSet; import javax.print.attribute.standard.Destination; import javax.print.attribute.standard.Fidelity; +import sun.print.DialogOwner; import sun.print.ServiceDialog; import sun.print.SunAlternateMedia; @@ -187,9 +188,8 @@ defaultIndex = 0; } - // For now we set owner to null. In the future, it may be passed - // as an argument. - Window owner = null; + DialogOwner dlgOwner = (DialogOwner)attributes.get(DialogOwner.class); + Window owner = (dlgOwner != null) ? dlgOwner.getOwner() : null; Rectangle gcBounds = (gc == null) ? GraphicsEnvironment. getLocalGraphicsEnvironment().getDefaultScreenDevice(). diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/javax/swing/GrayFilter.java --- a/jdk/src/java.desktop/share/classes/javax/swing/GrayFilter.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/GrayFilter.java Fri Sep 02 02:41:37 2016 +0000 @@ -26,6 +26,7 @@ import java.awt.*; import java.awt.image.*; +import sun.awt.image.MultiResolutionCachedImage; /** * An image filter that "disables" an image by turning @@ -48,7 +49,16 @@ * @param i an {@code Image} to be created as disabled * @return the new grayscale image created from {@code i} */ - public static Image createDisabledImage (Image i) { + public static Image createDisabledImage(Image i) { + if (i instanceof MultiResolutionImage) { + return MultiResolutionCachedImage + .map((MultiResolutionImage) i, + (img) -> createDisabledImageImpl(img)); + } + return createDisabledImageImpl(i); + } + + private static Image createDisabledImageImpl(Image i) { GrayFilter filter = new GrayFilter(true, 50); ImageProducer prod = new FilteredImageSource(i.getSource(), filter); Image grayImage = Toolkit.getDefaultToolkit().createImage(prod); diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/javax/swing/ImageIcon.java --- a/jdk/src/java.desktop/share/classes/javax/swing/ImageIcon.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/ImageIcon.java Fri Sep 02 02:41:37 2016 +0000 @@ -40,8 +40,8 @@ import javax.accessibility.*; import sun.awt.AppContext; -import java.lang.reflect.Field; import java.security.*; +import sun.awt.AWTAccessor; /** * An implementation of the Icon interface that paints Icons @@ -106,11 +106,8 @@ final Component component = createNoPermsComponent(); // 6482575 - clear the appContext field so as not to leak it - Field appContextField = - - Component.class.getDeclaredField("appContext"); - appContextField.setAccessible(true); - appContextField.set(component, null); + AWTAccessor.getComponentAccessor(). + setAppContext(component, null); return component; } catch (Throwable e) { diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/javax/swing/JComponent.java --- a/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/JComponent.java Fri Sep 02 02:41:37 2016 +0000 @@ -55,6 +55,7 @@ import sun.awt.AWTAccessor; import sun.awt.SunToolkit; +import sun.swing.SwingAccessor; import sun.swing.SwingUtilities2; /** @@ -376,6 +377,21 @@ private transient Object aaHint; private transient Object lcdRenderingHint; + static { + SwingAccessor.setJComponentAccessor(new SwingAccessor.JComponentAccessor() { + + @Override + public boolean getFlag(JComponent comp, int aFlag) { + return comp.getFlag(aFlag); + } + + @Override + public void compWriteObjectNotify(JComponent comp) { + comp.compWriteObjectNotify(); + } + }); + } + static Graphics safelyGetGraphics(Component c) { return safelyGetGraphics(c, SwingUtilities.getRoot(c)); } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/javax/swing/text/GlyphView.java --- a/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphView.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/GlyphView.java Fri Sep 02 02:41:37 2016 +0000 @@ -261,23 +261,7 @@ if (painter == null) { if (defaultPainter == null) { // the classname should probably come from a property file. - String classname = "javax.swing.text.GlyphPainter1"; - try { - Class c; - ClassLoader loader = getClass().getClassLoader(); - if (loader != null) { - c = loader.loadClass(classname); - } else { - c = Class.forName(classname); - } - Object o = c.newInstance(); - if (o instanceof GlyphPainter) { - defaultPainter = (GlyphPainter) o; - } - } catch (Throwable e) { - throw new StateInvariantError("GlyphView: Can't load glyph painter: " - + classname); - } + defaultPainter = new GlyphPainter1(); } setGlyphPainter(defaultPainter.getPainter(this, getStartOffset(), getEndOffset())); diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java --- a/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/ParagraphView.java Fri Sep 02 02:41:37 2016 +0000 @@ -61,20 +61,8 @@ Object i18nFlag = doc.getProperty(AbstractDocument.I18NProperty); if ((i18nFlag != null) && i18nFlag.equals(Boolean.TRUE)) { try { - if (i18nStrategy == null) { - // the classname should probably come from a property file. - String classname = "javax.swing.text.TextLayoutStrategy"; - ClassLoader loader = getClass().getClassLoader(); - if (loader != null) { - i18nStrategy = loader.loadClass(classname); - } else { - i18nStrategy = Class.forName(classname); - } - } - Object o = i18nStrategy.newInstance(); - if (o instanceof FlowStrategy) { - strategy = (FlowStrategy) o; - } + // the classname should probably come from a property file. + strategy = new TextLayoutStrategy(); } catch (Throwable e) { throw new StateInvariantError("ParagraphView: Can't create i18n strategy: " + e.getMessage()); diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java --- a/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/javax/swing/text/html/HTMLEditorKit.java Fri Sep 02 02:41:37 2016 +0000 @@ -40,6 +40,7 @@ import java.lang.ref.*; import java.security.AccessController; import java.security.PrivilegedAction; +import javax.swing.text.html.parser.ParserDelegator; /** * The Swing JEditorPane text component supports different kinds @@ -610,11 +611,7 @@ */ protected Parser getParser() { if (defaultParser == null) { - try { - Class c = Class.forName("javax.swing.text.html.parser.ParserDelegator"); - defaultParser = (Parser) c.newInstance(); - } catch (Throwable e) { - } + defaultParser = new ParserDelegator(); } return defaultParser; } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java --- a/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/sun/applet/AppletPanel.java Fri Sep 02 02:41:37 2016 +0000 @@ -616,34 +616,8 @@ * calls KeyboardFocusManager directly. */ private Component getMostRecentFocusOwnerForWindow(Window w) { - Method meth = AccessController.doPrivileged( - new PrivilegedAction() { - @Override - public Method run() { - Method meth = null; - try { - meth = KeyboardFocusManager.class.getDeclaredMethod( - "getMostRecentFocusOwner", - new Class[]{Window.class}); - meth.setAccessible(true); - } catch (Exception e) { - // Must never happen - e.printStackTrace(); - } - return meth; - } - }); - if (meth != null) { - // Meth refers static method - try { - return (Component)meth.invoke(null, new Object[] {w}); - } catch (Exception e) { - // Must never happen - e.printStackTrace(); - } - } - // Will get here if exception was thrown or meth is null - return w.getMostRecentFocusOwner(); + return AWTAccessor.getKeyboardFocusManagerAccessor() + .getMostRecentFocusOwner(w); } /* diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java --- a/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/sun/awt/AWTAccessor.java Fri Sep 02 02:41:37 2016 +0000 @@ -34,6 +34,7 @@ import java.awt.dnd.DropTargetContext; import java.awt.dnd.peer.DragSourceContextPeer; import java.awt.dnd.peer.DropTargetContextPeer; +import java.awt.event.AWTEventListener; import java.awt.event.InputEvent; import java.awt.event.InvocationEvent; import java.awt.event.KeyEvent; @@ -48,6 +49,7 @@ import java.io.File; import java.util.ResourceBundle; import java.util.Vector; +import javax.accessibility.AccessibleBundle; /** * The AWTAccessor utility class. @@ -406,6 +408,8 @@ * Accessor for InputEvent.canAccessSystemClipboard field */ boolean canAccessSystemClipboard(InputEvent event); + void setCanAccessSystemClipboard(InputEvent event, + boolean canAccessSystemClipboard); } /* @@ -455,6 +459,11 @@ void removeLastFocusRequest(Component heavyweight); /** + * Gets the most recent focus owner in the window. + */ + Component getMostRecentFocusOwner(Window window); + + /** * Sets the most recent focus owner in the window. */ void setMostRecentFocusOwner(Window window, Component component); @@ -708,6 +717,11 @@ * Gets original source for KeyEvent */ Component getOriginalSource(KeyEvent ev); + + /** + * Gets isProxyActive field for KeyEvent + */ + boolean isProxyActive(KeyEvent ev); } /** @@ -758,6 +772,11 @@ * Returns true if the event is an instances of SequencedEvent. */ boolean isSequencedEvent(AWTEvent event); + + /* + * Creates SequencedEvent with the given nested event + */ + AWTEvent create(AWTEvent event); } /* @@ -787,6 +806,15 @@ public interface AccessibleContextAccessor { void setAppContext(AccessibleContext accessibleContext, AppContext appContext); AppContext getAppContext(AccessibleContext accessibleContext); + Object getNativeAXResource(AccessibleContext accessibleContext); + void setNativeAXResource(AccessibleContext accessibleContext, Object value); + } + + /* + * An accessor object for the AccessibleContext class + */ + public interface AccessibleBundleAccessor { + String getKey(AccessibleBundle accessibleBundle); } /* @@ -845,6 +873,7 @@ private static InvocationEventAccessor invocationEventAccessor; private static SystemColorAccessor systemColorAccessor; private static AccessibleContextAccessor accessibleContextAccessor; + private static AccessibleBundleAccessor accessibleBundleAccessor; private static DragSourceContextAccessor dragSourceContextAccessor; private static DropTargetContextAccessor dropTargetContextAccessor; @@ -1235,9 +1264,13 @@ * Get the accessor object for the java.awt.SequencedEvent class. */ public static SequencedEventAccessor getSequencedEventAccessor() { - // The class is not public. So we can't ensure it's initialized. - // Null returned value means it's not initialized - // (so not a single instance of the event has been created). + if (sequencedEventAccessor == null) { + try { + unsafe.ensureClassInitialized( + Class.forName("java.awt.SequencedEvent")); + } catch (ClassNotFoundException ignore) { + } + } return sequencedEventAccessor; } @@ -1302,6 +1335,23 @@ } /* + * Set the accessor object for the javax.accessibility.AccessibleBundle class. + */ + public static void setAccessibleBundleAccessor(AccessibleBundleAccessor accessor) { + AWTAccessor.accessibleBundleAccessor = accessor; + } + + /* + * Get the accessor object for the javax.accessibility.AccessibleBundle class. + */ + public static AccessibleBundleAccessor getAccessibleBundleAccessor() { + if (accessibleBundleAccessor == null) { + unsafe.ensureClassInitialized(AccessibleBundle.class); + } + return accessibleBundleAccessor; + } + + /* * Set the accessor object for the javax.accessibility.AccessibleContext class. */ public static void setAccessibleContextAccessor(AccessibleContextAccessor accessor) { @@ -1342,4 +1392,4 @@ AWTAccessor.dropTargetContextAccessor = accessor; } -} +} \ No newline at end of file diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java --- a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java Fri Sep 02 02:41:37 2016 +0000 @@ -372,26 +372,6 @@ cont.setFocusTraversalPolicy(defaultPolicy); } - private static FocusTraversalPolicy createLayoutPolicy() { - FocusTraversalPolicy policy = null; - try { - Class layoutPolicyClass = - Class.forName("javax.swing.LayoutFocusTraversalPolicy"); - policy = (FocusTraversalPolicy)layoutPolicyClass.newInstance(); - } - catch (ClassNotFoundException e) { - assert false; - } - catch (InstantiationException e) { - assert false; - } - catch (IllegalAccessException e) { - assert false; - } - - return policy; - } - /* * Insert a mapping from target to AppContext, for later retrieval * via targetToAppContext() above. diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java --- a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionCachedImage.java Fri Sep 02 02:41:37 2016 +0000 @@ -33,6 +33,7 @@ import java.util.function.Function; import java.util.function.BiFunction; import java.util.stream.Collectors; +import java.awt.image.MultiResolutionImage; import java.awt.image.AbstractMultiResolutionImage; public class MultiResolutionCachedImage extends AbstractMultiResolutionImage { @@ -44,17 +45,30 @@ private int availableInfo; public MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight, - BiFunction mapper) { - this(baseImageWidth, baseImageHeight, new Dimension[]{new Dimension( - baseImageWidth, baseImageHeight) + BiFunction mapper) + { + this(baseImageWidth, baseImageHeight, + new Dimension[]{new Dimension( baseImageWidth, baseImageHeight) }, mapper); } public MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight, - Dimension2D[] sizes, BiFunction mapper) { + Dimension2D[] sizes, + BiFunction mapper) + { + this(baseImageWidth, baseImageHeight, sizes, mapper, true); + } + + private MultiResolutionCachedImage(int baseImageWidth, int baseImageHeight, + Dimension2D[] sizes, + BiFunction mapper, + boolean copySizes) + { this.baseImageWidth = baseImageWidth; this.baseImageHeight = baseImageHeight; - this.sizes = (sizes == null) ? null : Arrays.copyOf(sizes, sizes.length); + this.sizes = (copySizes && sizes != null) + ? Arrays.copyOf(sizes, sizes.length) + : sizes; this.mapper = mapper; } @@ -99,6 +113,35 @@ mapper.apply(getResolutionVariant(width, height))); } + public static Image map(MultiResolutionImage mrImage, + Function mapper) { + + if (mrImage instanceof MultiResolutionToolkitImage) { + MultiResolutionToolkitImage mrtImage = + (MultiResolutionToolkitImage) mrImage; + return MultiResolutionToolkitImage.map(mrtImage, mapper); + } + + BiFunction sizeMapper + = (w, h) -> mapper.apply(mrImage.getResolutionVariant(w, h)); + + if (mrImage instanceof MultiResolutionCachedImage) { + MultiResolutionCachedImage mrcImage + = (MultiResolutionCachedImage) mrImage; + + return new MultiResolutionCachedImage(mrcImage.baseImageWidth, + mrcImage.baseImageHeight, + mrcImage.sizes, + sizeMapper, + false); + } + + Image image = (Image) mrImage; + int width = image.getWidth(null); + int height = image.getHeight(null); + return new MultiResolutionCachedImage(width, height, sizeMapper); + } + @Override public int getWidth(ImageObserver observer) { updateInfo(observer, ImageObserver.WIDTH); diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionToolkitImage.java --- a/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionToolkitImage.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/sun/awt/image/MultiResolutionToolkitImage.java Fri Sep 02 02:41:37 2016 +0000 @@ -29,6 +29,7 @@ import java.awt.image.MultiResolutionImage; import java.util.Arrays; import java.util.List; +import java.util.function.Function; import sun.awt.SoftCache; public class MultiResolutionToolkitImage extends ToolkitImage implements MultiResolutionImage { @@ -47,6 +48,13 @@ ? this : resolutionVariant; } + public static Image map(MultiResolutionToolkitImage mrImage, + Function mapper) { + Image baseImage = mapper.apply(mrImage); + Image rvImage = mapper.apply(mrImage.resolutionVariant); + return new MultiResolutionToolkitImage(baseImage, rvImage); + } + private static void checkSize(double width, double height) { if (width <= 0 || height <= 0) { throw new IllegalArgumentException(String.format( diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java --- a/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/sun/print/PSPrinterJob.java Fri Sep 02 02:41:37 2016 +0000 @@ -33,11 +33,8 @@ import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.HeadlessException; -import java.awt.Rectangle; import java.awt.Shape; -import java.awt.image.BufferedImage; - import java.awt.font.FontRenderContext; import java.awt.geom.AffineTransform; @@ -46,7 +43,6 @@ import java.awt.image.BufferedImage; -import java.awt.peer.FontPeer; import java.awt.print.Pageable; import java.awt.print.PageFormat; import java.awt.print.Paper; @@ -55,14 +51,12 @@ import java.awt.print.PrinterIOException; import java.awt.print.PrinterJob; -import javax.print.DocFlavor; import javax.print.PrintService; import javax.print.StreamPrintService; import javax.print.attribute.HashPrintRequestAttributeSet; import javax.print.attribute.PrintRequestAttributeSet; import javax.print.attribute.PrintServiceAttributeSet; import javax.print.attribute.standard.PrinterName; -import javax.print.attribute.standard.Chromaticity; import javax.print.attribute.standard.Copies; import javax.print.attribute.standard.Destination; import javax.print.attribute.standard.DialogTypeSelection; @@ -72,7 +66,6 @@ import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; -import java.io.CharConversionException; import java.io.File; import java.io.InputStream; import java.io.InputStreamReader; @@ -85,17 +78,14 @@ import java.io.StringWriter; import java.util.ArrayList; -import java.util.Enumeration; import java.util.Locale; import java.util.Properties; import sun.awt.CharsetString; import sun.awt.FontConfiguration; -import sun.awt.FontDescriptor; import sun.awt.PlatformFont; import sun.awt.SunToolkit; import sun.font.FontAccess; -import sun.font.FontManagerFactory; import sun.font.FontUtilities; import java.nio.charset.*; @@ -105,7 +95,9 @@ //REMIND: Remove use of this class when IPPPrintService is moved to share directory. import java.lang.reflect.Method; +import javax.print.attribute.Attribute; import javax.print.attribute.standard.JobSheets; +import javax.print.attribute.standard.Media; /** * A class which initiates and executes a PostScript printer job. @@ -489,6 +481,23 @@ return doPrint; } + @Override + protected void setAttributes(PrintRequestAttributeSet attributes) + throws PrinterException { + super.setAttributes(attributes); + if (attributes == null) { + return; // now always use attributes, so this shouldn't happen. + } + Attribute attr = attributes.get(Media.class); + if (attr instanceof CustomMediaTray) { + CustomMediaTray customTray = (CustomMediaTray)attr; + String choice = customTray.getChoiceName(); + if (choice != null) { + mOptions = " InputSlot="+ choice; + } + } + } + /** * Invoked by the RasterPrinterJob super class * this method is called to mark the start of a @@ -1629,7 +1638,7 @@ execCmd[n++] = "-o job-sheets=standard"; } if ((pFlags & OPTIONS) != 0) { - execCmd[n++] = new String(options); + execCmd[n++] = "-o" + options; } } else { ncomps+=1; //add 1 arg for lp diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java --- a/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/sun/print/ServiceDialog.java Fri Sep 02 02:41:37 2016 +0000 @@ -944,6 +944,10 @@ } catch (MalformedURLException ex) { dstSupported = true; } + } else { + if (psCurrent.isAttributeCategorySupported(dstCategory)) { + dstSupported = true; + } } cbPrintToFile.setEnabled(dstSupported && dstAllowed); cbPrintToFile.setSelected(dstSelected && dstAllowed diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/classes/sun/swing/SwingAccessor.java --- a/jdk/src/java.desktop/share/classes/sun/swing/SwingAccessor.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/classes/sun/swing/SwingAccessor.java Fri Sep 02 02:41:37 2016 +0000 @@ -51,6 +51,16 @@ } /** + * An accessor for the JComponent class. + */ + public interface JComponentAccessor { + + boolean getFlag(JComponent comp, int aFlag); + + void compWriteObjectNotify(JComponent comp); + } + + /** * An accessor for the JTextComponent class. * Note that we intentionally introduce the JTextComponentAccessor, * and not the JComponentAccessor because the needed methods @@ -106,6 +116,29 @@ } /** + * The javax.swing.JComponent class accessor object. + */ + private static JComponentAccessor jComponentAccessor; + + /** + * Set an accessor object for the javax.swing.JComponent class. + */ + public static void setJComponentAccessor(JComponentAccessor jCompAccessor) { + jComponentAccessor = jCompAccessor; + } + + /** + * Retrieve the accessor object for the javax.swing.JComponent class. + */ + public static JComponentAccessor getJComponentAccessor() { + if (jComponentAccessor == null) { + unsafe.ensureClassInitialized(JComponent.class); + } + + return jComponentAccessor; + } + + /** * The javax.swing.text.JTextComponent class accessor object. */ private static JTextComponentAccessor jtextComponentAccessor; diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/native/include/jawt.h --- a/jdk/src/java.desktop/share/native/include/jawt.h Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/native/include/jawt.h Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -33,7 +33,7 @@ #endif /* - * AWT native interface (new in JDK 1.3) + * AWT native interface. * * The AWT native interface allows a native C or C++ application a means * by which to access native structures in AWT. This is to facilitate moving @@ -279,6 +279,50 @@ */ jobject (JNICALL *GetComponent)(JNIEnv* env, void* platformInfo); + /** + * Since 9 + * Creates a java.awt.Frame placed in a native container. Container is + * referenced by the native platform handle. For example on Windows this + * corresponds to an HWND. For other platforms, see the appropriate + * machine-dependent header file for a description. The reference returned + * by this function is a local reference that is only valid in this + * environment. This function returns a NULL reference if no frame could be + * created with matching platform information. + */ + jobject (JNICALL *CreateEmbeddedFrame) (JNIEnv *env, void* platformInfo); + + /** + * Since 9 + * Moves and resizes the embedded frame. The new location of the top-left + * corner is specified by x and y parameters relative to the native parent + * component. The new size is specified by width and height. + * + * The embedded frame should be created by CreateEmbeddedFrame() method, or + * this function will not have any effect. + * + * java.awt.Component.setLocation() and java.awt.Component.setBounds() for + * EmbeddedFrame really don't move it within the native parent. These + * methods always locate the embedded frame at (0, 0) for backward + * compatibility. To allow moving embedded frames this method was + * introduced, and it works just the same way as setLocation() and + * setBounds() for usual, non-embedded components. + * + * Using usual get/setLocation() and get/setBounds() together with this new + * method is not recommended. + */ + void (JNICALL *SetBounds) (JNIEnv *env, jobject embeddedFrame, + jint x, jint y, jint w, jint h); + /** + * Since 9 + * Synthesize a native message to activate or deactivate an EmbeddedFrame + * window depending on the value of parameter doActivate, if "true" + * activates the window; otherwise, deactivates the window. + * + * The embedded frame should be created by CreateEmbeddedFrame() method, or + * this function will not have any effect. + */ + void (JNICALL *SynthesizeWindowActivation) (JNIEnv *env, + jobject embeddedFrame, jboolean doActivate); } JAWT; /* @@ -291,6 +335,7 @@ #define JAWT_VERSION_1_3 0x00010003 #define JAWT_VERSION_1_4 0x00010004 #define JAWT_VERSION_1_7 0x00010007 +#define JAWT_VERSION_9 0x00090000 #ifdef __cplusplus } /* extern "C" */ diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c --- a/jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/native/libawt/awt/medialib/awt_ImagingLib.c Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -772,6 +772,7 @@ mlib_image *src; mlib_image *dst; int i; + int j = 0; int retStatus = 1; mlib_status status; double *matrix; @@ -824,6 +825,15 @@ return 0; } + /* Check for invalid double value in transformation matrix */ + for (j = 0; j < 6; j++) { + + if (!(IS_FINITE(matrix[j]))) { + (*env)->ReleasePrimitiveArrayCritical(env, jmatrix, matrix, JNI_ABORT); + return 0; + } + } + if (s_printIt) { printf("matrix is %g %g %g %g %g %g\n", matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); @@ -980,6 +990,7 @@ mlib_image *src; mlib_image *dst; int i; + int j = 0; int retStatus = 1; mlib_status status; double *matrix; @@ -1044,6 +1055,18 @@ return 0; } + /* Check for invalid double value in transformation matrix */ + for (j = 0; j < 6; j++) { + + if (!(IS_FINITE(matrix[j]))) { + (*env)->ReleasePrimitiveArrayCritical(env, jmatrix, matrix, JNI_ABORT); + free(srcRasterP); + free(dstRasterP); + + return 0; + } + } + if (s_printIt) { printf("matrix is %g %g %g %g %g %g\n", matrix[0], matrix[1], matrix[2], matrix[3], matrix[4], matrix[5]); diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c --- a/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/native/libfontmanager/HBShaper.c Fri Sep 02 02:41:37 2016 +0000 @@ -72,12 +72,13 @@ int storeGVData(JNIEnv* env, jobject gvdata, jint slot, jint baseIndex, jobject startPt, int glyphCount, hb_glyph_info_t *glyphInfo, - hb_glyph_position_t *glyphPos, hb_direction_t direction) { + hb_glyph_position_t *glyphPos, hb_direction_t direction, + float devScale) { int i; float x=0, y=0; float startX, startY; - float scale = 1.0f/64.0f; + float scale = 1.0f/64.0f/devScale; unsigned int* glyphs; float* positions; int initialCount, glyphArrayLen, posArrayLen, maxGlyphs, storeadv; @@ -216,7 +217,11 @@ fi->ptSize = ptSize; fi->xPtSize = euclidianDistance(fi->matrix[0], fi->matrix[1]); fi->yPtSize = euclidianDistance(fi->matrix[2], fi->matrix[3]); - + if (!aat && (getenv("HB_NODEVTX") != NULL)) { + fi->devScale = fi->xPtSize / fi->ptSize; + } else { + fi->devScale = 1.0f; + } return fi; } @@ -309,7 +314,8 @@ // by calling code. storeGVData(env, gvdata, slot, baseIndex, startPt, - glyphCount, glyphInfo, glyphPos, direction); + glyphCount, glyphInfo, glyphPos, direction, + jdkFontInfo->devScale); hb_buffer_destroy (buffer); hb_font_destroy(hbfont); diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc --- a/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk-font.cc Fri Sep 02 02:41:37 2016 +0000 @@ -81,6 +81,7 @@ return 0; } fadv = env->GetFloatField(pt, sunFontIDs.xFID); + fadv *= jdkFontInfo->devScale; env->DeleteLocalRef(pt); return FloatToF26Dot6(fadv); // should this round ? @@ -324,8 +325,8 @@ _hb_jdk_get_font_funcs (), jdkFontInfo, (hb_destroy_func_t) _do_nothing); hb_font_set_scale (font, - FloatToF26Dot6(jdkFontInfo->xPtSize), - FloatToF26Dot6(jdkFontInfo->yPtSize)); + FloatToF26Dot6(jdkFontInfo->ptSize*jdkFontInfo->devScale), + FloatToF26Dot6(jdkFontInfo->ptSize*jdkFontInfo->devScale)); return font; } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/native/libfontmanager/hb-jdk.h --- a/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk.h Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/native/libfontmanager/hb-jdk.h Fri Sep 02 02:41:37 2016 +0000 @@ -43,6 +43,7 @@ float ptSize; float xPtSize; float yPtSize; + float devScale; // How much applying the full glyph tx scales x distance. jboolean aat; } JDKFontInfo; diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c --- a/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageScanPoly.c Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -33,6 +33,8 @@ #include "mlib_image.h" #include "mlib_SysMath.h" #include "mlib_ImageAffine.h" +#include "safe_math.h" + /***************************************************************/ mlib_status mlib_AffineEdges(mlib_affine_param *param, @@ -83,6 +85,12 @@ dstYStride = mlib_ImageGetStride(dst); paddings = mlib_ImageGetPaddings(src); + /* All the transformation matrix parameters should be finite. if not, return failure */ + if (!(IS_FINITE(a) && IS_FINITE(b) && IS_FINITE(c) && IS_FINITE(d) && + IS_FINITE(tx) && IS_FINITE(ty))) { + return MLIB_FAILURE; + } + if (srcWidth >= (1 << 15) || srcHeight >= (1 << 15)) { return MLIB_FAILURE; } @@ -288,6 +296,10 @@ if (dY1 == dY2) continue; + if (!(IS_FINITE(slope))) { + continue; + } + if (dY1 < 0.0) y1 = 0; else { @@ -328,6 +340,10 @@ if (dY1 == dY2) continue; + if (!(IS_FINITE(slope))) { + continue; + } + if (dY1 < 0.0) y1 = 0; else { diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/native/libmlib_image/safe_math.h --- a/jdk/src/java.desktop/share/native/libmlib_image/safe_math.h Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/native/libmlib_image/safe_math.h Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 @@ -26,10 +26,15 @@ #ifndef __SAFE_MATH_H__ #define __SAFE_MATH_H__ +#include "mlib_types.h" + #define SAFE_TO_MULT(a, b) \ (((a) > 0) && ((b) >= 0) && ((0x7fffffff / (a)) > (b))) #define SAFE_TO_ADD(a, b) \ (((a) >= 0) && ((b) >= 0) && ((0x7fffffff - (a)) > (b))) +#define IS_FINITE(a) \ + (((a) >= MLIB_D64_MIN) && ((a) <= MLIB_D64_MAX)) + #endif // __SAFE_MATH_H__ diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c --- a/jdk/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/native/libsplashscreen/giflib/dgif_lib.c Fri Sep 02 02:41:37 2016 +0000 @@ -114,7 +114,7 @@ GifFile->SavedImages = NULL; GifFile->SColorMap = NULL; - Private = (GifFilePrivateType *)malloc(sizeof(GifFilePrivateType)); + Private = (GifFilePrivateType *)calloc(1, sizeof(GifFilePrivateType)); if (Private == NULL) { if (Error != NULL) *Error = D_GIF_ERR_NOT_ENOUGH_MEM; @@ -122,6 +122,9 @@ free((char *)GifFile); return NULL; } + + /*@i1@*/memset(Private, '\0', sizeof(GifFilePrivateType)); + #ifdef _WIN32 _setmode(FileHandle, O_BINARY); /* Make sure it is in binary mode. */ #endif /* _WIN32 */ @@ -197,13 +200,14 @@ GifFile->SavedImages = NULL; GifFile->SColorMap = NULL; - Private = (GifFilePrivateType *)malloc(sizeof(GifFilePrivateType)); + Private = (GifFilePrivateType *)calloc(1, sizeof(GifFilePrivateType)); if (!Private) { if (Error != NULL) *Error = D_GIF_ERR_NOT_ENOUGH_MEM; free((char *)GifFile); return NULL; } + /*@i1@*/memset(Private, '\0', sizeof(GifFilePrivateType)); GifFile->Private = (void *)Private; Private->FileHandle = 0; @@ -417,8 +421,8 @@ if (GifFile->SavedImages) { SavedImage* new_saved_images = - (SavedImage *)realloc(GifFile->SavedImages, - sizeof(SavedImage) * (GifFile->ImageCount + 1)); + (SavedImage *)reallocarray(GifFile->SavedImages, + (GifFile->ImageCount + 1), sizeof(SavedImage)); if (new_saved_images == NULL) { GifFile->Error = D_GIF_ERR_NOT_ENOUGH_MEM; return GIF_ERROR; @@ -788,6 +792,12 @@ } BitsPerPixel = CodeSize; + /* this can only happen on a severely malformed GIF */ + if (BitsPerPixel > 8) { + GifFile->Error = D_GIF_ERR_READ_FAILED; /* somewhat bogus error code */ + return GIF_ERROR; /* Failed to read Code size. */ + } + Private->Buf[0] = 0; /* Input Buffer empty. */ Private->BitsPerPixel = BitsPerPixel; Private->ClearCode = (1 << BitsPerPixel); @@ -1123,7 +1133,7 @@ if (ImageSize > (SIZE_MAX / sizeof(GifPixelType))) { return GIF_ERROR; } - sp->RasterBits = (unsigned char *)malloc(ImageSize * + sp->RasterBits = (unsigned char *)reallocarray(NULL, ImageSize, sizeof(GifPixelType)); if (sp->RasterBits == NULL) { diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h --- a/jdk/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/native/libsplashscreen/giflib/gif_lib.h Fri Sep 02 02:41:37 2016 +0000 @@ -37,7 +37,7 @@ #define GIFLIB_MAJOR 5 #define GIFLIB_MINOR 1 -#define GIFLIB_RELEASE 1 +#define GIFLIB_RELEASE 4 #define GIF_ERROR 0 #define GIF_OK 1 @@ -274,6 +274,9 @@ GifPixelType ColorTransIn2[]); extern int GifBitSize(int n); +extern void * reallocarray(void *optr, size_t nmemb, size_t size); + + /****************************************************************************** Support for the in-core structures allocation (slurp mode). ******************************************************************************/ diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c --- a/jdk/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/share/native/libsplashscreen/giflib/gifalloc.c Fri Sep 02 02:41:37 2016 +0000 @@ -212,8 +212,8 @@ /* perhaps we can shrink the map? */ if (RoundUpTo < ColorUnion->ColorCount) { - GifColorType *new_map = (GifColorType *)realloc(Map, - sizeof(GifColorType) * RoundUpTo); + GifColorType *new_map = (GifColorType *)reallocarray(Map, + RoundUpTo, sizeof(GifColorType)); if( new_map == NULL ) { GifFreeMapObject(ColorUnion); return ((ColorMapObject *) NULL); @@ -256,9 +256,9 @@ if (*ExtensionBlocks == NULL) *ExtensionBlocks=(ExtensionBlock *)malloc(sizeof(ExtensionBlock)); else { - ExtensionBlock* ep_new = (ExtensionBlock *)realloc(*ExtensionBlocks, - sizeof(ExtensionBlock) * - (*ExtensionBlockCount + 1)); + ExtensionBlock* ep_new = (ExtensionBlock *)reallocarray + (*ExtensionBlocks, (*ExtensionBlockCount + 1), + sizeof(ExtensionBlock)); if( ep_new == NULL ) return (GIF_ERROR); *ExtensionBlocks = ep_new; @@ -349,8 +349,8 @@ if (GifFile->SavedImages == NULL) GifFile->SavedImages = (SavedImage *)malloc(sizeof(SavedImage)); else - GifFile->SavedImages = (SavedImage *)realloc(GifFile->SavedImages, - sizeof(SavedImage) * (GifFile->ImageCount + 1)); + GifFile->SavedImages = (SavedImage *)reallocarray(GifFile->SavedImages, + (GifFile->ImageCount + 1), sizeof(SavedImage)); if (GifFile->SavedImages == NULL) return ((SavedImage *)NULL); @@ -379,9 +379,10 @@ } /* next, the raster */ - sp->RasterBits = (unsigned char *)malloc(sizeof(GifPixelType) * - CopyFrom->ImageDesc.Height * - CopyFrom->ImageDesc.Width); + sp->RasterBits = (unsigned char *)reallocarray(NULL, + (CopyFrom->ImageDesc.Height * + CopyFrom->ImageDesc.Width), + sizeof(GifPixelType)); if (sp->RasterBits == NULL) { FreeLastSavedImage(GifFile); return (SavedImage *)(NULL); @@ -392,9 +393,9 @@ /* finally, the extension blocks */ if (sp->ExtensionBlocks != NULL) { - sp->ExtensionBlocks = (ExtensionBlock *)malloc( - sizeof(ExtensionBlock) * - CopyFrom->ExtensionBlockCount); + sp->ExtensionBlocks = (ExtensionBlock *)reallocarray(NULL, + CopyFrom->ExtensionBlockCount, + sizeof(ExtensionBlock)); if (sp->ExtensionBlocks == NULL) { FreeLastSavedImage(GifFile); return (SavedImage *)(NULL); diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/share/native/libsplashscreen/giflib/openbsd-reallocarray.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/src/java.desktop/share/native/libsplashscreen/giflib/openbsd-reallocarray.c Fri Sep 02 02:41:37 2016 +0000 @@ -0,0 +1,106 @@ +/* + * 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. + */ + +/* $OpenBSD: reallocarray.c,v 1.1 2014/05/08 21:43:49 deraadt Exp $ */ +/* + * Copyright (c) 2008 Otto Moerbeek + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#include +#include +#include +#include + +/* + * This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX + * if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW + */ +#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4)) + +void * +reallocarray(void *optr, size_t nmemb, size_t size) +{ + if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && + nmemb > 0 && SIZE_MAX / nmemb < size) { + errno = ENOMEM; + return NULL; + } + /* + * Head off variations in realloc behavior on different + * platforms (reported by MarkR ) + * + * The behaviour of reallocarray is implementation-defined if + * nmemb or size is zero. It can return NULL or non-NULL + * depending on the platform. + * https://www.securecoding.cert.org/confluence/display/c/MEM04-C.Beware+of+zero-lengthallocations + * + * Here are some extracts from realloc man pages on different platforms. + * + * void realloc( void memblock, size_t size ); + * + * Windows: + * + * If there is not enough available memory to expand the block + * to the given size, the original block is left unchanged, + * and NULL is returned. If size is zero, then the block + * pointed to by memblock is freed; the return value is NULL, + * and memblock is left pointing at a freed block. + * + * OpenBSD: + * + * If size or nmemb is equal to 0, a unique pointer to an + * access protected, zero sized object is returned. Access via + * this pointer will generate a SIGSEGV exception. + * + * Linux: + * + * If size was equal to 0, either NULL or a pointer suitable + * to be passed to free() is returned. + * + * OS X: + * + * If size is zero and ptr is not NULL, a new, minimum sized + * object is allocated and the original object is freed. + * + * It looks like images with zero width or height can trigger + * this, and fuzzing behaviour will differ by platform, so + * fuzzing on one platform may not detect zero-size allocation + * problems on other platforms. + */ + if (size == 0 || nmemb == 0) + return NULL; + return realloc(optr, size * nmemb); +} diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java Fri Sep 02 02:41:37 2016 +0000 @@ -57,8 +57,6 @@ import java.awt.image.VolatileImage; import java.awt.peer.ComponentPeer; import java.awt.peer.ContainerPeer; -import java.lang.reflect.*; -import java.security.*; import java.util.Collection; import java.util.Objects; import java.util.Set; @@ -241,46 +239,8 @@ return false; } - private static Class seClass; - private static Constructor seCtor; - static final AWTEvent wrapInSequenced(AWTEvent event) { - try { - if (seClass == null) { - seClass = Class.forName("java.awt.SequencedEvent"); - } - - if (seCtor == null) { - seCtor = AccessController.doPrivileged(new - PrivilegedExceptionAction>() { - public Constructor run() throws Exception { - Constructor ctor = seClass.getConstructor( - new Class[] { AWTEvent.class }); - ctor.setAccessible(true); - return ctor; - } - }); - } - - return (AWTEvent) seCtor.newInstance(new Object[] { event }); - } - catch (ClassNotFoundException e) { - throw new NoClassDefFoundError("java.awt.SequencedEvent."); - } - catch (PrivilegedActionException ex) { - throw new NoClassDefFoundError("java.awt.SequencedEvent."); - } - catch (InstantiationException e) { - assert false; - } - catch (IllegalAccessException e) { - assert false; - } - catch (InvocationTargetException e) { - assert false; - } - - return null; + return AWTAccessor.getSequencedEventAccessor().create(event); } // TODO: consider moving it to KeyboardFocusManagerPeerImpl diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/unix/classes/sun/awt/X11/XMouseDragGestureRecognizer.java --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMouseDragGestureRecognizer.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XMouseDragGestureRecognizer.java Fri Sep 02 02:41:37 2016 +0000 @@ -36,10 +36,6 @@ import java.awt.event.InputEvent; import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.awt.event.MouseMotionListener; - -import java.lang.reflect.*; import sun.awt.dnd.SunDragSourceContextPeer; diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java --- a/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java Fri Sep 02 02:41:37 2016 +0000 @@ -32,8 +32,6 @@ import java.lang.ref.WeakReference; -import java.lang.reflect.Method; - import sun.awt.AWTAccessor.ComponentAccessor; import sun.util.logging.PlatformLogger; @@ -395,7 +393,6 @@ return false; } - static Method m_sendMessage; static void sendEvent(final AWTEvent e) { // The uses of this method imply that the incoming event is system-generated SunToolkit.setSystemGenerated(e); diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java --- a/jdk/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/unix/classes/sun/print/UnixPrintJob.java Fri Sep 02 02:41:37 2016 +0000 @@ -41,14 +41,12 @@ import java.io.PrintWriter; import java.io.Reader; import java.io.StringWriter; -import java.io.UnsupportedEncodingException; import java.nio.file.Files; import java.util.Vector; import javax.print.CancelablePrintJob; import javax.print.Doc; import javax.print.DocFlavor; -import javax.print.DocPrintJob; import javax.print.PrintService; import javax.print.PrintException; import javax.print.event.PrintJobEvent; @@ -56,7 +54,6 @@ import javax.print.event.PrintJobAttributeListener; import javax.print.attribute.Attribute; -import javax.print.attribute.AttributeSet; import javax.print.attribute.AttributeSetUtilities; import javax.print.attribute.DocAttributeSet; import javax.print.attribute.HashPrintJobAttributeSet; @@ -65,7 +62,6 @@ import javax.print.attribute.PrintJobAttributeSet; import javax.print.attribute.PrintRequestAttribute; import javax.print.attribute.PrintRequestAttributeSet; -import javax.print.attribute.PrintServiceAttributeSet; import javax.print.attribute.standard.Copies; import javax.print.attribute.standard.Destination; import javax.print.attribute.standard.DocumentName; @@ -77,13 +73,17 @@ import javax.print.attribute.standard.MediaSize; import javax.print.attribute.standard.MediaSizeName; import javax.print.attribute.standard.OrientationRequested; -import javax.print.attribute.standard.PrinterName; import javax.print.attribute.standard.RequestingUserName; import javax.print.attribute.standard.NumberUp; import javax.print.attribute.standard.Sides; import javax.print.attribute.standard.PrinterIsAcceptingJobs; -import java.awt.print.*; +import java.awt.print.PageFormat; +import java.awt.print.PrinterJob; +import java.awt.print.Pageable; +import java.awt.print.Paper; +import java.awt.print.Printable; +import java.awt.print.PrinterException; @@ -370,7 +370,7 @@ customTray instanceof CustomMediaTray) { String choice = customTray.getChoiceName(); if (choice != null) { - mOptions += " media="+choice; + mOptions += " InputSlot="+choice; } } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/unix/native/common/awt/awt_DrawingSurface.h --- a/jdk/src/java.desktop/unix/native/common/awt/awt_DrawingSurface.h Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/unix/native/common/awt/awt_DrawingSurface.h Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, 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 @@ -28,7 +28,6 @@ #include #include -#include _JNI_IMPORT_OR_EXPORT_ JAWT_DrawingSurface* JNICALL awt_GetDrawingSurface(JNIEnv* env, jobject target); @@ -45,4 +44,14 @@ _JNI_IMPORT_OR_EXPORT_ jobject JNICALL awt_GetComponent(JNIEnv* env, void* platformInfo); +_JNI_IMPORT_OR_EXPORT_ jobject JNICALL + awt_CreateEmbeddedFrame(JNIEnv* env, void* platformInfo); + +_JNI_IMPORT_OR_EXPORT_ void JNICALL + awt_SetBounds(JNIEnv *env, jobject embeddedFrame, jint x, jint y, + jint w, jint h); + +_JNI_IMPORT_OR_EXPORT_ void JNICALL + awt_SynthesizeWindowActivation(JNIEnv *env, jobject embeddedFrame, + jboolean doActivate); #endif /* !_AWT_DRAWING_SURFACE_H_ */ diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_DrawingSurface.c --- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_DrawingSurface.c Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/awt_DrawingSurface.c Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, 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 @@ -383,3 +383,48 @@ return target; } + +// EmbeddedFrame support + +static char *const embeddedClassName = "sun/awt/X11/XEmbeddedFrame"; + +JNIEXPORT jobject JNICALL awt_CreateEmbeddedFrame +(JNIEnv* env, void* platformInfo) +{ + static jmethodID mid = NULL; + static jclass cls; + if (mid == NULL) { + cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL_RETURN(cls, NULL); + mid = (*env)->GetMethodID(env, cls, "", "(JZ)V"); + CHECK_NULL_RETURN(mid, NULL); + } + return (*env)->NewObject(env, cls, mid, platformInfo, JNI_TRUE); +} + + +JNIEXPORT void JNICALL awt_SetBounds +(JNIEnv *env, jobject embeddedFrame, jint x, jint y, jint w, jint h) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL(cls); + mid = (*env)->GetMethodID(env, cls, "setBoundsPrivate", "(IIII)V"); + CHECK_NULL(mid); + } + (*env)->CallVoidMethod(env, embeddedFrame, mid, x, y, w, h); +} + +JNIEXPORT void JNICALL awt_SynthesizeWindowActivation +(JNIEnv *env, jobject embeddedFrame, jboolean doActivate) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = (*env)->FindClass(env, embeddedClassName); + CHECK_NULL(cls); + mid = (*env)->GetMethodID(env, cls, "synthesizeWindowActivation", "(Z)V"); + CHECK_NULL(mid); + } + (*env)->CallVoidMethod(env, embeddedFrame, mid, doActivate); +} diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/unix/native/libjawt/jawt.c --- a/jdk/src/java.desktop/unix/native/libjawt/jawt.c Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/unix/native/libjawt/jawt.c Fri Sep 02 02:41:37 2016 +0000 @@ -45,7 +45,8 @@ if (awt->version != JAWT_VERSION_1_3 && awt->version != JAWT_VERSION_1_4 - && awt->version != JAWT_VERSION_1_7) { + && awt->version != JAWT_VERSION_1_7 + && awt->version != JAWT_VERSION_9) { return JNI_FALSE; } @@ -55,6 +56,11 @@ awt->Lock = awt_Lock; awt->Unlock = awt_Unlock; awt->GetComponent = awt_GetComponent; + if (awt->version >= JAWT_VERSION_9) { + awt->CreateEmbeddedFrame = awt_CreateEmbeddedFrame; + awt->SetBounds = awt_SetBounds; + awt->SynthesizeWindowActivation = awt_SynthesizeWindowActivation; + } } return JNI_TRUE; diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.cpp --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.cpp Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.cpp Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2016, 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 @@ -272,3 +272,47 @@ { // Do nothing on Windows } + +// EmbeddedFrame support + +static char *const embeddedClassName = "sun/awt/windows/WEmbeddedFrame"; + +JNIEXPORT jobject JNICALL awt_CreateEmbeddedFrame +(JNIEnv* env, void* platformInfo) +{ + static jmethodID mid = NULL; + static jclass cls; + if (mid == NULL) { + cls = env->FindClass(embeddedClassName); + CHECK_NULL_RETURN(cls, NULL); + mid = env->GetMethodID(cls, "", "(J)V"); + CHECK_NULL_RETURN(mid, NULL); + } + return env->NewObject(cls, mid, platformInfo); +} + +JNIEXPORT void JNICALL awt_SetBounds +(JNIEnv *env, jobject embeddedFrame, jint x, jint y, jint w, jint h) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = env->FindClass(embeddedClassName); + CHECK_NULL(cls); + mid = env->GetMethodID(cls, "setBoundsPrivate", "(IIII)V"); + CHECK_NULL(mid); + } + env->CallVoidMethod(embeddedFrame, mid, x, y, w, h); +} + +JNIEXPORT void JNICALL awt_SynthesizeWindowActivation +(JNIEnv *env, jobject embeddedFrame, jboolean doActivate) +{ + static jmethodID mid = NULL; + if (mid == NULL) { + jclass cls = env->FindClass(embeddedClassName); + CHECK_NULL(cls); + mid = env->GetMethodID(cls, "synthesizeWindowActivation", "(Z)V"); + CHECK_NULL(mid); + } + env->CallVoidMethod(embeddedFrame, mid, doActivate); +} diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.h --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.h Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_DrawingSurface.h Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2016, 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 @@ -162,6 +162,16 @@ jobject JNICALL DSGetComponent( JNIEnv* env, void* platformInfo); + _JNI_IMPORT_OR_EXPORT_ jobject JNICALL + awt_CreateEmbeddedFrame(JNIEnv* env, void* platformInfo); + + _JNI_IMPORT_OR_EXPORT_ void JNICALL + awt_SetBounds(JNIEnv *env, jobject embeddedFrame, jint x, + jint y, jint w, jint h); + + _JNI_IMPORT_OR_EXPORT_ void JNICALL + awt_SynthesizeWindowActivation(JNIEnv *env, jobject embeddedFrame, + jboolean doActivate); #ifdef __cplusplus } /* extern "C" */ #endif diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp --- a/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt_PrintControl.cpp Fri Sep 02 02:41:37 2016 +0000 @@ -1132,7 +1132,7 @@ if (dwRet != IDOK) { /* if failure, cleanup and return failure */ - GlobalFree(pDevMode); + GlobalFree(*pDevMode); *pDevMode = NULL; return FALSE; } diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.desktop/windows/native/libjawt/jawt.cpp --- a/jdk/src/java.desktop/windows/native/libjawt/jawt.cpp Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.desktop/windows/native/libjawt/jawt.cpp Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,9 @@ } if (awt->version != JAWT_VERSION_1_3 - && awt->version != JAWT_VERSION_1_4) { + && awt->version != JAWT_VERSION_1_4 + && awt->version != JAWT_VERSION_1_7 + && awt->version != JAWT_VERSION_9) { return JNI_FALSE; } @@ -56,6 +58,11 @@ awt->Lock = DSLockAWT; awt->Unlock = DSUnlockAWT; awt->GetComponent = DSGetComponent; + if (awt->version >= JAWT_VERSION_9) { + awt->CreateEmbeddedFrame = awt_CreateEmbeddedFrame; + awt->SetBounds = awt_SetBounds; + awt->SynthesizeWindowActivation = awt_SynthesizeWindowActivation; + } } return JNI_TRUE; diff -r b079fff22b3c -r de9ff562c112 jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/TerminalImpl.java --- a/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/TerminalImpl.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/java.smartcardio/share/classes/sun/security/smartcardio/TerminalImpl.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -75,10 +75,10 @@ } } try { - card = new CardImpl(this, protocol); + card = new CardImpl(this, protocol); return card; } catch (PCSCException e) { - if (e.code == SCARD_W_REMOVED_CARD) { + if (e.code == SCARD_W_REMOVED_CARD || e.code == SCARD_E_NO_SMARTCARD) { throw new CardNotPresentException("No card present", e); } else { throw new CardException("connect() failed", e); diff -r b079fff22b3c -r de9ff562c112 jdk/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java --- a/jdk/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/jdk.attach/aix/classes/sun/tools/attach/VirtualMachineImpl.java Fri Sep 02 02:41:37 2016 +0000 @@ -76,20 +76,29 @@ sendQuitTo(pid); // give the target VM time to start the attach mechanism - int i = 0; - long delay = 200; - int retries = (int)(attachTimeout() / delay); + final int delay_step = 100; + final long timeout = attachTimeout(); + long time_spend = 0; + long delay = 0; do { + // Increase timeout on each attempt to reduce polling + delay += delay_step; try { Thread.sleep(delay); } catch (InterruptedException x) { } path = findSocketFile(pid); - i++; - } while (i <= retries && path == null); + + time_spend += delay; + if (time_spend > timeout/2 && path == null) { + // Send QUIT again to give target VM the last chance to react + sendQuitTo(pid); + } + } while (time_spend <= timeout && path == null); if (path == null) { throw new AttachNotSupportedException( - "Unable to open socket file: target process not responding " + - "or HotSpot VM not loaded"); + String.format("Unable to open socket file %s: " + + "target process %d doesn't respond within %dms " + + "or HotSpot VM not loaded", f.getPath(), pid, time_spend)); } } finally { f.delete(); diff -r b079fff22b3c -r de9ff562c112 jdk/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java --- a/jdk/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/jdk.attach/linux/classes/sun/tools/attach/VirtualMachineImpl.java Fri Sep 02 02:41:37 2016 +0000 @@ -44,9 +44,6 @@ // Any changes to this needs to be synchronized with HotSpot. private static final String tmpdir = "/tmp"; - // Indicates if this machine uses the old LinuxThreads - static boolean isLinuxThreads; - // The patch to the socket file created by the target VM String path; @@ -73,44 +70,37 @@ if (path == null) { File f = createAttachFile(pid); try { - // On LinuxThreads each thread is a process and we don't have the - // pid of the VMThread which has SIGQUIT unblocked. To workaround - // this we get the pid of the "manager thread" that is created - // by the first call to pthread_create. This is parent of all - // threads (except the initial thread). - if (isLinuxThreads) { - int mpid; - try { - mpid = getLinuxThreadsManager(pid); - } catch (IOException x) { - throw new AttachNotSupportedException(x.getMessage()); - } - assert(mpid >= 1); - sendQuitToChildrenOf(mpid); - } else { - sendQuitTo(pid); - } + sendQuitTo(pid); // give the target VM time to start the attach mechanism - int i = 0; - long delay = 200; - int retries = (int)(attachTimeout() / delay); + final int delay_step = 100; + final long timeout = attachTimeout(); + long time_spend = 0; + long delay = 0; do { + // Increase timeout on each attempt to reduce polling + delay += delay_step; try { Thread.sleep(delay); } catch (InterruptedException x) { } path = findSocketFile(pid); - i++; - } while (i <= retries && path == null); + + time_spend += delay; + if (time_spend > timeout/2 && path == null) { + // Send QUIT again to give target VM the last chance to react + sendQuitTo(pid); + } + } while (time_spend <= timeout && path == null); if (path == null) { throw new AttachNotSupportedException( - "Unable to open socket file: target process not responding " + - "or HotSpot VM not loaded"); + String.format("Unable to open socket file %s: " + + "target process %d doesn't respond within %dms " + + "or HotSpot VM not loaded", f.getPath(), pid, time_spend)); } } finally { f.delete(); } - } + } // Check that the file owner/permission to avoid attaching to // bogus process @@ -340,6 +330,5 @@ static { System.loadLibrary("attach"); - isLinuxThreads = isLinuxThreads(); } } diff -r b079fff22b3c -r de9ff562c112 jdk/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java --- a/jdk/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/jdk.attach/macosx/classes/sun/tools/attach/VirtualMachineImpl.java Fri Sep 02 02:41:37 2016 +0000 @@ -70,26 +70,34 @@ // Then we attempt to find the socket file again. path = findSocketFile(pid); if (path == null) { - File f = new File(tmpdir, ".attach_pid" + pid); - createAttachFile(f.getPath()); + File f = createAttachFile(pid); try { sendQuitTo(pid); // give the target VM time to start the attach mechanism - int i = 0; - long delay = 200; - int retries = (int)(attachTimeout() / delay); + final int delay_step = 100; + final long timeout = attachTimeout(); + long time_spend = 0; + long delay = 0; do { + // Increase timeout on each attempt to reduce polling + delay += delay_step; try { Thread.sleep(delay); } catch (InterruptedException x) { } path = findSocketFile(pid); - i++; - } while (i <= retries && path == null); + + time_spend += delay; + if (time_spend > timeout/2 && path == null) { + // Send QUIT again to give target VM the last chance to react + sendQuitTo(pid); + } + } while (time_spend <= timeout && path == null); if (path == null) { throw new AttachNotSupportedException( - "Unable to open socket file: target process not responding " + - "or HotSpot VM not loaded"); + String.format("Unable to open socket file %s: " + + "target process %d doesn't respond within %dms " + + "or HotSpot VM not loaded", f.getPath(), pid, time_spend)); } } finally { f.delete(); @@ -282,6 +290,12 @@ write(fd, b, 0, 1); } + private File createAttachFile(int pid) throws IOException { + String fn = ".attach_pid" + pid; + File f = new File(tmpdir, fn); + createAttachFile0(f.getPath()); + return f; + } //-- native methods @@ -299,7 +313,7 @@ static native void write(int fd, byte buf[], int off, int bufLen) throws IOException; - static native void createAttachFile(String path); + static native void createAttachFile0(String path); static native String getTempDir(); diff -r b079fff22b3c -r de9ff562c112 jdk/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c --- a/jdk/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/jdk.attach/macosx/native/libattach/VirtualMachineImpl.c Fri Sep 02 02:41:37 2016 +0000 @@ -270,7 +270,7 @@ * Method: createAttachFile * Signature: (Ljava.lang.String;)V */ -JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_createAttachFile(JNIEnv *env, jclass cls, jstring path) +JNIEXPORT void JNICALL Java_sun_tools_attach_VirtualMachineImpl_createAttachFile0(JNIEnv *env, jclass cls, jstring path) { const char* _path; jboolean isCopy; diff -r b079fff22b3c -r de9ff562c112 jdk/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java --- a/jdk/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/jdk.attach/share/classes/sun/tools/attach/HotSpotVirtualMachine.java Fri Sep 02 02:41:37 2016 +0000 @@ -319,7 +319,7 @@ // -- attach timeout support - private static long defaultAttachTimeout = 5000; + private static long defaultAttachTimeout = 10000; private volatile long attachTimeout; /* diff -r b079fff22b3c -r de9ff562c112 jdk/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java --- a/jdk/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/jdk.attach/solaris/classes/sun/tools/attach/VirtualMachineImpl.java Fri Sep 02 02:41:37 2016 +0000 @@ -71,27 +71,36 @@ } catch (FileNotFoundException fnf1) { File f = createAttachFile(pid); try { - // kill -QUIT will tickle target VM to check for the - // attach file. sigquit(pid); // give the target VM time to start the attach mechanism - int i = 0; - long delay = 200; - int retries = (int)(attachTimeout() / delay); + final int delay_step = 100; + final long timeout = attachTimeout(); + long time_spend = 0; + long delay = 0; do { + // Increase timeout on each attempt to reduce polling + delay += delay_step; try { Thread.sleep(delay); } catch (InterruptedException x) { } try { fd = openDoor(pid); - } catch (FileNotFoundException fnf2) { } - i++; - } while (i <= retries && fd == -1); - if (fd == -1) { + } catch (FileNotFoundException fnf2) { + // pass + } + + time_spend += delay; + if (time_spend > timeout/2 && fd == -1) { + // Send QUIT again to give target VM the last chance to react + sigquit(pid); + } + } while (time_spend <= timeout && fd == -1); + if (fd == -1) { throw new AttachNotSupportedException( - "Unable to open door: target process not responding or " + - "HotSpot VM not loaded"); + String.format("Unable to open door %s: " + + "target process %d doesn't respond within %dms " + + "or HotSpot VM not loaded", f.getPath(), pid, time_spend)); } } finally { f.delete(); diff -r b079fff22b3c -r de9ff562c112 jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java --- a/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/jdk.internal.le/share/classes/jdk/internal/jline/console/ConsoleReader.java Fri Sep 02 02:41:37 2016 +0000 @@ -39,6 +39,7 @@ //import java.util.Map; import java.util.ResourceBundle; import java.util.Stack; +import java.util.regex.Matcher; import java.util.regex.Pattern; import jdk.internal.jline.Terminal; @@ -2336,6 +2337,33 @@ out.flush(); } + Stack pushBackChar = new Stack(); + + if (terminal.isAnsiSupported()) { + //detect the prompt length by reading the cursor position from the terminal + //the real prompt length could differ from the simple prompt length due to + //use of escape sequences: + out.write("\033[6n"); + out.flush(); + StringBuilder input = new StringBuilder(); + while (true) { + int read; + while ((read = in.read()) != 'R') { + input.appendCodePoint(read); + } + input.appendCodePoint(read); + Matcher m = CURSOR_COLUMN_PATTERN.matcher(input); + if (m.matches()) { + promptLen = Integer.parseInt(m.group("column")) - 1; + String prefix = m.group("prefix"); + for (int i = prefix.length() - 1; i >= 0; i--) { + pushBackChar.push(prefix.charAt(i)); + } + break; + } + } + } + // if the terminal is unsupported, just use plain-java reading if (!terminal.isSupported()) { return readLineSimple(); @@ -2352,7 +2380,6 @@ boolean success = true; StringBuilder sb = new StringBuilder(); - Stack pushBackChar = new Stack(); while (true) { int c = pushBackChar.isEmpty() ? readCharacter() : pushBackChar.pop (); if (c == -1) { @@ -3193,6 +3220,9 @@ } } } + //where: + private Pattern CURSOR_COLUMN_PATTERN = + Pattern.compile("(?.*)\033\\[[0-9]+;(?[0-9]+)R"); /** * Read a line for unsupported terminals. diff -r b079fff22b3c -r de9ff562c112 jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/plugins/GenerateJLIClassesPlugin.java Fri Sep 02 02:41:37 2016 +0000 @@ -29,12 +29,12 @@ import java.lang.invoke.MethodType; import java.nio.file.Files; import java.util.ArrayList; -import java.util.Arrays; import java.util.EnumSet; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.TreeMap; +import java.util.TreeSet; import java.util.stream.Collectors; import java.util.stream.Stream; import jdk.internal.misc.SharedSecrets; @@ -69,11 +69,11 @@ private static final JavaLangInvokeAccess JLIA = SharedSecrets.getJavaLangInvokeAccess(); - List speciesTypes; + Set speciesTypes; - List invokerTypes; + Set invokerTypes; - Map> dmhMethods; + Map> dmhMethods; public GenerateJLIClassesPlugin() { } @@ -110,8 +110,8 @@ * A better long-term solution is to define and run a set of quick * generators and extracting this list as a step in the build process. */ - public static List defaultSpecies() { - return List.of("LL", "L3", "L4", "L5", "L6", "L7", "L7I", + public static Set defaultSpecies() { + return Set.of("LL", "L3", "L4", "L5", "L6", "L7", "L7I", "L7II", "L7IIL", "L8", "L9", "L10", "L10I", "L10II", "L10IIL", "L11", "L12", "L13", "LI", "D", "L3I", "LIL", "LLI", "LLIL", "LILL", "I", "LLILL"); @@ -120,23 +120,23 @@ /** * @return the default invoker forms to generate. */ - private static List defaultInvokers() { - return List.of("LL_L", "LL_I", "LILL_I", "L6_L"); + private static Set defaultInvokers() { + return Set.of("LL_L", "LL_I", "LILL_I", "L6_L"); } /** * @return the list of default DirectMethodHandle methods to generate. */ - private static Map> defaultDMHMethods() { + private static Map> defaultDMHMethods() { return Map.of( - DMH_INVOKE_VIRTUAL, List.of("L_L", "LL_L", "LLI_I", "L3_V"), - DMH_INVOKE_SPECIAL, List.of("LL_I", "LL_L", "LLF_L", "LLD_L", "L3_L", + DMH_INVOKE_VIRTUAL, Set.of("L_L", "LL_L", "LLI_I", "L3_V"), + DMH_INVOKE_SPECIAL, Set.of("LL_I", "LL_L", "LLF_L", "LLD_L", "L3_L", "L4_L", "L5_L", "L6_L", "L7_L", "L8_L", "LLI_I", "LLI_L", "LLIL_I", "LLII_I", "LLII_L", "L3I_L", "L3I_I", "LLILI_I", "LLIIL_L", "LLIILL_L", "LLIILL_I", "LLIIL_I", "LLILIL_I", "LLILILL_I", "LLILII_I", "LLI3_I", "LLI3L_I", "LLI3LL_I", "LLI3_L", "LLI4_I"), - DMH_INVOKE_STATIC, List.of("LII_I", "LIL_I", "LILIL_I", "LILII_I", + DMH_INVOKE_STATIC, Set.of("LII_I", "LIL_I", "LILIL_I", "LILII_I", "L_I", "L_L", "L_V", "LD_L", "LF_L", "LI_I", "LII_L", "LLI_L", "LL_V", "LL_L", "L3_L", "L4_L", "L5_L", "L6_L", "L7_L", "L8_L", "L9_L", "L10_L", "L10I_L", "L10II_L", "L10IIL_L", @@ -159,15 +159,48 @@ public void configure(Map config) { String mainArgument = config.get(NAME); - if (mainArgument != null && mainArgument.startsWith("@")) { + if ("none".equals(mainArgument)) { + speciesTypes = Set.of(); + invokerTypes = Set.of(); + dmhMethods = Map.of(); + return; + } + + // Start with the default configuration + Set defaultBMHSpecies = defaultSpecies(); + // Expand BMH species signatures + defaultBMHSpecies = defaultBMHSpecies.stream() + .map(type -> expandSignature(type)) + .collect(Collectors.toSet()); + + Set defaultInvokerTypes = defaultInvokers(); + validateMethodTypes(defaultInvokerTypes); + + Map> defaultDmhMethods = defaultDMHMethods(); + for (Set dmhMethodTypes : defaultDmhMethods.values()) { + validateMethodTypes(dmhMethodTypes); + } + + // Extend the default configuration with the contents in the supplied + // input file + if (mainArgument == null || !mainArgument.startsWith("@")) { + speciesTypes = defaultBMHSpecies; + invokerTypes = defaultInvokerTypes; + dmhMethods = defaultDmhMethods; + } else { File file = new File(mainArgument.substring(1)); if (file.exists()) { - speciesTypes = new ArrayList<>(); - invokerTypes = new ArrayList<>(); - dmhMethods = new HashMap<>(); - Stream lines = fileLines(file); - - lines.map(line -> line.split(" ")) + // Use TreeSet/TreeMap to keep things sorted in a deterministic + // order to avoid scrambling the layout on small changes and to + // ease finding methods in the generated code + speciesTypes = new TreeSet<>(defaultBMHSpecies); + invokerTypes = new TreeSet<>(defaultInvokerTypes); + dmhMethods = new TreeMap<>(); + for (Map.Entry> entry : defaultDmhMethods.entrySet()) { + dmhMethods.put(entry.getKey(), new TreeSet<>(entry.getValue())); + } + fileLines(file) + .map(line -> line.split(" ")) .forEach(parts -> { switch (parts[0]) { case "[BMH_RESOLVE]": @@ -191,28 +224,14 @@ } }); } - } else { - List bmhSpecies = defaultSpecies(); - // Expand BMH species signatures - speciesTypes = bmhSpecies.stream() - .map(type -> expandSignature(type)) - .collect(Collectors.toList()); - - invokerTypes = defaultInvokers(); - validateMethodTypes(invokerTypes); - - dmhMethods = defaultDMHMethods(); - for (List dmhMethodTypes : dmhMethods.values()) { - validateMethodTypes(dmhMethodTypes); - } } } private void addDMHMethodType(String dmh, String methodType) { validateMethodType(methodType); - List methodTypes = dmhMethods.get(dmh); + Set methodTypes = dmhMethods.get(dmh); if (methodTypes == null) { - methodTypes = new ArrayList<>(); + methodTypes = new TreeSet<>(); dmhMethods.put(dmh, methodTypes); } methodTypes.add(methodType); @@ -226,7 +245,7 @@ } } - private void validateMethodTypes(List dmhMethodTypes) { + private void validateMethodTypes(Set dmhMethodTypes) { for (String type : dmhMethodTypes) { validateMethodType(type); } @@ -291,13 +310,13 @@ private void generateHolderClasses(ResourcePoolBuilder out) { int count = 0; - for (List entry : dmhMethods.values()) { + for (Set entry : dmhMethods.values()) { count += entry.size(); } MethodType[] directMethodTypes = new MethodType[count]; int[] dmhTypes = new int[count]; int index = 0; - for (Map.Entry> entry : dmhMethods.entrySet()) { + for (Map.Entry> entry : dmhMethods.entrySet()) { String dmhType = entry.getKey(); for (String type : entry.getValue()) { // The DMH type to actually ask for is retrieved by removing @@ -314,10 +333,11 @@ } } MethodType[] invokerMethodTypes = new MethodType[this.invokerTypes.size()]; - for (int i = 0; i < invokerTypes.size(); i++) { + int i = 0; + for (String invokerType : invokerTypes) { // The invoker type to ask for is retrieved by removing the first // and the last argument, which needs to be of Object.class - MethodType mt = asMethodType(invokerTypes.get(i)); + MethodType mt = asMethodType(invokerType); final int lastParam = mt.parameterCount() - 1; if (mt.parameterCount() < 2 || mt.parameterType(0) != Object.class || @@ -327,6 +347,7 @@ } mt = mt.dropParameterTypes(lastParam, lastParam + 1); invokerMethodTypes[i] = mt.dropParameterTypes(0, 1); + i++; } try { byte[] bytes = JLIA.generateDirectMethodHandleHolderClassBytes( diff -r b079fff22b3c -r de9ff562c112 jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties --- a/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/jdk.jlink/share/classes/jdk/tools/jlink/resources/plugins.properties Fri Sep 02 02:41:37 2016 +0000 @@ -68,12 +68,12 @@ exclude-resources.description=\ Specify resources to exclude. e.g.: **.jcov,glob:**/META-INF/** -generate-jli-classes.argument=<@filename> +generate-jli-classes.argument= generate-jli-classes.description=\ Takes a file hinting to jlink what java.lang.invoke classes to pre-generate. If\n\ -this flag is not specified a default set of classes will be generated, so to \n\ -disable pre-generation supply the name of an empty or non-existing file +this flag is not specified a default set of classes will be generated. To \n\ +disable pre-generation specify none as the argument installed-modules.description=Fast loading of module descriptors (always enabled) diff -r b079fff22b3c -r de9ff562c112 jdk/src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c --- a/jdk/src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/src/jdk.management/share/native/libmanagement_ext/GcInfoBuilder.c Fri Sep 02 02:41:37 2016 +0000 @@ -87,9 +87,32 @@ for (i = 0; i < num_attributes; i++) { nativeTypes[i] = ext_att_info[i].type; attName = (*env)->NewStringUTF(env, ext_att_info[i].name); - desc = (*env)->NewStringUTF(env, ext_att_info[i].description); + if ((*env)->ExceptionCheck(env)) { + free(ext_att_info); + free(nativeTypes); + return; + } + (*env)->SetObjectArrayElement(env, attributeNames, i, attName); + if ((*env)->ExceptionCheck(env)) { + free(ext_att_info); + free(nativeTypes); + return; + } + + desc = (*env)->NewStringUTF(env, ext_att_info[i].description); + if ((*env)->ExceptionCheck(env)) { + free(ext_att_info); + free(nativeTypes); + return; + } + (*env)->SetObjectArrayElement(env, descriptions, i, desc); + if ((*env)->ExceptionCheck(env)) { + free(ext_att_info); + free(nativeTypes); + return; + } } (*env)->SetCharArrayRegion(env, types, 0, num_attributes, nativeTypes); diff -r b079fff22b3c -r de9ff562c112 jdk/test/ProblemList.txt --- a/jdk/test/ProblemList.txt Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/ProblemList.txt Fri Sep 02 02:41:37 2016 +0000 @@ -213,8 +213,6 @@ sun/security/pkcs11/ec/TestKeyFactory.java 8026976 generic-all -sun/security/krb5/auto/Unreachable.java 7164518 macosx-all - sun/security/tools/keytool/ListKeychainStore.sh 8156889 macosx-all sun/security/tools/jarsigner/warnings/BadKeyUsageTest.java 8026393 generic-all diff -r b079fff22b3c -r de9ff562c112 jdk/test/TEST.groups --- a/jdk/test/TEST.groups Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/TEST.groups Fri Sep 02 02:41:37 2016 +0000 @@ -189,7 +189,6 @@ -sun/security/krb5 \ -sun/security/jgss \ javax/net \ - sun/net/www/protocol/https \ com/sun/net/ssl \ lib/security diff -r b079fff22b3c -r de9ff562c112 jdk/test/com/sun/jdi/SunBootClassPathEmptyTest.java --- a/jdk/test/com/sun/jdi/SunBootClassPathEmptyTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/com/sun/jdi/SunBootClassPathEmptyTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -32,7 +32,7 @@ * @summary Verifies that PathSearchingVirtualMachine.bootClassPath() * returns an empty list in case no bootclass path specified * regardless of sun.boot.class.path option, which is now obsolete - * @library /test/lib/share/classes + * @library /test/lib * @compile TestClass.java * @compile SunBootClassPathEmptyTest.java * @run main/othervm SunBootClassPathEmptyTest diff -r b079fff22b3c -r de9ff562c112 jdk/test/com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.java --- a/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/com/sun/management/HotSpotDiagnosticMXBean/DumpHeap.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2016, 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 @@ -38,7 +38,7 @@ * @bug 6455258 * @summary Sanity test for com.sun.management.HotSpotDiagnosticMXBean.dumpHeap method * @library /lib/testlibrary - * @library /test/lib/share/classes + * @library /test/lib * @build jdk.testlibrary.* * @build jdk.test.lib.hprof.* * @build jdk.test.lib.hprof.model.* diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/awt/PrintJob/TestPrintJobFrameAssociation.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/PrintJob/TestPrintJobFrameAssociation.java Fri Sep 02 02:41:37 2016 +0000 @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2016, 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. + * + * 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. + */ +/* + * @test + * @bug 8154218 + * @summary Verifies if owner Frame is associated with print dialog + * @run main/manual TestPrintJobFrameAssociation + */ +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Panel; +import java.awt.JobAttributes; +import java.awt.PrintJob; +import java.awt.Toolkit; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; + +public class TestPrintJobFrameAssociation { + private static Thread mainThread; + private static boolean testPassed; + private static boolean testGeneratedInterrupt; + private static Button print; + private static Label dialogName; + private static Frame frame; + private static boolean start; + private static Thread t; + + public static void main(String args[]) throws Exception { + SwingUtilities.invokeAndWait(() -> { + doTest(TestPrintJobFrameAssociation::frameTest); + }); + mainThread = Thread.currentThread(); + try { + Thread.sleep(60000); + } catch (InterruptedException e) { + if (!testPassed && testGeneratedInterrupt) { + throw new RuntimeException("Print dialog not disposed." + + " Print dialog is not associated with owner Frame`"); + } + } + if (!testGeneratedInterrupt) { + throw new RuntimeException("user has not executed the test"); + } + } + + private static void frameTest() { + Panel panel =new Panel(); + + print = new Button("Print"); + print.setActionCommand("Print"); + print.addActionListener((e) -> { + JobAttributes ja = new JobAttributes(); + ja.setDialog(JobAttributes.DialogType.COMMON); + + t.start(); + start = true; + PrintJob pjob = Toolkit.getDefaultToolkit().getPrintJob(frame, + "Printing Test", + ja,null); + }); + + panel.add(print); + + frame = new Frame("Test Frame"); + frame.setLayout (new BorderLayout ()); + frame.add(panel,"South"); + frame.pack(); + frame.setVisible(true); + + t = new Thread (() -> { + if (start) { + try { + Thread.sleep(5000); + } catch (InterruptedException ex) {} + frame.dispose(); + } + }); + } + + public static synchronized void pass() { + testPassed = true; + testGeneratedInterrupt = true; + mainThread.interrupt(); + } + + public static synchronized void fail() { + testPassed = false; + testGeneratedInterrupt = true; + mainThread.interrupt(); + } + + private static void doTest(Runnable action) { + String description + = " A Frame with Print Button is shown. Press Print.\n" + + " A cross-platform print dialog will be shown. After 5 secs\n" + + " the frame along with this print dialog will be disposed.\n" + + " If the print dialog is not disposed, press FAIL else press PASS"; + + final JDialog dialog = new JDialog(); + dialog.setTitle("printSelectionTest"); + JTextArea textArea = new JTextArea(description); + textArea.setEditable(false); + final JButton testButton = new JButton("Start Test"); + final JButton passButton = new JButton("PASS"); + passButton.setEnabled(false); + passButton.addActionListener((e) -> { + dialog.dispose(); + pass(); + }); + final JButton failButton = new JButton("FAIL"); + failButton.setEnabled(false); + failButton.addActionListener((e) -> { + dialog.dispose(); + fail(); + }); + testButton.addActionListener((e) -> { + testButton.setEnabled(false); + action.run(); + passButton.setEnabled(true); + failButton.setEnabled(true); + }); + JPanel mainPanel = new JPanel(new BorderLayout()); + mainPanel.add(textArea, BorderLayout.CENTER); + JPanel buttonPanel = new JPanel(new FlowLayout()); + buttonPanel.add(testButton); + buttonPanel.add(passButton); + buttonPanel.add(failButton); + mainPanel.add(buttonPanel, BorderLayout.SOUTH); + dialog.add(mainPanel); + dialog.pack(); + dialog.setVisible(true); + dialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + System.out.println("main dialog closing"); + testGeneratedInterrupt = false; + mainThread.interrupt(); + } + }); + + } +} diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/awt/Window/8159168/SetShapeTest.java --- a/jdk/test/java/awt/Window/8159168/SetShapeTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/awt/Window/8159168/SetShapeTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,29 +1,30 @@ /* -* Copyright (c) 2016, 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. -* -* 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. + * Copyright (c) 2016, 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. + * + * 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. */ /** * @test - * @bug 8159168 + * @key headful + * @bug 8159168 8161913 * @summary [hidpi] Window.setShape() works incorrectly on HiDPI * @run main/othervm -Dsun.java2d.uiScale=2 SetShapeTest */ @@ -50,6 +51,7 @@ Rectangle rect = window.getBounds(); rect.x += rect.width - 10; rect.y += rect.height - 10; + robot.delay(1000); Color c = robot.getPixelColor(rect.x, rect.y); try { if (!c.equals(Color.RED)) { diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/awt/Window/OwnedWindowsLeak/OwnedWindowsLeak.java --- a/jdk/test/java/awt/Window/OwnedWindowsLeak/OwnedWindowsLeak.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/awt/Window/OwnedWindowsLeak/OwnedWindowsLeak.java Fri Sep 02 02:41:37 2016 +0000 @@ -27,16 +27,14 @@ @bug 6758673 @summary Tests that windows are removed from owner's child windows list @author art: area=awt.toplevel - @run main OwnedWindowsLeak + @run main/othervm -mx128m OwnedWindowsLeak */ -import java.awt.*; -import java.awt.event.*; - -import java.lang.ref.*; -import java.lang.reflect.*; - -import java.util.*; +import java.awt.Frame; +import java.awt.Window; +import java.lang.ref.WeakReference; +import java.lang.reflect.Field; +import java.util.Vector; public class OwnedWindowsLeak { diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/awt/dnd/URLDragTest/DragLinkFromBrowser.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/dnd/URLDragTest/DragLinkFromBrowser.java Fri Sep 02 02:41:37 2016 +0000 @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2016, 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. + * + * 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. + */ + + /* + @test + @bug 8156099 + @summary Drag and drop of link from web browser, DataFlavor types + application/x-java-url and text/uri-list, getTransferData returns null + @run main/manual DragLinkFromBrowser + */ + +import java.awt.Frame; +import java.awt.Button; +import java.awt.Panel; +import java.awt.TextArea; +import java.awt.Color; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.io.IOException; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.TransferHandler; +import javax.swing.SwingUtilities; +import javax.swing.JOptionPane; + +public class DragLinkFromBrowser implements ActionListener { + + private static GridBagLayout layout; + private static Panel mainControlPanel; + private static Panel resultButtonPanel; + private static TextArea instructionTextArea; + private static Button passButton; + private static Button failButton; + private static Frame mainFrame; + private static Thread mainThread = null; + private static volatile boolean testPassed = false; + private static volatile boolean isInterrupted = false; + private static volatile String failMessage; + private static final int testTimeOut = 300000; + private static JFrame urlFrame; + private static JPanel urlPanel; + + public static void dragLinkFromWebBrowser() { + + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + + urlFrame = new JFrame(); + urlPanel = new JPanel(); + failMessage = "Dragging link from web browser Failed. " + + "getTransferData returns null"; + urlFrame.getContentPane().add(urlPanel); + urlPanel.setTransferHandler(new TransferHandler() { + @Override + public boolean canImport(final TransferSupport support) { + return true; + } + + @Override + public boolean importData(final TransferSupport support) { + final Transferable transferable = + support.getTransferable(); + final DataFlavor[] flavors + = transferable.getTransferDataFlavors(); + + for (final DataFlavor flavor : flavors) { + try { + final Object transferData + = transferable.getTransferData(flavor); + + if (transferData == null) { + JOptionPane.showMessageDialog(urlPanel, + failMessage); + break; + } else { + String flavorMessage = flavor.toString(); + String transferDataMessage = + transferData.toString(); + if (flavorMessage.contains("error") + || transferDataMessage.contains("null")) { + JOptionPane.showMessageDialog(urlPanel, + failMessage); + break; + } + } + } catch (UnsupportedFlavorException e) { + testFailed("UnsupportedFlavorException - " + + "test Failed"); + } catch (IOException e) { + testFailed("IOException - test Failed"); + } + } + + return true; + } + }); + + urlFrame.setBounds(500, 10, 200, 200); + urlFrame.setVisible(true); + } + }); + } + + private void createInstructionUI() { + mainFrame = new Frame("Drag and drop link from web browser"); + layout = new GridBagLayout(); + mainControlPanel = new Panel(layout); + resultButtonPanel = new Panel(layout); + + GridBagConstraints gbc = new GridBagConstraints(); + String instructions + = "INSTRUCTIONS:" + + "\n 1. Open any browser." + + "\n 2. Select and drag URL from the browser page and " + + "drop it on the panel" + + "\n 3. If test fails, then a popup message will be displayed," + + " click Ok and \n click Fail button." + + "\n 5. Otherwise test passed. Click Pass button."; + + instructionTextArea = new TextArea(); + instructionTextArea.setText(instructions); + instructionTextArea.setEnabled(false); + instructionTextArea.setBackground(Color.white); + + gbc.gridx = 0; + gbc.gridy = 0; + gbc.fill = GridBagConstraints.HORIZONTAL; + mainControlPanel.add(instructionTextArea, gbc); + + passButton = new Button("Pass"); + passButton.setName("Pass"); + passButton.addActionListener(this); + + failButton = new Button("Fail"); + failButton.setName("Fail"); + failButton.addActionListener(this); + + gbc.gridx = 0; + gbc.gridy = 0; + resultButtonPanel.add(passButton, gbc); + gbc.gridx = 1; + gbc.gridy = 0; + resultButtonPanel.add(failButton, gbc); + gbc.gridx = 0; + gbc.gridy = 1; + mainControlPanel.add(resultButtonPanel, gbc); + + mainFrame.add(mainControlPanel); + mainFrame.pack(); + mainFrame.setVisible(true); + } + + @Override + public void actionPerformed(ActionEvent ae) { + if (ae.getSource() instanceof Button) { + Button btn = (Button) ae.getSource(); + switch (btn.getName()) { + case "Pass": + testPassed = true; + isInterrupted = true; + mainThread.interrupt(); + break; + + case "Fail": + testFailed("Dragging link from web browser Failed"); + break; + } + } + } + + public static void cleanUp() { + urlFrame.dispose(); + mainFrame.dispose(); + } + + public static void testFailed(String message) { + testPassed = false; + isInterrupted = true; + failMessage = message; + mainThread.interrupt(); + } + + public static void main(final String[] args) throws Exception { + + DragLinkFromBrowser linkFromBrowser = new DragLinkFromBrowser(); + linkFromBrowser.createInstructionUI(); + linkFromBrowser.dragLinkFromWebBrowser(); + + mainThread = Thread.currentThread(); + try { + mainThread.sleep(testTimeOut); + } catch (InterruptedException ex) { + if (!testPassed) { + throw new RuntimeException(failMessage); + } + } finally { + cleanUp(); + } + + if (!isInterrupted) { + throw new RuntimeException("Test Timed out after " + + testTimeOut / 1000 + " seconds"); + } + } +} + diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/awt/font/TextLayout/StyledFontLayoutTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/font/TextLayout/StyledFontLayoutTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2016, 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. + * + * 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. + */ + +/* + * @test + * @bug 8139176 + * @summary Test layout uses correct styled font. + * @run main StyledFontLayoutTest + */ + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; + +public class StyledFontLayoutTest extends JPanel { + + static final int W=600, H=400; + static boolean interactive; + static BufferedImage im; + public static void main(String[] args) { + + interactive = args.length > 0; + + runTest(); + + if (!interactive) { + return; + } + SwingUtilities.invokeLater(() -> { + JFrame frame = new JFrame("Styled Font Layout Test"); + frame.add(new StyledFontLayoutTest()); + frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); + frame.setSize(W, H); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + }); + } + + @Override + protected void paintComponent(Graphics g) { + g.drawImage(im, 0, 0, null); + } + + private static void runTest() { + im = new BufferedImage(W, H, BufferedImage.TYPE_INT_RGB); + Graphics2D g2d = im.createGraphics(); + g2d.setColor(Color.white); + g2d.fillRect(0, 0, W, H); + g2d.setColor(Color.black); + g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + char[] chs = "Sample Text.".toCharArray(); + int len = chs.length; + + int x = 50, y = 100; + + FontRenderContext frc = g2d.getFontRenderContext(); + Font plain = new Font("Serif", Font.PLAIN, 48); + GlyphVector pgv = plain.layoutGlyphVector(frc, chs, 0, len, 0); + g2d.setFont(plain); + g2d.drawChars(chs, 0, len, x, y); y +=50; + + g2d.drawGlyphVector(pgv, x, y); y += 50; + Rectangle2D plainStrBounds = plain.getStringBounds(chs, 0, len, frc); + Rectangle2D plainGVBounds = pgv.getLogicalBounds(); + Font bold = new Font("Serif", Font.BOLD, 48); + GlyphVector bgv = bold.layoutGlyphVector(frc, chs, 0, len, 0); + Rectangle2D boldStrBounds = bold.getStringBounds(chs, 0, len, frc); + Rectangle2D boldGVBounds = bgv.getLogicalBounds(); + g2d.setFont(bold); + g2d.drawChars(chs, 0, len, x, y); y +=50; + g2d.drawGlyphVector(bgv, x, y); + System.out.println("Plain String Bounds = " + plainStrBounds); + System.out.println("Bold String Bounds = " + boldStrBounds); + System.out.println("Plain GlyphVector Bounds = " + plainGVBounds); + System.out.println("Bold GlyphVector Bounds = " + boldGVBounds); + if (!plainStrBounds.equals(boldStrBounds) && + plainGVBounds.equals(boldGVBounds)) + { + System.out.println("Test failed: Plain GV bounds same as Bold"); + if (!interactive) { + throw new RuntimeException("Plain GV bounds same as Bold"); + } + } + + }; +} diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/awt/geom/AffineTransform/InvalidTransformParameterTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/geom/AffineTransform/InvalidTransformParameterTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2016, 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. + * + * 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. + */ + +/* @test + * @bug 8158356 + * @summary Test AffineTransform transformations do not result in SIGSEGV + * if NaN or infinity parameter is passed as argument. + * @run main InvalidTransformParameterTest + */ + +import java.awt.geom.AffineTransform; +import java.awt.image.AffineTransformOp; +import java.awt.image.BufferedImage; +import java.awt.image.ImagingOpException; +import java.awt.Point; +import java.awt.image.DataBuffer; +import java.awt.image.DataBufferByte; +import java.awt.image.PixelInterleavedSampleModel; +import java.awt.image.Raster; +import java.awt.image.WritableRaster; +import java.awt.image.RasterOp; +import java.awt.image.SampleModel; + +public class InvalidTransformParameterTest { + + public static void main(String[] args) { + int count = 0; + final int testScenarios = 12; + double NaNArg = 0.0 / 0.0; + double positiveInfArg = 1.0 / 0.0; + double negativeInfArg = -1.0 / 0.0; + + BufferedImage img = new BufferedImage(5, 5, BufferedImage.TYPE_INT_ARGB); + + AffineTransform[] inputTransforms = new AffineTransform[testScenarios]; + + for (int i = 0; i < inputTransforms.length; i++) { + inputTransforms[i] = new AffineTransform(); + } + + inputTransforms[0].rotate(NaNArg, img.getWidth()/2, img.getHeight()/2); + inputTransforms[1].translate(NaNArg, NaNArg); + inputTransforms[2].scale(NaNArg, NaNArg); + inputTransforms[3].shear(NaNArg, NaNArg); + + inputTransforms[4].rotate(positiveInfArg, img.getWidth()/2, img.getHeight()/2); + inputTransforms[5].translate(positiveInfArg, positiveInfArg); + inputTransforms[6].scale(positiveInfArg, positiveInfArg); + inputTransforms[7].shear(positiveInfArg, positiveInfArg); + + inputTransforms[8].rotate(negativeInfArg, img.getWidth()/2, img.getHeight()/2); + inputTransforms[9].translate(negativeInfArg, negativeInfArg); + inputTransforms[10].scale(negativeInfArg, negativeInfArg); + inputTransforms[11].shear(negativeInfArg, negativeInfArg); + + // Test BufferedImage AffineTransform --------------------------------- + + for (int i = 0; i < inputTransforms.length; i++) { + try { + testImageTransform(img, inputTransforms[i]); + } catch (ImagingOpException ex) { + count++; + } + } + + if (count != testScenarios) { + throw new RuntimeException("Test failed. All test scenarios did not" + + " result in exception as expected."); + } + + // Test Raster AffineTransform --------------------------------- + + count = 0; + int[] bandOffsets = {0}; + Point location = new Point(0, 0); + DataBuffer db = new DataBufferByte(10 * 10); + SampleModel sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, + 10, 10, 1, 10, + bandOffsets); + + Raster src = Raster.createRaster(sm, db, location); + WritableRaster dst = Raster.createWritableRaster(sm, db, location); + + for (int i = 0; i < inputTransforms.length; i++) { + try { + testRasterTransform(src, dst, inputTransforms[i]); + } catch (ImagingOpException ex) { + count++; + } + } + + if (count != testScenarios) { + throw new RuntimeException("Test failed. All test scenarios did not" + + " result in exception as expected."); + } + } + + public static BufferedImage testImageTransform(BufferedImage image, + AffineTransform transform) { + AffineTransformOp op = + new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR); + + BufferedImage transformedImage = new BufferedImage(image.getWidth(), + image.getHeight(), + image.getType()); + + return op.filter(image, transformedImage); + } + + public static Raster testRasterTransform(Raster src, WritableRaster dst, + AffineTransform transform) { + AffineTransformOp op = + new AffineTransformOp(transform, AffineTransformOp.TYPE_BILINEAR); + + return op.filter(src, dst); + } +} + diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/awt/image/MultiResolutionImage/MultiResolutionDisabledImageTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/image/MultiResolutionImage/MultiResolutionDisabledImageTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2016, 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. + * + * 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. + */ + +import java.awt.Color; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.MediaTracker; +import java.awt.Toolkit; +import java.awt.image.BaseMultiResolutionImage; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; +import javax.swing.GrayFilter; +import java.awt.image.MultiResolutionImage; +import javax.swing.JLabel; + +/** + * @test + * @bug 8156182 + * @summary [macosx] HiDPI/Retina icons do not work for disabled + * JButton/JMenuItem etc. + * @run main/othervm -Dsun.java2d.uiScale=2 MultiResolutionDisabledImageTest + */ +public class MultiResolutionDisabledImageTest { + + private static final String IMAGE_NAME_1X = "image.png"; + private static final String IMAGE_NAME_2X = "image@2x.png"; + private static final int IMAGE_SIZE = 100; + private static final Color COLOR_1X = Color.GREEN; + private static final Color COLOR_2X = Color.BLUE; + + public static void main(String[] args) throws Exception { + + Image baseMRImage = new BaseMultiResolutionImage(createImage(1), + createImage(2)); + testMRDisabledImage(baseMRImage); + + saveImages(); + Image toolkitMRImage = Toolkit.getDefaultToolkit().getImage(IMAGE_NAME_1X); + + if (toolkitMRImage instanceof MultiResolutionImage) { + testMRDisabledImage(toolkitMRImage); + } + } + + private static void testMRDisabledImage(Image image) throws Exception { + + Image disabledImage = GrayFilter.createDisabledImage(image); + MediaTracker mediaTracker = new MediaTracker(new JLabel()); + mediaTracker.addImage(disabledImage, 0); + mediaTracker.waitForID(0); + + BufferedImage buffImage = new BufferedImage(IMAGE_SIZE, + IMAGE_SIZE, + BufferedImage.TYPE_INT_RGB); + + int x = IMAGE_SIZE / 2; + int y = IMAGE_SIZE / 2; + + Graphics2D g = buffImage.createGraphics(); + + g.scale(1, 1); + g.drawImage(disabledImage, 0, 0, null); + int rgb1x = buffImage.getRGB(x, y); + + g.scale(2, 2); + g.drawImage(disabledImage, 0, 0, null); + int rgb2x = buffImage.getRGB(x, y); + + g.dispose(); + + if (rgb1x == rgb2x) { + throw new RuntimeException("Disabled image is the same for the base" + + "image and the resolution variant"); + } + + } + + private static BufferedImage createImage(int scale) throws Exception { + BufferedImage image = new BufferedImage(scale * 200, scale * 300, + BufferedImage.TYPE_INT_RGB); + Graphics g = image.createGraphics(); + g.setColor(scale == 1 ? COLOR_1X : COLOR_2X); + g.fillRect(0, 0, scale * 200, scale * 300); + g.dispose(); + return image; + } + + private static void saveImages() throws Exception { + saveImage(createImage(1), IMAGE_NAME_1X); + saveImage(createImage(2), IMAGE_NAME_2X); + } + + private static void saveImage(BufferedImage image, String name) throws Exception { + ImageIO.write(image, "png", new File(name)); + } +} diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/awt/image/VolatileImage/TransparentVImage.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/image/VolatileImage/TransparentVImage.java Fri Sep 02 02:41:37 2016 +0000 @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2016, 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. + * + * 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. + */ + +/* + * @test + * @bug 4881082 4916294 5002129 8158524 + * @summary The test verifies whether the rendering operations on transparent + * and translucent VolatileImage objects generate identical output + * as generated with transparent and translucent BufferedImages. + * @key headful + * @run main/othervm -Dsun.java2d.uiScale=1 TransparentVImage + * @run main/othervm -Dsun.java2d.uiScale=1 -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=false TransparentVImage + * @run main/othervm -Dsun.java2d.uiScale=1 -Dsun.java2d.opengl=True -Dsun.java2d.opengl.fbobject=true TransparentVImage + */ +import java.awt.GraphicsConfiguration; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Transparency; +import java.awt.image.BufferedImage; +import java.awt.image.VolatileImage; +import java.awt.Color; +import javax.swing.JFrame; +import javax.swing.JComponent; +import javax.swing.ImageIcon; +import javax.swing.SwingUtilities; + +/* + * This test draws the same contents to 4 images: 2 BufferedImages that are + * transparent and translucent and 2 VolatileImages that are transparent and + * translucent. It compares the results pixel-by-pixel and fails if the + * results are not the same. + */ +public class TransparentVImage + extends JComponent { + + BufferedImage cImgTransparent, cImgTranslucent; + VolatileImage vImgTransparent, vImgTranslucent; + Image sprite; + static final int IMAGE_SIZE = 250; + static final int WINDOW_SIZE = 600; + static boolean doneComparing = false; + static JFrame testFrame = null; + + @Override + public void paint(Graphics g) { + if (cImgTransparent == null) { + GraphicsConfiguration gc = getGraphicsConfiguration(); + // doesn't exist yet: create it (and the other images) + cImgTransparent = (BufferedImage) + gc.createCompatibleImage(IMAGE_SIZE, IMAGE_SIZE, + Transparency.BITMASK); + cImgTranslucent = (BufferedImage) + gc.createCompatibleImage(IMAGE_SIZE, IMAGE_SIZE, + Transparency.TRANSLUCENT); + vImgTransparent = gc.createCompatibleVolatileImage(IMAGE_SIZE, + IMAGE_SIZE, Transparency.BITMASK); + vImgTranslucent = gc.createCompatibleVolatileImage(IMAGE_SIZE, + IMAGE_SIZE, Transparency.TRANSLUCENT); + + String fileName = "duke.gif"; + String separator = System.getProperty("file.separator"); + String dirPath = System.getProperty("test.src", "."); + String filePath = dirPath + separator + fileName; + sprite = new ImageIcon(filePath).getImage(); + + // Now they exist; render to them + Graphics gImg[] = new Graphics[4]; + gImg[0] = cImgTransparent.getGraphics(); + gImg[1] = cImgTranslucent.getGraphics(); + gImg[2] = vImgTransparent.getGraphics(); + gImg[3] = vImgTranslucent.getGraphics(); + + for (int i = 0; i < gImg.length; ++i) { + /* + * VolatileImage utilizes the power of accelerated rendering + * using GPU. The GPU drivers for D3d and OpenGL are supplied + * by OEM vendors and are external to graphics subsystem. Thus + * one cannot guarentee that the drivers will render the + * primitives using exactly the same algorithms as those used + * by BufferedImage. This could result in minor differences in + * pixel values between BufferedImage and VolatileImage. + * + * The pipelines for D3d and OpenGL adjust the rendering with + * fudge factors to align output of GPU rendering with that of + * CPU rendering. Some of the draw calls in this paint method + * are commented indicating a need to fine tune the fudge + * factors in the future. Once they are found to work on all + * hardware, the draw calls will be enabled. + */ + // rectangular fill + gImg[i].setColor(Color.blue); + gImg[i].fillRect(0, 0, IMAGE_SIZE, IMAGE_SIZE); + + /* + * Image copy. Copy it 3 times to get any image management + * acceleration going + */ + int spriteW = sprite.getWidth(null); + gImg[i].drawImage(sprite, 0, 0, null); + gImg[i].drawImage(sprite, spriteW, 0, null); + gImg[i].drawImage(sprite, 2 * spriteW, 0, null); + + // horizontal/vertical/diagonal lines + gImg[i].setColor(Color.red); + gImg[i].drawLine(0, 0, + IMAGE_SIZE - 1, IMAGE_SIZE - 1); + gImg[i].drawLine(IMAGE_SIZE / 2, 0, + IMAGE_SIZE / 2, IMAGE_SIZE - 1); + //gImg[i].drawLine(IMAGE_SIZE, 0, + // 0, IMAGE_SIZE - 1); + gImg[i].drawLine(0, IMAGE_SIZE / 2, + IMAGE_SIZE - 1, IMAGE_SIZE / 2); + + // filled circle + //gImg[i].setColor(Color.yellow); + //gImg[i].fillOval(IMAGE_SIZE / 2 - 20, IMAGE_SIZE / 2 - 20, + // 40, 40); + } + + /* + * Now everything is drawn: let's compare pixels + * First, grab the pixel arrays + */ + int cRgbTransparent[] = new int[IMAGE_SIZE * IMAGE_SIZE]; + int cRgbTranslucent[] = new int[IMAGE_SIZE * IMAGE_SIZE]; + int vRgbTransparent[] = new int[IMAGE_SIZE * IMAGE_SIZE]; + int vRgbTranslucent[] = new int[IMAGE_SIZE * IMAGE_SIZE]; + cImgTransparent.getRGB(0, 0, IMAGE_SIZE, IMAGE_SIZE, + cRgbTransparent, 0, IMAGE_SIZE); + cImgTranslucent.getRGB(0, 0, IMAGE_SIZE, IMAGE_SIZE, + cRgbTranslucent, 0, IMAGE_SIZE); + BufferedImage bImgTransparent = vImgTransparent.getSnapshot(); + bImgTransparent.getRGB(0, 0, IMAGE_SIZE, IMAGE_SIZE, + vRgbTransparent, 0, IMAGE_SIZE); + BufferedImage bImgTranslucent = vImgTranslucent.getSnapshot(); + bImgTranslucent.getRGB(0, 0, IMAGE_SIZE, IMAGE_SIZE, + vRgbTranslucent, 0, IMAGE_SIZE); + + boolean failed = false; + for (int pixel = 0; pixel < cRgbTransparent.length; ++pixel) { + if (cRgbTransparent[pixel] != vRgbTransparent[pixel]) { + failed = true; + System.out.println("Error in transparent image: " + + "BI[" + pixel + "] = " + + Integer.toHexString(cRgbTransparent[pixel]) + + "VI[" + pixel + "] = " + + Integer.toHexString(vRgbTransparent[pixel])); + break; + } + if (cRgbTranslucent[pixel] != vRgbTranslucent[pixel]) { + failed = true; + System.out.println("Error in translucent image: " + + "BI[" + pixel + "] = " + + Integer.toHexString(cRgbTranslucent[pixel]) + + "VI[" + pixel + "] = " + + Integer.toHexString(vRgbTranslucent[pixel])); + break; + } + } + if (failed) { + throw new RuntimeException("Failed: Pixel mis-match observed"); + } + else { + System.out.println("Passed"); + } + doneComparing = true; + } + + g.drawImage(cImgTransparent, 0, 0, null); + g.drawImage(cImgTranslucent, getWidth() - IMAGE_SIZE, 0, null); + g.drawImage(vImgTransparent, 0, getHeight() - IMAGE_SIZE, null); + g.drawImage(vImgTranslucent, getWidth() - IMAGE_SIZE, + getHeight() - IMAGE_SIZE, null); + } + + private static void constructTestUI() { + testFrame = new JFrame(); + testFrame.setSize(600, 600); + testFrame.setResizable(false); + testFrame.getContentPane().add(new TransparentVImage()); + + testFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + testFrame.setLocationRelativeTo(null); + testFrame.setVisible(true); + } + + private static void destroyTestUI() { + testFrame.dispose(); + } + + public static void main(String args[]) throws Exception { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + try { + // Construct the test interface + constructTestUI(); + } catch (Exception ex) { + // Throw an exception indicating error while creating UI + throw new RuntimeException("Test Failed: Error while" + + " creating the test interface."); + } + } + }); + + /* + * Wait until the image comparison between VolatileImage and + * BufferedImage is complete. + */ + while (!doneComparing) { + try { + Thread.sleep(100); + } + catch (Exception e) {} + } + + /* + * Now sleep just a little longer to let the user see the resulting + * images in the frame + */ + try { + Thread.sleep(5000); + } + catch (Exception e) {} + + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + try { + // Destroy the test interface + destroyTestUI(); + } catch (Exception ex) { + // Throw an exception indicating error while deleting UI + throw new RuntimeException("Test Failed: Error while" + + " deleting the test interface."); + } + } + }); + } +} diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/awt/image/VolatileImage/duke.gif Binary file jdk/test/java/awt/image/VolatileImage/duke.gif has changed diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/awt/image/multiresolution/MultiResolutionIcon/IconTest.java --- a/jdk/test/java/awt/image/multiresolution/MultiResolutionIcon/IconTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/awt/image/multiresolution/MultiResolutionIcon/IconTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -23,10 +23,10 @@ /** * @test - * @bug 8147648 + * @bug 8147648 8163160 * @summary [hidpi] multiresolution image: wrong resolution variant is used as * icon in the Unity panel - * @run main/othervm -Dsun.java2d.uiScale=2 IconTest + * @run main/manual/othervm -Dsun.java2d.uiScale=2 IconTest */ import java.awt.Color; import java.awt.Graphics; @@ -67,7 +67,7 @@ if (g != null) { g.setColor(c); g.fillRect(0, 0, x, x); - g.setColor(Color.YELLOW); + g.setColor(Color.GREEN); g.drawRect(0, 0, x-1, x-1); } } finally { @@ -91,7 +91,8 @@ GridBagConstraints gbc = new GridBagConstraints(); String instructions = "INSTRUCTIONS:
    " - + "Check if test button and unity icons are both blue with yellow border.

    " + + "Check if test button icon and unity icon are both " + + "blue with green border.

    " + "If Icon color is blue press pass" + " else press fail.

    "; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/awt/print/PrinterJob/TestMediaTraySelection.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/java/awt/print/PrinterJob/TestMediaTraySelection.java Fri Sep 02 02:41:37 2016 +0000 @@ -0,0 +1,185 @@ +/* + * Copyright (c) 2016, 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. + * + * 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. + */ +/* + * @test + * @bug 6357887 + * @summary Verifies if selected printertray is used + * @requires (os.family == "linux" | os.family == "solaris") + * @run main/manual TestMediaTraySelection + */ + +import java.awt.BorderLayout; +import java.awt.FlowLayout; +import java.awt.Graphics; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import javax.print.DocFlavor; +import javax.print.PrintService; +import javax.print.PrintServiceLookup; +import javax.print.attribute.HashPrintRequestAttributeSet; +import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.standard.Media; +import javax.print.attribute.standard.MediaTray; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JPanel; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; + +public class TestMediaTraySelection implements Printable { + + private static Thread mainThread; + private static boolean testPassed; + private static boolean testGeneratedInterrupt; + private static PrintService prservices; + + public static void main(String[] args) throws Exception { + prservices = PrintServiceLookup.lookupDefaultPrintService(); + if (prservices == null) { + System.out.println("No print service found"); + return; + } + System.out.println(" Print service " + prservices); + SwingUtilities.invokeAndWait(() -> { + doTest(TestMediaTraySelection::printTest); + }); + mainThread = Thread.currentThread(); + try { + Thread.sleep(90000); + } catch (InterruptedException e) { + if (!testPassed && testGeneratedInterrupt) { + throw new RuntimeException("Banner page did not print"); + } + } + if (!testGeneratedInterrupt) { + throw new RuntimeException("user has not executed the test"); + } + } + + private static void printTest() { + + MediaTray tray = null; + //tray = getMediaTray( prservices, "Bypass Tray" ); + tray = getMediaTray( prservices, "Tray 4" ); + PrintRequestAttributeSet atrset = new HashPrintRequestAttributeSet(); + //atrset.add( MediaSizeName.ISO_A4 ); + atrset.add(tray); + PrinterJob pjob = PrinterJob.getPrinterJob(); + pjob.setPrintable(new TestMediaTraySelection()); + try { + pjob.print(atrset); + } catch (PrinterException e) { + e.printStackTrace(); + fail(); + } + } + + static MediaTray getMediaTray( PrintService ps, String name) { + Media[] media = (Media[])ps.getSupportedAttributeValues( Media.class, + DocFlavor.SERVICE_FORMATTED.PAGEABLE, null); + + for (Media m : media) { + if ( m instanceof MediaTray) { + System.out.println("MediaTray=" + m.toString() ); + if ( m.toString().trim().indexOf( name ) > -1 ) { + return (MediaTray)m; + } + } + } + return null; + } + + public static synchronized void pass() { + testPassed = true; + testGeneratedInterrupt = true; + mainThread.interrupt(); + } + + public static synchronized void fail() { + testPassed = false; + testGeneratedInterrupt = true; + mainThread.interrupt(); + } + + private static void doTest(Runnable action) { + String description + = " Please verify the \"Tray 4\" of printer is used for printout\n" + + " and not standard/auto tray. If yes, press PASS else press FAIL"; + + final JDialog dialog = new JDialog(); + dialog.setTitle("printBannerTest"); + JTextArea textArea = new JTextArea(description); + textArea.setEditable(false); + final JButton testButton = new JButton("Start Test"); + final JButton passButton = new JButton("PASS"); + passButton.setEnabled(false); + passButton.addActionListener((e) -> { + dialog.dispose(); + pass(); + }); + final JButton failButton = new JButton("FAIL"); + failButton.setEnabled(false); + failButton.addActionListener((e) -> { + dialog.dispose(); + fail(); + }); + testButton.addActionListener((e) -> { + testButton.setEnabled(false); + action.run(); + passButton.setEnabled(true); + failButton.setEnabled(true); + }); + JPanel mainPanel = new JPanel(new BorderLayout()); + mainPanel.add(textArea, BorderLayout.CENTER); + JPanel buttonPanel = new JPanel(new FlowLayout()); + buttonPanel.add(testButton); + buttonPanel.add(passButton); + buttonPanel.add(failButton); + mainPanel.add(buttonPanel, BorderLayout.SOUTH); + dialog.add(mainPanel); + dialog.pack(); + dialog.setVisible(true); + dialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + System.out.println("main dialog closing"); + testGeneratedInterrupt = false; + mainThread.interrupt(); + } + }); + } + + @Override + public int print(Graphics g, PageFormat pf, int pi) { + System.out.println("pi = " + pi); + if (pi > 0) { + return NO_SUCH_PAGE; + } + g.drawString("Testing : " , 200, 200); + return PAGE_EXISTS; + } +} diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/beans/Introspector/Test8027905.java --- a/jdk/test/java/beans/Introspector/Test8027905.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/beans/Introspector/Test8027905.java Fri Sep 02 02:41:37 2016 +0000 @@ -28,6 +28,7 @@ * @bug 8027905 * @summary Tests that GC does not affect a property type * @author Sergey Malenkov + * @run main/othervm -mx16m Test8027905 */ public class Test8027905 { diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/Class/GetModuleTest.java --- a/jdk/test/java/lang/Class/GetModuleTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/Class/GetModuleTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/Class/GetPackageTest.java --- a/jdk/test/java/lang/Class/GetPackageTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/Class/GetPackageTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/ClassLoader/GetSystemPackage.java --- a/jdk/test/java/lang/ClassLoader/GetSystemPackage.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/ClassLoader/GetSystemPackage.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/ClassLoader/deadlock/GetResource.java --- a/jdk/test/java/lang/ClassLoader/deadlock/GetResource.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/ClassLoader/deadlock/GetResource.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/ProcessBuilder/CloseRace.java --- a/jdk/test/java/lang/ProcessBuilder/CloseRace.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/ProcessBuilder/CloseRace.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/ProcessBuilder/PipelineTest.java --- a/jdk/test/java/lang/ProcessBuilder/PipelineTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/ProcessBuilder/PipelineTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ import java.io.File; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/ProcessBuilder/Zombies.java --- a/jdk/test/java/lang/ProcessBuilder/Zombies.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/ProcessBuilder/Zombies.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,7 +25,6 @@ * @test * @run main/othervm Zombies * @bug 6474073 6180151 - * @key intermittent * @summary Make sure zombies don't get created on Unix * @author Martin Buchholz */ diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/ProcessHandle/Basic.java --- a/jdk/test/java/lang/ProcessHandle/Basic.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/ProcessHandle/Basic.java Fri Sep 02 02:41:37 2016 +0000 @@ -36,7 +36,7 @@ /* * @test - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.management * @run testng Basic diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/ProcessHandle/InfoTest.java --- a/jdk/test/java/lang/ProcessHandle/InfoTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/ProcessHandle/InfoTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -48,7 +48,7 @@ /* * @test * @bug 8077350 8081566 8081567 8098852 8136597 - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.management * @build jdk.test.lib.Platform jdk.test.lib.Utils diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/ProcessHandle/OnExitTest.java --- a/jdk/test/java/lang/ProcessHandle/OnExitTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/ProcessHandle/OnExitTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -38,7 +38,7 @@ /* * @test - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.management * @build jdk.test.lib.Platform jdk.test.lib.Utils diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/ProcessHandle/TreeTest.java --- a/jdk/test/java/lang/ProcessHandle/TreeTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/ProcessHandle/TreeTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -44,7 +44,7 @@ /* * @test - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * jdk.management * @build jdk.test.lib.Utils diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/StackWalker/CountLocalSlots.java --- a/jdk/test/java/lang/StackWalker/CountLocalSlots.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/StackWalker/CountLocalSlots.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/StackWalker/LocalsAndOperands.java --- a/jdk/test/java/lang/StackWalker/LocalsAndOperands.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/StackWalker/LocalsAndOperands.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/StackWalker/LocalsCrash.java --- a/jdk/test/java/lang/StackWalker/LocalsCrash.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/StackWalker/LocalsCrash.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/String/concat/CompactStringsInitialCoder.java --- a/jdk/test/java/lang/String/concat/CompactStringsInitialCoder.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/String/concat/CompactStringsInitialCoder.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/String/concat/StringConcatFactoryEmptyMethods.java --- a/jdk/test/java/lang/String/concat/StringConcatFactoryEmptyMethods.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/String/concat/StringConcatFactoryEmptyMethods.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/String/concat/WithSecurityManager.java --- a/jdk/test/java/lang/String/concat/WithSecurityManager.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/String/concat/WithSecurityManager.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/Thread/ThreadStateController.java --- a/jdk/test/java/lang/Thread/ThreadStateController.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/Thread/ThreadStateController.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/annotation/typeAnnotations/GetAnnotatedReceiverType.java --- a/jdk/test/java/lang/annotation/typeAnnotations/GetAnnotatedReceiverType.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/annotation/typeAnnotations/GetAnnotatedReceiverType.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2014, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/instrument/NMTHelper.java --- a/jdk/test/java/lang/instrument/NMTHelper.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/instrument/NMTHelper.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/instrument/NativeMethodPrefixAgent.java --- a/jdk/test/java/lang/instrument/NativeMethodPrefixAgent.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/instrument/NativeMethodPrefixAgent.java Fri Sep 02 02:41:37 2016 +0000 @@ -24,6 +24,7 @@ /** * @test * @bug 6263319 + * @requires ((vm.opt.StartFlightRecording == null) | (vm.opt.StartFlightRecording == false)) & ((vm.opt.FlightRecorder == null) | (vm.opt.FlightRecorder == false)) * @summary test setNativeMethodPrefix * @author Robert Field, Sun Microsystems * diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/instrument/RedefineBigClass.sh --- a/jdk/test/java/lang/instrument/RedefineBigClass.sh Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/instrument/RedefineBigClass.sh Fri Sep 02 02:41:37 2016 +0000 @@ -70,7 +70,7 @@ fi "${JAVA}" ${TESTVMOPTS} \ - -XX:TraceRedefineClasses=3 ${NMT} \ + -Xlog:redefine+class+load=debug,redefine+class+load+exceptions=info ${NMT} \ -javaagent:RedefineBigClassAgent.jar=BigClass.class \ -classpath "${TESTCLASSES}" RedefineBigClassApp \ > output.log 2>&1 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh --- a/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/instrument/RedefineSubclassWithTwoInterfaces.sh Fri Sep 02 02:41:37 2016 +0000 @@ -87,23 +87,8 @@ echo "INFO: launching RedefineSubclassWithTwoInterfacesApp" -# TraceRedefineClasses options: -# -# 0x00000001 | 1 - name each target class before loading, after -# loading and after redefinition is completed -# 0x00000002 | 2 - print info if parsing, linking or -# verification throws an exception -# 0x00000004 | 4 - print timer info for the VM operation -# 0x00001000 | 4096 - detect calls to obsolete methods -# 0x00002000 | 8192 - fail a guarantee() in addition to detection -# 0x00004000 | 16384 - detect old/obsolete methods in metadata -# 0x00100000 | 1048576 - impl details: vtable updates -# 0x00200000 | 2097152 - impl details: itable updates -# -# 1+2+4+4096+8192+16384+1048576+2097152 == 3174407 - "${JAVA}" ${TESTVMOPTS} \ - -XX:TraceRedefineClasses=3174407 \ + -Xlog:redefine+class+load=trace,redefine+class+load+exceptions=trace,redefine+class+timer=trace,redefine+class+obsolete=trace,redefine+class+obsolete+metadata=trace,redefine+class+constantpool=trace \ -javaagent:RedefineSubclassWithTwoInterfacesAgent.jar \ -classpath "${TESTCLASSES}" \ RedefineSubclassWithTwoInterfacesApp > output.log 2>&1 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/instrument/RetransformBigClass.sh --- a/jdk/test/java/lang/instrument/RetransformBigClass.sh Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/instrument/RetransformBigClass.sh Fri Sep 02 02:41:37 2016 +0000 @@ -70,7 +70,7 @@ fi "${JAVA}" ${TESTVMOPTS} \ - -XX:TraceRedefineClasses=3 ${NMT} \ + -Xlog:redefine+class+load=debug,redefine+class+load+exceptions=info ${NMT} \ -javaagent:RetransformBigClassAgent.jar=BigClass.class \ -classpath "${TESTCLASSES}" RetransformBigClassApp \ > output.log 2>&1 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/6987555/Test6987555.java --- a/jdk/test/java/lang/invoke/6987555/Test6987555.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/6987555/Test6987555.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/6991596/Test6991596.java --- a/jdk/test/java/lang/invoke/6991596/Test6991596.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/6991596/Test6991596.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/6998541/Test6998541.java --- a/jdk/test/java/lang/invoke/6998541/Test6998541.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/6998541/Test6998541.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/7087570/Test7087570.java --- a/jdk/test/java/lang/invoke/7087570/Test7087570.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/7087570/Test7087570.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /* @test diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/7157574/Test7157574.java --- a/jdk/test/java/lang/invoke/7157574/Test7157574.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/7157574/Test7157574.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /* diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/7196190/ClassForNameTest.java --- a/jdk/test/java/lang/invoke/7196190/ClassForNameTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/7196190/ClassForNameTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/7196190/GetUnsafeTest.java --- a/jdk/test/java/lang/invoke/7196190/GetUnsafeTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/7196190/GetUnsafeTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/8009222/Test8009222.java --- a/jdk/test/java/lang/invoke/8009222/Test8009222.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/8009222/Test8009222.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/8022701/BogoLoader.java --- a/jdk/test/java/lang/invoke/8022701/BogoLoader.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/8022701/BogoLoader.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ import java.io.BufferedInputStream; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/8022701/InvokeSeveralWays.java --- a/jdk/test/java/lang/invoke/8022701/InvokeSeveralWays.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/8022701/InvokeSeveralWays.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ import java.lang.reflect.InvocationTargetException; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/8022701/Invoker.java --- a/jdk/test/java/lang/invoke/8022701/Invoker.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/8022701/Invoker.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ public class Invoker { diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/8022701/MHIllegalAccess.java --- a/jdk/test/java/lang/invoke/8022701/MHIllegalAccess.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/8022701/MHIllegalAccess.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/8022701/MethodSupplier.java --- a/jdk/test/java/lang/invoke/8022701/MethodSupplier.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/8022701/MethodSupplier.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /* diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/CallSiteTest.java --- a/jdk/test/java/lang/invoke/CallSiteTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/CallSiteTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/CallStaticInitOrder.java --- a/jdk/test/java/lang/invoke/CallStaticInitOrder.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/CallStaticInitOrder.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/Test.java --- a/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/Test.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/Test.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p1/T2.java --- a/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p1/T2.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p1/T2.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,8 +19,8 @@ * 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 p1; import p2.T3; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p2/T3.java --- a/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p2/T3.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/ProtectedMemberDifferentPackage/p2/T3.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,8 +19,8 @@ * 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 p2; import p1.T2; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleBaseTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -132,7 +132,8 @@ COMPARE_AND_SET, COMPARE_AND_EXCHANGE, GET_AND_SET, - GET_AND_ADD; + GET_AND_ADD, + GET_AND_BITWISE; } enum TestAccessMode { @@ -148,13 +149,26 @@ COMPARE_AND_EXCHANGE(TestAccessType.COMPARE_AND_EXCHANGE), COMPARE_AND_EXCHANGE_ACQUIRE(TestAccessType.COMPARE_AND_EXCHANGE), COMPARE_AND_EXCHANGE_RELEASE(TestAccessType.COMPARE_AND_EXCHANGE), + WEAK_COMPARE_AND_SET_PLAIN(TestAccessType.COMPARE_AND_SET), WEAK_COMPARE_AND_SET(TestAccessType.COMPARE_AND_SET), - WEAK_COMPARE_AND_SET_VOLATILE(TestAccessType.COMPARE_AND_SET), WEAK_COMPARE_AND_SET_ACQUIRE(TestAccessType.COMPARE_AND_SET), WEAK_COMPARE_AND_SET_RELEASE(TestAccessType.COMPARE_AND_SET), GET_AND_SET(TestAccessType.GET_AND_SET), + GET_AND_SET_ACQUIRE(TestAccessType.GET_AND_SET), + GET_AND_SET_RELEASE(TestAccessType.GET_AND_SET), GET_AND_ADD(TestAccessType.GET_AND_ADD), - ADD_AND_GET(TestAccessType.GET_AND_ADD),; + GET_AND_ADD_ACQUIRE(TestAccessType.GET_AND_ADD), + GET_AND_ADD_RELEASE(TestAccessType.GET_AND_ADD), + GET_AND_BITWISE_OR(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_OR_ACQUIRE(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_OR_RELEASE(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_AND(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_AND_ACQUIRE(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_AND_RELEASE(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_XOR(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_XOR_ACQUIRE(TestAccessType.GET_AND_BITWISE), + GET_AND_BITWISE_XOR_RELEASE(TestAccessType.GET_AND_BITWISE), + ; final TestAccessType at; final boolean isPolyMorphicInReturnType; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessBoolean.java Fri Sep 02 02:41:37 2016 +0000 @@ -103,14 +103,27 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -266,8 +279,13 @@ }); checkUOE(() -> { - boolean o = (boolean) vh.addAndGet(recv, true); + boolean o = (boolean) vh.getAndAddAcquire(recv, true); }); + + checkUOE(() -> { + boolean o = (boolean) vh.getAndAddRelease(recv, true); + }); + } @@ -321,8 +339,13 @@ }); checkUOE(() -> { - boolean o = (boolean) vh.addAndGet(true); + boolean o = (boolean) vh.getAndAddAcquire(true); }); + + checkUOE(() -> { + boolean o = (boolean) vh.getAndAddRelease(true); + }); + } @@ -418,11 +441,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, true, false); + success = vh.weakCompareAndSetPlain(recv, true, false); } - assertEquals(success, true, "weakCompareAndSet boolean"); + assertEquals(success, true, "weakCompareAndSetPlain boolean"); boolean x = (boolean) vh.get(recv); - assertEquals(x, false, "weakCompareAndSet boolean value"); + assertEquals(x, false, "weakCompareAndSetPlain boolean value"); } { @@ -448,21 +471,125 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, false, true); + success = vh.weakCompareAndSet(recv, false, true); } - assertEquals(success, true, "weakCompareAndSetVolatile boolean"); + assertEquals(success, true, "weakCompareAndSet boolean"); boolean x = (boolean) vh.get(recv); - assertEquals(x, true, "weakCompareAndSetVolatile boolean value"); + assertEquals(x, true, "weakCompareAndSet boolean value"); } // Compare set and get { + vh.set(recv, true); + boolean o = (boolean) vh.getAndSet(recv, false); assertEquals(o, true, "getAndSet boolean"); boolean x = (boolean) vh.get(recv); assertEquals(x, false, "getAndSet boolean value"); } + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndSetAcquire(recv, false); + assertEquals(o, true, "getAndSetAcquire boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, false, "getAndSetAcquire boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndSetRelease(recv, false); + assertEquals(o, true, "getAndSetRelease boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, false, "getAndSetRelease boolean value"); + } + + + // get and bitwise or + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseOr(recv, false); + assertEquals(o, true, "getAndBitwiseOr boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseOrAcquire(recv, false); + assertEquals(o, true, "getAndBitwiseOrAcquire boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseOrRelease(recv, false); + assertEquals(o, true, "getAndBitwiseOrRelease boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value"); + } + + // get and bitwise and + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseAnd(recv, false); + assertEquals(o, true, "getAndBitwiseAnd boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseAndAcquire(recv, false); + assertEquals(o, true, "getAndBitwiseAndAcquire boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseAndRelease(recv, false); + assertEquals(o, true, "getAndBitwiseAndRelease boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value"); + } + + // get and bitwise xor + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseXor(recv, false); + assertEquals(o, true, "getAndBitwiseXor boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseXorAcquire(recv, false); + assertEquals(o, true, "getAndBitwiseXorAcquire boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value"); + } + + { + vh.set(recv, true); + + boolean o = (boolean) vh.getAndBitwiseXorRelease(recv, false); + assertEquals(o, true, "getAndBitwiseXorRelease boolean"); + boolean x = (boolean) vh.get(recv); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value"); + } } static void testInstanceFieldUnsupported(VarHandleTestAccessBoolean recv, VarHandle vh) { @@ -472,8 +599,13 @@ }); checkUOE(() -> { - boolean o = (boolean) vh.addAndGet(recv, true); + boolean o = (boolean) vh.getAndAddAcquire(recv, true); }); + + checkUOE(() -> { + boolean o = (boolean) vh.getAndAddRelease(recv, true); + }); + } @@ -569,11 +701,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(true, false); + success = vh.weakCompareAndSetPlain(true, false); } - assertEquals(success, true, "weakCompareAndSet boolean"); + assertEquals(success, true, "weakCompareAndSetPlain boolean"); boolean x = (boolean) vh.get(); - assertEquals(x, false, "weakCompareAndSet boolean value"); + assertEquals(x, false, "weakCompareAndSetPlain boolean value"); } { @@ -599,21 +731,125 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease(false, true); + success = vh.weakCompareAndSet(false, true); } - assertEquals(success, true, "weakCompareAndSetVolatile boolean"); + assertEquals(success, true, "weakCompareAndSet boolean"); boolean x = (boolean) vh.get(); - assertEquals(x, true, "weakCompareAndSetVolatile boolean"); + assertEquals(x, true, "weakCompareAndSet boolean"); } // Compare set and get { + vh.set(true); + boolean o = (boolean) vh.getAndSet(false); assertEquals(o, true, "getAndSet boolean"); boolean x = (boolean) vh.get(); assertEquals(x, false, "getAndSet boolean value"); } + { + vh.set(true); + + boolean o = (boolean) vh.getAndSetAcquire(false); + assertEquals(o, true, "getAndSetAcquire boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, false, "getAndSetAcquire boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndSetRelease(false); + assertEquals(o, true, "getAndSetRelease boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, false, "getAndSetRelease boolean value"); + } + + + // get and bitwise or + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseOr(false); + assertEquals(o, true, "getAndBitwiseOr boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseOrAcquire(false); + assertEquals(o, true, "getAndBitwiseOrAcquire boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseOrRelease(false); + assertEquals(o, true, "getAndBitwiseOrRelease boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value"); + } + + // get and bitwise and + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseAnd(false); + assertEquals(o, true, "getAndBitwiseAnd boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseAndAcquire(false); + assertEquals(o, true, "getAndBitwiseAndAcquire boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseAndRelease(false); + assertEquals(o, true, "getAndBitwiseAndRelease boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value"); + } + + // get and bitwise xor + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseXor(false); + assertEquals(o, true, "getAndBitwiseXor boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseXorAcquire(false); + assertEquals(o, true, "getAndBitwiseXorAcquire boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value"); + } + + { + vh.set(true); + + boolean o = (boolean) vh.getAndBitwiseXorRelease(false); + assertEquals(o, true, "getAndBitwiseXorRelease boolean"); + boolean x = (boolean) vh.get(); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value"); + } } static void testStaticFieldUnsupported(VarHandle vh) { @@ -623,8 +859,13 @@ }); checkUOE(() -> { - boolean o = (boolean) vh.addAndGet(true); + boolean o = (boolean) vh.getAndAddAcquire(true); }); + + checkUOE(() -> { + boolean o = (boolean) vh.getAndAddRelease(true); + }); + } @@ -723,11 +964,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, true, false); + success = vh.weakCompareAndSetPlain(array, i, true, false); } - assertEquals(success, true, "weakCompareAndSet boolean"); + assertEquals(success, true, "weakCompareAndSetPlain boolean"); boolean x = (boolean) vh.get(array, i); - assertEquals(x, false, "weakCompareAndSet boolean value"); + assertEquals(x, false, "weakCompareAndSetPlain boolean value"); } { @@ -753,21 +994,125 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, false, true); + success = vh.weakCompareAndSet(array, i, false, true); } - assertEquals(success, true, "weakCompareAndSetVolatile boolean"); + assertEquals(success, true, "weakCompareAndSet boolean"); boolean x = (boolean) vh.get(array, i); - assertEquals(x, true, "weakCompareAndSetVolatile boolean"); + assertEquals(x, true, "weakCompareAndSet boolean"); } // Compare set and get { + vh.set(array, i, true); + boolean o = (boolean) vh.getAndSet(array, i, false); assertEquals(o, true, "getAndSet boolean"); boolean x = (boolean) vh.get(array, i); assertEquals(x, false, "getAndSet boolean value"); } + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndSetAcquire(array, i, false); + assertEquals(o, true, "getAndSetAcquire boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, false, "getAndSetAcquire boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndSetRelease(array, i, false); + assertEquals(o, true, "getAndSetRelease boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, false, "getAndSetRelease boolean value"); + } + + + // get and bitwise or + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseOr(array, i, false); + assertEquals(o, true, "getAndBitwiseOr boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseOrAcquire(array, i, false); + assertEquals(o, true, "getAndBitwiseOrAcquire boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseOrRelease(array, i, false); + assertEquals(o, true, "getAndBitwiseOrRelease boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value"); + } + + // get and bitwise and + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseAnd(array, i, false); + assertEquals(o, true, "getAndBitwiseAnd boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseAndAcquire(array, i, false); + assertEquals(o, true, "getAndBitwiseAndAcquire boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseAndRelease(array, i, false); + assertEquals(o, true, "getAndBitwiseAndRelease boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value"); + } + + // get and bitwise xor + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseXor(array, i, false); + assertEquals(o, true, "getAndBitwiseXor boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseXorAcquire(array, i, false); + assertEquals(o, true, "getAndBitwiseXorAcquire boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value"); + } + + { + vh.set(array, i, true); + + boolean o = (boolean) vh.getAndBitwiseXorRelease(array, i, false); + assertEquals(o, true, "getAndBitwiseXorRelease boolean"); + boolean x = (boolean) vh.get(array, i); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value"); + } } } @@ -781,8 +1126,13 @@ }); checkUOE(() -> { - boolean o = (boolean) vh.addAndGet(array, i, true); + boolean o = (boolean) vh.getAndAddAcquire(array, i, true); }); + + checkUOE(() -> { + boolean o = (boolean) vh.getAndAddRelease(array, i, true); + }); + } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -840,11 +1190,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, true, false); + boolean r = vh.weakCompareAndSetPlain(array, ci, true, false); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, true, false); + boolean r = vh.weakCompareAndSet(array, ci, true, false); }); checkIOOBE(() -> { @@ -859,6 +1209,50 @@ boolean o = (boolean) vh.getAndSet(array, ci, true); }); + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndSetAcquire(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndSetRelease(array, ci, true); + }); + + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseOr(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseOrAcquire(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseOrRelease(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseAnd(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseAndAcquire(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseAndRelease(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseXor(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseXorAcquire(array, ci, true); + }); + + checkIOOBE(() -> { + boolean o = (boolean) vh.getAndBitwiseXorRelease(array, ci, true); + }); } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessByte.java Fri Sep 02 02:41:37 2016 +0000 @@ -103,14 +103,27 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,7 @@ }); + } @@ -309,6 +323,7 @@ }); + } @@ -404,11 +419,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, (byte)0x01, (byte)0x23); + success = vh.weakCompareAndSetPlain(recv, (byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSet byte"); + assertEquals(success, true, "weakCompareAndSetPlain byte"); byte x = (byte) vh.get(recv); - assertEquals(x, (byte)0x23, "weakCompareAndSet byte value"); + assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value"); } { @@ -434,34 +449,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, (byte)0x23, (byte)0x01); + success = vh.weakCompareAndSet(recv, (byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSetVolatile byte"); + assertEquals(success, true, "weakCompareAndSet byte"); byte x = (byte) vh.get(recv); - assertEquals(x, (byte)0x01, "weakCompareAndSetVolatile byte value"); + assertEquals(x, (byte)0x01, "weakCompareAndSet byte value"); } // Compare set and get { + vh.set(recv, (byte)0x01); + byte o = (byte) vh.getAndSet(recv, (byte)0x23); assertEquals(o, (byte)0x01, "getAndSet byte"); byte x = (byte) vh.get(recv); assertEquals(x, (byte)0x23, "getAndSet byte value"); } - vh.set(recv, (byte)0x01); + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndSetAcquire(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetAcquire byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)0x23, "getAndSetAcquire byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndSetRelease(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetRelease byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)0x23, "getAndSetRelease byte value"); + } // get and add, add and get { - byte o = (byte) vh.getAndAdd(recv, (byte)0x45); + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndAdd(recv, (byte)0x23); assertEquals(o, (byte)0x01, "getAndAdd byte"); - byte c = (byte) vh.addAndGet(recv, (byte)0x45); - assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndAddAcquire(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddAcquire byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndAddRelease(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddReleasebyte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value"); + } + + // get and bitwise or + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseOr(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOr byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseOrAcquire(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseOrRelease(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value"); + } + + // get and bitwise and + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseAnd(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseAndAcquire(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseAndRelease(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value"); + } + + // get and bitwise xor + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseXor(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXor byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseXorAcquire(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value"); + } + + { + vh.set(recv, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseXorRelease(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte"); + byte x = (byte) vh.get(recv); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value"); } } static void testInstanceFieldUnsupported(VarHandleTestAccessByte recv, VarHandle vh) { + } @@ -557,11 +695,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet((byte)0x01, (byte)0x23); + success = vh.weakCompareAndSetPlain((byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSet byte"); + assertEquals(success, true, "weakCompareAndSetPlain byte"); byte x = (byte) vh.get(); - assertEquals(x, (byte)0x23, "weakCompareAndSet byte value"); + assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value"); } { @@ -587,34 +725,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease((byte)0x23, (byte)0x01); + success = vh.weakCompareAndSet((byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSetVolatile byte"); + assertEquals(success, true, "weakCompareAndSet byte"); byte x = (byte) vh.get(); - assertEquals(x, (byte)0x01, "weakCompareAndSetVolatile byte"); + assertEquals(x, (byte)0x01, "weakCompareAndSet byte"); } // Compare set and get { + vh.set((byte)0x01); + byte o = (byte) vh.getAndSet((byte)0x23); assertEquals(o, (byte)0x01, "getAndSet byte"); byte x = (byte) vh.get(); assertEquals(x, (byte)0x23, "getAndSet byte value"); } - vh.set((byte)0x01); + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndSetAcquire((byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetAcquire byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)0x23, "getAndSetAcquire byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndSetRelease((byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetRelease byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)0x23, "getAndSetRelease byte value"); + } // get and add, add and get { - byte o = (byte) vh.getAndAdd( (byte)0x45); + vh.set((byte)0x01); + + byte o = (byte) vh.getAndAdd((byte)0x23); assertEquals(o, (byte)0x01, "getAndAdd byte"); - byte c = (byte) vh.addAndGet((byte)0x45); - assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndAddAcquire((byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddAcquire byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndAddRelease((byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddReleasebyte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value"); + } + + // get and bitwise or + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseOr((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOr byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseOrAcquire((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseOrRelease((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value"); + } + + // get and bitwise and + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseAnd((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseAndAcquire((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseAndRelease((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value"); + } + + // get and bitwise xor + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseXor((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXor byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseXorAcquire((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value"); + } + + { + vh.set((byte)0x01); + + byte o = (byte) vh.getAndBitwiseXorRelease((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte"); + byte x = (byte) vh.get(); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value"); } } static void testStaticFieldUnsupported(VarHandle vh) { + } @@ -713,11 +974,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, (byte)0x01, (byte)0x23); + success = vh.weakCompareAndSetPlain(array, i, (byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSet byte"); + assertEquals(success, true, "weakCompareAndSetPlain byte"); byte x = (byte) vh.get(array, i); - assertEquals(x, (byte)0x23, "weakCompareAndSet byte value"); + assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value"); } { @@ -743,29 +1004,151 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, (byte)0x23, (byte)0x01); + success = vh.weakCompareAndSet(array, i, (byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSetVolatile byte"); + assertEquals(success, true, "weakCompareAndSet byte"); byte x = (byte) vh.get(array, i); - assertEquals(x, (byte)0x01, "weakCompareAndSetVolatile byte"); + assertEquals(x, (byte)0x01, "weakCompareAndSet byte"); } // Compare set and get { + vh.set(array, i, (byte)0x01); + byte o = (byte) vh.getAndSet(array, i, (byte)0x23); assertEquals(o, (byte)0x01, "getAndSet byte"); byte x = (byte) vh.get(array, i); assertEquals(x, (byte)0x23, "getAndSet byte value"); } - vh.set(array, i, (byte)0x01); + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndSetAcquire(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetAcquire byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)0x23, "getAndSetAcquire byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndSetRelease(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetRelease byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)0x23, "getAndSetRelease byte value"); + } // get and add, add and get { - byte o = (byte) vh.getAndAdd(array, i, (byte)0x45); + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndAdd(array, i, (byte)0x23); assertEquals(o, (byte)0x01, "getAndAdd byte"); - byte c = (byte) vh.addAndGet(array, i, (byte)0x45); - assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndAddAcquire(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddAcquire byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndAddRelease(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddReleasebyte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value"); + } + + // get and bitwise or + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseOr(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOr byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseOrAcquire(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseOrRelease(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value"); + } + + // get and bitwise and + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseAnd(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseAndAcquire(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseAndRelease(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value"); + } + + // get and bitwise xor + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseXor(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXor byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseXorAcquire(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value"); + } + + { + vh.set(array, i, (byte)0x01); + + byte o = (byte) vh.getAndBitwiseXorRelease(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte"); + byte x = (byte) vh.get(array, i); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value"); } } } @@ -775,6 +1158,7 @@ int i = 0; + } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1216,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, (byte)0x01, (byte)0x23); + boolean r = vh.weakCompareAndSetPlain(array, ci, (byte)0x01, (byte)0x23); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, (byte)0x01, (byte)0x23); + boolean r = vh.weakCompareAndSet(array, ci, (byte)0x01, (byte)0x23); }); checkIOOBE(() -> { @@ -852,11 +1236,59 @@ }); checkIOOBE(() -> { - byte o = (byte) vh.getAndAdd(array, ci, (byte)0x45); + byte o = (byte) vh.getAndSetAcquire(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndSetRelease(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndAdd(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndAddAcquire(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndAddRelease(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseOr(array, ci, (byte)0x01); }); checkIOOBE(() -> { - byte o = (byte) vh.addAndGet(array, ci, (byte)0x45); + byte o = (byte) vh.getAndBitwiseOrAcquire(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseOrRelease(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseAnd(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseAndAcquire(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseAndRelease(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseXor(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseXorAcquire(array, ci, (byte)0x01); + }); + + checkIOOBE(() -> { + byte o = (byte) vh.getAndBitwiseXorRelease(array, ci, (byte)0x01); }); } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessChar.java Fri Sep 02 02:41:37 2016 +0000 @@ -103,14 +103,27 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,7 @@ }); + } @@ -309,6 +323,7 @@ }); + } @@ -404,11 +419,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, '\u0123', '\u4567'); + success = vh.weakCompareAndSetPlain(recv, '\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSet char"); + assertEquals(success, true, "weakCompareAndSetPlain char"); char x = (char) vh.get(recv); - assertEquals(x, '\u4567', "weakCompareAndSet char value"); + assertEquals(x, '\u4567', "weakCompareAndSetPlain char value"); } { @@ -434,34 +449,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, '\u4567', '\u0123'); + success = vh.weakCompareAndSet(recv, '\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSetVolatile char"); + assertEquals(success, true, "weakCompareAndSet char"); char x = (char) vh.get(recv); - assertEquals(x, '\u0123', "weakCompareAndSetVolatile char value"); + assertEquals(x, '\u0123', "weakCompareAndSet char value"); } // Compare set and get { + vh.set(recv, '\u0123'); + char o = (char) vh.getAndSet(recv, '\u4567'); assertEquals(o, '\u0123', "getAndSet char"); char x = (char) vh.get(recv); assertEquals(x, '\u4567', "getAndSet char value"); } - vh.set(recv, '\u0123'); + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndSetAcquire(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndSetAcquire char"); + char x = (char) vh.get(recv); + assertEquals(x, '\u4567', "getAndSetAcquire char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndSetRelease(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndSetRelease char"); + char x = (char) vh.get(recv); + assertEquals(x, '\u4567', "getAndSetRelease char value"); + } // get and add, add and get { - char o = (char) vh.getAndAdd(recv, '\u89AB'); + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndAdd(recv, '\u4567'); assertEquals(o, '\u0123', "getAndAdd char"); - char c = (char) vh.addAndGet(recv, '\u89AB'); - assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndAddAcquire(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndAddAcquire char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndAddRelease(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndAddReleasechar"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value"); + } + + // get and bitwise or + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseOr(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOr char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseOrAcquire(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseOrRelease(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrRelease char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value"); + } + + // get and bitwise and + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseAnd(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAnd char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseAndAcquire(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseAndRelease(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndRelease char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value"); + } + + // get and bitwise xor + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseXor(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXor char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseXorAcquire(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value"); + } + + { + vh.set(recv, '\u0123'); + + char o = (char) vh.getAndBitwiseXorRelease(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorRelease char"); + char x = (char) vh.get(recv); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value"); } } static void testInstanceFieldUnsupported(VarHandleTestAccessChar recv, VarHandle vh) { + } @@ -557,11 +695,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet('\u0123', '\u4567'); + success = vh.weakCompareAndSetPlain('\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSet char"); + assertEquals(success, true, "weakCompareAndSetPlain char"); char x = (char) vh.get(); - assertEquals(x, '\u4567', "weakCompareAndSet char value"); + assertEquals(x, '\u4567', "weakCompareAndSetPlain char value"); } { @@ -587,34 +725,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease('\u4567', '\u0123'); + success = vh.weakCompareAndSet('\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSetVolatile char"); + assertEquals(success, true, "weakCompareAndSet char"); char x = (char) vh.get(); - assertEquals(x, '\u0123', "weakCompareAndSetVolatile char"); + assertEquals(x, '\u0123', "weakCompareAndSet char"); } // Compare set and get { + vh.set('\u0123'); + char o = (char) vh.getAndSet('\u4567'); assertEquals(o, '\u0123', "getAndSet char"); char x = (char) vh.get(); assertEquals(x, '\u4567', "getAndSet char value"); } - vh.set('\u0123'); + { + vh.set('\u0123'); + + char o = (char) vh.getAndSetAcquire('\u4567'); + assertEquals(o, '\u0123', "getAndSetAcquire char"); + char x = (char) vh.get(); + assertEquals(x, '\u4567', "getAndSetAcquire char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndSetRelease('\u4567'); + assertEquals(o, '\u0123', "getAndSetRelease char"); + char x = (char) vh.get(); + assertEquals(x, '\u4567', "getAndSetRelease char value"); + } // get and add, add and get { - char o = (char) vh.getAndAdd( '\u89AB'); + vh.set('\u0123'); + + char o = (char) vh.getAndAdd('\u4567'); assertEquals(o, '\u0123', "getAndAdd char"); - char c = (char) vh.addAndGet('\u89AB'); - assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndAddAcquire('\u4567'); + assertEquals(o, '\u0123', "getAndAddAcquire char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndAddRelease('\u4567'); + assertEquals(o, '\u0123', "getAndAddReleasechar"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value"); + } + + // get and bitwise or + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseOr('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOr char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseOrAcquire('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseOrRelease('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrRelease char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value"); + } + + // get and bitwise and + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseAnd('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAnd char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseAndAcquire('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseAndRelease('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndRelease char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value"); + } + + // get and bitwise xor + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseXor('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXor char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseXorAcquire('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value"); + } + + { + vh.set('\u0123'); + + char o = (char) vh.getAndBitwiseXorRelease('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorRelease char"); + char x = (char) vh.get(); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value"); } } static void testStaticFieldUnsupported(VarHandle vh) { + } @@ -713,11 +974,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, '\u0123', '\u4567'); + success = vh.weakCompareAndSetPlain(array, i, '\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSet char"); + assertEquals(success, true, "weakCompareAndSetPlain char"); char x = (char) vh.get(array, i); - assertEquals(x, '\u4567', "weakCompareAndSet char value"); + assertEquals(x, '\u4567', "weakCompareAndSetPlain char value"); } { @@ -743,29 +1004,151 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, '\u4567', '\u0123'); + success = vh.weakCompareAndSet(array, i, '\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSetVolatile char"); + assertEquals(success, true, "weakCompareAndSet char"); char x = (char) vh.get(array, i); - assertEquals(x, '\u0123', "weakCompareAndSetVolatile char"); + assertEquals(x, '\u0123', "weakCompareAndSet char"); } // Compare set and get { + vh.set(array, i, '\u0123'); + char o = (char) vh.getAndSet(array, i, '\u4567'); assertEquals(o, '\u0123', "getAndSet char"); char x = (char) vh.get(array, i); assertEquals(x, '\u4567', "getAndSet char value"); } - vh.set(array, i, '\u0123'); + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndSetAcquire(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndSetAcquire char"); + char x = (char) vh.get(array, i); + assertEquals(x, '\u4567', "getAndSetAcquire char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndSetRelease(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndSetRelease char"); + char x = (char) vh.get(array, i); + assertEquals(x, '\u4567', "getAndSetRelease char value"); + } // get and add, add and get { - char o = (char) vh.getAndAdd(array, i, '\u89AB'); + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndAdd(array, i, '\u4567'); assertEquals(o, '\u0123', "getAndAdd char"); - char c = (char) vh.addAndGet(array, i, '\u89AB'); - assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndAddAcquire(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndAddAcquire char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndAddRelease(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndAddReleasechar"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value"); + } + + // get and bitwise or + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseOr(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOr char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseOrAcquire(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseOrRelease(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrRelease char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value"); + } + + // get and bitwise and + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseAnd(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAnd char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseAndAcquire(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseAndRelease(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndRelease char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value"); + } + + // get and bitwise xor + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseXor(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXor char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseXorAcquire(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value"); + } + + { + vh.set(array, i, '\u0123'); + + char o = (char) vh.getAndBitwiseXorRelease(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorRelease char"); + char x = (char) vh.get(array, i); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value"); } } } @@ -775,6 +1158,7 @@ int i = 0; + } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1216,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, '\u0123', '\u4567'); + boolean r = vh.weakCompareAndSetPlain(array, ci, '\u0123', '\u4567'); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, '\u0123', '\u4567'); + boolean r = vh.weakCompareAndSet(array, ci, '\u0123', '\u4567'); }); checkIOOBE(() -> { @@ -852,11 +1236,59 @@ }); checkIOOBE(() -> { - char o = (char) vh.getAndAdd(array, ci, '\u89AB'); + char o = (char) vh.getAndSetAcquire(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndSetRelease(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndAdd(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndAddAcquire(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndAddRelease(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseOr(array, ci, '\u0123'); }); checkIOOBE(() -> { - char o = (char) vh.addAndGet(array, ci, '\u89AB'); + char o = (char) vh.getAndBitwiseOrAcquire(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseOrRelease(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseAnd(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseAndAcquire(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseAndRelease(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseXor(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseXorAcquire(array, ci, '\u0123'); + }); + + checkIOOBE(() -> { + char o = (char) vh.getAndBitwiseXorRelease(array, ci, '\u0123'); }); } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessDouble.java Fri Sep 02 02:41:37 2016 +0000 @@ -103,14 +103,27 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,42 @@ }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(recv, 1.0d); + }); } @@ -309,6 +358,42 @@ }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(1.0d); + }); } @@ -404,11 +489,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, 1.0d, 2.0d); + success = vh.weakCompareAndSetPlain(recv, 1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) vh.get(recv); - assertEquals(x, 2.0d, "weakCompareAndSet double value"); + assertEquals(x, 2.0d, "weakCompareAndSetPlain double value"); } { @@ -434,34 +519,109 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, 2.0d, 1.0d); + success = vh.weakCompareAndSet(recv, 2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSetVolatile double"); + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) vh.get(recv); - assertEquals(x, 1.0d, "weakCompareAndSetVolatile double value"); + assertEquals(x, 1.0d, "weakCompareAndSet double value"); } // Compare set and get { + vh.set(recv, 1.0d); + double o = (double) vh.getAndSet(recv, 2.0d); assertEquals(o, 1.0d, "getAndSet double"); double x = (double) vh.get(recv); assertEquals(x, 2.0d, "getAndSet double value"); } - vh.set(recv, 1.0d); + { + vh.set(recv, 1.0d); + + double o = (double) vh.getAndSetAcquire(recv, 2.0d); + assertEquals(o, 1.0d, "getAndSetAcquire double"); + double x = (double) vh.get(recv); + assertEquals(x, 2.0d, "getAndSetAcquire double value"); + } + + { + vh.set(recv, 1.0d); + + double o = (double) vh.getAndSetRelease(recv, 2.0d); + assertEquals(o, 1.0d, "getAndSetRelease double"); + double x = (double) vh.get(recv); + assertEquals(x, 2.0d, "getAndSetRelease double value"); + } // get and add, add and get { - double o = (double) vh.getAndAdd(recv, 3.0d); + vh.set(recv, 1.0d); + + double o = (double) vh.getAndAdd(recv, 2.0d); assertEquals(o, 1.0d, "getAndAdd double"); - double c = (double) vh.addAndGet(recv, 3.0d); - assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value"); + double x = (double) vh.get(recv); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value"); } + + { + vh.set(recv, 1.0d); + + double o = (double) vh.getAndAddAcquire(recv, 2.0d); + assertEquals(o, 1.0d, "getAndAddAcquire double"); + double x = (double) vh.get(recv); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value"); + } + + { + vh.set(recv, 1.0d); + + double o = (double) vh.getAndAddRelease(recv, 2.0d); + assertEquals(o, 1.0d, "getAndAddReleasedouble"); + double x = (double) vh.get(recv); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value"); + } + } static void testInstanceFieldUnsupported(VarHandleTestAccessDouble recv, VarHandle vh) { + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(recv, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(recv, 1.0d); + }); } @@ -557,11 +717,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(1.0d, 2.0d); + success = vh.weakCompareAndSetPlain(1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) vh.get(); - assertEquals(x, 2.0d, "weakCompareAndSet double value"); + assertEquals(x, 2.0d, "weakCompareAndSetPlain double value"); } { @@ -587,34 +747,109 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease(2.0d, 1.0d); + success = vh.weakCompareAndSet(2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSetVolatile double"); + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) vh.get(); - assertEquals(x, 1.0d, "weakCompareAndSetVolatile double"); + assertEquals(x, 1.0d, "weakCompareAndSet double"); } // Compare set and get { + vh.set(1.0d); + double o = (double) vh.getAndSet(2.0d); assertEquals(o, 1.0d, "getAndSet double"); double x = (double) vh.get(); assertEquals(x, 2.0d, "getAndSet double value"); } - vh.set(1.0d); + { + vh.set(1.0d); + + double o = (double) vh.getAndSetAcquire(2.0d); + assertEquals(o, 1.0d, "getAndSetAcquire double"); + double x = (double) vh.get(); + assertEquals(x, 2.0d, "getAndSetAcquire double value"); + } + + { + vh.set(1.0d); + + double o = (double) vh.getAndSetRelease(2.0d); + assertEquals(o, 1.0d, "getAndSetRelease double"); + double x = (double) vh.get(); + assertEquals(x, 2.0d, "getAndSetRelease double value"); + } // get and add, add and get { - double o = (double) vh.getAndAdd( 3.0d); + vh.set(1.0d); + + double o = (double) vh.getAndAdd(2.0d); assertEquals(o, 1.0d, "getAndAdd double"); - double c = (double) vh.addAndGet(3.0d); - assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value"); + double x = (double) vh.get(); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value"); } + + { + vh.set(1.0d); + + double o = (double) vh.getAndAddAcquire(2.0d); + assertEquals(o, 1.0d, "getAndAddAcquire double"); + double x = (double) vh.get(); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value"); + } + + { + vh.set(1.0d); + + double o = (double) vh.getAndAddRelease(2.0d); + assertEquals(o, 1.0d, "getAndAddReleasedouble"); + double x = (double) vh.get(); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value"); + } + } static void testStaticFieldUnsupported(VarHandle vh) { + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(1.0d); + }); } @@ -713,11 +948,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, 1.0d, 2.0d); + success = vh.weakCompareAndSetPlain(array, i, 1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) vh.get(array, i); - assertEquals(x, 2.0d, "weakCompareAndSet double value"); + assertEquals(x, 2.0d, "weakCompareAndSetPlain double value"); } { @@ -743,30 +978,69 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, 2.0d, 1.0d); + success = vh.weakCompareAndSet(array, i, 2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSetVolatile double"); + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) vh.get(array, i); - assertEquals(x, 1.0d, "weakCompareAndSetVolatile double"); + assertEquals(x, 1.0d, "weakCompareAndSet double"); } // Compare set and get { + vh.set(array, i, 1.0d); + double o = (double) vh.getAndSet(array, i, 2.0d); assertEquals(o, 1.0d, "getAndSet double"); double x = (double) vh.get(array, i); assertEquals(x, 2.0d, "getAndSet double value"); } - vh.set(array, i, 1.0d); + { + vh.set(array, i, 1.0d); + + double o = (double) vh.getAndSetAcquire(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndSetAcquire double"); + double x = (double) vh.get(array, i); + assertEquals(x, 2.0d, "getAndSetAcquire double value"); + } + + { + vh.set(array, i, 1.0d); + + double o = (double) vh.getAndSetRelease(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndSetRelease double"); + double x = (double) vh.get(array, i); + assertEquals(x, 2.0d, "getAndSetRelease double value"); + } // get and add, add and get { - double o = (double) vh.getAndAdd(array, i, 3.0d); + vh.set(array, i, 1.0d); + + double o = (double) vh.getAndAdd(array, i, 2.0d); assertEquals(o, 1.0d, "getAndAdd double"); - double c = (double) vh.addAndGet(array, i, 3.0d); - assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value"); + double x = (double) vh.get(array, i); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value"); } + + { + vh.set(array, i, 1.0d); + + double o = (double) vh.getAndAddAcquire(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndAddAcquire double"); + double x = (double) vh.get(array, i); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value"); + } + + { + vh.set(array, i, 1.0d); + + double o = (double) vh.getAndAddRelease(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndAddReleasedouble"); + double x = (double) vh.get(array, i); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value"); + } + } } @@ -775,6 +1049,42 @@ int i = 0; + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(array, i, 1.0d); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(array, i, 1.0d); + }); } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1142,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, 1.0d, 2.0d); + boolean r = vh.weakCompareAndSetPlain(array, ci, 1.0d, 2.0d); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, 1.0d, 2.0d); + boolean r = vh.weakCompareAndSet(array, ci, 1.0d, 2.0d); }); checkIOOBE(() -> { @@ -852,12 +1162,25 @@ }); checkIOOBE(() -> { - double o = (double) vh.getAndAdd(array, ci, 3.0d); + double o = (double) vh.getAndSetAcquire(array, ci, 1.0d); + }); + + checkIOOBE(() -> { + double o = (double) vh.getAndSetRelease(array, ci, 1.0d); }); checkIOOBE(() -> { - double o = (double) vh.addAndGet(array, ci, 3.0d); + double o = (double) vh.getAndAdd(array, ci, 1.0d); + }); + + checkIOOBE(() -> { + double o = (double) vh.getAndAddAcquire(array, ci, 1.0d); }); + + checkIOOBE(() -> { + double o = (double) vh.getAndAddRelease(array, ci, 1.0d); + }); + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessFloat.java Fri Sep 02 02:41:37 2016 +0000 @@ -103,14 +103,27 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,42 @@ }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(recv, 1.0f); + }); } @@ -309,6 +358,42 @@ }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(1.0f); + }); } @@ -404,11 +489,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, 1.0f, 2.0f); + success = vh.weakCompareAndSetPlain(recv, 1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) vh.get(recv); - assertEquals(x, 2.0f, "weakCompareAndSet float value"); + assertEquals(x, 2.0f, "weakCompareAndSetPlain float value"); } { @@ -434,34 +519,109 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, 2.0f, 1.0f); + success = vh.weakCompareAndSet(recv, 2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSetVolatile float"); + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) vh.get(recv); - assertEquals(x, 1.0f, "weakCompareAndSetVolatile float value"); + assertEquals(x, 1.0f, "weakCompareAndSet float value"); } // Compare set and get { + vh.set(recv, 1.0f); + float o = (float) vh.getAndSet(recv, 2.0f); assertEquals(o, 1.0f, "getAndSet float"); float x = (float) vh.get(recv); assertEquals(x, 2.0f, "getAndSet float value"); } - vh.set(recv, 1.0f); + { + vh.set(recv, 1.0f); + + float o = (float) vh.getAndSetAcquire(recv, 2.0f); + assertEquals(o, 1.0f, "getAndSetAcquire float"); + float x = (float) vh.get(recv); + assertEquals(x, 2.0f, "getAndSetAcquire float value"); + } + + { + vh.set(recv, 1.0f); + + float o = (float) vh.getAndSetRelease(recv, 2.0f); + assertEquals(o, 1.0f, "getAndSetRelease float"); + float x = (float) vh.get(recv); + assertEquals(x, 2.0f, "getAndSetRelease float value"); + } // get and add, add and get { - float o = (float) vh.getAndAdd(recv, 3.0f); + vh.set(recv, 1.0f); + + float o = (float) vh.getAndAdd(recv, 2.0f); assertEquals(o, 1.0f, "getAndAdd float"); - float c = (float) vh.addAndGet(recv, 3.0f); - assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value"); + float x = (float) vh.get(recv); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value"); } + + { + vh.set(recv, 1.0f); + + float o = (float) vh.getAndAddAcquire(recv, 2.0f); + assertEquals(o, 1.0f, "getAndAddAcquire float"); + float x = (float) vh.get(recv); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value"); + } + + { + vh.set(recv, 1.0f); + + float o = (float) vh.getAndAddRelease(recv, 2.0f); + assertEquals(o, 1.0f, "getAndAddReleasefloat"); + float x = (float) vh.get(recv); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value"); + } + } static void testInstanceFieldUnsupported(VarHandleTestAccessFloat recv, VarHandle vh) { + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(recv, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(recv, 1.0f); + }); } @@ -557,11 +717,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(1.0f, 2.0f); + success = vh.weakCompareAndSetPlain(1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) vh.get(); - assertEquals(x, 2.0f, "weakCompareAndSet float value"); + assertEquals(x, 2.0f, "weakCompareAndSetPlain float value"); } { @@ -587,34 +747,109 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease(2.0f, 1.0f); + success = vh.weakCompareAndSet(2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSetVolatile float"); + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) vh.get(); - assertEquals(x, 1.0f, "weakCompareAndSetVolatile float"); + assertEquals(x, 1.0f, "weakCompareAndSet float"); } // Compare set and get { + vh.set(1.0f); + float o = (float) vh.getAndSet(2.0f); assertEquals(o, 1.0f, "getAndSet float"); float x = (float) vh.get(); assertEquals(x, 2.0f, "getAndSet float value"); } - vh.set(1.0f); + { + vh.set(1.0f); + + float o = (float) vh.getAndSetAcquire(2.0f); + assertEquals(o, 1.0f, "getAndSetAcquire float"); + float x = (float) vh.get(); + assertEquals(x, 2.0f, "getAndSetAcquire float value"); + } + + { + vh.set(1.0f); + + float o = (float) vh.getAndSetRelease(2.0f); + assertEquals(o, 1.0f, "getAndSetRelease float"); + float x = (float) vh.get(); + assertEquals(x, 2.0f, "getAndSetRelease float value"); + } // get and add, add and get { - float o = (float) vh.getAndAdd( 3.0f); + vh.set(1.0f); + + float o = (float) vh.getAndAdd(2.0f); assertEquals(o, 1.0f, "getAndAdd float"); - float c = (float) vh.addAndGet(3.0f); - assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value"); + float x = (float) vh.get(); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value"); } + + { + vh.set(1.0f); + + float o = (float) vh.getAndAddAcquire(2.0f); + assertEquals(o, 1.0f, "getAndAddAcquire float"); + float x = (float) vh.get(); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value"); + } + + { + vh.set(1.0f); + + float o = (float) vh.getAndAddRelease(2.0f); + assertEquals(o, 1.0f, "getAndAddReleasefloat"); + float x = (float) vh.get(); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value"); + } + } static void testStaticFieldUnsupported(VarHandle vh) { + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(1.0f); + }); } @@ -713,11 +948,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, 1.0f, 2.0f); + success = vh.weakCompareAndSetPlain(array, i, 1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) vh.get(array, i); - assertEquals(x, 2.0f, "weakCompareAndSet float value"); + assertEquals(x, 2.0f, "weakCompareAndSetPlain float value"); } { @@ -743,30 +978,69 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, 2.0f, 1.0f); + success = vh.weakCompareAndSet(array, i, 2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSetVolatile float"); + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) vh.get(array, i); - assertEquals(x, 1.0f, "weakCompareAndSetVolatile float"); + assertEquals(x, 1.0f, "weakCompareAndSet float"); } // Compare set and get { + vh.set(array, i, 1.0f); + float o = (float) vh.getAndSet(array, i, 2.0f); assertEquals(o, 1.0f, "getAndSet float"); float x = (float) vh.get(array, i); assertEquals(x, 2.0f, "getAndSet float value"); } - vh.set(array, i, 1.0f); + { + vh.set(array, i, 1.0f); + + float o = (float) vh.getAndSetAcquire(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndSetAcquire float"); + float x = (float) vh.get(array, i); + assertEquals(x, 2.0f, "getAndSetAcquire float value"); + } + + { + vh.set(array, i, 1.0f); + + float o = (float) vh.getAndSetRelease(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndSetRelease float"); + float x = (float) vh.get(array, i); + assertEquals(x, 2.0f, "getAndSetRelease float value"); + } // get and add, add and get { - float o = (float) vh.getAndAdd(array, i, 3.0f); + vh.set(array, i, 1.0f); + + float o = (float) vh.getAndAdd(array, i, 2.0f); assertEquals(o, 1.0f, "getAndAdd float"); - float c = (float) vh.addAndGet(array, i, 3.0f); - assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value"); + float x = (float) vh.get(array, i); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value"); } + + { + vh.set(array, i, 1.0f); + + float o = (float) vh.getAndAddAcquire(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndAddAcquire float"); + float x = (float) vh.get(array, i); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value"); + } + + { + vh.set(array, i, 1.0f); + + float o = (float) vh.getAndAddRelease(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndAddReleasefloat"); + float x = (float) vh.get(array, i); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value"); + } + } } @@ -775,6 +1049,42 @@ int i = 0; + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(array, i, 1.0f); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(array, i, 1.0f); + }); } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1142,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, 1.0f, 2.0f); + boolean r = vh.weakCompareAndSetPlain(array, ci, 1.0f, 2.0f); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, 1.0f, 2.0f); + boolean r = vh.weakCompareAndSet(array, ci, 1.0f, 2.0f); }); checkIOOBE(() -> { @@ -852,12 +1162,25 @@ }); checkIOOBE(() -> { - float o = (float) vh.getAndAdd(array, ci, 3.0f); + float o = (float) vh.getAndSetAcquire(array, ci, 1.0f); + }); + + checkIOOBE(() -> { + float o = (float) vh.getAndSetRelease(array, ci, 1.0f); }); checkIOOBE(() -> { - float o = (float) vh.addAndGet(array, ci, 3.0f); + float o = (float) vh.getAndAdd(array, ci, 1.0f); + }); + + checkIOOBE(() -> { + float o = (float) vh.getAndAddAcquire(array, ci, 1.0f); }); + + checkIOOBE(() -> { + float o = (float) vh.getAndAddRelease(array, ci, 1.0f); + }); + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessInt.java Fri Sep 02 02:41:37 2016 +0000 @@ -103,14 +103,27 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,7 @@ }); + } @@ -309,6 +323,7 @@ }); + } @@ -404,11 +419,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, 0x01234567, 0x89ABCDEF); + success = vh.weakCompareAndSetPlain(recv, 0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) vh.get(recv); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSet int value"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value"); } { @@ -434,34 +449,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, 0x89ABCDEF, 0x01234567); + success = vh.weakCompareAndSet(recv, 0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSetVolatile int"); + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(recv); - assertEquals(x, 0x01234567, "weakCompareAndSetVolatile int value"); + assertEquals(x, 0x01234567, "weakCompareAndSet int value"); } // Compare set and get { + vh.set(recv, 0x01234567); + int o = (int) vh.getAndSet(recv, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndSet int"); int x = (int) vh.get(recv); assertEquals(x, 0x89ABCDEF, "getAndSet int value"); } - vh.set(recv, 0x01234567); + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndSetAcquire(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetAcquire int"); + int x = (int) vh.get(recv); + assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndSetRelease(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetRelease int"); + int x = (int) vh.get(recv); + assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) vh.getAndAdd(recv, 0xCAFEBABE); + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndAdd(recv, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndAdd int"); - int c = (int) vh.addAndGet(recv, 0xCAFEBABE); - assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndAddAcquire(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddAcquire int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndAddRelease(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddReleaseint"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value"); + } + + // get and bitwise or + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseOr(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOr int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseOrAcquire(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseOrRelease(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseAnd(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAnd int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseAndAcquire(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseAndRelease(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseXor(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXor int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseXorAcquire(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value"); + } + + { + vh.set(recv, 0x01234567); + + int o = (int) vh.getAndBitwiseXorRelease(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int"); + int x = (int) vh.get(recv); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value"); } } static void testInstanceFieldUnsupported(VarHandleTestAccessInt recv, VarHandle vh) { + } @@ -557,11 +695,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(0x01234567, 0x89ABCDEF); + success = vh.weakCompareAndSetPlain(0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) vh.get(); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSet int value"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value"); } { @@ -587,34 +725,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease(0x89ABCDEF, 0x01234567); + success = vh.weakCompareAndSet(0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSetVolatile int"); + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(); - assertEquals(x, 0x01234567, "weakCompareAndSetVolatile int"); + assertEquals(x, 0x01234567, "weakCompareAndSet int"); } // Compare set and get { + vh.set(0x01234567); + int o = (int) vh.getAndSet(0x89ABCDEF); assertEquals(o, 0x01234567, "getAndSet int"); int x = (int) vh.get(); assertEquals(x, 0x89ABCDEF, "getAndSet int value"); } - vh.set(0x01234567); + { + vh.set(0x01234567); + + int o = (int) vh.getAndSetAcquire(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetAcquire int"); + int x = (int) vh.get(); + assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndSetRelease(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetRelease int"); + int x = (int) vh.get(); + assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) vh.getAndAdd( 0xCAFEBABE); + vh.set(0x01234567); + + int o = (int) vh.getAndAdd(0x89ABCDEF); assertEquals(o, 0x01234567, "getAndAdd int"); - int c = (int) vh.addAndGet(0xCAFEBABE); - assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndAddAcquire(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddAcquire int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndAddRelease(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddReleaseint"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value"); + } + + // get and bitwise or + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseOr(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOr int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseOrAcquire(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseOrRelease(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseAnd(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAnd int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseAndAcquire(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseAndRelease(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseXor(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXor int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseXorAcquire(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value"); + } + + { + vh.set(0x01234567); + + int o = (int) vh.getAndBitwiseXorRelease(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int"); + int x = (int) vh.get(); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value"); } } static void testStaticFieldUnsupported(VarHandle vh) { + } @@ -713,11 +974,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, 0x01234567, 0x89ABCDEF); + success = vh.weakCompareAndSetPlain(array, i, 0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) vh.get(array, i); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSet int value"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value"); } { @@ -743,29 +1004,151 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, 0x89ABCDEF, 0x01234567); + success = vh.weakCompareAndSet(array, i, 0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSetVolatile int"); + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(array, i); - assertEquals(x, 0x01234567, "weakCompareAndSetVolatile int"); + assertEquals(x, 0x01234567, "weakCompareAndSet int"); } // Compare set and get { + vh.set(array, i, 0x01234567); + int o = (int) vh.getAndSet(array, i, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndSet int"); int x = (int) vh.get(array, i); assertEquals(x, 0x89ABCDEF, "getAndSet int value"); } - vh.set(array, i, 0x01234567); + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndSetAcquire(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndSetRelease(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) vh.getAndAdd(array, i, 0xCAFEBABE); + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndAdd(array, i, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndAdd int"); - int c = (int) vh.addAndGet(array, i, 0xCAFEBABE); - assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndAddAcquire(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndAddRelease(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddReleaseint"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value"); + } + + // get and bitwise or + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseOr(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOr int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseOrAcquire(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseOrRelease(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseAnd(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAnd int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseAndAcquire(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseAndRelease(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseXor(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXor int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseXorAcquire(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value"); + } + + { + vh.set(array, i, 0x01234567); + + int o = (int) vh.getAndBitwiseXorRelease(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value"); } } } @@ -775,6 +1158,7 @@ int i = 0; + } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1216,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, 0x01234567, 0x89ABCDEF); + boolean r = vh.weakCompareAndSetPlain(array, ci, 0x01234567, 0x89ABCDEF); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, 0x01234567, 0x89ABCDEF); + boolean r = vh.weakCompareAndSet(array, ci, 0x01234567, 0x89ABCDEF); }); checkIOOBE(() -> { @@ -852,11 +1236,59 @@ }); checkIOOBE(() -> { - int o = (int) vh.getAndAdd(array, ci, 0xCAFEBABE); + int o = (int) vh.getAndSetAcquire(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndSetRelease(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndAdd(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndAddAcquire(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndAddRelease(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOr(array, ci, 0x01234567); }); checkIOOBE(() -> { - int o = (int) vh.addAndGet(array, ci, 0xCAFEBABE); + int o = (int) vh.getAndBitwiseOrAcquire(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOrRelease(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAnd(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAndAcquire(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAndRelease(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXor(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXorAcquire(array, ci, 0x01234567); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXorRelease(array, ci, 0x01234567); }); } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessLong.java Fri Sep 02 02:41:37 2016 +0000 @@ -103,14 +103,27 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,7 @@ }); + } @@ -309,6 +323,7 @@ }); + } @@ -404,11 +419,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = vh.weakCompareAndSetPlain(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) vh.get(recv); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSet long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value"); } { @@ -434,34 +449,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = vh.weakCompareAndSet(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSetVolatile long"); + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(recv); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetVolatile long value"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long value"); } // Compare set and get { + vh.set(recv, 0x0123456789ABCDEFL); + long o = (long) vh.getAndSet(recv, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long"); long x = (long) vh.get(recv); assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value"); } - vh.set(recv, 0x0123456789ABCDEFL); + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndSetAcquire(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long"); + long x = (long) vh.get(recv); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndSetRelease(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long"); + long x = (long) vh.get(recv); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) vh.getAndAdd(recv, 0xDEADBEEFDEADBEEFL); + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndAdd(recv, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long"); - long c = (long) vh.addAndGet(recv, 0xDEADBEEFDEADBEEFL); - assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndAddAcquire(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndAddRelease(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddReleaselong"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value"); + } + + // get and bitwise or + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOr(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOrAcquire(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOrRelease(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAnd(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAndAcquire(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAndRelease(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXor(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXorAcquire(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value"); + } + + { + vh.set(recv, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXorRelease(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long"); + long x = (long) vh.get(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value"); } } static void testInstanceFieldUnsupported(VarHandleTestAccessLong recv, VarHandle vh) { + } @@ -557,11 +695,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = vh.weakCompareAndSetPlain(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) vh.get(); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSet long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value"); } { @@ -587,34 +725,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = vh.weakCompareAndSet(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSetVolatile long"); + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetVolatile long"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long"); } // Compare set and get { + vh.set(0x0123456789ABCDEFL); + long o = (long) vh.getAndSet(0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long"); long x = (long) vh.get(); assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value"); } - vh.set(0x0123456789ABCDEFL); + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndSetAcquire(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long"); + long x = (long) vh.get(); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndSetRelease(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long"); + long x = (long) vh.get(); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) vh.getAndAdd( 0xDEADBEEFDEADBEEFL); + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndAdd(0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long"); - long c = (long) vh.addAndGet(0xDEADBEEFDEADBEEFL); - assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndAddAcquire(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndAddRelease(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddReleaselong"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value"); + } + + // get and bitwise or + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOr(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOrAcquire(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOrRelease(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAnd(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAndAcquire(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAndRelease(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXor(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXorAcquire(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value"); + } + + { + vh.set(0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXorRelease(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long"); + long x = (long) vh.get(); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value"); } } static void testStaticFieldUnsupported(VarHandle vh) { + } @@ -713,11 +974,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = vh.weakCompareAndSetPlain(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) vh.get(array, i); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSet long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value"); } { @@ -743,29 +1004,151 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = vh.weakCompareAndSet(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSetVolatile long"); + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(array, i); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetVolatile long"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long"); } // Compare set and get { + vh.set(array, i, 0x0123456789ABCDEFL); + long o = (long) vh.getAndSet(array, i, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long"); long x = (long) vh.get(array, i); assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value"); } - vh.set(array, i, 0x0123456789ABCDEFL); + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndSetAcquire(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndSetRelease(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) vh.getAndAdd(array, i, 0xDEADBEEFDEADBEEFL); + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndAdd(array, i, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long"); - long c = (long) vh.addAndGet(array, i, 0xDEADBEEFDEADBEEFL); - assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndAddAcquire(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndAddRelease(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddReleaselong"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value"); + } + + // get and bitwise or + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOr(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOrAcquire(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseOrRelease(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAnd(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAndAcquire(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseAndRelease(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXor(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXorAcquire(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value"); + } + + { + vh.set(array, i, 0x0123456789ABCDEFL); + + long o = (long) vh.getAndBitwiseXorRelease(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value"); } } } @@ -775,6 +1158,7 @@ int i = 0; + } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1216,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + boolean r = vh.weakCompareAndSetPlain(array, ci, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + boolean r = vh.weakCompareAndSet(array, ci, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); }); checkIOOBE(() -> { @@ -852,11 +1236,59 @@ }); checkIOOBE(() -> { - long o = (long) vh.getAndAdd(array, ci, 0xDEADBEEFDEADBEEFL); + long o = (long) vh.getAndSetAcquire(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndSetRelease(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndAdd(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndAddAcquire(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndAddRelease(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOr(array, ci, 0x0123456789ABCDEFL); }); checkIOOBE(() -> { - long o = (long) vh.addAndGet(array, ci, 0xDEADBEEFDEADBEEFL); + long o = (long) vh.getAndBitwiseOrAcquire(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOrRelease(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAnd(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAndAcquire(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAndRelease(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXor(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXorAcquire(array, ci, 0x0123456789ABCDEFL); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXorRelease(array, ci, 0x0123456789ABCDEFL); }); } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessShort.java Fri Sep 02 02:41:37 2016 +0000 @@ -103,14 +103,27 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -261,6 +274,7 @@ }); + } @@ -309,6 +323,7 @@ }); + } @@ -404,11 +419,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, (short)0x0123, (short)0x4567); + success = vh.weakCompareAndSetPlain(recv, (short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSet short"); + assertEquals(success, true, "weakCompareAndSetPlain short"); short x = (short) vh.get(recv); - assertEquals(x, (short)0x4567, "weakCompareAndSet short value"); + assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value"); } { @@ -434,34 +449,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, (short)0x4567, (short)0x0123); + success = vh.weakCompareAndSet(recv, (short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSetVolatile short"); + assertEquals(success, true, "weakCompareAndSet short"); short x = (short) vh.get(recv); - assertEquals(x, (short)0x0123, "weakCompareAndSetVolatile short value"); + assertEquals(x, (short)0x0123, "weakCompareAndSet short value"); } // Compare set and get { + vh.set(recv, (short)0x0123); + short o = (short) vh.getAndSet(recv, (short)0x4567); assertEquals(o, (short)0x0123, "getAndSet short"); short x = (short) vh.get(recv); assertEquals(x, (short)0x4567, "getAndSet short value"); } - vh.set(recv, (short)0x0123); + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndSetAcquire(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetAcquire short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)0x4567, "getAndSetAcquire short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndSetRelease(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetRelease short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)0x4567, "getAndSetRelease short value"); + } // get and add, add and get { - short o = (short) vh.getAndAdd(recv, (short)0x89AB); + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndAdd(recv, (short)0x4567); assertEquals(o, (short)0x0123, "getAndAdd short"); - short c = (short) vh.addAndGet(recv, (short)0x89AB); - assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndAddAcquire(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddAcquire short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndAddRelease(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddReleaseshort"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value"); + } + + // get and bitwise or + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseOr(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOr short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseOrAcquire(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseOrRelease(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value"); + } + + // get and bitwise and + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseAnd(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAnd short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseAndAcquire(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseAndRelease(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value"); + } + + // get and bitwise xor + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseXor(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXor short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseXorAcquire(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value"); + } + + { + vh.set(recv, (short)0x0123); + + short o = (short) vh.getAndBitwiseXorRelease(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short"); + short x = (short) vh.get(recv); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value"); } } static void testInstanceFieldUnsupported(VarHandleTestAccessShort recv, VarHandle vh) { + } @@ -557,11 +695,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet((short)0x0123, (short)0x4567); + success = vh.weakCompareAndSetPlain((short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSet short"); + assertEquals(success, true, "weakCompareAndSetPlain short"); short x = (short) vh.get(); - assertEquals(x, (short)0x4567, "weakCompareAndSet short value"); + assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value"); } { @@ -587,34 +725,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease((short)0x4567, (short)0x0123); + success = vh.weakCompareAndSet((short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSetVolatile short"); + assertEquals(success, true, "weakCompareAndSet short"); short x = (short) vh.get(); - assertEquals(x, (short)0x0123, "weakCompareAndSetVolatile short"); + assertEquals(x, (short)0x0123, "weakCompareAndSet short"); } // Compare set and get { + vh.set((short)0x0123); + short o = (short) vh.getAndSet((short)0x4567); assertEquals(o, (short)0x0123, "getAndSet short"); short x = (short) vh.get(); assertEquals(x, (short)0x4567, "getAndSet short value"); } - vh.set((short)0x0123); + { + vh.set((short)0x0123); + + short o = (short) vh.getAndSetAcquire((short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetAcquire short"); + short x = (short) vh.get(); + assertEquals(x, (short)0x4567, "getAndSetAcquire short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndSetRelease((short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetRelease short"); + short x = (short) vh.get(); + assertEquals(x, (short)0x4567, "getAndSetRelease short value"); + } // get and add, add and get { - short o = (short) vh.getAndAdd( (short)0x89AB); + vh.set((short)0x0123); + + short o = (short) vh.getAndAdd((short)0x4567); assertEquals(o, (short)0x0123, "getAndAdd short"); - short c = (short) vh.addAndGet((short)0x89AB); - assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndAddAcquire((short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddAcquire short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndAddRelease((short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddReleaseshort"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value"); + } + + // get and bitwise or + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseOr((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOr short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseOrAcquire((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseOrRelease((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value"); + } + + // get and bitwise and + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseAnd((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAnd short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseAndAcquire((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseAndRelease((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value"); + } + + // get and bitwise xor + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseXor((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXor short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseXorAcquire((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value"); + } + + { + vh.set((short)0x0123); + + short o = (short) vh.getAndBitwiseXorRelease((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short"); + short x = (short) vh.get(); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value"); } } static void testStaticFieldUnsupported(VarHandle vh) { + } @@ -713,11 +974,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, (short)0x0123, (short)0x4567); + success = vh.weakCompareAndSetPlain(array, i, (short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSet short"); + assertEquals(success, true, "weakCompareAndSetPlain short"); short x = (short) vh.get(array, i); - assertEquals(x, (short)0x4567, "weakCompareAndSet short value"); + assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value"); } { @@ -743,29 +1004,151 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, (short)0x4567, (short)0x0123); + success = vh.weakCompareAndSet(array, i, (short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSetVolatile short"); + assertEquals(success, true, "weakCompareAndSet short"); short x = (short) vh.get(array, i); - assertEquals(x, (short)0x0123, "weakCompareAndSetVolatile short"); + assertEquals(x, (short)0x0123, "weakCompareAndSet short"); } // Compare set and get { + vh.set(array, i, (short)0x0123); + short o = (short) vh.getAndSet(array, i, (short)0x4567); assertEquals(o, (short)0x0123, "getAndSet short"); short x = (short) vh.get(array, i); assertEquals(x, (short)0x4567, "getAndSet short value"); } - vh.set(array, i, (short)0x0123); + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndSetAcquire(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetAcquire short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)0x4567, "getAndSetAcquire short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndSetRelease(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetRelease short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)0x4567, "getAndSetRelease short value"); + } // get and add, add and get { - short o = (short) vh.getAndAdd(array, i, (short)0x89AB); + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndAdd(array, i, (short)0x4567); assertEquals(o, (short)0x0123, "getAndAdd short"); - short c = (short) vh.addAndGet(array, i, (short)0x89AB); - assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndAddAcquire(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddAcquire short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndAddRelease(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddReleaseshort"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value"); + } + + // get and bitwise or + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseOr(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOr short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseOrAcquire(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseOrRelease(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value"); + } + + // get and bitwise and + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseAnd(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAnd short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseAndAcquire(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseAndRelease(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value"); + } + + // get and bitwise xor + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseXor(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXor short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseXorAcquire(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value"); + } + + { + vh.set(array, i, (short)0x0123); + + short o = (short) vh.getAndBitwiseXorRelease(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short"); + short x = (short) vh.get(array, i); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value"); } } } @@ -775,6 +1158,7 @@ int i = 0; + } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -832,11 +1216,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, (short)0x0123, (short)0x4567); + boolean r = vh.weakCompareAndSetPlain(array, ci, (short)0x0123, (short)0x4567); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, (short)0x0123, (short)0x4567); + boolean r = vh.weakCompareAndSet(array, ci, (short)0x0123, (short)0x4567); }); checkIOOBE(() -> { @@ -852,11 +1236,59 @@ }); checkIOOBE(() -> { - short o = (short) vh.getAndAdd(array, ci, (short)0x89AB); + short o = (short) vh.getAndSetAcquire(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndSetRelease(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndAdd(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndAddAcquire(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndAddRelease(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseOr(array, ci, (short)0x0123); }); checkIOOBE(() -> { - short o = (short) vh.addAndGet(array, ci, (short)0x89AB); + short o = (short) vh.getAndBitwiseOrAcquire(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseOrRelease(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseAnd(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseAndAcquire(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseAndRelease(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseXor(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseXorAcquire(array, ci, (short)0x0123); + }); + + checkIOOBE(() -> { + short o = (short) vh.getAndBitwiseXorRelease(array, ci, (short)0x0123); }); } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestAccessString.java Fri Sep 02 02:41:37 2016 +0000 @@ -103,14 +103,27 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @@ -266,7 +279,47 @@ }); checkUOE(() -> { - String o = (String) vh.addAndGet(recv, "foo"); + String o = (String) vh.getAndAddAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndAddRelease(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOr(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrRelease(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAnd(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndRelease(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXor(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorRelease(recv, "foo"); }); } @@ -321,7 +374,47 @@ }); checkUOE(() -> { - String o = (String) vh.addAndGet("foo"); + String o = (String) vh.getAndAddAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndAddRelease("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOr("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrRelease("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAnd("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndRelease("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXor("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorRelease("foo"); }); } @@ -418,11 +511,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, "foo", "bar"); + success = vh.weakCompareAndSetPlain(recv, "foo", "bar"); } - assertEquals(success, true, "weakCompareAndSet String"); + assertEquals(success, true, "weakCompareAndSetPlain String"); String x = (String) vh.get(recv); - assertEquals(x, "bar", "weakCompareAndSet String value"); + assertEquals(x, "bar", "weakCompareAndSetPlain String value"); } { @@ -448,21 +541,42 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, "bar", "foo"); + success = vh.weakCompareAndSet(recv, "bar", "foo"); } - assertEquals(success, true, "weakCompareAndSetVolatile String"); + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) vh.get(recv); - assertEquals(x, "foo", "weakCompareAndSetVolatile String value"); + assertEquals(x, "foo", "weakCompareAndSet String value"); } // Compare set and get { + vh.set(recv, "foo"); + String o = (String) vh.getAndSet(recv, "bar"); assertEquals(o, "foo", "getAndSet String"); String x = (String) vh.get(recv); assertEquals(x, "bar", "getAndSet String value"); } + { + vh.set(recv, "foo"); + + String o = (String) vh.getAndSetAcquire(recv, "bar"); + assertEquals(o, "foo", "getAndSetAcquire String"); + String x = (String) vh.get(recv); + assertEquals(x, "bar", "getAndSetAcquire String value"); + } + + { + vh.set(recv, "foo"); + + String o = (String) vh.getAndSetRelease(recv, "bar"); + assertEquals(o, "foo", "getAndSetRelease String"); + String x = (String) vh.get(recv); + assertEquals(x, "bar", "getAndSetRelease String value"); + } + + } static void testInstanceFieldUnsupported(VarHandleTestAccessString recv, VarHandle vh) { @@ -472,7 +586,47 @@ }); checkUOE(() -> { - String o = (String) vh.addAndGet(recv, "foo"); + String o = (String) vh.getAndAddAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndAddRelease(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOr(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrRelease(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAnd(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndRelease(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXor(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorAcquire(recv, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorRelease(recv, "foo"); }); } @@ -569,11 +723,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet("foo", "bar"); + success = vh.weakCompareAndSetPlain("foo", "bar"); } - assertEquals(success, true, "weakCompareAndSet String"); + assertEquals(success, true, "weakCompareAndSetPlain String"); String x = (String) vh.get(); - assertEquals(x, "bar", "weakCompareAndSet String value"); + assertEquals(x, "bar", "weakCompareAndSetPlain String value"); } { @@ -599,21 +753,42 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease("bar", "foo"); + success = vh.weakCompareAndSet("bar", "foo"); } - assertEquals(success, true, "weakCompareAndSetVolatile String"); + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) vh.get(); - assertEquals(x, "foo", "weakCompareAndSetVolatile String"); + assertEquals(x, "foo", "weakCompareAndSet String"); } // Compare set and get { + vh.set("foo"); + String o = (String) vh.getAndSet("bar"); assertEquals(o, "foo", "getAndSet String"); String x = (String) vh.get(); assertEquals(x, "bar", "getAndSet String value"); } + { + vh.set("foo"); + + String o = (String) vh.getAndSetAcquire("bar"); + assertEquals(o, "foo", "getAndSetAcquire String"); + String x = (String) vh.get(); + assertEquals(x, "bar", "getAndSetAcquire String value"); + } + + { + vh.set("foo"); + + String o = (String) vh.getAndSetRelease("bar"); + assertEquals(o, "foo", "getAndSetRelease String"); + String x = (String) vh.get(); + assertEquals(x, "bar", "getAndSetRelease String value"); + } + + } static void testStaticFieldUnsupported(VarHandle vh) { @@ -623,7 +798,47 @@ }); checkUOE(() -> { - String o = (String) vh.addAndGet("foo"); + String o = (String) vh.getAndAddAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndAddRelease("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOr("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrRelease("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAnd("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndRelease("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXor("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorAcquire("foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorRelease("foo"); }); } @@ -723,11 +938,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, "foo", "bar"); + success = vh.weakCompareAndSetPlain(array, i, "foo", "bar"); } - assertEquals(success, true, "weakCompareAndSet String"); + assertEquals(success, true, "weakCompareAndSetPlain String"); String x = (String) vh.get(array, i); - assertEquals(x, "bar", "weakCompareAndSet String value"); + assertEquals(x, "bar", "weakCompareAndSetPlain String value"); } { @@ -753,21 +968,42 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, "bar", "foo"); + success = vh.weakCompareAndSet(array, i, "bar", "foo"); } - assertEquals(success, true, "weakCompareAndSetVolatile String"); + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) vh.get(array, i); - assertEquals(x, "foo", "weakCompareAndSetVolatile String"); + assertEquals(x, "foo", "weakCompareAndSet String"); } // Compare set and get { + vh.set(array, i, "foo"); + String o = (String) vh.getAndSet(array, i, "bar"); assertEquals(o, "foo", "getAndSet String"); String x = (String) vh.get(array, i); assertEquals(x, "bar", "getAndSet String value"); } + { + vh.set(array, i, "foo"); + + String o = (String) vh.getAndSetAcquire(array, i, "bar"); + assertEquals(o, "foo", "getAndSetAcquire String"); + String x = (String) vh.get(array, i); + assertEquals(x, "bar", "getAndSetAcquire String value"); + } + + { + vh.set(array, i, "foo"); + + String o = (String) vh.getAndSetRelease(array, i, "bar"); + assertEquals(o, "foo", "getAndSetRelease String"); + String x = (String) vh.get(array, i); + assertEquals(x, "bar", "getAndSetRelease String value"); + } + + } } @@ -781,7 +1017,47 @@ }); checkUOE(() -> { - String o = (String) vh.addAndGet(array, i, "foo"); + String o = (String) vh.getAndAddAcquire(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndAddRelease(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOr(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrAcquire(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseOrRelease(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAnd(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndAcquire(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseAndRelease(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXor(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorAcquire(array, i, "foo"); + }); + + checkUOE(() -> { + String o = (String) vh.getAndBitwiseXorRelease(array, i, "foo"); }); } @@ -840,11 +1116,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, "foo", "bar"); + boolean r = vh.weakCompareAndSetPlain(array, ci, "foo", "bar"); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, "foo", "bar"); + boolean r = vh.weakCompareAndSet(array, ci, "foo", "bar"); }); checkIOOBE(() -> { @@ -859,6 +1135,15 @@ String o = (String) vh.getAndSet(array, ci, "foo"); }); + checkIOOBE(() -> { + String o = (String) vh.getAndSetAcquire(array, ci, "foo"); + }); + + checkIOOBE(() -> { + String o = (String) vh.getAndSetRelease(array, ci, "foo"); + }); + + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsChar.java Fri Sep 02 02:41:37 2016 +0000 @@ -92,14 +92,27 @@ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @Test(dataProvider = "typesProvider") @@ -201,11 +214,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -221,11 +234,59 @@ }); checkUOE(() -> { + char o = (char) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { char o = (char) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - char o = (char) vh.addAndGet(array, ci, VALUE_1); + char o = (char) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } @@ -270,11 +331,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -290,11 +351,59 @@ }); checkUOE(() -> { + char o = (char) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { char o = (char) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - char o = (char) vh.addAndGet(array, ci, VALUE_1); + char o = (char) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } else { @@ -315,11 +424,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -333,12 +442,59 @@ checkUOE(() -> { char o = (char) vh.getAndSet(array, ci, VALUE_1); }); + + checkUOE(() -> { + char o = (char) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndSetRelease(array, ci, VALUE_1); + }); checkUOE(() -> { char o = (char) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - char o = (char) vh.addAndGet(array, ci, VALUE_1); + char o = (char) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndAddRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + char o = (char) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -385,6 +541,7 @@ }); + } } @@ -434,6 +591,7 @@ }); + } } } @@ -518,6 +676,7 @@ }); + } } } @@ -564,6 +723,7 @@ assertEquals(x, VALUE_2, "setOpaque char value"); } + } } } @@ -609,6 +769,7 @@ assertEquals(x, VALUE_2, "setOpaque char value"); } + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsDouble.java Fri Sep 02 02:41:37 2016 +0000 @@ -92,14 +92,27 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @Test(dataProvider = "typesProvider") @@ -190,7 +203,47 @@ }); checkUOE(() -> { - double o = (double) vh.addAndGet(array, ci, VALUE_1); + double o = (double) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } @@ -236,11 +289,11 @@ }); checkROBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { @@ -255,13 +308,61 @@ double o = (double) vh.getAndSet(array, ci, VALUE_1); }); + checkROBE(() -> { + double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + double o = (double) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { double o = (double) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - double o = (double) vh.addAndGet(array, ci, VALUE_1); + double o = (double) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } else { @@ -270,7 +371,46 @@ }); checkUOE(() -> { - double o = (double) vh.addAndGet(array, ci, VALUE_1); + double o = (double) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndAddRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + double o = (double) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -333,11 +473,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -352,6 +492,15 @@ double o = (double) vh.getAndSet(array, ci, VALUE_1); }); + checkIOOBE(() -> { + double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + double o = (double) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + } } @@ -418,11 +567,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -437,6 +586,15 @@ double o = (double) vh.getAndSet(array, ci, VALUE_1); }); + checkIOOBE(() -> { + double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + double o = (double) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + } } } @@ -494,11 +652,11 @@ }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -513,6 +671,14 @@ double o = (double) vh.getAndSet(array, ci, VALUE_1); }); + checkISE(() -> { + double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + double o = (double) vh.getAndSetRelease(array, ci, VALUE_1); + }); + } } @@ -573,11 +739,11 @@ }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -592,6 +758,15 @@ double o = (double) vh.getAndSet(array, ci, VALUE_1); }); + checkISE(() -> { + double o = (double) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + double o = (double) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + } } } @@ -700,11 +875,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet double value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain double value"); } { @@ -728,20 +903,44 @@ } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile double"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile double value"); + assertEquals(x, VALUE_1, "weakCompareAndSet double"); } // Compare set and get { + vh.set(array, i, VALUE_1); + double o = (double) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet double"); double x = (double) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet double value"); } + { + vh.set(array, i, VALUE_1); + + double o = (double) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire double"); + double x = (double) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire double value"); + } + + { + vh.set(array, i, VALUE_1); + + double o = (double) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease double"); + double x = (double) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease double value"); + } + + } } } @@ -849,11 +1048,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet double value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain double value"); } { @@ -877,20 +1076,44 @@ } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile double"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile double value"); + assertEquals(x, VALUE_1, "weakCompareAndSet double"); } // Compare set and get { + vh.set(array, i, VALUE_1); + double o = (double) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet double"); double x = (double) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet double value"); } + { + vh.set(array, i, VALUE_1); + + double o = (double) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire double"); + double x = (double) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire double value"); + } + + { + vh.set(array, i, VALUE_1); + + double o = (double) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease double"); + double x = (double) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease double value"); + } + + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsFloat.java Fri Sep 02 02:41:37 2016 +0000 @@ -92,14 +92,27 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @Test(dataProvider = "typesProvider") @@ -190,7 +203,47 @@ }); checkUOE(() -> { - float o = (float) vh.addAndGet(array, ci, VALUE_1); + float o = (float) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } @@ -236,11 +289,11 @@ }); checkROBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { @@ -255,13 +308,61 @@ float o = (float) vh.getAndSet(array, ci, VALUE_1); }); + checkROBE(() -> { + float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + float o = (float) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { float o = (float) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - float o = (float) vh.addAndGet(array, ci, VALUE_1); + float o = (float) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } else { @@ -270,7 +371,46 @@ }); checkUOE(() -> { - float o = (float) vh.addAndGet(array, ci, VALUE_1); + float o = (float) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndAddRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + float o = (float) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -333,11 +473,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -352,6 +492,15 @@ float o = (float) vh.getAndSet(array, ci, VALUE_1); }); + checkIOOBE(() -> { + float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + float o = (float) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + } } @@ -418,11 +567,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -437,6 +586,15 @@ float o = (float) vh.getAndSet(array, ci, VALUE_1); }); + checkIOOBE(() -> { + float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + float o = (float) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + } } } @@ -494,11 +652,11 @@ }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -513,6 +671,14 @@ float o = (float) vh.getAndSet(array, ci, VALUE_1); }); + checkISE(() -> { + float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + float o = (float) vh.getAndSetRelease(array, ci, VALUE_1); + }); + } } @@ -573,11 +739,11 @@ }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -592,6 +758,15 @@ float o = (float) vh.getAndSet(array, ci, VALUE_1); }); + checkISE(() -> { + float o = (float) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + float o = (float) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + } } } @@ -700,11 +875,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet float value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain float value"); } { @@ -728,20 +903,44 @@ } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile float"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile float value"); + assertEquals(x, VALUE_1, "weakCompareAndSet float"); } // Compare set and get { + vh.set(array, i, VALUE_1); + float o = (float) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet float"); float x = (float) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet float value"); } + { + vh.set(array, i, VALUE_1); + + float o = (float) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire float"); + float x = (float) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire float value"); + } + + { + vh.set(array, i, VALUE_1); + + float o = (float) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease float"); + float x = (float) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease float value"); + } + + } } } @@ -849,11 +1048,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet float value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain float value"); } { @@ -877,20 +1076,44 @@ } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile float"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile float value"); + assertEquals(x, VALUE_1, "weakCompareAndSet float"); } // Compare set and get { + vh.set(array, i, VALUE_1); + float o = (float) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet float"); float x = (float) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet float value"); } + { + vh.set(array, i, VALUE_1); + + float o = (float) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire float"); + float x = (float) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire float value"); + } + + { + vh.set(array, i, VALUE_1); + + float o = (float) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease float"); + float x = (float) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease float value"); + } + + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsInt.java Fri Sep 02 02:41:37 2016 +0000 @@ -92,14 +92,27 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @Test(dataProvider = "typesProvider") @@ -185,6 +198,7 @@ int ci = 1; + } static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) { @@ -229,11 +243,11 @@ }); checkROBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { @@ -248,13 +262,61 @@ int o = (int) vh.getAndSet(array, ci, VALUE_1); }); + checkROBE(() -> { + int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkROBE(() -> { int o = (int) vh.getAndAdd(array, ci, VALUE_1); }); checkROBE(() -> { - int o = (int) vh.addAndGet(array, ci, VALUE_1); + int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } else { @@ -319,11 +381,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -339,11 +401,59 @@ }); checkIOOBE(() -> { + int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { int o = (int) vh.getAndAdd(array, ci, VALUE_1); }); checkIOOBE(() -> { - int o = (int) vh.addAndGet(array, ci, VALUE_1); + int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } @@ -411,11 +521,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -431,11 +541,59 @@ }); checkIOOBE(() -> { + int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { int o = (int) vh.getAndAdd(array, ci, VALUE_1); }); checkIOOBE(() -> { - int o = (int) vh.addAndGet(array, ci, VALUE_1); + int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -494,11 +652,11 @@ }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -514,13 +672,60 @@ }); checkISE(() -> { + int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { int o = (int) vh.getAndAdd(array, ci, VALUE_1); }); checkISE(() -> { - int o = (int) vh.addAndGet(array, ci, VALUE_1); + int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); }); + checkISE(() -> { + int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); } } } @@ -580,11 +785,11 @@ }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -600,11 +805,59 @@ }); checkISE(() -> { + int o = (int) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { int o = (int) vh.getAndAdd(array, ci, VALUE_1); }); checkISE(() -> { - int o = (int) vh.addAndGet(array, ci, VALUE_1); + int o = (int) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + int o = (int) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -714,11 +967,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet int value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain int value"); } { @@ -742,28 +995,153 @@ } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile int value"); + assertEquals(x, VALUE_1, "weakCompareAndSet int"); } // Compare set and get { + vh.set(array, i, VALUE_1); + int o = (int) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet int value"); } - vh.set(array, i, VALUE_1); + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) vh.getAndAdd(array, i, VALUE_3); + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndAdd(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndAdd int"); - int c = (int) vh.addAndGet(array, i, VALUE_3); - assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd int value"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndAddAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndAddRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease int value"); + } + + // get and bitwise or + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseOr(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOr int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseOrAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseOrRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseAnd(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAnd int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseAndAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseAndRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseXor(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXor int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseXorAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseXorRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease int value"); } } } @@ -872,11 +1250,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet int value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain int value"); } { @@ -900,28 +1278,153 @@ } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile int"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile int value"); + assertEquals(x, VALUE_1, "weakCompareAndSet int"); } // Compare set and get { + vh.set(array, i, VALUE_1); + int o = (int) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet int"); int x = (int) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet int value"); } - vh.set(array, i, VALUE_1); + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) vh.getAndAdd(array, i, VALUE_3); + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndAdd(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndAdd int"); - int c = (int) vh.addAndGet(array, i, VALUE_3); - assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd int value"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndAddAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndAddRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease int value"); + } + + // get and bitwise or + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseOr(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOr int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseOrAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseOrRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseAnd(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAnd int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseAndAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseAndRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseXor(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXor int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseXorAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire int value"); + } + + { + vh.set(array, i, VALUE_1); + + int o = (int) vh.getAndBitwiseXorRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorRelease int"); + int x = (int) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease int value"); } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsLong.java Fri Sep 02 02:41:37 2016 +0000 @@ -92,14 +92,27 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @Test(dataProvider = "typesProvider") @@ -185,6 +198,7 @@ int ci = 1; + } static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) { @@ -229,11 +243,11 @@ }); checkROBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { @@ -248,13 +262,61 @@ long o = (long) vh.getAndSet(array, ci, VALUE_1); }); + checkROBE(() -> { + long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndSetRelease(array, ci, VALUE_1); + }); + checkROBE(() -> { long o = (long) vh.getAndAdd(array, ci, VALUE_1); }); checkROBE(() -> { - long o = (long) vh.addAndGet(array, ci, VALUE_1); + long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } else { @@ -319,11 +381,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -339,11 +401,59 @@ }); checkIOOBE(() -> { + long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { long o = (long) vh.getAndAdd(array, ci, VALUE_1); }); checkIOOBE(() -> { - long o = (long) vh.addAndGet(array, ci, VALUE_1); + long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } @@ -411,11 +521,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -431,11 +541,59 @@ }); checkIOOBE(() -> { + long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { long o = (long) vh.getAndAdd(array, ci, VALUE_1); }); checkIOOBE(() -> { - long o = (long) vh.addAndGet(array, ci, VALUE_1); + long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -494,11 +652,11 @@ }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -514,13 +672,60 @@ }); checkISE(() -> { + long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { long o = (long) vh.getAndAdd(array, ci, VALUE_1); }); checkISE(() -> { - long o = (long) vh.addAndGet(array, ci, VALUE_1); + long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); }); + checkISE(() -> { + long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); } } } @@ -580,11 +785,11 @@ }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -600,11 +805,59 @@ }); checkISE(() -> { + long o = (long) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { long o = (long) vh.getAndAdd(array, ci, VALUE_1); }); checkISE(() -> { - long o = (long) vh.addAndGet(array, ci, VALUE_1); + long o = (long) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + long o = (long) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -714,11 +967,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet long value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain long value"); } { @@ -742,28 +995,153 @@ } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile long value"); + assertEquals(x, VALUE_1, "weakCompareAndSet long"); } // Compare set and get { + vh.set(array, i, VALUE_1); + long o = (long) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet long"); long x = (long) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet long value"); } - vh.set(array, i, VALUE_1); + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) vh.getAndAdd(array, i, VALUE_3); + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndAdd(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndAdd long"); - long c = (long) vh.addAndGet(array, i, VALUE_3); - assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd long value"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndAddAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndAddRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease long value"); + } + + // get and bitwise or + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseOr(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOr long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseOrAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseOrRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseAnd(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAnd long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseAndAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseAndRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseXor(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXor long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseXorAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseXorRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease long value"); } } } @@ -872,11 +1250,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet long value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain long value"); } { @@ -900,28 +1278,153 @@ } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile long"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile long value"); + assertEquals(x, VALUE_1, "weakCompareAndSet long"); } // Compare set and get { + vh.set(array, i, VALUE_1); + long o = (long) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet long"); long x = (long) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet long value"); } - vh.set(array, i, VALUE_1); + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) vh.getAndAdd(array, i, VALUE_3); + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndAdd(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndAdd long"); - long c = (long) vh.addAndGet(array, i, VALUE_3); - assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd long value"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndAddAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndAddRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease long value"); + } + + // get and bitwise or + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseOr(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOr long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseOrAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseOrRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseAnd(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAnd long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseAndAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseAndRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseXor(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXor long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseXorAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire long value"); + } + + { + vh.set(array, i, VALUE_1); + + long o = (long) vh.getAndBitwiseXorRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorRelease long"); + long x = (long) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease long value"); } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestByteArrayAsShort.java Fri Sep 02 02:41:37 2016 +0000 @@ -92,14 +92,27 @@ assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); + + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); } @Test(dataProvider = "typesProvider") @@ -201,11 +214,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -221,11 +234,59 @@ }); checkUOE(() -> { + short o = (short) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { short o = (short) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - short o = (short) vh.addAndGet(array, ci, VALUE_1); + short o = (short) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } @@ -270,11 +331,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -290,11 +351,59 @@ }); checkUOE(() -> { + short o = (short) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndSetRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { short o = (short) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - short o = (short) vh.addAndGet(array, ci, VALUE_1); + short o = (short) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndAddRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } else { @@ -315,11 +424,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -333,12 +442,59 @@ checkUOE(() -> { short o = (short) vh.getAndSet(array, ci, VALUE_1); }); + + checkUOE(() -> { + short o = (short) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndSetRelease(array, ci, VALUE_1); + }); checkUOE(() -> { short o = (short) vh.getAndAdd(array, ci, VALUE_1); }); checkUOE(() -> { - short o = (short) vh.addAndGet(array, ci, VALUE_1); + short o = (short) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndAddRelease(array, ci, VALUE_1); + }); + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + short o = (short) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); }); } } @@ -385,6 +541,7 @@ }); + } } @@ -434,6 +591,7 @@ }); + } } } @@ -518,6 +676,7 @@ }); + } } } @@ -564,6 +723,7 @@ assertEquals(x, VALUE_2, "setOpaque short value"); } + } } } @@ -609,6 +769,7 @@ assertEquals(x, VALUE_2, "setOpaque short value"); } + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessBoolean.java Fri Sep 02 02:41:37 2016 +0000 @@ -210,11 +210,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, true, false); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, true, false); } - assertEquals(success, true, "weakCompareAndSet boolean"); + assertEquals(success, true, "weakCompareAndSetPlain boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, false, "weakCompareAndSet boolean value"); + assertEquals(x, false, "weakCompareAndSetPlain boolean value"); } { @@ -240,11 +240,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, false, true); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, false, true); } - assertEquals(success, true, "weakCompareAndSetVolatile boolean"); + assertEquals(success, true, "weakCompareAndSet boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, true, "weakCompareAndSetVolatile boolean"); + assertEquals(x, true, "weakCompareAndSet boolean"); } // Compare set and get @@ -255,6 +255,90 @@ assertEquals(x, false, "getAndSet boolean value"); } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseOr boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseOrAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseOrRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseAnd boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseAndAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseAndRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseXor boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseXorAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, false); + assertEquals(o, true, "getAndBitwiseXorRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value"); + } } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessBoolean recv, Handles hs) throws Throwable { @@ -264,6 +348,7 @@ boolean r = (boolean) hs.get(am).invokeExact(recv, true); }); } + } @@ -359,11 +444,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(true, false); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(true, false); } - assertEquals(success, true, "weakCompareAndSet boolean"); + assertEquals(success, true, "weakCompareAndSetPlain boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, false, "weakCompareAndSet boolean value"); + assertEquals(x, false, "weakCompareAndSetPlain boolean value"); } { @@ -389,21 +474,127 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(false, true); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(false, true); } - assertEquals(success, true, "weakCompareAndSetVolatile boolean"); + assertEquals(success, true, "weakCompareAndSet boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, true, "weakCompareAndSetVolatile boolean"); + assertEquals(x, true, "weakCompareAndSet boolean"); } // Compare set and get { - boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET).invokeExact( false); + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET).invokeExact(false); assertEquals(o, true, "getAndSet boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, false, "getAndSet boolean value"); } + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(false); + assertEquals(o, true, "getAndSetAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, false, "getAndSetAcquire boolean value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(false); + assertEquals(o, true, "getAndSetRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, false, "getAndSetRelease boolean value"); + } + + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(false); + assertEquals(o, true, "getAndBitwiseOr boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(false); + assertEquals(o, true, "getAndBitwiseOrAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(false); + assertEquals(o, true, "getAndBitwiseOrRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(false); + assertEquals(o, true, "getAndBitwiseAnd boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(false); + assertEquals(o, true, "getAndBitwiseAndAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(false); + assertEquals(o, true, "getAndBitwiseAndRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(false); + assertEquals(o, true, "getAndBitwiseXor boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(false); + assertEquals(o, true, "getAndBitwiseXorAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(false); + assertEquals(o, true, "getAndBitwiseXorRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value"); + } } static void testStaticFieldUnsupported(Handles hs) throws Throwable { @@ -413,6 +604,7 @@ boolean r = (boolean) hs.get(am).invokeExact(true); }); } + } @@ -511,11 +703,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, true, false); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, true, false); } - assertEquals(success, true, "weakCompareAndSet boolean"); + assertEquals(success, true, "weakCompareAndSetPlain boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, false, "weakCompareAndSet boolean value"); + assertEquals(x, false, "weakCompareAndSetPlain boolean value"); } { @@ -541,21 +733,125 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, false, true); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, false, true); } - assertEquals(success, true, "weakCompareAndSetVolatile boolean"); + assertEquals(success, true, "weakCompareAndSet boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, true, "weakCompareAndSetVolatile boolean"); + assertEquals(x, true, "weakCompareAndSet boolean"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, false); assertEquals(o, true, "getAndSet boolean"); boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, false, "getAndSet boolean value"); } + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, false); + assertEquals(o, true, "getAndSetAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, false, "getAndSetAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, false); + assertEquals(o, true, "getAndSetRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, false, "getAndSetRelease boolean value"); + } + + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseOr boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOr boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseOrAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseOrRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true | false), "getAndBitwiseOrRelease boolean value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseAnd boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAnd boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseAndAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseAndRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true & false), "getAndBitwiseAndRelease boolean value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseXor boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXor boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseXorAcquire boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorAcquire boolean value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, true); + + boolean o = (boolean) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, false); + assertEquals(o, true, "getAndBitwiseXorRelease boolean"); + boolean x = (boolean) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (boolean)(true ^ false), "getAndBitwiseXorRelease boolean value"); + } } } @@ -569,6 +865,7 @@ boolean o = (boolean) hs.get(am).invokeExact(array, i, true); }); } + } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -607,6 +904,12 @@ }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + boolean o = (boolean) hs.get(am).invokeExact(array, ci, false); + }); + } } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessByte.java Fri Sep 02 02:41:37 2016 +0000 @@ -210,11 +210,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, (byte)0x01, (byte)0x23); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, (byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSet byte"); + assertEquals(success, true, "weakCompareAndSetPlain byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, (byte)0x23, "weakCompareAndSet byte value"); + assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value"); } { @@ -240,11 +240,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, (byte)0x23, (byte)0x01); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, (byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSetVolatile byte"); + assertEquals(success, true, "weakCompareAndSet byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, (byte)0x01, "weakCompareAndSetVolatile byte"); + assertEquals(x, (byte)0x01, "weakCompareAndSet byte"); } // Compare set and get @@ -255,19 +255,122 @@ assertEquals(x, (byte)0x23, "getAndSet byte value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); - // get and add, add and get { - byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, (byte)0x45); + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, (byte)0x23); assertEquals(o, (byte)0x01, "getAndAdd byte"); - byte c = (byte) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, (byte)0x45); - assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOr byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXor byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value"); } } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessByte recv, Handles hs) throws Throwable { + } @@ -363,11 +466,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact((byte)0x01, (byte)0x23); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact((byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSet byte"); + assertEquals(success, true, "weakCompareAndSetPlain byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, (byte)0x23, "weakCompareAndSet byte value"); + assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value"); } { @@ -393,34 +496,159 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact((byte)0x23, (byte)0x01); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact((byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSetVolatile byte"); + assertEquals(success, true, "weakCompareAndSet byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, (byte)0x01, "weakCompareAndSetVolatile byte"); + assertEquals(x, (byte)0x01, "weakCompareAndSet byte"); } // Compare set and get { - byte o = (byte) hs.get(TestAccessMode.GET_AND_SET).invokeExact( (byte)0x23); + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_SET).invokeExact((byte)0x23); assertEquals(o, (byte)0x01, "getAndSet byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, (byte)0x23, "getAndSet byte value"); } - hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)0x23, "getAndSetAcquire byte value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)0x23, "getAndSetRelease byte value"); + } // get and add, add and get { - byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( (byte)0x45); + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact((byte)0x23); assertEquals(o, (byte)0x01, "getAndAdd byte"); - byte c = (byte) hs.get(TestAccessMode.ADD_AND_GET).invokeExact((byte)0x45); - assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOr byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXor byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact((byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value"); } } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + } @@ -519,11 +747,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, (byte)0x01, (byte)0x23); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, (byte)0x01, (byte)0x23); } - assertEquals(success, true, "weakCompareAndSet byte"); + assertEquals(success, true, "weakCompareAndSetPlain byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, (byte)0x23, "weakCompareAndSet byte value"); + assertEquals(x, (byte)0x23, "weakCompareAndSetPlain byte value"); } { @@ -549,30 +777,152 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, (byte)0x23, (byte)0x01); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, (byte)0x23, (byte)0x01); } - assertEquals(success, true, "weakCompareAndSetVolatile byte"); + assertEquals(success, true, "weakCompareAndSet byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, (byte)0x01, "weakCompareAndSetVolatile byte"); + assertEquals(x, (byte)0x01, "weakCompareAndSet byte"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + byte o = (byte) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, (byte)0x23); assertEquals(o, (byte)0x01, "getAndSet byte"); byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, (byte)0x23, "getAndSet byte value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)0x23, "getAndSetAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndSetRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)0x23, "getAndSetRelease byte value"); + } // get and add, add and get { - byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, (byte)0x45); + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, (byte)0x23); assertEquals(o, (byte)0x01, "getAndAdd byte"); - byte c = (byte) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, (byte)0x45); - assertEquals(c, (byte)((byte)0x01 + (byte)0x45 + (byte)0x45), "getAndAdd byte value"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAdd byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndAddRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 + (byte)0x23), "getAndAddRelease byte value"); } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOr byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOr byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseOrRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 | (byte)0x23), "getAndBitwiseOrRelease byte value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAnd byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAnd byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseAndRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 & (byte)0x23), "getAndBitwiseAndRelease byte value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXor byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXor byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorAcquire byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorAcquire byte value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (byte)0x01); + + byte o = (byte) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, (byte)0x23); + assertEquals(o, (byte)0x01, "getAndBitwiseXorRelease byte"); + byte x = (byte) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (byte)((byte)0x01 ^ (byte)0x23), "getAndBitwiseXorRelease byte value"); + } } } @@ -581,6 +931,7 @@ final int i = 0; + } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +975,12 @@ byte o = (byte) hs.get(am).invokeExact(array, ci, (byte)0x45); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + byte o = (byte) hs.get(am).invokeExact(array, ci, (byte)0x45); + }); + } } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessChar.java Fri Sep 02 02:41:37 2016 +0000 @@ -210,11 +210,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, '\u0123', '\u4567'); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, '\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSet char"); + assertEquals(success, true, "weakCompareAndSetPlain char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, '\u4567', "weakCompareAndSet char value"); + assertEquals(x, '\u4567', "weakCompareAndSetPlain char value"); } { @@ -240,11 +240,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, '\u4567', '\u0123'); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, '\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSetVolatile char"); + assertEquals(success, true, "weakCompareAndSet char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, '\u0123', "weakCompareAndSetVolatile char"); + assertEquals(x, '\u0123', "weakCompareAndSet char"); } // Compare set and get @@ -255,19 +255,122 @@ assertEquals(x, '\u4567', "getAndSet char value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); - // get and add, add and get { - char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, '\u89AB'); + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, '\u4567'); assertEquals(o, '\u0123', "getAndAdd char"); - char c = (char) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, '\u89AB'); - assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndAddAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndAddRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOr char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAnd char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXor char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value"); } } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessChar recv, Handles hs) throws Throwable { + } @@ -363,11 +466,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact('\u0123', '\u4567'); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact('\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSet char"); + assertEquals(success, true, "weakCompareAndSetPlain char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, '\u4567', "weakCompareAndSet char value"); + assertEquals(x, '\u4567', "weakCompareAndSetPlain char value"); } { @@ -393,34 +496,159 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact('\u4567', '\u0123'); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact('\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSetVolatile char"); + assertEquals(success, true, "weakCompareAndSet char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, '\u0123', "weakCompareAndSetVolatile char"); + assertEquals(x, '\u0123', "weakCompareAndSet char"); } // Compare set and get { - char o = (char) hs.get(TestAccessMode.GET_AND_SET).invokeExact( '\u4567'); + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_SET).invokeExact('\u4567'); assertEquals(o, '\u0123', "getAndSet char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, '\u4567', "getAndSet char value"); } - hs.get(TestAccessMode.SET).invokeExact('\u0123'); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndSetAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, '\u4567', "getAndSetAcquire char value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndSetRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, '\u4567', "getAndSetRelease char value"); + } // get and add, add and get { - char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( '\u89AB'); + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact('\u4567'); assertEquals(o, '\u0123', "getAndAdd char"); - char c = (char) hs.get(TestAccessMode.ADD_AND_GET).invokeExact('\u89AB'); - assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndAddAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndAddRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOr char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAnd char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXor char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact('\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact('\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value"); } } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + } @@ -519,11 +747,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, '\u0123', '\u4567'); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, '\u0123', '\u4567'); } - assertEquals(success, true, "weakCompareAndSet char"); + assertEquals(success, true, "weakCompareAndSetPlain char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, '\u4567', "weakCompareAndSet char value"); + assertEquals(x, '\u4567', "weakCompareAndSetPlain char value"); } { @@ -549,30 +777,152 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, '\u4567', '\u0123'); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, '\u4567', '\u0123'); } - assertEquals(success, true, "weakCompareAndSetVolatile char"); + assertEquals(success, true, "weakCompareAndSet char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, '\u0123', "weakCompareAndSetVolatile char"); + assertEquals(x, '\u0123', "weakCompareAndSet char"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + char o = (char) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, '\u4567'); assertEquals(o, '\u0123', "getAndSet char"); char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, '\u4567', "getAndSet char value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndSetAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, '\u4567', "getAndSetAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndSetRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, '\u4567', "getAndSetRelease char value"); + } // get and add, add and get { - char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, '\u89AB'); + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, '\u4567'); assertEquals(o, '\u0123', "getAndAdd char"); - char c = (char) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, '\u89AB'); - assertEquals(c, (char)('\u0123' + '\u89AB' + '\u89AB'), "getAndAdd char value"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAdd char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndAddAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndAddRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' + '\u4567'), "getAndAddRelease char value"); } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOr char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOr char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseOrRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' | '\u4567'), "getAndBitwiseOrRelease char value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAnd char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAnd char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseAndRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' & '\u4567'), "getAndBitwiseAndRelease char value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXor char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXor char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorAcquire char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorAcquire char value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, '\u0123'); + + char o = (char) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, '\u4567'); + assertEquals(o, '\u0123', "getAndBitwiseXorRelease char"); + char x = (char) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (char)('\u0123' ^ '\u4567'), "getAndBitwiseXorRelease char value"); + } } } @@ -581,6 +931,7 @@ final int i = 0; + } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +975,12 @@ char o = (char) hs.get(am).invokeExact(array, ci, '\u89AB'); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + char o = (char) hs.get(am).invokeExact(array, ci, '\u89AB'); + }); + } } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessDouble.java Fri Sep 02 02:41:37 2016 +0000 @@ -210,11 +210,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1.0d, 2.0d); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 2.0d, "weakCompareAndSet double value"); + assertEquals(x, 2.0d, "weakCompareAndSetPlain double value"); } { @@ -240,11 +240,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, 2.0d, 1.0d); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSetVolatile double"); + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 1.0d, "weakCompareAndSetVolatile double"); + assertEquals(x, 1.0d, "weakCompareAndSet double"); } // Compare set and get @@ -255,19 +255,44 @@ assertEquals(x, 2.0d, "getAndSet double value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d); - // get and add, add and get { - double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 3.0d); + hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 2.0d); assertEquals(o, 1.0d, "getAndAdd double"); - double c = (double) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 3.0d); - assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 2.0d); + assertEquals(o, 1.0d, "getAndAddAcquire double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 2.0d); + assertEquals(o, 1.0d, "getAndAddRelease double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value"); + } + } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessDouble recv, Handles hs) throws Throwable { + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + double r = (double) hs.get(am).invokeExact(recv, 1.0d); + }); + } } @@ -363,11 +388,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1.0d, 2.0d); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 2.0d, "weakCompareAndSet double value"); + assertEquals(x, 2.0d, "weakCompareAndSetPlain double value"); } { @@ -393,34 +418,81 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(2.0d, 1.0d); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSetVolatile double"); + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 1.0d, "weakCompareAndSetVolatile double"); + assertEquals(x, 1.0d, "weakCompareAndSet double"); } // Compare set and get { - double o = (double) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 2.0d); + hs.get(TestAccessMode.SET).invokeExact(1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_SET).invokeExact(2.0d); assertEquals(o, 1.0d, "getAndSet double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 2.0d, "getAndSet double value"); } - hs.get(TestAccessMode.SET).invokeExact(1.0d); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(2.0d); + assertEquals(o, 1.0d, "getAndSetAcquire double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 2.0d, "getAndSetAcquire double value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(2.0d); + assertEquals(o, 1.0d, "getAndSetRelease double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 2.0d, "getAndSetRelease double value"); + } // get and add, add and get { - double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 3.0d); + hs.get(TestAccessMode.SET).invokeExact(1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(2.0d); assertEquals(o, 1.0d, "getAndAdd double"); - double c = (double) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(3.0d); - assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(2.0d); + assertEquals(o, 1.0d, "getAndAddAcquire double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(2.0d); + assertEquals(o, 1.0d, "getAndAddRelease double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value"); + } + } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + double r = (double) hs.get(am).invokeExact(1.0d); + }); + } } @@ -519,11 +591,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1.0d, 2.0d); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 1.0d, 2.0d); } - assertEquals(success, true, "weakCompareAndSet double"); + assertEquals(success, true, "weakCompareAndSetPlain double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 2.0d, "weakCompareAndSet double value"); + assertEquals(x, 2.0d, "weakCompareAndSetPlain double value"); } { @@ -549,30 +621,69 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, 2.0d, 1.0d); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 2.0d, 1.0d); } - assertEquals(success, true, "weakCompareAndSetVolatile double"); + assertEquals(success, true, "weakCompareAndSet double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 1.0d, "weakCompareAndSetVolatile double"); + assertEquals(x, 1.0d, "weakCompareAndSet double"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + double o = (double) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 2.0d); assertEquals(o, 1.0d, "getAndSet double"); double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 2.0d, "getAndSet double value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndSetAcquire double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 2.0d, "getAndSetAcquire double value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndSetRelease double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 2.0d, "getAndSetRelease double value"); + } // get and add, add and get { - double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 3.0d); + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 2.0d); assertEquals(o, 1.0d, "getAndAdd double"); - double c = (double) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 3.0d); - assertEquals(c, (double)(1.0d + 3.0d + 3.0d), "getAndAdd double value"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAdd double value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndAddAcquire double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddAcquire double value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0d); + + double o = (double) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 2.0d); + assertEquals(o, 1.0d, "getAndAddRelease double"); + double x = (double) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (double)(1.0d + 2.0d), "getAndAddRelease double value"); + } + } } @@ -581,6 +692,12 @@ final int i = 0; + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + double o = (double) hs.get(am).invokeExact(array, i, 1.0d); + }); + } } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +741,7 @@ double o = (double) hs.get(am).invokeExact(array, ci, 3.0d); }); } + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessFloat.java Fri Sep 02 02:41:37 2016 +0000 @@ -210,11 +210,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 1.0f, 2.0f); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 2.0f, "weakCompareAndSet float value"); + assertEquals(x, 2.0f, "weakCompareAndSetPlain float value"); } { @@ -240,11 +240,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, 2.0f, 1.0f); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSetVolatile float"); + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 1.0f, "weakCompareAndSetVolatile float"); + assertEquals(x, 1.0f, "weakCompareAndSet float"); } // Compare set and get @@ -255,19 +255,44 @@ assertEquals(x, 2.0f, "getAndSet float value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f); - // get and add, add and get { - float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 3.0f); + hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 2.0f); assertEquals(o, 1.0f, "getAndAdd float"); - float c = (float) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 3.0f); - assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 2.0f); + assertEquals(o, 1.0f, "getAndAddAcquire float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 2.0f); + assertEquals(o, 1.0f, "getAndAddRelease float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value"); + } + } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessFloat recv, Handles hs) throws Throwable { + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + float r = (float) hs.get(am).invokeExact(recv, 1.0f); + }); + } } @@ -363,11 +388,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(1.0f, 2.0f); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 2.0f, "weakCompareAndSet float value"); + assertEquals(x, 2.0f, "weakCompareAndSetPlain float value"); } { @@ -393,34 +418,81 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(2.0f, 1.0f); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSetVolatile float"); + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 1.0f, "weakCompareAndSetVolatile float"); + assertEquals(x, 1.0f, "weakCompareAndSet float"); } // Compare set and get { - float o = (float) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 2.0f); + hs.get(TestAccessMode.SET).invokeExact(1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_SET).invokeExact(2.0f); assertEquals(o, 1.0f, "getAndSet float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 2.0f, "getAndSet float value"); } - hs.get(TestAccessMode.SET).invokeExact(1.0f); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(2.0f); + assertEquals(o, 1.0f, "getAndSetAcquire float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 2.0f, "getAndSetAcquire float value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(2.0f); + assertEquals(o, 1.0f, "getAndSetRelease float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 2.0f, "getAndSetRelease float value"); + } // get and add, add and get { - float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 3.0f); + hs.get(TestAccessMode.SET).invokeExact(1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(2.0f); assertEquals(o, 1.0f, "getAndAdd float"); - float c = (float) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(3.0f); - assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(2.0f); + assertEquals(o, 1.0f, "getAndAddAcquire float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(2.0f); + assertEquals(o, 1.0f, "getAndAddRelease float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value"); + } + } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + float r = (float) hs.get(am).invokeExact(1.0f); + }); + } } @@ -519,11 +591,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 1.0f, 2.0f); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 1.0f, 2.0f); } - assertEquals(success, true, "weakCompareAndSet float"); + assertEquals(success, true, "weakCompareAndSetPlain float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 2.0f, "weakCompareAndSet float value"); + assertEquals(x, 2.0f, "weakCompareAndSetPlain float value"); } { @@ -549,30 +621,69 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, 2.0f, 1.0f); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 2.0f, 1.0f); } - assertEquals(success, true, "weakCompareAndSetVolatile float"); + assertEquals(success, true, "weakCompareAndSet float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 1.0f, "weakCompareAndSetVolatile float"); + assertEquals(x, 1.0f, "weakCompareAndSet float"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + float o = (float) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 2.0f); assertEquals(o, 1.0f, "getAndSet float"); float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 2.0f, "getAndSet float value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndSetAcquire float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 2.0f, "getAndSetAcquire float value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndSetRelease float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 2.0f, "getAndSetRelease float value"); + } // get and add, add and get { - float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 3.0f); + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 2.0f); assertEquals(o, 1.0f, "getAndAdd float"); - float c = (float) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 3.0f); - assertEquals(c, (float)(1.0f + 3.0f + 3.0f), "getAndAdd float value"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAdd float value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndAddAcquire float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddAcquire float value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 1.0f); + + float o = (float) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 2.0f); + assertEquals(o, 1.0f, "getAndAddRelease float"); + float x = (float) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (float)(1.0f + 2.0f), "getAndAddRelease float value"); + } + } } @@ -581,6 +692,12 @@ final int i = 0; + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + float o = (float) hs.get(am).invokeExact(array, i, 1.0f); + }); + } } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +741,7 @@ float o = (float) hs.get(am).invokeExact(array, ci, 3.0f); }); } + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessInt.java Fri Sep 02 02:41:37 2016 +0000 @@ -210,11 +210,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 0x01234567, 0x89ABCDEF); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSet int value"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value"); } { @@ -240,11 +240,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, 0x89ABCDEF, 0x01234567); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSetVolatile int"); + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 0x01234567, "weakCompareAndSetVolatile int"); + assertEquals(x, 0x01234567, "weakCompareAndSet int"); } // Compare set and get @@ -255,19 +255,122 @@ assertEquals(x, 0x89ABCDEF, "getAndSet int value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); - // get and add, add and get { - int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 0xCAFEBABE); + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndAdd int"); - int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 0xCAFEBABE); - assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOr int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAnd int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXor int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value"); } } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessInt recv, Handles hs) throws Throwable { + } @@ -363,11 +466,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(0x01234567, 0x89ABCDEF); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSet int value"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value"); } { @@ -393,34 +496,159 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(0x89ABCDEF, 0x01234567); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSetVolatile int"); + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 0x01234567, "weakCompareAndSetVolatile int"); + assertEquals(x, 0x01234567, "weakCompareAndSet int"); } // Compare set and get { - int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 0x89ABCDEF); + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(0x89ABCDEF); assertEquals(o, 0x01234567, "getAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 0x89ABCDEF, "getAndSet int value"); } - hs.get(TestAccessMode.SET).invokeExact(0x01234567); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 0xCAFEBABE); + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(0x89ABCDEF); assertEquals(o, 0x01234567, "getAndAdd int"); - int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(0xCAFEBABE); - assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOr int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAnd int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXor int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value"); } } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + } @@ -519,11 +747,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 0x01234567, 0x89ABCDEF); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 0x01234567, 0x89ABCDEF); } - assertEquals(success, true, "weakCompareAndSet int"); + assertEquals(success, true, "weakCompareAndSetPlain int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 0x89ABCDEF, "weakCompareAndSet int value"); + assertEquals(x, 0x89ABCDEF, "weakCompareAndSetPlain int value"); } { @@ -549,30 +777,152 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, 0x89ABCDEF, 0x01234567); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 0x89ABCDEF, 0x01234567); } - assertEquals(success, true, "weakCompareAndSetVolatile int"); + assertEquals(success, true, "weakCompareAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 0x01234567, "weakCompareAndSetVolatile int"); + assertEquals(x, 0x01234567, "weakCompareAndSet int"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + int o = (int) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndSet int"); int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 0x89ABCDEF, "getAndSet int value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 0x89ABCDEF, "getAndSetAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndSetRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 0x89ABCDEF, "getAndSetRelease int value"); + } // get and add, add and get { - int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 0xCAFEBABE); + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 0x89ABCDEF); assertEquals(o, 0x01234567, "getAndAdd int"); - int c = (int) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 0xCAFEBABE); - assertEquals(c, (int)(0x01234567 + 0xCAFEBABE + 0xCAFEBABE), "getAndAdd int value"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAdd int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndAddRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 + 0x89ABCDEF), "getAndAddRelease int value"); } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOr int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOr int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseOrRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 | 0x89ABCDEF), "getAndBitwiseOrRelease int value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAnd int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAnd int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseAndRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 & 0x89ABCDEF), "getAndBitwiseAndRelease int value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXor int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXor int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorAcquire int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorAcquire int value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x01234567); + + int o = (int) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, 0x89ABCDEF); + assertEquals(o, 0x01234567, "getAndBitwiseXorRelease int"); + int x = (int) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (int)(0x01234567 ^ 0x89ABCDEF), "getAndBitwiseXorRelease int value"); + } } } @@ -581,6 +931,7 @@ final int i = 0; + } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +975,12 @@ int o = (int) hs.get(am).invokeExact(array, ci, 0xCAFEBABE); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + int o = (int) hs.get(am).invokeExact(array, ci, 0xCAFEBABE); + }); + } } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessLong.java Fri Sep 02 02:41:37 2016 +0000 @@ -210,11 +210,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSet long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value"); } { @@ -240,11 +240,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSetVolatile long"); + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetVolatile long"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long"); } // Compare set and get @@ -255,19 +255,122 @@ assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); - // get and add, add and get { - long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 0xDEADBEEFDEADBEEFL); + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long"); - long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, 0xDEADBEEFDEADBEEFL); - assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value"); } } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessLong recv, Handles hs) throws Throwable { + } @@ -363,11 +466,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSet long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value"); } { @@ -393,34 +496,159 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSetVolatile long"); + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetVolatile long"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long"); } // Compare set and get { - long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact( 0xCAFEBABECAFEBABEL); + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value"); } - hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( 0xDEADBEEFDEADBEEFL); + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long"); - long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(0xDEADBEEFDEADBEEFL); - assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value"); } } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + } @@ -519,11 +747,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, 0x0123456789ABCDEFL, 0xCAFEBABECAFEBABEL); } - assertEquals(success, true, "weakCompareAndSet long"); + assertEquals(success, true, "weakCompareAndSetPlain long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSet long value"); + assertEquals(x, 0xCAFEBABECAFEBABEL, "weakCompareAndSetPlain long value"); } { @@ -549,30 +777,152 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, 0xCAFEBABECAFEBABEL, 0x0123456789ABCDEFL); } - assertEquals(success, true, "weakCompareAndSetVolatile long"); + assertEquals(success, true, "weakCompareAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSetVolatile long"); + assertEquals(x, 0x0123456789ABCDEFL, "weakCompareAndSet long"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + long o = (long) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndSet long"); long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSet long value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndSetRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, 0xCAFEBABECAFEBABEL, "getAndSetRelease long value"); + } // get and add, add and get { - long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 0xDEADBEEFDEADBEEFL); + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, 0xCAFEBABECAFEBABEL); assertEquals(o, 0x0123456789ABCDEFL, "getAndAdd long"); - long c = (long) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, 0xDEADBEEFDEADBEEFL); - assertEquals(c, (long)(0x0123456789ABCDEFL + 0xDEADBEEFDEADBEEFL + 0xDEADBEEFDEADBEEFL), "getAndAdd long value"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAdd long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndAddRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL + 0xCAFEBABECAFEBABEL), "getAndAddRelease long value"); } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOr long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOr long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseOrRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL | 0xCAFEBABECAFEBABEL), "getAndBitwiseOrRelease long value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAnd long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAnd long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseAndRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL & 0xCAFEBABECAFEBABEL), "getAndBitwiseAndRelease long value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXor long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXor long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorAcquire long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorAcquire long value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, 0x0123456789ABCDEFL); + + long o = (long) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, 0xCAFEBABECAFEBABEL); + assertEquals(o, 0x0123456789ABCDEFL, "getAndBitwiseXorRelease long"); + long x = (long) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (long)(0x0123456789ABCDEFL ^ 0xCAFEBABECAFEBABEL), "getAndBitwiseXorRelease long value"); + } } } @@ -581,6 +931,7 @@ final int i = 0; + } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +975,12 @@ long o = (long) hs.get(am).invokeExact(array, ci, 0xDEADBEEFDEADBEEFL); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + long o = (long) hs.get(am).invokeExact(array, ci, 0xDEADBEEFDEADBEEFL); + }); + } } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessShort.java Fri Sep 02 02:41:37 2016 +0000 @@ -210,11 +210,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, (short)0x0123, (short)0x4567); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, (short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSet short"); + assertEquals(success, true, "weakCompareAndSetPlain short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, (short)0x4567, "weakCompareAndSet short value"); + assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value"); } { @@ -240,11 +240,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, (short)0x4567, (short)0x0123); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, (short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSetVolatile short"); + assertEquals(success, true, "weakCompareAndSet short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, (short)0x0123, "weakCompareAndSetVolatile short"); + assertEquals(x, (short)0x0123, "weakCompareAndSet short"); } // Compare set and get @@ -255,19 +255,122 @@ assertEquals(x, (short)0x4567, "getAndSet short value"); } - hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); - // get and add, add and get { - short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, (short)0x89AB); + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, (short)0x4567); assertEquals(o, (short)0x0123, "getAndAdd short"); - short c = (short) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, (short)0x89AB); - assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOr short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAnd short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXor short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value"); } } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessShort recv, Handles hs) throws Throwable { + } @@ -363,11 +466,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact((short)0x0123, (short)0x4567); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact((short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSet short"); + assertEquals(success, true, "weakCompareAndSetPlain short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, (short)0x4567, "weakCompareAndSet short value"); + assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value"); } { @@ -393,34 +496,159 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact((short)0x4567, (short)0x0123); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact((short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSetVolatile short"); + assertEquals(success, true, "weakCompareAndSet short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, (short)0x0123, "weakCompareAndSetVolatile short"); + assertEquals(x, (short)0x0123, "weakCompareAndSet short"); } // Compare set and get { - short o = (short) hs.get(TestAccessMode.GET_AND_SET).invokeExact( (short)0x4567); + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_SET).invokeExact((short)0x4567); assertEquals(o, (short)0x0123, "getAndSet short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, (short)0x4567, "getAndSet short value"); } - hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)0x4567, "getAndSetAcquire short value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)0x4567, "getAndSetRelease short value"); + } // get and add, add and get { - short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( (short)0x89AB); + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact((short)0x4567); assertEquals(o, (short)0x0123, "getAndAdd short"); - short c = (short) hs.get(TestAccessMode.ADD_AND_GET).invokeExact((short)0x89AB); - assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value"); + } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOr short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAnd short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXor short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact((short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact((short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value"); } } static void testStaticFieldUnsupported(Handles hs) throws Throwable { + } @@ -519,11 +747,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, (short)0x0123, (short)0x4567); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, (short)0x0123, (short)0x4567); } - assertEquals(success, true, "weakCompareAndSet short"); + assertEquals(success, true, "weakCompareAndSetPlain short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, (short)0x4567, "weakCompareAndSet short value"); + assertEquals(x, (short)0x4567, "weakCompareAndSetPlain short value"); } { @@ -549,30 +777,152 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, (short)0x4567, (short)0x0123); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, (short)0x4567, (short)0x0123); } - assertEquals(success, true, "weakCompareAndSetVolatile short"); + assertEquals(success, true, "weakCompareAndSet short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, (short)0x0123, "weakCompareAndSetVolatile short"); + assertEquals(x, (short)0x0123, "weakCompareAndSet short"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + short o = (short) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, (short)0x4567); assertEquals(o, (short)0x0123, "getAndSet short"); short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, (short)0x4567, "getAndSet short value"); } - hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)0x4567, "getAndSetAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndSetRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)0x4567, "getAndSetRelease short value"); + } // get and add, add and get { - short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, (short)0x89AB); + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, (short)0x4567); assertEquals(o, (short)0x0123, "getAndAdd short"); - short c = (short) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, (short)0x89AB); - assertEquals(c, (short)((short)0x0123 + (short)0x89AB + (short)0x89AB), "getAndAdd short value"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAdd short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndAddRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 + (short)0x4567), "getAndAddRelease short value"); } + + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOr short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOr short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseOrRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 | (short)0x4567), "getAndBitwiseOrRelease short value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAnd short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAnd short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseAndRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 & (short)0x4567), "getAndBitwiseAndRelease short value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXor short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXor short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorAcquire short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorAcquire short value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, (short)0x0123); + + short o = (short) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, (short)0x4567); + assertEquals(o, (short)0x0123, "getAndBitwiseXorRelease short"); + short x = (short) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, (short)((short)0x0123 ^ (short)0x4567), "getAndBitwiseXorRelease short value"); + } } } @@ -581,6 +931,7 @@ final int i = 0; + } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -624,6 +975,12 @@ short o = (short) hs.get(am).invokeExact(array, ci, (short)0x89AB); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + short o = (short) hs.get(am).invokeExact(array, ci, (short)0x89AB); + }); + } } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodHandleAccessString.java Fri Sep 02 02:41:37 2016 +0000 @@ -210,11 +210,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, "foo", "bar"); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, "foo", "bar"); } - assertEquals(success, true, "weakCompareAndSet String"); + assertEquals(success, true, "weakCompareAndSetPlain String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, "bar", "weakCompareAndSet String value"); + assertEquals(x, "bar", "weakCompareAndSetPlain String value"); } { @@ -240,11 +240,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, "bar", "foo"); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, "bar", "foo"); } - assertEquals(success, true, "weakCompareAndSetVolatile String"); + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, "foo", "weakCompareAndSetVolatile String"); + assertEquals(x, "foo", "weakCompareAndSet String"); } // Compare set and get @@ -255,6 +255,7 @@ assertEquals(x, "bar", "getAndSet String value"); } + } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccessString recv, Handles hs) throws Throwable { @@ -264,6 +265,12 @@ String r = (String) hs.get(am).invokeExact(recv, "foo"); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + String r = (String) hs.get(am).invokeExact(recv, "foo"); + }); + } } @@ -359,11 +366,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact("foo", "bar"); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact("foo", "bar"); } - assertEquals(success, true, "weakCompareAndSet String"); + assertEquals(success, true, "weakCompareAndSetPlain String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, "bar", "weakCompareAndSet String value"); + assertEquals(x, "bar", "weakCompareAndSetPlain String value"); } { @@ -389,21 +396,44 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact("bar", "foo"); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact("bar", "foo"); } - assertEquals(success, true, "weakCompareAndSetVolatile String"); + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, "foo", "weakCompareAndSetVolatile String"); + assertEquals(x, "foo", "weakCompareAndSet String"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact("foo"); + + String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact("bar"); + assertEquals(o, "foo", "getAndSet String"); + String x = (String) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, "bar", "getAndSet String value"); } // Compare set and get { - String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact( "bar"); - assertEquals(o, "foo", "getAndSet String"); + hs.get(TestAccessMode.SET).invokeExact("foo"); + + String o = (String) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact("bar"); + assertEquals(o, "foo", "getAndSetAcquire String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, "bar", "getAndSet String value"); + assertEquals(x, "bar", "getAndSetAcquire String value"); } + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact("foo"); + + String o = (String) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact("bar"); + assertEquals(o, "foo", "getAndSetRelease String"); + String x = (String) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, "bar", "getAndSetRelease String value"); + } + + } static void testStaticFieldUnsupported(Handles hs) throws Throwable { @@ -413,6 +443,12 @@ String r = (String) hs.get(am).invokeExact("foo"); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + String r = (String) hs.get(am).invokeExact("foo"); + }); + } } @@ -511,11 +547,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, "foo", "bar"); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, "foo", "bar"); } - assertEquals(success, true, "weakCompareAndSet String"); + assertEquals(success, true, "weakCompareAndSetPlain String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, "bar", "weakCompareAndSet String value"); + assertEquals(x, "bar", "weakCompareAndSetPlain String value"); } { @@ -541,21 +577,42 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, "bar", "foo"); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, "bar", "foo"); } - assertEquals(success, true, "weakCompareAndSetVolatile String"); + assertEquals(success, true, "weakCompareAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, "foo", "weakCompareAndSetVolatile String"); + assertEquals(x, "foo", "weakCompareAndSet String"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, "foo"); + String o = (String) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, "bar"); assertEquals(o, "foo", "getAndSet String"); String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, "bar", "getAndSet String value"); } + { + hs.get(TestAccessMode.SET).invokeExact(array, i, "foo"); + + String o = (String) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, "bar"); + assertEquals(o, "foo", "getAndSetAcquire String"); + String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, "bar", "getAndSetAcquire String value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, "foo"); + + String o = (String) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, "bar"); + assertEquals(o, "foo", "getAndSetRelease String"); + String x = (String) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, "bar", "getAndSetRelease String value"); + } + + } } @@ -569,6 +626,12 @@ String o = (String) hs.get(am).invokeExact(array, i, "foo"); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + String o = (String) hs.get(am).invokeExact(array, i, "foo"); + }); + } } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -607,6 +670,7 @@ }); } + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeBoolean.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -353,6 +353,32 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, true, true); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, true, true); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, true); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, true, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, true, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, true, true, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, true, true); }); checkCCE(() -> { // receiver reference class @@ -376,32 +402,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, true, true); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, true, true); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, true); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, true, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, true, true); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, true, true, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,333 @@ boolean x = (boolean) vh.getAndSet(recv, true, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndSetAcquire(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndSetAcquire(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndSetAcquire(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndSetAcquire(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndSetAcquire(recv, true, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndSetRelease(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndSetRelease(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndSetRelease(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndSetRelease(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndSetRelease(recv, true, Void.class); + }); + + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseOr(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseOr(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseOr(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOr(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOr(recv, true, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseOrAcquire(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOrAcquire(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, true, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseOrRelease(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseOr(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseOr(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOr(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOr(recv, true, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseAnd(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseAnd(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAnd(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAnd(recv, true, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseAndAcquire(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAndAcquire(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, true, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseAndRelease(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseAnd(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAnd(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAnd(recv, true, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseXor(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseXor(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseXor(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXor(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXor(recv, true, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseXorAcquire(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXorAcquire(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, true, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + boolean x = (boolean) vh.getAndBitwiseXorRelease(null, true); + }); + checkCCE(() -> { // receiver reference class + boolean x = (boolean) vh.getAndBitwiseXor(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) vh.getAndBitwiseXor(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXor(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXor(recv, true, Void.class); + }); } static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeBoolean recv, Handles hs) throws Throwable { @@ -759,6 +1086,43 @@ }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class, boolean.class)). + invokeExact((VarHandleTestMethodTypeBoolean) null, true); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class, boolean.class)). + invokeExact(Void.class, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class, boolean.class)). + invokeExact(0, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeBoolean.class, boolean.class)). + invokeExact(recv, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeBoolean.class, boolean.class)). + invokeExact(recv, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) hs.get(am, methodType(boolean.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeBoolean.class, boolean.class)). + invokeExact(recv, true, Void.class); + }); + } } @@ -892,6 +1256,23 @@ // WeakCompareAndSet // Incorrect argument types checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, true); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(true, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(true, true, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, true); }); checkWMTE(() -> { // actual reference class @@ -906,23 +1287,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, true); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(true, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(true, true, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1049,6 +1413,236 @@ boolean x = (boolean) vh.getAndSet(true, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndSetAcquire(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndSetAcquire(true, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndSetRelease(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndSetRelease(true, Void.class); + }); + + + // GetAndBitwiseOr + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOr(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOr(true, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOrAcquire(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOrAcquire(true, Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOrRelease(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOrRelease(true, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAnd(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAnd(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAnd(true, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAndAcquire(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAndAcquire(true, Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAndRelease(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAndRelease(true, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXor(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXor(true, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXorAcquire(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXorAcquire(true, Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXorRelease(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXorRelease(true, Void.class); + }); } static void testStaticFieldWrongMethodType(Handles hs) throws Throwable { @@ -1163,6 +1757,32 @@ }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkWMTE(() -> { // value reference class + boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, boolean.class)). + invokeExact(true); + }); + checkWMTE(() -> { // primitive class + int x = (int) hs.get(am, methodType(int.class, boolean.class)). + invokeExact(true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) hs.get(am, methodType(boolean.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean.class, Class.class)). + invokeExact(true, Void.class); + }); + } } @@ -1426,6 +2046,35 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, true, true); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, true, true); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, true); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, true, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, true, true); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, true, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, true, true, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, true, true); }); checkCCE(() -> { // receiver reference class @@ -1452,35 +2101,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, true, true); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, true, true); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, true); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, true, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, true, true); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, true, true); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, true, true, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1679,6 +2299,368 @@ boolean x = (boolean) vh.getAndSet(array, 0, true, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndSetAcquire(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndSetAcquire(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + boolean x = (boolean) vh.getAndSetAcquire(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndSetAcquire(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndSetAcquire(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndSetAcquire(array, 0, true, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndSetRelease(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndSetRelease(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + boolean x = (boolean) vh.getAndSetRelease(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndSetRelease(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndSetRelease(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndSetRelease(array, 0, true, Void.class); + }); + + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseOr(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseOr(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseOr(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseOr(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOr(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, true, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseOrAcquire(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOrAcquire(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, true, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseOrRelease(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseOrRelease(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseOrRelease(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, true, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseAnd(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseAnd(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseAnd(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAnd(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, true, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseAndAcquire(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAndAcquire(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, true, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseAndRelease(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseAndRelease(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseAndRelease(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, true, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseXor(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseXor(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseXor(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseXor(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXor(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, true, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseXorAcquire(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXorAcquire(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, true, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) vh.getAndBitwiseXorRelease(null, 0, true); + }); + checkCCE(() -> { // array reference class + boolean x = (boolean) vh.getAndBitwiseXorRelease(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) vh.getAndBitwiseXorRelease(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, true, Void.class); + }); } static void testArrayWrongMethodType(Handles hs) throws Throwable { @@ -1880,6 +2862,48 @@ }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class, boolean.class)). + invokeExact((boolean[]) null, 0, true); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + boolean x = (boolean) hs.get(am, methodType(boolean.class, Class.class, int.class, boolean.class)). + invokeExact(Void.class, 0, true); + }); + checkWMTE(() -> { // value reference class + boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class, int.class, boolean.class)). + invokeExact(0, 0, true); + }); + checkWMTE(() -> { // index reference class + boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, Class.class, boolean.class)). + invokeExact(array, Void.class, true); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, boolean[].class, int.class, boolean.class)). + invokeExact(array, 0, true); + }); + checkWMTE(() -> { // primitive class + int x = (int) hs.get(am, methodType(int.class, boolean[].class, int.class, boolean.class)). + invokeExact(array, 0, true); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean x = (boolean) hs.get(am, methodType(boolean.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + boolean x = (boolean) hs.get(am, methodType(boolean.class, boolean[].class, int.class, boolean.class, Class.class)). + invokeExact(array, 0, true, Void.class); + }); + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeByte.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -353,6 +353,32 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, (byte)0x01, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, (byte)0x01, (byte)0x01); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, (byte)0x01); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, (byte)0x01, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, (byte)0x01, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, (byte)0x01, (byte)0x01, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, (byte)0x01, (byte)0x01); }); checkCCE(() -> { // receiver reference class @@ -376,32 +402,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, (byte)0x01, (byte)0x01); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, (byte)0x01, (byte)0x01); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, (byte)0x01); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, (byte)0x01, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, (byte)0x01, (byte)0x01); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, (byte)0x01, (byte)0x01, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ byte x = (byte) vh.getAndSet(recv, (byte)0x01, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndSetAcquire(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndSetAcquire(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndSetAcquire(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndSetAcquire(recv, (byte)0x01, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndSetRelease(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndSetRelease(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndSetRelease(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndSetRelease(recv, (byte)0x01, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,34 +669,331 @@ byte x = (byte) vh.getAndAdd(recv, (byte)0x01, Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - byte x = (byte) vh.addAndGet(null, (byte)0x01); + byte x = (byte) vh.getAndAddAcquire(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndAddAcquire(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndAddAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndAddAcquire(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndAddAcquire(recv, (byte)0x01, Void.class); + }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndAddRelease(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndAddRelease(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndAddRelease(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndAddRelease(recv, (byte)0x01, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseOr(null, (byte)0x01); }); checkCCE(() -> { // receiver reference class - byte x = (byte) vh.addAndGet(Void.class, (byte)0x01); + byte x = (byte) vh.getAndBitwiseOr(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseOr(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOr(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseOrAcquire(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseOrAcquire(Void.class, (byte)0x01); }); checkWMTE(() -> { // value reference class - byte x = (byte) vh.addAndGet(recv, Void.class); + byte x = (byte) vh.getAndBitwiseOrAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - byte x = (byte) vh.addAndGet(0, (byte)0x01); + byte x = (byte) vh.getAndBitwiseOrAcquire(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOrAcquire(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseOrRelease(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseOr(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseOr(0, (byte)0x01); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, (byte)0x01); + Void r = (Void) vh.getAndBitwiseOr(recv, (byte)0x01); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, (byte)0x01); + boolean x = (boolean) vh.getAndBitwiseOr(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOr(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseAnd(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseAnd(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseAnd(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAnd(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseAndAcquire(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseAndAcquire(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseAndAcquire(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, (byte)0x01); }); // Incorrect arity checkWMTE(() -> { // 0 - byte x = (byte) vh.addAndGet(); + byte x = (byte) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAndAcquire(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseAndRelease(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseAnd(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseAnd(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAnd(); }); checkWMTE(() -> { // > - byte x = (byte) vh.addAndGet(recv, (byte)0x01, Void.class); + byte x = (byte) vh.getAndBitwiseAnd(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseXor(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseXor(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseXor(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXor(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseXorAcquire(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseXorAcquire(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseXorAcquire(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXorAcquire(recv, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + byte x = (byte) vh.getAndBitwiseXorRelease(null, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + byte x = (byte) vh.getAndBitwiseXor(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) vh.getAndBitwiseXor(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXor(recv, (byte)0x01, Void.class); }); } @@ -853,6 +1208,43 @@ invokeExact(recv, (byte)0x01, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class)). + invokeExact((VarHandleTestMethodTypeByte) null, (byte)0x01); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + byte x = (byte) hs.get(am, methodType(byte.class, Class.class, byte.class)). + invokeExact(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + byte x = (byte) hs.get(am, methodType(byte.class, int.class, byte.class)). + invokeExact(0, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeByte.class, byte.class)). + invokeExact(recv, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeByte.class, byte.class)). + invokeExact(recv, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) hs.get(am, methodType(byte.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + byte x = (byte) hs.get(am, methodType(byte.class, VarHandleTestMethodTypeByte.class, byte.class)). + invokeExact(recv, (byte)0x01, Void.class); + }); + } } @@ -986,6 +1378,23 @@ // WeakCompareAndSet // Incorrect argument types checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, (byte)0x01); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain((byte)0x01, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain((byte)0x01, (byte)0x01, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, (byte)0x01); }); checkWMTE(() -> { // actual reference class @@ -1000,23 +1409,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, (byte)0x01); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile((byte)0x01, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile((byte)0x01, (byte)0x01, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1535,48 @@ byte x = (byte) vh.getAndSet((byte)0x01, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndSetAcquire((byte)0x01, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndSetRelease((byte)0x01, Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,24 +1598,233 @@ }); - // AddAndGet + // GetAndAddAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndAddAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndAddAcquire((byte)0x01, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndAddRelease((byte)0x01, Void.class); + }); + + // GetAndBitwiseOr // Incorrect argument types checkWMTE(() -> { // value reference class - byte x = (byte) vh.addAndGet(Void.class); + byte x = (byte) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOr((byte)0x01, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOrAcquire((byte)0x01, Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOrRelease((byte)0x01, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAnd(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet((byte)0x01); + Void r = (Void) vh.getAndBitwiseAnd((byte)0x01); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet((byte)0x01); + boolean x = (boolean) vh.getAndBitwiseAnd((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAnd((byte)0x01, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAndAcquire((byte)0x01, Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease((byte)0x01); }); // Incorrect arity checkWMTE(() -> { // 0 - byte x = (byte) vh.addAndGet(); + byte x = (byte) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAndRelease((byte)0x01, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXor(); }); checkWMTE(() -> { // > - byte x = (byte) vh.addAndGet((byte)0x01, Void.class); + byte x = (byte) vh.getAndBitwiseXor((byte)0x01, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXorAcquire((byte)0x01, Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXorRelease((byte)0x01, Void.class); }); } @@ -1322,6 +1965,32 @@ invokeExact((byte)0x01, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkWMTE(() -> { // value reference class + byte x = (byte) hs.get(am, methodType(byte.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, byte.class)). + invokeExact((byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, byte.class)). + invokeExact((byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) hs.get(am, methodType(byte.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + byte x = (byte) hs.get(am, methodType(byte.class, byte.class, Class.class)). + invokeExact((byte)0x01, Void.class); + }); + } } @@ -1585,6 +2254,35 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, (byte)0x01, (byte)0x01); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, (byte)0x01, (byte)0x01); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, (byte)0x01); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, (byte)0x01, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, (byte)0x01, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, (byte)0x01, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, (byte)0x01, (byte)0x01, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, (byte)0x01, (byte)0x01); }); checkCCE(() -> { // receiver reference class @@ -1611,35 +2309,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, (byte)0x01, (byte)0x01); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, (byte)0x01, (byte)0x01); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, (byte)0x01); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, (byte)0x01, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, (byte)0x01, (byte)0x01); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, (byte)0x01, (byte)0x01); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, (byte)0x01, (byte)0x01, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +2507,72 @@ byte x = (byte) vh.getAndSet(array, 0, (byte)0x01, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndSetAcquire(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndSetAcquire(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + byte x = (byte) vh.getAndSetAcquire(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndSetAcquire(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndSetAcquire(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndSetRelease(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndSetRelease(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + byte x = (byte) vh.getAndSetRelease(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndSetRelease(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndSetRelease(array, 0, (byte)0x01, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,36 +2606,365 @@ }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - byte x = (byte) vh.addAndGet(null, 0, (byte)0x01); + byte x = (byte) vh.getAndAddAcquire(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndAddAcquire(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndAddAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndAddAcquire(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndAddAcquire(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndAddAcquire(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndAddRelease(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndAddRelease(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndAddRelease(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndAddRelease(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndAddRelease(array, 0, (byte)0x01, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseOr(null, 0, (byte)0x01); }); checkCCE(() -> { // array reference class - byte x = (byte) vh.addAndGet(Void.class, 0, (byte)0x01); + byte x = (byte) vh.getAndBitwiseOr(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseOr(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseOr(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOr(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseOrAcquire(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseOrAcquire(Void.class, 0, (byte)0x01); }); checkWMTE(() -> { // value reference class - byte x = (byte) vh.addAndGet(array, 0, Void.class); + byte x = (byte) vh.getAndBitwiseOrAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - byte x = (byte) vh.addAndGet(0, 0, (byte)0x01); + byte x = (byte) vh.getAndBitwiseOrAcquire(0, 0, (byte)0x01); }); checkWMTE(() -> { // index reference class - byte x = (byte) vh.addAndGet(array, Void.class, (byte)0x01); + byte x = (byte) vh.getAndBitwiseOrAcquire(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOrAcquire(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseOrRelease(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseOrRelease(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseOrRelease(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseOrRelease(array, Void.class, (byte)0x01); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, (byte)0x01); + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, (byte)0x01); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, (byte)0x01); + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseOrRelease(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseAnd(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseAnd(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseAnd(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseAnd(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAnd(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseAndAcquire(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseAndAcquire(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseAndAcquire(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseAndAcquire(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, (byte)0x01); }); // Incorrect arity checkWMTE(() -> { // 0 - byte x = (byte) vh.addAndGet(); + byte x = (byte) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseAndAcquire(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseAndRelease(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseAndRelease(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseAndRelease(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseAndRelease(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseAndRelease(); }); checkWMTE(() -> { // > - byte x = (byte) vh.addAndGet(array, 0, (byte)0x01, Void.class); + byte x = (byte) vh.getAndBitwiseAndRelease(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseXor(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseXor(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseXor(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseXor(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXor(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseXorAcquire(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseXorAcquire(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseXorAcquire(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseXorAcquire(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXorAcquire(array, 0, (byte)0x01, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) vh.getAndBitwiseXorRelease(null, 0, (byte)0x01); + }); + checkCCE(() -> { // array reference class + byte x = (byte) vh.getAndBitwiseXorRelease(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) vh.getAndBitwiseXorRelease(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) vh.getAndBitwiseXorRelease(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + byte x = (byte) vh.getAndBitwiseXorRelease(array, 0, (byte)0x01, Void.class); }); } @@ -2144,6 +3208,48 @@ invokeExact(array, 0, (byte)0x01, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class)). + invokeExact((byte[]) null, 0, (byte)0x01); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + byte x = (byte) hs.get(am, methodType(byte.class, Class.class, int.class, byte.class)). + invokeExact(Void.class, 0, (byte)0x01); + }); + checkWMTE(() -> { // value reference class + byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + byte x = (byte) hs.get(am, methodType(byte.class, int.class, int.class, byte.class)). + invokeExact(0, 0, (byte)0x01); + }); + checkWMTE(() -> { // index reference class + byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, Class.class, byte.class)). + invokeExact(array, Void.class, (byte)0x01); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, byte[].class, int.class, byte.class)). + invokeExact(array, 0, (byte)0x01); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, byte[].class, int.class, byte.class)). + invokeExact(array, 0, (byte)0x01); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + byte x = (byte) hs.get(am, methodType(byte.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + byte x = (byte) hs.get(am, methodType(byte.class, byte[].class, int.class, byte.class, Class.class)). + invokeExact(array, 0, (byte)0x01, Void.class); + }); + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeChar.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -353,6 +353,32 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, '\u0123', '\u0123'); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, '\u0123', '\u0123'); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, '\u0123'); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, '\u0123', Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, '\u0123', '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, '\u0123', '\u0123', Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, '\u0123', '\u0123'); }); checkCCE(() -> { // receiver reference class @@ -376,32 +402,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, '\u0123', '\u0123'); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, '\u0123', '\u0123'); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, '\u0123'); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, '\u0123', Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, '\u0123', '\u0123'); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, '\u0123', '\u0123', Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ char x = (char) vh.getAndSet(recv, '\u0123', Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndSetAcquire(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndSetAcquire(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndSetAcquire(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndSetAcquire(recv, '\u0123', Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndSetRelease(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndSetRelease(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndSetRelease(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndSetRelease(recv, '\u0123', Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,34 +669,331 @@ char x = (char) vh.getAndAdd(recv, '\u0123', Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - char x = (char) vh.addAndGet(null, '\u0123'); + char x = (char) vh.getAndAddAcquire(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndAddAcquire(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndAddAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndAddAcquire(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndAddAcquire(recv, '\u0123', Void.class); + }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndAddRelease(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndAddRelease(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndAddRelease(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndAddRelease(recv, '\u0123', Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseOr(null, '\u0123'); }); checkCCE(() -> { // receiver reference class - char x = (char) vh.addAndGet(Void.class, '\u0123'); + char x = (char) vh.getAndBitwiseOr(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseOr(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOr(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseOrAcquire(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseOrAcquire(Void.class, '\u0123'); }); checkWMTE(() -> { // value reference class - char x = (char) vh.addAndGet(recv, Void.class); + char x = (char) vh.getAndBitwiseOrAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - char x = (char) vh.addAndGet(0, '\u0123'); + char x = (char) vh.getAndBitwiseOrAcquire(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOrAcquire(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseOrRelease(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseOr(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseOr(0, '\u0123'); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, '\u0123'); + Void r = (Void) vh.getAndBitwiseOr(recv, '\u0123'); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, '\u0123'); + boolean x = (boolean) vh.getAndBitwiseOr(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOr(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseAnd(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseAnd(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseAnd(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAnd(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseAndAcquire(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseAndAcquire(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseAndAcquire(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, '\u0123'); }); // Incorrect arity checkWMTE(() -> { // 0 - char x = (char) vh.addAndGet(); + char x = (char) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAndAcquire(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseAndRelease(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseAnd(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseAnd(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAnd(); }); checkWMTE(() -> { // > - char x = (char) vh.addAndGet(recv, '\u0123', Void.class); + char x = (char) vh.getAndBitwiseAnd(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseXor(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseXor(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseXor(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXor(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseXorAcquire(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseXorAcquire(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseXorAcquire(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXorAcquire(recv, '\u0123', Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + char x = (char) vh.getAndBitwiseXorRelease(null, '\u0123'); + }); + checkCCE(() -> { // receiver reference class + char x = (char) vh.getAndBitwiseXor(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) vh.getAndBitwiseXor(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXor(recv, '\u0123', Void.class); }); } @@ -853,6 +1208,43 @@ invokeExact(recv, '\u0123', Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class, char.class)). + invokeExact((VarHandleTestMethodTypeChar) null, '\u0123'); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + char x = (char) hs.get(am, methodType(char.class, Class.class, char.class)). + invokeExact(Void.class, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + char x = (char) hs.get(am, methodType(char.class, int.class, char.class)). + invokeExact(0, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeChar.class, char.class)). + invokeExact(recv, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeChar.class, char.class)). + invokeExact(recv, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) hs.get(am, methodType(char.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + char x = (char) hs.get(am, methodType(char.class, VarHandleTestMethodTypeChar.class, char.class)). + invokeExact(recv, '\u0123', Void.class); + }); + } } @@ -986,6 +1378,23 @@ // WeakCompareAndSet // Incorrect argument types checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, '\u0123'); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain('\u0123', Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain('\u0123', '\u0123', Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, '\u0123'); }); checkWMTE(() -> { // actual reference class @@ -1000,23 +1409,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, '\u0123'); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile('\u0123', Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile('\u0123', '\u0123', Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1535,48 @@ char x = (char) vh.getAndSet('\u0123', Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndSetAcquire('\u0123', Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndSetRelease('\u0123', Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,24 +1598,233 @@ }); - // AddAndGet + // GetAndAddAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndAddAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndAddAcquire('\u0123', Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndAddRelease('\u0123', Void.class); + }); + + // GetAndBitwiseOr // Incorrect argument types checkWMTE(() -> { // value reference class - char x = (char) vh.addAndGet(Void.class); + char x = (char) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOr('\u0123', Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOrAcquire('\u0123', Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOrRelease('\u0123', Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAnd(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet('\u0123'); + Void r = (Void) vh.getAndBitwiseAnd('\u0123'); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet('\u0123'); + boolean x = (boolean) vh.getAndBitwiseAnd('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAnd('\u0123', Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAndAcquire('\u0123', Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease('\u0123'); }); // Incorrect arity checkWMTE(() -> { // 0 - char x = (char) vh.addAndGet(); + char x = (char) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAndRelease('\u0123', Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXor(); }); checkWMTE(() -> { // > - char x = (char) vh.addAndGet('\u0123', Void.class); + char x = (char) vh.getAndBitwiseXor('\u0123', Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXorAcquire('\u0123', Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXorRelease('\u0123', Void.class); }); } @@ -1322,6 +1965,32 @@ invokeExact('\u0123', Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkWMTE(() -> { // value reference class + char x = (char) hs.get(am, methodType(char.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, char.class)). + invokeExact('\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, char.class)). + invokeExact('\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) hs.get(am, methodType(char.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + char x = (char) hs.get(am, methodType(char.class, char.class, Class.class)). + invokeExact('\u0123', Void.class); + }); + } } @@ -1585,6 +2254,35 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, '\u0123', '\u0123'); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, '\u0123', '\u0123'); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, '\u0123'); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, '\u0123', Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, '\u0123', '\u0123'); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, '\u0123', '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, '\u0123', '\u0123', Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, '\u0123', '\u0123'); }); checkCCE(() -> { // receiver reference class @@ -1611,35 +2309,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, '\u0123', '\u0123'); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, '\u0123', '\u0123'); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, '\u0123'); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, '\u0123', Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, '\u0123', '\u0123'); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, '\u0123', '\u0123'); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, '\u0123', '\u0123', Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +2507,72 @@ char x = (char) vh.getAndSet(array, 0, '\u0123', Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndSetAcquire(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndSetAcquire(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + char x = (char) vh.getAndSetAcquire(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndSetAcquire(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndSetAcquire(array, 0, '\u0123', Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndSetRelease(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndSetRelease(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + char x = (char) vh.getAndSetRelease(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndSetRelease(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndSetRelease(array, 0, '\u0123', Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,36 +2606,365 @@ }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - char x = (char) vh.addAndGet(null, 0, '\u0123'); + char x = (char) vh.getAndAddAcquire(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndAddAcquire(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndAddAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndAddAcquire(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndAddAcquire(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndAddAcquire(array, 0, '\u0123', Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndAddRelease(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndAddRelease(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndAddRelease(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndAddRelease(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndAddRelease(array, 0, '\u0123', Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseOr(null, 0, '\u0123'); }); checkCCE(() -> { // array reference class - char x = (char) vh.addAndGet(Void.class, 0, '\u0123'); + char x = (char) vh.getAndBitwiseOr(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseOr(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseOr(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOr(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseOrAcquire(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseOrAcquire(Void.class, 0, '\u0123'); }); checkWMTE(() -> { // value reference class - char x = (char) vh.addAndGet(array, 0, Void.class); + char x = (char) vh.getAndBitwiseOrAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - char x = (char) vh.addAndGet(0, 0, '\u0123'); + char x = (char) vh.getAndBitwiseOrAcquire(0, 0, '\u0123'); }); checkWMTE(() -> { // index reference class - char x = (char) vh.addAndGet(array, Void.class, '\u0123'); + char x = (char) vh.getAndBitwiseOrAcquire(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOrAcquire(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseOrRelease(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseOrRelease(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseOrRelease(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseOrRelease(array, Void.class, '\u0123'); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, '\u0123'); + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, '\u0123'); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, '\u0123'); + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseOrRelease(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseAnd(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseAnd(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseAnd(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseAnd(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAnd(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseAndAcquire(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseAndAcquire(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseAndAcquire(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseAndAcquire(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, '\u0123'); }); // Incorrect arity checkWMTE(() -> { // 0 - char x = (char) vh.addAndGet(); + char x = (char) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseAndAcquire(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseAndRelease(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseAndRelease(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseAndRelease(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseAndRelease(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseAndRelease(); }); checkWMTE(() -> { // > - char x = (char) vh.addAndGet(array, 0, '\u0123', Void.class); + char x = (char) vh.getAndBitwiseAndRelease(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseXor(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseXor(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseXor(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseXor(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXor(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseXorAcquire(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseXorAcquire(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseXorAcquire(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseXorAcquire(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXorAcquire(array, 0, '\u0123', Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) vh.getAndBitwiseXorRelease(null, 0, '\u0123'); + }); + checkCCE(() -> { // array reference class + char x = (char) vh.getAndBitwiseXorRelease(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) vh.getAndBitwiseXorRelease(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) vh.getAndBitwiseXorRelease(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + char x = (char) vh.getAndBitwiseXorRelease(array, 0, '\u0123', Void.class); }); } @@ -2144,6 +3208,48 @@ invokeExact(array, 0, '\u0123', Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + char x = (char) hs.get(am, methodType(char.class, char[].class, int.class, char.class)). + invokeExact((char[]) null, 0, '\u0123'); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + char x = (char) hs.get(am, methodType(char.class, Class.class, int.class, char.class)). + invokeExact(Void.class, 0, '\u0123'); + }); + checkWMTE(() -> { // value reference class + char x = (char) hs.get(am, methodType(char.class, char[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + char x = (char) hs.get(am, methodType(char.class, int.class, int.class, char.class)). + invokeExact(0, 0, '\u0123'); + }); + checkWMTE(() -> { // index reference class + char x = (char) hs.get(am, methodType(char.class, char[].class, Class.class, char.class)). + invokeExact(array, Void.class, '\u0123'); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, char[].class, int.class, char.class)). + invokeExact(array, 0, '\u0123'); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, char[].class, int.class, char.class)). + invokeExact(array, 0, '\u0123'); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + char x = (char) hs.get(am, methodType(char.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + char x = (char) hs.get(am, methodType(char.class, char[].class, int.class, char.class, Class.class)). + invokeExact(array, 0, '\u0123', Void.class); + }); + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeDouble.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -353,6 +353,32 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 1.0d, 1.0d); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 1.0d, 1.0d); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, 1.0d); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, 1.0d, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 1.0d, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, 1.0d, 1.0d, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 1.0d, 1.0d); }); checkCCE(() -> { // receiver reference class @@ -376,32 +402,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 1.0d, 1.0d); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 1.0d, 1.0d); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, 1.0d); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, 1.0d, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 1.0d, 1.0d); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, 1.0d, 1.0d, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ double x = (double) vh.getAndSet(recv, 1.0d, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + double x = (double) vh.getAndSetAcquire(null, 1.0d); + }); + checkCCE(() -> { // receiver reference class + double x = (double) vh.getAndSetAcquire(Void.class, 1.0d); + }); + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + double x = (double) vh.getAndSetAcquire(0, 1.0d); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, 1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndSetAcquire(recv, 1.0d, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + double x = (double) vh.getAndSetRelease(null, 1.0d); + }); + checkCCE(() -> { // receiver reference class + double x = (double) vh.getAndSetRelease(Void.class, 1.0d); + }); + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + double x = (double) vh.getAndSetRelease(0, 1.0d); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, 1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndSetRelease(recv, 1.0d, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,35 +669,64 @@ double x = (double) vh.getAndAdd(recv, 1.0d, Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - double x = (double) vh.addAndGet(null, 1.0d); + double x = (double) vh.getAndAddAcquire(null, 1.0d); }); checkCCE(() -> { // receiver reference class - double x = (double) vh.addAndGet(Void.class, 1.0d); + double x = (double) vh.getAndAddAcquire(Void.class, 1.0d); }); checkWMTE(() -> { // value reference class - double x = (double) vh.addAndGet(recv, Void.class); + double x = (double) vh.getAndAddAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - double x = (double) vh.addAndGet(0, 1.0d); + double x = (double) vh.getAndAddAcquire(0, 1.0d); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, 1.0d); + Void r = (Void) vh.getAndAddAcquire(recv, 1.0d); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, 1.0d); + boolean x = (boolean) vh.getAndAddAcquire(recv, 1.0d); }); // Incorrect arity checkWMTE(() -> { // 0 - double x = (double) vh.addAndGet(); + double x = (double) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - double x = (double) vh.addAndGet(recv, 1.0d, Void.class); - }); + double x = (double) vh.getAndAddAcquire(recv, 1.0d, Void.class); + }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + double x = (double) vh.getAndAddRelease(null, 1.0d); + }); + checkCCE(() -> { // receiver reference class + double x = (double) vh.getAndAddRelease(Void.class, 1.0d); + }); + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + double x = (double) vh.getAndAddRelease(0, 1.0d); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, 1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndAddRelease(recv, 1.0d, Void.class); + }); + } static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeDouble recv, Handles hs) throws Throwable { @@ -853,6 +940,7 @@ invokeExact(recv, 1.0d, Void.class); }); } + } @@ -986,6 +1074,23 @@ // WeakCompareAndSet // Incorrect argument types checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 1.0d); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(1.0d, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(1.0d, 1.0d, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, 1.0d); }); checkWMTE(() -> { // actual reference class @@ -1000,23 +1105,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 1.0d); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(1.0d, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(1.0d, 1.0d, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1231,48 @@ double x = (double) vh.getAndSet(1.0d, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndSetAcquire(1.0d, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndSetRelease(1.0d, Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,25 +1294,47 @@ }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkWMTE(() -> { // value reference class - double x = (double) vh.addAndGet(Void.class); + double x = (double) vh.getAndAddAcquire(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(1.0d); + Void r = (Void) vh.getAndAddAcquire(1.0d); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(1.0d); + boolean x = (boolean) vh.getAndAddAcquire(1.0d); }); // Incorrect arity checkWMTE(() -> { // 0 - double x = (double) vh.addAndGet(); + double x = (double) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - double x = (double) vh.addAndGet(1.0d, Void.class); - }); + double x = (double) vh.getAndAddAcquire(1.0d, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndAddRelease(1.0d, Void.class); + }); + } static void testStaticFieldWrongMethodType(Handles hs) throws Throwable { @@ -1322,6 +1474,7 @@ invokeExact(1.0d, Void.class); }); } + } @@ -1585,6 +1738,35 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, 1.0d, 1.0d); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, 1.0d, 1.0d); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, 1.0d); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, 1.0d, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, 1.0d, 1.0d); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, 1.0d, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, 1.0d, 1.0d, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, 1.0d, 1.0d); }); checkCCE(() -> { // receiver reference class @@ -1611,35 +1793,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, 1.0d, 1.0d); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, 1.0d, 1.0d); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, 1.0d); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, 1.0d, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, 1.0d, 1.0d); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, 1.0d, 1.0d); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, 1.0d, 1.0d, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +1991,72 @@ double x = (double) vh.getAndSet(array, 0, 1.0d, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + double x = (double) vh.getAndSetAcquire(null, 0, 1.0d); + }); + checkCCE(() -> { // array reference class + double x = (double) vh.getAndSetAcquire(Void.class, 0, 1.0d); + }); + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + double x = (double) vh.getAndSetAcquire(0, 0, 1.0d); + }); + checkWMTE(() -> { // index reference class + double x = (double) vh.getAndSetAcquire(array, Void.class, 1.0d); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, 1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndSetAcquire(array, 0, 1.0d, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + double x = (double) vh.getAndSetRelease(null, 0, 1.0d); + }); + checkCCE(() -> { // array reference class + double x = (double) vh.getAndSetRelease(Void.class, 0, 1.0d); + }); + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + double x = (double) vh.getAndSetRelease(0, 0, 1.0d); + }); + checkWMTE(() -> { // index reference class + double x = (double) vh.getAndSetRelease(array, Void.class, 1.0d); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, 1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndSetRelease(array, 0, 1.0d, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,37 +2090,71 @@ }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - double x = (double) vh.addAndGet(null, 0, 1.0d); + double x = (double) vh.getAndAddAcquire(null, 0, 1.0d); }); checkCCE(() -> { // array reference class - double x = (double) vh.addAndGet(Void.class, 0, 1.0d); + double x = (double) vh.getAndAddAcquire(Void.class, 0, 1.0d); }); checkWMTE(() -> { // value reference class - double x = (double) vh.addAndGet(array, 0, Void.class); + double x = (double) vh.getAndAddAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - double x = (double) vh.addAndGet(0, 0, 1.0d); + double x = (double) vh.getAndAddAcquire(0, 0, 1.0d); }); checkWMTE(() -> { // index reference class - double x = (double) vh.addAndGet(array, Void.class, 1.0d); + double x = (double) vh.getAndAddAcquire(array, Void.class, 1.0d); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, 1.0d); + Void r = (Void) vh.getAndAddAcquire(array, 0, 1.0d); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, 1.0d); + boolean x = (boolean) vh.getAndAddAcquire(array, 0, 1.0d); }); // Incorrect arity checkWMTE(() -> { // 0 - double x = (double) vh.addAndGet(); + double x = (double) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - double x = (double) vh.addAndGet(array, 0, 1.0d, Void.class); - }); + double x = (double) vh.getAndAddAcquire(array, 0, 1.0d, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + double x = (double) vh.getAndAddRelease(null, 0, 1.0d); + }); + checkCCE(() -> { // array reference class + double x = (double) vh.getAndAddRelease(Void.class, 0, 1.0d); + }); + checkWMTE(() -> { // value reference class + double x = (double) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + double x = (double) vh.getAndAddRelease(0, 0, 1.0d); + }); + checkWMTE(() -> { // index reference class + double x = (double) vh.getAndAddRelease(array, Void.class, 1.0d); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, 1.0d); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, 1.0d); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + double x = (double) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + double x = (double) vh.getAndAddRelease(array, 0, 1.0d, Void.class); + }); + } static void testArrayWrongMethodType(Handles hs) throws Throwable { @@ -2144,6 +2397,7 @@ invokeExact(array, 0, 1.0d, Void.class); }); } + } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeFloat.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -353,6 +353,32 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 1.0f, 1.0f); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 1.0f, 1.0f); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, 1.0f); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, 1.0f, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 1.0f, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, 1.0f, 1.0f, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 1.0f, 1.0f); }); checkCCE(() -> { // receiver reference class @@ -376,32 +402,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 1.0f, 1.0f); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 1.0f, 1.0f); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, 1.0f); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, 1.0f, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 1.0f, 1.0f); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, 1.0f, 1.0f, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ float x = (float) vh.getAndSet(recv, 1.0f, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + float x = (float) vh.getAndSetAcquire(null, 1.0f); + }); + checkCCE(() -> { // receiver reference class + float x = (float) vh.getAndSetAcquire(Void.class, 1.0f); + }); + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + float x = (float) vh.getAndSetAcquire(0, 1.0f); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, 1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndSetAcquire(recv, 1.0f, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + float x = (float) vh.getAndSetRelease(null, 1.0f); + }); + checkCCE(() -> { // receiver reference class + float x = (float) vh.getAndSetRelease(Void.class, 1.0f); + }); + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + float x = (float) vh.getAndSetRelease(0, 1.0f); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, 1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndSetRelease(recv, 1.0f, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,35 +669,64 @@ float x = (float) vh.getAndAdd(recv, 1.0f, Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - float x = (float) vh.addAndGet(null, 1.0f); + float x = (float) vh.getAndAddAcquire(null, 1.0f); }); checkCCE(() -> { // receiver reference class - float x = (float) vh.addAndGet(Void.class, 1.0f); + float x = (float) vh.getAndAddAcquire(Void.class, 1.0f); }); checkWMTE(() -> { // value reference class - float x = (float) vh.addAndGet(recv, Void.class); + float x = (float) vh.getAndAddAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - float x = (float) vh.addAndGet(0, 1.0f); + float x = (float) vh.getAndAddAcquire(0, 1.0f); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, 1.0f); + Void r = (Void) vh.getAndAddAcquire(recv, 1.0f); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, 1.0f); + boolean x = (boolean) vh.getAndAddAcquire(recv, 1.0f); }); // Incorrect arity checkWMTE(() -> { // 0 - float x = (float) vh.addAndGet(); + float x = (float) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - float x = (float) vh.addAndGet(recv, 1.0f, Void.class); - }); + float x = (float) vh.getAndAddAcquire(recv, 1.0f, Void.class); + }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + float x = (float) vh.getAndAddRelease(null, 1.0f); + }); + checkCCE(() -> { // receiver reference class + float x = (float) vh.getAndAddRelease(Void.class, 1.0f); + }); + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + float x = (float) vh.getAndAddRelease(0, 1.0f); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, 1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndAddRelease(recv, 1.0f, Void.class); + }); + } static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeFloat recv, Handles hs) throws Throwable { @@ -853,6 +940,7 @@ invokeExact(recv, 1.0f, Void.class); }); } + } @@ -986,6 +1074,23 @@ // WeakCompareAndSet // Incorrect argument types checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 1.0f); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(1.0f, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(1.0f, 1.0f, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, 1.0f); }); checkWMTE(() -> { // actual reference class @@ -1000,23 +1105,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 1.0f); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(1.0f, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(1.0f, 1.0f, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1231,48 @@ float x = (float) vh.getAndSet(1.0f, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndSetAcquire(1.0f, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndSetRelease(1.0f, Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,25 +1294,47 @@ }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkWMTE(() -> { // value reference class - float x = (float) vh.addAndGet(Void.class); + float x = (float) vh.getAndAddAcquire(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(1.0f); + Void r = (Void) vh.getAndAddAcquire(1.0f); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(1.0f); + boolean x = (boolean) vh.getAndAddAcquire(1.0f); }); // Incorrect arity checkWMTE(() -> { // 0 - float x = (float) vh.addAndGet(); + float x = (float) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - float x = (float) vh.addAndGet(1.0f, Void.class); - }); + float x = (float) vh.getAndAddAcquire(1.0f, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndAddRelease(1.0f, Void.class); + }); + } static void testStaticFieldWrongMethodType(Handles hs) throws Throwable { @@ -1322,6 +1474,7 @@ invokeExact(1.0f, Void.class); }); } + } @@ -1585,6 +1738,35 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, 1.0f, 1.0f); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, 1.0f, 1.0f); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, 1.0f); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, 1.0f, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, 1.0f, 1.0f); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, 1.0f, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, 1.0f, 1.0f, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, 1.0f, 1.0f); }); checkCCE(() -> { // receiver reference class @@ -1611,35 +1793,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, 1.0f, 1.0f); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, 1.0f, 1.0f); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, 1.0f); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, 1.0f, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, 1.0f, 1.0f); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, 1.0f, 1.0f); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, 1.0f, 1.0f, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +1991,72 @@ float x = (float) vh.getAndSet(array, 0, 1.0f, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + float x = (float) vh.getAndSetAcquire(null, 0, 1.0f); + }); + checkCCE(() -> { // array reference class + float x = (float) vh.getAndSetAcquire(Void.class, 0, 1.0f); + }); + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + float x = (float) vh.getAndSetAcquire(0, 0, 1.0f); + }); + checkWMTE(() -> { // index reference class + float x = (float) vh.getAndSetAcquire(array, Void.class, 1.0f); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, 1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndSetAcquire(array, 0, 1.0f, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + float x = (float) vh.getAndSetRelease(null, 0, 1.0f); + }); + checkCCE(() -> { // array reference class + float x = (float) vh.getAndSetRelease(Void.class, 0, 1.0f); + }); + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + float x = (float) vh.getAndSetRelease(0, 0, 1.0f); + }); + checkWMTE(() -> { // index reference class + float x = (float) vh.getAndSetRelease(array, Void.class, 1.0f); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, 1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndSetRelease(array, 0, 1.0f, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,37 +2090,71 @@ }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - float x = (float) vh.addAndGet(null, 0, 1.0f); + float x = (float) vh.getAndAddAcquire(null, 0, 1.0f); }); checkCCE(() -> { // array reference class - float x = (float) vh.addAndGet(Void.class, 0, 1.0f); + float x = (float) vh.getAndAddAcquire(Void.class, 0, 1.0f); }); checkWMTE(() -> { // value reference class - float x = (float) vh.addAndGet(array, 0, Void.class); + float x = (float) vh.getAndAddAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - float x = (float) vh.addAndGet(0, 0, 1.0f); + float x = (float) vh.getAndAddAcquire(0, 0, 1.0f); }); checkWMTE(() -> { // index reference class - float x = (float) vh.addAndGet(array, Void.class, 1.0f); + float x = (float) vh.getAndAddAcquire(array, Void.class, 1.0f); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, 1.0f); + Void r = (Void) vh.getAndAddAcquire(array, 0, 1.0f); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, 1.0f); + boolean x = (boolean) vh.getAndAddAcquire(array, 0, 1.0f); }); // Incorrect arity checkWMTE(() -> { // 0 - float x = (float) vh.addAndGet(); + float x = (float) vh.getAndAddAcquire(); }); checkWMTE(() -> { // > - float x = (float) vh.addAndGet(array, 0, 1.0f, Void.class); - }); + float x = (float) vh.getAndAddAcquire(array, 0, 1.0f, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + float x = (float) vh.getAndAddRelease(null, 0, 1.0f); + }); + checkCCE(() -> { // array reference class + float x = (float) vh.getAndAddRelease(Void.class, 0, 1.0f); + }); + checkWMTE(() -> { // value reference class + float x = (float) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + float x = (float) vh.getAndAddRelease(0, 0, 1.0f); + }); + checkWMTE(() -> { // index reference class + float x = (float) vh.getAndAddRelease(array, Void.class, 1.0f); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, 1.0f); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, 1.0f); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + float x = (float) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + float x = (float) vh.getAndAddRelease(array, 0, 1.0f, Void.class); + }); + } static void testArrayWrongMethodType(Handles hs) throws Throwable { @@ -2144,6 +2397,7 @@ invokeExact(array, 0, 1.0f, Void.class); }); } + } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeInt.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -353,6 +353,32 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0x01234567, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0x01234567, 0x01234567); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, 0x01234567); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, 0x01234567, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0x01234567, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, 0x01234567, 0x01234567, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0x01234567, 0x01234567); }); checkCCE(() -> { // receiver reference class @@ -376,32 +402,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0x01234567, 0x01234567); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0x01234567, 0x01234567); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, 0x01234567); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, 0x01234567, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0x01234567, 0x01234567); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, 0x01234567, 0x01234567, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ int x = (int) vh.getAndSet(recv, 0x01234567, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndSetAcquire(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndSetAcquire(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndSetAcquire(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndSetAcquire(recv, 0x01234567, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndSetRelease(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndSetRelease(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndSetRelease(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndSetRelease(recv, 0x01234567, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,34 +669,331 @@ int x = (int) vh.getAndAdd(recv, 0x01234567, Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - int x = (int) vh.addAndGet(null, 0x01234567); + int x = (int) vh.getAndAddAcquire(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndAddAcquire(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndAddAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndAddAcquire(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndAddAcquire(recv, 0x01234567, Void.class); + }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndAddRelease(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndAddRelease(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndAddRelease(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndAddRelease(recv, 0x01234567, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseOr(null, 0x01234567); }); checkCCE(() -> { // receiver reference class - int x = (int) vh.addAndGet(Void.class, 0x01234567); + int x = (int) vh.getAndBitwiseOr(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseOr(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOr(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseOrAcquire(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseOrAcquire(Void.class, 0x01234567); }); checkWMTE(() -> { // value reference class - int x = (int) vh.addAndGet(recv, Void.class); + int x = (int) vh.getAndBitwiseOrAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - int x = (int) vh.addAndGet(0, 0x01234567); + int x = (int) vh.getAndBitwiseOrAcquire(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOrAcquire(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseOrRelease(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseOr(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseOr(0, 0x01234567); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, 0x01234567); + Void r = (Void) vh.getAndBitwiseOr(recv, 0x01234567); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, 0x01234567); + boolean x = (boolean) vh.getAndBitwiseOr(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOr(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseAnd(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseAnd(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseAnd(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAnd(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseAndAcquire(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseAndAcquire(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseAndAcquire(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, 0x01234567); }); // Incorrect arity checkWMTE(() -> { // 0 - int x = (int) vh.addAndGet(); + int x = (int) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAndAcquire(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseAndRelease(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseAnd(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseAnd(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAnd(); }); checkWMTE(() -> { // > - int x = (int) vh.addAndGet(recv, 0x01234567, Void.class); + int x = (int) vh.getAndBitwiseAnd(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseXor(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseXor(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseXor(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXor(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseXorAcquire(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseXorAcquire(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseXorAcquire(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXorAcquire(recv, 0x01234567, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + int x = (int) vh.getAndBitwiseXorRelease(null, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + int x = (int) vh.getAndBitwiseXor(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) vh.getAndBitwiseXor(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXor(recv, 0x01234567, Void.class); }); } @@ -853,6 +1208,43 @@ invokeExact(recv, 0x01234567, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)). + invokeExact((VarHandleTestMethodTypeInt) null, 0x01234567); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + int x = (int) hs.get(am, methodType(int.class, Class.class, int.class)). + invokeExact(Void.class, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + int x = (int) hs.get(am, methodType(int.class, int.class, int.class)). + invokeExact(0, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeInt.class, int.class)). + invokeExact(recv, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeInt.class, int.class)). + invokeExact(recv, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) hs.get(am, methodType(int.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + int x = (int) hs.get(am, methodType(int.class, VarHandleTestMethodTypeInt.class, int.class)). + invokeExact(recv, 0x01234567, Void.class); + }); + } } @@ -986,6 +1378,23 @@ // WeakCompareAndSet // Incorrect argument types checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0x01234567); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(0x01234567, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(0x01234567, 0x01234567, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, 0x01234567); }); checkWMTE(() -> { // actual reference class @@ -1000,23 +1409,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0x01234567); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(0x01234567, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(0x01234567, 0x01234567, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1535,48 @@ int x = (int) vh.getAndSet(0x01234567, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndSetAcquire(0x01234567, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndSetRelease(0x01234567, Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,24 +1598,233 @@ }); - // AddAndGet + // GetAndAddAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndAddAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndAddAcquire(0x01234567, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndAddRelease(0x01234567, Void.class); + }); + + // GetAndBitwiseOr // Incorrect argument types checkWMTE(() -> { // value reference class - int x = (int) vh.addAndGet(Void.class); + int x = (int) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOr(0x01234567, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOrAcquire(0x01234567, Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOrRelease(0x01234567, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAnd(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(0x01234567); + Void r = (Void) vh.getAndBitwiseAnd(0x01234567); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(0x01234567); + boolean x = (boolean) vh.getAndBitwiseAnd(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAnd(0x01234567, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAndAcquire(0x01234567, Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(0x01234567); }); // Incorrect arity checkWMTE(() -> { // 0 - int x = (int) vh.addAndGet(); + int x = (int) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAndRelease(0x01234567, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXor(); }); checkWMTE(() -> { // > - int x = (int) vh.addAndGet(0x01234567, Void.class); + int x = (int) vh.getAndBitwiseXor(0x01234567, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXorAcquire(0x01234567, Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXorRelease(0x01234567, Void.class); }); } @@ -1322,6 +1965,32 @@ invokeExact(0x01234567, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkWMTE(() -> { // value reference class + int x = (int) hs.get(am, methodType(int.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, int.class)). + invokeExact(0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, int.class)). + invokeExact(0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) hs.get(am, methodType(int.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + int x = (int) hs.get(am, methodType(int.class, int.class, Class.class)). + invokeExact(0x01234567, Void.class); + }); + } } @@ -1585,6 +2254,35 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, 0x01234567, 0x01234567); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, 0x01234567, 0x01234567); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, 0x01234567); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, 0x01234567, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, 0x01234567, 0x01234567); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, 0x01234567, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, 0x01234567, 0x01234567, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, 0x01234567, 0x01234567); }); checkCCE(() -> { // receiver reference class @@ -1611,35 +2309,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, 0x01234567, 0x01234567); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, 0x01234567, 0x01234567); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, 0x01234567); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, 0x01234567, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, 0x01234567, 0x01234567); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, 0x01234567, 0x01234567); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, 0x01234567, 0x01234567, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +2507,72 @@ int x = (int) vh.getAndSet(array, 0, 0x01234567, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndSetAcquire(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndSetAcquire(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + int x = (int) vh.getAndSetAcquire(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndSetAcquire(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndSetAcquire(array, 0, 0x01234567, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndSetRelease(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndSetRelease(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + int x = (int) vh.getAndSetRelease(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndSetRelease(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndSetRelease(array, 0, 0x01234567, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,36 +2606,365 @@ }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - int x = (int) vh.addAndGet(null, 0, 0x01234567); + int x = (int) vh.getAndAddAcquire(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndAddAcquire(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndAddAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndAddAcquire(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndAddAcquire(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndAddAcquire(array, 0, 0x01234567, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndAddRelease(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndAddRelease(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndAddRelease(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndAddRelease(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndAddRelease(array, 0, 0x01234567, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseOr(null, 0, 0x01234567); }); checkCCE(() -> { // array reference class - int x = (int) vh.addAndGet(Void.class, 0, 0x01234567); + int x = (int) vh.getAndBitwiseOr(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseOr(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseOr(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOr(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseOrAcquire(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseOrAcquire(Void.class, 0, 0x01234567); }); checkWMTE(() -> { // value reference class - int x = (int) vh.addAndGet(array, 0, Void.class); + int x = (int) vh.getAndBitwiseOrAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - int x = (int) vh.addAndGet(0, 0, 0x01234567); + int x = (int) vh.getAndBitwiseOrAcquire(0, 0, 0x01234567); }); checkWMTE(() -> { // index reference class - int x = (int) vh.addAndGet(array, Void.class, 0x01234567); + int x = (int) vh.getAndBitwiseOrAcquire(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOrAcquire(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseOrRelease(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseOrRelease(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseOrRelease(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseOrRelease(array, Void.class, 0x01234567); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, 0x01234567); + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, 0x01234567); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, 0x01234567); + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseOrRelease(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseAnd(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseAnd(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseAnd(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseAnd(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAnd(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseAndAcquire(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseAndAcquire(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseAndAcquire(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseAndAcquire(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, 0x01234567); }); // Incorrect arity checkWMTE(() -> { // 0 - int x = (int) vh.addAndGet(); + int x = (int) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseAndAcquire(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseAndRelease(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseAndRelease(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseAndRelease(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseAndRelease(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseAndRelease(); }); checkWMTE(() -> { // > - int x = (int) vh.addAndGet(array, 0, 0x01234567, Void.class); + int x = (int) vh.getAndBitwiseAndRelease(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseXor(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseXor(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseXor(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseXor(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXor(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseXorAcquire(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseXorAcquire(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseXorAcquire(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseXorAcquire(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXorAcquire(array, 0, 0x01234567, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) vh.getAndBitwiseXorRelease(null, 0, 0x01234567); + }); + checkCCE(() -> { // array reference class + int x = (int) vh.getAndBitwiseXorRelease(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) vh.getAndBitwiseXorRelease(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) vh.getAndBitwiseXorRelease(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + int x = (int) vh.getAndBitwiseXorRelease(array, 0, 0x01234567, Void.class); }); } @@ -2144,6 +3208,48 @@ invokeExact(array, 0, 0x01234567, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class)). + invokeExact((int[]) null, 0, 0x01234567); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + int x = (int) hs.get(am, methodType(int.class, Class.class, int.class, int.class)). + invokeExact(Void.class, 0, 0x01234567); + }); + checkWMTE(() -> { // value reference class + int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + int x = (int) hs.get(am, methodType(int.class, int.class, int.class, int.class)). + invokeExact(0, 0, 0x01234567); + }); + checkWMTE(() -> { // index reference class + int x = (int) hs.get(am, methodType(int.class, int[].class, Class.class, int.class)). + invokeExact(array, Void.class, 0x01234567); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, int[].class, int.class, int.class)). + invokeExact(array, 0, 0x01234567); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, int[].class, int.class, int.class)). + invokeExact(array, 0, 0x01234567); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + int x = (int) hs.get(am, methodType(int.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + int x = (int) hs.get(am, methodType(int.class, int[].class, int.class, int.class, Class.class)). + invokeExact(array, 0, 0x01234567, Void.class); + }); + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeLong.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -353,6 +353,32 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, 0x0123456789ABCDEFL, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); }); checkCCE(() -> { // receiver reference class @@ -376,32 +402,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, 0x0123456789ABCDEFL); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, 0x0123456789ABCDEFL, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ long x = (long) vh.getAndSet(recv, 0x0123456789ABCDEFL, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndSetAcquire(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndSetAcquire(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndSetAcquire(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndSetAcquire(recv, 0x0123456789ABCDEFL, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndSetRelease(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndSetRelease(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndSetRelease(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndSetRelease(recv, 0x0123456789ABCDEFL, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,34 +669,331 @@ long x = (long) vh.getAndAdd(recv, 0x0123456789ABCDEFL, Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - long x = (long) vh.addAndGet(null, 0x0123456789ABCDEFL); + long x = (long) vh.getAndAddAcquire(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndAddAcquire(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndAddAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndAddAcquire(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndAddAcquire(recv, 0x0123456789ABCDEFL, Void.class); + }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndAddRelease(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndAddRelease(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndAddRelease(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndAddRelease(recv, 0x0123456789ABCDEFL, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseOr(null, 0x0123456789ABCDEFL); }); checkCCE(() -> { // receiver reference class - long x = (long) vh.addAndGet(Void.class, 0x0123456789ABCDEFL); + long x = (long) vh.getAndBitwiseOr(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseOr(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseOrAcquire(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseOrAcquire(Void.class, 0x0123456789ABCDEFL); }); checkWMTE(() -> { // value reference class - long x = (long) vh.addAndGet(recv, Void.class); + long x = (long) vh.getAndBitwiseOrAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - long x = (long) vh.addAndGet(0, 0x0123456789ABCDEFL); + long x = (long) vh.getAndBitwiseOrAcquire(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOrAcquire(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseOrRelease(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseOr(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseOr(0, 0x0123456789ABCDEFL); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, 0x0123456789ABCDEFL); + Void r = (Void) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, 0x0123456789ABCDEFL); + boolean x = (boolean) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOr(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseAnd(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseAnd(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseAnd(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseAndAcquire(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseAndAcquire(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseAndAcquire(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, 0x0123456789ABCDEFL); }); // Incorrect arity checkWMTE(() -> { // 0 - long x = (long) vh.addAndGet(); + long x = (long) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAndAcquire(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseAndRelease(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseAnd(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseAnd(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAnd(); }); checkWMTE(() -> { // > - long x = (long) vh.addAndGet(recv, 0x0123456789ABCDEFL, Void.class); + long x = (long) vh.getAndBitwiseAnd(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseXor(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseXor(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseXor(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseXorAcquire(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseXorAcquire(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseXorAcquire(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXorAcquire(recv, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + long x = (long) vh.getAndBitwiseXorRelease(null, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + long x = (long) vh.getAndBitwiseXor(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) vh.getAndBitwiseXor(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXor(recv, 0x0123456789ABCDEFL, Void.class); }); } @@ -853,6 +1208,43 @@ invokeExact(recv, 0x0123456789ABCDEFL, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)). + invokeExact((VarHandleTestMethodTypeLong) null, 0x0123456789ABCDEFL); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + long x = (long) hs.get(am, methodType(long.class, Class.class, long.class)). + invokeExact(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + long x = (long) hs.get(am, methodType(long.class, int.class, long.class)). + invokeExact(0, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeLong.class, long.class)). + invokeExact(recv, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeLong.class, long.class)). + invokeExact(recv, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) hs.get(am, methodType(long.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + long x = (long) hs.get(am, methodType(long.class, VarHandleTestMethodTypeLong.class, long.class)). + invokeExact(recv, 0x0123456789ABCDEFL, Void.class); + }); + } } @@ -986,6 +1378,23 @@ // WeakCompareAndSet // Incorrect argument types checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(0x0123456789ABCDEFL, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(0x0123456789ABCDEFL, 0x0123456789ABCDEFL, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, 0x0123456789ABCDEFL); }); checkWMTE(() -> { // actual reference class @@ -1000,23 +1409,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0x0123456789ABCDEFL); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(0x0123456789ABCDEFL, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(0x0123456789ABCDEFL, 0x0123456789ABCDEFL, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1535,48 @@ long x = (long) vh.getAndSet(0x0123456789ABCDEFL, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndSetAcquire(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndSetRelease(0x0123456789ABCDEFL, Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,24 +1598,233 @@ }); - // AddAndGet + // GetAndAddAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndAddAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndAddAcquire(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndAddRelease(0x0123456789ABCDEFL, Void.class); + }); + + // GetAndBitwiseOr // Incorrect argument types checkWMTE(() -> { // value reference class - long x = (long) vh.addAndGet(Void.class); + long x = (long) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOr(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOrAcquire(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOrRelease(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAnd(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(0x0123456789ABCDEFL); + Void r = (Void) vh.getAndBitwiseAnd(0x0123456789ABCDEFL); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(0x0123456789ABCDEFL); + boolean x = (boolean) vh.getAndBitwiseAnd(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAnd(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAndAcquire(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(0x0123456789ABCDEFL); }); // Incorrect arity checkWMTE(() -> { // 0 - long x = (long) vh.addAndGet(); + long x = (long) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAndRelease(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXor(); }); checkWMTE(() -> { // > - long x = (long) vh.addAndGet(0x0123456789ABCDEFL, Void.class); + long x = (long) vh.getAndBitwiseXor(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXorAcquire(0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXorRelease(0x0123456789ABCDEFL, Void.class); }); } @@ -1322,6 +1965,32 @@ invokeExact(0x0123456789ABCDEFL, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkWMTE(() -> { // value reference class + long x = (long) hs.get(am, methodType(long.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, long.class)). + invokeExact(0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, long.class)). + invokeExact(0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) hs.get(am, methodType(long.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + long x = (long) hs.get(am, methodType(long.class, long.class, Class.class)). + invokeExact(0x0123456789ABCDEFL, Void.class); + }); + } } @@ -1585,6 +2254,35 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); }); checkCCE(() -> { // receiver reference class @@ -1611,35 +2309,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, 0x0123456789ABCDEFL); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, 0x0123456789ABCDEFL, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, 0x0123456789ABCDEFL, 0x0123456789ABCDEFL, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +2507,72 @@ long x = (long) vh.getAndSet(array, 0, 0x0123456789ABCDEFL, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndSetAcquire(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndSetAcquire(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + long x = (long) vh.getAndSetAcquire(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndSetAcquire(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndSetAcquire(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndSetRelease(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndSetRelease(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + long x = (long) vh.getAndSetRelease(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndSetRelease(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndSetRelease(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,36 +2606,365 @@ }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - long x = (long) vh.addAndGet(null, 0, 0x0123456789ABCDEFL); + long x = (long) vh.getAndAddAcquire(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndAddAcquire(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndAddAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndAddAcquire(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndAddAcquire(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndAddAcquire(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndAddRelease(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndAddRelease(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndAddRelease(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndAddRelease(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndAddRelease(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseOr(null, 0, 0x0123456789ABCDEFL); }); checkCCE(() -> { // array reference class - long x = (long) vh.addAndGet(Void.class, 0, 0x0123456789ABCDEFL); + long x = (long) vh.getAndBitwiseOr(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseOr(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseOr(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOr(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseOrAcquire(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseOrAcquire(Void.class, 0, 0x0123456789ABCDEFL); }); checkWMTE(() -> { // value reference class - long x = (long) vh.addAndGet(array, 0, Void.class); + long x = (long) vh.getAndBitwiseOrAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - long x = (long) vh.addAndGet(0, 0, 0x0123456789ABCDEFL); + long x = (long) vh.getAndBitwiseOrAcquire(0, 0, 0x0123456789ABCDEFL); }); checkWMTE(() -> { // index reference class - long x = (long) vh.addAndGet(array, Void.class, 0x0123456789ABCDEFL); + long x = (long) vh.getAndBitwiseOrAcquire(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOrAcquire(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseOrRelease(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseOrRelease(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseOrRelease(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseOrRelease(array, Void.class, 0x0123456789ABCDEFL); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, 0x0123456789ABCDEFL); + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, 0x0123456789ABCDEFL); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, 0x0123456789ABCDEFL); + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseOrRelease(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseAnd(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseAnd(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseAnd(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseAnd(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAnd(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseAndAcquire(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseAndAcquire(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseAndAcquire(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseAndAcquire(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, 0x0123456789ABCDEFL); }); // Incorrect arity checkWMTE(() -> { // 0 - long x = (long) vh.addAndGet(); + long x = (long) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseAndAcquire(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseAndRelease(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseAndRelease(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseAndRelease(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseAndRelease(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseAndRelease(); }); checkWMTE(() -> { // > - long x = (long) vh.addAndGet(array, 0, 0x0123456789ABCDEFL, Void.class); + long x = (long) vh.getAndBitwiseAndRelease(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseXor(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseXor(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseXor(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseXor(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXor(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseXorAcquire(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseXorAcquire(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseXorAcquire(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseXorAcquire(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXorAcquire(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) vh.getAndBitwiseXorRelease(null, 0, 0x0123456789ABCDEFL); + }); + checkCCE(() -> { // array reference class + long x = (long) vh.getAndBitwiseXorRelease(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) vh.getAndBitwiseXorRelease(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) vh.getAndBitwiseXorRelease(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + long x = (long) vh.getAndBitwiseXorRelease(array, 0, 0x0123456789ABCDEFL, Void.class); }); } @@ -2144,6 +3208,48 @@ invokeExact(array, 0, 0x0123456789ABCDEFL, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class)). + invokeExact((long[]) null, 0, 0x0123456789ABCDEFL); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + long x = (long) hs.get(am, methodType(long.class, Class.class, int.class, long.class)). + invokeExact(Void.class, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // value reference class + long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + long x = (long) hs.get(am, methodType(long.class, int.class, int.class, long.class)). + invokeExact(0, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // index reference class + long x = (long) hs.get(am, methodType(long.class, long[].class, Class.class, long.class)). + invokeExact(array, Void.class, 0x0123456789ABCDEFL); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, long[].class, int.class, long.class)). + invokeExact(array, 0, 0x0123456789ABCDEFL); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, long[].class, int.class, long.class)). + invokeExact(array, 0, 0x0123456789ABCDEFL); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + long x = (long) hs.get(am, methodType(long.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + long x = (long) hs.get(am, methodType(long.class, long[].class, int.class, long.class, Class.class)). + invokeExact(array, 0, 0x0123456789ABCDEFL, Void.class); + }); + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeShort.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -353,6 +353,32 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, (short)0x0123, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, (short)0x0123, (short)0x0123); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, (short)0x0123); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, (short)0x0123, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, (short)0x0123, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, (short)0x0123, (short)0x0123, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, (short)0x0123, (short)0x0123); }); checkCCE(() -> { // receiver reference class @@ -376,32 +402,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, (short)0x0123, (short)0x0123); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, (short)0x0123, (short)0x0123); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, (short)0x0123); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, (short)0x0123, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, (short)0x0123, (short)0x0123); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, (short)0x0123, (short)0x0123, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ short x = (short) vh.getAndSet(recv, (short)0x0123, Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndSetAcquire(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndSetAcquire(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndSetAcquire(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndSetAcquire(recv, (short)0x0123, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndSetRelease(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndSetRelease(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndSetRelease(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndSetRelease(recv, (short)0x0123, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null receiver @@ -611,34 +669,331 @@ short x = (short) vh.getAndAdd(recv, (short)0x0123, Void.class); }); - - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null receiver - short x = (short) vh.addAndGet(null, (short)0x0123); + short x = (short) vh.getAndAddAcquire(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndAddAcquire(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndAddAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndAddAcquire(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndAddAcquire(recv, (short)0x0123, Void.class); + }); + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndAddRelease(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndAddRelease(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndAddRelease(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndAddRelease(recv, (short)0x0123, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseOr(null, (short)0x0123); }); checkCCE(() -> { // receiver reference class - short x = (short) vh.addAndGet(Void.class, (short)0x0123); + short x = (short) vh.getAndBitwiseOr(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseOr(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOr(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseOrAcquire(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseOrAcquire(Void.class, (short)0x0123); }); checkWMTE(() -> { // value reference class - short x = (short) vh.addAndGet(recv, Void.class); + short x = (short) vh.getAndBitwiseOrAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - short x = (short) vh.addAndGet(0, (short)0x0123); + short x = (short) vh.getAndBitwiseOrAcquire(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOrAcquire(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseOrRelease(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseOr(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseOr(0, (short)0x0123); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, (short)0x0123); + Void r = (Void) vh.getAndBitwiseOr(recv, (short)0x0123); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(recv, (short)0x0123); + boolean x = (boolean) vh.getAndBitwiseOr(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOr(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseAnd(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseAnd(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseAnd(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAnd(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseAndAcquire(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseAndAcquire(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseAndAcquire(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(recv, (short)0x0123); }); // Incorrect arity checkWMTE(() -> { // 0 - short x = (short) vh.addAndGet(); + short x = (short) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAndAcquire(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseAndRelease(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseAnd(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseAnd(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAnd(); }); checkWMTE(() -> { // > - short x = (short) vh.addAndGet(recv, (short)0x0123, Void.class); + short x = (short) vh.getAndBitwiseAnd(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseXor(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseXor(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseXor(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXor(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseXorAcquire(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseXorAcquire(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseXorAcquire(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXorAcquire(recv, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + short x = (short) vh.getAndBitwiseXorRelease(null, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + short x = (short) vh.getAndBitwiseXor(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) vh.getAndBitwiseXor(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXor(recv, (short)0x0123, Void.class); }); } @@ -853,6 +1208,43 @@ invokeExact(recv, (short)0x0123, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class)). + invokeExact((VarHandleTestMethodTypeShort) null, (short)0x0123); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + short x = (short) hs.get(am, methodType(short.class, Class.class, short.class)). + invokeExact(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + short x = (short) hs.get(am, methodType(short.class, int.class, short.class)). + invokeExact(0, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodTypeShort.class, short.class)). + invokeExact(recv, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, VarHandleTestMethodTypeShort.class, short.class)). + invokeExact(recv, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) hs.get(am, methodType(short.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + short x = (short) hs.get(am, methodType(short.class, VarHandleTestMethodTypeShort.class, short.class)). + invokeExact(recv, (short)0x0123, Void.class); + }); + } } @@ -986,6 +1378,23 @@ // WeakCompareAndSet // Incorrect argument types checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, (short)0x0123); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain((short)0x0123, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain((short)0x0123, (short)0x0123, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkWMTE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, (short)0x0123); }); checkWMTE(() -> { // actual reference class @@ -1000,23 +1409,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, (short)0x0123); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile((short)0x0123, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile((short)0x0123, (short)0x0123, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkWMTE(() -> { // expected reference class @@ -1143,6 +1535,48 @@ short x = (short) vh.getAndSet((short)0x0123, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndSetAcquire((short)0x0123, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndSetRelease((short)0x0123, Void.class); + }); + // GetAndAdd // Incorrect argument types checkWMTE(() -> { // value reference class @@ -1164,24 +1598,233 @@ }); - // AddAndGet + // GetAndAddAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndAddAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndAddAcquire((short)0x0123, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndAddRelease((short)0x0123, Void.class); + }); + + // GetAndBitwiseOr // Incorrect argument types checkWMTE(() -> { // value reference class - short x = (short) vh.addAndGet(Void.class); + short x = (short) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOr((short)0x0123, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOrAcquire((short)0x0123, Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrRelease((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOrRelease((short)0x0123, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAnd(Void.class); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet((short)0x0123); + Void r = (Void) vh.getAndBitwiseAnd((short)0x0123); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet((short)0x0123); + boolean x = (boolean) vh.getAndBitwiseAnd((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAnd((short)0x0123, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAndAcquire((short)0x0123, Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease((short)0x0123); }); // Incorrect arity checkWMTE(() -> { // 0 - short x = (short) vh.addAndGet(); + short x = (short) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAndRelease((short)0x0123, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXor(); }); checkWMTE(() -> { // > - short x = (short) vh.addAndGet((short)0x0123, Void.class); + short x = (short) vh.getAndBitwiseXor((short)0x0123, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXorAcquire((short)0x0123, Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXorRelease((short)0x0123, Void.class); }); } @@ -1322,6 +1965,32 @@ invokeExact((short)0x0123, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkWMTE(() -> { // value reference class + short x = (short) hs.get(am, methodType(short.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, short.class)). + invokeExact((short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, short.class)). + invokeExact((short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) hs.get(am, methodType(short.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + short x = (short) hs.get(am, methodType(short.class, short.class, Class.class)). + invokeExact((short)0x0123, Void.class); + }); + } } @@ -1585,6 +2254,35 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, (short)0x0123, (short)0x0123); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, (short)0x0123, (short)0x0123); + }); + checkWMTE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, (short)0x0123); + }); + checkWMTE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, (short)0x0123, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, (short)0x0123, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, (short)0x0123, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, (short)0x0123, (short)0x0123, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, (short)0x0123, (short)0x0123); }); checkCCE(() -> { // receiver reference class @@ -1611,35 +2309,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, (short)0x0123, (short)0x0123); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, (short)0x0123, (short)0x0123); - }); - checkWMTE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, (short)0x0123); - }); - checkWMTE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, (short)0x0123, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, (short)0x0123, (short)0x0123); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, (short)0x0123, (short)0x0123); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, (short)0x0123, (short)0x0123, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1838,6 +2507,72 @@ short x = (short) vh.getAndSet(array, 0, (short)0x0123, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndSetAcquire(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndSetAcquire(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + short x = (short) vh.getAndSetAcquire(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndSetAcquire(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndSetAcquire(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndSetRelease(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndSetRelease(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + short x = (short) vh.getAndSetRelease(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndSetRelease(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndSetRelease(array, 0, (short)0x0123, Void.class); + }); + // GetAndAdd // Incorrect argument types checkNPE(() -> { // null array @@ -1871,36 +2606,365 @@ }); - // AddAndGet + // GetAndAddAcquire // Incorrect argument types checkNPE(() -> { // null array - short x = (short) vh.addAndGet(null, 0, (short)0x0123); + short x = (short) vh.getAndAddAcquire(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndAddAcquire(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndAddAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndAddAcquire(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndAddAcquire(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddAcquire(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndAddAcquire(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndAddRelease(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndAddRelease(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndAddRelease(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndAddRelease(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndAddRelease(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndAddRelease(array, 0, (short)0x0123, Void.class); + }); + + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseOr(null, 0, (short)0x0123); }); checkCCE(() -> { // array reference class - short x = (short) vh.addAndGet(Void.class, 0, (short)0x0123); + short x = (short) vh.getAndBitwiseOr(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseOr(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseOr(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOr(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOr(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseOrAcquire(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseOrAcquire(Void.class, 0, (short)0x0123); }); checkWMTE(() -> { // value reference class - short x = (short) vh.addAndGet(array, 0, Void.class); + short x = (short) vh.getAndBitwiseOrAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - short x = (short) vh.addAndGet(0, 0, (short)0x0123); + short x = (short) vh.getAndBitwiseOrAcquire(0, 0, (short)0x0123); }); checkWMTE(() -> { // index reference class - short x = (short) vh.addAndGet(array, Void.class, (short)0x0123); + short x = (short) vh.getAndBitwiseOrAcquire(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseOrAcquire(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOrAcquire(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseOrRelease(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseOrRelease(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseOrRelease(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseOrRelease(array, Void.class, (short)0x0123); }); // Incorrect return type checkWMTE(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, (short)0x0123); + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, (short)0x0123); }); checkWMTE(() -> { // primitive class - boolean x = (boolean) vh.addAndGet(array, 0, (short)0x0123); + boolean x = (boolean) vh.getAndBitwiseOrRelease(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseOrRelease(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseAnd(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseAnd(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseAnd(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseAnd(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAnd(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAnd(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseAndAcquire(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseAndAcquire(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseAndAcquire(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseAndAcquire(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndAcquire(array, 0, (short)0x0123); }); // Incorrect arity checkWMTE(() -> { // 0 - short x = (short) vh.addAndGet(); + short x = (short) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseAndAcquire(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseAndRelease(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseAndRelease(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseAndRelease(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseAndRelease(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseAndRelease(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseAndRelease(); }); checkWMTE(() -> { // > - short x = (short) vh.addAndGet(array, 0, (short)0x0123, Void.class); + short x = (short) vh.getAndBitwiseAndRelease(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseXor(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseXor(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseXor(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseXor(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXor(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXor(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseXorAcquire(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseXorAcquire(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseXorAcquire(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseXorAcquire(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorAcquire(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXorAcquire(array, 0, (short)0x0123, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) vh.getAndBitwiseXorRelease(null, 0, (short)0x0123); + }); + checkCCE(() -> { // array reference class + short x = (short) vh.getAndBitwiseXorRelease(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) vh.getAndBitwiseXorRelease(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) vh.getAndBitwiseXorRelease(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndBitwiseXorRelease(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + short x = (short) vh.getAndBitwiseXorRelease(array, 0, (short)0x0123, Void.class); }); } @@ -2144,6 +3208,48 @@ invokeExact(array, 0, (short)0x0123, Void.class); }); } + + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class)). + invokeExact((short[]) null, 0, (short)0x0123); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + short x = (short) hs.get(am, methodType(short.class, Class.class, int.class, short.class)). + invokeExact(Void.class, 0, (short)0x0123); + }); + checkWMTE(() -> { // value reference class + short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + short x = (short) hs.get(am, methodType(short.class, int.class, int.class, short.class)). + invokeExact(0, 0, (short)0x0123); + }); + checkWMTE(() -> { // index reference class + short x = (short) hs.get(am, methodType(short.class, short[].class, Class.class, short.class)). + invokeExact(array, Void.class, (short)0x0123); + }); + // Incorrect return type + checkWMTE(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, short[].class, int.class, short.class)). + invokeExact(array, 0, (short)0x0123); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) hs.get(am, methodType(boolean.class, short[].class, int.class, short.class)). + invokeExact(array, 0, (short)0x0123); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + short x = (short) hs.get(am, methodType(short.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + short x = (short) hs.get(am, methodType(short.class, short[].class, int.class, short.class, Class.class)). + invokeExact(array, 0, (short)0x0123, Void.class); + }); + } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java --- a/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/VarHandleTestMethodTypeString.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -353,6 +353,32 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, "foo", "foo"); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, "foo", "foo"); + }); + checkCCE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, "foo"); + }); + checkCCE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, "foo", Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, "foo", "foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, "foo", "foo", Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, "foo", "foo"); }); checkCCE(() -> { // receiver reference class @@ -376,32 +402,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, "foo", "foo"); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, "foo", "foo"); - }); - checkCCE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, "foo"); - }); - checkCCE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, "foo", Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, "foo", "foo"); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, "foo", "foo", Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,65 @@ String x = (String) vh.getAndSet(recv, "foo", Void.class); }); + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + String x = (String) vh.getAndSetAcquire(null, "foo"); + }); + checkCCE(() -> { // receiver reference class + String x = (String) vh.getAndSetAcquire(Void.class, "foo"); + }); + checkCCE(() -> { // value reference class + String x = (String) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + String x = (String) vh.getAndSetAcquire(0, "foo"); + }); + // Incorrect return type + checkCCE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, "foo"); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(recv, "foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + String x = (String) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + String x = (String) vh.getAndSetAcquire(recv, "foo", Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + String x = (String) vh.getAndSetRelease(null, "foo"); + }); + checkCCE(() -> { // receiver reference class + String x = (String) vh.getAndSetRelease(Void.class, "foo"); + }); + checkCCE(() -> { // value reference class + String x = (String) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + String x = (String) vh.getAndSetRelease(0, "foo"); + }); + // Incorrect return type + checkCCE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, "foo"); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(recv, "foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + String x = (String) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + String x = (String) vh.getAndSetRelease(recv, "foo", Void.class); + }); + + } static void testInstanceFieldWrongMethodType(VarHandleTestMethodTypeString recv, Handles hs) throws Throwable { @@ -759,6 +818,7 @@ }); } + } @@ -892,6 +952,23 @@ // WeakCompareAndSet // Incorrect argument types checkCCE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, "foo"); + }); + checkCCE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain("foo", Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain("foo", "foo", Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkCCE(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, "foo"); }); checkCCE(() -> { // actual reference class @@ -906,23 +983,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkCCE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, "foo"); - }); - checkCCE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile("foo", Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile("foo", "foo", Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkCCE(() -> { // expected reference class @@ -1049,6 +1109,49 @@ String x = (String) vh.getAndSet("foo", Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkCCE(() -> { // value reference class + String x = (String) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + checkCCE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire("foo"); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire("foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + String x = (String) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + String x = (String) vh.getAndSetAcquire("foo", Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkCCE(() -> { // value reference class + String x = (String) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + checkCCE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease("foo"); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease("foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + String x = (String) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + String x = (String) vh.getAndSetRelease("foo", Void.class); + }); + + } static void testStaticFieldWrongMethodType(Handles hs) throws Throwable { @@ -1163,6 +1266,7 @@ }); } + } @@ -1426,6 +1530,35 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, "foo", "foo"); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, "foo", "foo"); + }); + checkCCE(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, "foo"); + }); + checkCCE(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, "foo", Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, "foo", "foo"); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, "foo", "foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, "foo", "foo", Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, "foo", "foo"); }); checkCCE(() -> { // receiver reference class @@ -1452,35 +1585,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, "foo", "foo"); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, "foo", "foo"); - }); - checkCCE(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, "foo"); - }); - checkCCE(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, "foo", Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, "foo", "foo"); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, "foo", "foo"); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, "foo", "foo", Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1679,6 +1783,73 @@ String x = (String) vh.getAndSet(array, 0, "foo", Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + String x = (String) vh.getAndSetAcquire(null, 0, "foo"); + }); + checkCCE(() -> { // array reference class + String x = (String) vh.getAndSetAcquire(Void.class, 0, "foo"); + }); + checkCCE(() -> { // value reference class + String x = (String) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + String x = (String) vh.getAndSetAcquire(0, 0, "foo"); + }); + checkWMTE(() -> { // index reference class + String x = (String) vh.getAndSetAcquire(array, Void.class, "foo"); + }); + // Incorrect return type + checkCCE(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, "foo"); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetAcquire(array, 0, "foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + String x = (String) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + String x = (String) vh.getAndSetAcquire(array, 0, "foo", Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + String x = (String) vh.getAndSetRelease(null, 0, "foo"); + }); + checkCCE(() -> { // array reference class + String x = (String) vh.getAndSetRelease(Void.class, 0, "foo"); + }); + checkCCE(() -> { // value reference class + String x = (String) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + String x = (String) vh.getAndSetRelease(0, 0, "foo"); + }); + checkWMTE(() -> { // index reference class + String x = (String) vh.getAndSetRelease(array, Void.class, "foo"); + }); + // Incorrect return type + checkCCE(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, "foo"); + }); + checkWMTE(() -> { // primitive class + boolean x = (boolean) vh.getAndSetRelease(array, 0, "foo"); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + String x = (String) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + String x = (String) vh.getAndSetRelease(array, 0, "foo", Void.class); + }); + + } static void testArrayWrongMethodType(Handles hs) throws Throwable { @@ -1880,6 +2051,7 @@ }); } + } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template --- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestAccess.java.template Fri Sep 02 02:41:37 2016 +0000 @@ -104,30 +104,58 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); #else[CAS] assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); #end[CAS] #if[AtomicAdd] assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); #else[AtomicAdd] assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); #end[AtomicAdd] + +#if[Bitwise] + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); +#else[Bitwise] + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); +#end[Bitwise] } @@ -295,11 +323,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(recv, $value1$, $value2$); + boolean r = vh.weakCompareAndSetPlain(recv, $value1$, $value2$); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(recv, $value1$, $value2$); + boolean r = vh.weakCompareAndSet(recv, $value1$, $value2$); }); checkUOE(() -> { @@ -313,6 +341,14 @@ checkUOE(() -> { $type$ r = ($type$) vh.getAndSet(recv, $value1$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetRelease(recv, $value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -321,9 +357,51 @@ }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet(recv, $value1$); + $type$ o = ($type$) vh.getAndAddAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(recv, $value1$); }); #end[AtomicAdd] + +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(recv, $value1$); + }); +#end[Bitwise] } @@ -389,11 +467,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet($value1$, $value2$); + boolean r = vh.weakCompareAndSetPlain($value1$, $value2$); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile($value1$, $value2$); + boolean r = vh.weakCompareAndSet($value1$, $value2$); }); checkUOE(() -> { @@ -407,6 +485,14 @@ checkUOE(() -> { $type$ r = ($type$) vh.getAndSet($value1$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetAcquire($value1$); + }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetRelease($value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -415,9 +501,51 @@ }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet($value1$); + $type$ o = ($type$) vh.getAndAddAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease($value1$); }); #end[AtomicAdd] + +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease($value1$); + }); +#end[Bitwise] } @@ -514,11 +642,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(recv, $value1$, $value2$); + success = vh.weakCompareAndSetPlain(recv, $value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(recv); - assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); + assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value"); } { @@ -544,33 +672,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(recv, $value2$, $value1$); + success = vh.weakCompareAndSet(recv, $value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSetVolatile $type$"); + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(recv); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$ value"); + assertEquals(x, $value1$, "weakCompareAndSet $type$ value"); } // Compare set and get { + vh.set(recv, $value1$); + $type$ o = ($type$) vh.getAndSet(recv, $value2$); assertEquals(o, $value1$, "getAndSet $type$"); $type$ x = ($type$) vh.get(recv); assertEquals(x, $value2$, "getAndSet $type$ value"); } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndSetAcquire(recv, $value2$); + assertEquals(o, $value1$, "getAndSetAcquire $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, $value2$, "getAndSetAcquire $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndSetRelease(recv, $value2$); + assertEquals(o, $value1$, "getAndSetRelease $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, $value2$, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - vh.set(recv, $value1$); - // get and add, add and get { - $type$ o = ($type$) vh.getAndAdd(recv, $value3$); + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndAdd(recv, $value2$); assertEquals(o, $value1$, "getAndAdd $type$"); - $type$ c = ($type$) vh.addAndGet(recv, $value3$); - assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndAddAcquire(recv, $value2$); + assertEquals(o, $value1$, "getAndAddAcquire $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndAddRelease(recv, $value2$); + assertEquals(o, $value1$, "getAndAddRelease$type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseOr(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOr $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseOrRelease(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseAnd(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseAndRelease(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseXor(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXor $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value"); + } + + { + vh.set(recv, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseXorRelease(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) vh.get(recv); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } static void testInstanceFieldUnsupported(VarHandleTestAccess$Type$ recv, VarHandle vh) { @@ -592,11 +844,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(recv, $value1$, $value2$); + boolean r = vh.weakCompareAndSetPlain(recv, $value1$, $value2$); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(recv, $value1$, $value2$); + boolean r = vh.weakCompareAndSet(recv, $value1$, $value2$); }); checkUOE(() -> { @@ -610,6 +862,14 @@ checkUOE(() -> { $type$ r = ($type$) vh.getAndSet(recv, $value1$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetRelease(recv, $value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -618,9 +878,51 @@ }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet(recv, $value1$); + $type$ o = ($type$) vh.getAndAddAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(recv, $value1$); }); #end[AtomicAdd] + +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(recv, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(recv, $value1$); + }); +#end[Bitwise] } @@ -717,11 +1019,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet($value1$, $value2$); + success = vh.weakCompareAndSetPlain($value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(); - assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); + assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value"); } { @@ -747,33 +1049,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetRelease($value2$, $value1$); + success = vh.weakCompareAndSet($value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSetVolatile $type$"); + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); + assertEquals(x, $value1$, "weakCompareAndSet $type$"); } // Compare set and get { + vh.set($value1$); + $type$ o = ($type$) vh.getAndSet($value2$); assertEquals(o, $value1$, "getAndSet $type$"); $type$ x = ($type$) vh.get(); assertEquals(x, $value2$, "getAndSet $type$ value"); } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndSetAcquire($value2$); + assertEquals(o, $value1$, "getAndSetAcquire $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, $value2$, "getAndSetAcquire $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndSetRelease($value2$); + assertEquals(o, $value1$, "getAndSetRelease $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, $value2$, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - vh.set($value1$); - // get and add, add and get { - $type$ o = ($type$) vh.getAndAdd( $value3$); + vh.set($value1$); + + $type$ o = ($type$) vh.getAndAdd($value2$); assertEquals(o, $value1$, "getAndAdd $type$"); - $type$ c = ($type$) vh.addAndGet($value3$); - assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndAddAcquire($value2$); + assertEquals(o, $value1$, "getAndAddAcquire $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndAddRelease($value2$); + assertEquals(o, $value1$, "getAndAddRelease$type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseOr($value2$); + assertEquals(o, $value1$, "getAndBitwiseOr $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseOrAcquire($value2$); + assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseOrRelease($value2$); + assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseAnd($value2$); + assertEquals(o, $value1$, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseAndAcquire($value2$); + assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseAndRelease($value2$); + assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseXor($value2$); + assertEquals(o, $value1$, "getAndBitwiseXor $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseXorAcquire($value2$); + assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value"); + } + + { + vh.set($value1$); + + $type$ o = ($type$) vh.getAndBitwiseXorRelease($value2$); + assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) vh.get(); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } static void testStaticFieldUnsupported(VarHandle vh) { @@ -795,11 +1221,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet($value1$, $value2$); + boolean r = vh.weakCompareAndSetPlain($value1$, $value2$); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile($value1$, $value2$); + boolean r = vh.weakCompareAndSet($value1$, $value2$); }); checkUOE(() -> { @@ -813,6 +1239,14 @@ checkUOE(() -> { $type$ r = ($type$) vh.getAndSet($value1$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetAcquire($value1$); + }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetRelease($value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -821,9 +1255,51 @@ }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet($value1$); + $type$ o = ($type$) vh.getAndAddAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease($value1$); }); #end[AtomicAdd] + +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire($value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease($value1$); + }); +#end[Bitwise] } @@ -923,11 +1399,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, $value1$, $value2$); + success = vh.weakCompareAndSetPlain(array, i, $value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(array, i); - assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); + assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value"); } { @@ -953,33 +1429,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSetVolatile(array, i, $value2$, $value1$); + success = vh.weakCompareAndSet(array, i, $value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSetVolatile $type$"); + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(array, i); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); + assertEquals(x, $value1$, "weakCompareAndSet $type$"); } // Compare set and get { + vh.set(array, i, $value1$); + $type$ o = ($type$) vh.getAndSet(array, i, $value2$); assertEquals(o, $value1$, "getAndSet $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, $value2$, "getAndSet $type$ value"); } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndSetAcquire(array, i, $value2$); + assertEquals(o, $value1$, "getAndSetAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, $value2$, "getAndSetAcquire $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndSetRelease(array, i, $value2$); + assertEquals(o, $value1$, "getAndSetRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, $value2$, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - vh.set(array, i, $value1$); - // get and add, add and get { - $type$ o = ($type$) vh.getAndAdd(array, i, $value3$); + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndAdd(array, i, $value2$); assertEquals(o, $value1$, "getAndAdd $type$"); - $type$ c = ($type$) vh.addAndGet(array, i, $value3$); - assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndAddAcquire(array, i, $value2$); + assertEquals(o, $value1$, "getAndAddAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndAddRelease(array, i, $value2$); + assertEquals(o, $value1$, "getAndAddRelease$type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseOr(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOr $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseAnd(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseXor(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXor $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value"); + } + + { + vh.set(array, i, $value1$); + + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } } @@ -1005,11 +1605,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, i, $value1$, $value2$); + boolean r = vh.weakCompareAndSetPlain(array, i, $value1$, $value2$); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, i, $value1$, $value2$); + boolean r = vh.weakCompareAndSet(array, i, $value1$, $value2$); }); checkUOE(() -> { @@ -1023,6 +1623,14 @@ checkUOE(() -> { $type$ r = ($type$) vh.getAndSet(array, i, $value1$); }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetAcquire(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ r = ($type$) vh.getAndSetRelease(array, i, $value1$); + }); #end[CAS] #if[!AtomicAdd] @@ -1031,9 +1639,51 @@ }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet(array, i, $value1$); + $type$ o = ($type$) vh.getAndAddAcquire(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, i, $value1$); }); #end[AtomicAdd] + +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, $value1$); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, $value1$); + }); +#end[Bitwise] } static void testArrayIndexOutOfBounds(VarHandle vh) throws Throwable { @@ -1092,11 +1742,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, $value1$, $value2$); + boolean r = vh.weakCompareAndSetPlain(array, ci, $value1$, $value2$); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, $value1$, $value2$); + boolean r = vh.weakCompareAndSet(array, ci, $value1$, $value2$); }); checkIOOBE(() -> { @@ -1110,17 +1760,67 @@ checkIOOBE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, $value1$); }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, $value1$); + }); #end[CAS] #if[AtomicAdd] checkIOOBE(() -> { - $type$ o = ($type$) vh.getAndAdd(array, ci, $value3$); + $type$ o = ($type$) vh.getAndAdd(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, $value1$); + }); +#end[AtomicAdd] + +#if[Bitwise] + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, $value1$); }); checkIOOBE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, $value3$); + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, $value1$); }); -#end[AtomicAdd] + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, $value1$); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, $value1$); + }); +#end[Bitwise] } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template --- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestByteArrayView.java.template Fri Sep 02 02:41:37 2016 +0000 @@ -93,30 +93,58 @@ assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); #else[CAS] assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_SET)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.COMPARE_AND_EXCHANGE_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_PLAIN)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_VOLATILE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_ACQUIRE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.WEAK_COMPARE_AND_SET_RELEASE)); assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_SET_RELEASE)); #end[CAS] #if[AtomicAdd] assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); #else[AtomicAdd] assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD)); - assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.ADD_AND_GET)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_ADD_RELEASE)); #end[AtomicAdd] + +#if[Bitwise] + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertTrue(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); +#else[Bitwise] + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_OR_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_AND_RELEASE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_ACQUIRE)); + assertFalse(vh.isAccessModeSupported(VarHandle.AccessMode.GET_AND_BITWISE_XOR_RELEASE)); +#end[Bitwise] } @Test(dataProvider = "typesProvider") @@ -219,11 +247,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -237,6 +265,14 @@ checkUOE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[!AtomicAdd] @@ -245,9 +281,51 @@ }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] + +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] } static void testArrayUnsupported(ByteBufferSource bs, VarHandleSource vhs) { @@ -293,11 +371,11 @@ }); checkROBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkROBE(() -> { @@ -312,6 +390,14 @@ $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + checkROBE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); + #else[CAS] checkUOE(() -> { boolean r = vh.compareAndSet(array, ci, VALUE_1, VALUE_2); @@ -330,11 +416,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -348,6 +434,14 @@ checkUOE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[AtomicAdd] @@ -356,7 +450,11 @@ }); checkROBE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #else[AtomicAdd] checkUOE(() -> { @@ -364,9 +462,87 @@ }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] + +#if[Bitwise] + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkROBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#else[Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] } else { #if[!CAS] @@ -387,11 +563,11 @@ }); checkUOE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkUOE(() -> { @@ -405,6 +581,14 @@ checkUOE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[!AtomicAdd] checkUOE(() -> { @@ -412,9 +596,50 @@ }); checkUOE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] +#if[!Bitwise] + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkUOE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] } } @@ -477,11 +702,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -495,6 +720,14 @@ checkIOOBE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[AtomicAdd] @@ -503,10 +736,52 @@ }); checkIOOBE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] +#if[Bitwise] + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] + } } @@ -573,11 +848,11 @@ }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkIOOBE(() -> { @@ -591,6 +866,14 @@ checkIOOBE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[AtomicAdd] @@ -599,9 +882,51 @@ }); checkIOOBE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] + +#if[Bitwise] + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkIOOBE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] } } } @@ -660,11 +985,11 @@ }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -678,6 +1003,14 @@ checkISE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[AtomicAdd] @@ -686,10 +1019,51 @@ }); checkISE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] +#if[Bitwise] + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] } } } @@ -750,11 +1124,11 @@ }); checkISE(() -> { - boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSetPlain(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { - boolean r = vh.weakCompareAndSetVolatile(array, ci, VALUE_1, VALUE_2); + boolean r = vh.weakCompareAndSet(array, ci, VALUE_1, VALUE_2); }); checkISE(() -> { @@ -768,6 +1142,14 @@ checkISE(() -> { $type$ o = ($type$) vh.getAndSet(array, ci, VALUE_1); }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndSetAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndSetRelease(array, ci, VALUE_1); + }); #end[CAS] #if[AtomicAdd] @@ -776,9 +1158,51 @@ }); checkISE(() -> { - $type$ o = ($type$) vh.addAndGet(array, ci, VALUE_1); + $type$ o = ($type$) vh.getAndAddAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndAddRelease(array, ci, VALUE_1); }); #end[AtomicAdd] + +#if[Bitwise] + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOr(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAnd(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXor(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, ci, VALUE_1); + }); + + checkISE(() -> { + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, ci, VALUE_1); + }); +#end[Bitwise] } } } @@ -888,11 +1312,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet $type$ value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain $type$ value"); } { @@ -916,32 +1340,159 @@ } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile $type$ value"); + assertEquals(x, VALUE_1, "weakCompareAndSet $type$"); } // Compare set and get { + vh.set(array, i, VALUE_1); + $type$ o = ($type$) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet $type$ value"); } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - vh.set(array, i, VALUE_1); - // get and add, add and get { - $type$ o = ($type$) vh.getAndAdd(array, i, VALUE_3); + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndAdd(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndAdd $type$"); - $type$ c = ($type$) vh.addAndGet(array, i, VALUE_3); - assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd $type$ value"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndAddAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndAddRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseOr(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOr $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseAnd(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseXor(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXor $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } } } @@ -1050,11 +1601,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = vh.weakCompareAndSet(array, i, VALUE_1, VALUE_2); + success = vh.weakCompareAndSetPlain(array, i, VALUE_1, VALUE_2); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) vh.get(array, i); - assertEquals(x, VALUE_2, "weakCompareAndSet $type$ value"); + assertEquals(x, VALUE_2, "weakCompareAndSetPlain $type$ value"); } { @@ -1078,32 +1629,159 @@ } { - boolean r = vh.weakCompareAndSetVolatile(array, i, VALUE_2, VALUE_1); - assertEquals(r, true, "weakCompareAndSetVolatile $type$"); + boolean success = false; + for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { + success = vh.weakCompareAndSet(array, i, VALUE_2, VALUE_1); + } + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) vh.get(array, i); - assertEquals(x, VALUE_1, "weakCompareAndSetVolatile $type$ value"); + assertEquals(x, VALUE_1, "weakCompareAndSet $type$"); } // Compare set and get { + vh.set(array, i, VALUE_1); + $type$ o = ($type$) vh.getAndSet(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndSet $type$"); $type$ x = ($type$) vh.get(array, i); assertEquals(x, VALUE_2, "getAndSet $type$ value"); } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndSetAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndSetRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndSetRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_2, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - vh.set(array, i, VALUE_1); - // get and add, add and get { - $type$ o = ($type$) vh.getAndAdd(array, i, VALUE_3); + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndAdd(array, i, VALUE_2); assertEquals(o, VALUE_1, "getAndAdd $type$"); - $type$ c = ($type$) vh.addAndGet(array, i, VALUE_3); - assertEquals(c, VALUE_1 + VALUE_3 + VALUE_3, "getAndAdd $type$ value"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAdd $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndAddAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndAddRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndAddRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 + VALUE_2, "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseOr(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOr $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOr $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseOrAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseOrRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 | VALUE_2, "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseAnd(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAnd $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseAndAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseAndRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 & VALUE_2, "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseXor(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXor $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXor $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseXorAcquire(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorAcquire $type$ value"); + } + + { + vh.set(array, i, VALUE_1); + + $type$ o = ($type$) vh.getAndBitwiseXorRelease(array, i, VALUE_2); + assertEquals(o, VALUE_1, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) vh.get(array, i); + assertEquals(x, VALUE_1 ^ VALUE_2, "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template --- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodHandleAccess.java.template Fri Sep 02 02:41:37 2016 +0000 @@ -211,11 +211,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, $value1$, $value2$); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(recv, $value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); + assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value"); } { @@ -241,11 +241,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(recv, $value2$, $value1$); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(recv, $value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSetVolatile $type$"); + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); + assertEquals(x, $value1$, "weakCompareAndSet $type$"); } // Compare set and get @@ -258,16 +258,120 @@ #end[CAS] #if[AtomicAdd] - hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); - // get and add, add and get { - $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, $value3$); + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(recv, $value2$); assertEquals(o, $value1$, "getAndAdd $type$"); - $type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(recv, $value3$); - assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndAddAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndAddRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOr $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXor $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(recv, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(recv, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(recv); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } static void testInstanceFieldUnsupported(VarHandleTestMethodHandleAccess$Type$ recv, Handles hs) throws Throwable { @@ -298,6 +402,14 @@ }); } #end[AtomicAdd] + +#if[!Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + $type$ r = ($type$) hs.get(am).invokeExact(recv, $value1$); + }); + } +#end[Bitwise] } @@ -394,11 +506,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact($value1$, $value2$); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact($value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); + assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value"); } { @@ -424,33 +536,159 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact($value2$, $value1$); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact($value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSetVolatile $type$"); + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); + assertEquals(x, $value1$, "weakCompareAndSet $type$"); } // Compare set and get { - $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact( $value2$); + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact($value2$); assertEquals(o, $value1$, "getAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); assertEquals(x, $value2$, "getAndSet $type$ value"); } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndSetAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, $value2$, "getAndSetAcquire $type$ value"); + } + + // Compare set and get + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndSetRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, $value2$, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - hs.get(TestAccessMode.SET).invokeExact($value1$); - // get and add, add and get { - $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact( $value3$); + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact($value2$); assertEquals(o, $value1$, "getAndAdd $type$"); - $type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact($value3$); - assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndAddAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndAddRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseOr $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseXor $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact($value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact($value2$); + assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } static void testStaticFieldUnsupported(Handles hs) throws Throwable { @@ -481,6 +719,14 @@ }); } #end[AtomicAdd] + +#if[!Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + $type$ r = ($type$) hs.get(am).invokeExact($value1$); + }); + } +#end[Bitwise] } @@ -580,11 +826,11 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, $value1$, $value2$); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_PLAIN).invokeExact(array, i, $value1$, $value2$); } - assertEquals(success, true, "weakCompareAndSet $type$"); + assertEquals(success, true, "weakCompareAndSetPlain $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, $value2$, "weakCompareAndSet $type$ value"); + assertEquals(x, $value2$, "weakCompareAndSetPlain $type$ value"); } { @@ -610,33 +856,157 @@ { boolean success = false; for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) { - success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET_VOLATILE).invokeExact(array, i, $value2$, $value1$); + success = (boolean) hs.get(TestAccessMode.WEAK_COMPARE_AND_SET).invokeExact(array, i, $value2$, $value1$); } - assertEquals(success, true, "weakCompareAndSetVolatile $type$"); + assertEquals(success, true, "weakCompareAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); - assertEquals(x, $value1$, "weakCompareAndSetVolatile $type$"); + assertEquals(x, $value1$, "weakCompareAndSet $type$"); } // Compare set and get { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET).invokeExact(array, i, $value2$); assertEquals(o, $value1$, "getAndSet $type$"); $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); assertEquals(x, $value2$, "getAndSet $type$ value"); } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_ACQUIRE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndSetAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, $value2$, "getAndSetAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_SET_RELEASE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndSetRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, $value2$, "getAndSetRelease $type$ value"); + } #end[CAS] #if[AtomicAdd] - hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); - // get and add, add and get { - $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, $value3$); + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD).invokeExact(array, i, $value2$); assertEquals(o, $value1$, "getAndAdd $type$"); - $type$ c = ($type$) hs.get(TestAccessMode.ADD_AND_GET).invokeExact(array, i, $value3$); - assertEquals(c, ($type$)($value1$ + $value3$ + $value3$), "getAndAdd $type$ value"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAdd $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_ACQUIRE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndAddAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_ADD_RELEASE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndAddRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ + $value2$), "getAndAddRelease $type$ value"); } #end[AtomicAdd] + +#if[Bitwise] + // get and bitwise or + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOr $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOr $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_ACQUIRE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_OR_RELEASE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseOrRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ | $value2$), "getAndBitwiseOrRelease $type$ value"); + } + + // get and bitwise and + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAnd $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAnd $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_ACQUIRE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_AND_RELEASE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseAndRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ & $value2$), "getAndBitwiseAndRelease $type$ value"); + } + + // get and bitwise xor + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXor $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXor $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_ACQUIRE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorAcquire $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorAcquire $type$ value"); + } + + { + hs.get(TestAccessMode.SET).invokeExact(array, i, $value1$); + + $type$ o = ($type$) hs.get(TestAccessMode.GET_AND_BITWISE_XOR_RELEASE).invokeExact(array, i, $value2$); + assertEquals(o, $value1$, "getAndBitwiseXorRelease $type$"); + $type$ x = ($type$) hs.get(TestAccessMode.GET).invokeExact(array, i); + assertEquals(x, ($type$)($value1$ ^ $value2$), "getAndBitwiseXorRelease $type$ value"); + } +#end[Bitwise] } } @@ -671,6 +1041,14 @@ }); } #end[AtomicAdd] + +#if[!Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkUOE(am, () -> { + $type$ o = ($type$) hs.get(am).invokeExact(array, i, $value1$); + }); + } +#end[Bitwise] } static void testArrayIndexOutOfBounds(Handles hs) throws Throwable { @@ -718,6 +1096,14 @@ }); } #end[AtomicAdd] + +#if[Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkIOOBE(am, () -> { + $type$ o = ($type$) hs.get(am).invokeExact(array, ci, $value3$); + }); + } +#end[Bitwise] } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template --- a/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/X-VarHandleTestMethodType.java.template Fri Sep 02 02:41:37 2016 +0000 @@ -354,6 +354,32 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, $value1$, $value1$); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, $value1$, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(recv, Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(recv, $value1$, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, $value1$, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(recv, $value1$, $value1$, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, $value1$, $value1$); }); checkCCE(() -> { // receiver reference class @@ -377,32 +403,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, $value1$, $value1$); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, $value1$, $value1$); - }); - check{#if[String]?CCE:WMTE}(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(recv, Void.class, $value1$); - }); - check{#if[String]?CCE:WMTE}(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(recv, $value1$, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, $value1$, $value1$); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(recv, $value1$, $value1$, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -582,6 +582,64 @@ checkWMTE(() -> { // > $type$ x = ($type$) vh.getAndSet(recv, $value1$, Void.class); }); + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndSetAcquire(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndSetAcquire(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndSetAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndSetAcquire(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetAcquire(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndSetAcquire(recv, $value1$, Void.class); + }); + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndSetRelease(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndSetRelease(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndSetRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndSetRelease(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetRelease(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndSetRelease(recv, $value1$, Void.class); + }); #end[CAS] #if[AtomicAdd] @@ -614,36 +672,335 @@ $type$ x = ($type$) vh.getAndAdd(recv, $value1$, Void.class); }); + // GetAndAddAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndAddAcquire(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndAddAcquire(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndAddAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndAddAcquire(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddAcquire(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndAddAcquire(recv, $value1$, Void.class); + }); - // AddAndGet + // GetAndAddRelease // Incorrect argument types checkNPE(() -> { // null receiver - $type$ x = ($type$) vh.addAndGet(null, $value1$); + $type$ x = ($type$) vh.getAndAddRelease(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndAddRelease(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndAddRelease(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndAddRelease(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddRelease(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndAddRelease(recv, $value1$, Void.class); + }); +#end[AtomicAdd] + +#if[Bitwise] + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseOr(null, $value1$); }); checkCCE(() -> { // receiver reference class - $type$ x = ($type$) vh.addAndGet(Void.class, $value1$); + $type$ x = ($type$) vh.getAndBitwiseOr(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseOr(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOr(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(Void.class, $value1$); }); check{#if[String]?CCE:WMTE}(() -> { // value reference class - $type$ x = ($type$) vh.addAndGet(recv, Void.class); + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(recv, Void.class); }); checkWMTE(() -> { // reciever primitive class - $type$ x = ($type$) vh.addAndGet(0, $value1$); + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrAcquire(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseOrRelease(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseOr(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOr(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseOr(0, $value1$); }); // Incorrect return type check{#if[String]?CCE:WMTE}(() -> { // reference class - Void r = (Void) vh.addAndGet(recv, $value1$); + Void r = (Void) vh.getAndBitwiseOr(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOr(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseAnd(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseAnd(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, $value1$); }); checkWMTE(() -> { // primitive class - $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.addAndGet(recv, $value1$); + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAnd(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndAcquire(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseAndRelease(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseAnd(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd(recv, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 - $type$ x = ($type$) vh.addAndGet(); + $type$ x = ($type$) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAnd(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseXor(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseXor(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseXor(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXor(); }); checkWMTE(() -> { // > - $type$ x = ($type$) vh.addAndGet(recv, $value1$, Void.class); - }); -#end[AtomicAdd] + $type$ x = ($type$) vh.getAndBitwiseXor(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorAcquire(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(recv, $value1$, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null receiver + $type$ x = ($type$) vh.getAndBitwiseXorRelease(null, $value1$); + }); + checkCCE(() -> { // receiver reference class + $type$ x = ($type$) vh.getAndBitwiseXor(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXor(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) vh.getAndBitwiseXor(0, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXor(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXor(recv, $value1$, Void.class); + }); +#end[Bitwise] } static void testInstanceFieldWrongMethodType(VarHandleTestMethodType$Type$ recv, Handles hs) throws Throwable { @@ -861,6 +1218,45 @@ }); } #end[AtomicAdd] + +#if[Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + checkNPE(() -> { // null receiver + $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). + invokeExact((VarHandleTestMethodType$Type$) null, $value1$); + }); + hs.checkWMTEOrCCE(() -> { // receiver reference class + $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, $type$.class)). + invokeExact(Void.class, $value1$); + }); + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class + $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, Class.class)). + invokeExact(recv, Void.class); + }); + checkWMTE(() -> { // reciever primitive class + $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, $type$.class)). + invokeExact(0, $value1$); + }); + // Incorrect return type + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, VarHandleTestMethodType$Type$.class, $type$.class)). + invokeExact(recv, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). + invokeExact(recv, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) hs.get(am, methodType($type$.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) hs.get(am, methodType($type$.class, VarHandleTestMethodType$Type$.class, $type$.class)). + invokeExact(recv, $value1$, Void.class); + }); + } +#end[Bitwise] } @@ -995,6 +1391,23 @@ // WeakCompareAndSet // Incorrect argument types check{#if[String]?CCE:WMTE}(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain($value1$, Void.class); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain($value1$, $value1$, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // expected reference class boolean r = vh.weakCompareAndSet(Void.class, $value1$); }); check{#if[String]?CCE:WMTE}(() -> { // actual reference class @@ -1009,23 +1422,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - check{#if[String]?CCE:WMTE}(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, $value1$); - }); - check{#if[String]?CCE:WMTE}(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile($value1$, Void.class); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile($value1$, $value1$, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types check{#if[String]?CCE:WMTE}(() -> { // expected reference class @@ -1151,6 +1547,48 @@ checkWMTE(() -> { // > $type$ x = ($type$) vh.getAndSet($value1$, Void.class); }); + + + // GetAndSetAcquire + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndSetAcquire(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetAcquire($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndSetAcquire($value1$, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndSetRelease(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndSetRelease($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetRelease($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndSetRelease($value1$, Void.class); + }); #end[CAS] #if[AtomicAdd] @@ -1175,26 +1613,237 @@ }); - // AddAndGet + // GetAndAddAcquire + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndAddAcquire(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddAcquire($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndAddAcquire($value1$, Void.class); + }); + + + // GetAndAddRelease + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndAddRelease(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndAddRelease($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddRelease($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndAddRelease($value1$, Void.class); + }); +#end[AtomicAdd] + +#if[Bitwise] + // GetAndBitwiseOr // Incorrect argument types check{#if[String]?CCE:WMTE}(() -> { // value reference class - $type$ x = ($type$) vh.addAndGet(Void.class); + $type$ x = ($type$) vh.getAndBitwiseOr(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOr($value1$, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrAcquire($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOrAcquire($value1$, Void.class); + }); + + + // GetAndBitwiseOrReleaseRelease + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOrRelease(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrRelease($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrRelease($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOrRelease($value1$, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class); }); // Incorrect return type check{#if[String]?CCE:WMTE}(() -> { // reference class - Void r = (Void) vh.addAndGet($value1$); + Void r = (Void) vh.getAndBitwiseAnd($value1$); }); checkWMTE(() -> { // primitive class - $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.addAndGet($value1$); + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAnd($value1$, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndAcquire($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAndAcquire($value1$, Void.class); + }); + + + // GetAndBitwiseAndReleaseRelease + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAndRelease(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndRelease($value1$); }); // Incorrect arity checkWMTE(() -> { // 0 - $type$ x = ($type$) vh.addAndGet(); + $type$ x = ($type$) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAndRelease($value1$, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXor(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXor(); }); checkWMTE(() -> { // > - $type$ x = ($type$) vh.addAndGet($value1$, Void.class); - }); -#end[AtomicAdd] + $type$ x = ($type$) vh.getAndBitwiseXor($value1$, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorAcquire($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXorAcquire($value1$, Void.class); + }); + + + // GetAndBitwiseXorReleaseRelease + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXorRelease(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorRelease($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXorRelease($value1$, Void.class); + }); +#end[Bitwise] } static void testStaticFieldWrongMethodType(Handles hs) throws Throwable { @@ -1338,6 +1987,34 @@ }); } #end[AtomicAdd] + +#if[Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class)). + invokeExact(Void.class); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, $type$.class)). + invokeExact($value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$.class)). + invokeExact($value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) hs.get(am, methodType($type$.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$.class, Class.class)). + invokeExact($value1$, Void.class); + }); + } +#end[Bitwise] } @@ -1602,6 +2279,35 @@ // WeakCompareAndSet // Incorrect argument types checkNPE(() -> { // null receiver + boolean r = vh.weakCompareAndSetPlain(null, 0, $value1$, $value1$); + }); + checkCCE(() -> { // receiver reference class + boolean r = vh.weakCompareAndSetPlain(Void.class, 0, $value1$, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // expected reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, Void.class, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // actual reference class + boolean r = vh.weakCompareAndSetPlain(array, 0, $value1$, Void.class); + }); + checkWMTE(() -> { // receiver primitive class + boolean r = vh.weakCompareAndSetPlain(0, 0, $value1$, $value1$); + }); + checkWMTE(() -> { // index reference class + boolean r = vh.weakCompareAndSetPlain(array, Void.class, $value1$, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + boolean r = vh.weakCompareAndSetPlain(); + }); + checkWMTE(() -> { // > + boolean r = vh.weakCompareAndSetPlain(array, 0, $value1$, $value1$, Void.class); + }); + + + // WeakCompareAndSetVolatile + // Incorrect argument types + checkNPE(() -> { // null receiver boolean r = vh.weakCompareAndSet(null, 0, $value1$, $value1$); }); checkCCE(() -> { // receiver reference class @@ -1628,35 +2334,6 @@ }); - // WeakCompareAndSetVolatile - // Incorrect argument types - checkNPE(() -> { // null receiver - boolean r = vh.weakCompareAndSetVolatile(null, 0, $value1$, $value1$); - }); - checkCCE(() -> { // receiver reference class - boolean r = vh.weakCompareAndSetVolatile(Void.class, 0, $value1$, $value1$); - }); - check{#if[String]?CCE:WMTE}(() -> { // expected reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, Void.class, $value1$); - }); - check{#if[String]?CCE:WMTE}(() -> { // actual reference class - boolean r = vh.weakCompareAndSetVolatile(array, 0, $value1$, Void.class); - }); - checkWMTE(() -> { // receiver primitive class - boolean r = vh.weakCompareAndSetVolatile(0, 0, $value1$, $value1$); - }); - checkWMTE(() -> { // index reference class - boolean r = vh.weakCompareAndSetVolatile(array, Void.class, $value1$, $value1$); - }); - // Incorrect arity - checkWMTE(() -> { // 0 - boolean r = vh.weakCompareAndSetVolatile(); - }); - checkWMTE(() -> { // > - boolean r = vh.weakCompareAndSetVolatile(array, 0, $value1$, $value1$, Void.class); - }); - - // WeakCompareAndSetAcquire // Incorrect argument types checkNPE(() -> { // null receiver @@ -1854,6 +2531,72 @@ checkWMTE(() -> { // > $type$ x = ($type$) vh.getAndSet(array, 0, $value1$, Void.class); }); + + + // GetAndSetAcquire + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndSetAcquire(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndSetAcquire(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndSetAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + $type$ x = ($type$) vh.getAndSetAcquire(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndSetAcquire(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndSetAcquire(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetAcquire(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndSetAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndSetAcquire(array, 0, $value1$, Void.class); + }); + + + // GetAndSetRelease + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndSetRelease(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndSetRelease(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndSetRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // reciarrayever primitive class + $type$ x = ($type$) vh.getAndSetRelease(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndSetRelease(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndSetRelease(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndSetRelease(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndSetRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndSetRelease(array, 0, $value1$, Void.class); + }); #end[CAS] #if[AtomicAdd] @@ -1890,38 +2633,369 @@ }); - // AddAndGet + // GetAndAddAcquire + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndAddAcquire(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndAddAcquire(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndAddAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndAddAcquire(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndAddAcquire(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndAddAcquire(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddAcquire(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndAddAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndAddAcquire(array, 0, $value1$, Void.class); + }); + + + // GetAndAddRelease // Incorrect argument types checkNPE(() -> { // null array - $type$ x = ($type$) vh.addAndGet(null, 0, $value1$); + $type$ x = ($type$) vh.getAndAddRelease(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndAddRelease(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndAddRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndAddRelease(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndAddRelease(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndAddRelease(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndAddRelease(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndAddRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndAddRelease(array, 0, $value1$, Void.class); + }); +#end[AtomicAdd] + +#if[Bitwise] + // GetAndBitwiseOr + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseOr(null, 0, $value1$); }); checkCCE(() -> { // array reference class - $type$ x = ($type$) vh.addAndGet(Void.class, 0, $value1$); + $type$ x = ($type$) vh.getAndBitwiseOr(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOr(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseOr(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseOr(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOr(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOr(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOr(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOr(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseOrAcquire + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(Void.class, 0, $value1$); }); check{#if[String]?CCE:WMTE}(() -> { // value reference class - $type$ x = ($type$) vh.addAndGet(array, 0, Void.class); + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(array, 0, Void.class); }); checkWMTE(() -> { // array primitive class - $type$ x = ($type$) vh.addAndGet(0, 0, $value1$); + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(0, 0, $value1$); }); checkWMTE(() -> { // index reference class - $type$ x = ($type$) vh.addAndGet(array, Void.class, $value1$); + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseOrAcquire(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrAcquire(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOrAcquire(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseOrRelease + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseOrRelease(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseOrRelease(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseOrRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseOrRelease(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseOrRelease(array, Void.class, $value1$); }); // Incorrect return type check{#if[String]?CCE:WMTE}(() -> { // reference class - Void r = (Void) vh.addAndGet(array, 0, $value1$); + Void r = (Void) vh.getAndBitwiseOrRelease(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseOrRelease(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseOrRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseOrRelease(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseAnd + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseAnd(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseAnd(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseAnd(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAnd(array, 0, $value1$); }); checkWMTE(() -> { // primitive class - $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.addAndGet(array, 0, $value1$); + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAnd(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAnd(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAnd(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseAndAcquire + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndAcquire(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndAcquire(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAndAcquire(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseAndRelease + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseAndRelease(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseAndRelease(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseAndRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseAndRelease(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseAndRelease(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseAndRelease(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseAndRelease(array, 0, $value1$); }); // Incorrect arity checkWMTE(() -> { // 0 - $type$ x = ($type$) vh.addAndGet(); + $type$ x = ($type$) vh.getAndBitwiseAndRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseAndRelease(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseXor + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseXor(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseXor(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXor(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseXor(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseXor(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXor(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXor(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXor(); }); checkWMTE(() -> { // > - $type$ x = ($type$) vh.addAndGet(array, 0, $value1$, Void.class); - }); -#end[AtomicAdd] + $type$ x = ($type$) vh.getAndBitwiseXor(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseXorAcquire + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorAcquire(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorAcquire(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXorAcquire(array, 0, $value1$, Void.class); + }); + + + // GetAndBitwiseXorRelease + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) vh.getAndBitwiseXorRelease(null, 0, $value1$); + }); + checkCCE(() -> { // array reference class + $type$ x = ($type$) vh.getAndBitwiseXorRelease(Void.class, 0, $value1$); + }); + check{#if[String]?CCE:WMTE}(() -> { // value reference class + $type$ x = ($type$) vh.getAndBitwiseXorRelease(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) vh.getAndBitwiseXorRelease(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) vh.getAndBitwiseXorRelease(array, Void.class, $value1$); + }); + // Incorrect return type + check{#if[String]?CCE:WMTE}(() -> { // reference class + Void r = (Void) vh.getAndBitwiseXorRelease(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) vh.getAndBitwiseXorRelease(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) vh.getAndBitwiseXorRelease(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) vh.getAndBitwiseXorRelease(array, 0, $value1$, Void.class); + }); +#end[Bitwise] } static void testArrayWrongMethodType(Handles hs) throws Throwable { @@ -2168,6 +3242,50 @@ }); } #end[AtomicAdd] + +#if[Bitwise] + for (TestAccessMode am : testAccessModesOfType(TestAccessType.GET_AND_BITWISE)) { + // Incorrect argument types + checkNPE(() -> { // null array + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class)). + invokeExact(($type$[]) null, 0, $value1$); + }); + hs.checkWMTEOrCCE(() -> { // array reference class + $type$ x = ($type$) hs.get(am, methodType($type$.class, Class.class, int.class, $type$.class)). + invokeExact(Void.class, 0, $value1$); + }); + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // value reference class + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, Class.class)). + invokeExact(array, 0, Void.class); + }); + checkWMTE(() -> { // array primitive class + $type$ x = ($type$) hs.get(am, methodType($type$.class, int.class, int.class, $type$.class)). + invokeExact(0, 0, $value1$); + }); + checkWMTE(() -> { // index reference class + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, Class.class, $type$.class)). + invokeExact(array, Void.class, $value1$); + }); + // Incorrect return type + {#if[String]?hs.checkWMTEOrCCE:checkWMTE}(() -> { // reference class + Void r = (Void) hs.get(am, methodType(Void.class, $type$[].class, int.class, $type$.class)). + invokeExact(array, 0, $value1$); + }); + checkWMTE(() -> { // primitive class + $wrong_primitive_type$ x = ($wrong_primitive_type$) hs.get(am, methodType($wrong_primitive_type$.class, $type$[].class, int.class, $type$.class)). + invokeExact(array, 0, $value1$); + }); + // Incorrect arity + checkWMTE(() -> { // 0 + $type$ x = ($type$) hs.get(am, methodType($type$.class)). + invokeExact(); + }); + checkWMTE(() -> { // > + $type$ x = ($type$) hs.get(am, methodType($type$.class, $type$[].class, int.class, $type$.class, Class.class)). + invokeExact(array, 0, $value1$, Void.class); + }); + } +#end[Bitwise] } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/VarHandles/generate-vh-tests.sh --- a/jdk/test/java/lang/invoke/VarHandles/generate-vh-tests.sh Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/VarHandles/generate-vh-tests.sh Fri Sep 02 02:41:37 2016 +0000 @@ -22,6 +22,12 @@ ;; esac + case $type in + boolean|byte|short|char|int|long) + args="$args -KBitwise" + ;; + esac + wrong_primitive_type=boolean case $type in @@ -109,6 +115,12 @@ ;; esac + case $type in + int|long) + args="$args -KBitwise" + ;; + esac + # The value of `value3` is chosen such that when added to `value1` or `value2` # it will result in carrying of bits over to the next byte, thereby detecting # possible errors in endianness conversion e.g. if say for atomic addition the diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/accessProtectedSuper/BogoLoader.java --- a/jdk/test/java/lang/invoke/accessProtectedSuper/BogoLoader.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/accessProtectedSuper/BogoLoader.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ import java.io.BufferedInputStream; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/accessProtectedSuper/MethodInvoker.java --- a/jdk/test/java/lang/invoke/accessProtectedSuper/MethodInvoker.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/accessProtectedSuper/MethodInvoker.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ import anotherpkg.MethodSupplierOuter; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/accessProtectedSuper/Test.java --- a/jdk/test/java/lang/invoke/accessProtectedSuper/Test.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/accessProtectedSuper/Test.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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. - * */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/invoke/accessProtectedSuper/anotherpkg/MethodSupplierOuter.java --- a/jdk/test/java/lang/invoke/accessProtectedSuper/anotherpkg/MethodSupplierOuter.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/invoke/accessProtectedSuper/anotherpkg/MethodSupplierOuter.java Fri Sep 02 02:41:37 2016 +0000 @@ -19,7 +19,6 @@ * 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 anotherpkg; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java --- a/jdk/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/management/GarbageCollectorMXBean/GcInfoCompositeType.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2016, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/lang/ref/CleanerTest.java --- a/jdk/test/java/lang/ref/CleanerTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/lang/ref/CleanerTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -49,7 +49,7 @@ /* * @test - * @library /test/lib/share/classes /lib/testlibrary /test/lib + * @library /lib/testlibrary /test/lib * @build sun.hotspot.WhiteBox * @build jdk.test.lib.Utils * @modules java.base/jdk.internal diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/net/Inet4Address/textToNumericFormat.java --- a/jdk/test/java/net/Inet4Address/textToNumericFormat.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/net/Inet4Address/textToNumericFormat.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2016, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/net/ProxySelector/B8035158.java --- a/jdk/test/java/net/ProxySelector/B8035158.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/net/ProxySelector/B8035158.java Fri Sep 02 02:41:37 2016 +0000 @@ -20,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + /* * @test * @bug 8035158 8145732 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java --- a/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/net/URLClassLoader/definePackage/SplitPackage.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,4 +1,4 @@ -/** +/* * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/net/URLPermission/nstest/LookupTest.java --- a/jdk/test/java/net/URLPermission/nstest/LookupTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/net/URLPermission/nstest/LookupTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/net/URLPermission/nstest/lookup.sh --- a/jdk/test/java/net/URLPermission/nstest/lookup.sh Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/net/URLPermission/nstest/lookup.sh Fri Sep 02 02:41:37 2016 +0000 @@ -27,6 +27,7 @@ # @build jdk.testlibrary.* # @compile -XDignore.symbol.file=true LookupTest.java # @run shell/timeout=50 lookup.sh +# @key intermittent # OS=`uname -s` diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/net/httpclient/BasicAuthTest.java --- a/jdk/test/java/net/httpclient/BasicAuthTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/net/httpclient/BasicAuthTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -20,6 +20,7 @@ * * 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. */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/net/httpclient/HeadersTest1.java --- a/jdk/test/java/net/httpclient/HeadersTest1.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/net/httpclient/HeadersTest1.java Fri Sep 02 02:41:37 2016 +0000 @@ -20,6 +20,7 @@ * * 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. */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/net/httpclient/ImmutableHeaders.java --- a/jdk/test/java/net/httpclient/ImmutableHeaders.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/net/httpclient/ImmutableHeaders.java Fri Sep 02 02:41:37 2016 +0000 @@ -20,6 +20,7 @@ * * 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. */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/net/httpclient/security/Driver.java --- a/jdk/test/java/net/httpclient/security/Driver.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/net/httpclient/security/Driver.java Fri Sep 02 02:41:37 2016 +0000 @@ -20,6 +20,7 @@ * * 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. */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/net/httpclient/security/Security.java --- a/jdk/test/java/net/httpclient/security/Security.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/net/httpclient/security/Security.java Fri Sep 02 02:41:37 2016 +0000 @@ -20,6 +20,7 @@ * * 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. */ /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/security/SecureRandom/DrbgParametersSpec.java --- a/jdk/test/java/security/SecureRandom/DrbgParametersSpec.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/security/SecureRandom/DrbgParametersSpec.java Fri Sep 02 02:41:37 2016 +0000 @@ -24,7 +24,7 @@ /* @test * @bug 8051408 8158534 * @summary Make sure DrbgParameters coded as specified - * @library /test/lib/share/classes + * @library /test/lib */ import jdk.test.lib.Asserts; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Bidi/BidiConformance.java --- a/jdk/test/java/text/Bidi/BidiConformance.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Bidi/BidiConformance.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2016, 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 @@ -25,6 +25,7 @@ * @test * @bug 6850113 8032446 * @summary confirm the behavior of new Bidi implementation. (Backward compatibility) + * @modules java.desktop */ import java.awt.font.NumericShaper; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Bidi/BidiEmbeddingTest.java --- a/jdk/test/java/text/Bidi/BidiEmbeddingTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Bidi/BidiEmbeddingTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, 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 @@ -28,6 +28,7 @@ * indicate overrides, rather than using bit 7. Also tests Bidi without loading awt classes to * confirm that Bidi can be used without awt. Verify that embedding level 0 is properly mapped * to the base embedding level. + * @modules java.desktop */ import java.awt.Color; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Bidi/Bug7042148.java --- a/jdk/test/java/text/Bidi/Bug7042148.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Bidi/Bug7042148.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -25,6 +25,7 @@ * @test * @bug 7042148 * @summary verify that Bidi.baseIsLeftToRight() returns the correct value even if an incorrect position is set in the given AttributedCharacterIterator. + * @modules java.desktop */ import java.awt.font.*; import java.text.*; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Bidi/Bug7051769.java --- a/jdk/test/java/text/Bidi/Bug7051769.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Bidi/Bug7051769.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2016, 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 @@ -26,6 +26,7 @@ * @bug 7051769 8038092 * @summary verify that Bidi.toString() returns the corect result. * The second run is intended to test lazy SharedSectets init for 8038092 + * @modules java.desktop * @run main Bug7051769 * @run main/othervm -DpreloadBidi=true Bug7051769 */ diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/BreakIterator/NewVSOld_th_TH.java --- a/jdk/test/java/text/BreakIterator/NewVSOld_th_TH.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/BreakIterator/NewVSOld_th_TH.java Fri Sep 02 02:41:37 2016 +0000 @@ -22,9 +22,10 @@ */ /* - @test - @summary test Comparison of New Collators against Old Collators in the en_US locale -*/ + * @test + * @summary test Comparison of New Collators against Old Collators in the en_US locale + * @modules jdk.localedata + */ import java.io.*; import java.util.Enumeration; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Collator/APITest.java --- a/jdk/test/java/text/Collator/APITest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Collator/APITest.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test Collation API + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996 - All Rights Reserved diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Collator/CollationKeyTest.java --- a/jdk/test/java/text/Collator/CollationKeyTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Collator/CollationKeyTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -29,6 +29,7 @@ * RuleBasedCollationKey. This test basically tests on the two features: * 1. Existing code using CollationKey works (backward compatiblility) * 2. CollationKey can be extended by its subclass. + * @modules jdk.localedata */ diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Collator/DanishTest.java --- a/jdk/test/java/text/Collator/DanishTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Collator/DanishTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -26,6 +26,7 @@ * @bug 4930708 4174436 5008498 * @library /java/text/testlib * @summary test Danish Collation + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996 - All Rights Reserved diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Collator/FinnishTest.java --- a/jdk/test/java/text/Collator/FinnishTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Collator/FinnishTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test Finnish Collation + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996 - All Rights Reserved diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Collator/FrenchTest.java --- a/jdk/test/java/text/Collator/FrenchTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Collator/FrenchTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test French Collation + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996 - All Rights Reserved diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Collator/G7Test.java --- a/jdk/test/java/text/Collator/G7Test.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Collator/G7Test.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test G7 Collation + * @modules jdk.localedata */ /* * diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Collator/JapaneseTest.java --- a/jdk/test/java/text/Collator/JapaneseTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Collator/JapaneseTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,6 +25,7 @@ * @test 1.1 02/09/11 * @bug 4176141 4655819 * @summary Regression tests for Japanese Collation + * @modules jdk.localedata */ import java.text.*; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Collator/KoreanTest.java --- a/jdk/test/java/text/Collator/KoreanTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Collator/KoreanTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,6 +25,7 @@ * @test 1.1 02/09/12 * @bug 4176141 4655819 * @summary Regression tests for Korean Collation + * @modules jdk.localedata */ import java.text.*; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Collator/Regression.java --- a/jdk/test/java/text/Collator/Regression.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Collator/Regression.java Fri Sep 02 02:41:37 2016 +0000 @@ -29,6 +29,7 @@ * 4133509 4139572 4141640 4179126 4179686 4244884 4663220 * @library /java/text/testlib * @summary Regression tests for Collation and associated classes + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996 - All Rights Reserved diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Collator/ThaiTest.java --- a/jdk/test/java/text/Collator/ThaiTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Collator/ThaiTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test Thai Collation + * @modules jdk.localedata */ /* * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Collator/TurkishTest.java --- a/jdk/test/java/text/Collator/TurkishTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Collator/TurkishTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test Turkish Collation + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996 - All Rights Reserved diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Collator/VietnameseTest.java --- a/jdk/test/java/text/Collator/VietnameseTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Collator/VietnameseTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -26,6 +26,7 @@ * @bug 4932968 5015215 * @library /java/text/testlib * @summary test Vietnamese Collation + * @modules jdk.localedata */ /* diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/DateFormat/Bug4823811.java --- a/jdk/test/java/text/Format/DateFormat/Bug4823811.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/DateFormat/Bug4823811.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, 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 @@ -25,6 +25,7 @@ * @test * @bug 4823811 8008577 * @summary Confirm that text which includes numbers with a trailing minus sign is parsed correctly. + * @modules jdk.localedata * @run main/othervm -Duser.timezone=GMT+09:00 -Djava.locale.providers=JRE,SPI Bug4823811 */ diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/DateFormat/Bug6683975.java --- a/jdk/test/java/text/Format/DateFormat/Bug6683975.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/DateFormat/Bug6683975.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2016, 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 @@ -25,6 +25,7 @@ * @test * @bug 6683975 8008577 * @summary Make sure that date is formatted correctlyin th locale. + * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=JRE,SPI Bug6683975 */ import java.text.*; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/DateFormat/Bug8139572.java --- a/jdk/test/java/text/Format/DateFormat/Bug8139572.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/DateFormat/Bug8139572.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -26,6 +26,7 @@ * @bug 8139572 * @summary SimpleDateFormat parse month stand-alone format bug * @compile -encoding utf-8 Bug8139572.java + * @modules jdk.localedata * @run main Bug8139572 */ import java.text.ParseException; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/DateFormat/ContextMonthNamesTest.java --- a/jdk/test/java/text/Format/DateFormat/ContextMonthNamesTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/DateFormat/ContextMonthNamesTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, 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 @@ -25,6 +25,7 @@ * @test * @bug 7079560 8008577 * @summary Unit test for context-sensitive month names + * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=JRE,SPI ContextMonthNamesTest */ diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/DateFormat/DateFormatTest.java --- a/jdk/test/java/text/Format/DateFormat/DateFormatTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/DateFormat/DateFormatTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -26,6 +26,7 @@ * @bug 4052223 4089987 4469904 4326988 4486735 8008577 8045998 8140571 * @summary test DateFormat and SimpleDateFormat. * @library /java/text/testlib + * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=COMPAT,SPI DateFormatTest */ diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/DateFormat/LocaleDateFormats.java --- a/jdk/test/java/text/Format/DateFormat/LocaleDateFormats.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/DateFormat/LocaleDateFormats.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -24,6 +24,7 @@ /** * @test * @bug 8080774 + * @modules jdk.localedata * @run testng/othervm -Djava.locale.providers=JRE,CLDR LocaleDateFormats * @summary This file contains tests for JRE locales date formats */ diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/DateFormat/NonGregorianFormatTest.java --- a/jdk/test/java/text/Format/DateFormat/NonGregorianFormatTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/DateFormat/NonGregorianFormatTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,6 +25,7 @@ * @test * @bug 4833268 6253991 8008577 * @summary Test formatting and parsing with non-Gregorian calendars + * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=COMPAT,SPI NonGregorianFormatTest */ diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/DateFormat/bug4117335.java --- a/jdk/test/java/text/Format/DateFormat/bug4117335.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/DateFormat/bug4117335.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,6 +25,7 @@ * @test * * @bug 4117335 4432617 + * @modules jdk.localedata */ import java.text.DateFormatSymbols ; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/MessageFormat/LargeMessageFormat.java --- a/jdk/test/java/text/Format/MessageFormat/LargeMessageFormat.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/MessageFormat/LargeMessageFormat.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,6 +25,7 @@ * @test * @bug 4112090 8008577 * @summary verify that MessageFormat can handle large numbers of arguments + * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=COMPAT,SPI LargeMessageFormat */ diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/NumberFormat/Bug8132125.java --- a/jdk/test/java/text/Format/NumberFormat/Bug8132125.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/NumberFormat/Bug8132125.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -25,6 +25,7 @@ * @test * @bug 8132125 * @summary Checks Swiss' number elements + * @modules jdk.localedata */ import java.text.*; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/NumberFormat/CurrencyFormat.java --- a/jdk/test/java/text/Format/NumberFormat/CurrencyFormat.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/NumberFormat/CurrencyFormat.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,6 +25,7 @@ * @test * @bug 4290801 4942982 5102005 8008577 8021121 * @summary Basic tests for currency formatting. + * @modules jdk.localedata * @run main/othervm -Djava.locale.providers=JRE,SPI CurrencyFormat */ diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/NumberFormat/IntlTestNumberFormatAPI.java --- a/jdk/test/java/text/Format/NumberFormat/IntlTestNumberFormatAPI.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/NumberFormat/IntlTestNumberFormatAPI.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,6 +25,7 @@ * @test * @library /java/text/testlib * @summary test International Number Format API + * @modules jdk.localedata */ /* (C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/NumberFormat/NumberRegression.java --- a/jdk/test/java/text/Format/NumberFormat/NumberRegression.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/NumberFormat/NumberRegression.java Fri Sep 02 02:41:37 2016 +0000 @@ -34,6 +34,7 @@ * @library /java/text/testlib * @build IntlTest HexDumpReader TestUtils * @modules java.base/sun.util.resources + * jdk.localedata * @compile -XDignore.symbol.file NumberRegression.java * @run main/othervm -Djava.locale.providers=COMPAT,SPI NumberRegression */ diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/text/Format/NumberFormat/NumberTest.java --- a/jdk/test/java/text/Format/NumberFormat/NumberTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/text/Format/NumberFormat/NumberTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -27,6 +27,7 @@ * @summary test NumberFormat * @library /java/text/testlib * @modules java.base/sun.util.resources + * jdk.localedata * @compile -XDignore.symbol.file NumberTest.java * @run main/othervm -Djava.locale.providers=COMPAT,SPI NumberTest */ diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/util/Arrays/Correct.java --- a/jdk/test/java/util/Arrays/Correct.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/util/Arrays/Correct.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/util/Map/FunctionalCMEs.java --- a/jdk/test/java/util/Map/FunctionalCMEs.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/util/Map/FunctionalCMEs.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + import java.util.Arrays; import java.util.ConcurrentModificationException; import java.util.HashMap; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/util/Objects/CheckIndex.java --- a/jdk/test/java/util/Objects/CheckIndex.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/util/Objects/CheckIndex.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/util/concurrent/FutureTask/NegativeTimeout.java --- a/jdk/test/java/util/concurrent/FutureTask/NegativeTimeout.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/util/concurrent/FutureTask/NegativeTimeout.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/util/logging/Logger/entering/LoggerEnteringWithParams.java --- a/jdk/test/java/util/logging/Logger/entering/LoggerEnteringWithParams.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/util/logging/Logger/entering/LoggerEnteringWithParams.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,4 +1,3 @@ - /* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/util/logging/XMLFormatterDate.java --- a/jdk/test/java/util/logging/XMLFormatterDate.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/util/logging/XMLFormatterDate.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,4 +1,3 @@ - /* * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -21,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/util/regex/PatternStreamTest.java --- a/jdk/test/java/util/regex/PatternStreamTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/util/regex/PatternStreamTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015 Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/util/zip/TestCRC32.java --- a/jdk/test/java/util/zip/TestCRC32.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/util/zip/TestCRC32.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,6 +1,3 @@ - -import java.util.zip.CRC32; - /* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,6 +21,8 @@ * questions. */ +import java.util.zip.CRC32; + /** * @test @summary Check that CRC-32 returns the expected CRC value for the * string 123456789 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/util/zip/TestCRC32C.java --- a/jdk/test/java/util/zip/TestCRC32C.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/util/zip/TestCRC32C.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,6 +1,3 @@ - -import java.util.zip.CRC32C; - /* * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -24,6 +21,8 @@ * questions. */ +import java.util.zip.CRC32C; + /** * @test @summary Check that CRC-32C returns the expected CRC value for the * string 123456789 diff -r b079fff22b3c -r de9ff562c112 jdk/test/java/util/zip/ZipFile/TestZipFile.java --- a/jdk/test/java/util/zip/ZipFile/TestZipFile.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/java/util/zip/ZipFile/TestZipFile.java Fri Sep 02 02:41:37 2016 +0000 @@ -8,7 +8,7 @@ * * 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 + * 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). * diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/imageio/GetReaderWriterInfoNullTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/imageio/GetReaderWriterInfoNullTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2016, 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. + * + * 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. + */ + +/* + * @test + * @bug 8163258 + * @summary Test verifies that when we create our own ImageReaderSpi + * implementaion with MIMEType or FileSuffix as null, it should + * not throw NullPointerException when we call + * ImageIO.getReaderMIMETypes() or ImageIO.getReaderFileSuffixes(). + * @run main GetReaderWriterInfoNullTest + */ + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.util.Iterator; +import java.util.Locale; +import javax.imageio.IIOException; +import javax.imageio.ImageReadParam; +import javax.imageio.ImageReader; +import javax.imageio.ImageTypeSpecifier; +import javax.imageio.metadata.IIOMetadata; +import javax.imageio.spi.ImageReaderSpi; +import javax.imageio.stream.ImageInputStream; +import javax.imageio.ImageIO; +import javax.imageio.spi.IIORegistry; + +class TestImageReaderSpi extends ImageReaderSpi { + + public TestImageReaderSpi(String[] FORMATNAMES, String[] SUFFIXES, + String[] MIMETYPES) { + super("J Duke", // vendor + "1.0", // version + FORMATNAMES, // format names + SUFFIXES, // file suffixes + MIMETYPES, // mimetypes + "readTest.TestImageReader", // reader class name + new Class[] { ImageInputStream.class }, // input types + null, // writer class names. + true, // supports native metadata, + null, // [no] native stream metadata format + null, // [no] native stream metadata class + null, // [no] native extra stream metadata format + null, // [no] native extra stream metadata class + true, // supports standard metadata, + null, // metadata format name, + null, // metadata format class name + null, // [no] extra image metadata format + null // [no] extra image metadata format class + ); + } + + @Override + public boolean canDecodeInput(Object source) throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public String getDescription(Locale locale) { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public ImageReader createReaderInstance(Object extension) + throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + +} + +class TestImageReader extends ImageReader { + + public TestImageReader(ImageReaderSpi originatingProvider) { + super(originatingProvider); + } + + @Override + public int getNumImages(boolean allowSearch) throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getWidth(int imageIndex) throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public int getHeight(int imageIndex) throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public Iterator getImageTypes(int imageIndex) + throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public IIOMetadata getStreamMetadata() throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public IIOMetadata getImageMetadata(int imageIndex) throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } + + @Override + public BufferedImage read(int imageIndex, ImageReadParam param) + throws IOException { + throw new UnsupportedOperationException("Not supported yet."); + } +} +public class GetReaderWriterInfoNullTest { + static final String[] FORMATNAMES = {"readTest"}; + static final String[] SUFFIXES = {"readTest"}; + static final String[] MIMETYPES = {"readTest"}; + public static void main (String[] args) throws IIOException { + // Verify getReaderMIMETypes() behavior by keeping MIMEType as null. + TestImageReaderSpi mimeNullReadSpi = + new TestImageReaderSpi(FORMATNAMES, SUFFIXES, null); + IIORegistry.getDefaultInstance(). + registerServiceProvider(mimeNullReadSpi); + ImageIO.getReaderMIMETypes(); + IIORegistry.getDefaultInstance(). + deregisterServiceProvider(mimeNullReadSpi); + + /* + * Verify getReaderFileSuffixes() behavior by keeping + * file suffix as null. + */ + TestImageReaderSpi suffixNullReadSpi = + new TestImageReaderSpi(FORMATNAMES, null, MIMETYPES); + IIORegistry.getDefaultInstance(). + registerServiceProvider(suffixNullReadSpi); + ImageIO.getReaderFileSuffixes(); + IIORegistry.getDefaultInstance(). + deregisterServiceProvider(suffixNullReadSpi); + } +} + diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/imageio/plugins/tiff/TIFFFieldTest.java --- a/jdk/test/javax/imageio/plugins/tiff/TIFFFieldTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/imageio/plugins/tiff/TIFFFieldTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -23,7 +23,7 @@ /** * @test - * @bug 8152183 + * @bug 8152183 8149562 * @author a.stepanov * @summary Some checks for TIFFField methods * @run main TIFFFieldTest @@ -455,8 +455,17 @@ TIFFTagSet ts = new TIFFTagSet(tags); boolean ok = false; - try { TIFFField.createFromMetadataNode(ts, null); } - catch (NullPointerException e) { ok = true; } + try { + TIFFField.createFromMetadataNode(ts, null); + } catch (IllegalArgumentException e) { + // createFromMetadataNode() formerly threw a NullPointerException + // if its Node parameter was null, but the specification has been + // modified to allow only IllegalArgumentExceptions, perhaps with + // a cause set. In the present invocation the cause would be set + // to a NullPointerException but this is not explicitly specified + // hence not verified here. + ok = true; + } check(ok, "can create TIFFField from a null node"); TIFFField f = new TIFFField(tag, v); diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/management/remote/mandatory/notif/DeadListenerTest.java --- a/jdk/test/javax/management/remote/mandatory/notif/DeadListenerTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/management/remote/mandatory/notif/DeadListenerTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, 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 @@ -115,9 +115,8 @@ mbean.sendNotification(notif); // Make sure notifs are working normally. - long deadline = System.currentTimeMillis() + 2000; - while ((count1Val.get() != 1 || count2Val.get() != 1) && System.currentTimeMillis() < deadline) { - Thread.sleep(10); + while ((count1Val.get() != 1 || count2Val.get() != 1) ) { + Thread.sleep(20); } assertTrue("New value of count1 == 1", count1Val.get() == 1); assertTrue("Initial value of count2 == 1", count2Val.get() == 1); diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/print/attribute/ServiceDialogValidateTest.java --- a/jdk/test/javax/print/attribute/ServiceDialogValidateTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/print/attribute/ServiceDialogValidateTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -22,7 +22,7 @@ */ /* * @test - * @bug 5049012 + * @bug 5049012 8163922 * @summary Verify if PrintToFile option is disabled for flavors that do not * support Destination * @requires (os.family == "linux") @@ -30,6 +30,8 @@ */ import java.awt.BorderLayout; import java.awt.FlowLayout; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.io.File; import javax.print.DocFlavor; import javax.print.PrintService; @@ -72,6 +74,9 @@ defService = ServiceUI.printDialog(null, 100, 100, service, defService, flavor, prSet); + ServiceUI.printDialog(null, 100, 100, service, defService, + DocFlavor.SERVICE_FORMATTED.PAGEABLE, + new HashPrintRequestAttributeSet()); } /** @@ -87,7 +92,8 @@ } catch (InterruptedException e) { if (!testPassed && testGeneratedInterrupt) { throw new RuntimeException("PrintToFile option is not disabled " - + "for flavors that do not support destination"); + + "for flavors that do not support destination and/or" + + " disabled for flavors that supports destination"); } } if (!testGeneratedInterrupt) { @@ -110,10 +116,15 @@ private static void doTest(Runnable action) { String description = " Visual inspection of print dialog is required.\n" - + " A print dialog will be shown.\n " - + " Please verify Print-To-File option is disabled.\n" + + " 2 print dialog will be shown.\n " + + " Please verify Print-To-File option is disabled " + + " in the 1st print dialog.\n" + " Press Cancel to close the print dialog.\n" - + " If Print-To-File option is disabled, press PASS else press FAIL"; + + " Please verify Print-To-File option is enabled " + + " in 2nd print dialog\n" + + " Press Cancel to close the print dialog.\n" + + " If the print dialog's Print-to-File behaves as mentioned, " + + " press PASS else press FAIL"; final JDialog dialog = new JDialog(); dialog.setTitle("printSelectionTest"); @@ -148,6 +159,14 @@ dialog.add(mainPanel); dialog.pack(); dialog.setVisible(true); + dialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + System.out.println("main dialog closing"); + testGeneratedInterrupt = false; + mainThread.interrupt(); + } + }); } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/print/attribute/ServiceDlgPageRangeTest.java --- a/jdk/test/javax/print/attribute/ServiceDlgPageRangeTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/print/attribute/ServiceDlgPageRangeTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -22,13 +22,15 @@ */ /* * @test - * @bug 5080098 + * @bug 5080098 8164205 * @summary Verify if PageRanges option is disabled for Non service-formatted * flavors. * @run main/manual ServiceDlgPageRangeTest */ import java.awt.BorderLayout; import java.awt.FlowLayout; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import javax.print.DocFlavor; import javax.print.PrintService; import javax.print.PrintServiceLookup; diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetInputStream.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetInputStream.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetInputStream.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,7 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -54,13 +56,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { @@ -76,7 +78,9 @@ buff = new ModelByteBuffer(test_byte_array); byte[] b = new byte[test_byte_array.length]; - buff.getInputStream().read(b); + try (InputStream is = buff.getInputStream()) { + is.read(b); + } for (int j = 0; j < b.length; j++) if(b[i] != test_byte_array[i]) throw new RuntimeException("Byte array compare fails!"); diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetRoot.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetRoot.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/GetRoot.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Load.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Load.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Load.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,7 +28,8 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -54,13 +55,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/LoadAll.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/LoadAll.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/LoadAll.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,7 +28,8 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; @@ -56,13 +57,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArray.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArray.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArray.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArrayIntInt.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArrayIntInt.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferByteArrayIntInt.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFile.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFile.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFile.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFileLongLong.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFileLongLong.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/NewModelByteBufferFileLongLong.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Available.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Available.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Available.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Close.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Close.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Close.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkReset.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkReset.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkReset.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkSupported.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkSupported.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/MarkSupported.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Read.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Read.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Read.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByte.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByte.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByte.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByteIntInt.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByteIntInt.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/ReadByteIntInt.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Skip.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Skip.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/RandomFileInputStream/Skip.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,8 +28,9 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +56,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLong.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLong.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLong.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLong.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLong.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLong.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLongBoolean.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLongBoolean.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/SubbufferLongLongBoolean.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,6 +28,8 @@ import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -53,13 +55,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Unload.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Unload.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/Unload.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -28,7 +28,8 @@ import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -54,13 +55,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/WriteTo.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/WriteTo.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBuffer/WriteTo.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2016, 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 @@ -29,7 +29,9 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; -import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -55,13 +57,13 @@ test_byte_array = new byte[testarray.length*2]; AudioFloatConverter.getConverter(format).toByteArray(testarray, test_byte_array); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(test_byte_array); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(test_byte_array); + } } static void tearDown() throws Exception { - if(!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void main(String[] args) throws Exception { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/midi/Gervill/ModelByteBufferWavetable/OpenStream.java --- a/jdk/test/javax/sound/midi/Gervill/ModelByteBufferWavetable/OpenStream.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/midi/Gervill/ModelByteBufferWavetable/OpenStream.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2016, 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 @@ -30,6 +30,8 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import javax.sound.sampled.*; @@ -99,16 +101,15 @@ buffer_wave = new ModelByteBuffer(baos.toByteArray()); test_file = File.createTempFile("test", ".raw"); - FileOutputStream fos = new FileOutputStream(test_file); - fos.write(baos.toByteArray()); - fos.close(); + try (FileOutputStream fos = new FileOutputStream(test_file)) { + fos.write(baos.toByteArray()); + } buffer_wave_ondisk = new ModelByteBuffer(test_file); } static void tearDown() throws Exception { - if (!test_file.delete()) - test_file.deleteOnExit(); + Files.delete(Paths.get(test_file.getAbsolutePath())); } public static void testOpenStream(ModelByteBufferWavetable wavetable) diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/sampled/AudioInputStream/FrameLengthAfterConversion.java --- a/jdk/test/javax/sound/sampled/AudioInputStream/FrameLengthAfterConversion.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/sampled/AudioInputStream/FrameLengthAfterConversion.java Fri Sep 02 02:41:37 2016 +0000 @@ -26,6 +26,8 @@ import java.io.File; import java.io.IOException; import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; @@ -162,7 +164,7 @@ ais = AudioSystem.getAudioInputStream(temp); final long frameLength = ais.getFrameLength(); ais.close(); - temp.delete(); + Files.delete(Paths.get(temp.getAbsolutePath())); validate(frameLength); } catch (IllegalArgumentException | UnsupportedAudioFileException | IOException ignored) { diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/sound/sampled/spi/AudioFileWriter/WriteUnsupportedAudioFormat.java --- a/jdk/test/javax/sound/sampled/spi/AudioFileWriter/WriteUnsupportedAudioFormat.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/sound/sampled/spi/AudioFileWriter/WriteUnsupportedAudioFormat.java Fri Sep 02 02:41:37 2016 +0000 @@ -27,6 +27,8 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.List; @@ -91,7 +93,6 @@ } catch (final IOException e) { throw new RuntimeException(e); } - FILE.deleteOnExit(); for (final Boolean end : new boolean[]{false, true}) { for (final int sampleSize : sampleBits) { @@ -134,6 +135,7 @@ } } } + Files.delete(Paths.get(FILE.getAbsolutePath())); } /** diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/swing/JButton/8151303/PressedIconTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/jdk/test/javax/swing/JButton/8151303/PressedIconTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2016, 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. + * + * 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. + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.image.BaseMultiResolutionImage; +import java.awt.image.BufferedImage; +import javax.swing.Icon; +import javax.swing.ImageIcon; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JToggleButton; +import javax.swing.SwingUtilities; + +/** + * @test + * @bug 8151303 + * @summary [macosx] [hidpi] JButton's low-res. icon is visible when clicking on it + * @run main/othervm PressedIconTest + * @run main/othervm -Dsun.java2d.uiScale=2 PressedIconTest + */ +public class PressedIconTest { + + private final static int IMAGE_SIZE = 300; + + private final static Color COLOR_1X = Color.RED; + private final static Color COLOR_2X = Color.BLUE; + private static JFrame frame; + private static volatile double scale = -1; + private static volatile int centerX; + private static volatile int centerY; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(50); + + SwingUtilities.invokeAndWait(() -> createAndShowGUI()); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(() -> { + scale = frame.getGraphicsConfiguration().getDefaultTransform() + .getScaleX(); + Point location = frame.getLocation(); + Dimension size = frame.getSize(); + centerX = location.x + size.width / 2; + centerY = location.y + size.height / 2; + }); + robot.waitForIdle(); + + robot.mouseMove(centerX, centerY); + robot.mousePress(InputEvent.BUTTON1_MASK); + robot.waitForIdle(); + Thread.sleep(100); + Color color = robot.getPixelColor(centerX, centerY); + robot.mouseRelease(InputEvent.BUTTON1_MASK); + + SwingUtilities.invokeAndWait(() -> frame.dispose()); + + if ((scale == 1 && !similar(color, COLOR_1X)) + || (scale == 2 && !similar(color, COLOR_2X))) { + throw new RuntimeException("Colors are different!"); + } + } + + private static void createAndShowGUI() { + frame = new JFrame(); + frame.setSize(IMAGE_SIZE, IMAGE_SIZE); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + + JPanel panel = new JPanel(new BorderLayout()); + + BufferedImage img1x = generateImage(1, COLOR_1X); + + BufferedImage img2x = generateImage(2, COLOR_2X); + BaseMultiResolutionImage mri = new BaseMultiResolutionImage( + new BufferedImage[]{img1x, img2x}); + Icon mrIcon = new ImageIcon(mri); + + JToggleButton button = new JToggleButton(); + button.setIcon(mrIcon); + panel.add(button, BorderLayout.CENTER); + + frame.getContentPane().add(panel); + frame.setVisible(true); + } + + private static boolean similar(Color c1, Color c2) { + return similar(c1.getRed(), c2.getRed()) + && similar(c1.getGreen(), c2.getGreen()) + && similar(c1.getBlue(), c2.getBlue()); + } + + private static boolean similar(int n, int m) { + return Math.abs(n - m) <= 50; + } + + private static BufferedImage generateImage(int scale, Color c) { + + int size = IMAGE_SIZE * scale; + BufferedImage img = new BufferedImage(size, size, BufferedImage.TYPE_INT_RGB); + Graphics g = img.createGraphics(); + g.setColor(c); + g.fillRect(0, 0, size, size); + g.dispose(); + return img; + } +} diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java --- a/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/swing/JRadioButton/FocusTraversal/FocusTraversal.java Fri Sep 02 02:41:37 2016 +0000 @@ -23,7 +23,7 @@ /* @test * @key headful - * @bug 8129940 8132770 8161470 + * @bug 8129940 8132770 8161470 8163169 * @summary JRadioButton should run custom FocusTraversalKeys for all LaFs * @run main FocusTraversal */ @@ -61,6 +61,7 @@ public static void main(String[] args) throws Exception { robot = new Robot(); + robot.setAutoDelay(100); robot.waitForIdle(); UIManager.LookAndFeelInfo[] lookAndFeelArray = UIManager.getInstalledLookAndFeels(); diff -r b079fff22b3c -r de9ff562c112 jdk/test/javax/swing/plaf/nimbus/8057791/bug8057791.java --- a/jdk/test/javax/swing/plaf/nimbus/8057791/bug8057791.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/javax/swing/plaf/nimbus/8057791/bug8057791.java Fri Sep 02 02:41:37 2016 +0000 @@ -22,9 +22,10 @@ */ /* @test - @bug 8057791 8160438 - @summary Selection in JList is drawn with wrong colors in Nimbus L&F - @run main bug8057791 + @key headful + @bug 8057791 8160438 8163161 + @summary Selection in JList is drawn with wrong colors in Nimbus L&F + @run main/timeout=500 bug8057791 */ import java.awt.Color; import java.awt.Font; diff -r b079fff22b3c -r de9ff562c112 jdk/test/jdk/internal/ref/Cleaner/ExitOnThrow.java --- a/jdk/test/jdk/internal/ref/Cleaner/ExitOnThrow.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/jdk/internal/ref/Cleaner/ExitOnThrow.java Fri Sep 02 02:41:37 2016 +0000 @@ -24,7 +24,7 @@ /* * @test * @bug 4954921 8009259 - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.ref * java.base/jdk.internal.misc * @build jdk.test.lib.* diff -r b079fff22b3c -r de9ff562c112 jdk/test/lib/testlibrary/jdk/testlibrary/Asserts.java --- a/jdk/test/lib/testlibrary/jdk/testlibrary/Asserts.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Asserts.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ * * * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} + * {@code /test/lib/jdk/test/lib} */ @Deprecated public class Asserts { diff -r b079fff22b3c -r de9ff562c112 jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java --- a/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -29,7 +29,7 @@ /** * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} + * {@code /test/lib/jdk/test/lib} */ @Deprecated public final class JDKToolFinder { diff -r b079fff22b3c -r de9ff562c112 jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java --- a/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ * } * * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} + * {@code /test/lib/jdk/test/lib} */ @Deprecated public class JDKToolLauncher { diff -r b079fff22b3c -r de9ff562c112 jdk/test/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java --- a/jdk/test/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/OutputAnalyzer.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ * Utility class for verifying output and exit value from a {@code Process}. * * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib/process} + * {@code /test/lib/jdk/test/lib/process} * */ @Deprecated diff -r b079fff22b3c -r de9ff562c112 jdk/test/lib/testlibrary/jdk/testlibrary/OutputBuffer.java --- a/jdk/test/lib/testlibrary/jdk/testlibrary/OutputBuffer.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/OutputBuffer.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -30,7 +30,7 @@ /** * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib/process} + * {@code /test/lib/jdk/test/lib/process} */ @Deprecated class OutputBuffer { diff -r b079fff22b3c -r de9ff562c112 jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java --- a/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Platform.java Fri Sep 02 02:41:37 2016 +0000 @@ -29,7 +29,7 @@ /** * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} + * {@code /test/lib/jdk/test/lib} */ @Deprecated public class Platform { diff -r b079fff22b3c -r de9ff562c112 jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java --- a/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/ProcessTools.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -43,7 +43,7 @@ /** * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib/process} + * {@code /test/lib/jdk/test/lib/process} */ @Deprecated public final class ProcessTools { diff -r b079fff22b3c -r de9ff562c112 jdk/test/lib/testlibrary/jdk/testlibrary/StreamPumper.java --- a/jdk/test/lib/testlibrary/jdk/testlibrary/StreamPumper.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/StreamPumper.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,7 +36,7 @@ /** * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib/process} + * {@code /test/lib/jdk/test/lib/process} */ @Deprecated public final class StreamPumper implements Runnable { diff -r b079fff22b3c -r de9ff562c112 jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java --- a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2016, 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 @@ -43,7 +43,7 @@ * Common library for various test helper functions. * * @deprecated This class is deprecated. Use the one from - * {@code /test/lib/share/classes/jdk/test/lib} + * {@code /test/lib/jdk/test/lib} */ @Deprecated public final class Utils { diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java --- a/jdk/test/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2016, 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 @@ -42,7 +42,7 @@ * @summary setInterval() for local MonitoredHost and local MonitoredVm * @modules jdk.jvmstat/sun.jvmstat.monitor * @library /lib/testlibrary - * @library /test/lib/share/classes + * @library /test/lib * @build jdk.testlibrary.* * @build jdk.test.lib.apps.* * @run main TestPollingInterval diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/misc/SunMiscSignalTest.java --- a/jdk/test/sun/misc/SunMiscSignalTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/misc/SunMiscSignalTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -43,7 +43,7 @@ /* * @test - * @library /test/lib/share/classes + * @library /test/lib * @modules jdk.unsupported * java.base/jdk.internal.misc * @build jdk.test.lib.Platform jdk.test.lib.Utils diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/security/krb5/auto/Unreachable.java --- a/jdk/test/sun/security/krb5/auto/Unreachable.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/security/krb5/auto/Unreachable.java Fri Sep 02 02:41:37 2016 +0000 @@ -23,31 +23,108 @@ /* * @test - * @bug 7162687 + * @bug 7162687 8015595 * @key intermittent * @summary enhance KDC server availability detection * @compile -XDignore.symbol.file Unreachable.java - * @run main/othervm/timeout=10 Unreachable + * @run main/othervm Unreachable */ - -import java.io.File; +import java.net.PortUnreachableException; +import java.net.SocketTimeoutException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetSocketAddress; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; +import java.util.concurrent.Executors; import javax.security.auth.login.LoginException; import sun.security.krb5.Config; public class Unreachable { + // Wait for 20 second until unreachable KDC throws PortUnreachableException. + private static final int TIMEOUT = 20; + private static final String REALM = "RABBIT.HOLE"; + private static final String HOST = "127.0.0.1"; + private static final int PORT = 13434; + private static final String KRB_CONF = "unreachable.krb5.conf"; + public static void main(String[] args) throws Exception { - File f = new File( - System.getProperty("test.src", "."), "unreachable.krb5.conf"); - System.setProperty("java.security.krb5.conf", f.getPath()); - Config.refresh(); - // If PortUnreachableException is not received, the login will consume - // about 3*3*30 seconds and the test will timeout. + // - Only PortUnreachableException will allow to continue execution. + // - SocketTimeoutException may occur on Mac because it will not throw + // PortUnreachableException for unreachable port in which case the Test + // execution will be skipped. + // - For Reachable port, the Test execution will get skipped. + // - Any other Exception will be treated as Test failure. + if (!findPortUnreachableExc()) { + System.out.println(String.format("WARNING: Either a reachable " + + "connection found to %s:%s or SocketTimeoutException " + + "occured which means PortUnreachableException not thrown" + + " by the platform.", HOST, PORT)); + return; + } + KDC kdc = KDC.existing(REALM, HOST, PORT); + KDC.saveConfig(KRB_CONF, kdc); + ExecutorService executor = Executors.newSingleThreadExecutor(); + Future future = executor.submit(new Callable() { + @Override + public Exception call() { + System.setProperty("java.security.krb5.conf", KRB_CONF); + try { + Config.refresh(); + // If PortUnreachableException is not received, the login + // will consume about 3*3*30 seconds and the test will + // timeout. + try { + Context.fromUserPass("name", "pass".toCharArray(), true); + } catch (LoginException le) { + // This is OK + } + System.out.println("Execution successful."); + } catch (Exception e) { + return e; + } + return null; + } + }); try { - Context.fromUserPass("name", "pass".toCharArray(), true); - } catch (LoginException le) { - // This is OK + Exception ex = null; + if ((ex = future.get(TIMEOUT, TimeUnit.SECONDS)) != null) { + throw new RuntimeException(ex); + } + } catch (TimeoutException e) { + future.cancel(true); + throw new RuntimeException("PortUnreachableException not thrown."); + } finally { + executor.shutdownNow(); } } + + /** + * If the remote destination to which the socket is connected does not + * exist, or is otherwise unreachable, and if an ICMP destination unreachable + * packet has been received for that address, then a subsequent call to + * send or receive may throw a PortUnreachableException. Note, there is no + * guarantee that the exception will be thrown. + */ + private static boolean findPortUnreachableExc() throws Exception { + try { + InetSocketAddress iaddr = new InetSocketAddress(HOST, PORT); + DatagramSocket dgSocket = new DatagramSocket(); + dgSocket.setSoTimeout(5000); + dgSocket.connect(iaddr); + byte[] data = new byte[]{}; + dgSocket.send(new DatagramPacket(data, data.length, iaddr)); + dgSocket.receive(new DatagramPacket(data, data.length)); + } catch (PortUnreachableException e) { + return true; + } catch (SocketTimeoutException e) { + return false; + } + return false; + } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/security/krb5/auto/unreachable.krb5.conf --- a/jdk/test/sun/security/krb5/auto/unreachable.krb5.conf Thu Sep 01 23:20:11 2016 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -[libdefaults] - default_realm = RABBIT.HOLE -[realms] - -RABBIT.HOLE = { - kdc = 127.0.0.1:13434 - kdc = 127.0.0.1:13435 - kdc = 127.0.0.1:13436 -} diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/security/provider/SecureRandom/AutoReseed.java --- a/jdk/test/sun/security/provider/SecureRandom/AutoReseed.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/security/provider/SecureRandom/AutoReseed.java Fri Sep 02 02:41:37 2016 +0000 @@ -20,6 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + import java.security.SecureRandom; import java.security.Security; @@ -27,15 +28,15 @@ * @test * @bug 8051408 * @summary make sure nextBytes etc can be called before setSeed + * @run main/othervm -Djava.security.egd=file:/dev/urandom AutoReseed */ public class AutoReseed { public static void main(String[] args) throws Exception { SecureRandom sr; - String old = Security.getProperty("securerandom.drbg.config"); - try { - for (String mech : - new String[]{"Hash_DRBG", "HMAC_DRBG", "CTR_DRBG"}) { + boolean pass = true; + for (String mech : new String[]{"Hash_DRBG", "HMAC_DRBG", "CTR_DRBG"}) { + try { System.out.println("Testing " + mech + "..."); Security.setProperty("securerandom.drbg.config", mech); @@ -46,9 +47,13 @@ sr.reseed(); sr = SecureRandom.getInstance("DRBG"); sr.generateSeed(10); + } catch (Exception e) { + pass = false; + e.printStackTrace(System.out); } - } finally { - Security.setProperty("securerandom.drbg.config", old); + } + if (!pass) { + throw new RuntimeException("At least one test case failed"); } } } diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java --- a/jdk/test/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java Fri Sep 02 02:41:37 2016 +0000 @@ -30,12 +30,13 @@ /* * @test - * @bug 7113275 + * @bug 7113275 8164846 * @summary compatibility issue with MD2 trust anchor and old X509TrustManager - * @run main/othervm TrustTrustedCert PKIX TLSv1.1 - * @run main/othervm TrustTrustedCert SunX509 TLSv1.1 - * @run main/othervm TrustTrustedCert PKIX TLSv1.2 - * @run main/othervm TrustTrustedCert SunX509 TLSv1.2 + * @run main/othervm TrustTrustedCert PKIX TLSv1.1 true + * @run main/othervm TrustTrustedCert PKIX TLSv1.1 false + * @run main/othervm TrustTrustedCert SunX509 TLSv1.1 false + * @run main/othervm TrustTrustedCert PKIX TLSv1.2 false + * @run main/othervm TrustTrustedCert SunX509 TLSv1.2 false */ import java.net.*; @@ -181,23 +182,32 @@ Thread.sleep(50); } - SSLContext context = generateSSLContext(); - SSLSocketFactory sslsf = context.getSocketFactory(); + SSLSocket sslSocket = null; + try { + SSLContext context = generateSSLContext(); + SSLSocketFactory sslsf = context.getSocketFactory(); - SSLSocket sslSocket = - (SSLSocket)sslsf.createSocket("localhost", serverPort); + sslSocket = (SSLSocket)sslsf.createSocket("localhost", serverPort); - // enable the specified TLS protocol - sslSocket.setEnabledProtocols(new String[] {tlsProtocol}); + // enable the specified TLS protocol + sslSocket.setEnabledProtocols(new String[] {tlsProtocol}); - InputStream sslIS = sslSocket.getInputStream(); - OutputStream sslOS = sslSocket.getOutputStream(); - - sslOS.write('B'); - sslOS.flush(); - sslIS.read(); - - sslSocket.close(); + InputStream sslIS = sslSocket.getInputStream(); + OutputStream sslOS = sslSocket.getOutputStream(); + sslOS.write('B'); + sslOS.flush(); + sslIS.read(); + } catch (SSLHandshakeException e) { + // focus in on the CertPathValidatorException + Throwable t = e.getCause().getCause(); + if ((t == null) || (expectFail && + !t.toString().contains("MD5withRSA"))) { + throw new RuntimeException( + "Expected to see MD5withRSA in exception output " + t); + } + } finally { + if (sslSocket != null) sslSocket.close(); + } } /* @@ -206,10 +216,13 @@ */ private static String tmAlgorithm; // trust manager private static String tlsProtocol; // trust manager + // set this flag to test context of CertificateException + private static boolean expectFail; private static void parseArguments(String[] args) { tmAlgorithm = args[0]; tlsProtocol = args[1]; + expectFail = Boolean.parseBoolean(args[2]); } private static SSLContext generateSSLContext() throws Exception { @@ -232,7 +245,7 @@ // generate the private key. PKCS8EncodedKeySpec priKeySpec = new PKCS8EncodedKeySpec( - Base64.getMimeDecoder().decode(targetPrivateKey)); + Base64.getMimeDecoder().decode(targetPrivateKey)); KeyFactory kf = KeyFactory.getInstance("RSA"); RSAPrivateKey priKey = (RSAPrivateKey)kf.generatePrivate(priKeySpec); @@ -338,9 +351,19 @@ volatile Exception clientException = null; public static void main(String[] args) throws Exception { - // MD5 is used in this test case, don't disable MD5 algorithm. - Security.setProperty("jdk.certpath.disabledAlgorithms", + /* + * Get the customized arguments. + */ + parseArguments(args); + + /* + * MD5 is used in this test case, don't disable MD5 algorithm. + * if expectFail is set, we're testing exception message + */ + if (!expectFail) { + Security.setProperty("jdk.certpath.disabledAlgorithms", "MD2, RSA keySize < 1024"); + } Security.setProperty("jdk.tls.disabledAlgorithms", "SSLv3, RC4, DH keySize < 768"); @@ -348,11 +371,6 @@ System.setProperty("javax.net.debug", "all"); /* - * Get the customized arguments. - */ - parseArguments(args); - - /* * Start the tests. */ new TrustTrustedCert(); @@ -376,7 +394,8 @@ startServer(false); } } catch (Exception e) { - // swallow for now. Show later + System.out.println("Unexpected exception: "); + e.printStackTrace(); } /* @@ -440,7 +459,11 @@ */ System.err.println("Server died..."); serverReady = true; - serverException = e; + if (!expectFail) { + // only record if we weren't expecting. + // client side will record exception + serverException = e; + } } } }; @@ -449,7 +472,11 @@ try { doServerSide(); } catch (Exception e) { - serverException = e; + // only record if we weren't expecting. + // client side will record exception + if (!expectFail) { + serverException = e; + } } finally { serverReady = true; } diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/security/tools/jarsigner/AltProvider.java --- a/jdk/test/sun/security/tools/jarsigner/AltProvider.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/security/tools/jarsigner/AltProvider.java Fri Sep 02 02:41:37 2016 +0000 @@ -25,7 +25,7 @@ * @test * @bug 4906940 8130302 * @summary -providerPath, -providerClass, -addprovider, and -providerArg - * @library /lib/testlibrary /test/lib/share/classes + * @library /lib/testlibrary /test/lib * @modules java.base/jdk.internal.misc */ diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/tools/jhsdb/BasicLauncherTest.java --- a/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/tools/jhsdb/BasicLauncherTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -24,7 +24,7 @@ /* * @test * @summary Basic test for jhsdb launcher - * @library /test/lib/share/classes + * @library /test/lib * @library /lib/testlibrary * @build jdk.testlibrary.* * @build jdk.test.lib.apps.* diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java --- a/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -37,7 +37,7 @@ * @bug 8042397 * @summary Unit test for jmap utility test heap configuration reader * @modules jdk.hotspot.agent/sun.jvm.hotspot - * @library /test/lib/share/classes + * @library /test/lib * @library /lib/testlibrary * @build jdk.testlibrary.* * @build jdk.test.lib.apps.* diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/tools/jinfo/JInfoTest.java --- a/jdk/test/sun/tools/jinfo/JInfoTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/tools/jinfo/JInfoTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -37,7 +37,7 @@ * @test * @summary Unit test for jinfo utility * @modules java.base/jdk.internal.misc - * @library /test/lib/share/classes + * @library /test/lib * @build jdk.test.lib.* * @build jdk.test.lib.apps.* * @build jdk.test.lib.process.* diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/tools/jmap/BasicJMapTest.java --- a/jdk/test/sun/tools/jmap/BasicJMapTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/tools/jmap/BasicJMapTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -37,7 +37,7 @@ * @summary Unit test for jmap utility * @key intermittent * @library /lib/testlibrary - * @library /test/lib/share/classes + * @library /test/lib * @build jdk.testlibrary.* * @build jdk.test.lib.hprof.* * @build jdk.test.lib.hprof.model.* diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/tools/jps/TestJpsSanity.java --- a/jdk/test/sun/tools/jps/TestJpsSanity.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/tools/jps/TestJpsSanity.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2016, 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 @@ -29,7 +29,7 @@ * @test * @summary This test verifies jps usage and checks that appropriate error message is shown * when running jps with illegal arguments. - * @library /lib/testlibrary /test/lib/share/classes + * @library /lib/testlibrary /test/lib * @modules jdk.jartool/sun.tools.jar * java.management * java.base/jdk.internal.misc diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/tools/jstack/DeadlockDetectionTest.java --- a/jdk/test/sun/tools/jstack/DeadlockDetectionTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/tools/jstack/DeadlockDetectionTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2016, 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 @@ -37,7 +37,7 @@ /* * @test * @summary Test deadlock detection - * @library /test/lib/share/classes + * @library /test/lib * @library /lib/testlibrary * @build jdk.testlibrary.* * @build jdk.test.lib.apps.* diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/util/calendar/zi/TestZoneInfo310.java --- a/jdk/test/sun/util/calendar/zi/TestZoneInfo310.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/util/calendar/zi/TestZoneInfo310.java Fri Sep 02 02:41:37 2016 +0000 @@ -22,11 +22,15 @@ */ /* - *@test - *@bug 8007572 8008161 - *@summary Test whether the TimeZone generated from JSR310 tzdb is the same - *as the one from the tz data from javazic + * @test + * @bug 8007572 8008161 8157792 + * @summary Test whether the TimeZone generated from JSR310 tzdb is the same + * as the one from the tz data from javazic * @modules java.base/sun.util.calendar + * @build BackEnd Checksum DayOfWeek Gen GenDoc Main Mappings Month + * Rule RuleDay RuleRec Simple TestZoneInfo310 Time Timezone + * TzIDOldMapping Zone ZoneInfoFile ZoneInfoOld ZoneRec Zoneinfo + * @run main TestZoneInfo310 */ import java.io.File; @@ -164,10 +168,6 @@ } for (String zid : zids_new) { - if (zid.equals("Asia/Oral") || zid.equals("Asia/Qyzylorda")) { - // JDK-8157792 tracking this issue - continue; - } ZoneInfoOld zi = toZoneInfoOld(TimeZone.getTimeZone(zid)); ZoneInfoOld ziOLD = (ZoneInfoOld)ZoneInfoOld.getTimeZone(zid); if (! zi.equalsTo(ziOLD)) { diff -r b079fff22b3c -r de9ff562c112 jdk/test/sun/util/calendar/zi/Zoneinfo.java --- a/jdk/test/sun/util/calendar/zi/Zoneinfo.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/sun/util/calendar/zi/Zoneinfo.java Fri Sep 02 02:41:37 2016 +0000 @@ -373,6 +373,7 @@ tz.getOffsetIndex(zrec.getGmtOffset()); int lastGmtOffsetValue = -1; + ZoneRec prevzrec = null; int currentSave = 0; boolean usedZone; for (int zindex = 0; zindex < zone.size(); zindex++) { @@ -441,6 +442,15 @@ currentSave); if (zrec.hasUntil()) { if (transition >= zrec.getUntilTime(currentSave)) { + // If the GMT offset changed from the previous one, + // record fromTime as a transition. + if (!fromTimeUsed && prevzrec != null + && gmtOffset != prevzrec.getGmtOffset()) { + tz.addTransition(fromTime, + tz.getOffsetIndex(gmtOffset+currentSave), + tz.getDstOffsetIndex(currentSave)); + fromTimeUsed = true; // for consistency + } break year_loop; } } @@ -452,8 +462,6 @@ if (fromTime != minTime) { int prevsave; - ZoneRec prevzrec = zone.get(zindex - 1); - // See if until time in the previous // ZoneRec is the same thing as the // local time in the next rule. @@ -555,6 +563,7 @@ fromYear = zrec.getUntilYear(); year = zrec.getUntilYear(); } + prevzrec = zrec; } if (tz.getDSTType() == Timezone.UNDEF_DST) { diff -r b079fff22b3c -r de9ff562c112 jdk/test/tools/jar/multiRelease/Basic.java --- a/jdk/test/tools/jar/multiRelease/Basic.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/tools/jar/multiRelease/Basic.java Fri Sep 02 02:41:37 2016 +0000 @@ -23,7 +23,7 @@ /* * @test - * @library /test/lib/share/classes + * @library /test/lib * @modules java.base/jdk.internal.misc * @build jdk.test.lib.JDKToolFinder jdk.test.lib.Platform * @run testng Basic diff -r b079fff22b3c -r de9ff562c112 jdk/test/tools/jlink/plugins/GenerateJLIClassesPluginTest.java --- a/jdk/test/tools/jlink/plugins/GenerateJLIClassesPluginTest.java Thu Sep 01 23:20:11 2016 +0000 +++ b/jdk/test/tools/jlink/plugins/GenerateJLIClassesPluginTest.java Fri Sep 02 02:41:37 2016 +0000 @@ -22,6 +22,7 @@ */ import java.nio.file.Path; +import java.util.Collection; import java.util.List; import java.util.stream.Collectors; @@ -75,7 +76,7 @@ } - private static List classFilesForSpecies(List species) { + private static List classFilesForSpecies(Collection species) { return species.stream() .map(s -> "/java.base/java/lang/invoke/BoundMethodHandle$Species_" + s + ".class") .collect(Collectors.toList());