Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mu-impl-fast
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
mu
mu-impl-fast
Commits
fddf6d35
Commit
fddf6d35
authored
Aug 03, 2017
by
Isaac Oscar Gariano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated rust formating
parent
71a74d9c
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
346 additions
and
278 deletions
+346
-278
build.rs
build.rs
+1
-1
src/compiler/backend/arch/aarch64/inst_sel.rs
src/compiler/backend/arch/aarch64/inst_sel.rs
+264
-206
src/compiler/backend/arch/x86_64/inst_sel.rs
src/compiler/backend/arch/x86_64/inst_sel.rs
+16
-23
src/compiler/backend/mod.rs
src/compiler/backend/mod.rs
+40
-38
src/compiler/passes/inlining.rs
src/compiler/passes/inlining.rs
+20
-5
src/vm/api/api_impl/muvm.rs
src/vm/api/api_impl/muvm.rs
+1
-1
src/vm/built_info.rs
src/vm/built_info.rs
+1
-1
tests/test_api/test_vm_version.rs
tests/test_api/test_vm_version.rs
+1
-1
tests/test_compiler/mod.rs
tests/test_compiler/mod.rs
+1
-1
tests/test_compiler/test_convop.rs
tests/test_compiler/test_convop.rs
+1
-1
No files found.
build.rs
View file @
fddf6d35
...
...
@@ -45,4 +45,4 @@ fn main() {
fn
built
()
{
built
::
write_built_file
()
.expect
(
"Failed to acquire build-time information"
);
}
\ No newline at end of file
}
src/compiler/backend/arch/aarch64/inst_sel.rs
View file @
fddf6d35
This diff is collapsed.
Click to expand it.
src/compiler/backend/arch/x86_64/inst_sel.rs
View file @
fddf6d35
...
...
@@ -365,15 +365,9 @@ impl<'a> InstructionSelection {
}
// jcc - for 8-bits integer
_
=>
{
let
blk_true
=
make_block_name
(
&
node
.name
(),
"select_true"
);
let
blk_false
=
make_block_name
(
&
node
.name
(),
"select_false"
);
let
blk_end
=
make_block_name
(
&
node
.name
(),
"select_end"
);
let
blk_true
=
make_block_name
(
&
node
.name
(),
"select_true"
);
let
blk_false
=
make_block_name
(
&
node
.name
(),
"select_false"
);
let
blk_end
=
make_block_name
(
&
node
.name
(),
"select_end"
);
// jump to blk_true if true
match
cmpop
{
...
...
@@ -436,12 +430,9 @@ impl<'a> InstructionSelection {
}
else
if
self
.match_fpreg
(
true_val
)
{
let
tmp_res
=
self
.get_result_value
(
node
);
let
blk_true
=
make_block_name
(
&
node
.name
(),
"select_true"
);
let
blk_false
=
make_block_name
(
&
node
.name
(),
"select_false"
);
let
blk_end
=
make_block_name
(
&
node
.name
(),
"select_end"
);
let
blk_true
=
make_block_name
(
&
node
.name
(),
"select_true"
);
let
blk_false
=
make_block_name
(
&
node
.name
(),
"select_false"
);
let
blk_end
=
make_block_name
(
&
node
.name
(),
"select_end"
);
// jump to blk_true if true
match
cmpop
{
...
...
@@ -596,7 +587,8 @@ impl<'a> InstructionSelection {
}
self
.finish_block
();
let
block_name
=
make_block_name
(
&
node
.name
(),
let
block_name
=
make_block_name
(
&
node
.name
(),
format!
(
"switch_not_met_case_{}"
,
case_op_index
)
.as_str
()
);
self
.start_block
(
block_name
);
...
...
@@ -1089,13 +1081,16 @@ impl<'a> InstructionSelection {
// testq %tmp_op %tmp_op
self
.backend
.emit_test_r_r
(
&
tmp_op
,
&
tmp_op
);
let
blk_if_signed
=
make_block_name
(
&
node
.name
(),
let
blk_if_signed
=
make_block_name
(
&
node
.name
(),
"uitofp_float_if_signed"
);
let
blk_if_not_signed
=
make_block_name
(
&
node
.name
(),
let
blk_if_not_signed
=
make_block_name
(
&
node
.name
(),
"uitofp_float_if_not_signed"
);
let
blk_done
=
make_block_name
(
&
node
.name
(),
let
blk_done
=
make_block_name
(
&
node
.name
(),
"uitofp_float_done"
);
...
...
@@ -3071,8 +3066,7 @@ impl<'a> InstructionSelection {
// emit: >> large object alloc
// emit: ALLOC_LARGE_END:
let
blk_alloc_large
=
make_block_name
(
&
node
.name
(),
"alloc_large"
);
let
blk_alloc_large_end
=
make_block_name
(
&
node
.name
(),
"alloc_large_end"
);
let
blk_alloc_large_end
=
make_block_name
(
&
node
.name
(),
"alloc_large_end"
);
if
OBJECT_HEADER_SIZE
!=
0
{
// if the header size is not zero, we need to calculate a total size to alloc
...
...
@@ -4028,8 +4022,7 @@ impl<'a> InstructionSelection {
// insert an intermediate block to branch to normal
// the branch is inserted later (because we need to deal with postcall convention)
self
.finish_block
();
let
block_name
=
make_block_name
(
&
node
.name
(),
"normal_cont_for_call"
);
let
block_name
=
make_block_name
(
&
node
.name
(),
"normal_cont_for_call"
);
self
.start_block
(
block_name
);
}
else
{
self
.current_callsites
...
...
src/compiler/backend/mod.rs
View file @
fddf6d35
...
...
@@ -232,44 +232,46 @@ impl BackendType {
pub
fn
resolve
(
ty
:
&
MuType
,
vm
:
&
VM
)
->
BackendType
{
match
ty
.v
{
// integer
MuType_
::
Int
(
size_in_bit
)
=>
match
size_in_bit
{
1
...
8
=>
BackendType
{
size
:
1
,
alignment
:
1
,
struct_layout
:
None
,
elem_size
:
None
,
gc_type
:
mm
::
add_gc_type
(
GCType
::
new_noreftype
(
1
,
1
))
},
9
...
16
=>
BackendType
{
size
:
2
,
alignment
:
2
,
struct_layout
:
None
,
elem_size
:
None
,
gc_type
:
mm
::
add_gc_type
(
GCType
::
new_noreftype
(
2
,
2
))
},
17
...
32
=>
BackendType
{
size
:
4
,
alignment
:
4
,
struct_layout
:
None
,
elem_size
:
None
,
gc_type
:
mm
::
add_gc_type
(
GCType
::
new_noreftype
(
4
,
4
))
},
33
...
64
=>
BackendType
{
size
:
8
,
alignment
:
8
,
struct_layout
:
None
,
elem_size
:
None
,
gc_type
:
mm
::
add_gc_type
(
GCType
::
new_noreftype
(
8
,
8
))
},
128
=>
BackendType
{
size
:
16
,
alignment
:
16
,
struct_layout
:
None
,
elem_size
:
None
,
gc_type
:
mm
::
add_gc_type
(
GCType
::
new_noreftype
(
16
,
16
))
},
_
=>
unimplemented!
()
},
MuType_
::
Int
(
size_in_bit
)
=>
{
match
size_in_bit
{
1
...
8
=>
BackendType
{
size
:
1
,
alignment
:
1
,
struct_layout
:
None
,
elem_size
:
None
,
gc_type
:
mm
::
add_gc_type
(
GCType
::
new_noreftype
(
1
,
1
))
},
9
...
16
=>
BackendType
{
size
:
2
,
alignment
:
2
,
struct_layout
:
None
,
elem_size
:
None
,
gc_type
:
mm
::
add_gc_type
(
GCType
::
new_noreftype
(
2
,
2
))
},
17
...
32
=>
BackendType
{
size
:
4
,
alignment
:
4
,
struct_layout
:
None
,
elem_size
:
None
,
gc_type
:
mm
::
add_gc_type
(
GCType
::
new_noreftype
(
4
,
4
))
},
33
...
64
=>
BackendType
{
size
:
8
,
alignment
:
8
,
struct_layout
:
None
,
elem_size
:
None
,
gc_type
:
mm
::
add_gc_type
(
GCType
::
new_noreftype
(
8
,
8
))
},
128
=>
BackendType
{
size
:
16
,
alignment
:
16
,
struct_layout
:
None
,
elem_size
:
None
,
gc_type
:
mm
::
add_gc_type
(
GCType
::
new_noreftype
(
16
,
16
))
},
_
=>
unimplemented!
()
}
}
// reference of any type
MuType_
::
Ref
(
_
)
|
MuType_
::
IRef
(
_
)
|
MuType_
::
WeakRef
(
_
)
=>
BackendType
{
size
:
8
,
...
...
src/compiler/passes/inlining.rs
View file @
fddf6d35
...
...
@@ -466,7 +466,13 @@ fn copy_inline_blocks(
let
ref
ops
=
inst
.ops
;
let
ref
v
=
inst
.v
;
trace!
(
"ISAAC: Inlining [{} -> {}] : {} -> {}"
,
old_block
.name
(),
block_name
,
inst_name
,
hdr
.name
());
trace!
(
"ISAAC: Inlining [{} -> {}] : {} -> {}"
,
old_block
.name
(),
block_name
,
inst_name
,
hdr
.name
()
);
match
v
{
&
Instruction_
::
Return
(
ref
vec
)
=>
{
// change RET to a branch
...
...
@@ -517,7 +523,10 @@ fn copy_inline_blocks(
trace!
(
"rewrite to: {}"
,
branch2
);
block_content
.body
.push
(
TreeNode
::
new_boxed_inst
(
branch2
));
}
&
Instruction_
::
Call
{
ref
data
,
ref
resume
}
=>
{
&
Instruction_
::
Call
{
ref
data
,
ref
resume
}
=>
{
let
call
=
Instruction
{
hdr
:
hdr
,
value
:
value
.clone
(),
...
...
@@ -531,7 +540,10 @@ fn copy_inline_blocks(
trace!
(
"rewrite to: {}"
,
call
);
block_content
.body
.push
(
TreeNode
::
new_boxed_inst
(
call
));
}
&
Instruction_
::
CCall
{
ref
data
,
ref
resume
}
=>
{
&
Instruction_
::
CCall
{
ref
data
,
ref
resume
}
=>
{
let
call
=
Instruction
{
hdr
:
hdr
,
value
:
value
.clone
(),
...
...
@@ -557,8 +569,11 @@ fn copy_inline_blocks(
v
:
Instruction_
::
Switch
{
cond
:
*
cond
,
default
:
fix_dest
(
default
.clone
()),
branches
:
branches
.iter
()
.map
(|
&
(
ref
op
,
ref
dest
)|
(
op
.clone
(),
fix_dest
(
dest
.clone
())))
branches
:
branches
.iter
()
.map
(|
&
(
ref
op
,
ref
dest
)|
{
(
op
.clone
(),
fix_dest
(
dest
.clone
()))
})
.collect
()
}
};
...
...
src/vm/api/api_impl/muvm.rs
View file @
fddf6d35
...
...
@@ -177,4 +177,4 @@ use vm::built_info;
#[no_mangle]
pub
extern
"C"
fn
mu_get_version
()
->
*
const
c_char
{
built_info
::
ZEBU_VERSION_C_STR
.as_ptr
()
}
\ No newline at end of file
}
src/vm/built_info.rs
View file @
fddf6d35
...
...
@@ -31,4 +31,4 @@ lazy_static! {
};
pub
static
ref
ZEBU_VERSION_C_STR
:
CString
=
CString
::
new
(
ZEBU_VERSION_STR
.clone
())
.unwrap
();
}
\ No newline at end of file
}
tests/test_api/test_vm_version.rs
View file @
fddf6d35
...
...
@@ -4,4 +4,4 @@ use std::ffi::CStr;
#[test]
fn
test_mu_get_version
()
{
println!
(
"{:?}"
,
unsafe
{
CStr
::
from_ptr
(
mu_get_version
())
});
}
\ No newline at end of file
}
tests/test_compiler/mod.rs
View file @
fddf6d35
...
...
@@ -29,4 +29,4 @@ mod test_mem_inst;
mod
test_inline
;
mod
test_convop
;
mod
test_int128
;
mod
test_misc
;
\ No newline at end of file
mod
test_misc
;
tests/test_compiler/test_convop.rs
View file @
fddf6d35
...
...
@@ -167,4 +167,4 @@ fn bitcast_f32_to_u32() -> VM {
});
vm
}
\ No newline at end of file
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment