提交 916f3b55 authored 作者: Frédéric Bastien's avatar Frédéric Bastien

Merge pull request #1714 from abergeron/fix_slow_mac

Hide symbols in compiled modules
......@@ -255,6 +255,7 @@ def struct_gen(args, struct_builders, blocks, sub):
# TODO: add some error checking to make sure storage_<x> are
# 1-element lists and __ERROR is a 3-elements list.
struct_code = """
namespace {
struct %(name)s {
PyObject* __ERROR;
......@@ -287,6 +288,7 @@ def struct_gen(args, struct_builders, blocks, sub):
%(do_return)s
}
};
}
""" % sub
return struct_code
......@@ -1285,22 +1287,22 @@ class CLinker(link.Linker):
# instantiate.
if PY3:
static = """
int {struct_name}_executor({struct_name} *self) {{
static int {struct_name}_executor({struct_name} *self) {{
return self->run();
}}
void {struct_name}_destructor(PyObject *capsule) {{
static void {struct_name}_destructor(PyObject *capsule) {{
{struct_name} *self = ({struct_name} *)PyCapsule_GetContext(capsule);
delete self;
}}
""".format(struct_name=self.struct_name)
else:
static = """
int %(struct_name)s_executor(%(struct_name)s* self) {
static int %(struct_name)s_executor(%(struct_name)s* self) {
return self->run();
}
void %(struct_name)s_destructor(void* executor, void* self) {
static void %(struct_name)s_destructor(void* executor, void* self) {
delete ((%(struct_name)s*)self);
}
""" % dict(struct_name=self.struct_name)
......
......@@ -51,7 +51,7 @@ def compile_cutils():
'op': complexadd % {'type': t}}
for t in complex_types])
fn_array = ("inplace_map_binop addition_funcs[] = {" +
fn_array = ("static inplace_map_binop addition_funcs[] = {" +
''.join(["""
#if defined(%(typen)s)
%(type)s_inplace_add,
......@@ -61,7 +61,7 @@ def compile_cutils():
"""NULL};
""")
type_number_array = ("int type_numbers[] = {" +
type_number_array = ("static int type_numbers[] = {" +
''.join(["""
#if defined(%(typen)s)
%(typen)s,
......
......@@ -793,7 +793,8 @@ int lazy_rec_eval(CLazyLinker * self, Py_ssize_t var_idx, PyObject*one, PyObject
set_position_of_error(self, owner_idx);
return err;
}
PyObject *
static PyObject *
CLazyLinker_call(PyObject *_self, PyObject *args, PyObject *kwds)
{
CLazyLinker * self = (CLazyLinker*)_self;
......
......@@ -92,9 +92,8 @@ def detect_macos_sdot_bug():
# Then, try a simple fix
test_fix_code = textwrap.dedent("""\
extern "C" float sdot_(int*, float*, int*, float*, int*);
extern "C" float cblas_sdot(int, float*, int, float*, int);
float sdot_(int* Nx, float* x, int* Sx, float* y, int* Sy)
static float sdot_(int* Nx, float* x, int* Sx, float* y, int* Sy)
{
return cblas_sdot(*Nx, x, *Sx, y, *Sy);
}
......@@ -924,7 +923,7 @@ def blas_header_text():
if detect_macos_sdot_bug.fix_works:
header += textwrap.dedent("""\
extern "C" float cblas_sdot(int, float*, int, float*, int);
float sdot_(int* Nx, float* x, int* Sx, float* y, int* Sy)
static float sdot_(int* Nx, float* x, int* Sx, float* y, int* Sy)
{
return cblas_sdot(*Nx, x, *Sx, y, *Sy);
}
......@@ -932,7 +931,7 @@ def blas_header_text():
else:
# Make sure the buggy version of sdot_ is never used
header += textwrap.dedent("""\
float sdot_(int* Nx, float* x, int* Sx, float* y, int* Sy)
static float sdot_(int* Nx, float* x, int* Sx, float* y, int* Sy)
{
fprintf(stderr,
"FATAL: The implementation of BLAS SDOT "
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论