Commit Graph

1876 Commits

Author SHA1 Message Date
Patrick Walton a9dd903d79 libtime: Remove the `tz_zone` field from times.
It depends on `~str`.
2014-05-22 14:42:02 -07:00
Daniel Micay 7798755916 update valgrind headers 2014-05-14 12:34:32 -04:00
Daniel Micay f1735cefcf make sure jemalloc valgrind support is enabled
This requires pointing it at the valgrind headers we carry in-tree.
2014-05-11 20:05:22 -04:00
Alex Crichton 9306e840f5 rustdoc: Migrate from sundown to hoedown
This primary fix brought on by this upgrade is the proper matching of the ```
and ~~~ doc blocks. This also moves hoedown to a git submodule rather than a
bundled repository.

Additionally, hoedown is stricter about code blocks, so this ended up fixing a
lot of invalid code blocks (ending with " ```" instead of "```", or ending with
"~~~~" instead of "~~~").

Closes #12776
2014-05-03 17:36:20 -07:00
Alex Crichton 58a51120a7 Update libuv
This update brings a few months of changes, but primarily a fix for the
following situation.

When creating a handle to stdin, libuv used to set the stdin handle to
nonblocking mode. This would end up affect this stdin handle across all
processes that shared it, which mean that stdin become nonblocking for everyone
using the same stdin. On linux, this also affected *stdout* because stdin/stdout
roughly point at the same thing.

This problem became apparent when running the test suite manually on a local
computer. The stdtest suite (running with libgreen) would set stdout to
nonblocking mode (as described above), and then the next test suite would always
fail for a printing failure (because stdout was returning EAGAIN).

This has been fixed upstream, joyent/libuv@342e8c, and this update pulls in this
fix. This also brings us in line with a recently upstreamed libuv patch.

Closes #13336
Closes #13355
2014-04-24 09:08:07 -07:00
Richo Healey 919889a1d6 Replace all ~"" with "".to_owned() 2014-04-18 17:25:34 -07:00
Joseph Crail 22b632560f Fix spelling errors in comments. 2014-04-08 00:03:12 -07:00
Alex Crichton 5fddb4280e rustuv: Handle short writes in uv_fs_write
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-25 09:37:36 -07:00
Alex Crichton d2e99a0b33 rand: Rewrite OsRng in Rust for windows
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-21 12:03:13 -07:00
klutzy 2d31bcaf16 rustc: Fix x86 ffi for empty struct arguments 2014-03-19 16:41:51 +09:00
Jyun-Yan You 6d7e86d099 fix MIPS target
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-14 11:13:36 +08:00
Huon Wilson 6fa4bbeed4 std: Move rand to librand.
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-12 11:31:05 +11:00
Alex Crichton 8334dd445f native: Stop using readdir()
This function is not threadsafe, and is deprecated in favor of the threadsafe
readdir_r variant.

Closes #12692
2014-03-05 09:11:10 -08:00
Alex Crichton 74b42c646e Upgrade libuv
This notably includes joyent/libuv@6f62d62c in order to fix when processes fail
to spawn on windows
2014-02-16 16:01:03 -08:00
Alex Crichton 301ff0c2df Remove two allocations from spawning a green task
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-13 20:31:17 -08:00
Alex Crichton 99582f8884 std: Hardcode pthread constants and structures
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-02-03 12:04:30 -08:00
Salem Talha cc61fc0994 Removed all instances of XXX in preparation for relaxing of FIXME rule 2014-01-26 14:42:53 -05:00
Alex Crichton c6123ca105 rustuv: Re-work sockaddr glue to not use malloc
This means we can purge even more C from src/rt!
2014-01-20 13:32:45 -08:00
Brian Anderson bc78d86985 rt: Define exp10 on Android
LLVM appears to generate calls to exp10 on ARM and bionic does not
define it.
2014-01-03 21:29:40 -08:00
Alex Crichton 726091fea5 Convert some C functions to rust functions
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-30 14:35:55 -08:00
Alex Crichton ab431a20c0 Register new snapshots 2013-12-26 11:30:23 -08:00
Brian Anderson f82246f56d Remove rust_globals.h 2013-12-24 20:09:49 -08:00
Vadim Chugunov e3b37154b0 Stop using C++ exceptions for stack unwinding. 2013-12-24 12:13:42 -08:00
Alex Crichton 9d59e358d9 uv: Suppress a warning by using an absolute path
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-22 22:30:51 -08:00
Alex Crichton 70273bb1d6 Register new snapshots
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-07 23:02:39 -08:00
Alex Crichton 17a951c7bf Remove unused upcalls
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-12-05 16:29:16 -08:00
Alex Crichton 9fbba7b2ee Statically link librustrt to libstd
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-29 18:36:14 -08:00
Luqman Aden 84403eb897 Remove sjlj stuff from rust_upcall and don't pass -Werror to libuv. 2013-11-22 22:04:36 -08:00
Luqman Aden 6820ed4dcf Fix up mingw64 target. 2013-11-22 20:39:58 -05:00
Alex Crichton 68d5510292 Implement more native file I/O
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-19 09:59:21 -08:00
Alex Crichton 508b7b996e Move runtime files to C instead of C++
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-18 21:45:58 -08:00
Alex Crichton e8bf078802 Remove the C++ lock_and_signal type
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-18 20:06:40 -08:00
Alex Crichton 24eb1b445d Implement a native mutex type
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-18 20:06:39 -08:00
Brian Anderson f4c222f7a3 rt: Namespace all C functions under rust_ 2013-11-18 16:17:43 -08:00
Jason Toffaletti 91de538c98 add rust_trylock_little_lock
Try to acquire lock and succeed only if lock is not already held.
Uses TryEnterCriticalSection or pthread_mutex_trylock.
2013-11-13 14:44:50 -08:00
Brian Anderson 6b6f89b0ec rt: Delete more C++ 2013-11-12 06:05:03 -08:00
bors 23746ae990 auto merge of #10403 : poiru/rust/issue-2675, r=alexcrichton
Closes #2675.
2013-11-11 12:06:25 -08:00
Birunthan Mohanathas 36afd60609 Add asserts to check for faililng QueryPerformance* calls in precise_time_ns
Closes #2675.
2013-11-11 21:21:51 +02:00
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