Skip to content

Commit 0eb9d45

Browse files
edg-lpefontana
andauthored
Add option to never have debug names in functions and enable it on ContractExecutor, fix danling temp library file (#794)
Co-authored-by: Pedro Fontana <fontana.pedro93@gmail.com>
1 parent 8faf10f commit 0eb9d45

26 files changed

+110
-47
lines changed

benches/compile_time.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pub fn bench_compile_time(c: &mut Criterion) {
1414
c.bench_with_input(BenchmarkId::new(filename, 1), &program, |b, program| {
1515
b.iter(|| {
1616
let native_context = NativeContext::new();
17-
native_context.compile(program).unwrap();
17+
native_context.compile(program, false).unwrap();
1818
// pass manager internally verifies the MLIR output is correct.
1919
})
2020
});
@@ -29,7 +29,7 @@ pub fn bench_compile_time(c: &mut Criterion) {
2929
for (program, filename) in &programs {
3030
c.bench_with_input(BenchmarkId::new(filename, 1), &program, |b, program| {
3131
b.iter(|| {
32-
native_context.compile(program).unwrap();
32+
native_context.compile(program, false).unwrap();
3333
// pass manager internally verifies the MLIR output is correct.
3434
})
3535
});
@@ -43,7 +43,7 @@ pub fn bench_compile_time(c: &mut Criterion) {
4343
c.bench_with_input(BenchmarkId::new(filename, 1), &program, |b, program| {
4444
b.iter(|| {
4545
let native_context = NativeContext::new();
46-
let module = native_context.compile(black_box(program)).unwrap();
46+
let module = native_context.compile(black_box(program), false).unwrap();
4747
let object = module_to_object(module.module(), OptLevel::None)
4848
.expect("to compile correctly to a object file");
4949
black_box(object)
@@ -60,7 +60,7 @@ pub fn bench_compile_time(c: &mut Criterion) {
6060
for (program, filename) in &programs {
6161
c.bench_with_input(BenchmarkId::new(filename, 1), &program, |b, program| {
6262
b.iter(|| {
63-
let module = native_context.compile(black_box(program)).unwrap();
63+
let module = native_context.compile(black_box(program), false).unwrap();
6464
let object = module_to_object(module.module(), OptLevel::None)
6565
.expect("to compile correctly to a object file");
6666
black_box(object)

benches/libfuncs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn bench_libfuncs(c: &mut Criterion) {
5050
|b, program| {
5151
let native_context = NativeContext::new();
5252
b.iter(|| {
53-
let module = native_context.compile(program).unwrap();
53+
let module = native_context.compile(program, false).unwrap();
5454
// pass manager internally verifies the MLIR output is correct.
5555
let native_executor =
5656
JitNativeExecutor::from_native_module(module, Default::default());
@@ -69,7 +69,7 @@ pub fn bench_libfuncs(c: &mut Criterion) {
6969
program,
7070
|b, program| {
7171
let native_context = NativeContext::new();
72-
let module = native_context.compile(program).unwrap();
72+
let module = native_context.compile(program, false).unwrap();
7373
// pass manager internally verifies the MLIR output is correct.
7474
let native_executor =
7575
JitNativeExecutor::from_native_module(module, Default::default());

examples/easy_api.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn main() {
1515
let sierra_program = cairo_to_sierra(program_path);
1616

1717
// Compile the sierra program into a MLIR module.
18-
let native_program = native_context.compile(&sierra_program).unwrap();
18+
let native_program = native_context.compile(&sierra_program, false).unwrap();
1919

2020
// The parameters of the entry point.
2121
let params = &[JitValue::Felt252(Felt::from_bytes_be_slice(b"user"))];

examples/erc20.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ fn main() {
305305

306306
let native_context = NativeContext::new();
307307

308-
let native_program = native_context.compile(&sierra_program).unwrap();
308+
let native_program = native_context.compile(&sierra_program, false).unwrap();
309309

310310
let entry_point_fn =
311311
find_entry_point_by_idx(&sierra_program, entry_point.function_idx).unwrap();

examples/invoke.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn main() {
2020

2121
let native_context = NativeContext::new();
2222

23-
let native_program = native_context.compile(&sierra_program).unwrap();
23+
let native_program = native_context.compile(&sierra_program, false).unwrap();
2424

2525
// Call the echo function from the contract using the generated wrapper.
2626

examples/starknet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ fn main() {
433433

434434
let native_context = NativeContext::new();
435435

436-
let native_program = native_context.compile(&sierra_program).unwrap();
436+
let native_program = native_context.compile(&sierra_program, false).unwrap();
437437

438438
// Call the echo function from the contract using the generated wrapper.
439439

src/bin/cairo-native-compile.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn main() -> anyhow::Result<()> {
5555
let sierra_program = cairo_to_sierra(&args.path);
5656

5757
// Compile the sierra program into a MLIR module.
58-
let native_module = native_context.compile(&sierra_program).unwrap();
58+
let native_module = native_context.compile(&sierra_program, false).unwrap();
5959

6060
let output_mlir = args
6161
.output_mlir

src/bin/cairo-native-dump.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
3535
let program = load_program(Path::new(&args.input), args.starknet)?;
3636

3737
// Compile the program.
38-
let module = context.compile(&program)?;
38+
let module = context.compile(&program, false)?;
3939

4040
// Write the output.
4141
let output_str = module

src/bin/cairo-native-run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn main() -> anyhow::Result<()> {
7272
let native_context = NativeContext::new();
7373

7474
// Compile the sierra program into a MLIR module.
75-
let native_module = native_context.compile(&sierra_program).unwrap();
75+
let native_module = native_context.compile(&sierra_program, false).unwrap();
7676

7777
let native_executor: NativeExecutor = match args.run_mode {
7878
RunMode::Aot => {

src/bin/cairo-native-stress/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ where
275275
) -> Arc<AotNativeExecutor> {
276276
let native_module = self
277277
.context
278-
.compile(program)
278+
.compile(program, false)
279279
.expect("failed to compile program");
280280

281281
let registry = ProgramRegistry::new(program).expect("failed to get program registry");

0 commit comments

Comments
 (0)