Commit d8b1f499 by Iain Buclaw

libphobos: Merge upstream druntime 2f764ab6

Fixes hashing of complex reals, enabling testing of rt.util.typeinfo and
core.internal.hash.

Reviewed-on: https://github.com/dlang/druntime/pull/6837

libphobos/ChangeLog:

	* Makefile.in: Rebuild.
	* configure: Rebuild.
	* libdruntime/Makefile.am: Test rt.util.typeinfo and
	core.internal.convert.
	* libdruntime/Makefile.in: Rebuild.
	* src/Makefile.in: Rebuild.
	* testsuite/Makefile.in: Rebuild.
	* testsuite/libphobos.hash/test_hash.d: Update test.

From-SVN: r268755
parent e613d992
......@@ -15,7 +15,7 @@
@SET_MAKE@
# Makefile for the toplevel directory of the D Standard library.
# Copyright (C) 2006-2018 Free Software Foundation, Inc.
# Copyright (C) 2006-2019 Free Software Foundation, Inc.
#
# GCC is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -319,7 +319,6 @@ phobos_compiler_shared_flag = @phobos_compiler_shared_flag@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
......
......@@ -3,7 +3,7 @@
# Generated by GNU Autoconf 2.69 for package-unused version-unused.
#
#
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
# Copyright (C) 1992-2019 Free Software Foundation, Inc.
#
#
# This configure script is free software; the Free Software Foundation
......@@ -782,7 +782,6 @@ infodir
docdir
oldincludedir
includedir
runstatedir
localstatedir
sharedstatedir
sysconfdir
......@@ -868,7 +867,6 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
......@@ -1121,15 +1119,6 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
-runstatedir | --runstatedir | --runstatedi | --runstated \
| --runstate | --runstat | --runsta | --runst | --runs \
| --run | --ru | --r)
ac_prev=runstatedir ;;
-runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
| --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
| --run=* | --ru=* | --r=*)
runstatedir=$ac_optarg ;;
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
......@@ -1267,7 +1256,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir runstatedir
libdir localedir mandir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
......@@ -1420,7 +1409,6 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
--runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
......@@ -1580,7 +1568,7 @@ if $ac_init_version; then
package-unused configure version-unused
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
_ACEOF
......@@ -11508,7 +11496,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11511 "configure"
#line 11499 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -11614,7 +11602,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 11617 "configure"
#line 11605 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
......@@ -15578,7 +15566,7 @@ package-unused config.status version-unused
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Copyright (C) 2012 Free Software Foundation, Inc.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
......@@ -16686,8 +16674,7 @@ esac ;;
# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
#
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
# 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
# Copyright (C) 1996-2019 Free Software Foundation, Inc.
# Written by Gordon Matzigkeit, 1996
#
# This file is part of GNU Libtool.
......
cc215408bbdbc3324a95080aeef31287f663e57c
2fd957307d94b5ce89eb173910cc7f1995d99031
The first line of this file holds the git revision number of the last
merge done from the dlang/druntime repository.
......@@ -79,17 +79,8 @@ ALL_DRUNTIME_COMPILE_DSOURCES += $(DRUNTIME_DSOURCES_GENERATED)
ALL_DRUNTIME_SOURCES = $(ALL_DRUNTIME_COMPILE_DSOURCES) $(DRUNTIME_CSOURCES) \
$(DRUNTIME_SSOURCES)
REAL_DRUNTIME_TEST_LOBJECTS = $(ALL_DRUNTIME_COMPILE_DSOURCES:.d=.t.lo)
REAL_DRUNTIME_TEST_OBJECTS = $(ALL_DRUNTIME_COMPILE_DSOURCES:.d=.t.o)
# Workaround issue #
DRUNTIME_TEST_OBJECTS = $(filter-out rt/util/typeinfo.t.o \
core/internal/convert.t.o, $(REAL_DRUNTIME_TEST_OBJECTS)) \
rt/util/typeinfo.o core/internal/convert.o
DRUNTIME_TEST_LOBJECTS = $(filter-out rt/util/typeinfo.t.lo \
core/internal/convert.t.lo, $(REAL_DRUNTIME_TEST_LOBJECTS)) \
rt/util/typeinfo.lo core/internal/convert.lo
DRUNTIME_TEST_LOBJECTS = $(ALL_DRUNTIME_COMPILE_DSOURCES:.d=.t.lo)
DRUNTIME_TEST_OBJECTS = $(ALL_DRUNTIME_COMPILE_DSOURCES:.d=.t.o)
# Main library build definitions
check_PROGRAMS =
......
......@@ -232,6 +232,7 @@ private struct Float
private template FloatTraits(T) if (floatFormat!T == FloatFormat.Float)
{
enum DATASIZE = 4;
enum EXPONENT = 8;
enum MANTISSA = 23;
enum ZERO = Float(0, 0, 0);
......@@ -244,6 +245,7 @@ private template FloatTraits(T) if (floatFormat!T == FloatFormat.Float)
private template FloatTraits(T) if (floatFormat!T == FloatFormat.Double)
{
enum DATASIZE = 8;
enum EXPONENT = 11;
enum MANTISSA = 52;
enum ZERO = Float(0, 0, 0);
......@@ -256,6 +258,7 @@ private template FloatTraits(T) if (floatFormat!T == FloatFormat.Double)
private template FloatTraits(T) if (floatFormat!T == FloatFormat.Real80)
{
enum DATASIZE = 10;
enum EXPONENT = 15;
enum MANTISSA = 64;
enum ZERO = Float(0, 0, 0);
......@@ -268,6 +271,7 @@ private template FloatTraits(T) if (floatFormat!T == FloatFormat.Real80)
private template FloatTraits(T) if (floatFormat!T == FloatFormat.DoubleDouble) //Unsupported in CTFE
{
enum DATASIZE = 16;
enum EXPONENT = 11;
enum MANTISSA = 106;
enum ZERO = Float(0, 0, 0);
......@@ -280,6 +284,7 @@ private template FloatTraits(T) if (floatFormat!T == FloatFormat.DoubleDouble) /
private template FloatTraits(T) if (floatFormat!T == FloatFormat.Quadruple)
{
enum DATASIZE = 16;
enum EXPONENT = 15;
enum MANTISSA = 112;
enum ZERO = Float(0, 0, 0);
......@@ -496,8 +501,8 @@ version (unittest)
testNumberConvert!("real.min_normal/2UL^^63");
// check subnormal storage edge case for Quadruple
testNumberConvert!("real.min_normal/2UL^^56");
//testNumberConvert!("real.min_normal/19"); // XGDC: ct[0] == 0, rt[0] == 27
//testNumberConvert!("real.min_normal/17"); // XGDC: ct[0= == 128, rt[0] == 136
testNumberConvert!("real.min_normal/19");
testNumberConvert!("real.min_normal/17");
/**Test imaginary values: convert algorithm is same with real values*/
testNumberConvert!("0.0Fi");
......@@ -505,8 +510,8 @@ version (unittest)
testNumberConvert!("0.0Li");
/**True random values*/
//testNumberConvert!("-0x9.0f7ee55df77618fp-13829L"); //XGDC: ct[0,1] == [0,96], rt[0,1] == [143,97]
//testNumberConvert!("0x7.36e6e2640120d28p+8797L"); // XGDC: ct[0,1] == [0,24], rt[0,1] == [80,26]
testNumberConvert!("-0x9.0f7ee55df77618fp-13829L");
testNumberConvert!("0x7.36e6e2640120d28p+8797L");
testNumberConvert!("-0x1.05df6ce4702ccf8p+15835L");
testNumberConvert!("0x9.54bb0d88806f714p-7088L");
......@@ -567,6 +572,11 @@ template floatFormat(T) if (is(T:real) || is(T:ireal))
}
package template floatSize(T) if (is(T:real) || is(T:ireal))
{
enum floatSize = FloatTraits!(T).DATASIZE;
}
// all toUbyte functions must be evaluable at compile time
@trusted pure nothrow @nogc
const(ubyte)[] toUbyte(T)(const T[] arr) if (T.sizeof == 1)
......
......@@ -354,6 +354,8 @@ size_t hashOf(T)(scope const T val, size_t seed = 0) if (!is(T == enum) && __tra
{
static if (__traits(isFloating, val))
{
import core.internal.convert : floatSize;
static if (floatCoalesceZeroes || floatCoalesceNaNs)
{
import core.internal.traits : Unqual;
......@@ -381,7 +383,23 @@ size_t hashOf(T)(scope const T val, size_t seed = 0) if (!is(T == enum) && __tra
else static if (T.mant_dig == double.mant_dig && T.sizeof == ulong.sizeof)
return hashOf(*cast(const ulong*) &data, seed);
else
return bytesHashWithExactSizeAndAlignment!T(toUbyte(data), seed);
{
static if (is(T : creal) && T.sizeof != 2 * floatSize!(typeof(T.re)))
{
auto h1 = hashOf(data.re);
return hashOf(data.im, h1);
}
else static if (is(T : real) || is(T : ireal))
{
// Ignore trailing padding
auto bytes = toUbyte(data)[0 .. floatSize!T];
return bytesHashWithExactSizeAndAlignment!T(bytes, seed);
}
else
{
return bytesHashWithExactSizeAndAlignment!T(toUbyte(data), seed);
}
}
}
else
{
......
......@@ -610,7 +610,6 @@ phobos_compiler_shared_flag = @phobos_compiler_shared_flag@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
......
......@@ -265,7 +265,6 @@ phobos_compiler_shared_flag = @phobos_compiler_shared_flag@
prefix = @prefix@
program_transform_name = @program_transform_name@
psdir = @psdir@
runstatedir = @runstatedir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
srcdir = @srcdir@
......
# Copyright (C) 2018 Free Software Foundation, Inc.
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......
# Copyright (C) 2018 Free Software Foundation, Inc.
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......
......@@ -532,7 +532,7 @@ void pr2243()
assert(tih26 == rth26);
assert(tih27 == rth27);
assert(tih28 == rth28);
//assert(tih29 == rth29); // XGDC: Implementation wrongly hashes padding.
assert(tih29 == rth29);
assert(tih30 == rth30);
assert(tih31 == rth31);
assert(tih32 == rth32);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment