diff options
| author | Brian Anderson <banderson@mozilla.com> | 2011-08-26 13:58:26 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2011-08-26 13:58:26 -0700 |
| commit | 2744bcd693671869d17bc9b8db013d487fe465b1 (patch) | |
| tree | 5a08b51a913ac9aab94868b2b7097f9c7c3591a5 /src/comp | |
| parent | f0820662c9bdc3d3150b7b7317bb165556c2348b (diff) | |
| download | rust-2744bcd693671869d17bc9b8db013d487fe465b1.tar.gz rust-2744bcd693671869d17bc9b8db013d487fe465b1.zip | |
Revert "Use cstrcache in C_str, C_cstr, C_shape."
This reverts commit d5173b1f2cc174d53272be0d14a8290c05b8670a.
Diffstat (limited to 'src/comp')
| -rw-r--r-- | src/comp/middle/trans.rs | 3 | ||||
| -rw-r--r-- | src/comp/middle/trans_common.rs | 18 |
2 files changed, 7 insertions, 14 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 98c2c23596d..022ad4cdded 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -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); diff --git a/src/comp/middle/trans_common.rs b/src/comp/middle/trans_common.rs index 74b049960f6..8edbcbdbcf9 100644 --- a/src/comp/middle/trans_common.rs +++ b/src/comp/middle/trans_common.rs @@ -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 |
