aboutsummaryrefslogtreecommitdiff
path: root/src/comp/middle
diff options
context:
space:
mode:
authorPatrick Walton <[email protected]>2011-04-29 16:40:30 -0700
committerPatrick Walton <[email protected]>2011-04-29 16:40:30 -0700
commitf6c472d816d31d0e497353512abe28a0ed6ab434 (patch)
tree3ee487110a24cce1c6c4bf40bd33c46c575d34a2 /src/comp/middle
parentrustc: Start threading a purity flag through upcalls (diff)
downloadrust-f6c472d816d31d0e497353512abe28a0ed6ab434.tar.xz
rust-f6c472d816d31d0e497353512abe28a0ed6ab434.zip
rustc: Emit pure native glue; we don't call it yet
Diffstat (limited to 'src/comp/middle')
-rw-r--r--src/comp/middle/trans.rs27
1 files changed, 19 insertions, 8 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index cb6badf4..1447c643 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -57,6 +57,7 @@ type glue_fns = rec(ValueRef activate_glue,
ValueRef yield_glue,
ValueRef exit_task_glue,
vec[ValueRef] native_glues_rust,
+ vec[ValueRef] native_glues_pure_rust,
vec[ValueRef] native_glues_cdecl,
ValueRef no_op_type_glue,
ValueRef memcpy_glue,
@@ -997,17 +998,26 @@ fn decl_glue(ModuleRef llmod, type_names tn, str s) -> ValueRef {
}
fn decl_native_glue(ModuleRef llmod, type_names tn,
- bool pass_task, uint _n) -> ValueRef {
+ abi.native_glue_type ngt, uint _n) -> ValueRef {
+ let bool pass_task;
+ alt (ngt) {
+ case (abi.ngt_rust) { pass_task = true; }
+ case (abi.ngt_pure_rust) { pass_task = true; }
+ case (abi.ngt_cdecl) { pass_task = false; }
+ }
+
// It doesn't actually matter what type we come up with here, at the
// moment, as we cast the native function pointers to int before passing
// them to the indirect native-invocation glue. But eventually we'd like
// to call them directly, once we have a calling convention worked out.
let int n = _n as int;
- let str s = abi.native_glue_name(n, pass_task);
+ let str s = abi.native_glue_name(n, ngt);
let vec[TypeRef] args = vec(T_int()); // callee
+
if (!pass_task) {
args += vec(T_int()); // taskptr, will not be passed
}
+
args += _vec.init_elt[TypeRef](T_int(), n as uint);
ret decl_fastcall_fn(llmod, s, T_fn(args, T_int()));
@@ -7610,13 +7620,14 @@ fn make_glues(ModuleRef llmod, type_names tn) -> @glue_fns {
T_void())),
native_glues_rust =
- _vec.init_fn[ValueRef](bind decl_native_glue(llmod, tn, true,
- _),
- abi.n_native_glues + 1 as uint),
+ _vec.init_fn[ValueRef](bind decl_native_glue(llmod, tn,
+ abi.ngt_rust, _), abi.n_native_glues + 1 as uint),
+ native_glues_pure_rust =
+ _vec.init_fn[ValueRef](bind decl_native_glue(llmod, tn,
+ abi.ngt_pure_rust, _), abi.n_native_glues + 1 as uint),
native_glues_cdecl =
- _vec.init_fn[ValueRef](bind decl_native_glue(llmod, tn, false,
- _),
- abi.n_native_glues + 1 as uint),
+ _vec.init_fn[ValueRef](bind decl_native_glue(llmod, tn,
+ abi.ngt_cdecl, _), abi.n_native_glues + 1 as uint),
no_op_type_glue = decl_no_op_type_glue(llmod, tn),
memcpy_glue = decl_memcpy_glue(llmod),
bzero_glue = decl_bzero_glue(llmod),