Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
a0cdbd1a
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,发现更多精彩内容 >>
提交
a0cdbd1a
编写于
7月 05, 2021
作者:
B
bjorn3
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rustfmt
上级
38585b3f
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
26 addition
and
28 deletion
+26
-28
src/bin/cg_clif.rs
src/bin/cg_clif.rs
+1
-1
src/driver/aot.rs
src/driver/aot.rs
+2
-1
src/driver/jit.rs
src/driver/jit.rs
+8
-5
src/intrinsics/llvm.rs
src/intrinsics/llvm.rs
+13
-15
src/vtable.rs
src/vtable.rs
+2
-6
未找到文件。
src/bin/cg_clif.rs
浏览文件 @
a0cdbd1a
...
...
@@ -6,8 +6,8 @@
extern
crate
rustc_session
;
extern
crate
rustc_target
;
use
std
::
panic
;
use
std
::
lazy
::
SyncLazy
;
use
std
::
panic
;
use
rustc_data_structures
::
profiling
::{
get_resident_set_size
,
print_time_passes_entry
};
use
rustc_interface
::
interface
;
...
...
src/driver/aot.rs
浏览文件 @
a0cdbd1a
...
...
@@ -291,7 +291,8 @@ pub(crate) fn run_aot(
};
// FIXME handle `-Ctarget-cpu=native`
let
target_cpu
=
tcx
.sess.opts.cg.target_cpu
.as_ref
()
.unwrap_or
(
&
tcx
.sess.target.cpu
)
.to_owned
();
let
target_cpu
=
tcx
.sess.opts.cg.target_cpu
.as_ref
()
.unwrap_or
(
&
tcx
.sess.target.cpu
)
.to_owned
();
Box
::
new
((
CodegenResults
{
modules
,
...
...
src/driver/jit.rs
浏览文件 @
a0cdbd1a
...
...
@@ -26,7 +26,8 @@ struct JitState {
}
/// The Sender owned by the rustc thread
static
GLOBAL_MESSAGE_SENDER
:
SyncOnceCell
<
Mutex
<
mpsc
::
Sender
<
UnsafeMessage
>>>
=
SyncOnceCell
::
new
();
static
GLOBAL_MESSAGE_SENDER
:
SyncOnceCell
<
Mutex
<
mpsc
::
Sender
<
UnsafeMessage
>>>
=
SyncOnceCell
::
new
();
/// A message that is sent from the jitted runtime to the rustc thread.
/// Senders are responsible for upholding `Send` semantics.
...
...
@@ -195,14 +196,17 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
// lazy JIT compilation request - compile requested instance and return pointer to result
UnsafeMessage
::
JitFn
{
instance_ptr
,
trampoline_ptr
,
tx
}
=>
{
tx
.send
(
jit_fn
(
instance_ptr
,
trampoline_ptr
))
.expect
(
"jitted runtime hung up before response to lazy JIT request was sent"
);
.expect
(
"jitted runtime hung up before response to lazy JIT request was sent"
);
}
}
}
}
#[no_mangle]
extern
"C"
fn
__
clif_jit_fn
(
instance_ptr
:
*
const
Instance
<
'static
>
,
trampoline_ptr
:
*
const
u8
)
->
*
const
u8
{
extern
"C"
fn
__
clif_jit_fn
(
instance_ptr
:
*
const
Instance
<
'static
>
,
trampoline_ptr
:
*
const
u8
,
)
->
*
const
u8
{
// send the JIT request to the rustc thread, with a channel for the response
let
(
tx
,
rx
)
=
mpsc
::
channel
();
UnsafeMessage
::
JitFn
{
instance_ptr
,
trampoline_ptr
,
tx
}
...
...
@@ -210,8 +214,7 @@ extern "C" fn __clif_jit_fn(instance_ptr: *const Instance<'static>, trampoline_p
.expect
(
"rustc thread hung up before lazy JIT request was sent"
);
// block on JIT compilation result
rx
.recv
()
.expect
(
"rustc thread hung up before responding to sent lazy JIT request"
)
rx
.recv
()
.expect
(
"rustc thread hung up before responding to sent lazy JIT request"
)
}
fn
jit_fn
(
instance_ptr
:
*
const
Instance
<
'static
>
,
trampoline_ptr
:
*
const
u8
)
->
*
const
u8
{
...
...
src/intrinsics/llvm.rs
浏览文件 @
a0cdbd1a
...
...
@@ -148,30 +148,28 @@ fn llvm_add_sub<'tcx>(
ret
:
CPlace
<
'tcx
>
,
cb_in
:
Value
,
a
:
CValue
<
'tcx
>
,
b
:
CValue
<
'tcx
>
b
:
CValue
<
'tcx
>
,
)
{
assert_eq!
(
a
.layout
()
.ty
,
fx
.tcx.types.u64
,
"llvm.x86.addcarry.64/llvm.x86.subborrow.64 second operand must be u64"
);
assert_eq!
(
b
.layout
()
.ty
,
fx
.tcx.types.u64
,
"llvm.x86.addcarry.64/llvm.x86.subborrow.64 third operand must be u64"
);
assert_eq!
(
a
.layout
()
.ty
,
fx
.tcx.types.u64
,
"llvm.x86.addcarry.64/llvm.x86.subborrow.64 second operand must be u64"
);
assert_eq!
(
b
.layout
()
.ty
,
fx
.tcx.types.u64
,
"llvm.x86.addcarry.64/llvm.x86.subborrow.64 third operand must be u64"
);
// c + carry -> c + first intermediate carry or borrow respectively
let
int0
=
crate
::
num
::
codegen_checked_int_binop
(
fx
,
bin_op
,
a
,
b
,
);
let
int0
=
crate
::
num
::
codegen_checked_int_binop
(
fx
,
bin_op
,
a
,
b
);
let
c
=
int0
.value_field
(
fx
,
mir
::
Field
::
new
(
0
));
let
cb0
=
int0
.value_field
(
fx
,
mir
::
Field
::
new
(
1
))
.load_scalar
(
fx
);
// c + carry -> c + second intermediate carry or borrow respectively
let
cb_in_as_u64
=
fx
.bcx
.ins
()
.uextend
(
types
::
I64
,
cb_in
);
let
cb_in_as_u64
=
CValue
::
by_val
(
cb_in_as_u64
,
fx
.layout_of
(
fx
.tcx.types.u64
));
let
int1
=
crate
::
num
::
codegen_checked_int_binop
(
fx
,
bin_op
,
c
,
cb_in_as_u64
,
);
let
int1
=
crate
::
num
::
codegen_checked_int_binop
(
fx
,
bin_op
,
c
,
cb_in_as_u64
);
let
(
c
,
cb1
)
=
int1
.load_scalar_pair
(
fx
);
// carry0 | carry1 -> carry or borrow respectively
...
...
src/vtable.rs
浏览文件 @
a0cdbd1a
...
...
@@ -69,12 +69,8 @@ pub(crate) fn get_vtable<'tcx>(
trait_ref
:
Option
<
ty
::
PolyExistentialTraitRef
<
'tcx
>>
,
)
->
Value
{
let
alloc_id
=
fx
.tcx
.vtable_allocation
(
ty
,
trait_ref
);
let
data_id
=
data_id_for_alloc_id
(
&
mut
fx
.constants_cx
,
&
mut
*
fx
.module
,
alloc_id
,
Mutability
::
Not
,
);
let
data_id
=
data_id_for_alloc_id
(
&
mut
fx
.constants_cx
,
&
mut
*
fx
.module
,
alloc_id
,
Mutability
::
Not
);
let
local_data_id
=
fx
.module
.declare_data_in_func
(
data_id
,
&
mut
fx
.bcx.func
);
if
fx
.clif_comments
.enabled
()
{
fx
.add_comment
(
local_data_id
,
format!
(
"vtable: {:?}"
,
alloc_id
));
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录