Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8287894: Use fixed timestamp as an alternative of __DATE__ macro in j…
…dk.jdi to make Windows build reproducible

Reviewed-by: erikj, ihse
  • Loading branch information
Alexey Pavlyutkin authored and Yuri Nesterenko committed Jun 8, 2022
1 parent 6e3e470 commit a9d46f3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
10 changes: 8 additions & 2 deletions make/modules/jdk.jdi/Lib.gmk
@@ -1,5 +1,5 @@
#
# Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2022, 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 @@ -29,10 +29,16 @@ include LibCommon.gmk

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

CFLAGS_LIBDT_SHMEM := $(CFLAGS_JDKLIB)

ifneq ($(HOTSPOT_BUILD_TIME), )
CFLAGS_LIBDT_SHMEM += -DSHMEM_BUILD_TIME='"$(HOTSPOT_BUILD_TIME)"'
endif

$(eval $(call SetupJdkLibrary, BUILD_LIBDT_SHMEM, \
NAME := dt_shmem, \
OPTIMIZATION := LOW, \
CFLAGS := $(CFLAGS_JDKLIB), \
CFLAGS := $(CFLAGS_LIBDT_SHMEM), \
EXTRA_HEADER_DIRS := \
jdk.jdwp.agent:include \
jdk.jdwp.agent:libjdwp/export, \
Expand Down
10 changes: 7 additions & 3 deletions src/jdk.jdi/share/native/libdt_shmem/shmemBase.h
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2022, 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 @@ -49,11 +49,15 @@ jint shmemBase_receivePacket(SharedMemoryConnection *, jdwpPacket *packet);
jint shmemBase_name(SharedMemoryTransport *, char **name);
jint shmemBase_getlasterror(char *msg, jint size);

#ifndef SHMEM_BUILD_TIME
#define SHMEM_BUILD_TIME __DATE__
#endif

#ifdef DEBUG
#define SHMEM_ASSERT(expression) \
do { \
if (!(expression)) { \
exitTransportWithError("assertion failed", __FILE__, __DATE__, __LINE__); \
exitTransportWithError("assertion failed", __FILE__, SHMEM_BUILD_TIME, __LINE__); \
} \
} while (0)
#else
Expand All @@ -63,7 +67,7 @@ do { \
#define SHMEM_GUARANTEE(expression) \
do { \
if (!(expression)) { \
exitTransportWithError("assertion failed", __FILE__, __DATE__, __LINE__); \
exitTransportWithError("assertion failed", __FILE__, SHMEM_BUILD_TIME, __LINE__); \
} \
} while (0)

Expand Down
8 changes: 6 additions & 2 deletions src/jdk.jdi/windows/native/libdt_shmem/shmem_md.c
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2022, 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 @@ -39,12 +39,16 @@

static HANDLE memHandle = NULL;

#ifndef SHMEM_BUILD_TIME
#define SHMEM_BUILD_TIME __DATE__
#endif

#ifdef DEBUG
#define sysAssert(expression) { \
if (!(expression)) { \
exitTransportWithError \
("\"%s\", line %d: assertion failure\n", \
__FILE__, __DATE__, __LINE__); \
__FILE__, SHMEM_BUILD_TIME, __LINE__); \
} \
}
#else
Expand Down

0 comments on commit a9d46f3

Please sign in to comment.