Commit 7cbb3c73 authored by Isaac Oscar Gariano's avatar Isaac Oscar Gariano

Fixed dynamic linking and tests bugs

parent ebd89fe5
......@@ -21,9 +21,11 @@ use utils::math::align_up;
use utils::bit_utils::bits_ones;
use std;
pub static mut VALIDATE_IR: bool = true;
macro_rules! assert_ir {
($ cond : expr ) => { assert!($cond) };
($ cond : expr , $ ( $ arg : tt ) + ) => { assert!($cond, $($arg)+)};
($ cond : expr ) => [{if unsafe{VALIDATE_IR} {assert!($cond)} }];
($ cond : expr , $ ( $ arg : tt ) + ) => [{if unsafe{VALIDATE_IR} {assert!($cond, $($arg)+)} }];
}
pub struct MuIRBuilder {
......
......@@ -53,3 +53,5 @@ mod deps {
pub use vm::handle::APIHandle;
extern crate mu_ast as ast;
}
pub use self::api_impl::VALIDATE_IR;
\ No newline at end of file
......@@ -27,23 +27,29 @@ Usage:
init_mu [options]
VM:
--log-level=<level> logging level: none, error, warn, info, debug, trace, env [default: env]
--log-level=<level> logging level: none, error, warn, info, debug, trace, env
[default: env]
Compiler:
--disable-inline disable compiler function inlining
--disable-regalloc-validate disable register allocation validation
--emit-debug-info emit debugging information
--dont-validate-ir don't validate for invalid IR
AOT Compiler:
--aot-emit-dir=<dir> the emit directory for ahead-of-time compiling [default: emit]
--link-statically link boot image to libmu statically (defaults to dynamic)
--bootimage-external-lib=<lib> ... library that will be linked against when making bootimage [default: ]
--bootimage-external-libpath=<path> ... path for the libraries during bootimage generation [default: ]
--aot-emit-dir=<dir> the emit directory for ahead-of-time compiling
[default: emit]
--link-statically link boot image to libmu statically (defaults to dynamic)
--bootimage-external-lib=<lib> ... library that will be linked against when making bootimage
[default: ]
--bootimage-external-libpath=<path> ... path for the libraries during bootimage generation
[default: ]
Garbage Collection:
--gc-disable-collection disable collection
--gc-immixspace-size=<kb> immix space size (default 65536kb = 64mb) [default: 67108864]
--gc-lospace-size=<kb> large object space size (default 65536kb = 64mb) [default: 67108864]
--gc-immixspace-size=<kb> immix space size (default 65536kb = 64mb)
[default: 67108864]
--gc-lospace-size=<kb> large object space size (default 65536kb = 64mb)
[default: 67108864]
--gc-nthreads=<n> number of threads for parallel gc [default: 8]
";
......@@ -51,24 +57,24 @@ Garbage Collection:
pub struct VMOptions {
// The comments here indicate the offset into the struct
// VM
pub flag_log_level: MuLogLevel, // +96
pub flag_log_level: MuLogLevel,
// Compiler
pub flag_disable_inline: bool, // +97
pub flag_disable_regalloc_validate: bool, // +98
pub flag_emit_debug_info: bool, // +99
pub flag_disable_inline: bool,
pub flag_disable_regalloc_validate: bool,
pub flag_emit_debug_info: bool,
pub flag_dont_validate_ir: bool,
// AOT compiler
pub flag_aot_emit_dir: String, // +0
pub flag_link_statically: bool, // +100
pub flag_bootimage_external_lib: Vec<String>, // +24
pub flag_bootimage_external_libpath: Vec<String>, // +48
pub flag_aot_emit_dir: String,
pub flag_link_statically: bool,
pub flag_bootimage_external_lib: Vec<String>,
pub flag_bootimage_external_libpath: Vec<String>,
// GC
pub flag_gc_disable_collection: bool, // +101
pub flag_gc_immixspace_size: usize, // +72
pub flag_gc_lospace_size: usize, // +80
pub flag_gc_nthreads: usize, // +88
pub flag_gc_disable_collection: bool,
pub flag_gc_immixspace_size: usize,
pub flag_gc_lospace_size: usize,
pub flag_gc_nthreads: usize
}
// The fields need to be listed here in the order rust stores them in
......@@ -83,6 +89,7 @@ rodal_struct!(VMOptions {
flag_disable_inline,
flag_disable_regalloc_validate,
flag_emit_debug_info,
flag_dont_validate_ir,
flag_link_statically,
flag_gc_disable_collection
});
......@@ -95,7 +102,7 @@ pub enum MuLogLevel {
Info,
Debug,
Trace,
Env,
Env
}
rodal_value!(MuLogLevel); // This enum has no fields with pointers, so just dump a strait value
......@@ -129,15 +136,32 @@ impl VMOptions {
// at the moment disable collection for debugging
// also because currently GC is buggy, and we are going to rewrite the GC
// See Issue #12
ret.flag_gc_disable_collection = true;
if !ret.flag_gc_disable_collection {
warn!("gc-disabled-collection is forced to true (opposite to user setting)");
ret.flag_gc_disable_collection = true;
}
// at the moment always emit debug info
ret.flag_emit_debug_info = true;
if !ret.flag_emit_debug_info {
warn!("emit-debug-info is forced to true (opposite to user setting)");
ret.flag_emit_debug_info = true;
}
// always disable register validation
// register validation is buggy. See Issue #19
ret.flag_disable_regalloc_validate = true;
if !ret.flag_disable_regalloc_validate {
warn!("disable-regalloc-validate is forced to true (opposite to user setting)");
ret.flag_disable_regalloc_validate = true;
}
if cfg!(target_os = "macos") {
if !ret.flag_link_statically {
warn!("link-statically is forced to true (opposite to user setting)");
ret.flag_link_statically = true;
}
}
unsafe{super::api::VALIDATE_IR = !ret.flag_dont_validate_ir};
ret
}
}
......
......@@ -383,7 +383,7 @@ def test_swapstack_threadlocal():
entry(<int<32>>argc <uptr<uptr<char>>>argv):
cs = COMMINST uvm.current_stack()
s = COMMINST uvm.new_stack<[(stackref)->()]>(test_swapstack_threadlocal_stack)
r = SWAPSTACK s RET_WITH<> PASS_VALUES<stackref>(cs)
SWAPSTACK s RET_WITH<> PASS_VALUES<stackref>(cs)
tv = COMMINST uvm.get_threadlocal()
tr = REFCAST <ref<void> ref<int<32>>> tv
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment