Skip to content

Commit 9bf3f60

Browse files
committed
Setup a workspace, adjust READMEs
1 parent 91cf50a commit 9bf3f60

15 files changed

+141
-141
lines changed

Cargo.toml

+2-36
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,2 @@
1-
[package]
2-
name = "stacker"
3-
version = "0.1.15"
4-
authors = ["Alex Crichton <[email protected]>", "Simonas Kazlauskas <[email protected]>"]
5-
build = "build.rs"
6-
license = "MIT OR Apache-2.0"
7-
readme = "README.md"
8-
repository = "https://github.com/rust-lang/stacker"
9-
homepage = "https://github.com/rust-lang/stacker"
10-
documentation = "https://docs.rs/stacker/0.1.15"
11-
description = """
12-
A stack growth library useful when implementing deeply recursive algorithms that
13-
may accidentally blow the stack.
14-
"""
15-
16-
[lib]
17-
name = "stacker"
18-
doctest = false
19-
test = false
20-
21-
[dependencies]
22-
cfg-if = "1.0.0"
23-
libc = "0.2.45"
24-
psm = { path = "psm", version = "0.1.7" }
25-
26-
[target.'cfg(windows)'.dependencies.windows-sys]
27-
version = ">=0.34.0, <0.42.0"
28-
features = [
29-
"Win32_System_Memory",
30-
"Win32_System_Threading",
31-
"Win32_Foundation",
32-
]
33-
34-
35-
[build-dependencies]
36-
cc = "1.0.2"
1+
[workspace]
2+
members = ["stacker", "psm"]

README.md

-44
This file was deleted.

README.mkd

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<div align="center">
2+
<h1><code>stacker & psm</code></h1>
3+
</div>
4+
5+
Check out the README for corresponding crates for further information on each crate.
6+
7+
# License
8+
9+
This project is licensed under either of
10+
11+
* [Apache License, Version 2.0](<https://www.apache.org/licenses/LICENSE-2.0>)
12+
* [MIT license](<https://opensource.org/licenses/MIT>)
13+
14+
at your option.
15+
16+
## Contribution
17+
18+
Unless you explicitly state otherwise, any contribution intentionally submitted
19+
for inclusion in this project by you, as defined in the Apache-2.0 license,
20+
shall be dual licensed as above, without any additional terms or conditions.

psm/README.mkd

+32-26
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
1-
# Portable Stack Manipulation
2-
3-
This crate provides very portable functions to control the stack pointer and inspect the properties
4-
of the stack. This crate does not attempt to provide safe abstractions to any operations, the
5-
only goals are correctness, portability and efficiency (in that exact order). As a consequence most
6-
functions you’ll see in this crate are unsafe.
7-
8-
Unless you’re writing a safe abstraction over stack manipulation, this is not the crate you
9-
want. Instead consider one of the safe abstractions over this crate. A good place to look at is
10-
the crates.io’s reverse dependency list.
1+
<div align="center">
2+
<h1><code>psm</code></h1>
3+
<p>
4+
<strong>A portable library of stack introspection and manipulation operations</strong>
5+
</p>
6+
</div>
7+
8+
This crate provides functions to control the stack pointer and inspect the properties of the stack.
9+
This crate does not attempt to provide safe or Rust-idiomatic abstractions to any of the
10+
operations. The only goals are correctness, portability and efficiency (in this exact order). As a
11+
consequence most functions you’ll see in this crate are unsafe and require the caller to maintain a
12+
variety of invariants.
13+
14+
Unless you are writing a safe abstraction over stack manipulation or need extremely precse control
15+
over your stack, this is probably not the crate you want. Instead consider one of the safe
16+
abstractions based on this crate. A good place to look at is the crates.io’s reverse dependency
17+
list.
1118

1219
# Platform support
1320

14-
The following table lists supported targets and architectures with notes on the level of current
15-
support and knowledge about the target. The three columns “Available”, “Tested” and “Callstack”
16-
imply an increasingly high level of support.
21+
The following table lists targets and architectures supported by this crate, alongside the notes on
22+
the current level of support and behaviour. The three columns “Available”, “Tested” and “Callstack”
23+
indicate different degrees of support:
1724

18-
* “Available” basically means that the code builds and the assembly files have been written for the
19-
target;
20-
* “Tested” means that the assembly code has been tested or otherwise verified to be correct. For
21-
most targets it also means that continuous integration is set up;
22-
* “Callstack” means that the assembly code has been written with due care to support unwinding the
23-
stack and displaying the call frames (i.e. `gdb backtrace` works as expected).
25+
* On platforms marked “available” this library builds and contains necessary functionality to
26+
introspect or manipulate the stack (see the `psm_stack_information` and `psm_stack_manipulation`
27+
macros);
28+
* “Tested” platforms have had their implementations tested or otherwise verified to be correct. For
29+
many such targets it also means that we have a continuous integration setup;
30+
* “Callstack” indicates that, in addition to the library being tested, it has been verified
31+
functions based on stack unwinding (e.g. `gdb backtrace`) continue to work correctly.
2432

2533
<table>
34+
2635
<tr>
27-
<th rowspan="1" colspan="2">Target</th>
28-
<th colspan="3">Support</th>
36+
<th rowspan="1" colspan="2">Target</th> <th colspan="3">Support</th>
2937
</tr>
3038
<tr>
3139
<th rowspan="2">Architecture</th>
@@ -510,11 +518,9 @@ The assembly code for loongarch64 has been tested locally with a C caller.
510518

511519
# License
512520

513-
PSM is licensed under either of
521+
`psm` is licensed under either of
514522

515-
* Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
516-
https://www.apache.org/licenses/LICENSE-2.0)
517-
* MIT license ([LICENSE-MIT](LICENSE-MIT) or
518-
https://opensource.org/licenses/MIT)
523+
* [Apache License, Version 2.0](<https://www.apache.org/licenses/LICENSE-2.0>)
524+
* [MIT license](<https://opensource.org/licenses/MIT>)
519525

520526
at your option.

psm/src/lib.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
//! # **P**ortable **S**tack **M**anipulation
2-
//! This crate provides portable functions to control the stack pointer and inspect the properties
3-
//! of the stack. This crate does not attempt to provide safe abstractions to any operations, the
4-
//! only goals are correctness, portability and efficiency (in that exact order). As a consequence
5-
//! most functions you will find in this crate are unsafe.
6-
//!
7-
//! Note, that the stack allocation is left up to the user. Unless you’re writing a safe
8-
//! abstraction over stack manipulation, this is unlikely to be the crate you want. Instead
9-
//! consider one of the safe abstractions over this crate such as `stacker`. Another good place to
10-
//! look at is the crates.io’s reverse dependency list.
11-
1+
#![doc=include_str!("../README.mkd")]
122
#![allow(unused_macros)]
133
#![no_std]
144

stacker/Cargo.toml

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
[package]
2+
name = "stacker"
3+
version = "0.1.15"
4+
authors = ["Alex Crichton <[email protected]>", "Simonas Kazlauskas <[email protected]>"]
5+
build = "build.rs"
6+
license = "MIT OR Apache-2.0"
7+
readme = "README.md"
8+
repository = "https://github.com/rust-lang/stacker"
9+
homepage = "https://github.com/rust-lang/stacker"
10+
documentation = "https://docs.rs/stacker/0.1.15"
11+
description = """
12+
A stack growth library useful when implementing deeply recursive algorithms that
13+
may accidentally blow the stack.
14+
"""
15+
16+
[lib]
17+
name = "stacker"
18+
doctest = false
19+
test = false
20+
21+
[dependencies]
22+
cfg-if = "1.0.0"
23+
libc = "0.2.45"
24+
psm = { path = "../psm", version = "0.1.7" }
25+
26+
[target.'cfg(windows)'.dependencies.windows-sys]
27+
version = ">=0.34.0, <0.42.0"
28+
features = [
29+
"Win32_System_Memory",
30+
"Win32_System_Threading",
31+
"Win32_Foundation",
32+
]
33+
34+
35+
[build-dependencies]
36+
cc = "1.0.2"
File renamed without changes.
File renamed without changes.

stacker/README.mkd

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<div align="center">
2+
<h1><code>stacker</code></h1>
3+
<p>
4+
<strong>A stack-growth library for Rust</strong>
5+
</p>
6+
</div>
7+
8+
9+
`stacker` enables users to annotate fixed points in their programs where the stack may want to grow
10+
larger to accomodate for recursion or other kinds of heavy stack space usage. At each such
11+
annotation, the caller indicates how far away from the end of the stack it's allowed to be, plus
12+
the amount of stack to allocate if the remaining capacity is insufficient.
13+
14+
Once a program has reached the end of its stack, a temporary stack on the heap is allocated and
15+
is switched to for the duration of a closure.
16+
17+
A philosophy behind this crate is to expose a straightforward interface. In case the functionality
18+
provided by this crate aren’t flexible enough for your use-case, check out the `psm` crate upon
19+
which `stacker` is built.
20+
21+
# Examples
22+
23+
```
24+
// Grow the stack if we are within the "red zone" of 32K, and if we allocate
25+
// a new stack allocate an additional 1MB of stack space.
26+
//
27+
// If we're already within bounds, the provided closure will run on the current stack.
28+
stacker::maybe_grow(32 * 1024, 1024 * 1024, || {
29+
// guaranteed to have at least 32K of stack available to use.
30+
});
31+
```
32+
33+
## Platform Support
34+
35+
This library currently uses `psm` for its cross platform capabilities, with a notable exception of
36+
Windows, which uses an implementation based on Fibers. See the documentation of psm for the table
37+
of supported platforms.
38+
39+
On all unsupported platforms this library is a noop. It should compile and run, but it won't
40+
actually grow the stack and code will continue to hit the guard pages typically in place.
41+
42+
# License
43+
44+
`stacker` is licensed under either of
45+
46+
* [Apache License, Version 2.0](<https://www.apache.org/licenses/LICENSE-2.0>)
47+
* [MIT license](<https://opensource.org/licenses/MIT>)
48+
49+
at your option.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/lib.rs renamed to stacker/src/lib.rs

+1-24
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,4 @@
1-
//! A library to help grow the stack when it runs out of space.
2-
//!
3-
//! This is an implementation of manually instrumented segmented stacks where points in a program's
4-
//! control flow are annotated with "maybe grow the stack here". Each point of annotation indicates
5-
//! how far away from the end of the stack it's allowed to be, plus the amount of stack to allocate
6-
//! if it does reach the end.
7-
//!
8-
//! Once a program has reached the end of its stack, a temporary stack on the heap is allocated and
9-
//! is switched to for the duration of a closure.
10-
//!
11-
//! For a set of lower-level primitives, consider the `psm` crate.
12-
//!
13-
//! # Examples
14-
//!
15-
//! ```
16-
//! // Grow the stack if we are within the "red zone" of 32K, and if we allocate
17-
//! // a new stack allocate 1MB of stack space.
18-
//! //
19-
//! // If we're already in bounds, just run the provided closure on current stack.
20-
//! stacker::maybe_grow(32 * 1024, 1024 * 1024, || {
21-
//! // guaranteed to have at least 32K of stack
22-
//! });
23-
//! ```
24-
1+
#![doc=include_str!("../README.mkd")]
252
#![allow(improper_ctypes)]
263

274
#[macro_use]
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)