-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
Copy pathjulia_fasttls.h
47 lines (37 loc) · 1.59 KB
/
julia_fasttls.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// This file is a part of Julia. License is MIT: https://julialang.org/license
#ifndef JL_FASTTLS_H
#define JL_FASTTLS_H
#ifdef __cplusplus
#include <atomic>
#define _Atomic(T) std::atomic<T>
#else
#include <stdatomic.h>
#endif
// Thread-local storage access
#ifdef __cplusplus
extern "C" {
#endif
/* Bring in definitions for `_OS_X_`, `JL_PATH_MAX` and `PATHSEPSTRING`, `jl_ptls_t`, etc... */
#include "platform.h"
#include "dirpath.h"
typedef struct _jl_gcframe_t jl_gcframe_t;
typedef jl_gcframe_t **(jl_get_pgcstack_func)(void);
#if !defined(_OS_WINDOWS_)
#define JULIA_DEFINE_FAST_TLS \
static __attribute__((tls_model("local-exec"))) __thread jl_gcframe_t **jl_pgcstack_localexec; \
JL_DLLEXPORT _Atomic(char) jl_pgcstack_static_semaphore; \
JL_DLLEXPORT jl_gcframe_t **jl_get_pgcstack_static(void) \
{ \
return jl_pgcstack_localexec; \
} \
JL_DLLEXPORT jl_gcframe_t ***jl_pgcstack_addr_static(void) \
{ \
return &jl_pgcstack_localexec; \
}
#else
#define JULIA_DEFINE_FAST_TLS
#endif
#ifdef __cplusplus
}
#endif
#endif