Skip to content

Commit

Permalink
Mark loading the activations table pointer from the vmctx as readonly
Browse files Browse the repository at this point in the history
It is never modified, should produce better codegen when we repeatedly access
it.
  • Loading branch information
fitzgen committed Oct 16, 2024
1 parent ccf2e42 commit bfbe36d
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion crates/cranelift/src/gc/enabled/drc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl DrcCompiler {
let vmctx = builder.ins().global_value(ptr_ty, vmctx);
let activations_table = builder.ins().load(
ptr_ty,
ir::MemFlags::trusted(),
ir::MemFlags::trusted().with_readonly(),
vmctx,
i32::from(func_env.offsets.ptr.vmctx_gc_heap_data()),
);
Expand Down
2 changes: 1 addition & 1 deletion tests/disas/gc/externref-globals.wat
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
;; @0034 brif v6, block5, block2
;;
;; block2:
;; @0034 v8 = load.i64 notrap aligned v0+56
;; @0034 v8 = load.i64 notrap aligned readonly v0+56
;; @0034 v9 = load.i64 notrap aligned v8
;; @0034 v10 = load.i64 notrap aligned v8+8
;; @0034 v11 = icmp eq v9, v10
Expand Down
2 changes: 1 addition & 1 deletion tests/disas/gc/struct-get.wat
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
;; @004e brif v19, block5, block2
;;
;; block2:
;; @004e v21 = load.i64 notrap aligned v0+56
;; @004e v21 = load.i64 notrap aligned readonly v0+56
;; @004e v22 = load.i64 notrap aligned v21
;; @004e v23 = load.i64 notrap aligned v21+8
;; @004e v24 = icmp eq v22, v23
Expand Down
4 changes: 2 additions & 2 deletions tests/disas/ref-func-0.wat
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
;;
;; block2:
;; @008f v10 = global_value.i64 gv3
;; @008f v11 = load.i64 notrap aligned v10+56
;; @008f v11 = load.i64 notrap aligned readonly v10+56
;; @008f v12 = load.i64 notrap aligned v11
;; @008f v13 = load.i64 notrap aligned v11+8
;; @008f v14 = icmp eq v12, v13
Expand Down Expand Up @@ -94,7 +94,7 @@
;;
;; block6:
;; @0091 v46 = global_value.i64 gv3
;; @0091 v47 = load.i64 notrap aligned v46+56
;; @0091 v47 = load.i64 notrap aligned readonly v46+56
;; @0091 v48 = load.i64 notrap aligned v47
;; @0091 v49 = load.i64 notrap aligned v47+8
;; @0091 v50 = icmp eq v48, v49
Expand Down
4 changes: 2 additions & 2 deletions tests/disas/table-get-fixed-size.wat
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
;; @0054 brif v13, block5, block2
;;
;; block2:
;; @0054 v15 = load.i64 notrap aligned v0+56
;; @0054 v15 = load.i64 notrap aligned readonly v0+56
;; @0054 v16 = load.i64 notrap aligned v15
;; @0054 v17 = load.i64 notrap aligned v15+8
;; @0054 v18 = icmp eq v16, v17
Expand Down Expand Up @@ -136,7 +136,7 @@
;; @005b brif v13, block5, block2
;;
;; block2:
;; @005b v15 = load.i64 notrap aligned v0+56
;; @005b v15 = load.i64 notrap aligned readonly v0+56
;; @005b v16 = load.i64 notrap aligned v15
;; @005b v17 = load.i64 notrap aligned v15+8
;; @005b v18 = icmp eq v16, v17
Expand Down
4 changes: 2 additions & 2 deletions tests/disas/table-get.wat
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
;; @0053 brif v14, block5, block2
;;
;; block2:
;; @0053 v16 = load.i64 notrap aligned v0+56
;; @0053 v16 = load.i64 notrap aligned readonly v0+56
;; @0053 v17 = load.i64 notrap aligned v16
;; @0053 v18 = load.i64 notrap aligned v16+8
;; @0053 v19 = icmp eq v17, v18
Expand Down Expand Up @@ -139,7 +139,7 @@
;; @005a brif v14, block5, block2
;;
;; block2:
;; @005a v16 = load.i64 notrap aligned v0+56
;; @005a v16 = load.i64 notrap aligned readonly v0+56
;; @005a v17 = load.i64 notrap aligned v16
;; @005a v18 = load.i64 notrap aligned v16+8
;; @005a v19 = icmp eq v17, v18
Expand Down

0 comments on commit bfbe36d

Please sign in to comment.