Skip to content

Commit cf0d515

Browse files
committed
Relicense fully to Apache-2.0 WITH LLVM-exception.
Large parts of the code in regalloc2 are currently licensed under the Mozilla Public License (MPL) 2.0, because they derive in meaningful ways from the register allocator in IonMonkey, which is part of Firefox. The relevant source files are marked as such, with references to the files in the Firefox source tree. The intent of the regalloc2 project was to port the register allocator from Firefox to use in Cranelift, borrowing good technology and improving on it in the spirit of open source. However, Several use-cases of Cranelift require, or at least strongly prefer, the Apache-2.0 license with the LLVM exception (matching the license of Cranelift itself, and Bytecode Alliance projects generally). While using this license is not strictly necessary for regalloc2 to be usable (The MPL is an excellent open-source license!), relicensing fully under this license to harmonize with the rest of Cranelift and Bytecode Alliance codebases significantly widens possibilities and reduces friction; then regalloc2 is "just another part of Cranelift" and doesn't have to be treated specially. The source in `src/ion/` specifically began as a fairly direct port of the algorithms in the following files in the `mozilla-central` repository (Firefox codebase): * The bulk of the "backtracking allocator" algorithm: * `js/src/jit/BacktrackingAllocator.{cpp,h}` * Helpers and definitions in the surrounding infrastructure: * `js/src/jit/RegisterAllocator.h` * `js/src/jit/RegisterAllocator.cpp` * `js/src/jit/StackSlotAllocator.h` * `js/src/jit/LIR.h` * A few data structure implementations: * `js/src/ds/SplayTree.h` * `js/src/ds/PriorityQueue.h` Subsequent work in improving regalloc2 has caused it to drift from the direct port -- for example, it no longer uses splay trees or the direct port of the priority queue above -- but it is of course very clearly still a derivative work. Analysis of the contributors to these files indicates that we need signoff from the following folks: * Mozilla Corp, for contributions made by Mozilla employees (the majority of the code). Communications with Mozilla (thanks @tschneidereit and @bholley for doing the work here!) indicate that @ekr is able to sign off when ready here. * Andy Wingo, specifically for the work done in [Bug 1620197](https://bugzilla.mozilla.org/show_bug.cgi?id=1620197) and [Bug 1609057](https://bugzilla.mozilla.org/show_bug.cgi?id=1609057) to generalize the stack allocator for a Wasm feature (multiple returns). Additionally, since the initial port, we have had three contributions from @Amanieu: [#9](#9), [#11](#11), [#13](#13). So, if everyone applicable is happy with this relicensing, this PR removes the MPL-2.0 license in `src/ion/` and marks all files as covered under `Apache-2.0 WITH LLVM-exception`. Please let us know if this is OK! Signoffs: - [ ] @ekr, for Mozilla's contributions - [ ] @wingo, for contributions to original code in `mozilla-central` - [ ] @Amanieu, for the three PRs linked above Thanks!
1 parent 57ccaef commit cf0d515

12 files changed

+63
-442
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name = "regalloc2"
33
version = "0.0.1"
44
authors = ["Chris Fallin <[email protected]>", "Mozilla SpiderMonkey Developers"]
55
edition = "2018"
6-
license = "Apache-2.0 WITH LLVM-exception AND MPL-2.0"
6+
license = "Apache-2.0 WITH LLVM-exception"
77
description = "Backtracking register allocator inspired from IonMonkey"
88
repository = "https://github.com/bytecodealliance/regalloc2"
99

README.md

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,8 @@ how the allocator works.
1515

1616
## License
1717

18-
Unless otherwise specified, code in this crate is licensed under the Apache 2.0
19-
License with LLVM Exception. This license text can be found in the file
20-
`LICENSE`.
21-
22-
Files in the `src/ion/` directory are directly ported from original C++ code in
23-
IonMonkey, a part of the Firefox codebase. Parts of `src/lib.rs` are also
24-
definitions that are directly translated from this original code. As a result,
25-
these files are derivative works and are covered by the Mozilla Public License
26-
(MPL) 2.0, as described in license headers in those files. Please see the
27-
notices in relevant files for links to the original IonMonkey source files from
28-
which they have been translated/derived. The MPL text can be found in
29-
`src/ion/LICENSE`.
18+
This crate is licensed under the Apache 2.0 License with LLVM
19+
Exception. This license text can be found in the file `LICENSE`.
3020

3121
Parts of the code are derived from regalloc.rs: in particular,
3222
`src/checker.rs` and `src/domtree.rs`. This crate has the same license

src/ion/LICENSE

Lines changed: 0 additions & 373 deletions
This file was deleted.

src/ion/data_structures.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/*
2-
* The following license applies to this file, which was initially
3-
* derived from the files `js/src/jit/BacktrackingAllocator.h` and
4-
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox:
5-
*
6-
* This Source Code Form is subject to the terms of the Mozilla Public
7-
* License, v. 2.0. If a copy of the MPL was not distributed with this
8-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
2+
* This file was initially derived from the files
3+
* `js/src/jit/BacktrackingAllocator.h` and
4+
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox, and was
5+
* originally licensed under the Mozilla Public License 2.0. We
6+
* subsequently relicensed it to Apache-2.0 WITH LLVM-exception (see
7+
* https://github.com/bytecodealliance/regalloc2/issues/7).
98
*
109
* Since the initial port, the design has been substantially evolved
1110
* and optimized.

src/ion/liveranges.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/*
2-
* The following license applies to this file, which was initially
3-
* derived from the files `js/src/jit/BacktrackingAllocator.h` and
4-
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox:
5-
*
6-
* This Source Code Form is subject to the terms of the Mozilla Public
7-
* License, v. 2.0. If a copy of the MPL was not distributed with this
8-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
2+
* This file was initially derived from the files
3+
* `js/src/jit/BacktrackingAllocator.h` and
4+
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox, and was
5+
* originally licensed under the Mozilla Public License 2.0. We
6+
* subsequently relicensed it to Apache-2.0 WITH LLVM-exception (see
7+
* https://github.com/bytecodealliance/regalloc2/issues/7).
98
*
109
* Since the initial port, the design has been substantially evolved
1110
* and optimized.

src/ion/merge.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/*
2-
* The following license applies to this file, which was initially
3-
* derived from the files `js/src/jit/BacktrackingAllocator.h` and
4-
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox:
5-
*
6-
* This Source Code Form is subject to the terms of the Mozilla Public
7-
* License, v. 2.0. If a copy of the MPL was not distributed with this
8-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
2+
* This file was initially derived from the files
3+
* `js/src/jit/BacktrackingAllocator.h` and
4+
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox, and was
5+
* originally licensed under the Mozilla Public License 2.0. We
6+
* subsequently relicensed it to Apache-2.0 WITH LLVM-exception (see
7+
* https://github.com/bytecodealliance/regalloc2/issues/7).
98
*
109
* Since the initial port, the design has been substantially evolved
1110
* and optimized.

src/ion/mod.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/*
2-
* The following license applies to this file, which was initially
3-
* derived from the files `js/src/jit/BacktrackingAllocator.h` and
4-
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox:
5-
*
6-
* This Source Code Form is subject to the terms of the Mozilla Public
7-
* License, v. 2.0. If a copy of the MPL was not distributed with this
8-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
2+
* This file was initially derived from the files
3+
* `js/src/jit/BacktrackingAllocator.h` and
4+
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox, and was
5+
* originally licensed under the Mozilla Public License 2.0. We
6+
* subsequently relicensed it to Apache-2.0 WITH LLVM-exception (see
7+
* https://github.com/bytecodealliance/regalloc2/issues/7).
98
*
109
* Since the initial port, the design has been substantially evolved
1110
* and optimized.

src/ion/moves.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/*
2-
* The following license applies to this file, which was initially
3-
* derived from the files `js/src/jit/BacktrackingAllocator.h` and
4-
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox:
5-
*
6-
* This Source Code Form is subject to the terms of the Mozilla Public
7-
* License, v. 2.0. If a copy of the MPL was not distributed with this
8-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
2+
* This file was initially derived from the files
3+
* `js/src/jit/BacktrackingAllocator.h` and
4+
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox, and was
5+
* originally licensed under the Mozilla Public License 2.0. We
6+
* subsequently relicensed it to Apache-2.0 WITH LLVM-exception (see
7+
* https://github.com/bytecodealliance/regalloc2/issues/7).
98
*
109
* Since the initial port, the design has been substantially evolved
1110
* and optimized.

src/ion/process.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/*
2-
* The following license applies to this file, which was initially
3-
* derived from the files `js/src/jit/BacktrackingAllocator.h` and
4-
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox:
5-
*
6-
* This Source Code Form is subject to the terms of the Mozilla Public
7-
* License, v. 2.0. If a copy of the MPL was not distributed with this
8-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
2+
* This file was initially derived from the files
3+
* `js/src/jit/BacktrackingAllocator.h` and
4+
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox, and was
5+
* originally licensed under the Mozilla Public License 2.0. We
6+
* subsequently relicensed it to Apache-2.0 WITH LLVM-exception (see
7+
* https://github.com/bytecodealliance/regalloc2/issues/7).
98
*
109
* Since the initial port, the design has been substantially evolved
1110
* and optimized.

src/ion/requirement.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/*
2+
* This file was initially derived from the files
3+
* `js/src/jit/BacktrackingAllocator.h` and
4+
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox, and was
5+
* originally licensed under the Mozilla Public License 2.0. We
6+
* subsequently relicensed it to Apache-2.0 WITH LLVM-exception (see
7+
* https://github.com/bytecodealliance/regalloc2/issues/7).
8+
*
9+
* Since the initial port, the design has been substantially evolved
10+
* and optimized.
11+
*/
12+
113
//! Requirements computation.
214
315
use super::{Env, LiveBundleIndex};

src/ion/spill.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/*
2-
* The following license applies to this file, which was initially
3-
* derived from the files `js/src/jit/BacktrackingAllocator.h` and
4-
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox:
5-
*
6-
* This Source Code Form is subject to the terms of the Mozilla Public
7-
* License, v. 2.0. If a copy of the MPL was not distributed with this
8-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
2+
* This file was initially derived from the files
3+
* `js/src/jit/BacktrackingAllocator.h` and
4+
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox, and was
5+
* originally licensed under the Mozilla Public License 2.0. We
6+
* subsequently relicensed it to Apache-2.0 WITH LLVM-exception (see
7+
* https://github.com/bytecodealliance/regalloc2/issues/7).
98
*
109
* Since the initial port, the design has been substantially evolved
1110
* and optimized.

src/ion/stackmap.rs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/*
2-
* The following license applies to this file, which was initially
3-
* derived from the files `js/src/jit/BacktrackingAllocator.h` and
4-
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox:
5-
*
6-
* This Source Code Form is subject to the terms of the Mozilla Public
7-
* License, v. 2.0. If a copy of the MPL was not distributed with this
8-
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
2+
* This file was initially derived from the files
3+
* `js/src/jit/BacktrackingAllocator.h` and
4+
* `js/src/jit/BacktrackingAllocator.cpp` in Mozilla Firefox, and was
5+
* originally licensed under the Mozilla Public License 2.0. We
6+
* subsequently relicensed it to Apache-2.0 WITH LLVM-exception (see
7+
* https://github.com/bytecodealliance/regalloc2/issues/7).
98
*
109
* Since the initial port, the design has been substantially evolved
1110
* and optimized.

0 commit comments

Comments
 (0)