mirror of
https://github.com/ChaiScript/ChaiScript.git
synced 2026-02-16 23:29:58 +08:00
Remove memory_order_relaxed usage
This commit is contained in:
parent
5a03c88ee3
commit
645377e191
@ -635,7 +635,7 @@ namespace chaiscript
|
|||||||
loc_mask = 0x0000FFFF
|
loc_mask = 0x0000FFFF
|
||||||
};
|
};
|
||||||
|
|
||||||
uint_fast32_t loc = t_loc.load(std::memory_order_relaxed);
|
uint_fast32_t loc = t_loc;
|
||||||
|
|
||||||
if (loc == 0)
|
if (loc == 0)
|
||||||
{
|
{
|
||||||
@ -647,17 +647,16 @@ namespace chaiscript
|
|||||||
for (auto s = stack_elem->begin(); s != stack_elem->end(); ++s )
|
for (auto s = stack_elem->begin(); s != stack_elem->end(); ++s )
|
||||||
{
|
{
|
||||||
if (s->first == name) {
|
if (s->first == name) {
|
||||||
t_loc.store( static_cast<uint_fast32_t>(std::distance(stack.rbegin(), stack_elem) << 16)
|
t_loc = static_cast<uint_fast32_t>(std::distance(stack.rbegin(), stack_elem) << 16)
|
||||||
| static_cast<uint_fast32_t>(std::distance(stack_elem->begin(), s))
|
| static_cast<uint_fast32_t>(std::distance(stack_elem->begin(), s))
|
||||||
| static_cast<uint_fast32_t>(Loc::located)
|
| static_cast<uint_fast32_t>(Loc::located)
|
||||||
| static_cast<uint_fast32_t>(Loc::is_local),
|
| static_cast<uint_fast32_t>(Loc::is_local);
|
||||||
std::memory_order_relaxed);
|
|
||||||
return s->second;
|
return s->second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
t_loc.store( static_cast<uint_fast32_t>(Loc::located), std::memory_order_relaxed);
|
t_loc = static_cast<uint_fast32_t>(Loc::located);
|
||||||
} else if (loc & static_cast<uint_fast32_t>(Loc::is_local)) {
|
} else if (loc & static_cast<uint_fast32_t>(Loc::is_local)) {
|
||||||
auto &stack = get_stack_data();
|
auto &stack = get_stack_data();
|
||||||
|
|
||||||
@ -675,7 +674,7 @@ namespace chaiscript
|
|||||||
|
|
||||||
// no? is it a function object?
|
// no? is it a function object?
|
||||||
auto obj = get_function_object_int(name, loc);
|
auto obj = get_function_object_int(name, loc);
|
||||||
if (obj.first != loc) t_loc.store(uint_fast32_t(obj.first), std::memory_order_relaxed);
|
if (obj.first != loc) t_loc = uint_fast32_t(obj.first);
|
||||||
return obj.second;
|
return obj.second;
|
||||||
|
|
||||||
|
|
||||||
@ -738,9 +737,9 @@ namespace chaiscript
|
|||||||
|
|
||||||
std::shared_ptr<std::vector<Proxy_Function>> get_method_missing_functions() const
|
std::shared_ptr<std::vector<Proxy_Function>> get_method_missing_functions() const
|
||||||
{
|
{
|
||||||
uint_fast32_t method_missing_loc = m_method_missing_loc.load(std::memory_order_relaxed);
|
uint_fast32_t method_missing_loc = m_method_missing_loc;
|
||||||
auto method_missing_funs = get_function("method_missing", method_missing_loc);
|
auto method_missing_funs = get_function("method_missing", method_missing_loc);
|
||||||
if (method_missing_funs.first != method_missing_loc) m_method_missing_loc.store(uint_fast32_t(method_missing_funs.first), std::memory_order_relaxed);
|
if (method_missing_funs.first != method_missing_loc) m_method_missing_loc = uint_fast32_t(method_missing_funs.first);
|
||||||
return std::move(method_missing_funs.second);
|
return std::move(method_missing_funs.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -938,9 +937,9 @@ namespace chaiscript
|
|||||||
Boxed_Value call_member(const std::string &t_name, std::atomic_uint_fast32_t &t_loc, const std::vector<Boxed_Value> ¶ms, bool t_has_params,
|
Boxed_Value call_member(const std::string &t_name, std::atomic_uint_fast32_t &t_loc, const std::vector<Boxed_Value> ¶ms, bool t_has_params,
|
||||||
const Type_Conversions_State &t_conversions)
|
const Type_Conversions_State &t_conversions)
|
||||||
{
|
{
|
||||||
uint_fast32_t loc = t_loc.load(std::memory_order_relaxed);
|
uint_fast32_t loc = t_loc;
|
||||||
const auto funs = get_function(t_name, loc);
|
const auto funs = get_function(t_name, loc);
|
||||||
if (funs.first != loc) t_loc.store(uint_fast32_t(funs.first), std::memory_order_relaxed);
|
if (funs.first != loc) t_loc = uint_fast32_t(funs.first);
|
||||||
|
|
||||||
const auto do_attribute_call =
|
const auto do_attribute_call =
|
||||||
[this](int l_num_params, const std::vector<Boxed_Value> &l_params, const std::vector<Proxy_Function> &l_funs, const Type_Conversions_State &l_conversions)->Boxed_Value
|
[this](int l_num_params, const std::vector<Boxed_Value> &l_params, const std::vector<Proxy_Function> &l_funs, const Type_Conversions_State &l_conversions)->Boxed_Value
|
||||||
@ -1051,9 +1050,9 @@ namespace chaiscript
|
|||||||
Boxed_Value call_function(const std::string &t_name, std::atomic_uint_fast32_t &t_loc, const std::vector<Boxed_Value> ¶ms,
|
Boxed_Value call_function(const std::string &t_name, std::atomic_uint_fast32_t &t_loc, const std::vector<Boxed_Value> ¶ms,
|
||||||
const Type_Conversions_State &t_conversions) const
|
const Type_Conversions_State &t_conversions) const
|
||||||
{
|
{
|
||||||
uint_fast32_t loc = t_loc.load(std::memory_order_relaxed);
|
uint_fast32_t loc = t_loc;
|
||||||
const auto funs = get_function(t_name, loc);
|
const auto funs = get_function(t_name, loc);
|
||||||
if (funs.first != loc) t_loc.store(uint_fast32_t(funs.first), std::memory_order_relaxed);
|
if (funs.first != loc) t_loc = uint_fast32_t(funs.first);
|
||||||
return dispatch::dispatch(*funs.second, params, t_conversions);
|
return dispatch::dispatch(*funs.second, params, t_conversions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user