Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
048ed148
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,发现更多精彩内容 >>
提交
048ed148
编写于
6月 17, 2013
作者:
J
James Miller
提交者:
James Miller
6月 22, 2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Move count-llvm-insn code into task-local storage
上级
0b0c756c
变更
18
展开全部
隐藏空白更改
内联
并排
Showing
18 changed file
with
225 addition
and
223 deletion
+225
-223
src/librustc/middle/trans/_match.rs
src/librustc/middle/trans/_match.rs
+8
-8
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/base.rs
+87
-83
src/librustc/middle/trans/build.rs
src/librustc/middle/trans/build.rs
+2
-3
src/librustc/middle/trans/callee.rs
src/librustc/middle/trans/callee.rs
+7
-7
src/librustc/middle/trans/closure.rs
src/librustc/middle/trans/closure.rs
+10
-10
src/librustc/middle/trans/common.rs
src/librustc/middle/trans/common.rs
+0
-1
src/librustc/middle/trans/consts.rs
src/librustc/middle/trans/consts.rs
+4
-4
src/librustc/middle/trans/context.rs
src/librustc/middle/trans/context.rs
+4
-3
src/librustc/middle/trans/controlflow.rs
src/librustc/middle/trans/controlflow.rs
+11
-11
src/librustc/middle/trans/datum.rs
src/librustc/middle/trans/datum.rs
+4
-4
src/librustc/middle/trans/expr.rs
src/librustc/middle/trans/expr.rs
+23
-23
src/librustc/middle/trans/foreign.rs
src/librustc/middle/trans/foreign.rs
+16
-16
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/glue.rs
+22
-22
src/librustc/middle/trans/inline.rs
src/librustc/middle/trans/inline.rs
+2
-3
src/librustc/middle/trans/meth.rs
src/librustc/middle/trans/meth.rs
+10
-10
src/librustc/middle/trans/monomorphize.rs
src/librustc/middle/trans/monomorphize.rs
+2
-2
src/librustc/middle/trans/tvec.rs
src/librustc/middle/trans/tvec.rs
+11
-11
src/librustc/middle/trans/uniq.rs
src/librustc/middle/trans/uniq.rs
+2
-2
未找到文件。
src/librustc/middle/trans/_match.rs
浏览文件 @
048ed148
...
...
@@ -259,7 +259,7 @@ pub enum opt_result {
range_result
(
Result
,
Result
),
}
pub
fn
trans_opt
(
bcx
:
block
,
o
:
&
Opt
)
->
opt_result
{
let
_
icx
=
bcx
.insn
_ctxt
(
"match::trans_opt"
);
let
_
icx
=
push
_ctxt
(
"match::trans_opt"
);
let
ccx
=
bcx
.ccx
();
let
bcx
=
bcx
;
match
*
o
{
...
...
@@ -870,7 +870,7 @@ pub fn extract_variant_args(bcx: block,
disr_val
:
int
,
val
:
ValueRef
)
->
ExtractedBlock
{
let
_
icx
=
bcx
.insn
_ctxt
(
"match::extract_variant_args"
);
let
_
icx
=
push
_ctxt
(
"match::extract_variant_args"
);
let
args
=
do
vec
::
from_fn
(
adt
::
num_args
(
repr
,
disr_val
))
|
i
|
{
adt
::
trans_field_ptr
(
bcx
,
repr
,
val
,
disr_val
,
i
)
};
...
...
@@ -896,7 +896,7 @@ pub fn extract_vec_elems(bcx: block,
val
:
ValueRef
,
count
:
ValueRef
)
->
ExtractedBlock
{
let
_
icx
=
bcx
.insn
_ctxt
(
"match::extract_vec_elems"
);
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
);
...
...
@@ -1088,7 +1088,7 @@ pub fn compare_values(cx: block,
rhs
:
ValueRef
,
rhs_t
:
ty
::
t
)
->
Result
{
let
_
icx
=
cx
.insn
_ctxt
(
"compare_values"
);
let
_
icx
=
push
_ctxt
(
"compare_values"
);
if
ty
::
type_is_scalar
(
rhs_t
)
{
let
rs
=
compare_scalar_types
(
cx
,
lhs
,
rhs
,
rhs_t
,
ast
::
eq
);
return
rslt
(
rs
.bcx
,
rs
.val
);
...
...
@@ -1277,7 +1277,7 @@ pub fn compile_submatch(bcx: block,
For an empty match, a fall-through case must exist
*/
assert
!
((
m
.len
()
>
0u
||
chk
.is_some
()));
let
_
icx
=
bcx
.insn
_ctxt
(
"match::compile_submatch"
);
let
_
icx
=
push
_ctxt
(
"match::compile_submatch"
);
let
mut
bcx
=
bcx
;
let
tcx
=
bcx
.tcx
();
let
dm
=
tcx
.def_map
;
...
...
@@ -1617,7 +1617,7 @@ pub fn trans_match(bcx: block,
discr_expr
:
@
ast
::
expr
,
arms
:
~
[
ast
::
arm
],
dest
:
Dest
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"match::trans_match"
);
let
_
icx
=
push
_ctxt
(
"match::trans_match"
);
do
with_scope
(
bcx
,
match_expr
.info
(),
"match"
)
|
bcx
|
{
trans_match_inner
(
bcx
,
discr_expr
,
arms
,
dest
)
}
...
...
@@ -1664,7 +1664,7 @@ pub fn trans_match_inner(scope_cx: block,
discr_expr
:
@
ast
::
expr
,
arms
:
&
[
ast
::
arm
],
dest
:
Dest
)
->
block
{
let
_
icx
=
scope_cx
.insn
_ctxt
(
"match::trans_match_inner"
);
let
_
icx
=
push
_ctxt
(
"match::trans_match_inner"
);
let
mut
bcx
=
scope_cx
;
let
tcx
=
bcx
.tcx
();
...
...
@@ -1751,7 +1751,7 @@ pub fn bind_irrefutable_pat(bcx: block,
make_copy
:
bool
,
binding_mode
:
IrrefutablePatternBindingMode
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"match::bind_irrefutable_pat"
);
let
_
icx
=
push
_ctxt
(
"match::bind_irrefutable_pat"
);
let
ccx
=
bcx
.fcx.ccx
;
let
mut
bcx
=
bcx
;
...
...
src/librustc/middle/trans/base.rs
浏览文件 @
048ed148
此差异已折叠。
点击以展开。
src/librustc/middle/trans/build.rs
浏览文件 @
048ed148
...
...
@@ -19,6 +19,7 @@
use
middle
::
trans
::
machine
::
llalign_of_min
;
use
syntax
::
codemap
::
span
;
use
middle
::
trans
::
base
;
use
middle
::
trans
::
type_
::
Type
;
use
core
::
cast
;
...
...
@@ -46,10 +47,8 @@ pub fn B(cx: block) -> BuilderRef {
}
pub
fn
count_insn
(
cx
:
block
,
category
:
&
str
)
{
if
cx
.ccx
()
.sess
.count_llvm_insns
()
{
do
base
::
with_insn_ctxt
|
v
|
{
let
h
=
&
mut
cx
.ccx
()
.stats.llvm_insns
;
let
v
:
&
[
~
str
]
=
cx
.ccx
()
.stats.llvm_insn_ctxt
;
// Build version of path with cycles removed.
...
...
src/librustc/middle/trans/callee.rs
浏览文件 @
048ed148
...
...
@@ -78,7 +78,7 @@ pub struct Callee {
}
pub
fn
trans
(
bcx
:
block
,
expr
:
@
ast
::
expr
)
->
Callee
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_callee"
);
let
_
icx
=
push
_ctxt
(
"trans_callee"
);
debug!
(
"callee::trans(expr=%s)"
,
expr
.repr
(
bcx
.tcx
()));
// pick out special kinds of expressions that can be called:
...
...
@@ -172,7 +172,7 @@ pub fn trans_fn_ref(bcx: block,
* with id `def_id` into a function pointer. This may require
* monomorphization or inlining. */
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_fn_ref"
);
let
_
icx
=
push
_ctxt
(
"trans_fn_ref"
);
let
type_params
=
node_id_type_params
(
bcx
,
ref_id
);
let
vtables
=
node_vtables
(
bcx
,
ref_id
);
...
...
@@ -216,7 +216,7 @@ pub fn trans_fn_ref_with_vtables(
// - `type_params`: values for each of the fn/method's type parameters
// - `vtables`: values for each bound on each of the type parameters
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_fn_ref_with_vtables"
);
let
_
icx
=
push
_ctxt
(
"trans_fn_ref_with_vtables"
);
let
ccx
=
bcx
.ccx
();
let
tcx
=
ccx
.tcx
;
...
...
@@ -357,7 +357,7 @@ pub fn trans_call(in_cx: block,
id
:
ast
::
node_id
,
dest
:
expr
::
Dest
)
->
block
{
let
_
icx
=
in_cx
.insn
_ctxt
(
"trans_call"
);
let
_
icx
=
push
_ctxt
(
"trans_call"
);
trans_call_inner
(
in_cx
,
call_ex
.info
(),
expr_ty
(
in_cx
,
f
),
...
...
@@ -375,7 +375,7 @@ pub fn trans_method_call(in_cx: block,
args
:
CallArgs
,
dest
:
expr
::
Dest
)
->
block
{
let
_
icx
=
in_cx
.insn
_ctxt
(
"trans_method_call"
);
let
_
icx
=
push
_ctxt
(
"trans_method_call"
);
debug!
(
"trans_method_call(call_ex=%s, rcvr=%s)"
,
call_ex
.repr
(
in_cx
.tcx
()),
rcvr
.repr
(
in_cx
.tcx
()));
...
...
@@ -671,7 +671,7 @@ pub fn trans_args(cx: block,
autoref_arg
:
AutorefArg
,
llargs
:
&
mut
~
[
ValueRef
])
->
block
{
let
_
icx
=
cx
.insn
_ctxt
(
"trans_args"
);
let
_
icx
=
push
_ctxt
(
"trans_args"
);
let
mut
temp_cleanups
=
~
[];
let
arg_tys
=
ty
::
ty_fn_args
(
fn_ty
);
...
...
@@ -725,7 +725,7 @@ pub fn trans_arg_expr(bcx: block,
temp_cleanups
:
&
mut
~
[
ValueRef
],
ret_flag
:
Option
<
ValueRef
>
,
autoref_arg
:
AutorefArg
)
->
Result
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_arg_expr"
);
let
_
icx
=
push
_ctxt
(
"trans_arg_expr"
);
let
ccx
=
bcx
.ccx
();
debug!
(
"trans_arg_expr(formal_arg_ty=(%s), self_mode=%?, arg_expr=%s,
\
...
...
src/librustc/middle/trans/closure.rs
浏览文件 @
048ed148
...
...
@@ -162,12 +162,12 @@ pub fn mk_closure_tys(tcx: ty::ctxt,
pub
fn
allocate_cbox
(
bcx
:
block
,
sigil
:
ast
::
Sigil
,
cdata_ty
:
ty
::
t
)
->
Result
{
let
_
icx
=
bcx
.insn
_ctxt
(
"closure::allocate_cbox"
);
let
_
icx
=
push
_ctxt
(
"closure::allocate_cbox"
);
let
ccx
=
bcx
.ccx
();
let
tcx
=
ccx
.tcx
;
fn
nuke_ref_count
(
bcx
:
block
,
llbox
:
ValueRef
)
{
let
_
icx
=
bcx
.insn
_ctxt
(
"closure::nuke_ref_count"
);
let
_
icx
=
push
_ctxt
(
"closure::nuke_ref_count"
);
// Initialize ref count to arbitrary value for debugging:
let
ccx
=
bcx
.ccx
();
let
llbox
=
PointerCast
(
bcx
,
llbox
,
Type
::
opaque_box
(
ccx
)
.ptr_to
());
...
...
@@ -206,7 +206,7 @@ pub struct ClosureResult {
pub
fn
store_environment
(
bcx
:
block
,
bound_values
:
~
[
EnvValue
],
sigil
:
ast
::
Sigil
)
->
ClosureResult
{
let
_
icx
=
bcx
.insn
_ctxt
(
"closure::store_environment"
);
let
_
icx
=
push
_ctxt
(
"closure::store_environment"
);
let
ccx
=
bcx
.ccx
();
let
tcx
=
ccx
.tcx
;
...
...
@@ -260,7 +260,7 @@ pub fn build_closure(bcx0: block,
cap_vars
:
&
[
moves
::
CaptureVar
],
sigil
:
ast
::
Sigil
,
include_ret_handle
:
Option
<
ValueRef
>
)
->
ClosureResult
{
let
_
icx
=
bcx0
.insn
_ctxt
(
"closure::build_closure"
);
let
_
icx
=
push
_ctxt
(
"closure::build_closure"
);
// If we need to, package up the iterator body to call
let
bcx
=
bcx0
;
...
...
@@ -322,7 +322,7 @@ pub fn load_environment(fcx: fn_ctxt,
cap_vars
:
&
[
moves
::
CaptureVar
],
load_ret_handle
:
bool
,
sigil
:
ast
::
Sigil
)
{
let
_
icx
=
fcx
.insn
_ctxt
(
"closure::load_environment"
);
let
_
icx
=
push
_ctxt
(
"closure::load_environment"
);
let
llloadenv
=
match
fcx
.llloadenv
{
Some
(
ll
)
=>
ll
,
...
...
@@ -393,7 +393,7 @@ pub fn trans_expr_fn(bcx: block,
(fn ptr, env) pair
*/
let
_
icx
=
bcx
.insn
_ctxt
(
"closure::trans_expr_fn"
);
let
_
icx
=
push
_ctxt
(
"closure::trans_expr_fn"
);
let
dest_addr
=
match
dest
{
expr
::
SaveIn
(
p
)
=>
p
,
...
...
@@ -470,7 +470,7 @@ pub fn make_closure_glue(
v
:
ValueRef
,
t
:
ty
::
t
,
glue_fn
:
@
fn
(
block
,
v
:
ValueRef
,
t
:
ty
::
t
)
->
block
)
->
block
{
let
_
icx
=
cx
.insn
_ctxt
(
"closure::make_closure_glue"
);
let
_
icx
=
push
_ctxt
(
"closure::make_closure_glue"
);
let
bcx
=
cx
;
let
tcx
=
cx
.tcx
();
...
...
@@ -494,7 +494,7 @@ pub fn make_opaque_cbox_take_glue(
cboxptr
:
ValueRef
)
// ptr to ptr to the opaque closure
->
block
{
// Easy cases:
let
_
icx
=
bcx
.insn
_ctxt
(
"closure::make_opaque_cbox_take_glue"
);
let
_
icx
=
push
_ctxt
(
"closure::make_opaque_cbox_take_glue"
);
match
sigil
{
ast
::
BorrowedSigil
=>
{
return
bcx
;
...
...
@@ -553,7 +553,7 @@ pub fn make_opaque_cbox_drop_glue(
sigil
:
ast
::
Sigil
,
cboxptr
:
ValueRef
)
// ptr to the opaque closure
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"closure::make_opaque_cbox_drop_glue"
);
let
_
icx
=
push
_ctxt
(
"closure::make_opaque_cbox_drop_glue"
);
match
sigil
{
ast
::
BorrowedSigil
=>
bcx
,
ast
::
ManagedSigil
=>
{
...
...
@@ -574,7 +574,7 @@ pub fn make_opaque_cbox_free_glue(
sigil
:
ast
::
Sigil
,
cbox
:
ValueRef
)
// ptr to ptr to the opaque closure
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"closure::make_opaque_cbox_free_glue"
);
let
_
icx
=
push
_ctxt
(
"closure::make_opaque_cbox_free_glue"
);
match
sigil
{
ast
::
BorrowedSigil
=>
{
return
bcx
;
...
...
src/librustc/middle/trans/common.rs
浏览文件 @
048ed148
...
...
@@ -101,7 +101,6 @@ pub struct Stats {
n_monos
:
uint
,
n_inlines
:
uint
,
n_closures
:
uint
,
llvm_insn_ctxt
:
~
[
~
str
],
llvm_insns
:
HashMap
<~
str
,
uint
>
,
fn_times
:
~
[(
~
str
,
int
)]
// (ident, time)
}
...
...
src/librustc/middle/trans/consts.rs
浏览文件 @
048ed148
...
...
@@ -19,7 +19,7 @@
use
middle
::
const_eval
;
use
middle
::
trans
::
adt
;
use
middle
::
trans
::
base
;
use
middle
::
trans
::
base
::
get_insn
_ctxt
;
use
middle
::
trans
::
base
::
push
_ctxt
;
use
middle
::
trans
::
common
::
*
;
use
middle
::
trans
::
consts
;
use
middle
::
trans
::
expr
;
...
...
@@ -37,7 +37,7 @@
pub
fn
const_lit
(
cx
:
@
mut
CrateContext
,
e
:
@
ast
::
expr
,
lit
:
ast
::
lit
)
->
ValueRef
{
let
_
icx
=
cx
.insn
_ctxt
(
"trans_lit"
);
let
_
icx
=
push
_ctxt
(
"trans_lit"
);
match
lit
.node
{
ast
::
lit_int
(
i
,
t
)
=>
C_integral
(
Type
::
int_from_ty
(
cx
,
t
),
i
as
u64
,
true
),
ast
::
lit_uint
(
u
,
t
)
=>
C_integral
(
Type
::
uint_from_ty
(
cx
,
t
),
u
,
false
),
...
...
@@ -249,7 +249,7 @@ pub fn const_expr(cx: @mut CrateContext, e: @ast::expr) -> ValueRef {
fn
const_expr_unadjusted
(
cx
:
@
mut
CrateContext
,
e
:
@
ast
::
expr
)
->
ValueRef
{
unsafe
{
let
_
icx
=
cx
.insn
_ctxt
(
"const_expr"
);
let
_
icx
=
push
_ctxt
(
"const_expr"
);
return
match
e
.node
{
ast
::
expr_lit
(
lit
)
=>
consts
::
const_lit
(
cx
,
e
,
*
lit
),
ast
::
expr_binary
(
_
,
b
,
e1
,
e2
)
=>
{
...
...
@@ -589,7 +589,7 @@ fn const_expr_unadjusted(cx: @mut CrateContext, e: @ast::expr) -> ValueRef {
pub
fn
trans_const
(
ccx
:
@
mut
CrateContext
,
_
e
:
@
ast
::
expr
,
id
:
ast
::
node_id
)
{
unsafe
{
let
_
icx
=
ccx
.insn
_ctxt
(
"trans_const"
);
let
_
icx
=
push
_ctxt
(
"trans_const"
);
let
g
=
base
::
get_item_val
(
ccx
,
id
);
// At this point, get_item_val has already translated the
// constant's initializer to determine its LLVM type.
...
...
src/librustc/middle/trans/context.rs
浏览文件 @
048ed148
...
...
@@ -162,6 +162,10 @@ pub fn new(sess: session::Session, name: &str, tcx: ty::ctxt,
None
};
if
sess
.count_llvm_insns
()
{
base
::
init_insn_ctxt
()
}
CrateContext
{
sess
:
sess
,
llmod
:
llmod
,
...
...
@@ -210,7 +214,6 @@ pub fn new(sess: session::Session, name: &str, tcx: ty::ctxt,
n_monos
:
0u
,
n_inlines
:
0u
,
n_closures
:
0u
,
llvm_insn_ctxt
:
~
[],
llvm_insns
:
HashMap
::
new
(),
fn_times
:
~
[]
},
...
...
@@ -234,7 +237,6 @@ pub fn log_fn_time(&mut self, name: ~str, start: time::Timespec, end: time::Time
((
end
.nsec
as
int
)
-
(
start
.nsec
as
int
))
/
1000000
;
self
.stats.fn_times
.push
((
name
,
elapsed
));
}
}
#[unsafe_destructor]
...
...
@@ -247,7 +249,6 @@ fn finalize(&self) {
}
fn
task_local_llcx_key
(
_
v
:
@
ContextRef
)
{}
pub
fn
task_llcx
()
->
ContextRef
{
let
opt
=
unsafe
{
local_data
::
local_data_get
(
task_local_llcx_key
)
};
*
opt
.expect
(
"task-local LLVMContextRef wasn't ever set!"
)
...
...
src/librustc/middle/trans/controlflow.rs
浏览文件 @
048ed148
...
...
@@ -35,7 +35,7 @@
use
syntax
::
codemap
::
span
;
pub
fn
trans_block
(
bcx
:
block
,
b
:
&
ast
::
blk
,
dest
:
expr
::
Dest
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_block"
);
let
_
icx
=
push
_ctxt
(
"trans_block"
);
let
mut
bcx
=
bcx
;
do
block_locals
(
b
)
|
local
|
{
bcx
=
alloc_local
(
bcx
,
local
);
...
...
@@ -67,7 +67,7 @@ pub fn trans_if(bcx: block,
dest
.to_str
(
bcx
.ccx
()));
let
_
indenter
=
indenter
();
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_if"
);
let
_
icx
=
push
_ctxt
(
"trans_if"
);
let
Result
{
bcx
,
val
:
cond_val
}
=
expr
::
trans_to_datum
(
bcx
,
cond
)
.to_result
();
...
...
@@ -126,7 +126,7 @@ pub fn join_blocks(parent_bcx: block, in_cxs: &[block]) -> block {
}
pub
fn
trans_while
(
bcx
:
block
,
cond
:
@
ast
::
expr
,
body
:
&
ast
::
blk
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_while"
);
let
_
icx
=
push
_ctxt
(
"trans_while"
);
let
next_bcx
=
sub_block
(
bcx
,
"while next"
);
// bcx
...
...
@@ -168,7 +168,7 @@ pub fn trans_loop(bcx:block,
body
:
&
ast
::
blk
,
opt_label
:
Option
<
ident
>
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_loop"
);
let
_
icx
=
push
_ctxt
(
"trans_loop"
);
let
next_bcx
=
sub_block
(
bcx
,
"next"
);
let
body_bcx_in
=
loop_scope_block
(
bcx
,
next_bcx
,
opt_label
,
"`loop`"
,
body
.info
());
...
...
@@ -182,7 +182,7 @@ pub fn trans_log(log_ex: @ast::expr,
lvl
:
@
ast
::
expr
,
bcx
:
block
,
e
:
@
ast
::
expr
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_log"
);
let
_
icx
=
push
_ctxt
(
"trans_log"
);
let
ccx
=
bcx
.ccx
();
let
mut
bcx
=
bcx
;
if
ty
::
type_is_bot
(
expr_ty
(
bcx
,
lvl
))
{
...
...
@@ -244,7 +244,7 @@ pub fn trans_break_cont(bcx: block,
opt_label
:
Option
<
ident
>
,
to_end
:
bool
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_break_cont"
);
let
_
icx
=
push
_ctxt
(
"trans_break_cont"
);
// Locate closest loop block, outputting cleanup as we go.
let
mut
unwind
=
bcx
;
let
mut
target
;
...
...
@@ -298,7 +298,7 @@ pub fn trans_cont(bcx: block, label_opt: Option<ident>) -> block {
}
pub
fn
trans_ret
(
bcx
:
block
,
e
:
Option
<@
ast
::
expr
>
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_ret"
);
let
_
icx
=
push
_ctxt
(
"trans_ret"
);
let
mut
bcx
=
bcx
;
let
dest
=
match
copy
bcx
.fcx.loop_ret
{
Some
((
flagptr
,
retptr
))
=>
{
...
...
@@ -333,7 +333,7 @@ pub fn trans_fail_expr(bcx: block,
sp_opt
:
Option
<
span
>
,
fail_expr
:
Option
<@
ast
::
expr
>
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_fail_expr"
);
let
_
icx
=
push
_ctxt
(
"trans_fail_expr"
);
let
mut
bcx
=
bcx
;
match
fail_expr
{
Some
(
arg_expr
)
=>
{
...
...
@@ -361,7 +361,7 @@ pub fn trans_fail(bcx: block,
sp_opt
:
Option
<
span
>
,
fail_str
:
@
str
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_fail"
);
let
_
icx
=
push
_ctxt
(
"trans_fail"
);
let
V_fail_str
=
C_cstr
(
bcx
.ccx
(),
fail_str
);
return
trans_fail_value
(
bcx
,
sp_opt
,
V_fail_str
);
}
...
...
@@ -370,7 +370,7 @@ fn trans_fail_value(bcx: block,
sp_opt
:
Option
<
span
>
,
V_fail_str
:
ValueRef
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_fail_value"
);
let
_
icx
=
push
_ctxt
(
"trans_fail_value"
);
let
ccx
=
bcx
.ccx
();
let
(
V_filename
,
V_line
)
=
match
sp_opt
{
Some
(
sp
)
=>
{
...
...
@@ -394,7 +394,7 @@ fn trans_fail_value(bcx: block,
pub
fn
trans_fail_bounds_check
(
bcx
:
block
,
sp
:
span
,
index
:
ValueRef
,
len
:
ValueRef
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_fail_bounds_check"
);
let
_
icx
=
push
_ctxt
(
"trans_fail_bounds_check"
);
let
(
filename
,
line
)
=
filename_and_line_num_from_span
(
bcx
,
sp
);
let
args
=
~
[
filename
,
line
,
index
,
len
];
let
bcx
=
callee
::
trans_lang_call
(
...
...
src/librustc/middle/trans/datum.rs
浏览文件 @
048ed148
...
...
@@ -273,7 +273,7 @@ pub fn copy_to(&self, bcx: block, action: CopyAction, dst: ValueRef)
* `store_to()` instead, which will move if possible but copy if
* neccessary. */
let
_
icx
=
bcx
.insn
_ctxt
(
"copy_to"
);
let
_
icx
=
push
_ctxt
(
"copy_to"
);
if
ty
::
type_is_nil
(
self
.ty
)
||
ty
::
type_is_bot
(
self
.ty
)
{
return
bcx
;
...
...
@@ -317,7 +317,7 @@ pub fn copy_to_no_check(&self,
* A helper for `copy_to()` which does not check to see if we
* are copying to/from the same value. */
let
_
icx
=
bcx
.insn
_ctxt
(
"copy_to_no_check"
);
let
_
icx
=
push
_ctxt
(
"copy_to_no_check"
);
let
mut
bcx
=
bcx
;
if
action
==
DROP_EXISTING
{
...
...
@@ -341,7 +341,7 @@ pub fn copy_to_no_check(&self,
//
pub
fn
move_to
(
&
self
,
bcx
:
block
,
action
:
CopyAction
,
dst
:
ValueRef
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"move_to"
);
let
_
icx
=
push
_ctxt
(
"move_to"
);
let
mut
bcx
=
bcx
;
debug!
(
"move_to(self=%s, action=%?, dst=%s)"
,
...
...
@@ -740,7 +740,7 @@ pub fn autoderef(&self,
expr_id
:
ast
::
node_id
,
max
:
uint
)
->
DatumBlock
{
let
_
icx
=
bcx
.insn
_ctxt
(
"autoderef"
);
let
_
icx
=
push
_ctxt
(
"autoderef"
);
debug!
(
"autoderef(expr_id=%d, max=%?, self=%?)"
,
expr_id
,
max
,
self
.to_str
(
bcx
.ccx
()));
...
...
src/librustc/middle/trans/expr.rs
浏览文件 @
048ed148
...
...
@@ -451,7 +451,7 @@ fn nil(bcx: block, ty: ty::t) -> DatumBlock {
}
fn
trans_rvalue_datum_unadjusted
(
bcx
:
block
,
expr
:
@
ast
::
expr
)
->
DatumBlock
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_rvalue_datum_unadjusted"
);
let
_
icx
=
push
_ctxt
(
"trans_rvalue_datum_unadjusted"
);
trace_span!
(
bcx
,
expr
.span
,
shorten
(
bcx
.expr_to_str
(
expr
)));
...
...
@@ -502,7 +502,7 @@ fn trans_rvalue_datum_unadjusted(bcx: block, expr: @ast::expr) -> DatumBlock {
fn
trans_rvalue_stmt_unadjusted
(
bcx
:
block
,
expr
:
@
ast
::
expr
)
->
block
{
let
mut
bcx
=
bcx
;
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_rvalue_stmt"
);
let
_
icx
=
push
_ctxt
(
"trans_rvalue_stmt"
);
if
bcx
.unreachable
{
return
bcx
;
...
...
@@ -558,7 +558,7 @@ fn trans_rvalue_stmt_unadjusted(bcx: block, expr: @ast::expr) -> block {
fn
trans_rvalue_dps_unadjusted
(
bcx
:
block
,
expr
:
@
ast
::
expr
,
dest
:
Dest
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_rvalue_dps_unadjusted"
);
let
_
icx
=
push
_ctxt
(
"trans_rvalue_dps_unadjusted"
);
let
tcx
=
bcx
.tcx
();
trace_span!
(
bcx
,
expr
.span
,
shorten
(
bcx
.expr_to_str
(
expr
)));
...
...
@@ -707,7 +707,7 @@ fn trans_rvalue_dps_unadjusted(bcx: block, expr: @ast::expr,
fn
trans_def_dps_unadjusted
(
bcx
:
block
,
ref_expr
:
@
ast
::
expr
,
def
:
ast
::
def
,
dest
:
Dest
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_def_dps_unadjusted"
);
let
_
icx
=
push
_ctxt
(
"trans_def_dps_unadjusted"
);
let
ccx
=
bcx
.ccx
();
let
lldest
=
match
dest
{
...
...
@@ -755,7 +755,7 @@ fn trans_def_datum_unadjusted(bcx: block,
ref_expr
:
@
ast
::
expr
,
def
:
ast
::
def
)
->
DatumBlock
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_def_datum_unadjusted"
);
let
_
icx
=
push
_ctxt
(
"trans_def_datum_unadjusted"
);
match
def
{
ast
::
def_fn
(
did
,
_
)
|
ast
::
def_static_method
(
did
,
None
,
_
)
=>
{
...
...
@@ -816,7 +816,7 @@ fn trans_lvalue_unadjusted(bcx: block, expr: @ast::expr) -> DatumBlock {
* Translates an lvalue expression, always yielding a by-ref
* datum. Does not apply any adjustments. */
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_lval"
);
let
_
icx
=
push
_ctxt
(
"trans_lval"
);
let
mut
bcx
=
bcx
;
debug!
(
"trans_lvalue(expr=%s)"
,
bcx
.expr_to_str
(
expr
));
...
...
@@ -855,7 +855,7 @@ fn trans_rec_field(bcx: block,
//! Translates `base.field`.
let
mut
bcx
=
bcx
;
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_rec_field"
);
let
_
icx
=
push
_ctxt
(
"trans_rec_field"
);
let
base_datum
=
unpack_datum!
(
bcx
,
trans_to_datum
(
bcx
,
base
));
let
repr
=
adt
::
represent_type
(
bcx
.ccx
(),
base_datum
.ty
);
...
...
@@ -878,7 +878,7 @@ fn trans_index(bcx: block,
idx
:
@
ast
::
expr
)
->
DatumBlock
{
//! Translates `base[idx]`.
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_index"
);
let
_
icx
=
push
_ctxt
(
"trans_index"
);
let
ccx
=
bcx
.ccx
();
let
base_ty
=
expr_ty
(
bcx
,
base
);
let
mut
bcx
=
bcx
;
...
...
@@ -942,7 +942,7 @@ fn trans_def_lvalue(bcx: block,
{
//! Translates a reference to a path.
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_def_lvalue"
);
let
_
icx
=
push
_ctxt
(
"trans_def_lvalue"
);
let
ccx
=
bcx
.ccx
();
match
def
{
ast
::
def_const
(
did
)
=>
{
...
...
@@ -1012,7 +1012,7 @@ fn get_val(bcx: block, did: ast::def_id, const_ty: ty::t)
}
pub
fn
trans_local_var
(
bcx
:
block
,
def
:
ast
::
def
)
->
Datum
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_local_var"
);
let
_
icx
=
push
_ctxt
(
"trans_local_var"
);
return
match
def
{
ast
::
def_upvar
(
nid
,
_
,
_
,
_
)
=>
{
...
...
@@ -1143,7 +1143,7 @@ fn trans_rec_or_struct(bcx: block,
id
:
ast
::
node_id
,
dest
:
Dest
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_rec"
);
let
_
icx
=
push
_ctxt
(
"trans_rec"
);
let
bcx
=
bcx
;
let
ty
=
node_id_type
(
bcx
,
id
);
...
...
@@ -1217,7 +1217,7 @@ fn trans_adt(bcx: block, repr: &adt::Repr, discr: int,
fields
:
&
[(
uint
,
@
ast
::
expr
)],
optbase
:
Option
<
StructBaseInfo
>
,
dest
:
Dest
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_adt"
);
let
_
icx
=
push
_ctxt
(
"trans_adt"
);
let
mut
bcx
=
bcx
;
let
addr
=
match
dest
{
Ignore
=>
{
...
...
@@ -1263,7 +1263,7 @@ fn trans_adt(bcx: block, repr: &adt::Repr, discr: int,
fn
trans_immediate_lit
(
bcx
:
block
,
expr
:
@
ast
::
expr
,
lit
:
ast
::
lit
)
->
DatumBlock
{
// must not be a string constant, that is a RvalueDpsExpr
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_immediate_lit"
);
let
_
icx
=
push
_ctxt
(
"trans_immediate_lit"
);
let
ty
=
expr_ty
(
bcx
,
expr
);
immediate_rvalue_bcx
(
bcx
,
consts
::
const_lit
(
bcx
.ccx
(),
expr
,
lit
),
ty
)
}
...
...
@@ -1272,7 +1272,7 @@ fn trans_unary_datum(bcx: block,
un_expr
:
@
ast
::
expr
,
op
:
ast
::
unop
,
sub_expr
:
@
ast
::
expr
)
->
DatumBlock
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_unary_datum"
);
let
_
icx
=
push
_ctxt
(
"trans_unary_datum"
);
// if deref, would be LvalueExpr
assert
!
(
op
!=
ast
::
deref
);
...
...
@@ -1333,7 +1333,7 @@ fn trans_boxed_expr(bcx: block,
contents
:
@
ast
::
expr
,
contents_ty
:
ty
::
t
,
heap
:
heap
)
->
DatumBlock
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_boxed_expr"
);
let
_
icx
=
push
_ctxt
(
"trans_boxed_expr"
);
let
base
::
MallocResult
{
bcx
,
box
:
bx
,
body
}
=
base
::
malloc_general
(
bcx
,
contents_ty
,
heap
);
add_clean_free
(
bcx
,
bx
,
heap
);
...
...
@@ -1345,7 +1345,7 @@ fn trans_boxed_expr(bcx: block,
fn
trans_addr_of
(
bcx
:
block
,
expr
:
@
ast
::
expr
,
subexpr
:
@
ast
::
expr
)
->
DatumBlock
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_addr_of"
);
let
_
icx
=
push
_ctxt
(
"trans_addr_of"
);
let
mut
bcx
=
bcx
;
let
sub_datum
=
unpack_datum!
(
bcx
,
trans_to_datum
(
bcx
,
subexpr
));
let
llval
=
sub_datum
.to_ref_llval
(
bcx
);
...
...
@@ -1361,7 +1361,7 @@ fn trans_eager_binop(bcx: block,
lhs_datum
:
&
Datum
,
rhs_datum
:
&
Datum
)
->
DatumBlock
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_eager_binop"
);
let
_
icx
=
push
_ctxt
(
"trans_eager_binop"
);
let
lhs
=
lhs_datum
.to_appropriate_llval
(
bcx
);
let
lhs_t
=
lhs_datum
.ty
;
...
...
@@ -1457,7 +1457,7 @@ fn trans_lazy_binop(bcx: block,
op
:
lazy_binop_ty
,
a
:
@
ast
::
expr
,
b
:
@
ast
::
expr
)
->
DatumBlock
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_lazy_binop"
);
let
_
icx
=
push
_ctxt
(
"trans_lazy_binop"
);
let
binop_ty
=
expr_ty
(
bcx
,
binop_expr
);
let
bcx
=
bcx
;
...
...
@@ -1503,7 +1503,7 @@ fn trans_binary(bcx: block,
lhs
:
@
ast
::
expr
,
rhs
:
@
ast
::
expr
)
->
DatumBlock
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_binary"
);
let
_
icx
=
push
_ctxt
(
"trans_binary"
);
match
op
{
ast
::
and
=>
{
...
...
@@ -1550,7 +1550,7 @@ fn trans_overloaded_op(bcx: block,
fn
int_cast
(
bcx
:
block
,
lldsttype
:
Type
,
llsrctype
:
Type
,
llsrc
:
ValueRef
,
signed
:
bool
)
->
ValueRef
{
let
_
icx
=
bcx
.insn
_ctxt
(
"int_cast"
);
let
_
icx
=
push
_ctxt
(
"int_cast"
);
unsafe
{
let
srcsz
=
llvm
::
LLVMGetIntTypeWidth
(
llsrctype
.to_ref
());
let
dstsz
=
llvm
::
LLVMGetIntTypeWidth
(
lldsttype
.to_ref
());
...
...
@@ -1568,7 +1568,7 @@ fn int_cast(bcx: block, lldsttype: Type, llsrctype: Type,
fn
float_cast
(
bcx
:
block
,
lldsttype
:
Type
,
llsrctype
:
Type
,
llsrc
:
ValueRef
)
->
ValueRef
{
let
_
icx
=
bcx
.insn
_ctxt
(
"float_cast"
);
let
_
icx
=
push
_ctxt
(
"float_cast"
);
let
srcsz
=
llsrctype
.float_width
();
let
dstsz
=
lldsttype
.float_width
();
return
if
dstsz
>
srcsz
{
...
...
@@ -1602,7 +1602,7 @@ pub fn cast_type_kind(t: ty::t) -> cast_kind {
fn
trans_imm_cast
(
bcx
:
block
,
expr
:
@
ast
::
expr
,
id
:
ast
::
node_id
)
->
DatumBlock
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_cast"
);
let
_
icx
=
push
_ctxt
(
"trans_cast"
);
let
ccx
=
bcx
.ccx
();
let
t_out
=
node_id_type
(
bcx
,
id
);
...
...
@@ -1669,7 +1669,7 @@ fn trans_assign_op(bcx: block,
dst
:
@
ast
::
expr
,
src
:
@
ast
::
expr
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"trans_assign_op"
);
let
_
icx
=
push
_ctxt
(
"trans_assign_op"
);
let
mut
bcx
=
bcx
;
debug!
(
"trans_assign_op(expr=%s)"
,
bcx
.expr_to_str
(
expr
));
...
...
src/librustc/middle/trans/foreign.rs
浏览文件 @
048ed148
...
...
@@ -188,7 +188,7 @@ fn build_wrap_fn_(ccx: @mut CrateContext,
needs_c_return
:
bool
,
arg_builder
:
wrap_arg_builder
,
ret_builder
:
wrap_ret_builder
)
{
let
_
icx
=
ccx
.insn
_ctxt
(
"foreign::build_wrap_fn_"
);
let
_
icx
=
push
_ctxt
(
"foreign::build_wrap_fn_"
);
let
fcx
=
new_fn_ctxt
(
ccx
,
~
[],
llwrapfn
,
tys
.fn_sig.output
,
None
);
// Patch up the return type if it's not immediate and we're returning via
...
...
@@ -274,7 +274,7 @@ fn build_wrap_fn_(ccx: @mut CrateContext,
pub
fn
trans_foreign_mod
(
ccx
:
@
mut
CrateContext
,
path
:
&
ast_map
::
path
,
foreign_mod
:
&
ast
::
foreign_mod
)
{
let
_
icx
=
ccx
.insn
_ctxt
(
"foreign::trans_foreign_mod"
);
let
_
icx
=
push
_ctxt
(
"foreign::trans_foreign_mod"
);
let
arch
=
ccx
.sess.targ_cfg.arch
;
let
abi
=
match
foreign_mod
.abis
.for_arch
(
arch
)
{
...
...
@@ -370,11 +370,11 @@ fn build_shim_fn(ccx: @mut CrateContext,
* }
*/
let
_
icx
=
ccx
.insn
_ctxt
(
"foreign::build_shim_fn"
);
let
_
icx
=
push
_ctxt
(
"foreign::build_shim_fn"
);
fn
build_args
(
bcx
:
block
,
tys
:
&
ShimTypes
,
llargbundle
:
ValueRef
)
->
~
[
ValueRef
]
{
let
_
icx
=
bcx
.insn
_ctxt
(
"foreign::shim::build_args"
);
let
_
icx
=
push
_ctxt
(
"foreign::shim::build_args"
);
tys
.fn_ty
.build_shim_args
(
bcx
,
tys
.llsig.llarg_tys
,
llargbundle
)
}
...
...
@@ -382,7 +382,7 @@ fn build_ret(bcx: block,
tys
:
&
ShimTypes
,
llargbundle
:
ValueRef
,
llretval
:
ValueRef
)
{
let
_
icx
=
bcx
.insn
_ctxt
(
"foreign::shim::build_ret"
);
let
_
icx
=
push
_ctxt
(
"foreign::shim::build_ret"
);
tys
.fn_ty
.build_shim_ret
(
bcx
,
tys
.llsig.llarg_tys
,
tys
.ret_def
,
...
...
@@ -488,7 +488,7 @@ fn build_wrap_fn(ccx: @mut CrateContext,
* account for the Rust modes.
*/
let
_
icx
=
ccx
.insn
_ctxt
(
"foreign::build_wrap_fn"
);
let
_
icx
=
push
_ctxt
(
"foreign::build_wrap_fn"
);
build_wrap_fn_
(
ccx
,
tys
,
...
...
@@ -503,7 +503,7 @@ fn build_args(bcx: block,
tys
:
&
ShimTypes
,
llwrapfn
:
ValueRef
,
llargbundle
:
ValueRef
)
{
let
_
icx
=
bcx
.insn
_ctxt
(
"foreign::wrap::build_args"
);
let
_
icx
=
push
_ctxt
(
"foreign::wrap::build_args"
);
let
ccx
=
bcx
.ccx
();
let
n
=
tys
.llsig.llarg_tys
.len
();
for
uint
::
range
(
0
,
n
)
|
i
|
{
...
...
@@ -528,7 +528,7 @@ fn build_args(bcx: block,
fn
build_ret
(
bcx
:
block
,
shim_types
:
&
ShimTypes
,
llargbundle
:
ValueRef
)
{
let
_
icx
=
bcx
.insn
_ctxt
(
"foreign::wrap::build_ret"
);
let
_
icx
=
push
_ctxt
(
"foreign::wrap::build_ret"
);
let
arg_count
=
shim_types
.fn_sig.inputs
.len
();
for
bcx
.fcx.llretptr
.iter
()
.advance
|
&
retptr
|
{
let
llretptr
=
load_inbounds
(
bcx
,
llargbundle
,
[
0
,
arg_count
]);
...
...
@@ -1155,7 +1155,7 @@ pub fn trans_foreign_fn(ccx: @mut CrateContext,
body
:
&
ast
::
blk
,
llwrapfn
:
ValueRef
,
id
:
ast
::
node_id
)
{
let
_
icx
=
ccx
.insn
_ctxt
(
"foreign::build_foreign_fn"
);
let
_
icx
=
push
_ctxt
(
"foreign::build_foreign_fn"
);
fn
build_rust_fn
(
ccx
:
@
mut
CrateContext
,
path
:
ast_map
::
path
,
...
...
@@ -1163,7 +1163,7 @@ fn build_rust_fn(ccx: @mut CrateContext,
body
:
&
ast
::
blk
,
id
:
ast
::
node_id
)
->
ValueRef
{
let
_
icx
=
ccx
.insn
_ctxt
(
"foreign::foreign::build_rust_fn"
);
let
_
icx
=
push
_ctxt
(
"foreign::foreign::build_rust_fn"
);
let
t
=
ty
::
node_id_to_type
(
ccx
.tcx
,
id
);
// XXX: Bad copy.
let
ps
=
link
::
mangle_internal_name_by_path
(
...
...
@@ -1205,11 +1205,11 @@ fn build_shim_fn(ccx: @mut CrateContext,
* one of those types that is passed by pointer in Rust.
*/
let
_
icx
=
ccx
.insn
_ctxt
(
"foreign::foreign::build_shim_fn"
);
let
_
icx
=
push
_ctxt
(
"foreign::foreign::build_shim_fn"
);
fn
build_args
(
bcx
:
block
,
tys
:
&
ShimTypes
,
llargbundle
:
ValueRef
)
->
~
[
ValueRef
]
{
let
_
icx
=
bcx
.insn
_ctxt
(
"foreign::extern::shim::build_args"
);
let
_
icx
=
push
_ctxt
(
"foreign::extern::shim::build_args"
);
let
ccx
=
bcx
.ccx
();
let
mut
llargvals
=
~
[];
let
mut
i
=
0u
;
...
...
@@ -1284,7 +1284,7 @@ fn build_wrap_fn(ccx: @mut CrateContext,
* }
*/
let
_
icx
=
ccx
.insn
_ctxt
(
"foreign::foreign::build_wrap_fn"
);
let
_
icx
=
push
_ctxt
(
"foreign::foreign::build_wrap_fn"
);
build_wrap_fn_
(
ccx
,
tys
,
...
...
@@ -1299,7 +1299,7 @@ fn build_args(bcx: block,
tys
:
&
ShimTypes
,
llwrapfn
:
ValueRef
,
llargbundle
:
ValueRef
)
{
let
_
icx
=
bcx
.insn
_ctxt
(
"foreign::foreign::wrap::build_args"
);
let
_
icx
=
push
_ctxt
(
"foreign::foreign::wrap::build_args"
);
tys
.fn_ty
.build_wrap_args
(
bcx
,
tys
.llsig.llret_ty
,
llwrapfn
,
...
...
@@ -1307,7 +1307,7 @@ fn build_args(bcx: block,
}
fn
build_ret
(
bcx
:
block
,
tys
:
&
ShimTypes
,
llargbundle
:
ValueRef
)
{
let
_
icx
=
bcx
.insn
_ctxt
(
"foreign::foreign::wrap::build_ret"
);
let
_
icx
=
push
_ctxt
(
"foreign::foreign::wrap::build_ret"
);
tys
.fn_ty
.build_wrap_ret
(
bcx
,
tys
.llsig.llarg_tys
,
llargbundle
);
build_return
(
bcx
);
}
...
...
@@ -1329,7 +1329,7 @@ pub fn register_foreign_fn(ccx: @mut CrateContext,
node_id
:
ast
::
node_id
,
attrs
:
&
[
ast
::
attribute
])
->
ValueRef
{
let
_
icx
=
ccx
.insn
_ctxt
(
"foreign::register_foreign_fn"
);
let
_
icx
=
push
_ctxt
(
"foreign::register_foreign_fn"
);
let
t
=
ty
::
node_id_to_type
(
ccx
.tcx
,
node_id
);
...
...
src/librustc/middle/trans/glue.rs
浏览文件 @
048ed148
...
...
@@ -45,7 +45,7 @@
use
syntax
::
ast
;
pub
fn
trans_free
(
cx
:
block
,
v
:
ValueRef
)
->
block
{
let
_
icx
=
cx
.insn
_ctxt
(
"trans_free"
);
let
_
icx
=
push
_ctxt
(
"trans_free"
);
callee
::
trans_lang_call
(
cx
,
cx
.tcx
()
.lang_items
.free_fn
(),
[
PointerCast
(
cx
,
v
,
Type
::
i8p
())],
...
...
@@ -53,7 +53,7 @@ pub fn trans_free(cx: block, v: ValueRef) -> block {
}
pub
fn
trans_exchange_free
(
cx
:
block
,
v
:
ValueRef
)
->
block
{
let
_
icx
=
cx
.insn
_ctxt
(
"trans_exchange_free"
);
let
_
icx
=
push
_ctxt
(
"trans_exchange_free"
);
callee
::
trans_lang_call
(
cx
,
cx
.tcx
()
.lang_items
.exchange_free_fn
(),
[
PointerCast
(
cx
,
v
,
Type
::
i8p
())],
...
...
@@ -62,7 +62,7 @@ pub fn trans_exchange_free(cx: block, v: ValueRef) -> block {
pub
fn
take_ty
(
cx
:
block
,
v
:
ValueRef
,
t
:
ty
::
t
)
->
block
{
// NB: v is an *alias* of type t here, not a direct value.
let
_
icx
=
cx
.insn
_ctxt
(
"take_ty"
);
let
_
icx
=
push
_ctxt
(
"take_ty"
);
if
ty
::
type_needs_drop
(
cx
.tcx
(),
t
)
{
return
call_tydesc_glue
(
cx
,
v
,
t
,
abi
::
tydesc_field_take_glue
);
}
...
...
@@ -71,7 +71,7 @@ pub fn take_ty(cx: block, v: ValueRef, t: ty::t) -> block {
pub
fn
drop_ty
(
cx
:
block
,
v
:
ValueRef
,
t
:
ty
::
t
)
->
block
{
// NB: v is an *alias* of type t here, not a direct value.
let
_
icx
=
cx
.insn
_ctxt
(
"drop_ty"
);
let
_
icx
=
push
_ctxt
(
"drop_ty"
);
if
ty
::
type_needs_drop
(
cx
.tcx
(),
t
)
{
return
call_tydesc_glue
(
cx
,
v
,
t
,
abi
::
tydesc_field_drop_glue
);
}
...
...
@@ -79,7 +79,7 @@ pub fn drop_ty(cx: block, v: ValueRef, t: ty::t) -> block {
}
pub
fn
drop_ty_immediate
(
bcx
:
block
,
v
:
ValueRef
,
t
:
ty
::
t
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"drop_ty_immediate"
);
let
_
icx
=
push
_ctxt
(
"drop_ty_immediate"
);
match
ty
::
get
(
t
)
.sty
{
ty
::
ty_uniq
(
_
)
|
ty
::
ty_evec
(
_
,
ty
::
vstore_uniq
)
...
...
@@ -96,7 +96,7 @@ pub fn drop_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> block {
}
pub
fn
take_ty_immediate
(
bcx
:
block
,
v
:
ValueRef
,
t
:
ty
::
t
)
->
Result
{
let
_
icx
=
bcx
.insn
_ctxt
(
"take_ty_immediate"
);
let
_
icx
=
push
_ctxt
(
"take_ty_immediate"
);
match
ty
::
get
(
t
)
.sty
{
ty
::
ty_box
(
_
)
|
ty
::
ty_opaque_box
|
ty
::
ty_evec
(
_
,
ty
::
vstore_box
)
|
...
...
@@ -117,7 +117,7 @@ pub fn take_ty_immediate(bcx: block, v: ValueRef, t: ty::t) -> Result {
pub
fn
free_ty
(
cx
:
block
,
v
:
ValueRef
,
t
:
ty
::
t
)
->
block
{
// NB: v is an *alias* of type t here, not a direct value.
let
_
icx
=
cx
.insn
_ctxt
(
"free_ty"
);
let
_
icx
=
push
_ctxt
(
"free_ty"
);
if
ty
::
type_needs_drop
(
cx
.tcx
(),
t
)
{
return
call_tydesc_glue
(
cx
,
v
,
t
,
abi
::
tydesc_field_free_glue
);
}
...
...
@@ -125,7 +125,7 @@ pub fn free_ty(cx: block, v: ValueRef, t: ty::t) -> block {
}
pub
fn
free_ty_immediate
(
bcx
:
block
,
v
:
ValueRef
,
t
:
ty
::
t
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"free_ty_immediate"
);
let
_
icx
=
push
_ctxt
(
"free_ty_immediate"
);
match
ty
::
get
(
t
)
.sty
{
ty
::
ty_uniq
(
_
)
|
ty
::
ty_evec
(
_
,
ty
::
vstore_uniq
)
|
...
...
@@ -207,7 +207,7 @@ pub fn simplified_glue_type(tcx: ty::ctxt, field: uint, t: ty::t) -> ty::t {
pub
fn
lazily_emit_simplified_tydesc_glue
(
ccx
:
@
mut
CrateContext
,
field
:
uint
,
ti
:
@
mut
tydesc_info
)
->
bool
{
let
_
icx
=
ccx
.insn
_ctxt
(
"lazily_emit_simplified_tydesc_glue"
);
let
_
icx
=
push
_ctxt
(
"lazily_emit_simplified_tydesc_glue"
);
let
simpl
=
simplified_glue_type
(
ccx
.tcx
,
field
,
ti
.ty
);
if
simpl
!=
ti
.ty
{
let
simpl_ti
=
get_tydesc
(
ccx
,
simpl
);
...
...
@@ -232,7 +232,7 @@ pub fn lazily_emit_simplified_tydesc_glue(ccx: @mut CrateContext,
pub
fn
lazily_emit_tydesc_glue
(
ccx
:
@
mut
CrateContext
,
field
:
uint
,
ti
:
@
mut
tydesc_info
)
{
let
_
icx
=
ccx
.insn
_ctxt
(
"lazily_emit_tydesc_glue"
);
let
_
icx
=
push
_ctxt
(
"lazily_emit_tydesc_glue"
);
let
llfnty
=
type_of_glue_fn
(
ccx
);
if
lazily_emit_simplified_tydesc_glue
(
ccx
,
field
,
ti
)
{
...
...
@@ -300,7 +300,7 @@ pub fn call_tydesc_glue_full(bcx: block,
tydesc
:
ValueRef
,
field
:
uint
,
static_ti
:
Option
<@
mut
tydesc_info
>
)
{
let
_
icx
=
bcx
.insn
_ctxt
(
"call_tydesc_glue_full"
);
let
_
icx
=
push
_ctxt
(
"call_tydesc_glue_full"
);
let
ccx
=
bcx
.ccx
();
// NB: Don't short-circuit even if this block is unreachable because
// GC-based cleanup needs to the see that the roots are live.
...
...
@@ -347,14 +347,14 @@ pub fn call_tydesc_glue_full(bcx: block,
// See [Note-arg-mode]
pub
fn
call_tydesc_glue
(
cx
:
block
,
v
:
ValueRef
,
t
:
ty
::
t
,
field
:
uint
)
->
block
{
let
_
icx
=
cx
.insn
_ctxt
(
"call_tydesc_glue"
);
let
_
icx
=
push
_ctxt
(
"call_tydesc_glue"
);
let
ti
=
get_tydesc
(
cx
.ccx
(),
t
);
call_tydesc_glue_full
(
cx
,
v
,
ti
.tydesc
,
field
,
Some
(
ti
));
return
cx
;
}
pub
fn
make_visit_glue
(
bcx
:
block
,
v
:
ValueRef
,
t
:
ty
::
t
)
{
let
_
icx
=
bcx
.insn
_ctxt
(
"make_visit_glue"
);
let
_
icx
=
push
_ctxt
(
"make_visit_glue"
);
let
bcx
=
do
with_scope
(
bcx
,
None
,
"visitor cleanup"
)
|
bcx
|
{
let
mut
bcx
=
bcx
;
let
(
visitor_trait
,
object_ty
)
=
ty
::
visitor_object_ty
(
bcx
.tcx
());
...
...
@@ -369,7 +369,7 @@ pub fn make_visit_glue(bcx: block, v: ValueRef, t: ty::t) {
pub
fn
make_free_glue
(
bcx
:
block
,
v
:
ValueRef
,
t
:
ty
::
t
)
{
// NB: v0 is an *alias* of type t here, not a direct value.
let
_
icx
=
bcx
.insn
_ctxt
(
"make_free_glue"
);
let
_
icx
=
push
_ctxt
(
"make_free_glue"
);
let
ccx
=
bcx
.ccx
();
let
bcx
=
match
ty
::
get
(
t
)
.sty
{
ty
::
ty_box
(
body_mt
)
=>
{
...
...
@@ -461,7 +461,7 @@ pub fn trans_struct_drop(bcx: block,
pub
fn
make_drop_glue
(
bcx
:
block
,
v0
:
ValueRef
,
t
:
ty
::
t
)
{
// NB: v0 is an *alias* of type t here, not a direct value.
let
_
icx
=
bcx
.insn
_ctxt
(
"make_drop_glue"
);
let
_
icx
=
push
_ctxt
(
"make_drop_glue"
);
let
ccx
=
bcx
.ccx
();
let
bcx
=
match
ty
::
get
(
t
)
.sty
{
ty
::
ty_box
(
_
)
|
ty
::
ty_opaque_box
|
...
...
@@ -532,7 +532,7 @@ pub fn decr_refcnt_maybe_free(bcx: block, box_ptr: ValueRef,
box_ptr_ptr
:
Option
<
ValueRef
>
,
t
:
ty
::
t
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"decr_refcnt_maybe_free"
);
let
_
icx
=
push
_ctxt
(
"decr_refcnt_maybe_free"
);
let
ccx
=
bcx
.ccx
();
do
with_cond
(
bcx
,
IsNotNull
(
bcx
,
box_ptr
))
|
bcx
|
{
...
...
@@ -551,7 +551,7 @@ pub fn decr_refcnt_maybe_free(bcx: block, box_ptr: ValueRef,
pub
fn
make_take_glue
(
bcx
:
block
,
v
:
ValueRef
,
t
:
ty
::
t
)
{
let
_
icx
=
bcx
.insn
_ctxt
(
"make_take_glue"
);
let
_
icx
=
push
_ctxt
(
"make_take_glue"
);
// NB: v is a *pointer* to type t here, not a direct value.
let
bcx
=
match
ty
::
get
(
t
)
.sty
{
ty
::
ty_box
(
_
)
|
ty
::
ty_opaque_box
|
...
...
@@ -600,7 +600,7 @@ pub fn make_take_glue(bcx: block, v: ValueRef, t: ty::t) {
}
pub
fn
incr_refcnt_of_boxed
(
cx
:
block
,
box_ptr
:
ValueRef
)
{
let
_
icx
=
cx
.insn
_ctxt
(
"incr_refcnt_of_boxed"
);
let
_
icx
=
push
_ctxt
(
"incr_refcnt_of_boxed"
);
let
ccx
=
cx
.ccx
();
let
rc_ptr
=
GEPi
(
cx
,
box_ptr
,
[
0u
,
abi
::
box_field_refcnt
]);
let
rc
=
Load
(
cx
,
rc_ptr
);
...
...
@@ -650,7 +650,7 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
pub
fn
declare_generic_glue
(
ccx
:
@
mut
CrateContext
,
t
:
ty
::
t
,
llfnty
:
Type
,
name
:
~
str
)
->
ValueRef
{
let
_
icx
=
ccx
.insn
_ctxt
(
"declare_generic_glue"
);
let
_
icx
=
push
_ctxt
(
"declare_generic_glue"
);
let
name
=
name
;
let
fn_nm
=
mangle_internal_name_by_type_and_seq
(
ccx
,
t
,
(
~
"glue_"
+
name
))
.to_managed
();
debug!
(
"%s is for type %s"
,
fn_nm
,
ppaux
::
ty_to_str
(
ccx
.tcx
,
t
));
...
...
@@ -665,7 +665,7 @@ pub fn make_generic_glue_inner(ccx: @mut CrateContext,
llfn
:
ValueRef
,
helper
:
glue_helper
)
->
ValueRef
{
let
_
icx
=
ccx
.insn
_ctxt
(
"make_generic_glue_inner"
);
let
_
icx
=
push
_ctxt
(
"make_generic_glue_inner"
);
let
fcx
=
new_fn_ctxt
(
ccx
,
~
[],
llfn
,
ty
::
mk_nil
(),
None
);
lib
::
llvm
::
SetLinkage
(
llfn
,
lib
::
llvm
::
InternalLinkage
);
ccx
.stats.n_glues_created
+=
1u
;
...
...
@@ -695,7 +695,7 @@ pub fn make_generic_glue(ccx: @mut CrateContext,
helper
:
glue_helper
,
name
:
&
str
)
->
ValueRef
{
let
_
icx
=
ccx
.insn
_ctxt
(
"make_generic_glue"
);
let
_
icx
=
push
_ctxt
(
"make_generic_glue"
);
if
!
ccx
.sess
.trans_stats
()
{
return
make_generic_glue_inner
(
ccx
,
t
,
llfn
,
helper
);
}
...
...
@@ -708,7 +708,7 @@ pub fn make_generic_glue(ccx: @mut CrateContext,
}
pub
fn
emit_tydescs
(
ccx
:
&
mut
CrateContext
)
{
//let _icx = ccx.insn
_ctxt("emit_tydescs");
let
_
icx
=
push
_ctxt
(
"emit_tydescs"
);
// As of this point, allow no more tydescs to be created.
ccx
.finished_tydescs
=
true
;
let
glue_fn_ty
=
Type
::
generic_glue_fn
(
ccx
);
...
...
src/librustc/middle/trans/inline.rs
浏览文件 @
048ed148
...
...
@@ -12,8 +12,7 @@
use
metadata
::
csearch
;
use
middle
::
astencode
;
use
middle
::
trans
::
base
::{
get_insn_ctxt
};
use
middle
::
trans
::
base
::{
impl_owned_self
,
impl_self
,
no_self
};
use
middle
::
trans
::
base
::{
push_ctxt
,
impl_owned_self
,
impl_self
,
no_self
};
use
middle
::
trans
::
base
::{
trans_item
,
get_item_val
,
trans_fn
};
use
middle
::
trans
::
common
::
*
;
use
middle
::
ty
;
...
...
@@ -30,7 +29,7 @@
pub
fn
maybe_instantiate_inline
(
ccx
:
@
mut
CrateContext
,
fn_id
:
ast
::
def_id
,
translate
:
bool
)
->
ast
::
def_id
{
let
_
icx
=
ccx
.insn
_ctxt
(
"maybe_instantiate_inline"
);
let
_
icx
=
push
_ctxt
(
"maybe_instantiate_inline"
);
match
ccx
.external
.find
(
&
fn_id
)
{
Some
(
&
Some
(
node_id
))
=>
{
// Already inline
...
...
src/librustc/middle/trans/meth.rs
浏览文件 @
048ed148
...
...
@@ -51,7 +51,7 @@ pub fn trans_impl(ccx: @mut CrateContext,
generics
:
&
ast
::
Generics
,
self_ty
:
Option
<
ty
::
t
>
,
id
:
ast
::
node_id
)
{
let
_
icx
=
ccx
.insn
_ctxt
(
"impl::trans_impl"
);
let
_
icx
=
push
_ctxt
(
"impl::trans_impl"
);
let
tcx
=
ccx
.tcx
;
debug!
(
"trans_impl(path=%s, name=%s, self_ty=%s, id=%?)"
,
...
...
@@ -159,7 +159,7 @@ pub fn trans_method(ccx: @mut CrateContext,
pub
fn
trans_self_arg
(
bcx
:
block
,
base
:
@
ast
::
expr
,
mentry
:
typeck
::
method_map_entry
)
->
Result
{
let
_
icx
=
bcx
.insn
_ctxt
(
"impl::trans_self_arg"
);
let
_
icx
=
push
_ctxt
(
"impl::trans_self_arg"
);
let
mut
temp_cleanups
=
~
[];
// Compute the type of self.
...
...
@@ -187,7 +187,7 @@ pub fn trans_method_callee(bcx: block,
this
:
@
ast
::
expr
,
mentry
:
typeck
::
method_map_entry
)
->
Callee
{
let
_
icx
=
bcx
.insn
_ctxt
(
"impl::trans_method_callee"
);
let
_
icx
=
push
_ctxt
(
"impl::trans_method_callee"
);
let
tcx
=
bcx
.tcx
();
debug!
(
"trans_method_callee(callee_id=%?, this=%s, mentry=%s)"
,
...
...
@@ -293,7 +293,7 @@ pub fn trans_static_method_callee(bcx: block,
trait_id
:
ast
::
def_id
,
callee_id
:
ast
::
node_id
)
->
FnData
{
let
_
icx
=
bcx
.insn
_ctxt
(
"impl::trans_static_method_callee"
);
let
_
icx
=
push
_ctxt
(
"impl::trans_static_method_callee"
);
let
ccx
=
bcx
.ccx
();
debug!
(
"trans_static_method_callee(method_id=%?, trait_id=%s,
\
...
...
@@ -437,7 +437,7 @@ pub fn trans_monomorphized_callee(bcx: block,
n_method
:
uint
,
vtbl
:
typeck
::
vtable_origin
)
->
Callee
{
let
_
icx
=
bcx
.insn
_ctxt
(
"impl::trans_monomorphized_callee"
);
let
_
icx
=
push
_ctxt
(
"impl::trans_monomorphized_callee"
);
return
match
vtbl
{
typeck
::
vtable_static
(
impl_did
,
ref
rcvr_substs
,
rcvr_origins
)
=>
{
let
ccx
=
bcx
.ccx
();
...
...
@@ -586,7 +586,7 @@ pub fn trans_trait_callee(bcx: block,
// first evaluate the self expression (expected a by-ref result) and then
// extract the self data and vtable out of the pair.
let
_
icx
=
bcx
.insn
_ctxt
(
"impl::trans_trait_callee"
);
let
_
icx
=
push
_ctxt
(
"impl::trans_trait_callee"
);
let
mut
bcx
=
bcx
;
let
self_datum
=
unpack_datum!
(
bcx
,
expr
::
trans_to_datum
(
bcx
,
self_expr
));
...
...
@@ -619,7 +619,7 @@ pub fn trans_trait_callee_from_llval(bcx: block,
// Same as `trans_trait_callee()` above, except that it is given
// a by-ref pointer to the @Trait pair.
let
_
icx
=
bcx
.insn
_ctxt
(
"impl::trans_trait_callee"
);
let
_
icx
=
push
_ctxt
(
"impl::trans_trait_callee"
);
let
ccx
=
bcx
.ccx
();
let
mut
bcx
=
bcx
;
...
...
@@ -770,7 +770,7 @@ pub fn make_vtable(ccx: @mut CrateContext,
ptrs
:
&
[
ValueRef
])
->
ValueRef
{
unsafe
{
let
_
icx
=
ccx
.insn
_ctxt
(
"impl::make_vtable"
);
let
_
icx
=
push
_ctxt
(
"impl::make_vtable"
);
let
mut
components
=
~
[
tydesc
.tydesc
];
for
ptrs
.each
|
&
ptr
|
{
...
...
@@ -797,7 +797,7 @@ pub fn make_impl_vtable(bcx: block,
vtables
:
typeck
::
vtable_res
)
->
ValueRef
{
let
ccx
=
bcx
.ccx
();
let
_
icx
=
ccx
.insn
_ctxt
(
"impl::make_impl_vtable"
);
let
_
icx
=
push
_ctxt
(
"impl::make_impl_vtable"
);
let
tcx
=
ccx
.tcx
;
let
trt_id
=
match
ty
::
impl_trait_ref
(
tcx
,
impl_id
)
{
...
...
@@ -841,7 +841,7 @@ pub fn trans_trait_cast(bcx: block,
_
store
:
ty
::
TraitStore
)
->
block
{
let
mut
bcx
=
bcx
;
let
_
icx
=
bcx
.insn
_ctxt
(
"impl::trans_cast"
);
let
_
icx
=
push
_ctxt
(
"impl::trans_cast"
);
let
lldest
=
match
dest
{
Ignore
=>
{
...
...
src/librustc/middle/trans/monomorphize.rs
浏览文件 @
048ed148
...
...
@@ -13,9 +13,8 @@
use
back
::
link
::
mangle_exported_name
;
use
driver
::
session
;
use
lib
::
llvm
::
ValueRef
;
use
middle
::
trans
::
base
::{
get_insn_ctxt
};
use
middle
::
trans
::
base
::{
set_inline_hint_if_appr
,
set_inline_hint
};
use
middle
::
trans
::
base
::{
trans_enum_variant
};
use
middle
::
trans
::
base
::{
trans_enum_variant
,
push_ctxt
};
use
middle
::
trans
::
base
::{
trans_fn
,
decl_internal_cdecl_fn
};
use
middle
::
trans
::
base
::{
get_item_val
,
no_self
};
use
middle
::
trans
::
base
;
...
...
@@ -61,6 +60,7 @@ pub fn monomorphic_fn(ccx: @mut CrateContext,
ref_id
);
assert
!
(
real_substs
.tps
.iter
()
.all
(|
t
|
!
ty
::
type_needs_infer
(
*
t
)));
let
_
icx
=
push_ctxt
(
"monomorphic_fn"
);
let
_
icx
=
ccx
.insn_ctxt
(
"monomorphic_fn"
);
let
mut
must_cast
=
false
;
let
substs
=
vec
::
map
(
real_substs
.tps
,
|
t
|
{
...
...
src/librustc/middle/trans/tvec.rs
浏览文件 @
048ed148
...
...
@@ -53,7 +53,7 @@ pub fn expand_boxed_vec_ty(tcx: ty::ctxt, t: ty::t) -> ty::t {
}
pub
fn
get_fill
(
bcx
:
block
,
vptr
:
ValueRef
)
->
ValueRef
{
let
_
icx
=
bcx
.insn
_ctxt
(
"tvec::get_fill"
);
let
_
icx
=
push
_ctxt
(
"tvec::get_fill"
);
Load
(
bcx
,
GEPi
(
bcx
,
vptr
,
[
0u
,
abi
::
vec_elt_fill
]))
}
pub
fn
set_fill
(
bcx
:
block
,
vptr
:
ValueRef
,
fill
:
ValueRef
)
{
...
...
@@ -68,12 +68,12 @@ pub fn get_bodyptr(bcx: block, vptr: ValueRef) -> ValueRef {
}
pub
fn
get_dataptr
(
bcx
:
block
,
vptr
:
ValueRef
)
->
ValueRef
{
let
_
icx
=
bcx
.insn
_ctxt
(
"tvec::get_dataptr"
);
let
_
icx
=
push
_ctxt
(
"tvec::get_dataptr"
);
GEPi
(
bcx
,
vptr
,
[
0u
,
abi
::
vec_elt_elems
,
0u
])
}
pub
fn
pointer_add
(
bcx
:
block
,
ptr
:
ValueRef
,
bytes
:
ValueRef
)
->
ValueRef
{
let
_
icx
=
bcx
.insn
_ctxt
(
"tvec::pointer_add"
);
let
_
icx
=
push
_ctxt
(
"tvec::pointer_add"
);
let
old_ty
=
val_ty
(
ptr
);
let
bptr
=
PointerCast
(
bcx
,
ptr
,
Type
::
i8p
());
return
PointerCast
(
bcx
,
InBoundsGEP
(
bcx
,
bptr
,
[
bytes
]),
old_ty
);
...
...
@@ -81,7 +81,7 @@ pub fn pointer_add(bcx: block, ptr: ValueRef, bytes: ValueRef) -> ValueRef {
pub
fn
alloc_raw
(
bcx
:
block
,
unit_ty
:
ty
::
t
,
fill
:
ValueRef
,
alloc
:
ValueRef
,
heap
:
heap
)
->
Result
{
let
_
icx
=
bcx
.insn
_ctxt
(
"tvec::alloc_uniq"
);
let
_
icx
=
push
_ctxt
(
"tvec::alloc_uniq"
);
let
ccx
=
bcx
.ccx
();
let
vecbodyty
=
ty
::
mk_mut_unboxed_vec
(
bcx
.tcx
(),
unit_ty
);
...
...
@@ -105,7 +105,7 @@ pub fn alloc_vec(bcx: block,
elts
:
uint
,
heap
:
heap
)
->
Result
{
let
_
icx
=
bcx
.insn
_ctxt
(
"tvec::alloc_uniq"
);
let
_
icx
=
push
_ctxt
(
"tvec::alloc_uniq"
);
let
ccx
=
bcx
.ccx
();
let
llunitty
=
type_of
::
type_of
(
ccx
,
unit_ty
);
let
unit_sz
=
nonzero_llsize_of
(
ccx
,
llunitty
);
...
...
@@ -119,7 +119,7 @@ pub fn alloc_vec(bcx: block,
}
pub
fn
duplicate_uniq
(
bcx
:
block
,
vptr
:
ValueRef
,
vec_ty
:
ty
::
t
)
->
Result
{
let
_
icx
=
bcx
.insn
_ctxt
(
"tvec::duplicate_uniq"
);
let
_
icx
=
push
_ctxt
(
"tvec::duplicate_uniq"
);
let
fill
=
get_fill
(
bcx
,
get_bodyptr
(
bcx
,
vptr
));
let
unit_ty
=
ty
::
sequence_element_type
(
bcx
.tcx
(),
vec_ty
);
...
...
@@ -137,7 +137,7 @@ pub fn duplicate_uniq(bcx: block, vptr: ValueRef, vec_ty: ty::t) -> Result {
pub
fn
make_drop_glue_unboxed
(
bcx
:
block
,
vptr
:
ValueRef
,
vec_ty
:
ty
::
t
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"tvec::make_drop_glue_unboxed"
);
let
_
icx
=
push
_ctxt
(
"tvec::make_drop_glue_unboxed"
);
let
tcx
=
bcx
.tcx
();
let
unit_ty
=
ty
::
sequence_element_type
(
tcx
,
vec_ty
);
if
ty
::
type_needs_drop
(
tcx
,
unit_ty
)
{
...
...
@@ -349,7 +349,7 @@ pub fn write_content(bcx: block,
content_expr
:
@
ast
::
expr
,
dest
:
Dest
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"tvec::write_content"
);
let
_
icx
=
push
_ctxt
(
"tvec::write_content"
);
let
mut
bcx
=
bcx
;
debug!
(
"write_content(vt=%s, dest=%s, vstore_expr=%?)"
,
...
...
@@ -548,7 +548,7 @@ pub fn get_base_and_len(bcx: block,
pub
fn
iter_vec_raw
(
bcx
:
block
,
data_ptr
:
ValueRef
,
vec_ty
:
ty
::
t
,
fill
:
ValueRef
,
f
:
iter_vec_block
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"tvec::iter_vec_raw"
);
let
_
icx
=
push
_ctxt
(
"tvec::iter_vec_raw"
);
let
unit_ty
=
ty
::
sequence_element_type
(
bcx
.tcx
(),
vec_ty
);
...
...
@@ -579,14 +579,14 @@ pub fn iter_vec_raw(bcx: block, data_ptr: ValueRef, vec_ty: ty::t,
pub
fn
iter_vec_uniq
(
bcx
:
block
,
vptr
:
ValueRef
,
vec_ty
:
ty
::
t
,
fill
:
ValueRef
,
f
:
iter_vec_block
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"tvec::iter_vec_uniq"
);
let
_
icx
=
push
_ctxt
(
"tvec::iter_vec_uniq"
);
let
data_ptr
=
get_dataptr
(
bcx
,
get_bodyptr
(
bcx
,
vptr
));
iter_vec_raw
(
bcx
,
data_ptr
,
vec_ty
,
fill
,
f
)
}
pub
fn
iter_vec_unboxed
(
bcx
:
block
,
body_ptr
:
ValueRef
,
vec_ty
:
ty
::
t
,
f
:
iter_vec_block
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"tvec::iter_vec_unboxed"
);
let
_
icx
=
push
_ctxt
(
"tvec::iter_vec_unboxed"
);
let
fill
=
get_fill
(
bcx
,
body_ptr
);
let
dataptr
=
get_dataptr
(
bcx
,
body_ptr
);
return
iter_vec_raw
(
bcx
,
dataptr
,
vec_ty
,
fill
,
f
);
...
...
src/librustc/middle/trans/uniq.rs
浏览文件 @
048ed148
...
...
@@ -21,7 +21,7 @@
pub
fn
make_free_glue
(
bcx
:
block
,
vptrptr
:
ValueRef
,
box_ty
:
ty
::
t
)
->
block
{
let
_
icx
=
bcx
.insn
_ctxt
(
"uniq::make_free_glue"
);
let
_
icx
=
push
_ctxt
(
"uniq::make_free_glue"
);
let
box_datum
=
immediate_rvalue
(
Load
(
bcx
,
vptrptr
),
box_ty
);
let
not_null
=
IsNotNull
(
bcx
,
box_datum
.val
);
...
...
@@ -38,7 +38,7 @@ pub fn make_free_glue(bcx: block, vptrptr: ValueRef, box_ty: ty::t)
}
pub
fn
duplicate
(
bcx
:
block
,
src_box
:
ValueRef
,
src_ty
:
ty
::
t
)
->
Result
{
let
_
icx
=
bcx
.insn
_ctxt
(
"uniq::duplicate"
);
let
_
icx
=
push
_ctxt
(
"uniq::duplicate"
);
// Load the body of the source (*src)
let
src_datum
=
immediate_rvalue
(
src_box
,
src_ty
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录