@@ -25,11 +25,49 @@ impl Default for record {
2525 }
2626 }
2727}
28- impl ByteRepr for record { }
29- #[ derive( ) ]
30- pub union anon_0 {
31- pub h : Value < record > ,
32- pub raw_ : Value < Box < [ u8 ] > > ,
28+ impl ByteRepr for record {
29+ fn byte_size ( ) -> usize {
30+ 16
31+ }
32+ fn to_bytes ( & self , buf : & mut [ u8 ] ) {
33+ ( * self . code . borrow ( ) ) . to_bytes ( & mut buf[ 0 ..2 ] ) ;
34+ ( * self . lo . borrow ( ) ) . to_bytes ( & mut buf[ 2 ..4 ] ) ;
35+ ( * self . hi . borrow ( ) ) . to_bytes ( & mut buf[ 4 ..8 ] ) ;
36+ ( * self . pad . borrow ( ) ) . to_bytes ( & mut buf[ 8 ..16 ] ) ;
37+ }
38+ fn from_bytes ( buf : & [ u8 ] ) -> Self {
39+ Self {
40+ code : Rc :: new ( RefCell :: new ( <u16 >:: from_bytes ( & buf[ 0 ..2 ] ) ) ) ,
41+ lo : Rc :: new ( RefCell :: new ( <u16 >:: from_bytes ( & buf[ 2 ..4 ] ) ) ) ,
42+ hi : Rc :: new ( RefCell :: new ( <u32 >:: from_bytes ( & buf[ 4 ..8 ] ) ) ) ,
43+ pad : Rc :: new ( RefCell :: new ( <Box < [ u8 ] > >:: from_bytes ( & buf[ 8 ..16 ] ) ) ) ,
44+ }
45+ }
46+ }
47+ pub struct anon_0 {
48+ __bytes : Value < Box < [ u8 ] > > ,
49+ }
50+ impl anon_0 {
51+ pub fn h ( & self ) -> Ptr < record > {
52+ ( self . __bytes . as_pointer ( ) as Ptr < u8 > ) . reinterpret_cast ( )
53+ }
54+ pub fn raw_ ( & self ) -> Ptr < Box < [ u8 ] > > {
55+ ( self . __bytes . as_pointer ( ) as Ptr < u8 > ) . reinterpret_cast ( )
56+ }
57+ }
58+ impl Clone for anon_0 {
59+ fn clone ( & self ) -> Self {
60+ anon_0 {
61+ __bytes : Rc :: new ( RefCell :: new ( self . __bytes . borrow ( ) . clone ( ) ) ) ,
62+ }
63+ }
64+ }
65+ impl Default for anon_0 {
66+ fn default ( ) -> Self {
67+ anon_0 {
68+ __bytes : Rc :: new ( RefCell :: new ( Box :: from ( [ 0u8 ; 128 ] ) ) ) ,
69+ }
70+ }
3371}
3472impl ByteRepr for anon_0 { }
3573#[ derive( Default ) ]
@@ -67,11 +105,11 @@ pub fn fill_1(out: AnyPtr, cap: usize) {
67105 ( * src. borrow_mut ( ) ) [ ( 6 ) as usize ] = 0_u8 ;
68106 ( * src. borrow_mut ( ) ) [ ( 7 ) as usize ] = 1_u8 ;
69107 let n: Value < usize > = Rc :: new ( RefCell :: new (
70- if ( ( ( :: std:: mem:: size_of :: < [ u8 ; 16 ] > ( ) < ( * cap. borrow ( ) ) ) as i32 ) != 0 ) {
71- :: std:: mem:: size_of :: < [ u8 ; 16 ] > ( )
108+ ( if ( ( ( :: std:: mem:: size_of :: < [ u8 ; 16 ] > ( ) < ( * cap. borrow ( ) ) ) as i32 ) != 0 ) {
109+ ( :: std:: mem:: size_of :: < [ u8 ; 16 ] > ( ) as u64 )
72110 } else {
73- ( * cap. borrow ( ) )
74- } ,
111+ ( ( * cap. borrow ( ) ) as u64 )
112+ } as usize ) ,
75113 ) ) ;
76114 {
77115 ( * out. borrow ( ) ) . memcpy (
@@ -89,42 +127,47 @@ fn main_0() -> i32 {
89127 {
90128 ( ( c. as_pointer ( ) ) as Ptr < Container > )
91129 . to_any ( )
92- . memset ( ( 0 ) as u8 , :: std :: mem :: size_of :: < Container > ( ) as usize ) ;
130+ . memset ( ( 0 ) as u8 , 128usize as usize ) ;
93131 ( ( c. as_pointer ( ) ) as Ptr < Container > ) . to_any ( ) . clone ( )
94132 } ;
95133 ( {
96134 let _out: AnyPtr = ( ( * c. borrow ( ) ) . view . as_pointer ( ) ) . to_any ( ) ;
97- let _cap: usize = :: std :: mem :: size_of :: < anon_0 > ( ) ;
135+ let _cap: usize = 128usize ;
98136 fill_1 ( _out, _cap)
99137 } ) ;
100138 assert ! (
101- ( ( ( ( ( * ( * ( * ( * c. borrow( ) ) . view. borrow( ) ) . h. borrow( ) ) . code. borrow( ) ) as i32 ) == 2 ) as i32 )
139+ ( ( ( ( ( * ( * ( * ( * c. borrow( ) ) . view. borrow( ) ) . h( ) . upgrade( ) . deref( ) )
140+ . code
141+ . borrow( ) ) as i32 )
142+ == 2 ) as i32 )
102143 != 0 )
103144 ) ;
104145 assert ! (
105- ( ( ( ( ( ( ( ( * ( * ( * c. borrow( ) ) . view. borrow( ) ) . h. borrow( ) ) . lo. as_pointer( ) )
106- . to_strong( )
107- . as_pointer( ) as Ptr :: <u8 >)
108- . offset( ( 0 ) as isize )
109- . read( ) ) as i32 )
146+ ( ( ( ( ( ( ( ( * ( * ( * c. borrow( ) ) . view. borrow( ) ) . h( ) . upgrade( ) . deref( ) )
147+ . lo
148+ . as_pointer( ) )
149+ . reinterpret_cast:: <u8 >( ) )
150+ . offset( ( 0 ) as isize )
151+ . read( ) ) as i32 )
110152 == 0 ) as i32 )
111153 != 0 )
112154 ) ;
113155 assert ! (
114- ( ( ( ( ( ( ( ( * ( * ( * c. borrow( ) ) . view. borrow( ) ) . h. borrow( ) ) . lo. as_pointer( ) )
115- . to_strong( )
116- . as_pointer( ) as Ptr :: <u8 >)
117- . offset( ( 1 ) as isize )
118- . read( ) ) as i32 )
156+ ( ( ( ( ( ( ( ( * ( * ( * c. borrow( ) ) . view. borrow( ) ) . h( ) . upgrade( ) . deref( ) )
157+ . lo
158+ . as_pointer( ) )
159+ . reinterpret_cast:: <u8 >( ) )
160+ . offset( ( 1 ) as isize )
161+ . read( ) ) as i32 )
119162 == 80 ) as i32 )
120163 != 0 )
121164 ) ;
122165 assert ! (
123- ( ( ( ( ( * ( * ( * c. borrow( ) ) . view. borrow( ) ) . raw_. borrow ( ) ) [ ( 0 ) as usize ] as i32 ) == 2 ) as i32 )
166+ ( ( ( ( ( ( * ( * c. borrow( ) ) . view. borrow( ) ) . raw_( ) . read ( ) ) [ ( 0 ) as usize ] as i32 ) == 2 ) as i32 )
124167 != 0 )
125168 ) ;
126169 assert ! (
127- ( ( ( ( ( ( * ( * ( * c. borrow( ) ) . view. borrow( ) ) . raw_. borrow ( ) ) [ ( 3 ) as usize ] as u8 ) as i32 ) == 80 )
170+ ( ( ( ( ( ( ( * ( * c. borrow( ) ) . view. borrow( ) ) . raw_( ) . read ( ) ) [ ( 3 ) as usize ] as u8 ) as i32 ) == 80 )
128171 as i32 )
129172 != 0 )
130173 ) ;
0 commit comments