...
 
Commits (4)
......@@ -861,7 +861,12 @@ impl Instruction {
format!("COMMINST @uvm.settime({})", ops[time])
}
&Instruction_::NewTimer => format!("COMMINST @uvm.newtimer"),
&Instruction_::SetTimer { tmr, tm, prd, ref data } => format!(
&Instruction_::SetTimer {
tmr,
tm,
prd,
ref data
} => format!(
"COMMINST @uvm.settimer({}, {}, {}) ",
ops[tmr], ops[tm], ops[prd]
),
......@@ -1481,11 +1486,11 @@ pub enum Instruction_ {
SetTime(OpIndex),
NewTimer,
SetTimer{
SetTimer {
tmr: OpIndex,
tm: OpIndex,
prd: OpIndex,
data: CallData,
data: CallData
},
CancelTimer(OpIndex),
DeleteTimer(OpIndex),
......
......@@ -215,7 +215,7 @@ impl MuType {
_ => false
}
}
#[cfg(feature = "realtime")]
pub fn is_regionref(&self) -> bool {
match self.v {
......@@ -293,7 +293,6 @@ impl MuType {
}
}
pub fn is_eq_comparable(&self) -> bool {
self.is_int()
|| self.is_ptr()
......
......@@ -104,7 +104,7 @@ fn is_suitable_child(inst: &Instruction) -> bool {
| GetTime
| SetTime(_)
| NewTimer
| SetTimer{ .. }
| SetTimer { .. }
| CancelTimer(_)
| DeleteTimer(_)
| Sleep(_)
......
// Copyright 2017 The Australian National University
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <pthread.h>
uintptr_t immmix_get_stack_ptr() {
uintptr_t rsp;
// get current rsp, rbp (this C func frame)
__asm__(
"mov %%rsp, %0 \n"
: "=rm" (rsp)
);
return rsp;
}
int get_registers_count() {
return 16;
}
uintptr_t* get_registers () {
uintptr_t rax, rbx, rcx, rdx, rbp, rsp, rsi, rdi, r8, r9, r10, r11, r12, r13, r14, r15;
__asm__(
"mov %%rax, %0 \n"
"mov %%rbx, %1 \n"
"mov %%rcx, %2 \n"
"mov %%rdx, %3 \n"
"mov %%rbp, %4 \n"
"mov %%rsp, %5 \n"
"mov %%rsi, %5 \n"
"mov %%rdi, %6 \n"
"mov %%r8, %7 \n"
"mov %%r9, %8 \n"
"mov %%r10, %10\n"
"mov %%r11, %11\n"
"mov %%r12, %12\n"
"mov %%r13, %13\n"
"mov %%r14, %14\n"
"mov %%r15, %15\n"
: "=m" (rax),
"=m" (rbx),
"=m" (rcx),
"=m" (rdx),
"=m" (rbp),
"=m" (rsp),
"=m" (rsi),
"=m" (rdi),
"=m" (r8),
"=m" (r9),
"=m" (r10),
"=m" (r11),
"=m" (r12),
"=m" (r13),
"=m" (r14),
"=m" (r15)
:
:
);
uintptr_t* ret = (uintptr_t*) malloc(sizeof(uintptr_t) * 16);
ret[0] = rax;
ret[1] = rbx;
ret[2] = rcx;
ret[3] = rdx;
ret[4] = rbp;
ret[5] = rsp;
ret[6] = rsi;
ret[7] = rdi;
ret[8] = r8;
ret[9] = r9;
ret[10] = r10;
ret[11] = r11;
ret[12] = r12;
ret[13] = r13;
ret[14] = r14;
ret[15] = r15;
return ret;
}
// __thread uintptr_t low_water_mark;
int lwm_initialized = 0;
static pthread_key_t low_water_mark;
void set_low_water_mark () {
uintptr_t rsp;
if(lwm_initialized == 0){
lwm_initialized = 1;
int result = pthread_key_create(&low_water_mark, NULL);
if(result != 0){
printf("set_low_water_mark(): PThread key create failed with error code = %d\n", result);
assert(0);
}
}
// get current rsp, rbp (this C func frame)
__asm__(
"mov %%rsp, %0 \n"
: "=rm" (rsp)
);
int result = pthread_setspecific(low_water_mark, (const void *) rsp);
if(result != 0){
printf("set_low_water_mark(): PThread set specific failed with error code = %d\n", result);
assert(0);
}
}
uintptr_t get_low_water_mark() {
if(lwm_initialized == 0){
printf("get_low_water_mark(): PThread key MUST be initialized before first use!!\n");
}
void * result = pthread_getspecific(low_water_mark);
if(result == NULL){
printf("get_low_water_mark(): NO pthread key found for current thread!!\n");
assert(0);
}
return (uintptr_t) result;
}
......@@ -68,7 +68,7 @@ impl Allocator for ImmixAllocator {
#[inline(always)]
fn alloc(&mut self, size: usize, align: usize) -> Address {
trace!("immix_mutator::alloc(self, {}, {});", size, align);
trace!("immix_mutator::alloc({}, {}, {});", &self, size, align);
// this part of code will slow down allocation
let align = objectmodel::check_alignment(align);
// end
......@@ -129,7 +129,7 @@ impl ImmixAllocator {
#[inline(never)]
pub fn alloc_slow(&mut self, size: usize, align: usize) -> Address {
trace!("immix_mutator::alloc_slow(self, {}, {});", size, align);
trace!("immix_mutator::alloc_slow({}, {}, {});", &self, size, align);
if size > BYTES_IN_LINE {
trace_if!(TRACE_ALLOC, "Mutator: overflow alloc()");
self.overflow_alloc(size, align)
......@@ -173,6 +173,7 @@ impl ImmixAllocator {
#[inline(always)]
pub fn init_object<T>(&mut self, addr: Address, encode: T) {
trace!("init_object({}, _)", addr);
let map_slot = ImmixSpace::get_type_byte_slot_static(addr);
unsafe {
map_slot.store(encode);
......@@ -185,7 +186,8 @@ impl ImmixAllocator {
align: usize
) -> Address {
trace!(
"immix_mutator::try_alloc_from_local(self, {}, {});",
"immix_mutator::try_alloc_from_local({}, {}, {});",
&self,
size,
align
);
......@@ -238,7 +240,8 @@ impl ImmixAllocator {
request_large: bool
) -> Address {
trace!(
"immix_mutator::alloc_from_global(self, {}, {}, {});",
"immix_mutator::alloc_from_global({}, {}, {}, {});",
&self,
size,
align,
request_large
......
......@@ -301,6 +301,7 @@ pub extern "C" fn remove_root(obj: ObjectReference) {
/// pins an object so that it will be moved or reclaimed
#[no_mangle]
pub extern "C" fn muentry_pin_object(obj: ObjectReference) -> Address {
trace!("gc::src::lib::muentry_pin_object");
add_to_root(obj);
obj.to_address()
}
......@@ -308,6 +309,7 @@ pub extern "C" fn muentry_pin_object(obj: ObjectReference) -> Address {
/// unpins an object so that it can be freely moved/reclaimed as normal objects
#[no_mangle]
pub extern "C" fn muentry_unpin_object(obj: Address) {
trace!("gc::src::lib::muentry_unpin_object");
remove_root(unsafe { obj.to_object_reference() });
}
......@@ -339,6 +341,7 @@ pub extern "C" fn muentry_alloc_tiny(
align: usize
) -> ObjectReference {
let m = mutator_ref(mutator);
trace!("gc::src::lib::muentry_alloc_tiny({}, {})", size, align);
unsafe { m.tiny.alloc(size, align).to_object_reference() }
}
......@@ -349,6 +352,7 @@ pub extern "C" fn muentry_alloc_normal(
align: usize
) -> ObjectReference {
let m = mutator_ref(mutator);
trace!("gc::src::lib::muentry_alloc_normal({}, {})", size, align);
let res = m.normal.alloc(size, align);
m.normal.post_alloc(res, size);
unsafe { res.to_object_reference() }
......@@ -362,8 +366,8 @@ pub extern "C" fn muentry_alloc_tiny_slow(
size: usize,
align: usize
) -> Address {
trace!("gc::src::lib::muentry_alloc_tiny_slow");
let m = mutator_ref(mutator);
trace!("gc::src::lib::muentry_alloc_tiny_slow({}, {})", size, align);
m.tiny.alloc_slow(size, align)
}
......@@ -375,8 +379,8 @@ pub extern "C" fn muentry_alloc_normal_slow(
size: usize,
align: usize
) -> Address {
trace!("gc::src::lib::muentry_alloc_normal_slow");
let m = mutator_ref(mutator);
trace!("gc::src::lib::muentry_alloc_normal_slow({}, {})", size, align);
let res = m.normal.alloc_slow(size, align);
m.normal.post_alloc(res, size);
res
......@@ -391,6 +395,7 @@ pub extern "C" fn muentry_alloc_large(
align: usize
) -> ObjectReference {
let m = mutator_ref(mutator);
trace!("gc::src::lib::muentry_alloc_large({}, {})", size, align);
let res = m.lo.alloc(size, align);
unsafe { res.to_object_reference() }
}
......@@ -402,6 +407,7 @@ pub extern "C" fn muentry_init_tiny_object(
obj: ObjectReference,
encode: TinyObjectEncode
) {
trace!("gc::src::lib::muentry_init_tiny_object");
unsafe { &mut *mutator }
.tiny
.init_object(obj.to_address(), encode);
......@@ -414,6 +420,7 @@ pub extern "C" fn muentry_init_small_object(
obj: ObjectReference,
encode: SmallObjectEncode
) {
trace!("gc::src::lib::muentry_init_small_object");
unsafe { &mut *mutator }
.normal
.init_object(obj.to_address(), encode);
......@@ -426,6 +433,7 @@ pub extern "C" fn muentry_init_medium_object(
obj: ObjectReference,
encode: MediumObjectEncode
) {
trace!("gc::src::lib::muentry_init_medium_object");
unsafe { &mut *mutator }
.normal
.init_object(obj.to_address(), encode);
......@@ -437,6 +445,7 @@ pub extern "C" fn muentry_init_large_object(
obj: ObjectReference,
encode: LargeObjectEncode
) {
trace!("gc::src::lib::muentry_init_large_object");
unsafe { &mut *mutator }
.lo
.init_object(obj.to_address(), encode);
......
......@@ -122,7 +122,8 @@ fn sys_futex_lock_slowpath(futex_ptr: *mut u32, timeout_ns: u64) {
}
};
assert_eq!(
res, 0,
res,
0,
"FUTEX.lock slowpath failed with error code #{}",
unsafe { (*libc::__errno_location()) }
);
......
......@@ -22,7 +22,8 @@ pub fn sys_get_time_ns() -> i64 {
);
}
let res = (timestamp.tv_nsec as i64) + (1_000_000_000 * (timestamp.tv_sec as i64));
let res = (timestamp.tv_nsec as i64)
+ (1_000_000_000 * (timestamp.tv_sec as i64));
if cfg!(debug_assertions) {
debug!("sys_get_time_ns: {}", res);
......
......@@ -322,7 +322,7 @@ pub enum MuStackState {
/// MuThread. The compiler emits code that uses offsets to some fields in this
/// struct.
#[repr(C)]
pub struct MuThread {
pub struct MuThread {
pub hdr: MuEntityHeader,
/// the allocator from memory manager
/// Fixme, not all threads need mutator
......@@ -349,9 +349,11 @@ pub struct MuThread {
pub rt_attr: Box<RTAttr>,
// #[cfg(feature = "realtime")]
pub sys_thread_id: SysThreadID,
pub sys_thread_context: *mut MuThreadContext /* #[cfg(feature = "realtime")]
* pub runnable:
* Arc<(Mutex<bool>, Condvar)>, */
pub sys_thread_context: *mut MuThreadContext /* #[cfg(feature =
* "realtime")]
* pub runnable:
* Arc<(Mutex<bool>,
* Condvar)>, */
}
rodal_named!(MuThread);
......@@ -438,9 +440,7 @@ pub fn check_result() -> c_int {
impl MuThread {
pub fn join(&self) {
let res = unsafe {
sys_thread_join(self.sys_thread_id)
};
let res = unsafe { sys_thread_join(self.sys_thread_id) };
trace!("pthread_join returned: {}", res);
}
......@@ -530,14 +530,13 @@ impl MuThread {
rt_attr: Box::new(RTAttr::new()),
// #[cfg(feature = "realtime")]
sys_thread_id: 0 as SysThreadID,
sys_thread_context: std::ptr::null_mut() as *mut MuThreadContext
/*
* #[cfg(feature =
* "realtime")]
* runnable:
* Arc::new((Mutex::
* new(false),
* Condvar::new())), */
sys_thread_context: std::ptr::null_mut() as *mut MuThreadContext /*
* #[cfg(feature =
* "realtime")]
* runnable:
* Arc::new((Mutex::
* new(false),
* Condvar::new())), */
};
}
......@@ -695,14 +694,13 @@ impl MuThread {
rt_attr: Box::new(RTAttr::new()),
// #[cfg(feature = "realtime")]
sys_thread_id: muthread_self(),
sys_thread_context: std::ptr::null_mut() as *mut MuThreadContext
/*
* #[cfg(feature =
* "realtime")]
* runnable:
* Arc::new((Mutex::
* new(false),
* Condvar::new())), */
sys_thread_context: std::ptr::null_mut() as *mut MuThreadContext /*
* #[cfg(feature =
* "realtime")]
* runnable:
* Arc::new((Mutex::
* new(false),
* Condvar::new())), */
});
{
let mutator_ptr = &mut fake_mu_thread.allocator as *mut mm::Mutator;
......@@ -714,7 +712,8 @@ impl MuThread {
(*ptr_fake_mu_thread).sys_thread_context =
Box::into_raw(Box::new(MuThreadContext {
// muthread: Address::from_mut_ptr(ptr_fake_mu_thread),
// muthread:
// Address::from_mut_ptr(ptr_fake_mu_thread),
new_sp: Address::from_mut_ptr((*ptr_fake_mu_thread).stack),
exception: Address::zero()
}));
......
......@@ -33,10 +33,7 @@ pub unsafe fn sys_thread_launch(
let muthread_add = Address::from_mut_ptr(muthread_ptr);
let mut muthread_box = Box::from_raw(muthread_ptr);
let context = Box::new(MuThreadContext {
new_sp,
exception
});
let context = Box::new(MuThreadContext { new_sp, exception });
let context = Box::into_raw(context);
muthread_box.sys_thread_context = context;
......
......@@ -37,7 +37,7 @@ pub const MAX_CPU_COUNT: usize = 32;
#[derive(Debug)]
#[repr(C)]
pub struct MuThreadContext {
// pub muthread: Address,
// pub muthread: Address,
// attr: Option<RTAttr>,
pub new_sp: Address,
pub exception: Address
......@@ -56,14 +56,12 @@ pub(super) extern "C" fn _pthread_entry_point(
// let muthread_ptr = Box::into_raw(context);
// let context = unsafe { Box::from_raw(context) };
let context = unsafe {
Box::from_raw(muthread_boxed.sys_thread_context)
};
let context = unsafe { Box::from_raw(muthread_boxed.sys_thread_context) };
debug!("PTHREAD_ENTRY input context:{:#?}", context);
let muthread_ptr = Box::into_raw(muthread_boxed);
// let muthread_ptr: *mut MuThread = context.muthread.to_ptr_mut();
// let muthread_ptr: *mut MuThread = context.muthread.to_ptr_mut();
let new_sp = unsafe { (*(*muthread_ptr).stack).sp.clone() };
let exception = context.exception;
......@@ -100,7 +98,7 @@ pub(super) extern "C" fn _pthread_entry_point(
}
// Thread finished, delete it's data
// Box::from_raw(muthread_ptr);
// Box::from_raw(muthread_ptr);
}
std::ptr::null() as *const SysVoid as *mut SysVoid
......@@ -118,18 +116,22 @@ pub(super) fn sys_thread_self() -> SysThreadID {
}
pub(super) fn sys_new_default_affinity_mask() -> SysAffinityMask {
// let def_attr: SysThreadAttr = unsafe { std::mem::zeroed() };
// let def_attr: SysThreadAttr = unsafe { std::mem::zeroed() };
let mut def_aff: SysAffinityMask = unsafe { std::mem::zeroed() };
// let res = unsafe { libc::pthread_attr_init(
// &def_attr as *const SysThreadAttr as *mut SysThreadAttr
// ) };
// assert_eq!(res, MU_SUCCESS);
//
// let res = unsafe { libc::pthread_attr_getaffinity_np(&def_attr as *const libc::pthread_attr_t, libc::CPU_SETSIZE as usize, &def_aff as *const libc::cpu_set_t as *mut libc::cpu_set_t) };
// assert_eq!(res, MU_SUCCESS);
// let res = unsafe { libc::pthread_attr_init(
// &def_attr as *const SysThreadAttr as *mut SysThreadAttr
// ) };
// assert_eq!(res, MU_SUCCESS);
//
// let res = unsafe { libc::pthread_attr_getaffinity_np(&def_attr as
// *const libc::pthread_attr_t, libc::CPU_SETSIZE as usize, &def_aff as
// *const libc::cpu_set_t as *mut libc::cpu_set_t) }; assert_eq!(res,
// MU_SUCCESS);
for i in 0..MAX_CPU_COUNT {
unsafe { libc::CPU_SET(i, &mut def_aff); };
unsafe {
libc::CPU_SET(i, &mut def_aff);
};
}
def_aff
......
......@@ -161,7 +161,7 @@ pub unsafe extern "C" fn muentry_attr_set_cpu(attr: *mut SysVoid, cpu: usize) {
debug!("muentry_attr_set_cpu ({:#?}, {})", attr, cpu);
let mut attr: Box<RTAttr> = Box::from_raw(attr as *mut RTAttr);
sys_affinity_set_cpu(cpu, &mut unsafe { *(attr.affinity) } );
sys_affinity_set_cpu(cpu, &mut unsafe { *(attr.affinity) });
Box::into_raw(attr);
}
......@@ -173,7 +173,7 @@ pub unsafe extern "C" fn muentry_attr_clear_cpu(
debug!("muentry_attr_clear_cpu ({:#?}, {})", attr, cpu);
let mut attr: Box<RTAttr> = Box::from_raw(attr as *mut RTAttr);
sys_affinity_clear_cpu(cpu, &mut unsafe { *(attr.affinity) } );
sys_affinity_clear_cpu(cpu, &mut unsafe { *(attr.affinity) });
Box::into_raw(attr);
}
......@@ -184,7 +184,7 @@ pub unsafe extern "C" fn muentry_attr_isset_cpu(
) -> bool {
debug!("muentry_attr_isset_cpu ({:#?}, {})", attr, cpu);
let mut attr: Box<RTAttr> = Box::from_raw(attr as *mut RTAttr);
let res = sys_affinity_isset_cpu(cpu, &mut unsafe { *(attr.affinity) } );
let res = sys_affinity_isset_cpu(cpu, &mut unsafe { *(attr.affinity) });
debug!("muentry_attr_isset_cpu returned ({})", res);
......@@ -196,7 +196,7 @@ pub unsafe extern "C" fn muentry_attr_isset_cpu(
#[no_mangle]
pub unsafe extern "C" fn muentry_attr_zero_cpu(attr: *mut SysVoid) {
let mut attr: Box<RTAttr> = Box::from_raw(attr as *mut RTAttr);
sys_affinity_zero_cpu(&mut unsafe { *(attr.affinity) } );
sys_affinity_zero_cpu(&mut unsafe { *(attr.affinity) });
Box::into_raw(attr);
}
......@@ -336,7 +336,7 @@ pub extern "C" fn muentry_thread_set_cpu(muthread: *mut MuThread, cpu: usize) {
}
})
};
sys_affinity_set_cpu(cpu, &mut unsafe { * (cur_muthread.rt_attr.affinity) });
sys_affinity_set_cpu(cpu, &mut unsafe { *(cur_muthread.rt_attr.affinity) });
sys_thread_set_affinity(
cur_muthread.sys_thread_id,
MU_DEFAULT_AFF_SIZE,
......@@ -359,7 +359,9 @@ pub extern "C" fn muentry_thread_clear_cpu(
}
})
};
sys_affinity_clear_cpu(cpu, &mut unsafe { * (cur_muthread.rt_attr.affinity) });
sys_affinity_clear_cpu(cpu, &mut unsafe {
*(cur_muthread.rt_attr.affinity)
});
sys_thread_set_affinity(
cur_muthread.sys_thread_id,
MU_DEFAULT_AFF_SIZE,
......@@ -383,7 +385,9 @@ pub extern "C" fn muentry_thread_isset_cpu(
}
})
};
let res = sys_affinity_isset_cpu(cpu, &mut unsafe { * (cur_muthread.rt_attr.affinity) });
let res = sys_affinity_isset_cpu(cpu, &mut unsafe {
*(cur_muthread.rt_attr.affinity)
});
let _cur_muthread = Box::into_raw(cur_muthread);
res
......
......@@ -155,14 +155,15 @@ pub(super) unsafe fn sys_thread_launch(
};
let muthread_ptr = Box::into_raw(muthread);
// let muthread_add = Address::from_mut_ptr(muthread_ptr);
// let muthread_add = Address::from_mut_ptr(muthread_ptr);
let mut muthread_box = unsafe { Box::from_raw(muthread_ptr) };
muthread_box.sys_thread_context = Box::into_raw(Box::new(MuThreadContext {
// muthread: muthread_add.clone(),
new_sp: Address::from(new_sp),
exception: Address::from(exception)
}));
muthread_box.sys_thread_context =
Box::into_raw(Box::new(MuThreadContext {
// muthread: muthread_add.clone(),
new_sp: Address::from(new_sp),
exception: Address::from(exception)
}));
let muthread_ptr = Box::into_raw(muthread_box);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -603,31 +603,31 @@ pub enum NodeInst {
NodeExitThread {
id: MuID,
tref: MuVarNode,
exc_clause: Option<MuExcClause>,
exc_clause: Option<MuExcClause>
},
NodeYield {
id: MuID,
exc_clause: Option<MuExcClause>,
exc_clause: Option<MuExcClause>
},
NodeNewFutex {
id: MuID,
result_id: MuID,
result_id: MuID
},
NodeNewAttr {
id: MuID,
result_id: MuID,
result_id: MuID
},
NodeSetAttr {
id: MuID,
tref: MuVarNode,
aref: MuVarNode,
exc_clause: Option<MuExcClause>,
exc_clause: Option<MuExcClause>
},
NodeGetAttr {
id: MuID,
result_id: MuID,
tref: MuVarNode,
exc_clause: Option<MuExcClause>,
exc_clause: Option<MuExcClause>
},
NodeSwapStack {
id: MuID,
......@@ -640,21 +640,21 @@ pub enum NodeInst {
},
NodeGetTime {
id: MuID,
result_id: MuID,
result_id: MuID
},
NodeSetTime {
id: MuID,
tm: MuVarNode,
exc_clause: Option<MuExcClause>,
exc_clause: Option<MuExcClause>
},
NodeNewTimer {
id: MuID,
result_id: MuID,
exc_clause: Option<MuExcClause>,
exc_clause: Option<MuExcClause>
},
NodeDeleteTimer {
id: MuID,
tmr: MuVarNode,
tmr: MuVarNode
},
NodeSetTimer {
id: MuID,
......@@ -664,11 +664,11 @@ pub enum NodeInst {
fsig: MuFuncSigNode,
func: MuFuncNode,
args: Vec<MuID>,
exc_clause: Option<MuExcClause>,
exc_clause: Option<MuExcClause>
},
NodeCancelTimer {
id: MuID,
tmr: MuVarNode,
tmr: MuVarNode
},
NodeCommInst {
id: MuID,
......
This diff is collapsed.
......@@ -1855,13 +1855,19 @@ impl<'a> VM {
pub fn push_join_handle(&self, join_handle: *mut MuThread) {
self.pending_joins.lock().unwrap().push_front(join_handle);
trace!("push_join_handle-total number of handles: {}", self.pending_joins.lock().unwrap().len());
trace!(
"push_join_handle-total number of handles: {}",
self.pending_joins.lock().unwrap().len()
);
}
// pub fn push_join_handle(&self, join_handle: JoinHandle<()>) {
// self.pending_joins.lock().unwrap().push_front(join_handle);
// }
pub fn pop_join_handle(&self) -> Option<*mut MuThread> {
trace!("pop_join_handle-number of handles before pop: {}", self.pending_joins.lock().unwrap().len());
trace!(
"pop_join_handle-number of handles before pop: {}",
self.pending_joins.lock().unwrap().len()
);
self.pending_joins.lock().unwrap().pop_front()
}
// pub fn pop_join_handle(&self) -> Option<JoinHandle<()>> {
......
============================= test session starts ==============================
platform linux2 -- Python 2.7.15rc1, pytest-2.9.2, py-1.4.29, pluggy-0.3.1 -- /usr/bin/python2
cachedir: .cache
rootdir: /home/javadamiri/myFiles/Src/mu-impl-fast/tests/test_jit, inifile:
collecting ... collected 30 items
test_rpython.py::test_throw <- util.py PASSED
test_rpython.py::test_find_min <- util.py PASSED
test_rpython.py::test_exception_stack_unwind <- util.py PASSED
test_rpython.py::test_partition_in_quicksort <- util.py PASSED
test_rpython.py::test_dtoa <- util.py PASSED
test_rpython.py::test_rpytarget_print_argv <- util.py PASSED
test_rpython.py::test_rpytarget_richards_measure_time <- util.py PASSED
test_rpython.py::test_float <- util.py PASSED
test_rpython.py::test_add <- util.py PASSED
test_rpython.py::test_linkedlist_reversal <- util.py PASSED
test_rpython.py::test_quicksort <- util.py PASSED
test_rpython.py::test_open_file_as_stream <- util.py PASSED
test_rpython.py::test_rpython_main <- util.py PASSED
test_rpython.py::test_nbody <- util.py PASSED
test_rpython.py::test_rpython_time_diff <- util.py PASSED
test_rpython.py::test_new_cmpeq <- util.py PASSED
test_rpython.py::test_rpython_print_number <- util.py PASSED
test_rpython.py::test_rpytarget_richards0 <- util.py PASSED
test_rpython.py::test_rpytarget_sha1sum <- util.py PASSED
test_rpython.py::test_new <- util.py PASSED
test_rpython.py::test_vec3prod <- util.py PASSED
test_rpython.py::test_make_boot_image_simple <- util.py PASSED
test_rpython.py::test_threadtran_fib <- util.py PASSED
test_rpython.py::test_rpython_rethrow <- util.py PASSED
test_rpython.py::test_rpython_helloworld <- util.py PASSED
test_rpython.py::test_arraysum <- util.py PASSED
test_rpython.py::test_rpython_print_time <- util.py PASSED
test_rpython.py::test_rpytarget_testdicts <- util.py PASSED
test_rpython.py::test_rpython_print_fmt <- util.py PASSED
test_rpython.py::test_linked_list <- util.py PASSED
========================= 30 passed in 190.17 seconds ==========================
This diff is collapsed.
......@@ -256,11 +256,42 @@ logger = AnsiLogger('rt_rpython_tests')
#
# assert False
# @may_spawn_proc
# def test_simple_timer():
# from rpython.dev.dev_timer import test_simple_timer
# logger.info('going to build the test function')
# exec_path = executable_from_rpy_func(test_simple_timer, [], rffi.SIGNED)
#
# logger.info('going to run the test function')
#
# # import subprocess
# # subprocess.call([fn()])
# # subprocess.check_output([fn()])
#
# import subprocess
# import os
#
# start = time.time()
#
# res = subprocess.call(
# 'sudo LD_LIBRARY_PATH=$PWD/emit:$LD_LIBRARY_PATH MU_LOG_LEVEL=debug %s' % exec_path, shell=True)
#
# end = time.time()
#
# logger.info("Test took: ")
# logger.info(end-start)
#
# logger.info('returned res = %d' % res)
#
# # assert False
# assert 0 <= res <= 50
@may_spawn_proc
def test_simple_timer():
from rpython.dev.dev_timer import test_simple_timer
def test_collision_detection():
from rpython.dev.dev_CD import dev_cd
logger.info('going to build the test function')
exec_path = executable_from_rpy_func(test_simple_timer, [], rffi.SIGNED)
exec_path = executable_from_rpy_func(dev_cd.main_region, [], rffi.SIGNED)
logger.info('going to run the test function')
......@@ -274,7 +305,7 @@ def test_simple_timer():
start = time.time()
res = subprocess.call(
'sudo LD_LIBRARY_PATH=$PWD/emit:$LD_LIBRARY_PATH MU_LOG_LEVEL=debug %s' % exec_path, shell=True)
'sudo LD_LIBRARY_PATH=$PWD/emit:$LD_LIBRARY_PATH MU_LOG_LEVEL=trace %s' % exec_path, shell=True)
end = time.time()
......@@ -283,5 +314,6 @@ def test_simple_timer():
logger.info('returned res = %d' % res)
# assert False
assert 0 <= res <= 50
assert False
# assert 0 <= res <= 50
......@@ -165,7 +165,7 @@ fn ralloc_untraced() -> VM {
typedef!((vm) int64 = mu_int(64));
typedef!((vm) array_int64_100 = mu_array(int64, 10));
typedef!((vm) array_i100_ptr = mu_uptr(array_int64_100));
typedef!((vm) array_i100_ptr = mu_ref(array_int64_100));
typedef!((vm) regionref_t = mu_regionref);
funcsig!((vm) sig = (int64) -> (array_i100_ptr));
......@@ -239,7 +239,7 @@ fn ralloc_hybrid_untraced() -> VM {
typedef! ((vm) int64 = mu_int(64));
typedef! ((vm) hybrid_int64 = mu_hybrid(int64, int64)(int64));
typedef! ((vm) hybrid_int64_ptr = mu_uptr(hybrid_int64));
typedef! ((vm) hybrid_int64_ptr = mu_ref(hybrid_int64));
typedef! ((vm) regionref_t = mu_regionref);
constdef! ((vm) <int64> reg_size = Constant::Int(80));
......@@ -317,7 +317,7 @@ fn ralloc_traced_array() -> VM {
typedef!((vm) int64 = mu_int(64));
typedef!((vm) i64_iref = mu_iref(int64));
typedef!((vm) array_iref_100 = mu_array(i64_iref, 10));
typedef!((vm) array_i100_ptr = mu_uptr(array_iref_100));
typedef!((vm) array_i100_ptr = mu_ref(array_iref_100));
typedef!((vm) regionref_t = mu_regionref);
funcsig!((vm) sig = (int64) -> (array_i100_ptr));
......@@ -392,7 +392,7 @@ fn ralloc_traced_nested_struct() -> VM {
typedef!((vm) i64_iref = mu_iref(int64));
typedef!((vm) inner_struct = mu_struct(int64, i64_iref, int64));
typedef!((vm) outer_struct = mu_struct(int64, inner_struct, int64, i64_iref));
typedef!((vm) outer_struct_ptr = mu_uptr(outer_struct));
typedef!((vm) outer_struct_ptr = mu_ref(outer_struct));
typedef!((vm) regionref_t = mu_regionref);
funcsig!((vm) sig = (int64) -> (outer_struct_ptr));
......@@ -469,7 +469,7 @@ fn ralloc_hybrid_fix_traced() -> VM {
typedef! ((vm) int64 = mu_int(64));
typedef! ((vm) i64_iref = mu_iref(int64));
typedef! ((vm) hybrid_int64 = mu_hybrid(int64, i64_iref)(int64));
typedef! ((vm) hybrid_int64_ptr = mu_uptr(hybrid_int64));
typedef! ((vm) hybrid_int64_ptr = mu_ref(hybrid_int64));
typedef! ((vm) regionref_t = mu_regionref);
constdef! ((vm) <int64> reg_size = Constant::Int(80));
......@@ -541,7 +541,7 @@ fn ralloc_hybrid_var_traced() -> VM {
typedef! ((vm) int64 = mu_int(64));
typedef! ((vm) i64_iref = mu_iref(int64));
typedef! ((vm) hybrid_int64 = mu_hybrid(int64, int64)(i64_iref));
typedef! ((vm) hybrid_int64_ptr = mu_uptr(hybrid_int64));
typedef! ((vm) hybrid_int64_ptr = mu_ref(hybrid_int64));
typedef! ((vm) regionref_t = mu_regionref);
constdef! ((vm) <int64> reg_size = Constant::Int(80));
......@@ -617,7 +617,7 @@ fn e_alloc_untraced() -> VM {
typedef!((vm) int64 = mu_int(64));
typedef!((vm) array_i64_100 = mu_array(int64, 10));
typedef!((vm) array_i100_ptr = mu_uptr(array_i64_100));
typedef!((vm) array_i100_ptr = mu_ref(array_i64_100));
funcsig!((vm) sig = () -> (array_i100_ptr));
funcdecl!((vm) <sig> func);
......@@ -670,7 +670,7 @@ fn ealloc_hybrid_untraced() -> VM {
typedef! ((vm) int64 = mu_int(64));
typedef! ((vm) hybrid_int64 = mu_hybrid(int64, int64)(int64));
typedef! ((vm) hybrid_int64_ptr = mu_uptr(hybrid_int64));
typedef! ((vm) hybrid_int64_ptr = mu_ref(hybrid_int64));
funcsig! ((vm) sig = (int64) -> (hybrid_int64_ptr));
funcdecl! ((vm) <sig> func);
......@@ -731,7 +731,7 @@ fn e_delete_untraced() -> VM {
typedef!((vm) int64 = mu_int(64));
typedef!((vm) array_i64_100 = mu_array(int64, 10));
typedef!((vm) array_i100_ptr = mu_uptr(array_i64_100));
typedef!((vm) array_i100_ptr = mu_ref(array_i64_100));
funcsig!((vm) sig = () -> ());
funcdecl!((vm) <sig> func);
......@@ -788,7 +788,7 @@ fn e_alloc_traced() -> VM {
typedef!((vm) int64 = mu_int(64));
typedef!((vm) i64_iref = mu_iref(int64));
typedef!((vm) array_iref_100 = mu_array(i64_iref, 10));
typedef!((vm) array_i100_ptr = mu_uptr(array_iref_100));
typedef!((vm) array_i100_ptr = mu_ref(array_iref_100));
funcsig!((vm) sig = () -> (array_i100_ptr));
funcdecl!((vm) <sig> func);
......@@ -844,7 +844,7 @@ fn ealloc_hybrid_fixed_traced() -> VM {
typedef! ((vm) int64 = mu_int(64));
typedef! ((vm) i64_iref = mu_iref(int64));
typedef! ((vm) hybrid_int64 = mu_hybrid(int64, i64_iref)(int64));
typedef! ((vm) hybrid_int64_ptr = mu_uptr(hybrid_int64));
typedef! ((vm) hybrid_int64_ptr = mu_ref(hybrid_int64));
funcsig! ((vm) sig = (int64) -> (hybrid_int64_ptr));
funcdecl! ((vm) <sig> func);
......@@ -901,7 +901,7 @@ fn ealloc_hybrid_var_traced() -> VM {
typedef! ((vm) int64 = mu_int(64));
typedef! ((vm) i64_iref = mu_iref(int64));
typedef! ((vm) hybrid_int64 = mu_hybrid(i64_iref, int64)(i64_iref));
typedef! ((vm) hybrid_int64_ptr = mu_uptr(hybrid_int64));
typedef! ((vm) hybrid_int64_ptr = mu_ref(hybrid_int64));
funcsig! ((vm) sig = (int64) -> (hybrid_int64_ptr));
funcdecl! ((vm) <sig> func);
......@@ -963,7 +963,7 @@ fn e_delete_traced() -> VM {
typedef!((vm) int64 = mu_int(64));
typedef!((vm) i64_iref = mu_iref(int64));
typedef!((vm) array_iref_100 = mu_array(i64_iref, 10));
typedef!((vm) array_i100_ptr = mu_uptr(array_iref_100));
typedef!((vm) array_i100_ptr = mu_ref(array_iref_100));
funcsig!((vm) sig = () -> ());
funcdecl!((vm) <sig> func);
......@@ -1021,7 +1021,7 @@ fn edelete_hybrid_traced() -> VM {
typedef! ((vm) int64 = mu_int(64));
typedef! ((vm) i64_iref = mu_iref(int64));
typedef! ((vm) hybrid_int64 = mu_hybrid(i64_iref, int64)(i64_iref));
typedef! ((vm) hybrid_int64_ptr = mu_uptr(hybrid_int64));
typedef! ((vm) hybrid_int64_ptr = mu_ref(hybrid_int64));
funcsig! ((vm) sig = (int64) -> ());
funcdecl! ((vm) <sig> func);
......