Skip to content

Commit a9d46f3

Browse files
Alexey PavlyutkinYuri Nesterenko
Alexey Pavlyutkin
authored and
Yuri Nesterenko
committedJun 8, 2022
8287894: Use fixed timestamp as an alternative of __DATE__ macro in jdk.jdi to make Windows build reproducible
Reviewed-by: erikj, ihse
1 parent 6e3e470 commit a9d46f3

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed
 

‎make/modules/jdk.jdi/Lib.gmk

+8-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#
2-
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
2+
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
33
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
#
55
# This code is free software; you can redistribute it and/or modify it
@@ -29,10 +29,16 @@ include LibCommon.gmk
2929

3030
ifeq ($(call isTargetOs, windows), true)
3131

32+
CFLAGS_LIBDT_SHMEM := $(CFLAGS_JDKLIB)
33+
34+
ifneq ($(HOTSPOT_BUILD_TIME), )
35+
CFLAGS_LIBDT_SHMEM += -DSHMEM_BUILD_TIME='"$(HOTSPOT_BUILD_TIME)"'
36+
endif
37+
3238
$(eval $(call SetupJdkLibrary, BUILD_LIBDT_SHMEM, \
3339
NAME := dt_shmem, \
3440
OPTIMIZATION := LOW, \
35-
CFLAGS := $(CFLAGS_JDKLIB), \
41+
CFLAGS := $(CFLAGS_LIBDT_SHMEM), \
3642
EXTRA_HEADER_DIRS := \
3743
jdk.jdwp.agent:include \
3844
jdk.jdwp.agent:libjdwp/export, \

‎src/jdk.jdi/share/native/libdt_shmem/shmemBase.h

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -49,11 +49,15 @@ jint shmemBase_receivePacket(SharedMemoryConnection *, jdwpPacket *packet);
4949
jint shmemBase_name(SharedMemoryTransport *, char **name);
5050
jint shmemBase_getlasterror(char *msg, jint size);
5151

52+
#ifndef SHMEM_BUILD_TIME
53+
#define SHMEM_BUILD_TIME __DATE__
54+
#endif
55+
5256
#ifdef DEBUG
5357
#define SHMEM_ASSERT(expression) \
5458
do { \
5559
if (!(expression)) { \
56-
exitTransportWithError("assertion failed", __FILE__, __DATE__, __LINE__); \
60+
exitTransportWithError("assertion failed", __FILE__, SHMEM_BUILD_TIME, __LINE__); \
5761
} \
5862
} while (0)
5963
#else
@@ -63,7 +67,7 @@ do { \
6367
#define SHMEM_GUARANTEE(expression) \
6468
do { \
6569
if (!(expression)) { \
66-
exitTransportWithError("assertion failed", __FILE__, __DATE__, __LINE__); \
70+
exitTransportWithError("assertion failed", __FILE__, SHMEM_BUILD_TIME, __LINE__); \
6771
} \
6872
} while (0)
6973

‎src/jdk.jdi/windows/native/libdt_shmem/shmem_md.c

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -39,12 +39,16 @@
3939

4040
static HANDLE memHandle = NULL;
4141

42+
#ifndef SHMEM_BUILD_TIME
43+
#define SHMEM_BUILD_TIME __DATE__
44+
#endif
45+
4246
#ifdef DEBUG
4347
#define sysAssert(expression) { \
4448
if (!(expression)) { \
4549
exitTransportWithError \
4650
("\"%s\", line %d: assertion failure\n", \
47-
__FILE__, __DATE__, __LINE__); \
51+
__FILE__, SHMEM_BUILD_TIME, __LINE__); \
4852
} \
4953
}
5054
#else

0 commit comments

Comments
 (0)
Please sign in to comment.