Skip to content

Commit

Permalink
add semantics for @nogc
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Apr 23, 2014
1 parent 4cd94f6 commit f5f95e0
Show file tree
Hide file tree
Showing 18 changed files with 533 additions and 194 deletions.
144 changes: 72 additions & 72 deletions src/builtin.c
Expand Up @@ -132,78 +132,78 @@ void builtin_init()
{
builtins._init(45);

// @safe pure nothrow real function(real)
add_builtin("_D4core4math3sinFNaNbNfeZe", &eval_sin);
add_builtin("_D4core4math3cosFNaNbNfeZe", &eval_cos);
add_builtin("_D4core4math3tanFNaNbNfeZe", &eval_tan);
add_builtin("_D4core4math4sqrtFNaNbNfeZe", &eval_sqrt);
add_builtin("_D4core4math4fabsFNaNbNfeZe", &eval_fabs);
add_builtin("_D4core4math5expm1FNaNbNfeZe", &eval_unimp);
add_builtin("_D4core4math4exp21FNaNbNfeZe", &eval_unimp);

// @trusted pure nothrow real function(real)
add_builtin("_D4core4math3sinFNaNbNeeZe", &eval_sin);
add_builtin("_D4core4math3cosFNaNbNeeZe", &eval_cos);
add_builtin("_D4core4math3tanFNaNbNeeZe", &eval_tan);
add_builtin("_D4core4math4sqrtFNaNbNeeZe", &eval_sqrt);
add_builtin("_D4core4math4fabsFNaNbNeeZe", &eval_fabs);
add_builtin("_D4core4math5expm1FNaNbNeeZe", &eval_unimp);
add_builtin("_D4core4math4exp21FNaNbNeeZe", &eval_unimp);

// @safe pure nothrow double function(double)
add_builtin("_D4core4math4sqrtFNaNbNfdZd", &eval_sqrt);
// @safe pure nothrow float function(float)
add_builtin("_D4core4math4sqrtFNaNbNffZf", &eval_sqrt);

// @safe pure nothrow real function(real, real)
add_builtin("_D4core4math5atan2FNaNbNfeeZe", &eval_unimp);
add_builtin("_D4core4math4yl2xFNaNbNfeeZe", &eval_unimp);
add_builtin("_D4core4math6yl2xp1FNaNbNfeeZe", &eval_unimp);

// @safe pure nothrow long function(real)
add_builtin("_D4core4math6rndtolFNaNbNfeZl", &eval_unimp);

// @safe pure nothrow real function(real)
add_builtin("_D3std4math3sinFNaNbNfeZe", &eval_sin);
add_builtin("_D3std4math3cosFNaNbNfeZe", &eval_cos);
add_builtin("_D3std4math3tanFNaNbNfeZe", &eval_tan);
add_builtin("_D3std4math4sqrtFNaNbNfeZe", &eval_sqrt);
add_builtin("_D3std4math4fabsFNaNbNfeZe", &eval_fabs);
add_builtin("_D3std4math5expm1FNaNbNfeZe", &eval_unimp);
add_builtin("_D3std4math4exp21FNaNbNfeZe", &eval_unimp);

// @trusted pure nothrow real function(real)
add_builtin("_D3std4math3sinFNaNbNeeZe", &eval_sin);
add_builtin("_D3std4math3cosFNaNbNeeZe", &eval_cos);
add_builtin("_D3std4math3tanFNaNbNeeZe", &eval_tan);
add_builtin("_D3std4math4sqrtFNaNbNeeZe", &eval_sqrt);
add_builtin("_D3std4math4fabsFNaNbNeeZe", &eval_fabs);
add_builtin("_D3std4math5expm1FNaNbNeeZe", &eval_unimp);
add_builtin("_D3std4math4exp21FNaNbNeeZe", &eval_unimp);

// @safe pure nothrow double function(double)
add_builtin("_D3std4math4sqrtFNaNbNfdZd", &eval_sqrt);
// @safe pure nothrow float function(float)
add_builtin("_D3std4math4sqrtFNaNbNffZf", &eval_sqrt);

// @safe pure nothrow real function(real, real)
add_builtin("_D3std4math5atan2FNaNbNfeeZe", &eval_unimp);
add_builtin("_D3std4math4yl2xFNaNbNfeeZe", &eval_unimp);
add_builtin("_D3std4math6yl2xp1FNaNbNfeeZe", &eval_unimp);

// @safe pure nothrow long function(real)
add_builtin("_D3std4math6rndtolFNaNbNfeZl", &eval_unimp);

// @safe pure nothrow int function(uint)
add_builtin("_D4core5bitop3bsfFNaNbNfkZi", &eval_bsf);
add_builtin("_D4core5bitop3bsrFNaNbNfkZi", &eval_bsr);

// @safe pure nothrow int function(ulong)
add_builtin("_D4core5bitop3bsfFNaNbNfmZi", &eval_bsf);
add_builtin("_D4core5bitop3bsrFNaNbNfmZi", &eval_bsr);

// @safe pure nothrow uint function(uint)
add_builtin("_D4core5bitop5bswapFNaNbNfkZk", &eval_bswap);
// @safe @nogc pure nothrow real function(real)
add_builtin("_D4core4math3sinFNaNbNiNfeZe", &eval_sin);
add_builtin("_D4core4math3cosFNaNbNiNfeZe", &eval_cos);
add_builtin("_D4core4math3tanFNaNbNiNfeZe", &eval_tan);
add_builtin("_D4core4math4sqrtFNaNbNiNfeZe", &eval_sqrt);
add_builtin("_D4core4math4fabsFNaNbNiNfeZe", &eval_fabs);
add_builtin("_D4core4math5expm1FNaNbNiNfeZe", &eval_unimp);
add_builtin("_D4core4math4exp21FNaNbNiNfeZe", &eval_unimp);

// @trusted @nogc pure nothrow real function(real)
add_builtin("_D4core4math3sinFNaNbNiNeeZe", &eval_sin);
add_builtin("_D4core4math3cosFNaNbNiNeeZe", &eval_cos);
add_builtin("_D4core4math3tanFNaNbNiNeeZe", &eval_tan);
add_builtin("_D4core4math4sqrtFNaNbNiNeeZe", &eval_sqrt);
add_builtin("_D4core4math4fabsFNaNbNiNeeZe", &eval_fabs);
add_builtin("_D4core4math5expm1FNaNbNiNeeZe", &eval_unimp);
add_builtin("_D4core4math4exp21FNaNbNiNeeZe", &eval_unimp);

// @safe @nogc pure nothrow double function(double)
add_builtin("_D4core4math4sqrtFNaNbNiNfdZd", &eval_sqrt);
// @safe @nogc pure nothrow float function(float)
add_builtin("_D4core4math4sqrtFNaNbNiNffZf", &eval_sqrt);

// @safe @nogc pure nothrow real function(real, real)
add_builtin("_D4core4math5atan2FNaNbNiNfeeZe", &eval_unimp);
add_builtin("_D4core4math4yl2xFNaNbNiNfeeZe", &eval_unimp);
add_builtin("_D4core4math6yl2xp1FNaNbNiNfeeZe", &eval_unimp);

// @safe @nogc pure nothrow long function(real)
add_builtin("_D4core4math6rndtolFNaNbNiNfeZl", &eval_unimp);

// @safe @nogc pure nothrow real function(real)
add_builtin("_D3std4math3sinFNaNbNiNfeZe", &eval_sin);
add_builtin("_D3std4math3cosFNaNbNiNfeZe", &eval_cos);
add_builtin("_D3std4math3tanFNaNbNiNfeZe", &eval_tan);
add_builtin("_D3std4math4sqrtFNaNbNiNfeZe", &eval_sqrt);
add_builtin("_D3std4math4fabsFNaNbNiNfeZe", &eval_fabs);
add_builtin("_D3std4math5expm1FNaNbNiNfeZe", &eval_unimp);
add_builtin("_D3std4math4exp21FNaNbNiNfeZe", &eval_unimp);

// @trusted @nogc pure nothrow real function(real)
add_builtin("_D3std4math3sinFNaNbNiNeeZe", &eval_sin);
add_builtin("_D3std4math3cosFNaNbNiNeeZe", &eval_cos);
add_builtin("_D3std4math3tanFNaNbNiNeeZe", &eval_tan);
add_builtin("_D3std4math4sqrtFNaNbNiNeeZe", &eval_sqrt);
add_builtin("_D3std4math4fabsFNaNbNiNeeZe", &eval_fabs);
add_builtin("_D3std4math5expm1FNaNbNiNeeZe", &eval_unimp);
add_builtin("_D3std4math4exp21FNaNbNiNeeZe", &eval_unimp);

// @safe @nogc pure nothrow double function(double)
add_builtin("_D3std4math4sqrtFNaNbNiNfdZd", &eval_sqrt);
// @safe @nogc pure nothrow float function(float)
add_builtin("_D3std4math4sqrtFNaNbNiNffZf", &eval_sqrt);

// @safe @nogc pure nothrow real function(real, real)
add_builtin("_D3std4math5atan2FNaNbNiNfeeZe", &eval_unimp);
add_builtin("_D3std4math4yl2xFNaNbNiNfeeZe", &eval_unimp);
add_builtin("_D3std4math6yl2xp1FNaNbNiNfeeZe", &eval_unimp);

// @safe @nogc pure nothrow long function(real)
add_builtin("_D3std4math6rndtolFNaNbNiNfeZl", &eval_unimp);

// @safe @nogc pure nothrow int function(uint)
add_builtin("_D4core5bitop3bsfFNaNbNiNfkZi", &eval_bsf);
add_builtin("_D4core5bitop3bsrFNaNbNiNfkZi", &eval_bsr);

// @safe @nogc pure nothrow int function(ulong)
add_builtin("_D4core5bitop3bsfFNaNbNiNfmZi", &eval_bsf);
add_builtin("_D4core5bitop3bsrFNaNbNiNfmZi", &eval_bsr);

// @safe @nogc pure nothrow uint function(uint)
add_builtin("_D4core5bitop5bswapFNaNbNiNfkZk", &eval_bswap);
}

/**********************************
Expand Down
6 changes: 6 additions & 0 deletions src/declaration.h
Expand Up @@ -612,6 +612,7 @@ class FuncDeclaration : public Declaration
#define FUNCFLAGpurityInprocess 1 // working on determining purity
#define FUNCFLAGsafetyInprocess 2 // working on determining safety
#define FUNCFLAGnothrowInprocess 4 // working on determining nothrow
#define FUNCFLAGnogcInprocess 8 // working on determining @nogc

FuncDeclaration(Loc loc, Loc endloc, Identifier *id, StorageClass storage_class, Type *type);
Dsymbol *syntaxCopy(Dsymbol *);
Expand Down Expand Up @@ -656,6 +657,11 @@ class FuncDeclaration : public Declaration
bool isSafeBypassingInference();
bool isTrusted();
bool setUnsafe();

bool isNogc();
bool isNogcBypassingInference();
bool setGC();

void printGCUsage(Loc loc, const char *warn);
bool isolateReturn();
bool parametersIntersect(Type *t);
Expand Down

0 comments on commit f5f95e0

Please sign in to comment.