Skip to content

Commit

Permalink
continue the great rename-n-ing
Browse files Browse the repository at this point in the history
  • Loading branch information
vtjnash committed Sep 14, 2023
1 parent 4591ba4 commit d8f19ce
Show file tree
Hide file tree
Showing 30 changed files with 467 additions and 502 deletions.
2 changes: 1 addition & 1 deletion base/Base.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ include("strings/lazy.jl")

# array structures
include("indices.jl")
include("memoryt.jl")
include("genericmemory.jl")
include("array.jl")
include("abstractarray.jl")
include("subarray.jl")
Expand Down
2 changes: 1 addition & 1 deletion base/array.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1097,7 +1097,7 @@ function array_new_memory(mem::Memory{T}, newlen::Int, add_null::Bool) where T
# if data is in a String, keep it that way
# TODO: use jl_gc_expand_string(oldstr, newlen)?
str = _string_n(newlen)
return ccall(:jl_string_to_memoryt, Memory{T}, (Any,), str)
return ccall(:jl_string_to_genericmemory, Memory{T}, (Any,), str)
else
# TODO: when implimented, this should use a memory growing call
mem = Memory{T}(undef, newlen + add_null)
Expand Down
2 changes: 1 addition & 1 deletion base/boot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ const undef = UndefInitializer()
if isdefined(self, :instance) && m === 0
self.instance
else
ccall(:jl_alloc_memoryt, Ref{GenericMemory{isatomic,T}}, (Any, Int), self, m)
ccall(:jl_alloc_genericmemory, Ref{GenericMemory{isatomic,T}}, (Any, Int), self, m)
end
(self::Type{GenericMemory{isatomic,T}})(::UndefInitializer, d::NTuple{1,Int}) where {T,isatomic} = self(undef, getfield(d,1))
# empty vector constructor
Expand Down
2 changes: 1 addition & 1 deletion base/compiler/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ include("strings/lazy.jl")

# core array operations
include("indices.jl")
include("memoryt.jl")
include("genericmemory.jl")
include("array.jl")
include("abstractarray.jl")

Expand Down
16 changes: 8 additions & 8 deletions base/compiler/tfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2003,14 +2003,14 @@ function array_elmtype(@nospecialize ary)
return Any
end

@nospecs function memoryt_builtin_common_errorcheck(boundscheck, mem, idx)
@nospecs function genericmemory_builtin_common_errorcheck(boundscheck, mem, idx)
hasintersect(widenconst(boundscheck), Bool) || return false
hasintersect(widenconst(mem), GenericMemory) || return false
hasintersect(widenconst(idx), Int) || return false
return true
end

function memoryt_elemtype(@nospecialize mem)
function genericmemory_elemtype(@nospecialize mem)
m = widenconst(mem)
if !has_free_typevars(m) && m <: GenericMemory
m0 = m
Expand Down Expand Up @@ -2170,12 +2170,12 @@ end
return true
end

function memoryt_builtin_common_nothrow(argtypes::Vector{Any}, ismemoryref::Bool)
function genericmemory_builtin_common_nothrow(argtypes::Vector{Any}, ismemoryref::Bool)
idx_idx = ismemoryref ? 3 : 4
length(argtypes) == idx_idx || return false
boundscheck = argtypes[1]
memtype = widenconst(argtypes[2])
memoryt_builtin_common_typecheck(boundscheck, memtype, argtypes[idx_idx]) || return false
genericmemory_builtin_common_typecheck(boundscheck, memtype, argtypes[idx_idx]) || return false
if ismemoryref
# If we could potentially throw undef ref errors, bail out now.
array_type_undefable(memtype) && return false
Expand All @@ -2193,7 +2193,7 @@ function memoryt_builtin_common_nothrow(argtypes::Vector{Any}, ismemoryref::Bool
return false
end

@nospecs function memoryt_builtin_common_typecheck(boundscheck, memtype, idx)
@nospecs function genericmemory_builtin_common_typecheck(boundscheck, memtype, idx)
return boundscheck Bool && memtype GenericMemory && idx Int
end

Expand Down Expand Up @@ -3080,14 +3080,14 @@ function foreigncall_effects(@specialize(abstract_eval), e::Expr)
args = e.args
name = args[1]
isa(name, QuoteNode) && (name = name.value)
if name === :jl_alloc_memoryt
nothrow = new_memoryt_nothrow(abstract_eval, args)
if name === :jl_alloc_genericmemory
nothrow = new_genericmemory_nothrow(abstract_eval, args)
return Effects(EFFECTS_TOTAL; consistent=CONSISTENT_IF_NOTRETURNED, nothrow)
end
return EFFECTS_UNKNOWN
end

function new_memoryt_nothrow(@nospecialize(abstract_eval), args::Vector{Any})
function new_genericmemory_nothrow(@nospecialize(abstract_eval), args::Vector{Any})
length(args) 1+FOREIGNCALL_ARG_START || return false
mtype = instanceof_tfunc(abstract_eval(args[FOREIGNCALL_ARG_START]))[1]
isa(mtype, DataType) || return false
Expand Down
4 changes: 2 additions & 2 deletions base/memoryt.jl → base/genericmemory.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

## memoryt.jl: Managed Memory
## genericmemory.jl: Managed Memory

"""
GenericMemory{isatomic, T} <: AbstractVector{T}
Expand Down Expand Up @@ -64,7 +64,7 @@ end
unsafe_copyto!(dest::Memory, doffs, src::Memory, soffs, n) =
_unsafe_copyto!(dest, doffs, src, soffs, n)

copy(a::T) where {T<:Memory} = ccall(:jl_memoryt_copy, Ref{T}, (Any,), a)
copy(a::T) where {T<:Memory} = ccall(:jl_genericmemory_copy, Ref{T}, (Any,), a)

## Constructors ##

Expand Down
4 changes: 2 additions & 2 deletions base/pointer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ function unsafe_wrap(::Union{Type{Array},Type{Array{T}},Type{Array{T,1}}},
end
function unsafe_wrap(::Union{Type{GenericMemory{isatomic}},Type{GenericMemory{isatomic,T}}},
p::Ptr{T}, dims::Tuple{Int}; own::Bool = false) where {isatomic,T}
ccall(:jl_ptr_to_memoryt, Ref{GenericMemory{isatomic,T}},
ccall(:jl_ptr_to_genericmemory, Ref{GenericMemory{isatomic,T}},
(Any, Ptr{Cvoid}, Csize_t, Cint), Memory{isatomic,T}, p, dim[1], own)
end
function unsafe_wrap(::Union{Type{GenericMemory{isatomic}},Type{GenericMemory{isatomic,T}}},
p::Ptr{T}, d::Integer; own::Bool = false) where {isatomic,T}
ccall(:jl_ptr_to_memoryt, Ref{GenericMemory{isatomic,T}},
ccall(:jl_ptr_to_genericmemory, Ref{GenericMemory{isatomic,T}},
(Any, Ptr{Cvoid}, Csize_t, Cint), GenericMemory{isatomic,T}, p, d, own)
end
unsafe_wrap(Atype::Union{Type{Array},Type{Array{T}},Type{Array{T,N}},Type{GenericMemory{isatomic}},Type{GenericMemory{isatomic,T}}} where {isatomic},
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ endif

SRCS := \
jltypes gf typemap smallintset ast builtins module interpreter symbol \
dlload sys init task array memoryt staticdata toplevel jl_uv datatype \
dlload sys init task array genericmemory staticdata toplevel jl_uv datatype \
simplevector runtime_intrinsics precompile jloptions \
threading partr stackwalk gc gc-debug gc-pages gc-stacks gc-alloc-profiler method \
jlapi signal-handling safepoint timing subtype rtutils gc-heap-snapshot \
Expand Down
36 changes: 18 additions & 18 deletions src/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ JL_UNUSED static size_t overallocation(size_t maxsize)
JL_DLLEXPORT char *jl_array_typetagdata(jl_array_t *a) JL_NOTSAFEPOINT
{
assert(jl_array_isbitsunion(a));
return jl_memoryt_typetagdata(a->ref.mem) + (uintptr_t)a->ref.data;
return jl_genericmemory_typetagdata(a->ref.mem) + (uintptr_t)a->ref.data;
}

STATIC_INLINE jl_array_t *_new_array(jl_value_t *atype, uint32_t ndims, size_t *dims)
Expand All @@ -136,7 +136,7 @@ STATIC_INLINE jl_array_t *_new_array(jl_value_t *atype, uint32_t ndims, size_t *
// extra byte for all julia allocated byte vectors
int add_null = JL_ARRAY_IMPL_NUL && nel != 0 && ndims == 1 && layout->size == 1 && !layout->arrayelem_isunion;

jl_memory_t *mem = jl_alloc_memoryt(mtype, nel + add_null);
jl_genericmemory_t *mem = jl_alloc_genericmemory(mtype, nel + add_null);
if (add_null && ((char*)mem->data)[nel] != '\0')
((char*)mem->data)[nel] = '\0';
JL_GC_PUSH1(&mem);
Expand All @@ -162,7 +162,7 @@ STATIC_INLINE jl_array_t *_new_array(jl_value_t *atype, uint32_t ndims, size_t *
return a;
}

jl_memory_t *jl_new_memoryt_for_deserialization(jl_value_t *mtype, size_t nel, int isunion, int elsz);
jl_genericmemory_t *jl_new_genericmemory_for_deserialization(jl_value_t *mtype, size_t nel, int isunion, int elsz);

jl_array_t *jl_new_array_for_deserialization(jl_value_t *atype, uint32_t ndims, size_t *dims,
int isunboxed, int hasptr, int isunion, int elsz)
Expand All @@ -178,7 +178,7 @@ jl_array_t *jl_new_array_for_deserialization(jl_value_t *atype, uint32_t ndims,
jl_value_t *mtype = jl_field_type_concrete((jl_datatype_t*)jl_field_type_concrete((jl_datatype_t*)atype, 0), 1);
const jl_datatype_layout_t *layout = ((jl_datatype_t*)mtype)->layout;
int add_null = JL_ARRAY_IMPL_NUL && nel != 0 && ndims == 1 && layout->size == 1 && !layout->arrayelem_isunion;
jl_memory_t *mem = jl_new_memoryt_for_deserialization(mtype, nel + add_null, isunion, elsz);
jl_genericmemory_t *mem = jl_new_genericmemory_for_deserialization(mtype, nel + add_null, isunion, elsz);
if (add_null && ((char*)mem->data)[nel] != '\0')
((char*)mem->data)[nel] = '\0';
JL_GC_PUSH1(&mem);
Expand Down Expand Up @@ -247,20 +247,20 @@ JL_DLLEXPORT jl_array_t *jl_reshape_array(jl_value_t *atype, jl_array_t *data,
if (offset != 0 || a->ref.mem->length != l) {
// if this is a multidimentional slice of a vector, may need to record the size
JL_GC_PUSH1(&a);
a->ref.mem = jl_memoryt_slice(a->ref.mem, offset, l);
a->ref.mem = jl_genericmemory_slice(a->ref.mem, offset, l);
JL_GC_POP();
}
}

return a;
}

JL_DLLEXPORT jl_memory_t *jl_string_to_memoryt(jl_value_t *str);
JL_DLLEXPORT jl_genericmemory_t *jl_string_to_genericmemory(jl_value_t *str);

JL_DLLEXPORT jl_array_t *jl_string_to_array(jl_value_t *str)
{
jl_task_t *ct = jl_current_task;
jl_memory_t *mem = jl_string_to_memoryt(str);
jl_genericmemory_t *mem = jl_string_to_genericmemory(str);
JL_GC_PUSH1(&mem);
int ndimwords = 1;
int tsz = sizeof(jl_array_t) + ndimwords*sizeof(size_t);
Expand All @@ -281,7 +281,7 @@ JL_DLLEXPORT jl_array_t *jl_ptr_to_array_1d(jl_value_t *atype, void *data,
jl_exceptionf(jl_argumenterror_type, "invalid Array dimensions");
jl_value_t *mtype = jl_field_type_concrete((jl_datatype_t*)jl_field_type_concrete((jl_datatype_t*)atype, 0), 1);
const jl_datatype_layout_t *layout = ((jl_datatype_t*)mtype)->layout;
jl_memory_t *mem = jl_ptr_to_memoryt(mtype, data, nel, own_buffer);
jl_genericmemory_t *mem = jl_ptr_to_genericmemory(mtype, data, nel, own_buffer);
JL_GC_PUSH1(&mem);
int ndims = 1;
int tsz = sizeof(jl_array_t) + ndims*sizeof(size_t);
Expand Down Expand Up @@ -315,7 +315,7 @@ JL_DLLEXPORT jl_array_t *jl_ptr_to_array(jl_value_t *atype, void *data,
return jl_ptr_to_array_1d(atype, data, nel, own_buffer);
jl_value_t *mtype = jl_field_type_concrete((jl_datatype_t*)jl_field_type_concrete((jl_datatype_t*)atype, 0), 1);
const jl_datatype_layout_t *layout = ((jl_datatype_t*)mtype)->layout;
jl_memory_t *mem = jl_ptr_to_memoryt(mtype, data, nel, own_buffer);
jl_genericmemory_t *mem = jl_ptr_to_genericmemory(mtype, data, nel, own_buffer);
JL_GC_PUSH1(&mem);
int ndimwords = ndims;
int tsz = sizeof(jl_array_t) + ndimwords*sizeof(size_t);
Expand Down Expand Up @@ -344,7 +344,7 @@ JL_DLLEXPORT jl_value_t *jl_array_to_string(jl_array_t *a)
}
jl_value_t *str;
if (a->ref.data == a->ref.mem->data)
str = jl_memoryt_to_string(a->ref.mem, len);
str = jl_genericmemory_to_string(a->ref.mem, len);
else
str = jl_pchar_to_string(jl_array_data(a, char), len);
a->ref.mem->length = 0; // TODO(jwn): unsound?
Expand All @@ -366,20 +366,20 @@ static int array_resize_buffer(jl_array_t *a, size_t newlen)
const jl_datatype_layout_t *layout = ((jl_datatype_t*)mtype)->layout;
int add_null = JL_ARRAY_IMPL_NUL && newlen != 0 && layout->size == 1 && !layout->arrayelem_isunion;
int newbuf = 1;
jl_memory_t *mem;
jl_genericmemory_t *mem;
if (jl_is_string(jl_array_owner(a))) {
// if data is in a String, keep it that way
jl_value_t *str = jl_alloc_string(newlen);
// TODO: use jl_gc_expand_string(oldstr, newlen)?
JL_GC_PUSH1(&str);
mem = jl_string_to_memoryt(str);
mem = jl_string_to_genericmemory(str);
a->ref.mem = mem;
a->ref.data = mem->data;
jl_gc_wb(a, mem);
JL_GC_POP();
}
else {
mem = jl_alloc_memoryt(mtype, newlen + add_null);
mem = jl_alloc_genericmemory(mtype, newlen + add_null);
a->ref.mem = mem;
if (layout->arrayelem_isunion || layout->size == 0)
a->ref.data = 0;
Expand All @@ -404,17 +404,17 @@ STATIC_INLINE void jl_array_shrink(jl_array_t *a, size_t dec)
size_t nel = maxsize - dec;
size_t n = jl_array_nrows(a);
int add_null = JL_ARRAY_IMPL_NUL && elsz == 1 && !isbitsunion;
jl_memory_t *newmem = jl_alloc_memoryt((jl_value_t*)jl_typetagof(a->ref.mem), nel + add_null);
jl_genericmemory_t *newmem = jl_alloc_genericmemory((jl_value_t*)jl_typetagof(a->ref.mem), nel + add_null);
const char *olddata = (char*)a->ref.mem->data + byteoffset;
char *newdata = (char*)newmem->data + byteoffset;
memcpy(newdata, olddata, n * elsz);
if (isbitsunion) {
char *typetagdata = jl_array_typetagdata(a);
char *newtypetagdata = jl_memoryt_typetagdata(newmem) + (uintptr_t)a->ref.data;
char *newtypetagdata = jl_genericmemory_typetagdata(newmem) + (uintptr_t)a->ref.data;
memcpy(newtypetagdata, typetagdata, n);
}
if (add_null) {
assert(&newdata[n] < (char*)newmem->data + newmem->length + jl_is_string(jl_memoryt_owner(newmem)));
assert(&newdata[n] < (char*)newmem->data + newmem->length + jl_is_string(jl_genericmemory_owner(newmem)));
if (newdata[n] != 0)
newdata[n] = 0;
}
Expand Down Expand Up @@ -667,13 +667,13 @@ JL_DLLEXPORT jl_array_t *jl_array_copy(jl_array_t *ary)
const jl_datatype_layout_t *layout = ((jl_datatype_t*)jl_typetagof(ary->ref.mem))->layout;
int ndims = jl_array_ndims(ary);
int add_null = JL_ARRAY_IMPL_NUL && len != 0 && ndims == 1 && layout->size == 1 && !layout->arrayelem_isunion;
jl_memory_t *mem = jl_new_memoryt_for_deserialization((jl_value_t*)jl_typetagof(ary->ref.mem), len + add_null, layout->arrayelem_isunion, layout->size);
jl_genericmemory_t *mem = jl_new_genericmemory_for_deserialization((jl_value_t*)jl_typetagof(ary->ref.mem), len + add_null, layout->arrayelem_isunion, layout->size);
if (add_null && ((char*)mem->data)[len] != '\0')
((char*)mem->data)[len] = '\0';
// ensure isbits union arrays copy their selector bytes correctly
if (layout->arrayelem_isunion) {
memcpy(mem->data, (char*)ary->ref.mem->data + (size_t)jl_array_data_(ary) * elsz, len * elsz);
memcpy(jl_memoryt_typetagdata(mem), jl_array_typetagdata(ary), len);
memcpy(jl_genericmemory_typetagdata(mem), jl_array_typetagdata(ary), len);
}
else {
memcpy(mem->data, jl_array_data_(ary), len * elsz);
Expand Down
32 changes: 16 additions & 16 deletions src/builtins.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@ JL_CALLABLE(jl_f_sizeof)
assert(jl_is_datatype(dt));
assert(!dt->name->abstract);
size_t sz = jl_datatype_size(dt);
if (jl_is_memory(x)) // TODO(jwn): add bitsunion bytes?
sz *= ((jl_memory_t*)x)->length;
if (jl_is_genericmemory(x)) // TODO(jwn): add bitsunion bytes?
sz *= ((jl_genericmemory_t*)x)->length;
return jl_box_long(sz);
}

Expand Down Expand Up @@ -1547,21 +1547,21 @@ JL_CALLABLE(jl_f_memoryref)
{
JL_NARGS(memoryref, 1, 3);
if (nargs == 1) {
JL_TYPECHK(memoryref, memory, args[0]);
jl_memory_t *m = (jl_memory_t*)args[0];
jl_value_t *typ = jl_apply_type2((jl_value_t*)jl_memoryref_type, jl_tparam0(jl_typetagof(m)), jl_tparam1(jl_typetagof(m)));
JL_TYPECHK(memoryref, genericmemory, args[0]);
jl_genericmemory_t *m = (jl_genericmemory_t*)args[0];
jl_value_t *typ = jl_apply_type2((jl_value_t*)jl_genericmemoryref_type, jl_tparam0(jl_typetagof(m)), jl_tparam1(jl_typetagof(m)));
JL_GC_PROMISE_ROOTED(typ); // it is a concrete type
const jl_datatype_layout_t *layout = ((jl_datatype_t*)jl_typetagof(m))->layout;
if (layout->arrayelem_isunion || layout->size == 0)
return (jl_value_t*)jl_new_memoryref(typ, m, 0);
return (jl_value_t*)jl_new_memoryref(typ, m, m->data);
}
else {
JL_TYPECHK(memoryref, memoryref, args[0]);
JL_TYPECHK(memoryref, genericmemoryref, args[0]);
JL_TYPECHK(memoryref, long, args[1]);
if (nargs == 3)
JL_TYPECHK(memoryref, bool, args[2]);
jl_memoryref_t *m = (jl_memoryref_t*)args[0];
jl_genericmemoryref_t *m = (jl_genericmemoryref_t*)args[0];
size_t i = jl_unbox_long(args[1]) - 1;
const jl_datatype_layout_t *layout = ((jl_datatype_t*)jl_typetagof(m->mem))->layout;
char *data = (char*)m->data;
Expand All @@ -1587,10 +1587,10 @@ JL_CALLABLE(jl_f_memoryref)
JL_CALLABLE(jl_f_memoryrefget)
{
JL_NARGS(memoryrefget, 3, 3);
JL_TYPECHK(memoryrefget, memoryref, args[0]);
JL_TYPECHK(memoryrefget, genericmemoryref, args[0]);
JL_TYPECHK(memoryrefget, symbol, args[1]);
JL_TYPECHK(memoryrefget, bool, args[2]);
jl_memoryref_t m = *(jl_memoryref_t*)args[0];
jl_genericmemoryref_t m = *(jl_genericmemoryref_t*)args[0];
jl_value_t *isatomic = jl_tparam0(jl_typetagof(m.mem));
if (isatomic == jl_false)
if (args[1] != (jl_value_t*)jl_not_atomic_sym)
Expand All @@ -1603,10 +1603,10 @@ JL_CALLABLE(jl_f_memoryrefget)
JL_CALLABLE(jl_f_memoryrefset)
{
JL_NARGS(memoryrefset, 4, 4);
JL_TYPECHK(memoryrefset, memoryref, args[0]);
JL_TYPECHK(memoryrefset, genericmemoryref, args[0]);
JL_TYPECHK(memoryrefset, symbol, args[2]);
JL_TYPECHK(memoryrefset, bool, args[3]);
jl_memoryref_t m = *(jl_memoryref_t*)args[0];
jl_genericmemoryref_t m = *(jl_genericmemoryref_t*)args[0];
jl_value_t *isatomic = jl_tparam0(jl_typetagof(m.mem));
if (isatomic == jl_false)
if (args[2] != (jl_value_t*)jl_not_atomic_sym)
Expand All @@ -1620,10 +1620,10 @@ JL_CALLABLE(jl_f_memoryrefset)
JL_CALLABLE(jl_f_memoryref_isassigned)
{
JL_NARGS(memoryref_isassigned, 3, 3);
JL_TYPECHK(memoryref_isassigned, memoryref, args[0]);
JL_TYPECHK(memoryref_isassigned, genericmemoryref, args[0]);
JL_TYPECHK(memoryref_isassigned, symbol, args[1]);
JL_TYPECHK(memoryref_isassigned, bool, args[2]);
jl_memoryref_t m = *(jl_memoryref_t*)args[0];
jl_genericmemoryref_t m = *(jl_genericmemoryref_t*)args[0];
jl_value_t *isatomic = jl_tparam0(jl_typetagof(m.mem));
if (isatomic == jl_false)
if (args[1] != (jl_value_t*)jl_not_atomic_sym)
Expand Down Expand Up @@ -1823,7 +1823,7 @@ static int references_name(jl_value_t *p, jl_typename_t *name, int affects_layou
jl_datatype_t *dp = (jl_datatype_t*)p;
if (affects_layout && dp->name == name)
return 1;
affects_layout = jl_is_memory_type(dp) || ((jl_datatype_t*)jl_unwrap_unionall(dp->name->wrapper))->layout == NULL;
affects_layout = jl_is_genericmemory_type(dp) || ((jl_datatype_t*)jl_unwrap_unionall(dp->name->wrapper))->layout == NULL;
// and even if it has a layout, the fields themselves might trigger layouts if they use tparam i
// rather than checking this for each field, we just assume it applies
if (!affects_layout && freevars && jl_field_names(dp) != jl_emptysvec) {
Expand Down Expand Up @@ -2209,8 +2209,8 @@ void jl_init_primitives(void) JL_GC_DISABLED
add_builtin("AbstractArray", (jl_value_t*)jl_abstractarray_type);
add_builtin("DenseArray", (jl_value_t*)jl_densearray_type);
add_builtin("Array", (jl_value_t*)jl_array_type);
add_builtin("GenericMemory", (jl_value_t*)jl_memory_type);
add_builtin("MemoryRef", (jl_value_t*)jl_memoryref_type);
add_builtin("GenericMemory", (jl_value_t*)jl_genericmemory_type);
add_builtin("MemoryRef", (jl_value_t*)jl_genericmemoryref_type);

add_builtin("Expr", (jl_value_t*)jl_expr_type);
add_builtin("LineNumberNode", (jl_value_t*)jl_linenumbernode_type);
Expand Down
2 changes: 1 addition & 1 deletion src/ccall.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1271,7 +1271,7 @@ static const std::string verify_ccall_sig(jl_value_t *&rt, jl_value_t *at,
JL_TYPECHK(ccall, type, rt);
JL_TYPECHK(ccall, simplevector, at);

if (rt == (jl_value_t*)jl_any_type || jl_is_array_type(rt) || jl_is_memory_type(rt) ||
if (rt == (jl_value_t*)jl_any_type || jl_is_array_type(rt) || jl_is_genericmemory_type(rt) ||
(jl_is_datatype(rt) && ((jl_datatype_t*)rt)->layout != NULL &&
jl_is_layout_opaque(((jl_datatype_t*)rt)->layout))) {
// n.b. `Array` used as return type just returns a julia object reference
Expand Down
Loading

0 comments on commit d8f19ce

Please sign in to comment.