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
3d948653
Commit
3d948653
authored
Oct 27, 2016
by
John Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compile_to_sharedlib now compiles the whole bundle, with a specified library name
parent
3575d4da
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
15 deletions
+13
-15
src/vm/api/api_bridge.rs
src/vm/api/api_bridge.rs
+4
-6
src/vm/api/api_c.rs
src/vm/api/api_c.rs
+1
-1
src/vm/api/api_impl/muvm.rs
src/vm/api/api_impl/muvm.rs
+7
-7
src/vm/api/muapi.h
src/vm/api/muapi.h
+1
-1
No files found.
src/vm/api/api_bridge.rs
View file @
3d948653
...
...
@@ -243,14 +243,12 @@ extern fn _forwarder__MuVM__set_trap_handler(mvm: *mut CMuVM, trap_handler: CMuT
};
}
extern
fn
_
forwarder__MuVM__compile_to_sharedlib
(
mvm
:
*
mut
CMuVM
,
fnc_id
:
CMuID
)
->
CMuCString
{
extern
fn
_
forwarder__MuVM__compile_to_sharedlib
(
mvm
:
*
mut
CMuVM
,
lib_name
:
CMuCString
)
{
let
mut
_
arg_mvm
=
from_MuVM_ptr
(
mvm
);
let
mut
_
arg_
fnc_id
=
fnc_id
as
MuID
;
let
_
rv
=
unsafe
{
(
*
_
arg_mvm
)
.compile_to_sharedlib
(
_
arg_fnc_id
)
let
mut
_
arg_
lib_name
=
from_MuCString
(
lib_name
)
;
unsafe
{
(
*
_
arg_mvm
)
.compile_to_sharedlib
(
&
_
arg_lib_name
)
};
let
_
rv_prep
=
_
rv
;
_
rv_prep
}
extern
fn
_
forwarder__MuCtx__id_of
(
ctx
:
*
mut
CMuCtx
,
name
:
CMuName
)
->
CMuID
{
...
...
src/vm/api/api_c.rs
View file @
3d948653
...
...
@@ -110,7 +110,7 @@ pub struct CMuVM {
pub
name_of
:
extern
fn
(
*
mut
CMuVM
,
CMuID
)
->
CMuName
,
pub
set_trap_handler
:
extern
fn
(
*
mut
CMuVM
,
CMuTrapHandler
,
CMuCPtr
),
// this function is only used in testing jit
pub
compile_to_sharedlib
:
extern
fn
(
*
mut
CMuVM
,
CMu
ID
)
->
CMuCString
,
pub
compile_to_sharedlib
:
extern
fn
(
*
mut
CMuVM
,
CMu
CString
)
,
}
#[repr(C)]
...
...
src/vm/api/api_impl/muvm.rs
View file @
3d948653
...
...
@@ -70,7 +70,7 @@ impl MuVM {
panic!
(
"Not implemented"
)
}
pub
fn
compile_to_sharedlib
(
&
self
,
fnc_id
:
MuID
)
->
CMuCString
{
pub
fn
compile_to_sharedlib
(
&
self
,
lib_name
:
&
str
)
{
extern
crate
libloading
as
ll
;
use
compiler
::
*
;
...
...
@@ -78,18 +78,18 @@ impl MuVM {
let
compiler
=
Compiler
::
new
(
CompilerPolicy
::
default
(),
self
.vm
.clone
());
let
funcs
=
self
.vm
.funcs
()
.read
()
.unwrap
();
let
mut
func_names
=
vec!
[];
// NOTE: this fails because load() API call is not properly implemented yet.
let
func
=
funcs
.get
(
&
fnc_id
)
.unwrap
()
.read
()
.unwrap
();
{
for
(
func_id
,
ref
f
)
in
funcs
.iter
()
{
let
func
=
f
.read
()
.unwrap
();
let
func_vers
=
self
.vm
.func_vers
()
.read
()
.unwrap
();
let
mut
func_ver
=
func_vers
.get
(
&
func
.cur_ver
.unwrap
())
.unwrap
()
.write
()
.unwrap
();
compiler
.compile
(
&
mut
func_ver
);
func_names
.push
(
func
.name
()
.unwrap
());
}
let
func_name
=
func
.name
()
.unwrap
();
backend
::
emit_context
(
&
self
.vm
);
let
libname
=
&
format!
(
"lib{}.dylib"
,
func_name
);
let
dylib
=
aot
::
link_dylib
(
vec!
[
func_name
],
libname
);
dylib
.to_str
()
.unwrap
()
.as_ptr
()
as
CMuCString
let
libname
=
&
format!
(
"lib{}.dylib"
,
lib_name
);
aot
::
link_dylib
(
func_names
,
libname
);
}
}
...
...
src/vm/api/muapi.h
View file @
3d948653
...
...
@@ -271,7 +271,7 @@ struct MuVM {
// Set handlers
void
(
*
set_trap_handler
)(
MuVM
*
mvm
,
MuTrapHandler
trap_handler
,
MuCPtr
userdata
);
MuCString
(
*
compile_to_sharedlib
)(
MuVM
*
mvm
,
MuID
fnc_id
);
void
(
*
compile_to_sharedlib
)(
MuVM
*
mvm
,
MuCString
lib_name
);
};
// A local context. It can only be used by one thread at a time. It holds many
...
...
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