@@ -312,6 +312,24 @@ where
312
312
let [ Argument :: Object ( object) , target] = & op. arguments [ ..] else { panic ! ( ) } ;
313
313
self . do_store ( & mut context, & target, object. clone ( ) ) ?;
314
314
}
315
+ Opcode :: RefOf => {
316
+ let [ Argument :: Object ( object) ] = & op. arguments [ ..] else { panic ! ( ) } ;
317
+ let reference =
318
+ Arc :: new ( Object :: Reference { kind : ReferenceKind :: RefOf , inner : object. clone ( ) } ) ;
319
+ context. contribute_arg ( Argument :: Object ( reference) ) ;
320
+ }
321
+ Opcode :: CondRefOf => {
322
+ let [ Argument :: Object ( object) , target] = & op. arguments [ ..] else { panic ! ( ) } ;
323
+ let result = if let Object :: Reference { kind : ReferenceKind :: Unresolved , .. } = * * object {
324
+ Object :: Integer ( 0 )
325
+ } else {
326
+ let reference =
327
+ Arc :: new ( Object :: Reference { kind : ReferenceKind :: RefOf , inner : object. clone ( ) } ) ;
328
+ self . do_store ( & mut context, target, reference) ?;
329
+ Object :: Integer ( u64:: MAX )
330
+ } ;
331
+ context. contribute_arg ( Argument :: Object ( Arc :: new ( result) ) ) ;
332
+ }
315
333
Opcode :: Sleep => {
316
334
let [ Argument :: Object ( msec) ] = & op. arguments [ ..] else { panic ! ( ) } ;
317
335
self . handler . sleep ( msec. as_integer ( ) ?) ;
@@ -642,7 +660,6 @@ where
642
660
let name = name. resolve ( & context. current_scope ) ?;
643
661
self . namespace . lock ( ) . insert ( name, Arc :: new ( Object :: Event ) ) ?;
644
662
}
645
- Opcode :: CondRefOf => todo ! ( ) ,
646
663
Opcode :: LoadTable => todo ! ( ) ,
647
664
Opcode :: Load => todo ! ( ) ,
648
665
Opcode :: Stall => context. start_in_flight_op ( OpInFlight :: new ( Opcode :: Stall , 1 ) ) ,
@@ -798,7 +815,8 @@ where
798
815
} ) ) ) ;
799
816
}
800
817
Opcode :: Store => context. start_in_flight_op ( OpInFlight :: new ( Opcode :: Store , 2 ) ) ,
801
- Opcode :: RefOf => todo ! ( ) ,
818
+ Opcode :: RefOf => context. start_in_flight_op ( OpInFlight :: new ( Opcode :: RefOf , 1 ) ) ,
819
+ Opcode :: CondRefOf => context. start_in_flight_op ( OpInFlight :: new ( opcode, 2 ) ) ,
802
820
803
821
Opcode :: DualNamePrefix
804
822
| Opcode :: MultiNamePrefix
@@ -822,7 +840,9 @@ where
822
840
}
823
841
}
824
842
Err ( AmlError :: ObjectDoesNotExist ( _) ) => {
825
- if context. current_block . kind == BlockKind :: Package {
843
+ let allow_unresolved = context. current_block . kind == BlockKind :: Package
844
+ || context. in_flight . last ( ) . map ( |op| op. op == Opcode :: CondRefOf ) . unwrap_or ( false ) ;
845
+ if allow_unresolved {
826
846
let reference = Object :: Reference {
827
847
kind : ReferenceKind :: Unresolved ,
828
848
inner : Arc :: new ( Object :: String ( name. to_string ( ) ) ) ,
0 commit comments