Skip to content

Commit 234724d

Browse files
committed
No STD build
1 parent c56588f commit 234724d

206 files changed

Lines changed: 6063 additions & 2389 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.lock

Lines changed: 750 additions & 361 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,40 +24,44 @@ brimstone_icu_collections = { path = "src/brimstone_icu_collections" }
2424
brimstone_macros = { path = "src/brimstone_macros" }
2525
brimstone_serialized_heap = { path = "src/brimstone_serialized_heap" }
2626

27+
2728
# External Crates
29+
oxc = { version = "0.105.0", features = [] }
30+
parking_lot = "0.12.1"
31+
once_cell = "1.21.3"
32+
2833
allocator-api2 = "0.2.21"
29-
bitflags = "2.1.0"
30-
bumpalo = "3.17.0"
31-
clap = "4.0.29"
32-
criterion = "0.5.1"
33-
half = "2.4.1"
34-
hashbrown = "0.15.2"
35-
indexmap-allocator-api = "2.7.1"
34+
bitflags = "2.10.0"
35+
bumpalo = "3.19.0"
36+
clap = "4.5.53"
37+
criterion = "0.8.1"
38+
half = "2.7.1"
39+
hashbrown = "0.16.1"
40+
indexmap-allocator-api = { git = 'https://github.com/Hans-Halverson/indexmap-allocator-api.git' }
3641
num-bigint = "0.4.3"
3742
num-traits = "0.2.16"
38-
quote = "1.0.32"
39-
rand = "0.8.5"
40-
regex = "1.7.1"
43+
quote = "1.0.42"
44+
rand = "0.9.2"
45+
regex = "1.12.2"
4146
ryu-js = "1.0.2"
4247
serde = "1.0.152"
43-
serde_json = "1.0.91"
48+
serde_json = "1.0.147"
4449
supports-color = "3.0.2"
45-
syn = "2.0.27"
46-
tikv-jemallocator = "0.6"
50+
syn = "2.0.111"
4751
threadpool = "1.8.1"
48-
yaml-rust = "0.4.5"
52+
yaml-rust = "0.4.4"
4953

5054
# ICU4X crates must all be the same version
5155
icu_casemap = "2.1.1"
5256
icu_collator = "2.1.1"
5357
icu_collections = "2.1.1"
5458
icu_locale = "2.1.1"
5559
icu_normalizer = "2.1.1"
56-
icu_properties = "2.1.1"
60+
icu_properties = { version = "2.1.1", features = ["alloc"] }
5761
icu_provider = "2.1.1"
5862
icu_provider_baked = "2.1.1"
5963
icu_provider_adapters = "2.1.1"
60-
zerotrie = "0.2.0"
64+
zerotrie = "0.2.3"
6165
zerovec = "0.11.3"
6266

6367
[workspace.lints.clippy]
@@ -69,7 +73,3 @@ mutable_key_type = "allow"
6973
new_ret_no_self = "allow"
7074
new_without_default = "allow"
7175
too_many_arguments = "allow"
72-
73-
[patch.crates-io]
74-
# A version of indexmap 2.7.1 patched to support the allocator API
75-
indexmap-allocator-api = { git = 'https://github.com/Hans-Halverson/indexmap-allocator-api.git' }

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
# Brimstone
1+
# SO2 JS
2+
> read as `Sulphur Dioxide JS`
23
3-
Brimstone is a JavaScript engine written from scratch in Rust, aiming to have full support for the JavaScript language.
4+
SO2JS is a fork of [Brimstone](https://github.com/Hans-Halverson/brimstone) JS engine which is a JavaScript engine written from scratch in Rust, aiming to have full support for the JavaScript language.
45

5-
Brimstone is a work in progress but already supports almost all of the JavaScript language (>97% of the ECMAScript language in test262). Not ready for use in production.
6+
SO2 [Brimstone](https://github.com/Hans-Halverson/brimstone) Implements the [ECMAScript specification](https://tc39.es/ecma262/). Heavy inspiration is taken from the design of [V8](https://v8.dev/) and SerenityOS's [LibJS](https://github.com/LadybirdBrowser/ladybird). Brimstone chooses to implement almost all components of the engine from scratch with minimal dependencies, with the notable exception of [ICU4X](https://github.com/unicode-org/icu4x).
67

7-
Implements the [ECMAScript specification](https://tc39.es/ecma262/). Heavy inspiration is taken from the design of [V8](https://v8.dev/) and SerenityOS's [LibJS](https://github.com/LadybirdBrowser/ladybird). Brimstone chooses to implement almost all components of the engine from scratch with minimal dependencies, with the notable exception of [ICU4X](https://github.com/unicode-org/icu4x).
8-
9-
Brimstone features:
8+
## Features
109

1110
- Bytecode VM, heavily inspired by the design of V8's Ignition
1211
- Compacting garbage collector, written in *very* unsafe Rust
@@ -33,7 +32,7 @@ Hello world!
3332

3433
## Testing
3534

36-
Brimstone relies heavily on a set of first and third party integration test suites, most notably the official [test262](https://github.com/tc39/test262) test suite. A custom [integration test runner](./tests/README.md) is included. This can be run with:
35+
SO2(Brimstone) relies heavily on a set of first and third party integration test suites, most notably the official [test262](https://github.com/tc39/test262) test suite. A custom [integration test runner](./tests/README.md) is included. This can be run with:
3736

3837
```
3938
cargo brimstone-test

rustfmt.toml

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

src/Cargo.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ clap = { workspace = true, features = ["derive"] }
1515

1616
brimstone_core.workspace = true
1717
brimstone_serialized_heap.workspace = true
18+
parking_lot.workspace = true
19+
once_cell.workspace = true
1820

1921
[dev-dependencies]
2022
criterion.workspace = true
2123

2224
[features]
23-
default = ["alloc_error", "annex_b", "jemalloc"]
25+
default = ["alloc_error", "annex_b"]
2426
# Enable Annex B extensions by default
2527
annex_b = ["brimstone_core/annex_b"]
26-
# Run the garbage collector in stress test mode
27-
gc_stress_test = ["brimstone_core/gc_stress_test"]
2828
# Collect handle use statistics
2929
handle_stats = ["brimstone_core/handle_stats"]
30-
# Use the jemalloc allocator
31-
jemalloc = ["brimstone_core/jemalloc"]
32-
# Do not use the jemalloc allocator, overrides the `jemalloc` feature
33-
no_jemalloc = ["brimstone_core/no_jemalloc"]
3430
# Return allocation errors instead of panicking
3531
alloc_error = ["brimstone_core/alloc_error"]
3632

33+
34+
# Run the garbage collector in stress test mode
35+
gc_stress_test = ["brimstone_core/gc_stress_test"]
36+
3737
[lints]
3838
workspace = true
3939

src/benches/benches.rs

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,10 @@ fn setup_step(file: &str, flags: TestFlags) -> (Context, ParseContext) {
6767
.annex_b(flags.contains(TestFlags::ANNEX_B))
6868
.heap_size(10 * 1024 * 1024)
6969
.build();
70-
let cx = ContextBuilder::new().set_options(Rc::new(options)).build();
70+
let cx = ContextBuilder::new()
71+
.set_options(Rc::new(options))
72+
.build()
73+
.unwrap();
7174
let source = Rc::new(Source::new_from_file(&format!("benches/{file}")).unwrap());
7275
let pcx = ParseContext::new(source);
7376
(cx, pcx)
@@ -202,7 +205,10 @@ fn context_benches(c: &mut Criterion) {
202205
|| {},
203206
|_| {
204207
let options = OptionsBuilder::new().serialized_heap(None).build();
205-
let cx = ContextBuilder::new().set_options(Rc::new(options)).build();
208+
let cx = ContextBuilder::new()
209+
.set_options(Rc::new(options))
210+
.build()
211+
.unwrap();
206212
(cx, ())
207213
},
208214
cleanup2_step,
@@ -217,7 +223,10 @@ fn context_benches(c: &mut Criterion) {
217223
let options = OptionsBuilder::new()
218224
.serialized_heap(Some(serialized_heap))
219225
.build();
220-
let cx = ContextBuilder::new().set_options(Rc::new(options)).build();
226+
let cx = ContextBuilder::new()
227+
.set_options(Rc::new(options))
228+
.build()
229+
.unwrap();
221230
(cx, ())
222231
},
223232
cleanup2_step,

src/brimstone_icu_collections/Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ icu_provider_baked.workspace = true
1515
icu_provider_adapters.workspace = true
1616
zerotrie.workspace = true
1717
zerovec.workspace = true
18+
hashbrown.workspace = true
19+
once_cell.workspace = true
1820

1921
[build-dependencies]
2022
icu_casemap.workspace = true
@@ -27,4 +29,4 @@ icu_provider = { workspace = true, features = ["sync"] }
2729
icu_provider_baked.workspace = true
2830
icu_provider_adapters.workspace = true
2931
zerotrie.workspace = true
30-
zerovec.workspace = true
32+
zerovec.workspace = true

src/brimstone_icu_collections/build.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ fn gen_overrides_file(
164164
let mut file = String::new();
165165

166166
file.push_str("use icu_collections::codepointinvlist::{CodePointInversionList, CodePointInversionListBuilder};
167-
use std::collections::HashMap;
168-
use std::sync::LazyLock;
167+
use hashbrown::HashMap;
168+
use once_cell::sync::Lazy;
169169
170170
fn build_overrides_set() -> CodePointInversionList<'static> {
171171
let mut builder = CodePointInversionListBuilder::new();
@@ -192,15 +192,17 @@ fn build_overrides_map() -> HashMap<char, CodePointInversionList<'static>> {
192192
file.push_str(&format!(" builder.add_char('{closure_char}');\n"));
193193
}
194194

195-
file.push_str(&format!(" map.insert('{overriden_char}', builder.build());\n\n"));
195+
file.push_str(&format!(
196+
" map.insert('{overriden_char}', builder.build());\n\n"
197+
));
196198
}
197199

198200
file.push_str(
199201
" map
200202
}
201203
202-
static OVERRIDES_SET: LazyLock<CodePointInversionList<'static>> = LazyLock::new(build_overrides_set);
203-
static OVERRIDES_MAP: LazyLock<HashMap<char, CodePointInversionList<'static>>> = LazyLock::new(build_overrides_map);
204+
static OVERRIDES_SET: Lazy<CodePointInversionList<'static>> = Lazy::new(build_overrides_set);
205+
static OVERRIDES_MAP: Lazy<HashMap<char, CodePointInversionList<'static>>> = Lazy::new(build_overrides_map);
204206
205207
pub fn has_case_closure_override(c: char) -> bool {
206208
OVERRIDES_SET.contains(c)
@@ -214,10 +216,14 @@ const ALL_CASE_FOLDED_DATA",
214216
);
215217

216218
let inv_list_vec = all_case_folded.get_inversion_list_vec();
217-
file.push_str(&format!(": [u32; {}] = {:?};\n\n", inv_list_vec.len(), inv_list_vec));
219+
file.push_str(&format!(
220+
": [u32; {}] = {:?};\n\n",
221+
inv_list_vec.len(),
222+
inv_list_vec
223+
));
218224

219225
file.push_str(
220-
"static ALL_CASE_FOLDED_SET: LazyLock<CodePointInversionList<'static>> = LazyLock::new(|| {
226+
"static ALL_CASE_FOLDED_SET: Lazy<CodePointInversionList<'static>> = Lazy::new(|| {
221227
CodePointInversionList::try_from_u32_inversion_list_slice(&ALL_CASE_FOLDED_DATA).unwrap()
222228
});
223229
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
#![no_std]
12
include!(concat!(env!("OUT_DIR"), "/generated_icu_collections.rs"));

src/brimstone_macros/src/match_u32.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ struct CharRewriter {
1414

1515
impl CharRewriter {
1616
fn new() -> Self {
17-
Self { char_const_decls: HashMap::new() }
17+
Self {
18+
char_const_decls: HashMap::new(),
19+
}
1820
}
1921

2022
fn add_char_constant(&mut self, lit_char: &syn::LitChar) -> syn::Ident {

0 commit comments

Comments
 (0)