mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 03:47:02 -05:00
d: Merge upstream dmd, druntime 53a1cc8d13
D front-end changes: - Typesafe variadic class parameters have been deprecated. D runtime changes: - Added `entry' field to TypeInfo_AssociativeArray. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 53a1cc8d13. * d-tree.h (create_typeinfo): Change second parameter to Scope *. (speculative_type_p): Remove prototype. * d-frontend.cc (getTypeInfoType): Adjust. * decl.cc: Include dmd/typinf.h. (DeclVisitor::visit (TypeInfoDeclaration *)): Update for new front-end interface. * typeinfo.cc (create_typeinfo): Likewise. (class SpeculativeTypeVisitor): Remove class. (speculative_type_p): Remove function. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 53a1cc8d13. gcc/testsuite/ChangeLog: * gdc.dg/pr100967.d: Adjust error message.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
ffbad272b649b7ae3e88cfdc85688bfef3168994
|
||||
53a1cc8d13e8db2cb1642219320a8dfc1b0cc6c5
|
||||
|
||||
The first line of this file holds the git revision number of the last
|
||||
merge done from the dlang/dmd repository.
|
||||
|
||||
@@ -52,7 +52,7 @@ version (D_ProfileGC)
|
||||
/**
|
||||
* TraceGC wrapper around $(REF _d_arrayappendT, core,internal,array,appending).
|
||||
*/
|
||||
ref Tarr _d_arrayappendcTXTrace(Tarr : T[], T)(string file, int line, string funcname, return ref scope Tarr px, size_t n) @trusted
|
||||
ref Tarr _d_arrayappendcTXTrace(Tarr : T[], T)(return ref scope Tarr px, size_t n, string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
|
||||
{
|
||||
version (D_TypeInfo)
|
||||
{
|
||||
@@ -115,7 +115,7 @@ version (D_ProfileGC)
|
||||
/**
|
||||
* TraceGC wrapper around $(REF _d_arrayappendT, core,internal,array,appending).
|
||||
*/
|
||||
ref Tarr _d_arrayappendTTrace(Tarr : T[], T)(string file, int line, string funcname, return ref scope Tarr x, scope Tarr y) @trusted
|
||||
ref Tarr _d_arrayappendTTrace(Tarr : T[], T)(return ref scope Tarr x, scope Tarr y, string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
|
||||
{
|
||||
version (D_TypeInfo)
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ Tret _d_arraycatnTX(Tret, Tarr...)(auto ref Tarr froms) @trusted
|
||||
{
|
||||
// TODO: forward file, line, name from _d_arraycatnTXTrace
|
||||
_d_arraysetlengthTImpl!(typeof(res))._d_arraysetlengthTTrace(
|
||||
__FILE__, __LINE__, "_d_arraycatnTX", res, totalLen);
|
||||
res, totalLen, __FILE__, __LINE__, __FUNCTION__);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -178,7 +178,7 @@ version (D_ProfileGC)
|
||||
/**
|
||||
* TraceGC wrapper around $(REF _d_arraycatnTX, core,internal,array,concatenation).
|
||||
*/
|
||||
Tret _d_arraycatnTXTrace(Tret, Tarr...)(string file, int line, string funcname, scope auto ref Tarr froms) @trusted
|
||||
Tret _d_arraycatnTXTrace(Tret, Tarr...)(scope auto ref Tarr froms, string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
|
||||
{
|
||||
version (D_TypeInfo)
|
||||
{
|
||||
|
||||
@@ -470,7 +470,7 @@ version (D_ProfileGC)
|
||||
/**
|
||||
* TraceGC wrapper around $(REF _d_newitemT, core,lifetime).
|
||||
*/
|
||||
T[] _d_newarrayTTrace(T)(string file, int line, string funcname, size_t length, bool isShared) @trusted
|
||||
T[] _d_newarrayTTrace(T)(size_t length, bool isShared, string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
|
||||
{
|
||||
version (D_TypeInfo)
|
||||
{
|
||||
@@ -602,7 +602,7 @@ version (D_ProfileGC)
|
||||
/**
|
||||
* TraceGC wrapper around $(REF _d_newarraymT, core,internal,array,construction).
|
||||
*/
|
||||
Tarr _d_newarraymTXTrace(Tarr : U[], T, U)(string file, int line, string funcname, size_t[] dims, bool isShared=false) @trusted
|
||||
Tarr _d_newarraymTXTrace(Tarr : U[], T, U)(size_t[] dims, bool isShared=false, string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
|
||||
{
|
||||
version (D_TypeInfo)
|
||||
{
|
||||
|
||||
@@ -53,18 +53,6 @@ version (D_ProfileGC)
|
||||
string name = } ~ "`" ~ Type ~ "`;" ~ q{
|
||||
|
||||
// FIXME: use rt.tracegc.accumulator when it is accessable in the future.
|
||||
version (tracegc)
|
||||
} ~ "{\n" ~ q{
|
||||
import core.stdc.stdio : printf;
|
||||
|
||||
printf("%sTrace file = '%.*s' line = %d function = '%.*s' type = %.*s\n",
|
||||
} ~ "\"" ~ Hook ~ "\".ptr," ~ q{
|
||||
file.length, file.ptr,
|
||||
line,
|
||||
funcname.length, funcname.ptr,
|
||||
name.length, name.ptr
|
||||
);
|
||||
} ~ "}\n" ~ q{
|
||||
ulong currentlyAllocated = gcStatsPure().allocatedInCurrentThread;
|
||||
|
||||
scope(exit)
|
||||
@@ -99,7 +87,7 @@ version (D_ProfileGC)
|
||||
* purity, and throwabilty checks. To prevent breaking existing code, this function template
|
||||
* is temporarily declared `@trusted pure` until the implementation can be brought up to modern D expectations.
|
||||
*/
|
||||
auto _d_HookTraceImpl(T, alias Hook, string errorMessage)(string file, int line, string funcname, Parameters!Hook parameters) @trusted pure
|
||||
auto _d_HookTraceImpl(T, alias Hook, string errorMessage)(Parameters!Hook parameters, string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted pure
|
||||
{
|
||||
version (D_TypeInfo)
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ struct Impl
|
||||
Bucket[] buckets;
|
||||
uint used;
|
||||
uint deleted;
|
||||
TypeInfo_Struct entryTI;
|
||||
const(TypeInfo) entryTI;
|
||||
uint firstUsed;
|
||||
immutable uint keysz;
|
||||
immutable uint valsz;
|
||||
@@ -75,15 +75,6 @@ private size_t mix(size_t h) @safe pure nothrow @nogc
|
||||
return h;
|
||||
}
|
||||
|
||||
struct Entry(K, V)
|
||||
{
|
||||
// can make this const, because we aren't really going to use it aside from
|
||||
// construction.
|
||||
const K key;
|
||||
V value;
|
||||
}
|
||||
|
||||
|
||||
// create a binary-compatible AA structure that can be used directly as an
|
||||
// associative array.
|
||||
// NOTE: this must only be called during CTFE
|
||||
@@ -92,7 +83,7 @@ AAShell makeAA(K, V)(V[K] src) @trusted
|
||||
assert(__ctfe, "makeAA Must only be called at compile time");
|
||||
immutable srclen = src.length;
|
||||
assert(srclen <= uint.max);
|
||||
alias E = Entry!(K, V);
|
||||
alias E = TypeInfo_AssociativeArray.Entry!(K, V);
|
||||
if (srclen == 0)
|
||||
return AAShell.init;
|
||||
// first, determine the size that would be used if we grew the bucket list
|
||||
|
||||
@@ -2788,7 +2788,7 @@ if (is(T == class))
|
||||
/**
|
||||
* TraceGC wrapper around $(REF _d_newclassT, core,lifetime).
|
||||
*/
|
||||
T _d_newclassTTrace(T)(string file, int line, string funcname) @trusted
|
||||
T _d_newclassTTrace(T)(string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
|
||||
{
|
||||
version (D_TypeInfo)
|
||||
{
|
||||
@@ -2985,7 +2985,7 @@ version (D_ProfileGC)
|
||||
/**
|
||||
* TraceGC wrapper around $(REF _d_newitemT, core,lifetime).
|
||||
*/
|
||||
T* _d_newitemTTrace(T)(string file, int line, string funcname) @trusted
|
||||
T* _d_newitemTTrace(T)(string file = __FILE__, int line = __LINE__, string funcname = __FUNCTION__) @trusted
|
||||
{
|
||||
version (D_TypeInfo)
|
||||
{
|
||||
|
||||
@@ -670,3 +670,8 @@ package(core) template muslRedirTime64Mangle(string name, string redirectedName)
|
||||
else
|
||||
enum muslRedirTime64Mangle = name;
|
||||
}
|
||||
|
||||
version (PPC64)
|
||||
enum PPCUseIEEE128 = real.mant_dig == 113;
|
||||
else
|
||||
enum PPCUseIEEE128 = false;
|
||||
|
||||
@@ -4284,404 +4284,651 @@ else
|
||||
double acos(double x);
|
||||
///
|
||||
float acosf(float x);
|
||||
///
|
||||
real acosl(real x);
|
||||
|
||||
///
|
||||
double asin(double x);
|
||||
///
|
||||
float asinf(float x);
|
||||
///
|
||||
real asinl(real x);
|
||||
|
||||
///
|
||||
pure double atan(double x);
|
||||
///
|
||||
pure float atanf(float x);
|
||||
///
|
||||
pure real atanl(real x);
|
||||
|
||||
///
|
||||
double atan2(double y, double x);
|
||||
///
|
||||
float atan2f(float y, float x);
|
||||
///
|
||||
real atan2l(real y, real x);
|
||||
|
||||
///
|
||||
pure double cos(double x);
|
||||
///
|
||||
pure float cosf(float x);
|
||||
///
|
||||
pure real cosl(real x);
|
||||
|
||||
///
|
||||
pure double sin(double x);
|
||||
///
|
||||
pure float sinf(float x);
|
||||
///
|
||||
pure real sinl(real x);
|
||||
|
||||
///
|
||||
pure double tan(double x);
|
||||
///
|
||||
pure float tanf(float x);
|
||||
///
|
||||
pure real tanl(real x);
|
||||
|
||||
///
|
||||
double acosh(double x);
|
||||
///
|
||||
float acoshf(float x);
|
||||
///
|
||||
real acoshl(real x);
|
||||
|
||||
///
|
||||
pure double asinh(double x);
|
||||
///
|
||||
pure float asinhf(float x);
|
||||
///
|
||||
pure real asinhl(real x);
|
||||
|
||||
///
|
||||
double atanh(double x);
|
||||
///
|
||||
float atanhf(float x);
|
||||
///
|
||||
real atanhl(real x);
|
||||
|
||||
///
|
||||
double cosh(double x);
|
||||
///
|
||||
float coshf(float x);
|
||||
///
|
||||
real coshl(real x);
|
||||
|
||||
///
|
||||
double sinh(double x);
|
||||
///
|
||||
float sinhf(float x);
|
||||
///
|
||||
real sinhl(real x);
|
||||
|
||||
///
|
||||
pure double tanh(double x);
|
||||
///
|
||||
pure float tanhf(float x);
|
||||
///
|
||||
pure real tanhl(real x);
|
||||
|
||||
///
|
||||
double exp(double x);
|
||||
///
|
||||
float expf(float x);
|
||||
///
|
||||
real expl(real x);
|
||||
|
||||
///
|
||||
double exp2(double x);
|
||||
///
|
||||
float exp2f(float x);
|
||||
///
|
||||
real exp2l(real x);
|
||||
|
||||
///
|
||||
double expm1(double x);
|
||||
///
|
||||
float expm1f(float x);
|
||||
///
|
||||
real expm1l(real x);
|
||||
|
||||
///
|
||||
pure double frexp(double value, int* exp);
|
||||
///
|
||||
pure float frexpf(float value, int* exp);
|
||||
///
|
||||
pure real frexpl(real value, int* exp);
|
||||
|
||||
///
|
||||
int ilogb(double x);
|
||||
///
|
||||
int ilogbf(float x);
|
||||
///
|
||||
int ilogbl(real x);
|
||||
|
||||
///
|
||||
double ldexp(double x, int exp);
|
||||
///
|
||||
float ldexpf(float x, int exp);
|
||||
///
|
||||
real ldexpl(real x, int exp);
|
||||
|
||||
///
|
||||
double log(double x);
|
||||
///
|
||||
float logf(float x);
|
||||
///
|
||||
real logl(real x);
|
||||
|
||||
///
|
||||
double log10(double x);
|
||||
///
|
||||
float log10f(float x);
|
||||
///
|
||||
real log10l(real x);
|
||||
|
||||
///
|
||||
double log1p(double x);
|
||||
///
|
||||
float log1pf(float x);
|
||||
///
|
||||
real log1pl(real x);
|
||||
|
||||
///
|
||||
double log2(double x);
|
||||
///
|
||||
float log2f(float x);
|
||||
///
|
||||
real log2l(real x);
|
||||
|
||||
///
|
||||
double logb(double x);
|
||||
///
|
||||
float logbf(float x);
|
||||
///
|
||||
real logbl(real x);
|
||||
|
||||
///
|
||||
pure double modf(double value, double* iptr);
|
||||
///
|
||||
pure float modff(float value, float* iptr);
|
||||
///
|
||||
pure real modfl(real value, real *iptr);
|
||||
|
||||
///
|
||||
double scalbn(double x, int n);
|
||||
///
|
||||
float scalbnf(float x, int n);
|
||||
///
|
||||
real scalbnl(real x, int n);
|
||||
|
||||
///
|
||||
double scalbln(double x, c_long n);
|
||||
///
|
||||
float scalblnf(float x, c_long n);
|
||||
///
|
||||
real scalblnl(real x, c_long n);
|
||||
|
||||
///
|
||||
pure double cbrt(double x);
|
||||
///
|
||||
pure float cbrtf(float x);
|
||||
///
|
||||
pure real cbrtl(real x);
|
||||
|
||||
///
|
||||
pure double fabs(double x);
|
||||
version (CRuntime_Microsoft)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
pure float fabsf(float x);
|
||||
///
|
||||
pure real fabsl(real x);
|
||||
}
|
||||
|
||||
///
|
||||
double hypot(double x, double y);
|
||||
///
|
||||
float hypotf(float x, float y);
|
||||
///
|
||||
real hypotl(real x, real y);
|
||||
|
||||
///
|
||||
double pow(double x, double y);
|
||||
///
|
||||
float powf(float x, float y);
|
||||
///
|
||||
real powl(real x, real y);
|
||||
|
||||
///
|
||||
double sqrt(double x);
|
||||
///
|
||||
float sqrtf(float x);
|
||||
///
|
||||
real sqrtl(real x);
|
||||
|
||||
///
|
||||
pure double erf(double x);
|
||||
///
|
||||
pure float erff(float x);
|
||||
///
|
||||
pure real erfl(real x);
|
||||
|
||||
///
|
||||
double erfc(double x);
|
||||
///
|
||||
float erfcf(float x);
|
||||
///
|
||||
real erfcl(real x);
|
||||
|
||||
///
|
||||
double lgamma(double x);
|
||||
///
|
||||
float lgammaf(float x);
|
||||
///
|
||||
real lgammal(real x);
|
||||
|
||||
///
|
||||
double tgamma(double x);
|
||||
///
|
||||
float tgammaf(float x);
|
||||
///
|
||||
real tgammal(real x);
|
||||
|
||||
///
|
||||
pure double ceil(double x);
|
||||
///
|
||||
pure float ceilf(float x);
|
||||
///
|
||||
pure real ceill(real x);
|
||||
|
||||
///
|
||||
pure double floor(double x);
|
||||
///
|
||||
pure float floorf(float x);
|
||||
///
|
||||
pure real floorl(real x);
|
||||
|
||||
///
|
||||
pure double nearbyint(double x);
|
||||
///
|
||||
pure float nearbyintf(float x);
|
||||
///
|
||||
pure real nearbyintl(real x);
|
||||
|
||||
///
|
||||
pure double rint(double x);
|
||||
///
|
||||
pure float rintf(float x);
|
||||
///
|
||||
pure real rintl(real x);
|
||||
|
||||
///
|
||||
c_long lrint(double x);
|
||||
///
|
||||
c_long lrintf(float x);
|
||||
///
|
||||
c_long lrintl(real x);
|
||||
|
||||
///
|
||||
long llrint(double x);
|
||||
///
|
||||
long llrintf(float x);
|
||||
///
|
||||
long llrintl(real x);
|
||||
|
||||
///
|
||||
pure double round(double x);
|
||||
///
|
||||
pure float roundf(float x);
|
||||
///
|
||||
pure real roundl(real x);
|
||||
|
||||
///
|
||||
c_long lround(double x);
|
||||
///
|
||||
c_long lroundf(float x);
|
||||
///
|
||||
c_long lroundl(real x);
|
||||
|
||||
///
|
||||
long llround(double x);
|
||||
///
|
||||
long llroundf(float x);
|
||||
///
|
||||
long llroundl(real x);
|
||||
|
||||
///
|
||||
pure double trunc(double x);
|
||||
///
|
||||
pure float truncf(float x);
|
||||
///
|
||||
pure real truncl(real x);
|
||||
|
||||
///
|
||||
double fmod(double x, double y);
|
||||
///
|
||||
float fmodf(float x, float y);
|
||||
///
|
||||
real fmodl(real x, real y);
|
||||
|
||||
///
|
||||
double remainder(double x, double y);
|
||||
///
|
||||
float remainderf(float x, float y);
|
||||
///
|
||||
real remainderl(real x, real y);
|
||||
|
||||
///
|
||||
double remquo(double x, double y, int* quo);
|
||||
///
|
||||
float remquof(float x, float y, int* quo);
|
||||
///
|
||||
real remquol(real x, real y, int* quo);
|
||||
|
||||
///
|
||||
pure double copysign(double x, double y);
|
||||
///
|
||||
pure float copysignf(float x, float y);
|
||||
///
|
||||
pure real copysignl(real x, real y);
|
||||
|
||||
///
|
||||
pure double nan(char* tagp);
|
||||
///
|
||||
pure float nanf(char* tagp);
|
||||
///
|
||||
pure real nanl(char* tagp);
|
||||
|
||||
///
|
||||
double nextafter(double x, double y);
|
||||
///
|
||||
float nextafterf(float x, float y);
|
||||
///
|
||||
real nextafterl(real x, real y);
|
||||
|
||||
///
|
||||
double nexttoward(double x, real y);
|
||||
///
|
||||
float nexttowardf(float x, real y);
|
||||
///
|
||||
real nexttowardl(real x, real y);
|
||||
|
||||
///
|
||||
double fdim(double x, double y);
|
||||
///
|
||||
float fdimf(float x, float y);
|
||||
///
|
||||
real fdiml(real x, real y);
|
||||
|
||||
///
|
||||
pure double fmax(double x, double y);
|
||||
///
|
||||
pure float fmaxf(float x, float y);
|
||||
///
|
||||
pure real fmaxl(real x, real y);
|
||||
|
||||
|
||||
///
|
||||
pure double fmin(double x, double y);
|
||||
///
|
||||
pure float fminf(float x, float y);
|
||||
///
|
||||
pure real fminl(real x, real y);
|
||||
|
||||
|
||||
///
|
||||
pure double fma(double x, double y, double z);
|
||||
///
|
||||
pure float fmaf(float x, float y, float z);
|
||||
///
|
||||
pure real fmal(real x, real y, real z);
|
||||
|
||||
|
||||
static if (PPCUseIEEE128) {
|
||||
///
|
||||
real __acosieee128(real x);
|
||||
///
|
||||
alias acosl = __acosieee128;
|
||||
///
|
||||
real __asinieee128(real x);
|
||||
///
|
||||
alias asinl = __asinieee128;
|
||||
///
|
||||
pure real __atanieee128(real x);
|
||||
///
|
||||
alias atanl = __atanieee128;
|
||||
///
|
||||
real __atan2ieee128(real y, real x);
|
||||
///
|
||||
alias atan2l = __atan2ieee128;
|
||||
///
|
||||
pure real __cosieee128(real x);
|
||||
///
|
||||
alias cosl = __cosieee128;
|
||||
///
|
||||
pure real __sinieee128(real x);
|
||||
///
|
||||
alias sinl = __sinieee128;
|
||||
///
|
||||
pure real __tanieee128(real x);
|
||||
///
|
||||
alias tanl = __tanieee128;
|
||||
///
|
||||
real __acoshieee128(real x);
|
||||
///
|
||||
alias acoshl = __acoshieee128;
|
||||
///
|
||||
pure real __asinhieee128(real x);
|
||||
///
|
||||
alias asinhl = __asinhieee128;
|
||||
///
|
||||
real __atanhieee128(real x);
|
||||
///
|
||||
alias atanhl = __atanhieee128;
|
||||
///
|
||||
real __coshieee128(real x);
|
||||
///
|
||||
alias coshl = __coshieee128;
|
||||
///
|
||||
real __sinhieee128(real x);
|
||||
///
|
||||
alias sinhl = __sinhieee128;
|
||||
///
|
||||
pure real __tanhieee128(real x);
|
||||
///
|
||||
alias tanhl = __tanhieee128;
|
||||
///
|
||||
real __expieee128(real x);
|
||||
///
|
||||
alias expl = __expieee128;
|
||||
///
|
||||
real __exp2ieee128(real x);
|
||||
///
|
||||
alias exp2l = __exp2ieee128;
|
||||
///
|
||||
real __expm1ieee128(real x);
|
||||
///
|
||||
alias expm1l = __expm1ieee128;
|
||||
///
|
||||
pure real __frexpieee128(real value, int* exp);
|
||||
///
|
||||
alias frexpl = __frexpieee128;
|
||||
///
|
||||
int __ilogbieee128(real x);
|
||||
///
|
||||
alias ilogbl = __ilogbieee128;
|
||||
///
|
||||
real __ldexpieee128(real x, int exp);
|
||||
///
|
||||
alias ldexpl = __ldexpieee128;
|
||||
///
|
||||
real __logieee128(real x);
|
||||
///
|
||||
alias logl = __logieee128;
|
||||
///
|
||||
real __log10ieee128(real x);
|
||||
///
|
||||
alias log10l = __log10ieee128;
|
||||
///
|
||||
real __log1pieee128(real x);
|
||||
///
|
||||
alias log1pl = __log1pieee128;
|
||||
///
|
||||
real __log2ieee128(real x);
|
||||
///
|
||||
alias log2l = __log2ieee128;
|
||||
///
|
||||
real __logbieee128(real x);
|
||||
///
|
||||
alias logbl = __logbieee128;
|
||||
///
|
||||
pure real __modfieee128(real value, real *iptr);
|
||||
///
|
||||
alias modfl = __modfieee128;
|
||||
///
|
||||
real __scalbnieee128(real x, int n);
|
||||
///
|
||||
alias scalbnl = __scalbnieee128;
|
||||
///
|
||||
real __scalblnieee128(real x, c_long n);
|
||||
///
|
||||
alias scalblnl = __scalblnieee128;
|
||||
///
|
||||
pure real __cbrtieee128(real x);
|
||||
///
|
||||
alias cbrtl = __cbrtieee128;
|
||||
///
|
||||
pure float fabsf(float x);
|
||||
///
|
||||
pure real __fabsieee128(real x);
|
||||
///
|
||||
alias fabsl = __fabsieee128;
|
||||
///
|
||||
real __hypotieee128(real x, real y);
|
||||
///
|
||||
alias hypotl = __hypotieee128;
|
||||
///
|
||||
real __powieee128(real x, real y);
|
||||
///
|
||||
alias powl = __powieee128;
|
||||
///
|
||||
real __sqrtieee128(real x);
|
||||
///
|
||||
alias sqrtl = __sqrtieee128;
|
||||
///
|
||||
pure real __erfieee128(real x);
|
||||
///
|
||||
alias erfl = __erfieee128;
|
||||
///
|
||||
real __erfcieee128(real x);
|
||||
///
|
||||
alias erfcl = __erfcieee128;
|
||||
///
|
||||
real __lgammaieee128(real x);
|
||||
///
|
||||
alias lgammal = __lgammaieee128;
|
||||
///
|
||||
real __tgammaieee128(real x);
|
||||
///
|
||||
alias tgammal = __tgammaieee128;
|
||||
///
|
||||
pure real __ceilieee128(real x);
|
||||
///
|
||||
alias ceill = __ceilieee128;
|
||||
///
|
||||
pure real __floorieee128(real x);
|
||||
///
|
||||
alias floorl = __floorieee128;
|
||||
///
|
||||
pure real __nearbyintieee128(real x);
|
||||
///
|
||||
alias nearbyintl = __nearbyintieee128;
|
||||
///
|
||||
pure real __rintieee128(real x);
|
||||
///
|
||||
alias rintl = __rintieee128;
|
||||
///
|
||||
c_long __lrintieee128(real x);
|
||||
///
|
||||
alias lrintl = __lrintieee128;
|
||||
///
|
||||
long __llrintieee128(real x);
|
||||
///
|
||||
alias llrintl = __llrintieee128;
|
||||
///
|
||||
pure real __roundieee128(real x);
|
||||
///
|
||||
alias roundl = __roundieee128;
|
||||
///
|
||||
c_long __lroundieee128(real x);
|
||||
///
|
||||
alias lroundl = __lroundieee128;
|
||||
///
|
||||
long __llroundieee128(real x);
|
||||
///
|
||||
alias llroundl = __llroundieee128;
|
||||
///
|
||||
pure real __truncieee128(real x);
|
||||
///
|
||||
alias truncl = __truncieee128;
|
||||
///
|
||||
real __fmodieee128(real x, real y);
|
||||
///
|
||||
alias fmodl = __fmodieee128;
|
||||
///
|
||||
real __remainderieee128(real x, real y);
|
||||
///
|
||||
alias remainderl = __remainderieee128;
|
||||
///
|
||||
real __remquoieee128(real x, real y, int* quo);
|
||||
///
|
||||
alias remquol = __remquoieee128;
|
||||
///
|
||||
pure real __copysignieee128(real x, real y);
|
||||
///
|
||||
alias copysignl = __copysignieee128;
|
||||
///
|
||||
pure real __nanieee128(char* tagp);
|
||||
///
|
||||
alias nanl = __nanieee128;
|
||||
///
|
||||
real __nextafterieee128(real x, real y);
|
||||
///
|
||||
alias nextafterl = __nextafterieee128;
|
||||
///
|
||||
double __nexttoward_to_ieee128(double x, real y);
|
||||
///
|
||||
alias nexttoward = __nexttoward_to_ieee128;
|
||||
///
|
||||
float __nexttowardf_to_ieee128(float x, real y);
|
||||
///
|
||||
alias nexttowardf = __nexttowardf_to_ieee128;
|
||||
///
|
||||
real __nexttowardieee128(real x, real y);
|
||||
///
|
||||
alias nexttowardl = __nexttowardieee128;
|
||||
///
|
||||
real __fdimieee128(real x, real y);
|
||||
///
|
||||
alias fdiml = __fdimieee128;
|
||||
///
|
||||
pure real __fmaxieee128(real x, real y);
|
||||
///
|
||||
alias fmaxl = __fmaxieee128;
|
||||
///
|
||||
pure real __fminieee128(real x, real y);
|
||||
///
|
||||
alias fminl = __fminieee128;
|
||||
///
|
||||
pure real __fmaieee128(real x, real y, real z);
|
||||
///
|
||||
alias fmal = __fmaieee128;
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
real acosl(real x);
|
||||
///
|
||||
real asinl(real x);
|
||||
///
|
||||
pure real atanl(real x);
|
||||
///
|
||||
real atan2l(real y, real x);
|
||||
///
|
||||
pure real cosl(real x);
|
||||
///
|
||||
pure real sinl(real x);
|
||||
///
|
||||
pure real tanl(real x);
|
||||
///
|
||||
real acoshl(real x);
|
||||
///
|
||||
pure real asinhl(real x);
|
||||
///
|
||||
real atanhl(real x);
|
||||
///
|
||||
real coshl(real x);
|
||||
///
|
||||
real sinhl(real x);
|
||||
///
|
||||
pure real tanhl(real x);
|
||||
///
|
||||
real expl(real x);
|
||||
///
|
||||
real exp2l(real x);
|
||||
///
|
||||
real expm1l(real x);
|
||||
///
|
||||
pure real frexpl(real value, int* exp);
|
||||
///
|
||||
int ilogbl(real x);
|
||||
///
|
||||
real ldexpl(real x, int exp);
|
||||
///
|
||||
real logl(real x);
|
||||
///
|
||||
real log10l(real x);
|
||||
///
|
||||
real log1pl(real x);
|
||||
///
|
||||
real log2l(real x);
|
||||
///
|
||||
real logbl(real x);
|
||||
///
|
||||
pure real modfl(real value, real *iptr);
|
||||
///
|
||||
real scalbnl(real x, int n);
|
||||
///
|
||||
real scalblnl(real x, c_long n);
|
||||
///
|
||||
pure real cbrtl(real x);
|
||||
version (CRuntime_Microsoft)
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
pure float fabsf(float x);
|
||||
///
|
||||
pure real fabsl(real x);
|
||||
}
|
||||
///
|
||||
real hypotl(real x, real y);
|
||||
///
|
||||
real powl(real x, real y);
|
||||
///
|
||||
real sqrtl(real x);
|
||||
///
|
||||
pure real erfl(real x);
|
||||
///
|
||||
real erfcl(real x);
|
||||
///
|
||||
real lgammal(real x);
|
||||
///
|
||||
real tgammal(real x);
|
||||
///
|
||||
pure real ceill(real x);
|
||||
///
|
||||
pure real floorl(real x);
|
||||
///
|
||||
pure real nearbyintl(real x);
|
||||
///
|
||||
pure real rintl(real x);
|
||||
///
|
||||
c_long lrintl(real x);
|
||||
///
|
||||
long llrintl(real x);
|
||||
///
|
||||
pure real roundl(real x);
|
||||
///
|
||||
c_long lroundl(real x);
|
||||
///
|
||||
long llroundl(real x);
|
||||
///
|
||||
pure real truncl(real x);
|
||||
///
|
||||
real fmodl(real x, real y);
|
||||
///
|
||||
real remainderl(real x, real y);
|
||||
///
|
||||
real remquol(real x, real y, int* quo);
|
||||
///
|
||||
pure real copysignl(real x, real y);
|
||||
///
|
||||
pure real nanl(char* tagp);
|
||||
///
|
||||
real nextafterl(real x, real y);
|
||||
///
|
||||
double nexttoward(double x, real y);
|
||||
///
|
||||
float nexttowardf(float x, real y);
|
||||
///
|
||||
real nexttowardl(real x, real y);
|
||||
///
|
||||
real fdiml(real x, real y);
|
||||
///
|
||||
pure real fmaxl(real x, real y);
|
||||
///
|
||||
pure real fminl(real x, real y);
|
||||
///
|
||||
pure real fmal(real x, real y, real z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1303,54 +1303,118 @@ version (MinGW)
|
||||
}
|
||||
else version (CRuntime_Glibc)
|
||||
{
|
||||
///
|
||||
pragma(printf)
|
||||
int fprintf(FILE* stream, scope const char* format, scope const ...);
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_fscanf(FILE* stream, scope const char* format, scope ...);
|
||||
///
|
||||
alias fscanf = __isoc99_fscanf;
|
||||
///
|
||||
pragma(printf)
|
||||
int sprintf(scope char* s, scope const char* format, scope const ...);
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_sscanf(scope const char* s, scope const char* format, scope ...);
|
||||
///
|
||||
alias sscanf = __isoc99_sscanf;
|
||||
///
|
||||
pragma(printf)
|
||||
int vfprintf(FILE* stream, scope const char* format, va_list arg);
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_vfscanf(FILE* stream, scope const char* format, va_list arg);
|
||||
///
|
||||
alias vfscanf = __isoc99_vfscanf;
|
||||
///
|
||||
pragma(printf)
|
||||
int vsprintf(scope char* s, scope const char* format, va_list arg);
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_vsscanf(scope const char* s, scope const char* format, va_list arg);
|
||||
///
|
||||
alias vsscanf = __isoc99_vsscanf;
|
||||
///
|
||||
pragma(printf)
|
||||
int vprintf(scope const char* format, va_list arg);
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_vscanf(scope const char* format, va_list arg);
|
||||
///
|
||||
alias vscanf = __isoc99_vscanf;
|
||||
///
|
||||
pragma(printf)
|
||||
int printf(scope const char* format, scope const ...);
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_scanf(scope const char* format, scope ...);
|
||||
///
|
||||
alias scanf = __isoc99_scanf;
|
||||
static if (PPCUseIEEE128)
|
||||
{
|
||||
///
|
||||
pragma(printf)
|
||||
int __fprintfieee128(FILE* stream, scope const char* format, scope const ...);
|
||||
///
|
||||
alias fprintf = __fprintfieee128;
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_fscanfieee128(FILE* stream, scope const char* format, scope ...);
|
||||
///
|
||||
alias fscanf = __isoc99_fscanfieee128;
|
||||
///
|
||||
pragma(printf)
|
||||
int __sprintfieee128(scope char* s, scope const char* format, scope const ...);
|
||||
///
|
||||
alias sprintf = __sprintfieee128;
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_sscanfieee128(scope const char* s, scope const char* format, scope ...);
|
||||
///
|
||||
alias sscanf = __isoc99_sscanfieee128;
|
||||
///
|
||||
pragma(printf)
|
||||
int vfprintf(FILE* stream, scope const char* format, va_list arg);
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_vfscanfieee128(FILE* stream, scope const char* format, va_list arg);
|
||||
///
|
||||
alias vfscanf = __isoc99_vfscanfieee128;
|
||||
///
|
||||
pragma(printf)
|
||||
int __vsprintfieee128(scope char* s, scope const char* format, va_list arg);
|
||||
///
|
||||
alias vsprintf = __vsprintfieee128;
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_vsscanfieee128(scope const char* s, scope const char* format, va_list arg);
|
||||
///
|
||||
alias vsscanf = __isoc99_vsscanfieee128;
|
||||
///
|
||||
pragma(printf)
|
||||
int __vprintfieee128(scope const char* format, va_list arg);
|
||||
///
|
||||
alias vprintf = __vprintfieee128;
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_vfscanfieee128(scope const char* format, va_list arg);
|
||||
///
|
||||
alias vscanf = __isoc99_vfscanfieee128;
|
||||
///
|
||||
pragma(printf)
|
||||
int __printfieee128(scope const char* format, scope const ...);
|
||||
///
|
||||
alias printf = __printfieee128;
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_scanfieee128(scope const char* format, scope ...);
|
||||
///
|
||||
alias scanf = __isoc99_scanfieee128;
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
pragma(printf)
|
||||
int fprintf(FILE* stream, scope const char* format, scope const ...);
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_fscanf(FILE* stream, scope const char* format, scope ...);
|
||||
///
|
||||
alias fscanf = __isoc99_fscanf;
|
||||
///
|
||||
pragma(printf)
|
||||
int sprintf(scope char* s, scope const char* format, scope const ...);
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_sscanf(scope const char* s, scope const char* format, scope ...);
|
||||
///
|
||||
alias sscanf = __isoc99_sscanf;
|
||||
///
|
||||
pragma(printf)
|
||||
int vfprintf(FILE* stream, scope const char* format, va_list arg);
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_vfscanf(FILE* stream, scope const char* format, va_list arg);
|
||||
///
|
||||
alias vfscanf = __isoc99_vfscanf;
|
||||
///
|
||||
pragma(printf)
|
||||
int vsprintf(scope char* s, scope const char* format, va_list arg);
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_vsscanf(scope const char* s, scope const char* format, va_list arg);
|
||||
///
|
||||
alias vsscanf = __isoc99_vsscanf;
|
||||
///
|
||||
pragma(printf)
|
||||
int vprintf(scope const char* format, va_list arg);
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_vscanf(scope const char* format, va_list arg);
|
||||
///
|
||||
alias vscanf = __isoc99_vscanf;
|
||||
///
|
||||
pragma(printf)
|
||||
int printf(scope const char* format, scope const ...);
|
||||
///
|
||||
pragma(scanf)
|
||||
int __isoc99_scanf(scope const char* format, scope ...);
|
||||
///
|
||||
alias scanf = __isoc99_scanf;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1544,12 +1608,28 @@ else version (CRuntime_Glibc)
|
||||
int fileno(FILE *);
|
||||
}
|
||||
|
||||
///
|
||||
pragma(printf)
|
||||
int snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
|
||||
///
|
||||
pragma(printf)
|
||||
int vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
|
||||
static if (PPCUseIEEE128)
|
||||
{
|
||||
///
|
||||
pragma(printf)
|
||||
int __snprintfieee128(scope char* s, size_t n, scope const char* format, scope const ...);
|
||||
///
|
||||
alias snprintf = __snprintfieee128;
|
||||
///
|
||||
pragma(printf)
|
||||
int __vsnprintfieee128(scope char* s, size_t n, scope const char* format, va_list arg);
|
||||
///
|
||||
alias vsnprintf = __vsnprintfieee128;
|
||||
}
|
||||
else
|
||||
{
|
||||
///
|
||||
pragma(printf)
|
||||
int snprintf(scope char* s, size_t n, scope const char* format, scope const ...);
|
||||
///
|
||||
pragma(printf)
|
||||
int vsnprintf(scope char* s, size_t n, scope const char* format, va_list arg);
|
||||
}
|
||||
|
||||
//
|
||||
// Gnu under-the-hood C I/O functions. Uses _iobuf* for the unshared
|
||||
|
||||
@@ -147,8 +147,16 @@ version (CRuntime_Microsoft)
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Added to Bionic since Lollipop.
|
||||
real strtold(scope inout(char)* nptr, scope inout(char)** endptr);
|
||||
static if (PPCUseIEEE128)
|
||||
{
|
||||
real __strtoieee128(scope inout(char)* nptr, scope inout(char)** endptr);
|
||||
alias strtold = __strtoieee128;
|
||||
}
|
||||
else
|
||||
{
|
||||
/// Added to Bionic since Lollipop.
|
||||
real strtold(scope inout(char)* nptr, scope inout(char)** endptr);
|
||||
}
|
||||
}
|
||||
|
||||
// No unsafe pointer manipulation.
|
||||
|
||||
@@ -11,13 +11,15 @@ $(RED Warning:
|
||||
*/
|
||||
|
||||
module core.sys.windows.sql;
|
||||
|
||||
enum ODBCVER = 0x0400;
|
||||
|
||||
deprecated ("The ODBC 3.5 modules are deprecated. Please use the ODBC4 modules in the `etc.c.odbc` package."):
|
||||
version (Windows):
|
||||
|
||||
public import core.sys.windows.sqltypes;
|
||||
import core.sys.windows.windef;
|
||||
|
||||
enum ODBCVER = 0x0351;
|
||||
|
||||
enum SQL_ACCESSIBLE_PROCEDURES=20;
|
||||
enum SQL_ACCESSIBLE_TABLES=19;
|
||||
enum SQL_ALL_TYPES=0;
|
||||
|
||||
@@ -11,6 +11,7 @@ $(RED Warning:
|
||||
*/
|
||||
|
||||
module core.sys.windows.sqlext;
|
||||
deprecated ("The ODBC 3.5 modules are deprecated. Please use the ODBC4 modules in the `etc.c.odbc` package."):
|
||||
version (Windows):
|
||||
|
||||
/* Conversion notes:
|
||||
|
||||
@@ -70,6 +70,10 @@ alias long ODBCINT64, SQLBIGINT;
|
||||
alias ulong SQLUBIGINT;
|
||||
//}
|
||||
|
||||
//Everything above this line may by used by odbcinst.d
|
||||
//Everything below this line is deprecated
|
||||
deprecated ("The ODBC 3.5 modules are deprecated. Please use the ODBC4 modules in the `etc.c.odbc` package."):
|
||||
|
||||
struct DATE_STRUCT {
|
||||
SQLSMALLINT year;
|
||||
SQLUSMALLINT month;
|
||||
|
||||
@@ -11,6 +11,7 @@ $(RED Warning:
|
||||
*/
|
||||
|
||||
module core.sys.windows.sqlucode;
|
||||
deprecated ("The ODBC 3.5 modules are deprecated. Please use the ODBC4 modules in the `etc.c.odbc` package."):
|
||||
version (Windows):
|
||||
|
||||
version (ANSI) {} else version = Unicode;
|
||||
|
||||
@@ -1324,8 +1324,16 @@ class TypeInfo_AssociativeArray : TypeInfo
|
||||
override @property inout(TypeInfo) next() nothrow pure inout { return value; }
|
||||
override @property uint flags() nothrow pure const { return 1; }
|
||||
|
||||
// TypeInfo entry is generated from the type of this template to help rt/aaA.d
|
||||
static struct Entry(K, V)
|
||||
{
|
||||
K key;
|
||||
V value;
|
||||
}
|
||||
|
||||
TypeInfo value;
|
||||
TypeInfo key;
|
||||
TypeInfo entry;
|
||||
|
||||
override @property size_t talign() nothrow pure const
|
||||
{
|
||||
|
||||
@@ -66,13 +66,13 @@ private:
|
||||
if ((ti.key.flags | ti.value.flags) & 1)
|
||||
flags |= Flags.hasPointers;
|
||||
|
||||
entryTI = fakeEntryTI(this, ti.key, ti.value);
|
||||
entryTI = ti.entry;
|
||||
}
|
||||
|
||||
Bucket[] buckets;
|
||||
uint used;
|
||||
uint deleted;
|
||||
TypeInfo_Struct entryTI;
|
||||
const(TypeInfo) entryTI;
|
||||
uint firstUsed;
|
||||
immutable uint keysz;
|
||||
immutable uint valsz;
|
||||
@@ -229,15 +229,6 @@ private void* allocEntry(scope const Impl* aa, scope const void* pkey)
|
||||
return res;
|
||||
}
|
||||
|
||||
package void entryDtor(void* p, const TypeInfo_Struct sti)
|
||||
{
|
||||
// key and value type info stored after the TypeInfo_Struct by tiEntry()
|
||||
auto sizeti = __traits(classInstanceSize, TypeInfo_Struct);
|
||||
auto extra = cast(const(TypeInfo)*)(cast(void*) sti + sizeti);
|
||||
extra[0].destroy(p);
|
||||
extra[1].destroy(p + talign(extra[0].tsize, extra[1].talign));
|
||||
}
|
||||
|
||||
private bool hasDtor(const TypeInfo ti) pure nothrow
|
||||
{
|
||||
import rt.lifetime : unqualify;
|
||||
@@ -258,132 +249,6 @@ private immutable(void)* getRTInfo(const TypeInfo ti) pure nothrow
|
||||
return isNoClass ? ti.rtInfo() : rtinfoHasPointers;
|
||||
}
|
||||
|
||||
// build type info for Entry with additional key and value fields
|
||||
TypeInfo_Struct fakeEntryTI(ref Impl aa, const TypeInfo keyti, const TypeInfo valti) nothrow
|
||||
{
|
||||
import rt.lifetime : unqualify;
|
||||
|
||||
auto kti = unqualify(keyti);
|
||||
auto vti = unqualify(valti);
|
||||
|
||||
// figure out whether RTInfo has to be generated (indicated by rtisize > 0)
|
||||
enum pointersPerWord = 8 * (void*).sizeof * (void*).sizeof;
|
||||
auto rtinfo = rtinfoNoPointers;
|
||||
size_t rtisize = 0;
|
||||
immutable(size_t)* keyinfo = void;
|
||||
immutable(size_t)* valinfo = void;
|
||||
if (aa.flags & Impl.Flags.hasPointers)
|
||||
{
|
||||
// classes are references
|
||||
keyinfo = cast(immutable(size_t)*) getRTInfo(keyti);
|
||||
valinfo = cast(immutable(size_t)*) getRTInfo(valti);
|
||||
|
||||
if (keyinfo is rtinfoHasPointers && valinfo is rtinfoHasPointers)
|
||||
rtinfo = rtinfoHasPointers;
|
||||
else
|
||||
rtisize = 1 + (aa.valoff + aa.valsz + pointersPerWord - 1) / pointersPerWord;
|
||||
}
|
||||
bool entryHasDtor = hasDtor(kti) || hasDtor(vti);
|
||||
if (rtisize == 0 && !entryHasDtor)
|
||||
return null;
|
||||
|
||||
// save kti and vti after type info for struct
|
||||
enum sizeti = __traits(classInstanceSize, TypeInfo_Struct);
|
||||
void* p = GC.malloc(sizeti + (2 + rtisize) * (void*).sizeof);
|
||||
import core.stdc.string : memcpy;
|
||||
|
||||
memcpy(p, __traits(initSymbol, TypeInfo_Struct).ptr, sizeti);
|
||||
|
||||
auto ti = cast(TypeInfo_Struct) p;
|
||||
auto extra = cast(TypeInfo*)(p + sizeti);
|
||||
extra[0] = cast() kti;
|
||||
extra[1] = cast() vti;
|
||||
|
||||
static immutable tiMangledName = "S2rt3aaA__T5EntryZ";
|
||||
ti.mangledName = tiMangledName;
|
||||
|
||||
ti.m_RTInfo = rtisize > 0 ? rtinfoEntry(aa, keyinfo, valinfo, cast(size_t*)(extra + 2), rtisize) : rtinfo;
|
||||
ti.m_flags = ti.m_RTInfo is rtinfoNoPointers ? cast(TypeInfo_Struct.StructFlags)0 : TypeInfo_Struct.StructFlags.hasPointers;
|
||||
|
||||
// we don't expect the Entry objects to be used outside of this module, so we have control
|
||||
// over the non-usage of the callback methods and other entries and can keep these null
|
||||
// xtoHash, xopEquals, xopCmp, xtoString and xpostblit
|
||||
immutable entrySize = aa.valoff + aa.valsz;
|
||||
ti.m_init = (cast(ubyte*) null)[0 .. entrySize]; // init length, but not ptr
|
||||
|
||||
if (entryHasDtor)
|
||||
{
|
||||
// xdtor needs to be built from the dtors of key and value for the GC
|
||||
ti.xdtorti = &entryDtor;
|
||||
ti.m_flags |= TypeInfo_Struct.StructFlags.isDynamicType;
|
||||
}
|
||||
|
||||
ti.m_align = cast(uint) max(kti.talign, vti.talign);
|
||||
|
||||
return ti;
|
||||
}
|
||||
|
||||
// build appropriate RTInfo at runtime
|
||||
immutable(void)* rtinfoEntry(ref Impl aa, immutable(size_t)* keyinfo,
|
||||
immutable(size_t)* valinfo, size_t* rtinfoData, size_t rtinfoSize) pure nothrow
|
||||
{
|
||||
enum bitsPerWord = 8 * size_t.sizeof;
|
||||
|
||||
rtinfoData[0] = aa.valoff + aa.valsz;
|
||||
rtinfoData[1..rtinfoSize] = 0;
|
||||
|
||||
void copyKeyInfo(string src)()
|
||||
{
|
||||
size_t pos = 1;
|
||||
size_t keybits = aa.keysz / (void*).sizeof;
|
||||
while (keybits >= bitsPerWord)
|
||||
{
|
||||
rtinfoData[pos] = mixin(src);
|
||||
keybits -= bitsPerWord;
|
||||
pos++;
|
||||
}
|
||||
if (keybits > 0)
|
||||
rtinfoData[pos] = mixin(src) & ((size_t(1) << keybits) - 1);
|
||||
}
|
||||
|
||||
if (keyinfo is rtinfoHasPointers)
|
||||
copyKeyInfo!"~size_t(0)"();
|
||||
else if (keyinfo !is rtinfoNoPointers)
|
||||
copyKeyInfo!"keyinfo[pos]"();
|
||||
|
||||
void copyValInfo(string src)()
|
||||
{
|
||||
size_t bitpos = aa.valoff / (void*).sizeof;
|
||||
size_t pos = 1;
|
||||
size_t dstpos = 1 + bitpos / bitsPerWord;
|
||||
size_t begoff = bitpos % bitsPerWord;
|
||||
size_t valbits = aa.valsz / (void*).sizeof;
|
||||
size_t endoff = (bitpos + valbits) % bitsPerWord;
|
||||
for (;;)
|
||||
{
|
||||
const bits = bitsPerWord - begoff;
|
||||
size_t s = mixin(src);
|
||||
rtinfoData[dstpos] |= s << begoff;
|
||||
if (begoff > 0 && valbits > bits)
|
||||
rtinfoData[dstpos+1] |= s >> bits;
|
||||
if (valbits < bitsPerWord)
|
||||
break;
|
||||
valbits -= bitsPerWord;
|
||||
dstpos++;
|
||||
pos++;
|
||||
}
|
||||
if (endoff > 0)
|
||||
rtinfoData[dstpos] &= (size_t(1) << endoff) - 1;
|
||||
}
|
||||
|
||||
if (valinfo is rtinfoHasPointers)
|
||||
copyValInfo!"~size_t(0)"();
|
||||
else if (valinfo !is rtinfoNoPointers)
|
||||
copyValInfo!"valinfo[pos]"();
|
||||
|
||||
return cast(immutable(void)*) rtinfoData;
|
||||
}
|
||||
|
||||
unittest
|
||||
{
|
||||
void test(K, V)()
|
||||
@@ -402,12 +267,10 @@ unittest
|
||||
if (valrti is rtinfoNoPointers && keyrti is rtinfoNoPointers)
|
||||
{
|
||||
assert(!(impl.flags & Impl.Flags.hasPointers));
|
||||
assert(impl.entryTI is null);
|
||||
}
|
||||
else if (valrti is rtinfoHasPointers && keyrti is rtinfoHasPointers)
|
||||
{
|
||||
assert(impl.flags & Impl.Flags.hasPointers);
|
||||
assert(impl.entryTI is null);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -977,7 +840,10 @@ unittest
|
||||
aa1 = null;
|
||||
aa2 = null;
|
||||
aa3 = null;
|
||||
GC.runFinalizers((cast(char*)&entryDtor)[0 .. 1]);
|
||||
auto dtor1 = typeid(TypeInfo_AssociativeArray.Entry!(int, T)).xdtor;
|
||||
GC.runFinalizers((cast(char*)dtor1)[0 .. 1]);
|
||||
auto dtor2 = typeid(TypeInfo_AssociativeArray.Entry!(T, int)).xdtor;
|
||||
GC.runFinalizers((cast(char*)dtor2)[0 .. 1]);
|
||||
assert(T.dtor == 6 && T.postblit == 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -1587,16 +1587,13 @@ deprecated unittest
|
||||
GC.free(blkinf.base);
|
||||
|
||||
// associative arrays
|
||||
import rt.aaA : entryDtor;
|
||||
// throw away all existing AA entries with dtor
|
||||
GC.runFinalizers((cast(char*)&entryDtor)[0..1]);
|
||||
|
||||
S1[int] aa1;
|
||||
aa1[0] = S1(0);
|
||||
aa1[1] = S1(1);
|
||||
dtorCount = 0;
|
||||
aa1 = null;
|
||||
GC.runFinalizers((cast(char*)&entryDtor)[0..1]);
|
||||
auto dtor1 = typeid(TypeInfo_AssociativeArray.Entry!(int, S1)).xdtor;
|
||||
GC.runFinalizers((cast(char*)dtor1)[0..1]);
|
||||
assert(dtorCount == 2);
|
||||
|
||||
int[S1] aa2;
|
||||
@@ -1605,7 +1602,8 @@ deprecated unittest
|
||||
aa2[S1(2)] = 2;
|
||||
dtorCount = 0;
|
||||
aa2 = null;
|
||||
GC.runFinalizers((cast(char*)&entryDtor)[0..1]);
|
||||
auto dtor2 = typeid(TypeInfo_AssociativeArray.Entry!(S1, int)).xdtor;
|
||||
GC.runFinalizers((cast(char*)dtor2)[0..1]);
|
||||
assert(dtorCount == 3);
|
||||
|
||||
S1[2][int] aa3;
|
||||
@@ -1613,7 +1611,8 @@ deprecated unittest
|
||||
aa3[1] = [S1(1),S1(3)];
|
||||
dtorCount = 0;
|
||||
aa3 = null;
|
||||
GC.runFinalizers((cast(char*)&entryDtor)[0..1]);
|
||||
auto dtor3 = typeid(TypeInfo_AssociativeArray.Entry!(int, S1[2])).xdtor;
|
||||
GC.runFinalizers((cast(char*)dtor3)[0..1]);
|
||||
assert(dtorCount == 4);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user