summary refs log tree commit diff
path: root/src/rt
AgeCommit message (Collapse)AuthorLines
2014-03-25rustuv: Handle short writes in uv_fs_writeAlex Crichton-1/+1
The libuv fs wrappers are very thin wrappers around the syscalls they correspond to, and a notable worrisome case is the write syscall. This syscall is not guaranteed to write the entire buffer provided, so we may have to continue calling uv_fs_write if a short write occurs. Closes #13130
2014-03-21rand: Rewrite OsRng in Rust for windowsAlex Crichton-59/+0
This removes even more rust_builtin.c code, and allows us to more gracefully handle errors (not a process panic, but a task failure).
2014-03-19rustc: Fix x86 ffi for empty struct argumentsklutzy-0/+23
2014-03-14fix MIPS targetJyun-Yan You-25/+8
I ignored AtomicU64 methods on MIPS target because libgcc doesn't implement MIPS32 64-bit atomic operations. Otherwise it would cause link failure.
2014-03-12std: Move rand to librand.Huon Wilson-1/+1
This functionality is not super-core and so doesn't need to be included in std. It's possible that std may need rand (it does a little bit now, for io::test) in which case the functionality required could be moved to a secret hidden module and reexposed by librand. Unfortunately, using #[deprecated] here is hard: there's too much to mock to make it feasible, since we have to ensure that programs still typecheck to reach the linting phase.
2014-03-05native: Stop using readdir()Alex Crichton-3/+12
This function is not threadsafe, and is deprecated in favor of the threadsafe readdir_r variant. Closes #12692
2014-02-16Upgrade libuvAlex Crichton-1/+1
This notably includes joyent/libuv@6f62d62c in order to fix when processes fail to spawn on windows
2014-02-13Remove two allocations from spawning a green taskAlex Crichton-0/+41
Two unfortunate allocations were wrapping a proc() in a proc() with GreenTask::build_start_wrapper, and then boxing this proc in a ~proc() inside of Context::new(). Both of these allocations were a direct result from two conditions: 1. The Context::new() function has a nice api of taking a procedure argument to start up a new context with. This inherently required an allocation by build_start_wrapper because extra code needed to be run around the edges of a user-provided proc() for a new task. 2. The initial bootstrap code only understood how to pass one argument to the next function. By modifying the assembly and entry points to understand more than one argument, more information is passed through in registers instead of allocating a pointer-sized context. This is sadly where I end up throwing mips under a bus because I have no idea what's going on in the mips context switching code and don't know how to modify it. Closes #7767 cc #11389
2014-02-03std: Hardcode pthread constants and structuresAlex Crichton-20/+0
This allows for easier static initialization of a pthread mutex, although the windows mutexes still sadly suffer. Note that this commit removes the clone() method from a mutex because it no longer makes sense for pthreads mutexes. This also removes the Once type for now, but it'll get added back shortly.
2014-01-26Removed all instances of XXX in preparation for relaxing of FIXME ruleSalem Talha-1/+1
2014-01-20rustuv: Re-work sockaddr glue to not use mallocAlex Crichton-44/+0
This means we can purge even more C from src/rt!
2014-01-03rt: Define exp10 on AndroidBrian Anderson-0/+5
LLVM appears to generate calls to exp10 on ARM and bionic does not define it.
2013-12-30Convert some C functions to rust functionsAlex Crichton-67/+0
Right now on linux, an empty executable with LTO still depends on librt becaues of the clock_gettime function in rust_builtin.o, but this commit moves this dependency into a rust function which is subject to elimination via LTO. At the same time, this also drops libstd's dependency on librt on unices that are not OSX because the library is only used by extra::time (and now the dependency is listed in that module instead).
2013-12-26Register new snapshotsAlex Crichton-92/+0
2013-12-24Remove rust_globals.hBrian Anderson-143/+37
2013-12-24Stop using C++ exceptions for stack unwinding.Vadim Chugunov-31/+37
2013-12-22uv: Suppress a warning by using an absolute pathAlex Crichton-0/+2
Turns out libuv's build system doesn't like us telling them that the build directory is a relative location, as it always spits out a warning about a circular dependency being dropped. By using an absolute path, turns out the warnings isn't spit out, who knew? Closes #11067
2013-12-07Register new snapshotsAlex Crichton-9/+0
This transitions the snapshot dependency process to understand that our snapshots are now a single static binary rather than an array of files.
2013-12-05Remove unused upcallsAlex Crichton-1/+2
The main one removed is rust_upcall_reset_stack_limit (continuation of #10156), and this also removes the upcall_trace function. The was hidden behind a `-Z trace` flag, but if you attempt to use this now you'll get a linker error because there is no implementation of the 'upcall_trace' function. Due to this no longer working, I decided to remove it entirely from the compiler (I'm also a little unsure on what it did in the first place).
2013-11-29Statically link librustrt to libstdAlex Crichton-51/+0
This commit alters the build process of the compiler to build a static librustrt.a instead of a dynamic version. This means that we can stop distributing librustrt as well as default linking against it in the compiler. This also means that if you attempt to build rust code without libstd, it will no longer work if there are any landing pads in play. The reason for this is that LLVM and rustc will emit calls to the various upcalls in librustrt used to manage exception handling. In theory we could split librustrt into librustrt and librustupcall. We would then distribute librustupcall and link to it for all programs using landing pads, but I would rather see just one librustrt artifact and simplify the build process. The major benefit of doing this is that building a static rust library for use in embedded situations all of a sudden just became a whole lot more feasible. Closes #3361
2013-11-22Remove sjlj stuff from rust_upcall and don't pass -Werror to libuv.Luqman Aden-11/+0
2013-11-22Fix up mingw64 target.Luqman Aden-7/+18
2013-11-19Implement more native file I/OAlex Crichton-63/+0
This implements a fair amount of the unimpl() functionality in io::native relating to filesystem operations. I've also modified all io::fs tests to run in both a native and uv environment (so everything is actually tested). There are a two bits of remaining functionality which I was unable to get working: * change_file_times on windows * lstat on windows I think that change_file_times may just need a better interface, but lstat has a large implementation in libuv which I didn't want to tackle trying to copy.
2013-11-18Move runtime files to C instead of C++Alex Crichton-178/+198
Explicitly have the only C++ portion of the runtime be one file with exception handling. All other runtime files must now live in C and be fully defined in C.
2013-11-18Remove the C++ lock_and_signal typeAlex Crichton-441/+2
A the same time this purges all runtime support needed for statically initialized mutexes, moving all users over to the new Mutex type instead.
2013-11-18Implement a native mutex typeAlex Crichton-2/+24
This mutex is built on top of pthreads for unix and the related windows apis on windows. This is a straight port of the lock_and_signal type from C++ to rust. Almost all operations on the type are unsafe, and it's definitely not recommended for general use. Closes #9105
2013-11-18rt: Namespace all C functions under rust_Brian Anderson-16/+16
2013-11-13add rust_trylock_little_lockJason Toffaletti-0/+33
Try to acquire lock and succeed only if lock is not already held. Uses TryEnterCriticalSection or pthread_mutex_trylock.
2013-11-12rt: Delete more C++Brian Anderson-141/+10
2013-11-11auto merge of #10403 : poiru/rust/issue-2675, r=alexcrichtonbors-9/+11
Closes #2675.
2013-11-11Add asserts to check for faililng QueryPerformance* calls in precise_time_nsBirunthan Mohanathas-7/+9
Closes #2675.
2013-11-11Change use of unsigned integers to signed integers for clarity inBirunthan Mohanathas-5/+5
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-10Another round of test fixes from previous commitsAlex Crichton-4/+2
2013-11-10Update to the latest libuvAlex Crichton-152/+25
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-10Work around bugs in 32-bit enum FFIAlex Crichton-0/+5
cc #10308
2013-11-10Migrate uv timer bindings away from ~fn()Alex Crichton-5/+0
2013-11-10uv: Remove lots of uv/C++ wrappersAlex Crichton-352/+0
2013-11-08auto merge of #10348 : ksh8281/rust/fix_android_timegm, r=yichoibors-2/+5
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-08fix android timegmsh8281.kim-2/+5
2013-11-07auto merge of #10281 : klutzy/rust/rt-timezone, r=alexcrichtonbors-4/+9
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-07update for ndk r9bsh8281.kim-4/+0
2013-11-06auto merge of #10227 : kud1ing/rust/ios, r=alexcrichtonbors-5/+17
2013-11-06Fixes for compilation to iOS:kud1ing-5/+17
- 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-05Move implementation for threads to RustDirkjan Bussink-143/+0
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-05rt: Convert timezone to utf-8 on Windowsklutzy-4/+9
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-03Fill out the remaining functionality in io::fileAlex Crichton-0/+4
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-03Remove all blocking std::os blocking functionsAlex Crichton-0/+4
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-03Modify IoFactory's fs_mkdir, and add fs_renameAlex Crichton-0/+5
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-02Statically link libuv to librustuvAlex Crichton-115/+0
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-01Statically link sundown to librustdocAlex Crichton-6/+0
Closes #10103