Skip to content

Instantly share code, notes, and snippets.

View arielb1's full-sized avatar

Ariel Ben-Yehuda arielb1

View GitHub Profile
; ModuleID = 'example.0.rs'
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc"
%"2.std::str::Chars" = type { %"2.std::slice::Iter<u8>" }
%"2.std::slice::Iter<u8>" = type { i8*, i8*, %"2.std::marker::PhantomData<&'static u8>" }
%"2.std::marker::PhantomData<&'static u8>" = type {}
%"2.std::option::Option<char>" = type { i32, [0 x i32], [1 x i32] }
%"2.std::option::Option<u32>" = type { i32, [0 x i32], [1 x i32] }
struct Foo {
a: Box<u32>,
b: Box<u32>,
c: Box<u32>,
d: Box<u32>
}
fn star() -> u32 { 0 }
fn main() {
MIR for method clone in Foo.::std::clone::Clone::clone (id=14)
fn(arg0: &Foo) -> Foo {
let tmp0: &U;
let tmp1: &V;
let var0: U;
let var1: V;
begin: {
goto clone_0;
; ModuleID = 'spawn_example.0.rs'
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
%str_slice = type { i8*, i64 }
%"1.core::marker::PhantomData<&'static mut u8>" = type {}
%"1.core::fmt::Formatter" = type { i32, i32, i8, %"1.core::option::Option<usize>", %"1.core::option::Option<usize>", { i8*, void (i8*)** }, %"1.core::slice::Iter<core::fmt::ArgumentV1>", { %"1.core::fmt::ArgumentV1"*, i64 } }
%"1.core::option::Option<usize>" = type { i64, [0 x i64], [1 x i64] }
%"1.core::slice::Iter<core::fmt::ArgumentV1>" = type { %"1.core::fmt::ArgumentV1"*, %"1.core::fmt::ArgumentV1"*, %"1.core::marker::PhantomData<&'static core::fmt::ArgumentV1>" }
%"1.core::fmt::ArgumentV1" = type { %"1.core::fmt::Void"*, i8 (%"1.core::fmt::Void"*, %"1.core::fmt::Formatter"*)* }
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Do we have to correctly compute the determinant of matrices whose determinant contains components that don't fit in a long, like this 4x4 matrix:
M=
0000001 4999999 4999999 4999999
0000001 5000000 9999998 9999998
0000001 5000000 9999998 9999999
0000000 0000000 0000001 4999999
This matrix's determinant is -1 (this can be discovered by noticing that it is the product of the 3 matrices
+ RUSTFLAGS=-Z time-passes time make -j8 rustc-stage2
cfg: version 1.1.0-dev (a86a88c93 2015-04-30) (built 2015-04-30)
cfg: build triple x86_64-unknown-linux-gnu
cfg: host triples x86_64-unknown-linux-gnu
cfg: target triples x86_64-unknown-linux-gnu
cfg: enabling debug assertions (CFG_ENABLE_DEBUG_ASSERTIONS)
cfg: host for x86_64-unknown-linux-gnu is x86_64
cfg: os for x86_64-unknown-linux-gnu is unknown-linux-gnu
cfg: good valgrind for x86_64-unknown-linux-gnu is 1
cfg: using CC=gcc (CFG_CC)
@arielb1
arielb1 / code
Created April 21, 2015 13:27
Acyclic
pub unsafe trait Acyclic {}
// struct Rc<T: RcSafe>
// struct Arc<T: RcSafe>
// R1: structural
unsafe impl Acyclic for .. {}
// R2: no-ownership
@arielb1
arielb1 / gist:5eb299a87546ce8829b3
Last active August 29, 2015 14:19
Working Scope implementation
use std::cell::RefCell;
use std::mem;
struct Destructor<'a> {
next: Option<Box<Destructor<'a>>>,
dtor: Box<FnMut() + 'a>
}
struct Scope<'a> {
@arielb1
arielb1 / how to compile
Created November 23, 2014 16:28
Rust with only libcore
$ rustc -C no-stack-check source.rs --crate-type=staticlib # kernel also wants -C no-redzone -C code-model=kernel
$ gcc libsource.a
$ ldd ./a.out # no rust libs here
linux-vdso.so.1 => (0x00007fffb5343000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f59ef69b000)
/lib64/ld-linux-x86-64.so.2 (0x00007f59efaa4000)
$ ./a.out; echo $?
42