Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Rust
提交
a7016ade
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,发现更多精彩内容 >>
提交
a7016ade
编写于
7月 01, 2010
作者:
G
Graydon Hoare
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Implement STMT_init_box in trans, clean up some of the semant table-accessors.
上级
8acb2cf4
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
39 addition
and
51 deletion
+39
-51
src/boot/me/dwarf.ml
src/boot/me/dwarf.ml
+1
-1
src/boot/me/layout.ml
src/boot/me/layout.ml
+1
-1
src/boot/me/semant.ml
src/boot/me/semant.ml
+23
-39
src/boot/me/trans.ml
src/boot/me/trans.ml
+11
-7
src/boot/me/transutil.ml
src/boot/me/transutil.ml
+2
-2
src/boot/me/typestate.ml
src/boot/me/typestate.ml
+1
-1
未找到文件。
src/boot/me/dwarf.ml
浏览文件 @
a7016ade
...
...
@@ -2463,7 +2463,7 @@ let dwarf_visitor
then
get_abbrev_code
abbrev_formal
else
get_abbrev_code
abbrev_variable
in
let
resolved_slot
=
referent_to
_slot
cx
s
.
id
in
let
resolved_slot
=
get
_slot
cx
s
.
id
in
let
emit_var_die
slot_loc
=
let
var_die
=
SEQ
[
|
...
...
src/boot/me/layout.ml
浏览文件 @
a7016ade
...
...
@@ -140,7 +140,7 @@ let layout_visitor
(
slots
:
node_id
array
)
:
unit
=
let
accum
(
off
,
align
)
id
:
(
size
*
size
)
=
let
slot
=
referent_to
_slot
cx
id
in
let
slot
=
get
_slot
cx
id
in
let
rt
=
slot_referent_type
cx
.
ctxt_abi
slot
in
let
(
elt_size
,
elt_align
)
=
rty_layout
rt
in
if
vregs_ok
...
...
src/boot/me/semant.ml
浏览文件 @
a7016ade
...
...
@@ -306,18 +306,32 @@ let referent_is_item (cx:ctxt) (id:node_id) : bool =
|
_
->
false
;;
(* coerce an lval definition id to a slot *)
let
referent_to_slot
(
cx
:
ctxt
)
(
id
:
node_id
)
:
Ast
.
slot
=
match
Hashtbl
.
find
cx
.
ctxt_all_defns
id
with
DEFN_slot
slot
->
slot
|
_
->
bugi
cx
id
"unknown slot"
let
rec
lval_base_id
(
lv
:
Ast
.
lval
)
:
node_id
=
match
lv
with
Ast
.
LVAL_base
nbi
->
nbi
.
id
|
Ast
.
LVAL_ext
(
lv
,
_
)
->
lval_base_id
lv
;;
let
get_item
(
cx
:
ctxt
)
(
node
:
node_id
)
:
Ast
.
mod_item_decl
=
match
htab_search
cx
.
ctxt_all_defns
node
with
Some
(
DEFN_item
item
)
->
item
|
Some
_
->
bugi
cx
node
"defn is not an item"
|
None
->
bugi
cx
node
"missing defn"
;;
let
get_slot
(
cx
:
ctxt
)
(
node
:
node_id
)
:
Ast
.
slot
=
match
htab_search
cx
.
ctxt_all_defns
node
with
Some
(
DEFN_slot
slot
)
->
slot
|
Some
_
->
bugi
cx
node
"defn is not a slot"
|
None
->
bugi
cx
node
"missing defn"
;;
(* coerce an lval reference id to its definition slot *)
let
lval_to_slot
(
cx
:
ctxt
)
(
id
:
node_id
)
:
Ast
.
slot
=
match
resolve_lval_id
cx
id
with
DEFN_slot
slot
->
slot
|
_
->
bugi
cx
id
"unknown slot"
let
lval_base_to_slot
(
cx
:
ctxt
)
(
lval
:
Ast
.
lval
)
:
Ast
.
slot
identified
=
let
lid
=
lval_base_id
lval
in
let
rid
=
lval_to_referent
cx
lid
in
let
slot
=
get_slot
cx
rid
in
{
node
=
slot
;
id
=
rid
}
;;
let
get_stmt_depth
(
cx
:
ctxt
)
(
id
:
node_id
)
:
int
=
...
...
@@ -534,22 +548,6 @@ let rec lval_to_name (lv:Ast.lval) : Ast.name =
Ast
.
NAME_ext
(
lval_to_name
lv
,
comp
)
;;
let
rec
lval_base_id
(
lv
:
Ast
.
lval
)
:
node_id
=
match
lv
with
Ast
.
LVAL_base
nbi
->
nbi
.
id
|
Ast
.
LVAL_ext
(
lv
,
_
)
->
lval_base_id
lv
;;
let
rec
lval_base_slot
(
cx
:
ctxt
)
(
lv
:
Ast
.
lval
)
:
node_id
option
=
match
lv
with
Ast
.
LVAL_base
nbi
->
let
referent
=
lval_to_referent
cx
nbi
.
id
in
if
referent_is_slot
cx
referent
then
Some
referent
else
None
|
Ast
.
LVAL_ext
(
lv
,
_
)
->
lval_base_slot
cx
lv
;;
let
rec
lval_slots
(
cx
:
ctxt
)
(
lv
:
Ast
.
lval
)
:
node_id
array
=
match
lv
with
Ast
.
LVAL_base
nbi
->
...
...
@@ -1193,20 +1191,6 @@ let lval_is_direct_mod (cx:ctxt) (lval:Ast.lval) : bool =
|
_
->
false
;;
let
get_item
(
cx
:
ctxt
)
(
node
:
node_id
)
:
Ast
.
mod_item_decl
=
match
htab_search
cx
.
ctxt_all_defns
node
with
Some
(
DEFN_item
item
)
->
item
|
Some
_
->
bugi
cx
node
"defn is not an item"
|
None
->
bugi
cx
node
"missing defn"
;;
let
get_slot
(
cx
:
ctxt
)
(
node
:
node_id
)
:
Ast
.
slot
=
match
htab_search
cx
.
ctxt_all_defns
node
with
Some
(
DEFN_slot
slot
)
->
slot
|
Some
_
->
bugi
cx
node
"defn is not a slot"
|
None
->
bugi
cx
node
"missing defn"
;;
let
lval_ty
(
cx
:
ctxt
)
(
lval
:
Ast
.
lval
)
:
Ast
.
ty
=
(*
FIXME: The correct definition of this function is just:
...
...
src/boot/me/trans.ml
浏览文件 @
a7016ade
...
...
@@ -446,7 +446,7 @@ let trans_visitor
in
let
slot_id_referent_type
(
slot_id
:
node_id
)
:
Il
.
referent_ty
=
slot_referent_type
abi
(
referent_to
_slot
cx
slot_id
)
slot_referent_type
abi
(
get
_slot
cx
slot_id
)
in
let
caller_args_cell
(
args_rty
:
Il
.
referent_ty
)
:
Il
.
cell
=
...
...
@@ -959,12 +959,11 @@ let trans_visitor
in
trans_slot_lval_ext
base_ty
base_cell
comp
|
Ast
.
LVAL_base
nb
->
let
slot
=
lval_to_slot
cx
nb
.
id
in
let
referent
=
lval_to_referent
cx
nb
.
id
in
let
cell
=
cell_of_block_slot
referent
in
let
ty
=
slot_ty
slot
in
let
cell
=
deref_slot
initializing
cell
slot
in
|
Ast
.
LVAL_base
_
->
let
sloti
=
lval_base_to_slot
cx
lv
in
let
cell
=
cell_of_block_slot
sloti
.
id
in
let
ty
=
slot_ty
sloti
.
node
in
let
cell
=
deref_slot
initializing
cell
sloti
.
node
in
deref_ty
initializing
cell
ty
in
iflog
...
...
@@ -4173,6 +4172,11 @@ let trans_visitor
trans_init_chan
dst
p
end
|
Ast
.
STMT_init_box
(
dst
,
src
)
->
let
sloti
=
lval_base_to_slot
cx
dst
in
let
cell
=
cell_of_block_slot
sloti
.
id
in
trans_init_slot_from_atom
CLONE_none
cell
sloti
.
node
src
|
Ast
.
STMT_block
block
->
trans_block
block
...
...
src/boot/me/transutil.ml
浏览文件 @
a7016ade
...
...
@@ -153,7 +153,7 @@ let iter_block_slots
Hashtbl
.
iter
begin
fun
key
slot_id
->
let
slot
=
referent_to
_slot
cx
slot_id
in
let
slot
=
get
_slot
cx
slot_id
in
fn
key
slot_id
slot
end
block_slots
...
...
@@ -180,7 +180,7 @@ let iter_arg_slots
begin
fun
slot_id
->
let
key
=
Hashtbl
.
find
cx
.
ctxt_slot_keys
slot_id
in
let
slot
=
referent_to
_slot
cx
slot_id
in
let
slot
=
get
_slot
cx
slot_id
in
fn
key
slot_id
slot
end
ls
...
...
src/boot/me/typestate.ml
浏览文件 @
a7016ade
...
...
@@ -68,7 +68,7 @@ let determine_constr_key
if
referent_is_slot
cx
aid
then
if
type_has_state
(
slot_ty
(
referent_to
_slot
cx
aid
))
(
slot_ty
(
get
_slot
cx
aid
))
then
err
(
Some
aid
)
"predicate applied to slot of mutable type"
else
aid
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录