@@ -66,18 +66,19 @@ pub(crate) fn classify_side_entry_repr(
6666
6767pub ( crate ) fn classify_side_entry_materialization (
6868 materialization : & SsaMaterialization ,
69- ) -> InheritedStateAbiClass {
69+ defining_repr : Option < SsaValueRepr > ,
70+ ) -> Option < InheritedStateAbiClass > {
7071 match materialization {
7172 SsaMaterialization :: Value ( _) => {
72- InheritedStateAbiClass :: Tagged ( SideEntryOwnership :: Borrowed )
73+ defining_repr . map ( |repr| classify_side_entry_repr ( repr , SideEntryOwnership :: Borrowed ) )
7374 }
74- SsaMaterialization :: BoxInt ( _) => InheritedStateAbiClass :: ScalarInt ,
75- SsaMaterialization :: BoxFloat ( _) => InheritedStateAbiClass :: ScalarFloat ,
76- SsaMaterialization :: BoxBool ( _) => InheritedStateAbiClass :: ScalarBool ,
77- SsaMaterialization :: BoxHeapPtr { tag, .. } => InheritedStateAbiClass :: HeapPointer {
75+ SsaMaterialization :: BoxInt ( _) => Some ( InheritedStateAbiClass :: ScalarInt ) ,
76+ SsaMaterialization :: BoxFloat ( _) => Some ( InheritedStateAbiClass :: ScalarFloat ) ,
77+ SsaMaterialization :: BoxBool ( _) => Some ( InheritedStateAbiClass :: ScalarBool ) ,
78+ SsaMaterialization :: BoxHeapPtr { tag, .. } => Some ( InheritedStateAbiClass :: HeapPointer {
7879 tag : * tag,
7980 ownership : SideEntryOwnership :: Owned ,
80- } ,
81+ } ) ,
8182 }
8283}
8384
@@ -104,7 +105,7 @@ impl NativeSideLinkSlot {
104105 self . entry . store ( std:: ptr:: null_mut ( ) , Ordering :: Release ) ;
105106 }
106107
107- pub ( crate ) fn address ( & self ) -> * mut * mut u8 {
108+ pub ( crate ) fn address ( self : & Arc < Self > ) -> * mut * mut u8 {
108109 self . entry . as_ptr ( )
109110 }
110111}
@@ -296,30 +297,54 @@ mod tests {
296297 fn side_entry_abi_classifies_scalar_pointer_tagged_borrowed_and_owned_values ( ) {
297298 let value = SsaValueId :: new ( 7 ) ;
298299 assert_eq ! (
299- classify_side_entry_materialization( & SsaMaterialization :: BoxInt ( value) ) ,
300- InheritedStateAbiClass :: ScalarInt
300+ classify_side_entry_materialization( & SsaMaterialization :: BoxInt ( value) , None ) ,
301+ Some ( InheritedStateAbiClass :: ScalarInt )
301302 ) ;
302303 assert_eq ! (
303- classify_side_entry_materialization( & SsaMaterialization :: BoxFloat ( value) ) ,
304- InheritedStateAbiClass :: ScalarFloat
304+ classify_side_entry_materialization( & SsaMaterialization :: BoxFloat ( value) , None ) ,
305+ Some ( InheritedStateAbiClass :: ScalarFloat )
305306 ) ;
306307 assert_eq ! (
307- classify_side_entry_materialization( & SsaMaterialization :: BoxBool ( value) ) ,
308- InheritedStateAbiClass :: ScalarBool
308+ classify_side_entry_materialization( & SsaMaterialization :: BoxBool ( value) , None ) ,
309+ Some ( InheritedStateAbiClass :: ScalarBool )
309310 ) ;
311+ for ( repr, expected) in [
312+ ( SsaValueRepr :: I64 , InheritedStateAbiClass :: ScalarInt ) ,
313+ ( SsaValueRepr :: F64 , InheritedStateAbiClass :: ScalarFloat ) ,
314+ ( SsaValueRepr :: Bool , InheritedStateAbiClass :: ScalarBool ) ,
315+ (
316+ SsaValueRepr :: HeapPtr ( ValueType :: Array ) ,
317+ InheritedStateAbiClass :: HeapPointer {
318+ tag : ValueType :: Array ,
319+ ownership : SideEntryOwnership :: Borrowed ,
320+ } ,
321+ ) ,
322+ (
323+ SsaValueRepr :: Tagged ,
324+ InheritedStateAbiClass :: Tagged ( SideEntryOwnership :: Borrowed ) ,
325+ ) ,
326+ ] {
327+ assert_eq ! (
328+ classify_side_entry_materialization( & SsaMaterialization :: Value ( value) , Some ( repr) , ) ,
329+ Some ( expected)
330+ ) ;
331+ }
310332 assert_eq ! (
311- classify_side_entry_materialization( & SsaMaterialization :: Value ( value) ) ,
312- InheritedStateAbiClass :: Tagged ( SideEntryOwnership :: Borrowed )
333+ classify_side_entry_materialization( & SsaMaterialization :: Value ( value) , None ) ,
334+ None
313335 ) ;
314336 assert_eq ! (
315- classify_side_entry_materialization( & SsaMaterialization :: BoxHeapPtr {
316- value,
317- tag: ValueType :: String ,
318- } ) ,
319- InheritedStateAbiClass :: HeapPointer {
337+ classify_side_entry_materialization(
338+ & SsaMaterialization :: BoxHeapPtr {
339+ value,
340+ tag: ValueType :: String ,
341+ } ,
342+ None ,
343+ ) ,
344+ Some ( InheritedStateAbiClass :: HeapPointer {
320345 tag: ValueType :: String ,
321346 ownership: SideEntryOwnership :: Owned ,
322- }
347+ } )
323348 ) ;
324349 assert_eq ! (
325350 classify_side_entry_repr(
@@ -341,7 +366,7 @@ mod tests {
341366 }
342367 const DEOPT_STATUS : i32 = 17 ;
343368 const CHILD_STATUS : i32 = 23 ;
344- let slot = Box :: new ( NativeSideLinkSlot :: new ( ) ) ;
369+ let slot = Arc :: new ( NativeSideLinkSlot :: new ( ) ) ;
345370 let child = compile_tail_status_body ( CHILD_STATUS ) . expect ( "tail child should compile" ) ;
346371 let root = compile_tail_side_link_body ( slot. address ( ) as usize , DEOPT_STATUS )
347372 . expect ( "tail root should compile" ) ;
@@ -376,7 +401,7 @@ mod tests {
376401 }
377402 const DEOPT_STATUS : i32 = 29 ;
378403 const CHILD_STATUS : i32 = 31 ;
379- let slot = Box :: new ( NativeSideLinkSlot :: new ( ) ) ;
404+ let slot = Arc :: new ( NativeSideLinkSlot :: new ( ) ) ;
380405 let child =
381406 compile_tail_owned_clear_body ( CHILD_STATUS ) . expect ( "owned child should compile" ) ;
382407 let root = compile_tail_owned_side_link_body ( slot. address ( ) as usize , DEOPT_STATUS )
0 commit comments