Skip to content

Lots of commits related to I/O and the scheduler #6046

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

Merged
merged 62 commits into from
May 3, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
e47ee77
wip
brson Apr 19, 2013
6a5c4f6
core::rt: Just some poking at the I/O docs
brson Apr 20, 2013
1f97e6d
rt: Add rust_dbg_next_port for generating test port numbers
brson Apr 20, 2013
744ba62
core::rt: Add a test mod and put run_in_newsched_task there
brson Apr 20, 2013
d24a3a4
core::rt: Use generated port numbers in tests
brson Apr 20, 2013
eac629b
core::rt: Unignore some networking tests
brson Apr 20, 2013
1a7561b
core::rt: Remove redundant copy of run_in_newsched_task
brson Apr 20, 2013
e564fc7
core::rt: Don't directly create scheduler types in I/O tests
brson Apr 20, 2013
a11c032
core::rt: Fix a broken uvio test
brson Apr 20, 2013
6e17202
core::rt: Add `next_test_ip4` for generating test addresses
brson Apr 20, 2013
bcb3cfb
core::rt: Improve docs for run_in_newsched_task testing function
brson Apr 20, 2013
d818ea8
core::rt: Listener constructors are called and return a
brson Apr 20, 2013
00474c1
core: Ignore two long-running tests
brson Apr 20, 2013
fa478f5
core: Speed up a test case
brson Apr 20, 2013
4eff313
core::rt:: Implement Reader/Writer for MemReader/MemWriter
brson Apr 21, 2013
f9069ba
core::rt: Add LocalServices for thread-local language services
brson Apr 21, 2013
2fe118b
rt: Don't make memory_region depend on rust_env
brson Apr 22, 2013
d7f5e43
core::rt: Add the local heap to newsched tasks
brson Apr 22, 2013
d0786fd
core::rt Wire up task-local storage to the new scheduler
brson Apr 22, 2013
e5d21b9
core::rt: Make I/O constructors return Option instead of Result
brson Apr 22, 2013
6644a03
core::rt: Move the definition of Listener to rt::io
brson Apr 22, 2013
fe13b86
Make conditions public. #6009
brson Apr 22, 2013
5fbb094
core::rt: Add implementations of Reader, Writer, and Listener for Option
brson Apr 22, 2013
42c0f88
core::rt: Add unwinding to newsched tasks
brson Apr 23, 2013
a292d51
mk: Pass CFLAGS to the uv build
brson Apr 23, 2013
8a2f9ca
core::rt: Fix a use after free in uv 'write'
brson Apr 23, 2013
f4af40a
mk: core has another level of directories with rt/io/net
brson Apr 23, 2013
2a819ae
core::rt: Tasks to not require an unwinder
brson Apr 23, 2013
e944c7d
Merge remote-tracking branch 'brson/io'
brson Apr 23, 2013
6373861
core: Convert reinterpret_cast to transmute in TLS. #6039
brson Apr 24, 2013
c0e734d
core::rt: Add more I/O docs
brson Apr 24, 2013
354460e
Tidy
brson Apr 24, 2013
34f7255
mk: reorganize doc build to fix dependencies. #6042
brson Apr 24, 2013
1962803
core: Warning police
brson Apr 24, 2013
08659f5
core: Turn off rtdebug logging
brson Apr 24, 2013
436657b
Rename cleanup_task_local_map_ to cleanup_task_local_map_extern_cb
brson Apr 24, 2013
28ab152
Merge remote-tracking branch 'brson/io'
brson Apr 25, 2013
abc49fd
rt: abort doesn't take an argument
brson Apr 25, 2013
6818e24
core: Turn off the local heap in newsched in stage0 to work around wi…
brson Apr 29, 2013
c2b8f98
librustc: Fix drop finalizer not running for newtype structs.
luqmana Apr 30, 2013
4a4646f
Merge remote-tracking branch 'brson/io'
brson Apr 30, 2013
9847428
mk: Fix pdf build
brson May 1, 2013
c64471a
Add trait object field types to back/abi.rs, and use them
Sodel-the-Vociferous May 1, 2013
6487cb2
Explain that the source code was generated by this script
May 2, 2013
18c46b8
The following code was generated by "src/etc/unicode.py"
May 2, 2013
35b91e2
Use static strings
youknowone May 2, 2013
7aa10e6
make link_args use spaces as separators
thestinger May 2, 2013
b698884
auto merge of #6125 : luqmana/rust/newtype-drop, r=pcwalton
bors May 2, 2013
544ac62
Convert most of rust_run_program.cpp to rust (issue #2674).
Apr 30, 2013
23e97ae
Remove errant trailing whitespace.
May 1, 2013
ec9c7c3
auto merge of #6184 : kud1ing/rust/master, r=sanxiyn
bors May 2, 2013
cce97ab
Add test for drop for newtype structs.
luqmana May 2, 2013
cdf604f
auto merge of #6193 : youknowone/rust/static-string, r=sanxiyn
bors May 2, 2013
bd979c1
Fix some issues with test_destroy_actually_kills:
May 2, 2013
ba84251
auto merge of #6197 : graydon/rust/re-xfail, r=graydon
bors May 2, 2013
31599fe
auto merge of #6172 : Sodel-the-Vociferous/rust/rm_trt_obj_magic_nums…
bors May 2, 2013
79a2b2e
auto merge of #6192 : thestinger/rust/link_args, r=catamorphism
bors May 2, 2013
73733c9
auto merge of #6195 : luqmana/rust/newtype-drop, r=catamorphism
bors May 3, 2013
db6a62c
rustc: Drop the visitor object from the visitor glue
brson May 3, 2013
f8dffc6
core: Wire up the unwinder to newsched again
brson May 3, 2013
baa1c18
auto merge of #6140 : Dretch/rust/run-with-rust, r=brson
bors May 3, 2013
6c478c7
Merge remote-tracking branch 'brson/io' into incoming
brson May 3, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ $(foreach target,$(CFG_TARGET_TRIPLES),\

CORELIB_CRATE := $(S)src/libcore/core.rc
CORELIB_INPUTS := $(wildcard $(addprefix $(S)src/libcore/, \
core.rc *.rs */*.rs */*/*rs))
core.rc *.rs */*.rs */*/*rs */*/*/*rs))

######################################################################
# Standard library variables
Expand Down
74 changes: 35 additions & 39 deletions mk/docs.mk
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,8 @@ DOCS :=


######################################################################
# Pandoc (reference-manual related)
# Docs, from pandoc, rustdoc (which runs pandoc), and node
######################################################################
ifeq ($(CFG_PANDOC),)
$(info cfg: no pandoc found, omitting doc/rust.pdf)
else

ifeq ($(CFG_NODE),)
$(info cfg: no node found, omitting doc/tutorial.html)
else

doc/rust.css: rust.css
@$(call E, cp: $@)
Expand All @@ -34,6 +27,18 @@ doc/manual.css: manual.css
@$(call E, cp: $@)
$(Q)cp -a $< $@ 2> /dev/null

ifeq ($(CFG_PANDOC),)
$(info cfg: no pandoc found, omitting docs)
NO_DOCS = 1
endif

ifeq ($(CFG_NODE),)
$(info cfg: no node found, omitting docs)
NO_DOCS = 1
endif

ifneq ($(NO_DOCS),1)

DOCS += doc/rust.html
doc/rust.html: rust.md doc/version_info.html doc/rust.css doc/manual.css
@$(call E, pandoc: $@)
Expand All @@ -47,19 +52,8 @@ doc/rust.html: rust.md doc/version_info.html doc/rust.css doc/manual.css
--css=manual.css \
--include-before-body=doc/version_info.html \
--output=$@
endif

ifeq ($(CFG_PDFLATEX),)
$(info cfg: no pdflatex found, omitting doc/rust.pdf)
else
ifeq ($(CFG_XETEX),)
$(info cfg: no xetex found, disabling doc/rust.pdf)
else
ifeq ($(CFG_LUATEX),)
$(info cfg: lacking luatex, disabling pdflatex)
else

DOCS += doc/rust.pdf
DOCS += doc/rust.tex
doc/rust.tex: rust.md doc/version.md
@$(call E, pandoc: $@)
$(Q)$(CFG_NODE) $(S)doc/prep.js $< | \
Expand All @@ -70,17 +64,6 @@ doc/rust.tex: rust.md doc/version.md
--from=markdown --to=latex \
--output=$@

doc/rust.pdf: doc/rust.tex
@$(call E, pdflatex: $@)
$(Q)$(CFG_PDFLATEX) \
-interaction=batchmode \
-output-directory=doc \
$<

endif
endif
endif

DOCS += doc/rustpkg.html
doc/rustpkg.html: rustpkg.md doc/version_info.html doc/rust.css doc/manual.css
@$(call E, pandoc: $@)
Expand All @@ -95,13 +78,6 @@ doc/rustpkg.html: rustpkg.md doc/version_info.html doc/rust.css doc/manual.css
--include-before-body=doc/version_info.html \
--output=$@

######################################################################
# Node (tutorial related)
######################################################################
ifeq ($(CFG_NODE),)
$(info cfg: no node found, omitting doc/tutorial.html)
else

DOCS += doc/tutorial.html
doc/tutorial.html: tutorial.md doc/version_info.html doc/rust.css
@$(call E, pandoc: $@)
Expand Down Expand Up @@ -153,9 +129,29 @@ doc/tutorial-tasks.html: tutorial-tasks.md doc/version_info.html doc/rust.css
--include-before-body=doc/version_info.html \
--output=$@

ifeq ($(CFG_PDFLATEX),)
$(info cfg: no pdflatex found, omitting doc/rust.pdf)
else
ifeq ($(CFG_XETEX),)
$(info cfg: no xetex found, disabling doc/rust.pdf)
else
ifeq ($(CFG_LUATEX),)
$(info cfg: lacking luatex, disabling pdflatex)
else

DOCS += doc/rust.pdf
doc/rust.pdf: doc/rust.tex
@$(call E, pdflatex: $@)
$(Q)$(CFG_PDFLATEX) \
-interaction=batchmode \
-output-directory=doc \
$<

endif
endif
endif
endif

endif # No pandoc / node

######################################################################
# LLnextgen (grammar analysis from refman)
Expand Down
4 changes: 4 additions & 0 deletions src/etc/unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ def emit_decomp_module(f, canon, compat):
rf = open(r, "w")

(canon_decomp, compat_decomp, gencats) = load_unicode_data("UnicodeData.txt")

# Explain that the source code was generated by this script.
rf.write('// The following code was generated by "src/etc/unicode.py"\n\n')

emit_property_module(rf, "general_category", gencats)

#emit_decomp_module(rf, canon_decomp, compat_decomp)
Expand Down
23 changes: 23 additions & 0 deletions src/libcore/condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,4 +192,27 @@ mod test {

assert!(trapped);
}

// Issue #6009
mod m {
condition! {
sadness: int -> int;
}

mod n {
use super::sadness;

#[test]
fn test_conditions_are_public() {
let mut trapped = false;
do sadness::cond.trap(|_| {
trapped = true;
0
}).in {
sadness::cond.raise(0);
}
assert!(trapped);
}
}
}
}
3 changes: 3 additions & 0 deletions src/libcore/core.rc
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ pub mod linkhack {
}
}

// Internal macros
mod macros;

/* The Prelude. */

pub mod prelude;
Expand Down
131 changes: 127 additions & 4 deletions src/libcore/libc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,12 +582,16 @@ pub mod types {

pub type LPWSTR = *mut WCHAR;
pub type LPSTR = *mut CHAR;
pub type LPTSTR = *mut CHAR;

// Not really, but opaque to us.
pub type LPSECURITY_ATTRIBUTES = LPVOID;

pub type LPVOID = *mut c_void;
pub type LPBYTE = *mut BYTE;
pub type LPWORD = *mut WORD;
pub type LPDWORD = *mut DWORD;
pub type LPHANDLE = *mut HANDLE;

pub type LRESULT = LONG_PTR;
pub type PBOOL = *mut BOOL;
Expand All @@ -596,6 +600,36 @@ pub mod types {

pub type time64_t = i64;
pub type int64 = i64;

pub struct STARTUPINFO {
cb: DWORD,
lpReserved: LPTSTR,
lpDesktop: LPTSTR,
lpTitle: LPTSTR,
dwX: DWORD,
dwY: DWORD,
dwXSize: DWORD,
dwYSize: DWORD,
dwXCountChars: DWORD,
dwYCountCharts: DWORD,
dwFillAttribute: DWORD,
dwFlags: DWORD,
wShowWindow: WORD,
cbReserved2: WORD,
lpReserved2: LPBYTE,
hStdInput: HANDLE,
hStdOutput: HANDLE,
hStdError: HANDLE
}
pub type LPSTARTUPINFO = *mut STARTUPINFO;

pub struct PROCESS_INFORMATION {
hProcess: HANDLE,
hThread: HANDLE,
dwProcessId: DWORD,
dwThreadId: DWORD
}
pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
}
}
}
Expand Down Expand Up @@ -848,13 +882,62 @@ pub mod consts {
pub mod bsd44 {
}
pub mod extra {
use libc::types::os::arch::extra::{DWORD, BOOL};

pub static TRUE : BOOL = 1;
pub static FALSE : BOOL = 0;

pub static O_TEXT : int = 16384;
pub static O_BINARY : int = 32768;
pub static O_NOINHERIT: int = 128;

pub static ERROR_SUCCESS : int = 0;
pub static ERROR_INSUFFICIENT_BUFFER : int = 122;
pub static INVALID_HANDLE_VALUE: int = -1;

pub static DELETE : DWORD = 0x00010000;
pub static READ_CONTROL : DWORD = 0x00020000;
pub static SYNCHRONIZE : DWORD = 0x00100000;
pub static WRITE_DAC : DWORD = 0x00040000;
pub static WRITE_OWNER : DWORD = 0x00080000;

pub static PROCESS_CREATE_PROCESS : DWORD = 0x0080;
pub static PROCESS_CREATE_THREAD : DWORD = 0x0002;
pub static PROCESS_DUP_HANDLE : DWORD = 0x0040;
pub static PROCESS_QUERY_INFORMATION : DWORD = 0x0400;
pub static PROCESS_QUERY_LIMITED_INFORMATION : DWORD = 0x1000;
pub static PROCESS_SET_INFORMATION : DWORD = 0x0200;
pub static PROCESS_SET_QUOTA : DWORD = 0x0100;
pub static PROCESS_SUSPEND_RESUME : DWORD = 0x0800;
pub static PROCESS_TERMINATE : DWORD = 0x0001;
pub static PROCESS_VM_OPERATION : DWORD = 0x0008;
pub static PROCESS_VM_READ : DWORD = 0x0010;
pub static PROCESS_VM_WRITE : DWORD = 0x0020;

pub static STARTF_FORCEONFEEDBACK : DWORD = 0x00000040;
pub static STARTF_FORCEOFFFEEDBACK : DWORD = 0x00000080;
pub static STARTF_PREVENTPINNING : DWORD = 0x00002000;
pub static STARTF_RUNFULLSCREEN : DWORD = 0x00000020;
pub static STARTF_TITLEISAPPID : DWORD = 0x00001000;
pub static STARTF_TITLEISLINKNAME : DWORD = 0x00000800;
pub static STARTF_USECOUNTCHARS : DWORD = 0x00000008;
pub static STARTF_USEFILLATTRIBUTE : DWORD = 0x00000010;
pub static STARTF_USEHOTKEY : DWORD = 0x00000200;
pub static STARTF_USEPOSITION : DWORD = 0x00000004;
pub static STARTF_USESHOWWINDOW : DWORD = 0x00000001;
pub static STARTF_USESIZE : DWORD = 0x00000002;
pub static STARTF_USESTDHANDLES : DWORD = 0x00000100;

pub static WAIT_ABANDONED : DWORD = 0x00000080;
pub static WAIT_OBJECT_0 : DWORD = 0x00000000;
pub static WAIT_TIMEOUT : DWORD = 0x00000102;
pub static WAIT_FAILED : DWORD = -1;

pub static DUPLICATE_CLOSE_SOURCE : DWORD = 0x00000001;
pub static DUPLICATE_SAME_ACCESS : DWORD = 0x00000002;

pub static INFINITE : DWORD = -1;
pub static STILL_ACTIVE : DWORD = 259;
}
}

Expand Down Expand Up @@ -1751,12 +1834,24 @@ pub mod funcs {

unsafe fn sysctlnametomib(name: *c_char, mibp: *mut c_int,
sizep: *mut size_t) -> c_int;

unsafe fn getdtablesize() -> c_int;
}
}


#[cfg(target_os = "linux")]
#[cfg(target_os = "android")]
pub mod bsd44 {
use libc::types::os::arch::c95::{c_int};

#[abi = "cdecl"]
pub extern {
unsafe fn getdtablesize() -> c_int;
}
}


#[cfg(target_os = "win32")]
pub mod bsd44 {
}
Expand Down Expand Up @@ -1790,9 +1885,11 @@ pub mod funcs {
pub mod kernel32 {
use libc::types::os::arch::c95::{c_uint};
use libc::types::os::arch::extra::{BOOL, DWORD, HMODULE};
use libc::types::os::arch::extra::{LPCWSTR, LPWSTR, LPTCH};
use libc::types::os::arch::extra::{LPSECURITY_ATTRIBUTES};
use libc::types::os::arch::extra::{HANDLE};
use libc::types::os::arch::extra::{LPCWSTR, LPWSTR, LPCTSTR,
LPTSTR, LPTCH, LPDWORD, LPVOID};
use libc::types::os::arch::extra::{LPSECURITY_ATTRIBUTES, LPSTARTUPINFO,
LPPROCESS_INFORMATION};
use libc::types::os::arch::extra::{HANDLE, LPHANDLE};

#[abi = "stdcall"]
pub extern "stdcall" {
Expand Down Expand Up @@ -1829,19 +1926,45 @@ pub mod funcs {
findFileData: HANDLE)
-> BOOL;
unsafe fn FindClose(findFile: HANDLE) -> BOOL;
unsafe fn DuplicateHandle(hSourceProcessHandle: HANDLE,
hSourceHandle: HANDLE,
hTargetProcessHandle: HANDLE,
lpTargetHandle: LPHANDLE,
dwDesiredAccess: DWORD,
bInheritHandle: BOOL,
dwOptions: DWORD) -> BOOL;
unsafe fn CloseHandle(hObject: HANDLE) -> BOOL;
unsafe fn OpenProcess(dwDesiredAccess: DWORD,
bInheritHandle: BOOL,
dwProcessId: DWORD) -> HANDLE;
unsafe fn GetCurrentProcess() -> HANDLE;
unsafe fn CreateProcessA(lpApplicationName: LPCTSTR,
lpCommandLine: LPTSTR,
lpProcessAttributes: LPSECURITY_ATTRIBUTES,
lpThreadAttributes: LPSECURITY_ATTRIBUTES,
bInheritHandles: BOOL,
dwCreationFlags: DWORD,
lpEnvironment: LPVOID,
lpCurrentDirectory: LPCTSTR,
lpStartupInfo: LPSTARTUPINFO,
lpProcessInformation: LPPROCESS_INFORMATION) -> BOOL;
unsafe fn WaitForSingleObject(hHandle: HANDLE, dwMilliseconds: DWORD) -> DWORD;
unsafe fn TerminateProcess(hProcess: HANDLE, uExitCode: c_uint) -> BOOL;
unsafe fn GetExitCodeProcess(hProcess: HANDLE, lpExitCode: LPDWORD) -> BOOL;
}
}

pub mod msvcrt {
use libc::types::os::arch::c95::c_int;
use libc::types::os::arch::c95::{c_int, c_long};

#[abi = "cdecl"]
#[nolink]
pub extern {
#[link_name = "_commit"]
unsafe fn commit(fd: c_int) -> c_int;

#[link_name = "_get_osfhandle"]
unsafe fn get_osfhandle(fd: c_int) -> c_long;
}
}
}
Expand Down
Loading