Commit Graph

1938 Commits

Author SHA1 Message Date
Birunthan Mohanathas
61f76a5130 Change use of unsigned integers to signed integers for clarity in
precise_time_ns

The QueryPerformance* functions take a LARGE_INTEGER, which is a signed
64-bit integer rather than an unsigned 64-bit integer. `ts.tv_sec`, too,
is a signed integer so `ns_per_s` has been changed to a int64_t.
2013-11-11 21:21:24 +02:00
Alex Crichton
86a321b65d Another round of test fixes from previous commits 2013-11-10 01:37:12 -08:00
Alex Crichton
3a3eefc5c3 Update to the latest libuv
At this time, also point the libuv submodule to the official repo instead of my
own off to the side.

cc #10246
Closes #10329
2013-11-10 01:37:11 -08:00
Alex Crichton
0df8b0057c Work around bugs in 32-bit enum FFI
cc #10308
2013-11-10 01:37:11 -08:00
Alex Crichton
24b4223418 Migrate uv timer bindings away from ~fn() 2013-11-10 01:37:10 -08:00
Alex Crichton
30c885ea52 uv: Remove lots of uv/C++ wrappers 2013-11-10 01:37:10 -08:00
bors
4ce7d573e8 auto merge of #10348 : ksh8281/rust/fix_android_timegm, r=yichoi
fix timegm bug on android
TZ restore not correctly before.
and it cause test case fail (time::tests::run_tests::test_convertions)

with @sammykim
2013-11-08 04:36:12 -08:00
sh8281.kim
09257df055 fix android timegm 2013-11-08 15:44:36 +09:00
bors
075347b445 auto merge of #10281 : klutzy/rust/rt-timezone, r=alexcrichton
Previously #9418 fixed utf-8 assertion issue by wcsftime,
but the function didn't work as expected: it follows the locale
set by setlocale(), not the system code page.
This patch fixes it by manual multibyte-to-unicode conversion.
2013-11-07 21:41:07 -08:00
sh8281.kim
96ec3c11de update for ndk r9b 2013-11-07 18:47:56 +09:00
bors
22eb11c09b auto merge of #10227 : kud1ing/rust/ios, r=alexcrichton 2013-11-06 14:01:14 -08:00
kud1ing
2a333ed088 Fixes for compilation to iOS:
- remove /usr/include from the include path since the iOS SDK provides the correct version
- `_NSGetEnviron()` is private and not available on iOS
- `.align` without an argument is not allowed with the Apple tools. 2^2 should be the default alignment
- ignore error messages for XCode < 5
- pass include path to libuv
2013-11-06 22:11:09 +01:00
Dirkjan Bussink
47e0bd403a Move implementation for threads to Rust
This binds to the appropriate pthreads_* and Windows specific functions
and calls them from Rust. This allows for removal of the C++ support
code for threads.

Fixes #10162
2013-11-05 17:49:46 +01:00
klutzy
e63ffc1d16 rt: Convert timezone to utf-8 on Windows
Previously #9418 fixed utf-8 assertion issue by wcsftime,
but the function didn't work as expected: it follows the locale
set by setlocale(), not the system code page.
This patch fixes it by manual multibyte-to-unicode conversion.
2013-11-05 13:54:09 +09:00
Alex Crichton
f19d083362 Fill out the remaining functionality in io::file
This adds bindings to the remaining functions provided by libuv, all of which
are useful operations on files which need to get exposed somehow.

Some highlights:

* Dropped `FileReader` and `FileWriter` and `FileStream` for one `File` type
* Moved all file-related methods to be static methods under `File`
* All directory related methods are still top-level functions
* Created `io::FilePermission` types (backed by u32) that are what you'd expect
* Created `io::FileType` and refactored `FileStat` to use FileType and
  FilePermission
* Removed the expanding matrix of `FileMode` operations. The mode of reading a
  file will not have the O_CREAT flag, but a write mode will always have the
  O_CREAT flag.

Closes #10130
Closes #10131
Closes #10121
2013-11-03 15:15:42 -08:00
Alex Crichton
9c1851019f Remove all blocking std::os blocking functions
This commit moves all thread-blocking I/O functions from the std::os module.
Their replacements can be found in either std::rt::io::file or in a hidden
"old_os" module inside of native::file. I didn't want to outright delete these
functions because they have a lot of special casing learned over time for each
OS/platform, and I imagine that these will someday get integrated into a
blocking implementation of IoFactory. For now, they're moved to a private module
to prevent bitrot and still have tests to ensure that they work.

I've also expanded the extensions to a few more methods defined on Path, most of
which were previously defined in std::os but now have non-thread-blocking
implementations as part of using the current IoFactory.

The api of io::file is in flux, but I plan on changing it in the next commit as
well.

Closes #10057
2013-11-03 15:15:42 -08:00
Alex Crichton
7bf58c2baa Modify IoFactory's fs_mkdir, and add fs_rename
The invocation for making a directory should be able to specify a mode to make
the directory with (instead of defaulting to one particular mode). Additionally,
libuv and various OSes implement efficient versions of renaming files, so this
operation is exposed as an IoFactory call.
2013-11-03 15:15:41 -08:00
Alex Crichton
0ce1b2f04d Statically link libuv to librustuv
Similarly to the previous commit, libuv is only used by this library, so there's
no need for it to be linked into librustrt and available to all crates by
default.
2013-11-02 21:28:17 -07:00
Alex Crichton
7f31b079e5 Statically link sundown to librustdoc
Closes #10103
2013-11-01 21:28:48 -07:00
bors
e42e378f32 auto merge of #10163 : brson/rust/rtcxx, r=alexcrichton 2013-10-29 21:26:20 -07:00
Brian Anderson
fce9d7fc37 rt: Remove array_list.h 2013-10-29 17:06:55 -07:00
Brian Anderson
4a318d6e0f rt: Remove rust_thread::detach 2013-10-29 17:02:37 -07:00
Brian Anderson
24a69ddbbc rt: Remove four unused upcalls 2013-10-29 16:49:38 -07:00
Alex Crichton
357ef1f69c Rewrite boxed_region/memory_region in Rust
This drops more of the old C++ runtime to rather be written in rust. A few
features were lost along the way, but hopefully not too many. The main loss is
that there are no longer backtraces associated with allocations (rust doesn't
have a way of acquiring those just yet). Other than that though, I believe that
the rest of the debugging utilities made their way over into rust.

Closes #8704
2013-10-26 01:10:39 -07:00
bors
baeed886aa auto merge of #10060 : alexcrichton/rust/cached-stdout, r=brson
Almost all languages provide some form of buffering of the stdout stream, and
this commit adds this feature for rust. A handle to stdout is lazily initialized
in the Task structure as a buffered owned Writer trait object. The buffer
behavior depends on where stdout is directed to. Like C, this line-buffers the
stream when the output goes to a terminal (flushes on newlines), and also like C
this uses a fixed-size buffer when output is not directed at a terminal.

We may decide the fixed-size buffering is overkill, but it certainly does reduce
write syscall counts when piping output elsewhere. This is a *huge* benefit to
any code using logging macros or the printing macros. Formatting emits calls to
`write` very frequently, and to have each of them backed by a write syscall was
very expensive.

In a local benchmark of printing 10000 lines of "what" to stdout, I got the
following timings:

  when |  terminal   |  redirected
----------|---------------|--------
before |  0.575s     |   0.525s
after  |  0.197s     |   0.013s
  C    |  0.019s     |   0.004s

I can also confirm that we're buffering the output appropriately in both
situtations. We're still far slower than C, but I believe much of that has to do
with the "homing" that all tasks due, we're still performing an order of
magnitude more write syscalls than C does.
2013-10-25 10:36:09 -07:00
Alex Crichton
e8f72c38f4 Cache and buffer stdout per-task for printing
Almost all languages provide some form of buffering of the stdout stream, and
this commit adds this feature for rust. A handle to stdout is lazily initialized
in the Task structure as a buffered owned Writer trait object. The buffer
behavior depends on where stdout is directed to. Like C, this line-buffers the
stream when the output goes to a terminal (flushes on newlines), and also like C
this uses a fixed-size buffer when output is not directed at a terminal.

We may decide the fixed-size buffering is overkill, but it certainly does reduce
write syscall counts when piping output elsewhere. This is a *huge* benefit to
any code using logging macros or the printing macros. Formatting emits calls to
`write` very frequently, and to have each of them backed by a write syscall was
very expensive.

In a local benchmark of printing 10000 lines of "what" to stdout, I got the
following timings:

  when |  terminal   |  redirected
----------------------------------
before |  0.575s     |   0.525s
after  |  0.197s     |   0.013s
  C    |  0.019s     |   0.004s

I can also confirm that we're buffering the output appropriately in both
situtations. We're still far slower than C, but I believe much of that has to do
with the "homing" that all tasks due, we're still performing an order of
magnitude more write syscalls than C does.
2013-10-25 10:31:57 -07:00
Alex Crichton
64a5c3bc1e Implement a basic event loop built on LittleLock
It's not guaranteed that there will always be an event loop to run, and this
implementation will serve as an incredibly basic one which does not provide any
I/O, but allows the scheduler to still run.

cc #9128
2013-10-24 23:49:11 -07:00
Alex Crichton
188e471339 Another round of test fixes and merge conflicts 2013-10-24 14:22:35 -07:00
Do Nhat Minh
b5a02e0784 wrapping libuv signal for use in Rust
descriptive names
easier-to-use api
reorganize and document
2013-10-24 14:22:35 -07:00
Alex Crichton
620ab3853a Test fixes and merge conflicts 2013-10-24 14:21:58 -07:00
Alex Crichton
4eb5336054 Move as much I/O as possible off of native::io
When uv's TTY I/O is used for the stdio streams, the file descriptors are put
into a non-blocking mode. This means that other concurrent writes to the same
stream can fail with EAGAIN or EWOULDBLOCK. By all I/O to event-loop I/O, we
avoid this error.

There is one location which cannot move, which is the runtime's dumb_println
function. This was implemented to handle the EAGAIN and EWOULDBLOCK errors and
simply retry again and again.
2013-10-24 14:21:57 -07:00
Alex Crichton
59d45b8fe7 Don't attempt to export uv functions directly 2013-10-24 14:21:57 -07:00
Alex Crichton
35756fbcf6 Move rt::io::stdio from FileStream to a TTY
We get a little more functionality from libuv for these kinds of streams (things
like terminal dimentions), and it also appears to more gracefully handle the
stream being a window. Beforehand, if you used stdio and hit CTRL+d on a
process, libuv would continually return 0-length successful reads instead of
interpreting that the stream was closed.

I was hoping to be able to write tests for this, but currently the testing
infrastructure doesn't allow tests with a stdin and a stdout, but this has been
manually tested! (not that it means much)
2013-10-24 14:21:57 -07:00
Alex Crichton
1db783bdcf Finish implementing io::net::addrinfo
This fills in the `hints` structure and exposes libuv's full functionality for
doing dns lookups.
2013-10-24 14:21:56 -07:00
Alex Crichton
bac9681858 Implement io::net::unix 2013-10-24 14:21:56 -07:00
bors
a4ec8af4c5 auto merge of #9810 : huonw/rust/rand3, r=alexcrichton
- Adds the `Sample` and `IndependentSample` traits for generating numbers where there are parameters (e.g. a list of elements to draw from, or the mean/variance of a normal distribution). The former takes `&mut self` and the latter takes `&self` (this is the only difference).
- Adds proper `Normal` and `Exp`-onential distributions
- Adds `Range` which generates `[lo, hi)` generically & properly (via a new trait) replacing the incorrect behaviour of `Rng.gen_integer_range` (this has become `Rng.gen_range` for convenience, it's far more efficient to use `Range` itself)
- Move the `Weighted` struct from `std::rand` to `std::rand::distributions` & improve it
- optimisations and docs
2013-10-23 08:31:21 -07:00
Huon Wilson
e0eb128086 std::rand: documentation & references.
Most importantly, links to the papers/references for the core
algorithms (the RNG ones & the distribution ones).
2013-10-23 10:40:06 +11:00
Mark Rowe
fd8c06e7b5 Fix unwinding on OS X 10.9.
OS X 10.9's linker has a bug that results in it failing to preserve
DWARF unwind information when passed the -no_compact_unwind flag.
This flag is passed on OS X because the unwind information for
__morestack cannot be represented by the compact unwind format.

We can work around this problem by using a more targeted approach
to disabling compact unwind information. The OS X linker looks for
a particular pattern in the DWARF unwind information and will not
attempt to convert the unwind information to the compact format.
The pattern in question is the return address register being saved
twice to the same location.

Fixes #6849.
2013-10-22 03:02:25 -07:00
bors
69860b79b8 auto merge of #9812 : HNO3/rust/windows-utf8, r=alexcrichton
This fixes #9418 and #9618, and potential problems related to directory walking.
2013-10-20 10:31:17 -07:00
LEE Wondong
3e53c929a2 Fix unicode errors on Windows in path_is_dir, path_exists, getcwd and rust_localtime.
This make these functions use wchar_t version of APIs, instead of char version.
2013-10-20 15:02:03 +09:00
bors
31a209ca42 auto merge of #9834 : alexcrichton/rust/morestack, r=brson
This commit re-introduces the functionality of __morestack in a way that it was
not originally anticipated. Rust does not currently have segmented stacks,
rather just large stack segments. We do not detect when these stack segments are
overrun currently, but this commit leverages __morestack in order to check this.

This commit purges a lot of the old __morestack and stack limit C++
functionality, migrating the necessary chunks to rust. The stack limit is now
entirely maintained in rust, and the "main logic bits" of __morestack are now
also implemented in rust as well.

I put my best effort into validating that this currently builds and runs successfully on osx and linux 32/64 bit, but I was unable to get this working on windows. We never did have unwinding through __morestack frames, and although I tried poking at it for a bit, I was unable to understand why we don't get unwinding right now.

A focus of this commit is to implement as much of the logic in rust as possible. This involved some liberal usage of `no_split_stack` in various locations, along with some use of the `asm!` macro (scary). I modified a bit of C++ to stop calling `record_sp_limit` because this is no longer defined in C++, rather in rust.

Another consequence of this commit is that `thread_local_storage::{get, set}` must both be flagged with `#[rust_stack]`. I've briefly looked at the implementations on osx/linux/windows to ensure that they're pretty small stacks, and I'm pretty sure that they're definitely less than 20K stacks, so we probably don't have a lot to worry about.

Other things worthy of note:
* The default stack size is now 4MB instead of 2MB. This is so that when we request 2MB to call a C function you don't immediately overflow because you have consumed any stack at all.
* `asm!` is actually pretty cool, maybe we could actually define context switching with it?
* I wanted to add links to the internet about all this jazz of storing information in TLS, but I was only able to find a link for the windows implementation. Otherwise my suggestion is just "disassemble on that arch and see what happens"
* I put my best effort forward on arm/mips to tweak __morestack correctly, we have no ability to test this so an extra set of eyes would be useful on these spots.
* This is all really tricky stuff, so I tried to put as many comments as I thought were necessary, but if anything is still unclear (or I completely forgot to take something into account), I'm willing to write more!
2013-10-19 09:46:18 -07:00
Alex Crichton
6d8330afb6 Use __morestack to detect stack overflow
This commit resumes management of the stack boundaries and limits when switching
between tasks. This additionally leverages the __morestack function to run code
on "stack overflow". The current behavior is to abort the process, but this is
probably not the best behavior in the long term (for deails, see the comment I
wrote up in the stack exhaustion routine).
2013-10-19 09:43:31 -07:00
Alex Crichton
90911d7259 Remove jemalloc from the runtime
As discovered in #9925, it turns out that we weren't using jemalloc on most
platforms. Additionally, on some platforms we were using it incorrectly and
mismatching the libc version of malloc with the jemalloc version of malloc.

Additionally, it's not clear that using jemalloc is indeed a large performance
win in particular situtations. This could be due to building jemalloc
incorrectly, or possibly due to using jemalloc incorrectly, but it is unclear at
this time.

Until jemalloc can be confirmed to integrate correctly on all platforms and has
verifiable large performance wins on platforms as well, it shouldn't be part of
the default build process. It should still be available for use via the
LD_PRELOAD trick on various architectures, but using it as the default allocator
for everything would require guaranteeing that it works in all situtations,
which it currently doesn't.

Closes #9925
2013-10-18 10:38:21 -07:00
Daniel Micay
f766acad62 drop the linenoise library
Closes #5038
2013-10-16 22:57:51 -04:00
bors
2e64a718ea auto merge of #9664 : alexcrichton/rust/logging, r=huonw
This makes some headway on #3309, see commits for details.
2013-10-09 07:31:36 -07:00
Huon Wilson
29e3b33a09 std::rand: make the windows OSRng more correct, remove some C++.
This lets the C++ code in the rt handle the (slightly) tricky parts of
random number generation: e.g. error detection/handling, and using the
values of the `#define`d options to the various functions.
2013-10-09 22:22:42 +11:00
Steven Fackler
1d19ad9787 Fix thread safety issues in dynamic_lib
The root issue is that dlerror isn't reentrant or even thread safe.

The Windows code isn't affected since errno is thread-local on Windows
and it's running in an atomically block to ensure there isn't a green
thread context switch.

Closes #8156
2013-10-05 10:37:11 -07:00
Alex Crichton
88593fc3fc Document logging and remove old functions
This adds a large doc-block to the top of the std::logging module explaining how
to use it. This is mostly just making sure that all the information in the
manual's section about logging is also here (in case someone decides to look
into this module first).

This also removes the old console_{on,off} methods. As far as I can tell, the
functions were only used by the compiler, and there's no reason for them to be
used because they're all turned off by default anyway (maybe they were turned on
by default at some point...)

I believe that this is the final nail in the coffin and closes #5021
2013-10-03 09:16:31 -07:00
Alex Crichton
d29b3ac8a7 Expand tidy to prevent binaries from being checked
Closes #9621
2013-09-30 10:15:47 -07:00
Brian Anderson
25bc6b6283 Remove a little bit of unused C++ 2013-09-26 18:40:13 -07:00
Alex Crichton
6aba140fa7 rustdoc: Add sundown to src/rt/
This also starts compiling it in the same manner as linenoise, it's just bundled
with librustrt directly, and we export just a few symbols out of it.
2013-09-25 14:27:41 -07:00
Huon Wilson
0951313c1e Remove the C(++) ISAAC Rng from the old rt.
This has to leave rust_gen_seed and rng_gen_seed around since they're
used to initialise the std::rand RNGs.
2013-09-23 00:11:43 +10:00
bors
3c0013134c auto merge of #9280 : alexcrichton/rust/less-c++, r=brson
Some of the functions could be converted to rust, but the functions dealing with
signals were moved to rust_builtin.cpp instead (no reason to keep the original
file around for one function).

Closes #2674

Because less C++ is better C++!
2013-09-18 22:15:59 -07:00
Alex Crichton
c3ad785d83 Remove rust_run_program.cpp
Some of the functions could be converted to rust, but the functions dealing with
signals were moved to rust_builtin.cpp instead (no reason to keep the original
file around for one function).

Closes #2674
2013-09-18 20:58:56 -07:00
Alex Crichton
cb7756a81d Implement process bindings to libuv
This is a re-landing of #8645, except that the bindings are *not* being used to
power std::run just yet. Instead, this adds the bindings as standalone bindings
inside the rt::io::process module.

I made one major change from before, having to do with how pipes are
created/bound. It's much clearer now when you can read/write to a pipe, as
there's an explicit difference (different types) between an unbound and a bound
pipe. The process configuration now takes unbound pipes (and consumes ownership
of them), and will return corresponding pipe structures back if spawning is
successful (otherwise everything is destroyed normally).
2013-09-18 13:52:18 -07:00
Jeff Olson
bf399d558e std: bind uv_fs_readdir(), flesh out DirectoryInfo and docs/cleanup 2013-09-16 23:19:24 -07:00
Jeff Olson
b49fc4cf4e std: adding file::{stat,mkdir,rmdir}, FileInfo and FileReader/FileWriter
add ignores for win32 tests on previous file io stuff...
2013-09-16 23:17:46 -07:00
Jeff Olson
055488df1a merge cleanup 2013-09-16 23:17:46 -07:00
Jeff Olson
af650572e0 std/rt: in-progress file io work
std: remove unneeded field from RequestData struct

std: rt::uv::file - map us_fs_stat & start refactoring calls into FsRequest

std: stubbing out stat calls from the top-down into uvio

std: us_fs_* operations are now by-val self methods on FsRequest

std: post-rebase cleanup

std: add uv_fs_mkdir|rmdir + tests & minor test cleanup in rt::uv::file

WORKING: fleshing out FileStat and FileInfo + tests

std: reverting test files..

refactoring back and cleanup...
2013-09-16 23:17:46 -07:00
Alex Crichton
0af2bd829e Remove all usage of change_dir_locked
While usage of change_dir_locked is synchronized against itself, it's not
synchronized against other relative path usage, so I'm of the opinion that it
just really doesn't help in running tests. In order to prevent the problems that
have been cropping up, this completely removes the function.

All existing tests (except one) using it have been moved to run-pass tests where
they get their own process and don't need to be synchronized with anyone else.

There is one now-ignored rustpkg test because when I moved it to a run-pass test
apparently run-pass isn't set up to have 'extern mod rustc' (it ends up having
linkage failures).
2013-09-13 21:58:00 -07:00
bors
323e8f07ff auto merge of #9087 : fhahn/rust/rust_crate_map, r=brson
This patch converts the rust_crate_map.cpp to Rust as mentioned at the end of #8880.
2013-09-12 23:00:51 -07:00
Florian Hahn
2b5f4b55c0 Convert rust_crate_map.cpp to Rust
Conflicts:
	src/libstd/rt/logging.rs
2013-09-13 00:47:30 +02:00
Huon Wilson
a9184975da Add linenoise lock helpers to rustrt.def.in. 2013-09-12 17:07:24 +10:00
Huon Wilson
21ce41d42d extra: use a mutex to wrap linenoise calls and make them threadsafe.
Fixes #3921.
2013-09-11 22:20:33 +10:00
Alex Crichton
b4c36c2d1b Upgrade libuv to the current master (again)
This is a reopening of the libuv-upgrade part of #8645. Hopefully this won't
cause random segfaults all over the place. The windows regression in testing
should also be fixed (it shouldn't build the whole compiler twice).

A notable difference from before is that gyp is now a git submodule instead of
always git-cloned at make time. This allows bundling for releases more easily.

Closes #8850
2013-09-06 11:12:49 -07:00
Brian Anderson
c218694cec std::rt: Add libuv bindings for getaddrinfo 2013-09-05 14:22:15 -07:00
bors
60fba4d7d6 auto merge of #8880 : fhahn/rust/issue_8703, r=brson
I've started working on #8703.

RUST_LOG="::help" should work, I hope I'll be able to finish the rest this weekend.
2013-09-04 13:05:50 -07:00
Florian Hahn
e38739bb44 Convert rust_log.cpp to Rust, closes #8703 2013-09-04 14:18:56 +02:00
Daniel Micay
09ad0cd362 add type name to the tydesc
Closes #8926
2013-09-03 04:44:47 -04:00
Birunthan Mohanathas
30fc2c8df2 Fix incorrect strftime error handling in rust_localtime
Closes #8702.
2013-09-01 14:57:29 +03:00
Brian Anderson
3c5a43e5b6 Revert "auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, r=brson"
This reverts commit b8d1fa3994, reversing
changes made to f22b4b1698.

Conflicts:
	mk/rt.mk
	src/libuv
2013-08-29 14:23:44 -07:00
Alex Crichton
b89e1c000e Implement process bindings to libuv
Closes #6436
2013-08-27 20:46:43 -07:00
Alex Crichton
ed204257a0 Upgrade libuv to the current master + our patches
There were two main differences with the old libuv and the master version:

1. The uv_last_error function is now gone. The error code returned by each
   function is the "last error" so now a UvError is just a wrapper around a
   c_int.
2. The repo no longer includes a makefile, and the build system has change.
   According to the build directions on joyent/libuv, this now downloads a `gyp`
   program into the `libuv/build` directory and builds using that. This
   shouldn't add any dependences on autotools or anything like that.

Closes #8407
Closes #6567
Closes #6315
2013-08-27 20:46:17 -07:00
klutzy
442f4a5f2c Support Win64 context switching
This patch saves and restores win64's nonvolatile registers.
This patch also saves stack information of thread environment
block (TEB), which is at %gs:0x08 and %gs:0x10.
2013-08-26 22:16:54 +09:00
klutzy
63e53b8af2 rt: Support SEH/SJLJ personality routine 2013-08-26 22:15:45 +09:00
klutzy
ef20bd44bd rt: Make valgrind Win64-compatible 2013-08-26 22:15:45 +09:00
klutzy
a35bfa2e9b rt: Add {get,record}_sp_limit on Win64
Uses ArbitraryUserPointer area at gs:0x28.
2013-08-26 22:14:31 +09:00
klutzy
5118ef6ff0 rt: Remove leading underscore on Win64
Win64 convention does not use underscore.
2013-08-26 22:14:23 +09:00
Brian Anderson
8fc1d9db21 std: Convert the runtime TLS key to a Rust global to avoid FFI 2013-08-24 15:46:03 -07:00
Brian Anderson
9cdfe1e603 rt: Remove rust_abi 2013-08-23 18:38:59 -07:00
Brian Anderson
0ee24437ce rt: Remove rust_util.cpp 2013-08-23 18:38:59 -07:00
Brian Anderson
b72c43739d rt: Remove old precise GC code 2013-08-23 18:38:59 -07:00
Brian Anderson
c17447f8b3 rt: Move some test functions to rust_test_helpers 2013-08-23 18:38:59 -07:00
Brian Anderson
4541c6cfe3 rt: Remove exit_status helpers 2013-08-23 18:38:59 -07:00
Brian Anderson
b4ef59db2f rt: Remove sync.h 2013-08-23 18:38:59 -07:00
Brian Anderson
e3419f9c45 rt: Memory regions are never synchronized now 2013-08-23 18:38:59 -07:00
Brian Anderson
0a1baef4f5 rt: Remove timer 2013-08-23 18:38:56 -07:00
Brian Anderson
a9d28b2d9d rt: Remove indexed_list 2013-08-23 14:46:23 -07:00
Brian Anderson
b3fa43f6e0 rt: Remove rust_exchange_alloc 2013-08-23 14:46:23 -07:00
Brian Anderson
74b2d9e19b rt: Remove last use of C++ exchange alloc 2013-08-23 14:46:23 -07:00
bors
9e1e152091 auto merge of #8596 : vadimcn/rust/master, r=alexcrichton
This resolves issue #908.  

Notable changes:
-  On Windows, LLVM integrated assembler emits bad stack unwind tables when segmented stacks are enabled.  However, unwind info directives in the assembly output are correct, so we generate assembly first and then run it through an external assembler, just like it is already done for Android builds.

- Linker is invoked  via "g++" command instead of "gcc": g++ passes the appropriate magic parameters to the linker, which ensure correct registration of stack unwind tables in dynamic libraries.
2013-08-22 21:06:25 -07:00
Jeff Olson
744c46225e make check appeasement 2013-08-22 16:33:59 -07:00
Jeff Olson
c0fba3c4ac rt: re-adding lines erroneous stripped out in merge conflict 2013-08-22 16:31:58 -07:00
Jeff Olson
a7ee85b50b std: stripping unneeded fcntl.h include from rust_uv.cpp 2013-08-22 16:31:58 -07:00
Jeff Olson
f60bd75f4d std: remove fcntl const bindings + making valgrind clean w/ no owned vecs 2013-08-22 16:31:57 -07:00
Jeff Olson
c49c2921b0 std: add read and unlink to low-level FileDescriptor + end-to-end CRUD test 2013-08-22 16:31:57 -07:00
Jeff Olson
dabbac1d6c std: working tests for low-level libuv open, write and close operations 2013-08-22 16:31:57 -07:00
Jeff Olson
a901b16690 std: bootstrapping libuv-based fileio in newrt... open & close
the test "touch"es a new file
2013-08-22 16:31:57 -07:00
Vadim Chugunov
84e683063b Emit unwind info in rustrt assembly files on Windows. 2013-08-22 00:12:43 -07:00
Vadim Chugunov
9e7f1fce73 Un-disable stack unwinding on Windows. 2013-08-22 00:12:43 -07:00
bors
0bc1ca4045 auto merge of #8631 : anasazi/rust/homing-io, r=brson
libuv handles are tied to the event loop that created them. In order to perform IO, the handle must be on the thread with its home event loop. Thus, when as task wants to do IO it must first go to the IO handle's home event loop and pin itself to the corresponding scheduler while the IO action is in flight. Once the IO action completes, the task is unpinned and either returns to its home scheduler if it is a pinned task, or otherwise stays on the current scheduler.

Making new blocking IO implementations (i.e. files) thread safe is rather simple. Add a home field to the IO handle's struct in uvio and implement the HomingIO trait. Wrap every IO call in the HomingIO.home_for_io method, which will take care of the scheduling.

I'm not sure if this remains thread safe in the presence of asynchronous IO at the libuv level. If we decide to do that, then this set up should be revisited.
2013-08-20 17:12:09 -07:00
bors
5034792c88 auto merge of #8584 : thestinger/rust/jemalloc, r=graydon
This reverts commit 371a316ec9.

Closes #7217
2013-08-19 20:21:58 -07:00
Daniel Micay
ef436637ea jemalloc: use $(AR), not ar 2013-08-19 20:53:02 -04:00
Graydon Hoare
517e611271 regenerate configure 2013-08-19 20:48:11 -04:00
Eric Reed
88f718341e Instruct event loops to ignore SIGPIPE when constructed.
libuv does not always catch SIGPIPE.
2013-08-19 16:26:50 -07:00
Graydon Hoare
2c7164595f rt: make jemalloc header conform to android signature. 2013-08-19 16:09:46 -07:00
bors
3bc6858428 auto merge of #8551 : huonw/rust/speling, r=alexcrichton
(This doesn't add/remove `u`s or change `ize` to `ise`, or anything like that.)
2013-08-18 05:11:58 -07:00
Brian Anderson
a4d171e009 rt: Remove unused uv helpers 2013-08-16 13:24:25 -07:00
Brian Anderson
5052773ad8 rt: Remove empty rust_upcall.h 2013-08-16 13:24:25 -07:00
Brian Anderson
450f16eb25 rt: Remove unused rust_clone_type_desc declaration 2013-08-16 13:24:25 -07:00
Brian Anderson
da7d79dfbe rt: Remove rust_stack 2013-08-16 13:24:25 -07:00
Brian Anderson
8861ba6159 rt: Remove rust_refcount.h 2013-08-16 13:24:25 -07:00
Brian Anderson
cb89afc64e rt: Remove unused parts of rust_log 2013-08-16 13:24:25 -07:00
Brian Anderson
085dc55e13 rt: Remove unused parts of rust_globals.h 2013-08-16 13:24:24 -07:00
Brian Anderson
1b6292aaea rt: Remove rust_signal.h 2013-08-16 13:24:24 -07:00
Brian Anderson
5923cc3745 rt: Remove rust_env 2013-08-16 13:24:24 -07:00
Huon Wilson
72fd02d939 doc: convert remaining uses of core:: to std::. 2013-08-16 15:54:14 +10:00
Niko Matsakis
6fe59bf877 Add a field borrow_offset to the type descriptor indicating
what amount a T* pointer must be adjusted to reach the contents
of the box. For `~T` types, this requires knowing the type `T`,
which is not known in the case of objects.
2013-08-11 13:59:45 -04:00
bors
60f5011005 auto merge of #8296 : erickt/rust/remove-str-trailing-nulls, r=erickt
This PR fixes #7235 and #3371, which removes trailing nulls from `str` types. Instead, it replaces the creation of c strings with a new type, `std::c_str::CString`, which wraps a malloced byte array, and respects:

*  No interior nulls
* Ends with a trailing null
2013-08-09 21:56:17 -07:00
Brian Anderson
b75915d0ca Remove the C++ runtime. Sayonara 2013-08-09 16:45:50 -07:00
Erick Tryzelaar
8567611adf Merge commit 'd89ff7eef969aee6b493bc846b64d68358fafbcd' into remove-str-trailing-nulls 2013-08-06 16:18:58 -07:00
Luqman Aden
9c39992021 Add support for vanilla linux on arm. 2013-08-04 19:28:06 -04:00
Erick Tryzelaar
3c94b5044c Merge remote-tracking branch 'remotes/origin/master' into str-remove-null 2013-08-04 16:23:41 -07:00
Erick Tryzelaar
5865a7597b Remove trailing null from strings 2013-08-04 15:45:16 -07:00
Brian Anderson
044fa35bf8 rt: Fix a corner-case in unwinding that leads to stack overflow
In some scenarios upcall_rust_stack_limit fails to record the stack
limit, leaving it 0, and allowing subsequent Rust code to run into
the red zone.
2013-08-03 23:40:25 -07:00
Brian Anderson
05eff5f731 extra: Remove dbg module and rt support code
This stuff is ancient, unused, and tied to oldsched
2013-07-31 18:51:57 -07:00
bors
9e857458d6 auto merge of #8145 : brson/rust/rttestfixes, r=pcwalton
Two commits here that fix test case dependencies on the old scheduler.
2013-07-31 07:34:24 -07:00
bors
5d409ccd30 auto merge of #8143 : brson/rust/change-dir-lock, r=luqmana 2013-07-31 05:46:21 -07:00
Brian Anderson
11fc1fd485 test: Use a test extern in various foreign fn tests 2013-07-30 21:13:55 -07:00
Brian Anderson
91f1ab4896 rt: Use the correct global change_dir lock 2013-07-30 21:06:02 -07:00
Brian Anderson
cb9ee7f5be std: Remove ManualThreads spawn mode 2013-07-30 14:23:45 -07:00
Brian Anderson
0144c83213 std::rt: Change Thread interface to require an explicit join
Makes it more obvious what's going on
2013-07-30 14:23:44 -07:00
bors
6dc5e2c61f auto merge of #8046 : kmcallister/rust/unused-log, r=pcwalton 2013-07-28 12:52:25 -07:00
bors
15310ba7c2 auto merge of #8040 : luqmana/rust/rtn, r=brson
Implements various missing tcp & udp methods.. Also fixes handling ipv4-mapped/compatible ipv6 addresses and addresses the XXX on `status_to_maybe_uv_error`.

r? @brson
2013-07-27 01:49:35 -07:00
Luqman Aden
037bf3757c libstd: Implement some missing udp methods. 2013-07-25 22:21:46 -04:00
Keegan McAllister
d0f54a5cfb Warn about unused RUST_LOG specs 2013-07-25 13:24:32 -07:00
Luqman Aden
61e741cf71 libstd: Implement {peer, socket}_name for new rt tcp & udp. 2013-07-25 05:57:52 -04:00
Daniel Micay
ce1db94647 rm unused upcall_exchange_free 2013-07-24 18:44:16 -04:00
bors
7f96eb58d2 auto merge of #7980 : graydon/rust/misc-benchmarks, r=catamorphism
Some machinery for enabling #[bench] benchmarks in std and some examples showing how to write them.
2013-07-23 22:46:39 -07:00
Graydon Hoare
bc2b78ca2c rt: Fix child-iteration bug in crate map. 2013-07-22 16:56:10 -07:00
Brian Anderson
407bffb33e std: Remove at_exit API. Unused 2013-07-22 14:17:09 -07:00
Brian Anderson
23b7ee2bda std: Remove unstable::global. Unused 2013-07-22 14:16:52 -07:00
Brian Anderson
4beda4e582 std::rt: Stop using unstable::global in change_dir_locked 2013-07-22 14:16:52 -07:00
Brian Anderson
f8c4d99df6 std: Remove weak_task API. Unused 2013-07-22 14:16:52 -07:00
Daniel Micay
ed67cdb73c new snapshot 2013-07-22 01:09:48 -04:00
bors
91ebfbb959 auto merge of #7859 : kmcallister/rust/rt-diag-messages, r=pcwalton
I added these while tracking down heap corruption in Servo.
2013-07-18 22:40:38 -07:00
bors
b70c045f38 auto merge of #7856 : brson/rust/no-thread-per-core, r=pcwalton
This doesn't make sense under the new scheduler.
2013-07-18 19:10:41 -07:00
Keegan McAllister
2d82d9364c rt: Print alloc backtraces for bad release_alloc with RUSTRT_TRACK_ALLOCATIONS
Probably the env var should be renamed from DETAILED_LEAKS but I'm leaving
aside that breaking change for now.
2013-07-17 14:04:03 -07:00
Keegan McAllister
dfa5595628 rt: Diagnose bad alloc index in release_alloc with RUSTRT_TRACK_ALLOCATIONS 2013-07-17 14:03:59 -07:00
Daniel Micay
e118555ce6 remove headers from unique vectors 2013-07-15 23:57:27 -04:00