Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
9c71249b
R
Rust
项目概览
int
/
Rust
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
9c71249b
编写于
2月 21, 2013
作者:
P
Patrick Walton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
librustc: De-mut trans. rs=demuting
上级
553c27c5
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
43 addition
and
43 deletion
+43
-43
src/librustc/middle/trans/_match.rs
src/librustc/middle/trans/_match.rs
+3
-3
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/base.rs
+17
-17
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/common.rs
+17
-17
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/debuginfo.rs
+2
-2
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/expr.rs
+2
-2
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/glue.rs
+2
-2
未找到文件。
src/librustc/middle/trans/_match.rs
浏览文件 @
9c71249b
...
...
@@ -831,7 +831,7 @@ pub fn extract_variant_args(bcx: block,
->
ExtractedBlock
{
let
(
enm
,
evar
)
=
vdefs
;
let
_
icx
=
bcx
.insn_ctxt
(
"match::extract_variant_args"
);
let
ccx
=
bcx
.fcx.ccx
;
let
ccx
=
*
bcx
.fcx.ccx
;
let
enum_ty_substs
=
match
ty
::
get
(
node_id_type
(
bcx
,
pat_id
))
.sty
{
ty
::
ty_enum
(
id
,
ref
substs
)
=>
{
assert
id
==
enm
;
...
...
@@ -1272,7 +1272,7 @@ pub fn compile_submatch(bcx: block,
let
vals_left
=
vec
::
append
(
vec
::
slice
(
vals
,
0u
,
col
)
.to_vec
(),
vec
::
slice
(
vals
,
col
+
1u
,
vals
.len
()));
let
ccx
=
bcx
.fcx.ccx
;
let
ccx
=
*
bcx
.fcx.ccx
;
let
mut
pat_id
=
0
;
for
vec
::
each
(
m
)
|
br
|
{
// Find a real id (we're adding placeholder wildcard patterns, but
...
...
@@ -1710,7 +1710,7 @@ pub fn bind_irrefutable_pat(bcx: block,
binding_mode
:
IrrefutablePatternBindingMode
)
->
block
{
let
_
icx
=
bcx
.insn_ctxt
(
"match::bind_irrefutable_pat"
);
let
ccx
=
bcx
.fcx.ccx
;
let
ccx
=
*
bcx
.fcx.ccx
;
let
mut
bcx
=
bcx
;
// Necessary since bind_irrefutable_pat is called outside trans_match
...
...
src/librustc/middle/trans/base.rs
浏览文件 @
9c71249b
...
...
@@ -1162,7 +1162,7 @@ pub fn trans_stmt(cx: block, s: ast::stmt) -> block {
}
}
}
ast
::
decl_item
(
i
)
=>
trans_item
(
cx
.fcx.ccx
,
*
i
)
ast
::
decl_item
(
i
)
=>
trans_item
(
*
cx
.fcx.ccx
,
*
i
)
}
}
ast
::
stmt_mac
(
*
)
=>
cx
.tcx
()
.sess
.bug
(
~
"unexpanded macro"
)
...
...
@@ -1584,25 +1584,25 @@ pub fn new_fn_ctxt_w_id(ccx: @CrateContext,
param_substs
:
Option
<@
param_substs
>
,
sp
:
Option
<
span
>
)
->
fn_ctxt
{
let
llbbs
=
mk_standard_basic_blocks
(
llfndecl
);
return
@
fn_ctxt_
{
return
@
mut
fn_ctxt_
{
llfn
:
llfndecl
,
llenv
:
unsafe
{
llvm
::
LLVMGetParam
(
llfndecl
,
1u
as
c_uint
)
},
llretptr
:
unsafe
{
llvm
::
LLVMGetParam
(
llfndecl
,
0u
as
c_uint
)
},
mut
llstaticallocas
:
llbbs
.sa
,
mut
llloadenv
:
None
,
mut
llreturn
:
llbbs
.rt
,
mut
llself
:
None
,
mut
personality
:
None
,
mut
loop_ret
:
None
,
llargs
:
HashMap
(),
lllocals
:
HashMap
(),
llupvars
:
HashMap
(),
llstaticallocas
:
llbbs
.sa
,
llloadenv
:
None
,
llreturn
:
llbbs
.rt
,
llself
:
None
,
personality
:
None
,
loop_ret
:
None
,
llargs
:
@
HashMap
(),
lllocals
:
@
HashMap
(),
llupvars
:
@
HashMap
(),
id
:
id
,
impl_id
:
impl_id
,
param_substs
:
param_substs
,
span
:
sp
,
path
:
path
,
ccx
:
ccx
ccx
:
@
ccx
};
}
...
...
@@ -1792,7 +1792,7 @@ pub fn trans_closure(ccx: @CrateContext,
llvm
::
LLVMSetGC
(
fcx
.llfn
,
strategy
);
}
}
ccx
.uses_gc
=
true
;
*
ccx
.uses_gc
=
true
;
}
// Create the first basic block in the function and keep a handle on it to
...
...
@@ -2815,7 +2815,7 @@ pub fn trap(bcx: block) {
}
pub
fn
decl_gc_metadata
(
ccx
:
@
CrateContext
,
llmod_id
:
~
str
)
{
if
!
ccx
.sess.opts.gc
||
!
ccx
.uses_gc
{
if
!
ccx
.sess.opts.gc
||
!
*
ccx
.uses_gc
{
return
;
}
...
...
@@ -3050,7 +3050,7 @@ pub fn trans_crate(sess: session::Session,
discrims
:
HashMap
(),
discrim_symbols
:
HashMap
(),
tydescs
:
ty
::
new_ty_hash
(),
mut
finished_tydescs
:
false
,
finished_tydescs
:
@
mut
false
,
external
:
HashMap
(),
monomorphized
:
HashMap
(),
monomorphizing
:
HashMap
(),
...
...
@@ -3092,9 +3092,9 @@ pub fn trans_crate(sess: session::Session,
builder
:
BuilderRef_res
(
unsafe
{
llvm
::
LLVMCreateBuilder
()
}),
shape_cx
:
mk_ctxt
(
llmod
),
crate_map
:
crate_map
,
mut
uses_gc
:
false
,
uses_gc
:
@
mut
false
,
dbg_cx
:
dbg_cx
,
mut
do_not_commit_warning_issued
:
false
do_not_commit_warning_issued
:
@
mut
false
};
{
...
...
src/librustc/middle/trans/common.rs
浏览文件 @
9c71249b
...
...
@@ -175,7 +175,7 @@ pub struct CrateContext {
tydescs
:
HashMap
<
ty
::
t
,
@
mut
tydesc_info
>
,
// Set when running emit_tydescs to enforce that no more tydescs are
// created.
mut
finished_tydescs
:
bool
,
finished_tydescs
:
@
mut
bool
,
// Track mapping of external ids to local items imported for inlining
external
:
HashMap
<
ast
::
def_id
,
Option
<
ast
::
node_id
>>
,
// Cache instances of monomorphized functions
...
...
@@ -224,9 +224,9 @@ pub struct CrateContext {
// Set when at least one function uses GC. Needed so that
// decl_gc_metadata knows whether to link to the module metadata, which
// is not emitted by LLVM's GC pass when no functions use GC.
mut
uses_gc
:
bool
,
uses_gc
:
@
mut
bool
,
dbg_cx
:
Option
<
debuginfo
::
DebugContext
>
,
mut
do_not_commit_warning_issued
:
bool
do_not_commit_warning_issued
:
@
mut
bool
}
// Types used for llself.
...
...
@@ -273,34 +273,34 @@ pub struct fn_ctxt_ {
// the function, due to LLVM's quirks.
// A block for all the function's static allocas, so that LLVM
// will coalesce them into a single alloca call.
mut
llstaticallocas
:
BasicBlockRef
,
llstaticallocas
:
BasicBlockRef
,
// A block containing code that copies incoming arguments to space
// already allocated by code in one of the llallocas blocks.
// (LLVM requires that arguments be copied to local allocas before
// allowing most any operation to be performed on them.)
mut
llloadenv
:
Option
<
BasicBlockRef
>
,
mut
llreturn
:
BasicBlockRef
,
llloadenv
:
Option
<
BasicBlockRef
>
,
llreturn
:
BasicBlockRef
,
// The 'self' value currently in use in this function, if there
// is one.
//
// NB: This is the type of the self *variable*, not the self *type*. The
// self type is set only for default methods, while the self variable is
// set for all methods.
mut
llself
:
Option
<
ValSelfData
>
,
llself
:
Option
<
ValSelfData
>
,
// The a value alloca'd for calls to upcalls.rust_personality. Used when
// outputting the resume instruction.
mut
personality
:
Option
<
ValueRef
>
,
personality
:
Option
<
ValueRef
>
,
// If this is a for-loop body that returns, this holds the pointers needed
// for that (flagptr, retptr)
mut
loop_ret
:
Option
<
(
ValueRef
,
ValueRef
)
>
,
loop_ret
:
Option
<
(
ValueRef
,
ValueRef
)
>
,
// Maps arguments to allocas created for them in llallocas.
llargs
:
HashMap
<
ast
::
node_id
,
local_val
>
,
llargs
:
@
HashMap
<
ast
::
node_id
,
local_val
>
,
// Maps the def_ids for local variables to the allocas created for
// them in llallocas.
lllocals
:
HashMap
<
ast
::
node_id
,
local_val
>
,
lllocals
:
@
HashMap
<
ast
::
node_id
,
local_val
>
,
// Same as above, but for closure upvars
llupvars
:
HashMap
<
ast
::
node_id
,
ValueRef
>
,
llupvars
:
@
HashMap
<
ast
::
node_id
,
ValueRef
>
,
// The node_id of the function, or -1 if it doesn't correspond to
// a user-defined function.
...
...
@@ -319,14 +319,14 @@ pub struct fn_ctxt_ {
path
:
path
,
// This function's enclosing crate context.
ccx
:
@
CrateContext
ccx
:
@
@
CrateContext
}
pub
type
fn_ctxt
=
@
fn_ctxt_
;
pub
type
fn_ctxt
=
@
mut
fn_ctxt_
;
pub
fn
warn_not_to_commit
(
ccx
:
@
CrateContext
,
msg
:
~
str
)
{
if
!
ccx
.do_not_commit_warning_issued
{
ccx
.do_not_commit_warning_issued
=
true
;
if
!
*
ccx
.do_not_commit_warning_issued
{
*
ccx
.do_not_commit_warning_issued
=
true
;
ccx
.sess
.warn
(
msg
+
~
" -- do not commit like this!"
);
}
}
...
...
@@ -689,7 +689,7 @@ pub fn block_parent(cx: block) -> block {
// Accessors
pub
impl
block
{
pure
fn
ccx
()
->
@
CrateContext
{
self
.fcx.ccx
}
pure
fn
ccx
()
->
@
CrateContext
{
*
self
.fcx.ccx
}
pure
fn
tcx
()
->
ty
::
ctxt
{
self
.fcx.ccx.tcx
}
pure
fn
sess
()
->
Session
{
self
.fcx.ccx.sess
}
...
...
src/librustc/middle/trans/debuginfo.rs
浏览文件 @
9c71249b
...
...
@@ -778,7 +778,7 @@ pub fn create_local_var(bcx: block, local: @ast::local)
pub
fn
create_arg
(
bcx
:
block
,
arg
:
ast
::
arg
,
sp
:
span
)
->
Option
<@
Metadata
<
ArgumentMetadata
>>
{
unsafe
{
let
fcx
=
bcx
.fcx
,
cx
=
fcx
.ccx
;
let
fcx
=
bcx
.fcx
,
cx
=
*
fcx
.ccx
;
let
cache
=
get_cache
(
cx
);
let
tg
=
ArgVariableTag
;
match
cached_metadata
::
<@
Metadata
<
ArgumentMetadata
>>
(
...
...
@@ -845,7 +845,7 @@ pub fn update_source_pos(cx: block, s: span) {
}
pub
fn
create_function
(
fcx
:
fn_ctxt
)
->
@
Metadata
<
SubProgramMetadata
>
{
let
cx
=
fcx
.ccx
;
let
cx
=
*
fcx
.ccx
;
let
dbg_cx
=
(
/*bad*/
copy
cx
.dbg_cx
)
.get
();
debug!
(
"~~"
);
...
...
src/librustc/middle/trans/expr.rs
浏览文件 @
9c71249b
...
...
@@ -944,10 +944,10 @@ pub fn trans_local_var(bcx: block, def: ast::def) -> Datum {
}
}
ast
::
def_arg
(
nid
,
_
,
_
)
=>
{
take_local
(
bcx
,
bcx
.fcx.llargs
,
nid
)
take_local
(
bcx
,
*
bcx
.fcx.llargs
,
nid
)
}
ast
::
def_local
(
nid
,
_
)
|
ast
::
def_binding
(
nid
,
_
)
=>
{
take_local
(
bcx
,
bcx
.fcx.lllocals
,
nid
)
take_local
(
bcx
,
*
bcx
.fcx.lllocals
,
nid
)
}
ast
::
def_self
(
nid
,
_
)
=>
{
let
self_info
:
ValSelfData
=
match
bcx
.fcx.llself
{
...
...
src/librustc/middle/trans/glue.rs
浏览文件 @
9c71249b
...
...
@@ -654,7 +654,7 @@ pub fn declare_tydesc(ccx: @CrateContext, t: ty::t) -> @mut tydesc_info {
let
_
icx
=
ccx
.insn_ctxt
(
"declare_tydesc"
);
// If emit_tydescs already ran, then we shouldn't be creating any new
// tydescs.
assert
!
ccx
.finished_tydescs
;
assert
!
*
ccx
.finished_tydescs
;
let
llty
=
type_of
(
ccx
,
t
);
...
...
@@ -761,7 +761,7 @@ pub fn make_generic_glue(ccx: @CrateContext, t: ty::t, llfn: ValueRef,
pub
fn
emit_tydescs
(
ccx
:
@
CrateContext
)
{
let
_
icx
=
ccx
.insn_ctxt
(
"emit_tydescs"
);
// As of this point, allow no more tydescs to be created.
ccx
.finished_tydescs
=
true
;
*
ccx
.finished_tydescs
=
true
;
for
ccx
.tydescs.each_value
|
&
val
|
{
let
glue_fn_ty
=
T_ptr
(
T_generic_glue_fn
(
ccx
));
let
ti
=
val
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录