Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ty::layout for ABI computation instead of LLVM types. #40658

Merged
merged 4 commits into from Apr 9, 2017

Conversation

Projects
None yet
7 participants
@eddyb
Copy link
Member

eddyb commented Mar 19, 2017

This is the first step in creating a backend-agnostic library for computing call ABI details from signatures.
I wanted to open the PR before attempting to move cabi_* from trans to avoid rebase churn in #39999.
EDIT: As I suspected, #39999 needs this PR to fully work (see #39999 (comment)).

The first 3 commits add more APIs to ty::layout and replace non-ABI uses of sizing_type_of.
These APIs are probably usable by other backends, and miri too (cc @stoklund @solson).

The last commit rewrites rustc_trans::cabi_* to use ty::layout and new rustc_trans::abi APIs.
Also, during the process, a couple trivial bugs were identified and fixed:

  • msp430, nvptx, nvptx64: type sizes in bytes were compared with 32 and 64
  • x86 (fastcall): f64 was incorrectly not treated the same way as f32

Although not urgent, this PR also uses the more general "homogenous aggregate" logic to fix #32045.

@rust-highfive

This comment has been minimized.

Copy link
Collaborator

rust-highfive commented Mar 19, 2017

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

@eddyb

This comment has been minimized.

Copy link
Member Author

eddyb commented Mar 19, 2017

@eddyb eddyb force-pushed the eddyb:lay-more-out branch 2 times, most recently from f55fb66 to c91c10a Mar 20, 2017

@nagisa
Copy link
Contributor

nagisa left a comment

Some nits gathered over the day.

@@ -1087,25 +1089,33 @@ impl<'a, 'gcx, 'tcx> Layout {
// Arrays and slices.
ty::TyArray(element, count) => {
let element = element.layout(infcx)?;
let element_size = element.size(dl);
let count = count as u64;

This comment has been minimized.

@nagisa

nagisa Mar 20, 2017

Contributor

The cast is not necessary and is possibly dangerous (e.g. after a type in the declaration changes)

This comment has been minimized.

@eddyb

eddyb Mar 20, 2017

Author Member

It's currently usize (even if it shouldn't be).

This comment has been minimized.

@nikomatsakis

nikomatsakis Mar 23, 2017

Contributor

if we care, maybe make fn usize_to_u64(x: usize) and then do usize_to_u64(count)?

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

or (count: usize) as u64.

This comment has been minimized.

@eddyb

eddyb Mar 24, 2017

Author Member

LOL. I'll add a whole variable dealing with this fact and a comment on it.

i: usize,
variant_index: Option<usize>)
-> Size {
match *self {

This comment has been minimized.

@nagisa

nagisa Mar 20, 2017

Contributor

debug_assert i==0, perhaps?


ty::TyTuple(tys, _) => tys[i],

// SIMD vector types.

This comment has been minimized.

@nagisa

nagisa Mar 20, 2017

Contributor

Assumes that all fields of a some vector must be the same (true for LLVM but not true for some architectures/proposals such as for RISC-V)

Not a big issue (also we discussed this on IRC already)

This comment has been minimized.

@eddyb

eddyb Mar 20, 2017

Author Member

Oh, just to be super clear: ty::layout already assumes uniform vectors.
We'd have to overhaul it a bit when that assumption breaks down anyway.

}
}
// Currently supported vector size (AVX).
const LARGEST_VECTOR_SIZE: usize = 256;

This comment has been minimized.

@nagisa

nagisa Mar 20, 2017

Contributor

AVX-512 has 512 bits. (Also discussed on IRC)

This comment has been minimized.

@eddyb

eddyb Mar 20, 2017

Author Member

Right, I meant AVX. AVX512 is different from AVX like SSE3 is different from SSE.

This comment has been minimized.

@eddyb

eddyb Mar 20, 2017

Author Member

Also cc @BurntSushi on what stance we should have in terms of ABI compat.

Scalar { .. } |
CEnum { .. } |
UntaggedUnion { .. } |
RawNullablePointer { .. } => {

This comment has been minimized.

@eddyb

eddyb Mar 20, 2017

Author Member

debug_assert i==0, perhaps?

You mean here? I might just take this out, except for UntaggedUnion. It was meant for something I abandoned.

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 20, 2017

☔️ The latest upstream changes (presumably #39628) made this pull request unmergeable. Please resolve the merge conflicts.

@eddyb eddyb force-pushed the eddyb:lay-more-out branch 2 times, most recently from b3001b2 to 6ac00de Mar 21, 2017

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Mar 23, 2017

@@ -1087,25 +1089,33 @@ impl<'a, 'gcx, 'tcx> Layout {
// Arrays and slices.
ty::TyArray(element, count) => {
let element = element.layout(infcx)?;
let element_size = element.size(dl);
let count = count as u64;

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

or (count: usize) as u64.

pub fn size_of(&self, ty: Ty<'tcx>) -> machine::llsize {
let layout = self.layout_of(ty);
layout.size(&self.tcx().data_layout).bytes() as machine::llsize
}
}

fn llvm_type_name<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, ty: Ty<'tcx>) -> String {

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

Nice catch!

@@ -202,6 +202,16 @@ impl TargetDataLayout {
}
}

pub trait HasDataLayout: Copy {

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

Generic bloat? Not sure this is worth worrying about.

}
}

pub trait LayoutTyper<'tcx>: HasTyCtxt<'tcx> {

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

This looks like a rather heavy abstraction - it is only used for .field, which is only called from trans::abi, which already defines LayoutExt. I'll move Layout::field to LayoutExt and remove this trait.

This comment has been minimized.

@eddyb

eddyb Mar 24, 2017

Author Member

The abstraction exists so we can pull out the ABI computation into a separate crate, so the heaviness is intentional.

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

I'm fine with this if this is temporary code.

pub fn of(infcx: &InferCtxt<'a, 'gcx, 'tcx>, ty: Ty<'gcx>)
-> Result<Self, LayoutError<'gcx>> {
let ty = normalize_associated_type(infcx, ty);
pub trait HasTyCtxt<'tcx>: HasDataLayout {

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

If you are defining this trait, maybe move it to ty::fold and make TypeFolder a subtrait? Can you add a blanket impl<T: HasTyCtxt> HasDataLayout for T? Is there any place that needs data layout but does not have a tcx (aka do we need HasDataLayout)?

This comment has been minimized.

@eddyb

eddyb Mar 24, 2017

Author Member

I tried that and it required weird inexpressible region bounds to work, sadly.

@@ -133,32 +134,279 @@ impl ArgAttributes {
}
}

pub trait CastTarget {

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

Any reason this is a trait rather than an enum (Reg | RegPair | Uniform)? That would make moving away from LLVM easier.

This comment has been minimized.

@eddyb

eddyb Mar 24, 2017

Author Member

I wanted to make sure it works first, and the trait allows replacing with an enum later, but maybe I should do it now.

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

ok

@arielb1
Copy link
Contributor

arielb1 left a comment

Looks excellent. I should look at this last commit more but I have to go.


// ADTs.
ty::TyAdt(def, _) => {
let v = if def.is_enum() {

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

I'll say "what about univariant enums" but you appear to have fixed this in the next commit.

This comment has been minimized.

@eddyb

eddyb Mar 24, 2017

Author Member

I'll move it back (rebasing was painful when fixing that but now it should be fine.

ty::TyNever |
ty::TyFnDef(..) |
ty::TyDynamic(..) => {
ty::TyFnPtr(_) => {
bug!("TyLayout::field_type({:?}): not applicable", self)

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

bug and comment are wrong - function is called field_count, and TyDynamic is not a ZST. OTOH, non-ADT/arrays have 0 fields, so presumably you should always return 0 for them (+TyStr).

This comment has been minimized.

@eddyb

eddyb Mar 24, 2017

Author Member

It mostly has to match the Layout variant (maybe I should match on that instead).

}
}
RegKind::Vector => {
// Try to pick an integer at least twice as small.

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

What's the motivation for this? AFAICT this seems to be used only for SSE/AVX on amd64 SysV, so the if statement can never be hit. If LLVM really does not care about the type of the vector elements as long as it has the right length, why not use [u8; N] everywhere? Or [u64; N] because all SIMD is a multiple of 64 bits.

This comment has been minimized.

@eddyb

eddyb Mar 24, 2017

Author Member

I'll switch to <n x i8>, it's the cleanest simple solution.

use rustc::ty::layout::{self, Layout, TyLayout, Size};

#[derive(Clone, Copy, PartialEq, Debug)]
enum Class {

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

Nice to see we can reduce this.

SSEDv,
SSEInt(/* bitwidth */ u64),
LoneF32,
Sse,

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

Might be worth commenting that this also includes AVX (yes I know the spec calls this Sse).

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

Also, LoneF32 is also an Sse in the spec - the only difference is that we want to tell LLVM that only the lowest 32 bits matter. I'll make it a field of the enum.

This comment has been minimized.

@eddyb

eddyb Mar 25, 2017

Author Member

There's a more elegant way to handle this (last Sse with only 4 bytes of data left, only way to get LoneF32 anyway, unless you have weird padding). I'll try to implement it.
Also, clang does somewhat complex type recovery - I don't think we care, as this is for FFI.

@@ -1513,6 +1531,59 @@ impl<'a, 'gcx, 'tcx> Layout {
}
}
}

pub fn field_offset(&self,

This comment has been minimized.

@nikomatsakis

nikomatsakis Mar 24, 2017

Contributor

Seems like some comments, or better choice of names, would be good here. e.g. what is i -- the index of the field, I guess? variant_index is for structs/enums? (I'd also find the opposite order of those parameters more intuitive, but I can't say why -- I guess because the i is defined relative to variant_index)

This comment has been minimized.

@eddyb

eddyb Mar 24, 2017

Author Member

We'll hopefully eventually remove variant_index by adding variant types, so I'm not sure how much I care about it.

@nikomatsakis

This comment has been minimized.

Copy link
Contributor

nikomatsakis commented Mar 24, 2017

OK, since @arielb1 and @nagisa are already giving this a detailed look, I gave it more of a cursory overview. Seems quite nice to me, but I didn't dig into the last commit, which is obviously where most of the subtle logic resides.

@arielb1
Copy link
Contributor

arielb1 left a comment

Most changes should be fixed in a separate PR, but I don't like the "pirate" pair of floats feature in this PR.

}
}

pub trait LayoutTyper<'tcx>: HasTyCtxt<'tcx> {

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

I'm fine with this if this is temporary code.

self.layout.field_offset(cx, i, self.variant_index)
}

pub fn field_count<C: HasTyCtxt<'tcx>>(&self, cx: C) -> usize {

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

Can you match on the layout instead?

@@ -133,32 +134,279 @@ impl ArgAttributes {
}
}

pub trait CastTarget {

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

ok

return;
}

// Pairs of floats.

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

This is not present in the original code. Random micro-optimization?

This comment has been minimized.

@eddyb

eddyb Mar 25, 2017

Author Member

Oh I meant to find that issue and mention it in the description. This is a long-wanted feature and now it's easy to implement so I just did it when I rewrote that code.

let fields = variant.field_index_by_increasing_offset().map(|i| fields[i as usize]);
if sizing {
fields.filter(|ty| !dst || cx.shared().type_is_sized(*ty))
.map(|ty| type_of::sizing_type_of(cx, ty)).collect()
bug!()

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

nit: remove the sizing and dst parameters? They don't seem to be used anywhere.

This comment has been minimized.

@eddyb

eddyb Mar 25, 2017

Author Member

Have to keep to allow #39999 to rebase.

let size = ret.layout.size(ccx);
let bits = size.bits();
if bits <= 128 {
let unit = if bits <= 8 {

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

can't this logic be lifted to abi? It appears to be used in several places, including the Rust ABI.

SSEDv,
SSEInt(/* bitwidth */ u64),
LoneF32,
Sse,

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

Also, LoneF32 is also an Sse in the spec - the only difference is that we want to tell LLVM that only the lowest 32 bits matter. I'll make it a field of the enum.


#[derive(Clone, Copy, PartialEq, Debug)]
enum Class {
None,

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

This is called NoClass in the spec. Why not stick to it?

This comment has been minimized.

@eddyb

eddyb Mar 25, 2017

Author Member

Because Class::NoClass is unidiomatic.

@@ -121,13 +121,13 @@ pub fn unsafe_slice(_: &[UnsafeInner]) {
fn str(_: &[u8]) {
}

// CHECK: @trait_borrow(i8* nonnull, void (i8*)** noalias nonnull readonly)
// CHECK: @trait_borrow({}* nonnull, {}* noalias nonnull readonly)

This comment has been minimized.

@arielb1

arielb1 Mar 24, 2017

Contributor

Are LLVM's problems with unit pointers gone?

This comment has been minimized.

@eddyb

eddyb Mar 25, 2017

Author Member

Those problems were only around C FFI were LLVM was looking for a specific signature, IIRC.
i.e. Not unit pointers were the problem but any pointer thst wasn't i8*.

@arielb1

This comment has been minimized.

Copy link
Contributor

arielb1 commented Mar 25, 2017

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 25, 2017

📌 Commit 6ac00de has been approved by arielb1

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 25, 2017

⌛️ Testing commit 6ac00de with merge 0b20dbd...

bors added a commit that referenced this pull request Mar 25, 2017

Auto merge of #40658 - eddyb:lay-more-out, r=arielb1
Use ty::layout for ABI computation instead of LLVM types.

This is the first step in creating a backend-agnostic library for computing call ABI details from signatures.
I wanted to open the PR *before* attempting to move `cabi_*` from trans to avoid rebase churn in #39999.
**EDIT**: As I suspected, #39999 needs this PR to fully work (see #39999 (comment)).

The first 3 commits add more APIs to `ty::layout` and replace non-ABI uses of `sizing_type_of`.
These APIs are probably usable by other backends, and miri too (cc @stoklund @solson).

The last commit rewrites `rustc_trans::cabi_*` to use `ty::layout` and new `rustc_trans::abi` APIs.
Also, during the process, a couple trivial bugs were identified and fixed:
* `msp430`, `nvptx`, `nvptx64`: type sizes *in bytes* were compared with `32` and `64`
* `x86` (`fastcall`): `f64` was incorrectly not treated the same way as `f32`
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 25, 2017

💔 Test failed - status-travis

@arielb1

This comment has been minimized.

Copy link
Contributor

arielb1 commented Mar 25, 2017

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 25, 2017

⌛️ Testing commit 6ac00de with merge 5f08d8d...

bors added a commit that referenced this pull request Mar 25, 2017

Auto merge of #40658 - eddyb:lay-more-out, r=arielb1
Use ty::layout for ABI computation instead of LLVM types.

This is the first step in creating a backend-agnostic library for computing call ABI details from signatures.
I wanted to open the PR *before* attempting to move `cabi_*` from trans to avoid rebase churn in #39999.
**EDIT**: As I suspected, #39999 needs this PR to fully work (see #39999 (comment)).

The first 3 commits add more APIs to `ty::layout` and replace non-ABI uses of `sizing_type_of`.
These APIs are probably usable by other backends, and miri too (cc @stoklund @solson).

The last commit rewrites `rustc_trans::cabi_*` to use `ty::layout` and new `rustc_trans::abi` APIs.
Also, during the process, a couple trivial bugs were identified and fixed:
* `msp430`, `nvptx`, `nvptx64`: type sizes *in bytes* were compared with `32` and `64`
* `x86` (`fastcall`): `f64` was incorrectly not treated the same way as `f32`
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Mar 25, 2017

💔 Test failed - status-travis

@eddyb

This comment has been minimized.

Copy link
Member Author

eddyb commented Apr 8, 2017

@bors r=arielb1

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 8, 2017

📌 Commit 1759358 has been approved by arielb1

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 8, 2017

⌛️ Testing commit 1759358 with merge fbe44d3...

bors added a commit that referenced this pull request Apr 8, 2017

Auto merge of #40658 - eddyb:lay-more-out, r=arielb1
Use ty::layout for ABI computation instead of LLVM types.

This is the first step in creating a backend-agnostic library for computing call ABI details from signatures.
I wanted to open the PR *before* attempting to move `cabi_*` from trans to avoid rebase churn in #39999.
**EDIT**: As I suspected, #39999 needs this PR to fully work (see #39999 (comment)).

The first 3 commits add more APIs to `ty::layout` and replace non-ABI uses of `sizing_type_of`.
These APIs are probably usable by other backends, and miri too (cc @stoklund @solson).

The last commit rewrites `rustc_trans::cabi_*` to use `ty::layout` and new `rustc_trans::abi` APIs.
Also, during the process, a couple trivial bugs were identified and fixed:
* `msp430`, `nvptx`, `nvptx64`: type sizes *in bytes* were compared with `32` and `64`
* `x86` (`fastcall`): `f64` was incorrectly not treated the same way as `f32`

Although not urgent, this PR also uses the more general "homogenous aggregate" logic to fix #32045.
@eddyb

This comment has been minimized.

Copy link
Member Author

eddyb commented Apr 8, 2017

@bors r- retry

@eddyb eddyb force-pushed the eddyb:lay-more-out branch from 1759358 to a8dd65a Apr 8, 2017

@eddyb

This comment has been minimized.

Copy link
Member Author

eddyb commented Apr 8, 2017

@bors r=arielb1

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 8, 2017

📌 Commit a8dd65a has been approved by arielb1

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 9, 2017

⌛️ Testing commit a8dd65a with merge c5404c5...

bors added a commit that referenced this pull request Apr 9, 2017

Auto merge of #40658 - eddyb:lay-more-out, r=arielb1
Use ty::layout for ABI computation instead of LLVM types.

This is the first step in creating a backend-agnostic library for computing call ABI details from signatures.
I wanted to open the PR *before* attempting to move `cabi_*` from trans to avoid rebase churn in #39999.
**EDIT**: As I suspected, #39999 needs this PR to fully work (see #39999 (comment)).

The first 3 commits add more APIs to `ty::layout` and replace non-ABI uses of `sizing_type_of`.
These APIs are probably usable by other backends, and miri too (cc @stoklund @solson).

The last commit rewrites `rustc_trans::cabi_*` to use `ty::layout` and new `rustc_trans::abi` APIs.
Also, during the process, a couple trivial bugs were identified and fixed:
* `msp430`, `nvptx`, `nvptx64`: type sizes *in bytes* were compared with `32` and `64`
* `x86` (`fastcall`): `f64` was incorrectly not treated the same way as `f32`

Although not urgent, this PR also uses the more general "homogenous aggregate" logic to fix #32045.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 9, 2017

💔 Test failed - status-travis

@eddyb

This comment has been minimized.

Copy link
Member Author

eddyb commented Apr 9, 2017

@bors retry

  • unrelated (AFAICT) emscripten failure ("The end of the file was unexpectedly encountered")
@nagisa

This comment has been minimized.

Copy link
Contributor

nagisa commented Apr 9, 2017

This is the log of the error (there are multiple like these:

[00:52:59] error: linking with `emcc` failed: exit code: 1
[00:52:59]   |
[00:52:59]   = note: "emcc" "-s" "DISABLE_EXCEPTION_CATCHING=0" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-fail/test-should-panic-no-message.0.o" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-fail/test-should-panic-no-message.stage2-asmjs-unknown-emscripten.js" "-s" "EXPORTED_FUNCTIONS=[\"_main\",\"_rust_eh_personality\"]" "-O2" "--memory-init-file" "0" "-g0" "-s" "DEFAULT_LIBRARY_FUNCS_TO_INCLUDE=[]" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-fail" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/run-fail/test-should-panic-no-message.stage2-asmjs-unknown-emscripten.run-fail.libaux" "-L" "/checkout/obj/build/asmjs-unknown-emscripten/native/rust-test-helpers" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libtest-6c35a477e7bec8d3.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libterm-fa872424129019f5.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libgetopts-a80f7c589731de53.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libstd-f4594d3e53dcb114.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libpanic_unwind-a0157c0ca919c364.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libunwind-488b4ab4bd53a138.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/librand-1efbcfd8938372b6.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libcollections-532a3dbf317eff86.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/liballoc-ca07b617414dd0fa.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libstd_unicode-cfbd6648f7db2ee5.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/liballoc_system-68e33a366943aef4.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/liblibc-88c194c15fdb6521.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libcore-687e6a964d22cbb4.rlib" "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libcompiler_builtins-987729be881d4d32.rlib" "-l" "c" "-s" "ERROR_ON_UNDEFINED_SYMBOLS=1"
[00:52:59]   = note: /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libtest-6c35a477e7bec8d3.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libterm-fa872424129019f5.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libgetopts-a80f7c589731de53.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libstd-f4594d3e53dcb114.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libpanic_unwind-a0157c0ca919c364.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libunwind-488b4ab4bd53a138.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/librand-1efbcfd8938372b6.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libcollections-532a3dbf317eff86.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/liballoc-ca07b617414dd0fa.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libstd_unicode-cfbd6648f7db2ee5.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/liballoc_system-68e33a366943aef4.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/liblibc-88c194c15fdb6521.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libcore-687e6a964d22cbb4.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           /tmp/emsdk_portable/clang/tag-e1.37.1/build_tag-e1.37.1_32/bin/llvm-nm: /checkout/obj/build/x86_64-unknown-linux-gnu/stage2/lib/rustlib/asmjs-unknown-emscripten/lib/libcompiler_builtins-987729be881d4d32.rlib(rust.metadata.bin) The end of the file was unexpectedly encountered
[00:52:59]           
[00:52:59]           Value:   %.fca.1.insert109.i361.i = phi [2 x double] [ %.fca.1.insert109.i.i, %bb21.i.thread.i ], [ %.fca.1.insert109.i353.i, %bb3.i33.i.preheader.i ]
[00:52:59]           LLVM ERROR: Unrecognized struct value
[00:52:59]           Traceback (most recent call last):
[00:52:59]             File "/tmp/emsdk_portable/emscripten/tag-1.37.1/emcc", line 13, in <module>
[00:52:59]               emcc.run()
[00:52:59]             File "/tmp/emsdk_portable/emscripten/tag-1.37.1/emcc.py", line 1635, in run
[00:52:59]               final = shared.Building.emscripten(final, append_ext=False, extra_args=extra_args)
[00:52:59]             File "/tmp/emsdk_portable/emscripten/tag-1.37.1/tools/shared.py", line 1745, in emscripten
[00:52:59]               call_emscripten(cmdline)
[00:52:59]             File "/tmp/emsdk_portable/emscripten/tag-1.37.1/emscripten.py", line 1783, in _main
[00:52:59]               temp_files.run_and_clean(lambda: main(
[00:52:59]             File "/tmp/emsdk_portable/emscripten/tag-1.37.1/tools/tempfiles.py", line 78, in run_and_clean
[00:52:59]               return func()
[00:52:59]             File "/tmp/emsdk_portable/emscripten/tag-1.37.1/emscripten.py", line 1788, in <lambda>
[00:52:59]               DEBUG=DEBUG,
[00:52:59]             File "/tmp/emsdk_portable/emscripten/tag-1.37.1/emscripten.py", line 1689, in main
[00:52:59]               temp_files=temp_files, DEBUG=DEBUG)
[00:52:59]             File "/tmp/emsdk_portable/emscripten/tag-1.37.1/emscripten.py", line 91, in emscript
[00:52:59]               funcs, metadata, mem_init = get_and_parse_backend(infile, settings, temp_files, DEBUG)
[00:52:59]             File "/tmp/emsdk_portable/emscripten/tag-1.37.1/emscripten.py", line 157, in get_and_parse_backend
[00:52:59]               backend_output = open(temp_js).read()
[00:52:59]           IOError: [Errno 2] No such file or directory: '/tmp/tmpswNHZh.4.js'
[00:52:59]           
[00:52:59] 
[00:52:59] error: aborting due to previous error
[00:52:59] 
[00:52:59] 
[00:52:59] ------------------------------------------
[00:52:59] 
[00:52:59] thread '[run-fail] run-fail/test-should-panic-no-message.rs' panicked at 'explicit panic', /checkout/src/tools/compiletest/src/runtest.rs:2621

This is not related to the out-of-disk-space errors. There’s still plenty left.

cc @alexcrichton this one is new.

@eddyb

This comment has been minimized.

Copy link
Member Author

eddyb commented Apr 9, 2017

@bors r- Aaaaah there's an LLVM error in there, thanks!

@eddyb

This comment has been minimized.

Copy link
Member Author

eddyb commented Apr 9, 2017

This appears to be an emscripten bug, which I've filed as emscripten-core/emscripten-fastcomp#178.
I'll try to work around it by not using Uniform in the Rust ABI and I'll leave a FIXME in.

@eddyb eddyb force-pushed the eddyb:lay-more-out branch from a8dd65a to f0636b6 Apr 9, 2017

@eddyb

This comment has been minimized.

Copy link
Member Author

eddyb commented Apr 9, 2017

@bors r=arielb1

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 9, 2017

📌 Commit f0636b6 has been approved by arielb1

@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 9, 2017

⌛️ Testing commit f0636b6 with merge 2c48ae6...

bors added a commit that referenced this pull request Apr 9, 2017

Auto merge of #40658 - eddyb:lay-more-out, r=arielb1
Use ty::layout for ABI computation instead of LLVM types.

This is the first step in creating a backend-agnostic library for computing call ABI details from signatures.
I wanted to open the PR *before* attempting to move `cabi_*` from trans to avoid rebase churn in #39999.
**EDIT**: As I suspected, #39999 needs this PR to fully work (see #39999 (comment)).

The first 3 commits add more APIs to `ty::layout` and replace non-ABI uses of `sizing_type_of`.
These APIs are probably usable by other backends, and miri too (cc @stoklund @solson).

The last commit rewrites `rustc_trans::cabi_*` to use `ty::layout` and new `rustc_trans::abi` APIs.
Also, during the process, a couple trivial bugs were identified and fixed:
* `msp430`, `nvptx`, `nvptx64`: type sizes *in bytes* were compared with `32` and `64`
* `x86` (`fastcall`): `f64` was incorrectly not treated the same way as `f32`

Although not urgent, this PR also uses the more general "homogenous aggregate" logic to fix #32045.
@bors

This comment has been minimized.

Copy link
Contributor

bors commented Apr 9, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: arielb1
Pushing 2c48ae6 to master...

@bors bors merged commit f0636b6 into rust-lang:master Apr 9, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details

@eddyb eddyb deleted the eddyb:lay-more-out branch Apr 9, 2017

bors added a commit that referenced this pull request Apr 11, 2017

Auto merge of #41206 - eddyb:avoid-illegal-vectors, r=nagisa
Fix pairs of doubles using an illegal <8 x i8> vector.

Accidentally introduced in #40658 and discovered in some Objective-C bindings (returning `NSPoint`).
Turns out LLVM will widen element types of illegal vectors instead of increasing element count, i.e. it will zero-extend `<8 x i8>` to `<8 x i16>`, interleaving the bytes, instead of using the first 8 of `<16 x i8>`.

frewsxcv added a commit to frewsxcv/rust that referenced this pull request Apr 12, 2017

Rollup merge of rust-lang#41206 - eddyb:avoid-illegal-vectors, r=nagisa
Fix pairs of doubles using an illegal <8 x i8> vector.

Accidentally introduced in rust-lang#40658 and discovered in some Objective-C bindings (returning `NSPoint`).
Turns out LLVM will widen element types of illegal vectors instead of increasing element count, i.e. it will zero-extend `<8 x i8>` to `<8 x i16>`, interleaving the bytes, instead of using the first 8 of `<16 x i8>`.

TimNN added a commit to TimNN/rust that referenced this pull request Apr 12, 2017

Rollup merge of rust-lang#41206 - eddyb:avoid-illegal-vectors, r=nagisa
Fix pairs of doubles using an illegal <8 x i8> vector.

Accidentally introduced in rust-lang#40658 and discovered in some Objective-C bindings (returning `NSPoint`).
Turns out LLVM will widen element types of illegal vectors instead of increasing element count, i.e. it will zero-extend `<8 x i8>` to `<8 x i16>`, interleaving the bytes, instead of using the first 8 of `<16 x i8>`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.