Remove unused TyDesc parameter from the glue functions

To remove the environment pointer, support for function pointers without
an environment argument is needed (i.e. a fixed version of #6661).
This commit is contained in:
Philipp Brüschweiler 2013-06-22 21:36:00 +02:00
parent 1b76bac41d
commit e2f1049bd5
9 changed files with 66 additions and 37 deletions

View file

@ -8,9 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.
pub static rc_base_field_refcnt: uint = 0u;
pub static task_field_refcnt: uint = 0u;
@ -69,14 +66,4 @@ pub static vec_elt_elems: uint = 2u;
pub static slice_elt_base: uint = 0u;
pub static slice_elt_len: uint = 1u;
pub static worst_case_glue_call_args: uint = 7u;
pub static abi_version: uint = 1u;
pub fn memcpy_glue_name() -> ~str { return ~"rust_memcpy_glue"; }
pub fn bzero_glue_name() -> ~str { return ~"rust_bzero_glue"; }
pub fn yield_glue_name() -> ~str { return ~"rust_yield_glue"; }
pub fn no_op_type_glue_name() -> ~str { return ~"rust_no_op_type_glue"; }

View file

@ -232,7 +232,7 @@ pub fn lazily_emit_tydesc_glue(ccx: @mut CrateContext,
field: uint,
ti: @mut tydesc_info) {
let _icx = push_ctxt("lazily_emit_tydesc_glue");
let llfnty = type_of_glue_fn(ccx);
let llfnty = Type::glue_fn();
if lazily_emit_simplified_tydesc_glue(ccx, field, ti) {
return;
@ -338,9 +338,7 @@ pub fn call_tydesc_glue_full(bcx: block,
}
};
Call(bcx, llfn, [C_null(Type::nil().ptr_to()),
C_null(bcx.ccx().tydesc_type.ptr_to().ptr_to()),
llrawptr]);
Call(bcx, llfn, [C_null(Type::nil().ptr_to()), llrawptr]);
}
// See [Note-arg-mode]
@ -680,7 +678,7 @@ pub fn make_generic_glue_inner(ccx: @mut CrateContext,
let bcx = top_scope_block(fcx, None);
let lltop = bcx.llbb;
let rawptr0_arg = fcx.arg_pos(1u);
let rawptr0_arg = fcx.arg_pos(0u);
let llrawptr0 = unsafe { llvm::LLVMGetParam(llfn, rawptr0_arg as c_uint) };
let llty = type_of(ccx, t);
let llrawptr0 = PointerCast(bcx, llrawptr0, llty.ptr_to());
@ -715,7 +713,7 @@ pub fn emit_tydescs(ccx: &mut CrateContext) {
let _icx = push_ctxt("emit_tydescs");
// As of this point, allow no more tydescs to be created.
ccx.finished_tydescs = true;
let glue_fn_ty = Type::generic_glue_fn(ccx);
let glue_fn_ty = Type::generic_glue_fn(ccx).ptr_to();
let tyds = &mut ccx.tydescs;
for tyds.each_value |&val| {
let ti = val;
@ -782,7 +780,3 @@ pub fn emit_tydescs(ccx: &mut CrateContext) {
}
};
}
pub fn type_of_glue_fn(ccx: &CrateContext) -> Type {
Type::glue_fn(ccx.tydesc_type)
}

View file

@ -20,7 +20,6 @@ use middle::trans::base;
use syntax::ast;
use syntax::abi::{Architecture, X86, X86_64, Arm, Mips};
use back::abi;
use core::vec;
use core::cast;
@ -189,22 +188,20 @@ impl Type {
None => ()
}
let ty = Type::glue_fn(cx.tydesc_type).ptr_to();
let ty = Type::glue_fn();
cx.tn.associate_type("glue_fn", &ty);
return ty;
}
pub fn glue_fn(tydesc: Type) -> Type {
let tydescpp = tydesc.ptr_to().ptr_to();
Type::func([ Type::nil().ptr_to(), tydescpp, Type::i8p() ],
pub fn glue_fn() -> Type {
Type::func([ Type::nil().ptr_to(), Type::i8p() ],
&Type::void())
}
pub fn tydesc(arch: Architecture) -> Type {
let mut tydesc = Type::named_struct("tydesc");
let pvoid = Type::i8p();
let glue_fn_ty = Type::glue_fn(tydesc).ptr_to();
let glue_fn_ty = Type::glue_fn().ptr_to();
let int_ty = Type::int(arch);