aboutsummaryrefslogtreecommitdiff
path: root/build2/variable.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-01-20 13:46:11 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-02-03 14:35:45 +0200
commit934f2a9a90c5cad3cdc8a66b50c17827a3ddbcee (patch)
treef35f106e5369e98350327c79080c571195234c0b /build2/variable.cxx
parent280f4a5bf787587227ca193cd59c6bd74091db70 (diff)
Get rid of action rule override semantics
Instead we now have two more or less separate match states for outer and inner parts of an action.
Diffstat (limited to 'build2/variable.cxx')
-rw-r--r--build2/variable.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/build2/variable.cxx b/build2/variable.cxx
index d1f95c5..eb74aad 100644
--- a/build2/variable.cxx
+++ b/build2/variable.cxx
@@ -302,7 +302,7 @@ namespace build2
}
void
- typify (value& v, const value_type& t, const variable* var)
+ typify (value& v, const value_type& t, const variable* var, memory_order mo)
{
if (v.type == nullptr)
{
@@ -312,11 +312,16 @@ namespace build2
//
names ns (move (v).as<names> ());
v = nullptr;
- v.type = &t;
- v.assign (move (ns), var);
+
+ // Use value_type::assign directly to delay v.type change.
+ //
+ t.assign (v, move (ns), var);
+ v.null = false;
}
else
v.type = &t;
+
+ v.type.store (&t, mo);
}
else if (v.type != &t)
{
@@ -342,8 +347,10 @@ namespace build2
variable_cache_mutex_shard[
hash<value*> () (&v) % variable_cache_mutex_shard_size]);
+ // Note: v.type is rechecked by typify() under lock.
+ //
ulock l (m);
- typify (v, t, var); // v.type is rechecked by typify(), stored under lock.
+ typify (v, t, var, memory_order_release);
}
void