Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
2e46ac64
R
Rust
项目概览
int
/
Rust
大约 1 年 前同步成功
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
Rust
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
2e46ac64
编写于
12月 18, 2013
作者:
P
Patrick Walton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
librustc: De-`@mut` the short names cache
上级
2612d76d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
8 deletion
+18
-8
src/librustc/metadata/tyencode.rs
src/librustc/metadata/tyencode.rs
+16
-6
src/librustc/middle/ty.rs
src/librustc/middle/ty.rs
+2
-2
未找到文件。
src/librustc/metadata/tyencode.rs
浏览文件 @
2e46ac64
...
...
@@ -60,17 +60,27 @@ fn mywrite(w: @mut MemWriter, fmt: &fmt::Arguments) {
pub
fn
enc_ty
(
w
:
@
mut
MemWriter
,
cx
:
@
ctxt
,
t
:
ty
::
t
)
{
match
cx
.abbrevs
{
ac_no_abbrevs
=>
{
let
result_str
=
match
cx
.tcx.short_names_cache
.find
(
&
t
)
{
Some
(
&
s
)
=>
s
,
let
result_str_opt
;
{
let
short_names_cache
=
cx
.tcx.short_names_cache
.borrow
();
result_str_opt
=
short_names_cache
.get
()
.find
(
&
t
)
.map
(|
result
|
*
result
);
}
let
result_str
=
match
result_str_opt
{
Some
(
s
)
=>
s
,
None
=>
{
let
wr
=
@
mut
MemWriter
::
new
();
enc_sty
(
wr
,
cx
,
&
ty
::
get
(
t
)
.sty
);
let
s
=
str
::
from_utf8
(
*
wr
.inner_ref
())
.to_managed
();
cx
.tcx.short_names_cache
.insert
(
t
,
s
);
let
mut
short_names_cache
=
cx
.tcx
.short_names_cache
.borrow_mut
();
short_names_cache
.get
()
.insert
(
t
,
s
);
s
}
};
w
.write
(
result_str
.as_bytes
());
}
};
w
.write
(
result_str
.as_bytes
());
}
ac_use_abbrevs
(
abbrevs
)
=>
{
match
abbrevs
.find
(
&
t
)
{
...
...
src/librustc/middle/ty.rs
浏览文件 @
2e46ac64
...
...
@@ -307,7 +307,7 @@ struct ctxt_ {
freevars
:
freevars
::
freevar_map
,
tcache
:
type_cache
,
rcache
:
creader_cache
,
short_names_cache
:
@
mut
HashMap
<
t
,
@
str
>
,
short_names_cache
:
RefCell
<
HashMap
<
t
,
@
str
>
>
,
needs_unwind_cleanup_cache
:
@
mut
HashMap
<
t
,
bool
>
,
tc_cache
:
@
mut
HashMap
<
uint
,
TypeContents
>
,
ast_ty_to_ty_cache
:
@
mut
HashMap
<
NodeId
,
ast_ty_to_ty_cache_entry
>
,
...
...
@@ -993,7 +993,7 @@ pub fn mk_ctxt(s: session::Session,
freevars
:
freevars
,
tcache
:
@
mut
HashMap
::
new
(),
rcache
:
mk_rcache
(),
short_names_cache
:
new_ty_hash
(
),
short_names_cache
:
RefCell
::
new
(
HashMap
::
new
()
),
needs_unwind_cleanup_cache
:
new_ty_hash
(),
tc_cache
:
@
mut
HashMap
::
new
(),
ast_ty_to_ty_cache
:
@
mut
HashMap
::
new
(),
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录