about summary refs log tree commit diff
path: root/src/rt
AgeCommit message (Collapse)AuthorLines
2013-10-24Finish implementing io::net::addrinfoAlex Crichton-0/+13
This fills in the `hints` structure and exposes libuv's full functionality for doing dns lookups.
2013-10-24Implement io::net::unixAlex Crichton-0/+15
2013-10-23auto merge of #9810 : huonw/rust/rand3, r=alexcrichtonbors-0/+2
- 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-23std::rand: documentation & references.Huon Wilson-0/+2
Most importantly, links to the papers/references for the core algorithms (the RNG ones & the distribution ones).
2013-10-22Fix unwinding on OS X 10.9.Mark Rowe-3/+21
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-20auto merge of #9812 : HNO3/rust/windows-utf8, r=alexcrichtonbors-4/+52
This fixes #9418 and #9618, and potential problems related to directory walking.
2013-10-20Fix unicode errors on Windows in path_is_dir, path_exists, getcwd and ↵LEE Wondong-4/+52
rust_localtime. This make these functions use wchar_t version of APIs, instead of char version.
2013-10-19auto merge of #9834 : alexcrichton/rust/morestack, r=brsonbors-1464/+70
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-19Use __morestack to detect stack overflowAlex Crichton-1464/+70
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-18Remove jemalloc from the runtimeAlex Crichton-44502/+0
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-16drop the linenoise libraryDaniel Micay-1934/+0
Closes #5038
2013-10-09auto merge of #9664 : alexcrichton/rust/logging, r=huonwbors-24/+0
This makes some headway on #3309, see commits for details.
2013-10-09std::rand: make the windows OSRng more correct, remove some C++.Huon Wilson-116/+59
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-05Fix thread safety issues in dynamic_libSteven Fackler-0/+14
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-03Document logging and remove old functionsAlex Crichton-24/+0
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-09-30Expand tidy to prevent binaries from being checkedAlex Crichton-0/+0
Closes #9621
2013-09-26Remove a little bit of unused C++Brian Anderson-18/+0
2013-09-25rustdoc: Add sundown to src/rt/Alex Crichton-0/+5454
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-23Remove the C(++) ISAAC Rng from the old rt.Huon Wilson-347/+0
This has to leave rust_gen_seed and rng_gen_seed around since they're used to initialise the std::rand RNGs.
2013-09-18auto merge of #9280 : alexcrichton/rust/less-c++, r=brsonbors-72/+23
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-18Remove rust_run_program.cppAlex Crichton-72/+23
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-18Implement process bindings to libuvAlex Crichton-0/+42
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-16std: bind uv_fs_readdir(), flesh out DirectoryInfo and docs/cleanupJeff Olson-0/+11
2013-09-16std: adding file::{stat,mkdir,rmdir}, FileInfo and FileReader/FileWriterJeff Olson-21/+21
add ignores for win32 tests on previous file io stuff...
2013-09-16merge cleanupJeff Olson-21/+21
2013-09-16std/rt: in-progress file io workJeff Olson-0/+47
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-13Remove all usage of change_dir_lockedAlex Crichton-14/+0
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-12auto merge of #9087 : fhahn/rust/rust_crate_map, r=brsonbors-175/+0
This patch converts the rust_crate_map.cpp to Rust as mentioned at the end of #8880.
2013-09-13Convert rust_crate_map.cpp to RustFlorian Hahn-175/+0
Conflicts: src/libstd/rt/logging.rs
2013-09-12Add linenoise lock helpers to rustrt.def.in.Huon Wilson-0/+2
2013-09-11extra: use a mutex to wrap linenoise calls and make them threadsafe.Huon Wilson-0/+12
Fixes #3921.
2013-09-06Upgrade libuv to the current master (again)Alex Crichton-10/+2
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-05std::rt: Add libuv bindings for getaddrinfoBrian Anderson-0/+6
2013-09-04auto merge of #8880 : fhahn/rust/issue_8703, r=brsonbors-174/+37
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-04Convert rust_log.cpp to Rust, closes #8703Florian Hahn-174/+37
2013-09-03add type name to the tydescDaniel Micay-0/+6
Closes #8926
2013-09-01Fix incorrect strftime error handling in rust_localtimeBirunthan Mohanathas-3/+6
Closes #8702.
2013-08-29Revert "auto merge of #8645 : alexcrichton/rust/issue-6436-run-non-blocking, ↵Brian Anderson-44/+11
r=brson" This reverts commit b8d1fa399402c71331aefd634d710004e00b73a6, reversing changes made to f22b4b169854c8a4ba86c16ee43327d6bcf94562. Conflicts: mk/rt.mk src/libuv
2013-08-27Implement process bindings to libuvAlex Crichton-0/+41
Closes #6436
2013-08-27Upgrade libuv to the current master + our patchesAlex Crichton-11/+3
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-26Support Win64 context switchingklutzy-9/+75
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-26rt: Support SEH/SJLJ personality routineklutzy-6/+16
2013-08-26rt: Make valgrind Win64-compatibleklutzy-6/+12
2013-08-26rt: Add {get,record}_sp_limit on Win64klutzy-0/+8
Uses ArbitraryUserPointer area at gs:0x28.
2013-08-26rt: Remove leading underscore on Win64klutzy-3/+6
Win64 convention does not use underscore.
2013-08-24std: Convert the runtime TLS key to a Rust global to avoid FFIBrian Anderson-12/+6
2013-08-23rt: Remove rust_abiBrian Anderson-168/+0
2013-08-23rt: Remove rust_util.cppBrian Anderson-37/+0
2013-08-23rt: Remove old precise GC codeBrian Anderson-123/+0
2013-08-23rt: Move some test functions to rust_test_helpersBrian Anderson-51/+50