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

Add support for 64-bit Windows builds #16261

Merged
merged 11 commits into from Aug 6, 2014
Merged

Add support for 64-bit Windows builds #16261

merged 11 commits into from Aug 6, 2014

Conversation

vadimcn
Copy link
Contributor

@vadimcn vadimcn commented Aug 5, 2014

Finally landed all the required fixes in LLVM master!

These 4 tests currently fail in win64 build, I suspect there's some ABI conformance bug:
run-pass/extern-pass-TwoU64s.rs
run-pass/extern-pass-empty.rs
run-pass/extern-return-TwoU64s.rs
run-pass/tcp-connect-timeouts.rs

Closes #1237

_WIN32 is defined for 64-bit builds as well, so test for _WIN64 first.
This is important when building with --disable-jemalloc: unlike jemalloc,  msvcrt does not align on 16 bytes unless asked to.
The original trick used to trigger unwinds would not work with GCC's implementation of SEH, so I had to invent a new one: rust_try now consists of two routines: the outer one, whose handler triggers unwinds, and the inner one, that stops unwinds by having a landing pad that swallows exceptions and passes them on to the outer routine via a normal return.
@@ -338,7 +334,7 @@ pub mod eabi {

// ARM EHABI uses a slightly different personality routine signature,
// but otherwise works the same.
#[cfg(target_arch = "arm", not(test), not(target_os = "ios"))]
#[cfg(target_arch = "arm", not(target_os = "ios", not(test)))]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does nested not work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think so. It's a typo. :(

@klutzy
Copy link
Contributor

klutzy commented Aug 5, 2014

\o/ yay!!

#[inline(always)]
pub unsafe fn record_stack_bounds(stack_lo: uint, _stack_hi: uint) {
record_sp_limit(stack_lo + RED_ZONE);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this introduced?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to allow setting morestack stack limit from libnative without touching Windows's stack bounds TIB fields (gs:0x08 and gs:0x10). Since libnative relies on os-managed stacks, it should not mess with these. Currently it doesn't even do it correctly, because gs:0x10 is supposed to be the commit limit, not the reserve limit, as @klutzy had explained here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If that's the case, this function needs to have some comments to justify its existence and explain what it's doing. Also, if the other function is wrong, why not just delete it? Surely it must be doing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The original function is still needed for libgreen, because it creates stacks from scratch.
I know, having two of them is not optimal, but couldn't think of anything better. I am open to suggestions...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about this, could you just update libnative to call record_stack_limit as opposed to record_stack_bounds. You can move the RED_ZONE addition into record_stack_limit as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean record_sp_limit? There's a number of uses which add a value other than RED_ZONE:
https://github.com/rust-lang/rust/blob/master/src/librustrt/stack.rs#L71
https://github.com/rust-lang/rust/blob/master/src/libstd/rand/os.rs#L213
https://github.com/rust-lang/rust/blob/master/src/libstd/rand/os.rs#L217
I think it's better left alone.

Maybe call libnative variant record_os_managed_stack_bounds?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, that sounds good to me. I think that the green/native naming is a bit of a misnomer, but record_os_managed_stack_bounds seems good.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also add a comment to the function explaining how its different from the others?

@alexcrichton
Copy link
Member

🌴 this is exciting!

@@ -53,7 +53,7 @@ def unpack_snapshot(triple, dl_path):
dl_path = sys.argv[2]
else:
# There are no 64-bit Windows snapshots yet, so we'll use 32-bit ones instead, for now
snap_triple = triple if triple != "x86_64-w64-mingw32" else "i686-pc-mingw32"
snap_triple = triple if triple != "x86_64-w64-mingw32" else "i686-w64-mingw32"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is changed by the line? (was this causing problem on some environments?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Purely cosmetic. Since we are now on mingw64, I thought we should use its' triple for consistency.

// unwinds. Instead, it extracts the exception pointer and performs a "normal"
// return.
//
// See also: rt/rust_try.ll
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I'll just have to trust you on this one!

For a good measure, implemented target_record_stack_bounds for 32-bit Windows as well.
@vadimcn
Copy link
Contributor Author

vadimcn commented Aug 6, 2014

r?

@bors bors merged commit 881bfb1 into rust-lang:master Aug 6, 2014
@vadimcn vadimcn deleted the Win64 branch March 1, 2015 08:01
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 8, 2024
internal: Move query limits to the caller

Prior we calculated up to `limit` entries from a query, then filtered from that leaving us with less entries than the limit in some cases (which might give odd completion behavior due to items disappearing). This changes it so we filter before checking the limit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

64-bit windows build.
4 participants