1
- use std:: thread;
2
-
3
1
use anyhow:: { anyhow, Result } ;
4
2
use cairo_lang_compiler:: diagnostics:: DiagnosticsError ;
5
3
use indicatif:: HumanDuration ;
@@ -20,7 +18,7 @@ pub fn compile(packages: Vec<PackageId>, ws: &Workspace<'_>) -> Result<()> {
20
18
. collect :: < Vec < _ > > ( ) ;
21
19
22
20
for unit in compilation_units {
23
- compile_unit_isolated ( unit, ws) ?;
21
+ compile_unit ( unit, ws) ?;
24
22
}
25
23
26
24
let elapsed_time = HumanDuration ( ws. config ( ) . elapsed_time ( ) ) ;
@@ -32,25 +30,6 @@ pub fn compile(packages: Vec<PackageId>, ws: &Workspace<'_>) -> Result<()> {
32
30
Ok ( ( ) )
33
31
}
34
32
35
- // FIXME(mkaput): Remove this when Cairo will fix their issue upstream.
36
- // NOTE: This is untested! Compiling such large Cairo files takes horribly long time.
37
- /// Run compiler in a new thread which has significantly increased stack size.
38
- /// The Cairo compiler tends to consume too much stack space in some specific cases:
39
- /// https://github.com/starkware-libs/cairo/issues/3530.
40
- /// It does not seem to consume infinite amounts though, so we try to confine it in arbitrarily
41
- /// chosen big memory chunk.
42
- fn compile_unit_isolated ( unit : CompilationUnit , ws : & Workspace < ' _ > ) -> Result < ( ) > {
43
- thread:: scope ( |s| {
44
- thread:: Builder :: new ( )
45
- . name ( format ! ( "scarb compile {}" , unit. id( ) ) )
46
- . stack_size ( 128 * 1024 * 1024 )
47
- . spawn_scoped ( s, || compile_unit ( unit, ws) )
48
- . expect ( "Failed to spawn compiler thread." )
49
- . join ( )
50
- . expect ( "Compiler thread has panicked." )
51
- } )
52
- }
53
-
54
33
fn compile_unit ( unit : CompilationUnit , ws : & Workspace < ' _ > ) -> Result < ( ) > {
55
34
let package_name = unit. main_package_id . name . clone ( ) ;
56
35
0 commit comments