Skip to content

Commit

Permalink
First step in the typesystem rewrite:
Browse files Browse the repository at this point in the history
Create the typedesc type in one place. That is where it will be named.
  • Loading branch information
cixtor committed Jul 13, 2011
1 parent 39151f2 commit 3d353f7
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 84 deletions.
26 changes: 13 additions & 13 deletions src/comp/back/upcall.rs
Expand Up @@ -17,7 +17,6 @@ import trans::T_ptr;
import trans::T_size_t;
import trans::T_str;
import trans::T_taskptr;
import trans::T_tydesc;
import trans::T_void;
import lib::llvm::type_names;
import lib::llvm::llvm::ModuleRef;
Expand Down Expand Up @@ -62,16 +61,17 @@ type upcalls =
ValueRef ivec_resize_shared,
ValueRef ivec_spill_shared);

fn declare_upcalls(type_names tn, ModuleRef llmod) -> @upcalls {
fn decl(type_names tn, ModuleRef llmod, str name, vec[TypeRef] tys,
TypeRef rv) -> ValueRef {
fn declare_upcalls(type_names tn, TypeRef tydesc_type, ModuleRef llmod)
-> @upcalls {
fn decl(type_names tn, TypeRef tydesc_type, ModuleRef llmod, str name,
vec[TypeRef] tys, TypeRef rv) -> ValueRef {
let TypeRef[] arg_tys = ~[T_taskptr(tn)];
for (TypeRef t in tys) { arg_tys += ~[t]; }
auto fn_ty = T_fn(arg_tys, rv);
ret trans::decl_cdecl_fn(llmod, "upcall_" + name, fn_ty);
}
auto dv = bind decl(tn, llmod, _, _, T_void());
auto d = bind decl(tn, llmod, _, _, _);
auto dv = bind decl(tn, tydesc_type, llmod, _, _, T_void());
auto d = bind decl(tn, tydesc_type, llmod, _, _, _);
// FIXME: Sigh:.. remove this when I fix the typechecker pushdown.
// --pcwalton

Expand All @@ -98,27 +98,27 @@ fn declare_upcalls(type_names tn, ModuleRef llmod) -> @upcalls {
_fail=dv("fail", [T_ptr(T_i8()), T_ptr(T_i8()), T_size_t()]),
kill=dv("kill", [T_taskptr(tn)]),
exit=dv("exit", empty_vec),
malloc=d("malloc", [T_size_t(), T_ptr(T_tydesc(tn))],
malloc=d("malloc", [T_size_t(), T_ptr(tydesc_type)],
T_ptr(T_i8())),
free=dv("free", [T_ptr(T_i8()), T_int()]),
shared_malloc=d("shared_malloc",
[T_size_t(), T_ptr(T_tydesc(tn))], T_ptr(T_i8())),
[T_size_t(), T_ptr(tydesc_type)], T_ptr(T_i8())),
shared_free=dv("shared_free", [T_ptr(T_i8())]),
mark=d("mark", [T_ptr(T_i8())], T_int()),
new_str=d("new_str", [T_ptr(T_i8()), T_size_t()],
T_ptr(T_str())),
dup_str=d("dup_str", [T_taskptr(tn), T_ptr(T_str())],
dup_str=d("dup_str", [T_taskptr(tn), T_ptr(T_str())],
T_ptr(T_str())),
new_vec=d("new_vec", [T_size_t(), T_ptr(T_tydesc(tn))],
new_vec=d("new_vec", [T_size_t(), T_ptr(tydesc_type)],
T_opaque_vec_ptr()),
vec_append=d("vec_append",
[T_ptr(T_tydesc(tn)), T_ptr(T_tydesc(tn)),
[T_ptr(tydesc_type), T_ptr(tydesc_type),
T_ptr(T_opaque_vec_ptr()), T_opaque_vec_ptr(),
T_bool()], T_void()),
get_type_desc=d("get_type_desc",
[T_ptr(T_nil()), T_size_t(), T_size_t(),
T_size_t(), T_ptr(T_ptr(T_tydesc(tn)))],
T_ptr(T_tydesc(tn))),
T_size_t(), T_ptr(T_ptr(tydesc_type))],
T_ptr(tydesc_type)),
new_task=d("new_task", [T_ptr(T_str())], T_taskptr(tn)),
start_task=d("start_task",
[T_taskptr(tn), T_int(), T_int(), T_size_t()],
Expand Down

0 comments on commit 3d353f7

Please sign in to comment.