rename base_and_len
-> base_and_byte_len
This commit is contained in:
parent
1e128d7931
commit
ef3ec1fe97
@ -1025,8 +1025,7 @@ fn extract_vec_elems(bcx: @mut Block,
|
||||
-> ExtractedBlock {
|
||||
let _icx = push_ctxt("match::extract_vec_elems");
|
||||
let vec_datum = match_datum(bcx, val, pat_id);
|
||||
let (bcx, base, len) = vec_datum.get_vec_base_and_len(bcx, pat_span,
|
||||
pat_id, 0);
|
||||
let (bcx, base, len) = vec_datum.get_vec_base_and_byte_len(bcx, pat_span, pat_id, 0);
|
||||
let vt = tvec::vec_types(bcx, node_id_type(bcx, pat_id));
|
||||
|
||||
let mut elems = do vec::from_fn(elem_count) |i| {
|
||||
@ -1647,9 +1646,7 @@ fn compile_submatch_continue(mut bcx: @mut Block,
|
||||
vec_len(*) => {
|
||||
let vt = tvec::vec_types(bcx, node_id_type(bcx, pat_id));
|
||||
let unboxed = load_if_immediate(bcx, val, vt.vec_ty);
|
||||
let (_, len) = tvec::get_base_and_len(
|
||||
bcx, unboxed, vt.vec_ty
|
||||
);
|
||||
let (_, len) = tvec::get_base_and_byte_len(bcx, unboxed, vt.vec_ty);
|
||||
test_val = SDiv(bcx, len, vt.llunit_size);
|
||||
kind = compare_vec_len;
|
||||
}
|
||||
|
@ -745,7 +745,7 @@ pub fn iter_structural_ty(cx: @mut Block, av: ValueRef, t: ty::t,
|
||||
}
|
||||
ty::ty_estr(ty::vstore_fixed(_)) |
|
||||
ty::ty_evec(_, ty::vstore_fixed(_)) => {
|
||||
let (base, len) = tvec::get_base_and_len(cx, av, t);
|
||||
let (base, len) = tvec::get_base_and_byte_len(cx, av, t);
|
||||
cx = tvec::iter_vec_raw(cx, base, t, len, f);
|
||||
}
|
||||
ty::ty_tup(ref args) => {
|
||||
|
@ -305,7 +305,7 @@ pub fn trans_fail_expr(bcx: @mut Block,
|
||||
bcx, expr::trans_to_datum(bcx, arg_expr));
|
||||
|
||||
if ty::type_is_str(arg_datum.ty) {
|
||||
let (lldata, _) = arg_datum.get_vec_base_and_len_no_root(bcx);
|
||||
let (lldata, _) = arg_datum.get_vec_base_and_byte_len_no_root(bcx);
|
||||
return trans_fail_value(bcx, sp_opt, lldata);
|
||||
} else if bcx.unreachable || ty::type_is_bot(arg_datum.ty) {
|
||||
return bcx;
|
||||
|
@ -770,28 +770,28 @@ impl Datum {
|
||||
DatumBlock { bcx: bcx, datum: datum }
|
||||
}
|
||||
|
||||
pub fn get_vec_base_and_len(&self,
|
||||
mut bcx: @mut Block,
|
||||
span: Span,
|
||||
expr_id: ast::NodeId,
|
||||
derefs: uint)
|
||||
-> (@mut Block, ValueRef, ValueRef) {
|
||||
pub fn get_vec_base_and_byte_len(&self,
|
||||
mut bcx: @mut Block,
|
||||
span: Span,
|
||||
expr_id: ast::NodeId,
|
||||
derefs: uint)
|
||||
-> (@mut Block, ValueRef, ValueRef) {
|
||||
//! Converts a vector into the slice pair. Performs rooting
|
||||
//! and write guards checks.
|
||||
|
||||
// only imp't for @[] and @str, but harmless
|
||||
bcx = write_guard::root_and_write_guard(self, bcx, span, expr_id, derefs);
|
||||
let (base, len) = self.get_vec_base_and_len_no_root(bcx);
|
||||
let (base, len) = self.get_vec_base_and_byte_len_no_root(bcx);
|
||||
(bcx, base, len)
|
||||
}
|
||||
|
||||
pub fn get_vec_base_and_len_no_root(&self, bcx: @mut Block)
|
||||
-> (ValueRef, ValueRef) {
|
||||
pub fn get_vec_base_and_byte_len_no_root(&self, bcx: @mut Block)
|
||||
-> (ValueRef, ValueRef) {
|
||||
//! Converts a vector into the slice pair. Des not root
|
||||
//! nor perform write guard checks.
|
||||
|
||||
let llval = self.to_appropriate_llval(bcx);
|
||||
tvec::get_base_and_len(bcx, llval, self.ty)
|
||||
tvec::get_base_and_byte_len(bcx, llval, self.ty)
|
||||
}
|
||||
|
||||
pub fn root_and_write_guard(&self,
|
||||
|
@ -265,7 +265,7 @@ pub fn trans_to_datum(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
|
||||
let unit_ty = ty::sequence_element_type(tcx, datum.ty);
|
||||
|
||||
let (bcx, base, len) =
|
||||
datum.get_vec_base_and_len(bcx, expr.span, expr.id, autoderefs+1);
|
||||
datum.get_vec_base_and_byte_len(bcx, expr.span, expr.id, autoderefs+1);
|
||||
|
||||
// this type may have a different region/mutability than the
|
||||
// real one, but it will have the same runtime representation
|
||||
@ -978,8 +978,8 @@ fn trans_lvalue_unadjusted(bcx: @mut Block, expr: &ast::Expr) -> DatumBlock {
|
||||
base::maybe_name_value(bcx.ccx(), vt.llunit_size, "unit_sz");
|
||||
|
||||
let (bcx, base, len) =
|
||||
base_datum.get_vec_base_and_len(bcx, index_expr.span,
|
||||
index_expr.id, 0);
|
||||
base_datum.get_vec_base_and_byte_len(bcx, index_expr.span,
|
||||
index_expr.id, 0);
|
||||
|
||||
debug2!("trans_index: base {}", bcx.val_to_str(base));
|
||||
debug2!("trans_index: len {}", bcx.val_to_str(len));
|
||||
|
@ -501,7 +501,7 @@ pub fn elements_required(bcx: @mut Block, content_expr: &ast::Expr) -> uint {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_base_and_len(bcx: @mut Block,
|
||||
pub fn get_base_and_byte_len(bcx: @mut Block,
|
||||
llval: ValueRef,
|
||||
vec_ty: ty::t) -> (ValueRef, ValueRef) {
|
||||
//!
|
||||
@ -509,7 +509,7 @@ pub fn get_base_and_len(bcx: @mut Block,
|
||||
// Converts a vector into the slice pair. The vector should be stored in
|
||||
// `llval` which should be either immediate or by-ref as appropriate for
|
||||
// the vector type. If you have a datum, you would probably prefer to
|
||||
// call `Datum::get_base_and_len()` which will handle any conversions for
|
||||
// call `Datum::get_base_and_byte_len()` which will handle any conversions for
|
||||
// you.
|
||||
|
||||
let ccx = bcx.ccx();
|
||||
|
Loading…
Reference in New Issue
Block a user