Revert "Use cstrcache in C_str, C_cstr, C_shape."
This reverts commit d5173b1f2c.
This commit is contained in:
parent
f0820662c9
commit
2744bcd693
2 changed files with 7 additions and 14 deletions
|
|
@ -6395,8 +6395,7 @@ fn trans_crate(sess: &session::session, crate: &@ast::crate, tcx: &ty::ctxt,
|
|||
task_type: task_type,
|
||||
builder: BuilderRef_res(llvm::LLVMCreateBuilder()),
|
||||
shape_cx: shape::mk_ctxt(llmod),
|
||||
gc_cx: gc::mk_ctxt(),
|
||||
cstrcache: cstrcache::mk()};
|
||||
gc_cx: gc::mk_ctxt()};
|
||||
let cx = new_local_ctxt(ccx);
|
||||
collect_items(ccx, crate);
|
||||
collect_tag_ctors(ccx, crate);
|
||||
|
|
|
|||
|
|
@ -154,8 +154,7 @@ type crate_ctxt =
|
|||
task_type: TypeRef,
|
||||
builder: BuilderRef_res,
|
||||
shape_cx: shape::ctxt,
|
||||
gc_cx: gc::ctxt,
|
||||
cstrcache: cstrcache::t};
|
||||
gc_cx: gc::ctxt};
|
||||
|
||||
type local_ctxt =
|
||||
{path: [str],
|
||||
|
|
@ -843,11 +842,10 @@ fn C_u8(i: uint) -> ValueRef { ret C_integral(T_i8(), i, False); }
|
|||
// This is a 'c-like' raw string, which differs from
|
||||
// our boxed-and-length-annotated strings.
|
||||
fn C_cstr(cx: &@crate_ctxt, s: &str) -> ValueRef {
|
||||
let sc = llvm::LLVMConstString(safe_sbuf(cx, s),
|
||||
str::byte_len(s), False);
|
||||
let sc = llvm::LLVMConstString(str::buf(s), str::byte_len(s), False);
|
||||
let g =
|
||||
llvm::LLVMAddGlobal(cx.llmod, val_ty(sc),
|
||||
safe_sbuf(cx, cx.names.next("str")));
|
||||
str::buf(cx.names.next("str")));
|
||||
llvm::LLVMSetInitializer(g, sc);
|
||||
llvm::LLVMSetGlobalConstant(g, True);
|
||||
llvm::LLVMSetLinkage(g, lib::llvm::LLVMInternalLinkage as llvm::Linkage);
|
||||
|
|
@ -865,10 +863,10 @@ fn C_str(cx: &@crate_ctxt, s: &str) -> ValueRef {
|
|||
let box =
|
||||
C_struct([C_int(abi::const_refcount as int), C_int(len + 1u as int),
|
||||
C_int(len + 1u as int), C_int(0),
|
||||
llvm::LLVMConstString(safe_sbuf(cx, s), len, False)]);
|
||||
llvm::LLVMConstString(str::buf(s), len, False)]);
|
||||
let g =
|
||||
llvm::LLVMAddGlobal(cx.llmod, val_ty(box),
|
||||
safe_sbuf(cx, cx.names.next("str")));
|
||||
str::buf(cx.names.next("str")));
|
||||
llvm::LLVMSetInitializer(g, box);
|
||||
llvm::LLVMSetGlobalConstant(g, True);
|
||||
llvm::LLVMSetLinkage(g, lib::llvm::LLVMInternalLinkage as llvm::Linkage);
|
||||
|
|
@ -911,7 +909,7 @@ fn C_shape(ccx: &@crate_ctxt, bytes: &[u8]) -> ValueRef {
|
|||
let llshape = C_bytes(bytes);
|
||||
let llglobal =
|
||||
llvm::LLVMAddGlobal(ccx.llmod, val_ty(llshape),
|
||||
safe_sbuf(ccx, ccx.names.next("shape")));
|
||||
str::buf(ccx.names.next("shape")));
|
||||
llvm::LLVMSetInitializer(llglobal, llshape);
|
||||
llvm::LLVMSetGlobalConstant(llglobal, True);
|
||||
llvm::LLVMSetLinkage(llglobal,
|
||||
|
|
@ -919,10 +917,6 @@ fn C_shape(ccx: &@crate_ctxt, bytes: &[u8]) -> ValueRef {
|
|||
ret llvm::LLVMConstPointerCast(llglobal, T_ptr(T_i8()));
|
||||
}
|
||||
|
||||
fn safe_sbuf(ccx: &@crate_ctxt, s: &str) -> str::rustrt::sbuf {
|
||||
cstrcache::get_cstr(ccx.cstrcache, s)
|
||||
}
|
||||
|
||||
//
|
||||
// Local Variables:
|
||||
// mode: rust
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue