Skip to content

Commit bff10fe

Browse files
committed
rename BoundsCheck variants
1 parent 7abc758 commit bff10fe

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

crates/cranelift/src/bounds_checks.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ pub enum BoundsCheck {
4444
/// Check that this one access in particular is in bounds:
4545
///
4646
/// ```ignore
47-
/// index + offset + access_size <= gc_heap_bound
47+
/// index + offset + access_size <= bound
4848
/// ```
49-
Field { offset: u32, access_size: u8 },
49+
StaticOffset { offset: u32, access_size: u8 },
5050

5151
/// Assuming the precondition `offset + access_size <= object_size`, check
5252
/// that this whole object is in bounds:
@@ -55,7 +55,7 @@ pub enum BoundsCheck {
5555
/// index + object_size <= bound
5656
/// ```
5757
#[cfg(feature = "gc")]
58-
StaticWholeObject {
58+
StaticObjectField {
5959
offset: u32,
6060
access_size: u8,
6161
object_size: u32,
@@ -66,7 +66,7 @@ pub enum BoundsCheck {
6666
/// It is *your* responsibility to ensure that the `offset + access_size <=
6767
/// object_size` precondition holds.
6868
#[cfg(feature = "gc")]
69-
DynamicWholeObject {
69+
DynamicObjectField {
7070
offset: ir::Value,
7171
object_size: ir::Value,
7272
},
@@ -87,13 +87,13 @@ pub fn bounds_check_and_compute_addr(
8787
trap: ir::TrapCode,
8888
) -> Reachability<ir::Value> {
8989
match bounds_check {
90-
BoundsCheck::Field {
90+
BoundsCheck::StaticOffset {
9191
offset,
9292
access_size,
9393
} => bounds_check_field_access(builder, env, heap, index, offset, access_size, trap),
9494

9595
#[cfg(feature = "gc")]
96-
BoundsCheck::StaticWholeObject {
96+
BoundsCheck::StaticObjectField {
9797
offset,
9898
access_size,
9999
object_size,
@@ -131,7 +131,7 @@ pub fn bounds_check_and_compute_addr(
131131
// a pointer to just after the object, and then reverse offset from that
132132
// to get the pointer to the field being accessed.
133133
#[cfg(feature = "gc")]
134-
BoundsCheck::DynamicWholeObject {
134+
BoundsCheck::DynamicObjectField {
135135
offset,
136136
object_size,
137137
} => {

crates/cranelift/src/func_environ/gc/enabled.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ pub fn translate_struct_get(
328328
let field_addr = func_env.prepare_gc_ref_access(
329329
builder,
330330
struct_ref,
331-
BoundsCheck::StaticWholeObject {
331+
BoundsCheck::StaticObjectField {
332332
offset: field_offset,
333333
access_size: u8::try_from(field_size).unwrap(),
334334
object_size: struct_size,
@@ -375,7 +375,7 @@ pub fn translate_struct_set(
375375
let field_addr = func_env.prepare_gc_ref_access(
376376
builder,
377377
struct_ref,
378-
BoundsCheck::StaticWholeObject {
378+
BoundsCheck::StaticObjectField {
379379
offset: field_offset,
380380
access_size: u8::try_from(field_size).unwrap(),
381381
object_size: struct_size,
@@ -643,7 +643,7 @@ pub fn translate_array_fill(
643643
let elem_addr = func_env.prepare_gc_ref_access(
644644
builder,
645645
array_ref,
646-
BoundsCheck::DynamicWholeObject {
646+
BoundsCheck::DynamicObjectField {
647647
offset: obj_offset,
648648
object_size: obj_size,
649649
},
@@ -691,7 +691,7 @@ pub fn translate_array_len(
691691
array_ref,
692692
// Note: We can't bounds check the whole array object's size because we
693693
// don't know its length yet. Chicken and egg problem.
694-
BoundsCheck::Field {
694+
BoundsCheck::StaticOffset {
695695
offset: len_offset,
696696
access_size: u8::try_from(ir::types::I32.bytes()).unwrap(),
697697
},
@@ -825,7 +825,7 @@ fn array_elem_addr(
825825
func_env.prepare_gc_ref_access(
826826
builder,
827827
array_ref,
828-
BoundsCheck::DynamicWholeObject {
828+
BoundsCheck::DynamicObjectField {
829829
offset: offset_in_array,
830830
object_size: obj_size,
831831
},
@@ -999,7 +999,7 @@ pub fn translate_ref_test(
999999
let kind_addr = func_env.prepare_gc_ref_access(
10001000
builder,
10011001
val,
1002-
BoundsCheck::StaticWholeObject {
1002+
BoundsCheck::StaticObjectField {
10031003
offset: wasmtime_environ::VM_GC_HEADER_KIND_OFFSET,
10041004
access_size: wasmtime_environ::VM_GC_KIND_SIZE,
10051005
object_size: wasmtime_environ::VM_GC_HEADER_SIZE,
@@ -1051,7 +1051,7 @@ pub fn translate_ref_test(
10511051
let ty_addr = func_env.prepare_gc_ref_access(
10521052
builder,
10531053
val,
1054-
BoundsCheck::Field {
1054+
BoundsCheck::StaticOffset {
10551055
offset: wasmtime_environ::VM_GC_HEADER_TYPE_INDEX_OFFSET,
10561056
access_size: func_env.offsets.size_of_vmshared_type_index(),
10571057
},

crates/cranelift/src/func_environ/gc/enabled/drc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl DrcCompiler {
3232
let pointer = func_env.prepare_gc_ref_access(
3333
builder,
3434
gc_ref,
35-
BoundsCheck::Field {
35+
BoundsCheck::StaticOffset {
3636
offset,
3737
access_size: u8::try_from(ir::types::I64.bytes()).unwrap(),
3838
},
@@ -57,7 +57,7 @@ impl DrcCompiler {
5757
let pointer = func_env.prepare_gc_ref_access(
5858
builder,
5959
gc_ref,
60-
BoundsCheck::Field {
60+
BoundsCheck::StaticOffset {
6161
offset,
6262
access_size: u8::try_from(ir::types::I64.bytes()).unwrap(),
6363
},

crates/cranelift/src/translate/code_translator.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
//! <https://github.com/bytecodealliance/cranelift/pull/1236>
7272
//! ("Relax verification to allow I8X16 to act as a default vector type")
7373
74-
use crate::bounds_checks::bounds_check_and_compute_addr;
74+
use crate::bounds_checks::{bounds_check_and_compute_addr, BoundsCheck};
7575
use crate::func_environ::{Extension, FuncEnvironment};
7676
use crate::translate::environ::{GlobalVariable, StructFieldsVec};
7777
use crate::translate::state::{ControlStackFrame, ElseData, FuncTranslationState};
@@ -3207,7 +3207,7 @@ fn prepare_addr(
32073207
environ,
32083208
&heap,
32093209
index,
3210-
crate::bounds_checks::BoundsCheck::Field {
3210+
BoundsCheck::StaticOffset {
32113211
offset,
32123212
access_size,
32133213
},
@@ -3255,7 +3255,7 @@ fn prepare_addr(
32553255
environ,
32563256
&heap,
32573257
adjusted_index,
3258-
crate::bounds_checks::BoundsCheck::Field {
3258+
BoundsCheck::StaticOffset {
32593259
offset: 0,
32603260
access_size,
32613261
},

0 commit comments

Comments
 (0)