forked from M-Labs/artiq-zynq
Compare commits
No commits in common. "ndarray" and "master" have entirely different histories.
|
@ -189,9 +189,6 @@ pub fn resolve(required: &[u8]) -> Option<u32> {
|
||||||
api!(__artiq_raise = eh_artiq::raise),
|
api!(__artiq_raise = eh_artiq::raise),
|
||||||
api!(__artiq_reraise = eh_artiq::reraise),
|
api!(__artiq_reraise = eh_artiq::reraise),
|
||||||
|
|
||||||
// Implementations for LLVM math intrinsics
|
|
||||||
api!(__powidf2),
|
|
||||||
|
|
||||||
// libm
|
// libm
|
||||||
api_libm_f64f64!(acos),
|
api_libm_f64f64!(acos),
|
||||||
api_libm_f64f64!(acosh),
|
api_libm_f64f64!(acosh),
|
||||||
|
@ -204,7 +201,6 @@ pub fn resolve(required: &[u8]) -> Option<u32> {
|
||||||
}
|
}
|
||||||
api!(atan2 = atan2)
|
api!(atan2 = atan2)
|
||||||
},
|
},
|
||||||
api_libm_f64f64!(atanh),
|
|
||||||
api_libm_f64f64!(cbrt),
|
api_libm_f64f64!(cbrt),
|
||||||
api_libm_f64f64!(ceil),
|
api_libm_f64f64!(ceil),
|
||||||
api_libm_f64f64!(cos),
|
api_libm_f64f64!(cos),
|
||||||
|
|
|
@ -72,7 +72,7 @@ async unsafe fn recv_value<F>(stream: &TcpStream, tag: Tag<'async_recursion>, da
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Tag::List(it) => {
|
Tag::List(it) | Tag::Array(it) => {
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
struct List { elements: *mut (), length: u32 };
|
struct List { elements: *mut (), length: u32 };
|
||||||
consume_value!(List, |ptr| {
|
consume_value!(List, |ptr| {
|
||||||
|
@ -88,25 +88,6 @@ async unsafe fn recv_value<F>(stream: &TcpStream, tag: Tag<'async_recursion>, da
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Tag::Array(it, num_dims) => {
|
|
||||||
consume_value!(*mut (), |buffer| {
|
|
||||||
let mut total_len: u32 = 1;
|
|
||||||
for _ in 0..num_dims {
|
|
||||||
let len = proto_async::read_i32(stream).await? as u32;
|
|
||||||
total_len *= len;
|
|
||||||
consume_value!(u32, |ptr| *ptr = len )
|
|
||||||
}
|
|
||||||
|
|
||||||
let elt_tag = it.clone().next().expect("truncated tag");
|
|
||||||
*buffer = alloc(elt_tag.size() * total_len as usize).await;
|
|
||||||
|
|
||||||
let mut data = *buffer;
|
|
||||||
for _ in 0..total_len {
|
|
||||||
recv_value(stream, elt_tag, &mut data, alloc).await?
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
})
|
|
||||||
}
|
|
||||||
Tag::Range(it) => {
|
Tag::Range(it) => {
|
||||||
let tag = it.clone().next().expect("truncated tag");
|
let tag = it.clone().next().expect("truncated tag");
|
||||||
recv_value(stream, tag, data, alloc).await?;
|
recv_value(stream, tag, data, alloc).await?;
|
||||||
|
@ -173,7 +154,7 @@ unsafe fn send_value<W>(writer: &mut W, tag: Tag, data: &mut *const ())
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
Tag::List(it) => {
|
Tag::List(it) | Tag::Array(it) => {
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
struct List { elements: *const (), length: u32 };
|
struct List { elements: *const (), length: u32 };
|
||||||
consume_value!(List, |ptr| {
|
consume_value!(List, |ptr| {
|
||||||
|
@ -186,25 +167,6 @@ unsafe fn send_value<W>(writer: &mut W, tag: Tag, data: &mut *const ())
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Tag::Array(it, num_dims) => {
|
|
||||||
writer.write_u8(num_dims)?;
|
|
||||||
consume_value!(*const(), |buffer| {
|
|
||||||
let elt_tag = it.clone().next().expect("truncated tag");
|
|
||||||
|
|
||||||
let mut total_len = 1;
|
|
||||||
for _ in 0..num_dims {
|
|
||||||
consume_value!(u32, |len| {
|
|
||||||
writer.write_u32(*len)?;
|
|
||||||
total_len *= *len;
|
|
||||||
})
|
|
||||||
}
|
|
||||||
let mut data = *buffer;
|
|
||||||
for _ in 0..total_len as usize {
|
|
||||||
send_value(writer, elt_tag, &mut data)?;
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
})
|
|
||||||
}
|
|
||||||
Tag::Range(it) => {
|
Tag::Range(it) => {
|
||||||
let tag = it.clone().next().expect("truncated tag");
|
let tag = it.clone().next().expect("truncated tag");
|
||||||
send_value(writer, tag, data)?;
|
send_value(writer, tag, data)?;
|
||||||
|
@ -283,7 +245,7 @@ mod tag {
|
||||||
ByteArray,
|
ByteArray,
|
||||||
Tuple(TagIterator<'a>, u8),
|
Tuple(TagIterator<'a>, u8),
|
||||||
List(TagIterator<'a>),
|
List(TagIterator<'a>),
|
||||||
Array(TagIterator<'a>, u8),
|
Array(TagIterator<'a>),
|
||||||
Range(TagIterator<'a>),
|
Range(TagIterator<'a>),
|
||||||
Keyword(TagIterator<'a>),
|
Keyword(TagIterator<'a>),
|
||||||
Object
|
Object
|
||||||
|
@ -302,7 +264,7 @@ mod tag {
|
||||||
Tag::ByteArray => b'A',
|
Tag::ByteArray => b'A',
|
||||||
Tag::Tuple(_, _) => b't',
|
Tag::Tuple(_, _) => b't',
|
||||||
Tag::List(_) => b'l',
|
Tag::List(_) => b'l',
|
||||||
Tag::Array(_, _) => b'a',
|
Tag::Array(_) => b'a',
|
||||||
Tag::Range(_) => b'r',
|
Tag::Range(_) => b'r',
|
||||||
Tag::Keyword(_) => b'k',
|
Tag::Keyword(_) => b'k',
|
||||||
Tag::Object => b'O',
|
Tag::Object => b'O',
|
||||||
|
@ -329,7 +291,7 @@ mod tag {
|
||||||
size
|
size
|
||||||
}
|
}
|
||||||
Tag::List(_) => 8,
|
Tag::List(_) => 8,
|
||||||
Tag::Array(_, num_dims) => 4 * (1 + num_dims as usize),
|
Tag::Array(_) => 8,
|
||||||
Tag::Range(it) => {
|
Tag::Range(it) => {
|
||||||
let tag = it.clone().next().expect("truncated tag");
|
let tag = it.clone().next().expect("truncated tag");
|
||||||
tag.size() * 3
|
tag.size() * 3
|
||||||
|
@ -372,11 +334,7 @@ mod tag {
|
||||||
Tag::Tuple(self.sub(count), count)
|
Tag::Tuple(self.sub(count), count)
|
||||||
}
|
}
|
||||||
b'l' => Tag::List(self.sub(1)),
|
b'l' => Tag::List(self.sub(1)),
|
||||||
b'a' => {
|
b'a' => Tag::Array(self.sub(1)),
|
||||||
let count = self.data[0];
|
|
||||||
self.data = &self.data[1..];
|
|
||||||
Tag::Array(self.sub(1), count)
|
|
||||||
}
|
|
||||||
b'r' => Tag::Range(self.sub(1)),
|
b'r' => Tag::Range(self.sub(1)),
|
||||||
b'k' => Tag::Keyword(self.sub(1)),
|
b'k' => Tag::Keyword(self.sub(1)),
|
||||||
b'O' => Tag::Object,
|
b'O' => Tag::Object,
|
||||||
|
@ -431,10 +389,10 @@ mod tag {
|
||||||
it.fmt(f)?;
|
it.fmt(f)?;
|
||||||
write!(f, ")")?;
|
write!(f, ")")?;
|
||||||
}
|
}
|
||||||
Tag::Array(it, num_dims) => {
|
Tag::Array(it) => {
|
||||||
write!(f, "Array(")?;
|
write!(f, "Array(")?;
|
||||||
it.fmt(f)?;
|
it.fmt(f)?;
|
||||||
write!(f, ", {})", num_dims)?;
|
write!(f, ")")?;
|
||||||
}
|
}
|
||||||
Tag::Range(it) => {
|
Tag::Range(it) => {
|
||||||
write!(f, "Range(")?;
|
write!(f, "Range(")?;
|
||||||
|
|
Loading…
Reference in New Issue