Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
13f4c137
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
1 年多 前同步成功
通知
0
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
13f4c137
编写于
8月 01, 2018
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[atomic] Fix Solaris ones to add proper barriers
上级
19dfaa35
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
36 addition
and
16 deletion
+36
-16
src/hb-atomic-private.hh
src/hb-atomic-private.hh
+36
-16
未找到文件。
src/hb-atomic-private.hh
浏览文件 @
13f4c137
...
...
@@ -62,7 +62,7 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
const
void
*
O
=
O_
;
// Need lvalue
return
__atomic_compare_exchange_n
((
void
**
)
P
,
(
void
**
)
&
O
,
(
void
*
)
N
,
true
,
__ATOMIC_ACQ_REL
,
__ATOMIC_RELAXED
);
}
#define hb_atomic_ptr_impl_cmpexch(P,O,N)
(_hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N)
))
#define hb_atomic_ptr_impl_cmpexch(P,O,N)
_hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N
))
#elif !defined(HB_NO_MT) && __cplusplus >= 201103L
...
...
@@ -82,7 +82,7 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
const
void
*
O
=
O_
;
// Need lvalue
return
reinterpret_cast
<
std
::
atomic
<
const
void
*>
*>
(
P
)
->
compare_exchange_weak
(
O
,
N
,
std
::
memory_order_acq_rel
,
std
::
memory_order_relaxed
);
}
#define hb_atomic_ptr_impl_cmpexch(P,O,N)
(_hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N)
))
#define hb_atomic_ptr_impl_cmpexch(P,O,N)
_hb_atomic_ptr_impl_cmplexch ((const void **) (P), (O), (N
))
#elif !defined(HB_NO_MT) && (defined(_WIN32) || defined(__CYGWIN__))
...
...
@@ -127,9 +127,25 @@ typedef int hb_atomic_int_impl_t;
#define _hb_memory_barrier() __machine_rw_barrier ()
typedef
unsigned
int
hb_atomic_int_impl_t
;
#define hb_atomic_int_impl_add(AI, V) ( ({__machine_rw_barrier ();}), atomic_add_int_nv ((AI), (V)) - (V)
/* XXX barrier again? */
)
#define hb_atomic_ptr_impl_cmpexch(P,O,N) ( ({__machine_rw_barrier ();}), atomic_cas_ptr ((void **) (P), (void *) (O), (void *) (N)) == (void *) (O) ? true : false
/* XXX barrier again? */
)
static
inline
int
_hb_fetch_and_add
(
hb_atomic_int_impl_t
*
AI
,
int
V
)
{
_hb_memory_w_barrier
();
int
result
=
atomic_add_int_nv
(
AI
,
V
);
_hb_memory_r_barrier
();
return
result
;
}
static
inline
bool
_hb_compare_and_swap_ptr
(
const
void
**
P
,
const
void
*
O
,
const
void
*
N
)
{
_hb_memory_w_barrier
();
int
result
=
atomic_cas_ptr
((
void
**
)
P
,
(
void
*
)
O
,
(
void
*
)
N
)
==
(
void
*
)
O
;
_hb_memory_r_barrier
();
return
result
;
}
#define hb_atomic_int_impl_add(AI, V) _hb_fetch_and_add ((AI), (V))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swap_ptr ((const void **) (P), (O), (N))
#elif !defined(HB_NO_MT) && defined(__APPLE__)
...
...
@@ -161,25 +177,29 @@ typedef int32_t hb_atomic_int_impl_t;
#include <builtins.h>
static
inline
int
_hb_fetch_and_add
(
int
*
AI
,
unsigned
int
V
)
{
__lwsync
();
int
result
=
__fetch_and_add
(
AI
,
V
);
__lwsync
();
#define _hb_memory_barrier() __lwsync ()
typedef
int
hb_atomic_int_impl_t
;
static
inline
int
_hb_fetch_and_add
(
hb_atomic_int_impl_t
*
AI
,
int
V
)
{
_hb_memory_barrier
();
int
result
=
__fetch_and_add
(
AI
,
V
);
_hb_memory_barrier
();
return
result
;
}
static
inline
int
_hb_compare_and_swaplp
(
long
*
P
,
long
O
,
long
N
)
{
__lwsync
();
int
result
=
__compare_and_swaplp
(
P
,
&
O
,
N
);
__lwsync
();
static
inline
bool
_hb_compare_and_swaplp
(
long
*
P
,
long
O
,
long
N
)
{
_hb_memory_barrier
();
bool
result
=
__compare_and_swaplp
(
P
,
&
O
,
N
);
_hb_memory_barrier
();
return
result
;
}
#define _hb_memory_barrier() __lwsync ()
typedef
int
hb_atomic_int_impl_t
;
#define hb_atomic_int_impl_add(AI, V) _hb_fetch_and_add ((AI), (V))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swaplp ((long*)(P), (long)(O), (long)(N))
#define hb_atomic_ptr_impl_cmpexch(P,O,N) _hb_compare_and_swaplp ((long *) (P), (long) (O), (long) (N))
static_assert
((
sizeof
(
long
)
==
sizeof
(
void
*
)),
""
);
#elif !defined(HB_NO_MT)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录