Skip to content

Commit

Permalink
Merge master jdk-11.0.24+8 into openj9-staging
Browse files Browse the repository at this point in the history
Signed-off-by: J9 Build <[email protected]>
  • Loading branch information
j9build committed Jul 17, 2024
2 parents 3024b8f + b57f96e commit 4d7d1ee
Show file tree
Hide file tree
Showing 15 changed files with 266 additions and 128 deletions.
2 changes: 1 addition & 1 deletion make/autoconf/flags-cflags.m4
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
TOOLCHAIN_CFLAGS="-errshort=tags"
TOOLCHAIN_CFLAGS_JDK="-mt $TOOLCHAIN_FLAGS"
TOOLCHAIN_CFLAGS_JDK_CONLY="-xc99=%none -xCC -Xa -W0,-noglobal $TOOLCHAIN_CFLAGS" # C only
TOOLCHAIN_CFLAGS_JDK_CONLY="-xCC -Xa -W0,-noglobal $TOOLCHAIN_CFLAGS" # C only
TOOLCHAIN_CFLAGS_JDK_CXXONLY="-features=no%except -norunpath -xnolib" # CXX only
TOOLCHAIN_CFLAGS_JVM="-template=no%extdef -features=no%split_init \
-library=stlport4 -mt -features=no%except $TOOLCHAIN_FLAGS"
Expand Down
4 changes: 2 additions & 2 deletions make/autoconf/version-numbers
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2024, 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
Expand Down Expand Up @@ -37,7 +37,7 @@ DEFAULT_VERSION_DATE=2024-07-16
DEFAULT_VERSION_CLASSFILE_MAJOR=55 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`"
DEFAULT_VERSION_CLASSFILE_MINOR=0
DEFAULT_ACCEPTABLE_BOOT_VERSIONS="10 11"
DEFAULT_PROMOTED_VERSION_PRE=ea
DEFAULT_PROMOTED_VERSION_PRE=

LAUNCHER_NAME=openjdk
PRODUCT_NAME=OpenJDK
Expand Down
4 changes: 1 addition & 3 deletions make/lib/Awt2dLibraries.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,6 @@ endif
# The fast floor code loses precision.
LCMS_CFLAGS=-DCMS_DONT_USE_FAST_FLOOR

LCMS_CFLAGS_JDKLIB := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB))

ifeq ($(USE_EXTERNAL_LCMS), true)
# If we're using an external library, we'll just need the wrapper part.
# By including it explicitly, all other files will be excluded.
Expand All @@ -382,7 +380,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBLCMS, \
NAME := lcms, \
INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
OPTIMIZATION := HIGHEST, \
CFLAGS := $(LCMS_CFLAGS_JDKLIB) \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LCMS_CFLAGS), \
CFLAGS_solaris := -xc99=no_lib, \
CFLAGS_windows := -DCMS_IS_WINDOWS_, \
Expand Down
42 changes: 24 additions & 18 deletions src/java.desktop/share/classes/sun/java2d/SunGraphics2D.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2024, 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
Expand Down Expand Up @@ -2153,27 +2153,33 @@ private void doCopyArea(int x, int y, int w, int h, int dx, int dy) {
}

Blit ob = lastCAblit;
if (dy == 0 && dx > 0 && dx < w) {
while (w > 0) {
int partW = Math.min(w, dx);
w -= partW;
int sx = x + w;
ob.Blit(theData, theData, comp, clip,
sx, y, sx+dx, y+dy, partW, h);
try {
if (dy == 0 && dx > 0 && dx < w) {
while (w > 0) {
int partW = Math.min(w, dx);
w -= partW;
int sx = Math.addExact(x, w);
ob.Blit(theData, theData, comp, clip,
sx, y, sx+dx, y+dy, partW, h);
}
return;
}
return;
}
if (dy > 0 && dy < h && dx > -w && dx < w) {
while (h > 0) {
int partH = Math.min(h, dy);
h -= partH;
int sy = y + h;
ob.Blit(theData, theData, comp, clip,
x, sy, x+dx, sy+dy, w, partH);
if (dy > 0 && dy < h && dx > -w && dx < w) {
while (h > 0) {
int partH = Math.min(h, dy);
h -= partH;
int sy = Math.addExact(y, h);
ob.Blit(theData, theData, comp, clip,
x, sy, Math.addExact(x, dx), sy+dy, w, partH);
}
return;
}
ob.Blit(theData, theData, comp, clip, x, y,
Math.addExact(x, dx), Math.addExact(y, dy), w, h);
} catch (ArithmeticException ex) {
// We are hitting integer overflow in Math.addExact()
return;
}
ob.Blit(theData, theData, comp, clip, x, y, x+dx, y+dy, w, h);
}

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2024, 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
Expand Down Expand Up @@ -367,6 +367,13 @@ protected void renderImageXform(SunGraphics2D sg, Image img,
final AffineTransform itx;
try {
itx = tx.createInverse();
double[] mat = new double[6];
itx.getMatrix(mat);
for (double d : mat) {
if (!Double.isFinite(d)) {
return;
}
}
} catch (final NoninvertibleTransformException ignored) {
// Non-invertible transform means no output
return;
Expand Down
11 changes: 10 additions & 1 deletion src/java.desktop/share/native/libawt/java2d/SurfaceData.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2024, 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
Expand Down Expand Up @@ -32,6 +32,7 @@
#define _Included_SurfaceData

#include <jni.h>
#include <limits.h>

#ifdef __cplusplus
extern "C" {
Expand All @@ -53,6 +54,14 @@ typedef struct {

#define SD_RASINFO_PRIVATE_SIZE 64

#define UNSAFE_TO_ADD(a, b) \
(((a >= 0) && (b >= 0) && (a > (INT_MAX - b))) || \
((a < 0) && (b < 0) && (a < (INT_MIN - b)))) \

#define UNSAFE_TO_SUB(a, b) \
(((b >= 0) && (a < 0) && (a < (INT_MIN + b))) || \
((b < 0) && (a >= 0) && (-b > (INT_MAX - a)))) \

/*
* The SurfaceDataRasInfo structure is used to pass in and return various
* pieces of information about the destination drawable. In particular:
Expand Down
16 changes: 15 additions & 1 deletion src/java.desktop/share/native/libawt/java2d/loops/MaskBlit.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2024, 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
Expand Down Expand Up @@ -68,14 +68,28 @@ Java_sun_java2d_loops_MaskBlit_MaskBlit
return;
}

if (width <= 0 || height <= 0) {
return;
}

srcInfo.bounds.x1 = srcx;
srcInfo.bounds.y1 = srcy;
if (UNSAFE_TO_ADD(srcx, width) ||
UNSAFE_TO_ADD(srcy, height) ||
UNSAFE_TO_ADD(dstx, width) ||
UNSAFE_TO_ADD(dsty, height)) {
return;
}
srcInfo.bounds.x2 = srcx + width;
srcInfo.bounds.y2 = srcy + height;
dstInfo.bounds.x1 = dstx;
dstInfo.bounds.y1 = dsty;
dstInfo.bounds.x2 = dstx + width;
dstInfo.bounds.y2 = dsty + height;
if (UNSAFE_TO_SUB(srcx, dstx) ||
UNSAFE_TO_SUB(srcy, dsty)) {
return;
}
srcx -= dstx;
srcy -= dsty;
SurfaceData_IntersectBounds(&dstInfo.bounds, &clipInfo.bounds);
Expand Down
16 changes: 8 additions & 8 deletions src/java.desktop/share/native/libawt/java2d/loops/MaskFill.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2024, 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
Expand Down Expand Up @@ -467,7 +467,7 @@ storePgram(EdgeInfo *pLeftEdge, EdgeInfo *pRightEdge,
#define INSERT_ACCUM(pACCUM, IMIN, IMAX, X0, Y0, X1, Y1, CX1, CX2, MULT) \
do { \
jdouble xmid = ((X0) + (X1)) * 0.5; \
if (xmid <= (CX2)) { \
if (xmid < (CX2)) { \
jdouble sliceh = ((Y1) - (Y0)); \
jdouble slicearea; \
jint i; \
Expand Down Expand Up @@ -556,7 +556,7 @@ fillAAPgram(NativePrimitive *pPrim, SurfaceDataRasInfo *pRasInfo,
jint cy2 = pRasInfo->bounds.y2;
jint width = cx2 - cx1;
EdgeInfo edges[4];
jfloat localaccum[MASK_BUF_LEN + 1];
jfloat localaccum[MASK_BUF_LEN + 2];
jfloat *pAccum;

if (!storePgram(edges + 0, edges + 2,
Expand All @@ -568,12 +568,12 @@ fillAAPgram(NativePrimitive *pPrim, SurfaceDataRasInfo *pRasInfo,
}

pAccum = ((width > MASK_BUF_LEN)
? malloc((width + 1) * sizeof(jfloat))
? malloc((width + 2) * sizeof(jfloat))
: localaccum);
if (pAccum == NULL) {
return;
}
memset(pAccum, 0, (width+1) * sizeof(jfloat));
memset(pAccum, 0, (width + 2) * sizeof(jfloat));

while (cy1 < cy2) {
jint lmin, lmax, rmin, rmax;
Expand Down Expand Up @@ -794,7 +794,7 @@ drawAAPgram(NativePrimitive *pPrim, SurfaceDataRasInfo *pRasInfo,
jint cy2 = pRasInfo->bounds.y2;
jint width = cx2 - cx1;
EdgeInfo edges[8];
jfloat localaccum[MASK_BUF_LEN + 1];
jfloat localaccum[MASK_BUF_LEN + 2];
jfloat *pAccum;

if (!storePgram(edges + 0, edges + 6,
Expand All @@ -815,12 +815,12 @@ drawAAPgram(NativePrimitive *pPrim, SurfaceDataRasInfo *pRasInfo,
JNI_TRUE);

pAccum = ((width > MASK_BUF_LEN)
? malloc((width + 1) * sizeof(jfloat))
? malloc((width + 2) * sizeof(jfloat))
: localaccum);
if (pAccum == NULL) {
return;
}
memset(pAccum, 0, (width+1) * sizeof(jfloat));
memset(pAccum, 0, (width + 2) * sizeof(jfloat));

while (cy1 < cy2) {
jint lmin, lmax, rmin, rmax;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2004, 2024, 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
Expand Down Expand Up @@ -120,7 +120,7 @@ TransformInterpFunc *pBicubicFunc = BicubicInterp;
/* We reject coordinates not less than 1<<30 so that the distance between */
/* any 2 of them is less than 1<<31 which would overflow into the sign */
/* bit of a signed long value used to represent fixed point coordinates. */
#define TX_FIXED_UNSAFE(v) (fabs(v) >= (1<<30))
#define TX_FIXED_UNSAFE(v) (isinf(v) || isnan(v) || fabs(v) >= (1<<30))
static jboolean
checkOverflow(jint dxoff, jint dyoff,
SurfaceDataBounds *pBounds,
Expand Down
6 changes: 3 additions & 3 deletions src/jdk.pack/share/native/common-unpack/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ extern int assert_failed(const char*);

#define lengthof(array) (sizeof(array)/sizeof(array[0]))

#define NEW(T, n) (T*) must_malloc((int)(scale_size(n, sizeof(T))))
#define U_NEW(T, n) (T*) u->alloc(scale_size(n, sizeof(T)))
#define T_NEW(T, n) (T*) u->temp_alloc(scale_size(n, sizeof(T)))
#define NEW(T, n) (T*) must_calloc(n, sizeof(T))
#define U_NEW(T, n) (T*) u->calloc(n, sizeof(T))
#define T_NEW(T, n) (T*) u->temp_calloc(n, sizeof(T))

// Dealing with big-endian arch
#ifdef _BIG_ENDIAN
Expand Down
Loading

0 comments on commit 4d7d1ee

Please sign in to comment.