@@ -100,7 +100,7 @@ pub fn convert_rvalue_to_operand<'a>(
100100 for i in 0 ..array_size {
101101 let index_operand = oomir:: Operand :: Constant ( oomir:: Constant :: I32 ( i as i32 ) ) ;
102102 instructions. push ( oomir:: Instruction :: ArrayStore {
103- array_var : temp_array_var. clone ( ) , // Store into temp array
103+ array : temp_array_var. clone ( ) ,
104104 index : index_operand,
105105 value : oomir_elem_op. clone ( ) ,
106106 } ) ;
@@ -135,7 +135,14 @@ pub fn convert_rvalue_to_operand<'a>(
135135 let source_name = place_to_string ( source_place, tcx) ;
136136 instructions. push ( oomir:: Instruction :: Length {
137137 dest : temp_len_var. clone ( ) ,
138- array_var : source_name,
138+ array : oomir:: Operand :: Variable {
139+ name : source_name,
140+ ty : ty_to_oomir_type (
141+ source_place. ty ( & mir. local_decls , tcx) . ty ,
142+ tcx,
143+ data_types,
144+ ) ,
145+ } ,
139146 } ) ;
140147 result_operand = oomir:: Operand :: Variable {
141148 name : temp_len_var,
@@ -307,7 +314,7 @@ pub fn convert_rvalue_to_operand<'a>(
307314 } ) ;
308315 // Set fields on the *temporary* tuple
309316 instructions. push ( oomir:: Instruction :: SetField {
310- object_var : temp_tuple_var. clone ( ) ,
317+ object : temp_tuple_var. clone ( ) ,
311318 field_name : "field0" . to_string ( ) ,
312319 value : oomir:: Operand :: Variable {
313320 name : tmp_result_var,
@@ -317,7 +324,7 @@ pub fn convert_rvalue_to_operand<'a>(
317324 owner_class : tuple_class_name. clone ( ) ,
318325 } ) ;
319326 instructions. push ( oomir:: Instruction :: SetField {
320- object_var : temp_tuple_var. clone ( ) ,
327+ object : temp_tuple_var. clone ( ) ,
321328 field_name : "field1" . to_string ( ) ,
322329 value : oomir:: Operand :: Variable {
323330 name : tmp_overflow_var,
@@ -374,7 +381,7 @@ pub fn convert_rvalue_to_operand<'a>(
374381 match oomir_src_operand {
375382 oomir:: Operand :: Variable {
376383 name : source_name,
377- ty : _ ,
384+ ty : var_ty ,
378385 } => {
379386 // Check if source is actually an array/slice/str type
380387 let operand_place = match operand {
@@ -400,7 +407,10 @@ pub fn convert_rvalue_to_operand<'a>(
400407 println ! ( "Info: Detected Length op via PtrMetadata." ) ;
401408 instructions. push ( oomir:: Instruction :: Length {
402409 dest : temp_unop_var. clone ( ) ,
403- array_var : source_name,
410+ array : oomir:: Operand :: Variable {
411+ name : source_name,
412+ ty : var_ty,
413+ } ,
404414 } ) ;
405415 } else {
406416 println ! (
@@ -481,7 +491,7 @@ pub fn convert_rvalue_to_operand<'a>(
481491 let value_operand =
482492 convert_operand ( mir_op, tcx, mir, data_types, & mut instructions) ;
483493 instructions. push ( oomir:: Instruction :: SetField {
484- object_var : temp_aggregate_var. clone ( ) ,
494+ object : temp_aggregate_var. clone ( ) ,
485495 field_name,
486496 value : value_operand,
487497 field_ty : element_oomir_type,
@@ -510,7 +520,7 @@ pub fn convert_rvalue_to_operand<'a>(
510520 let index_operand =
511521 oomir:: Operand :: Constant ( oomir:: Constant :: I32 ( i as i32 ) ) ;
512522 instructions. push ( oomir:: Instruction :: ArrayStore {
513- array_var : temp_aggregate_var. clone ( ) ,
523+ array : temp_aggregate_var. clone ( ) ,
514524 index : index_operand,
515525 value : value_operand,
516526 } ) ;
@@ -544,7 +554,7 @@ pub fn convert_rvalue_to_operand<'a>(
544554 & mut instructions,
545555 ) ;
546556 instructions. push ( oomir:: Instruction :: SetField {
547- object_var : temp_aggregate_var. clone ( ) ,
557+ object : temp_aggregate_var. clone ( ) ,
548558 field_name,
549559 value : value_operand,
550560 field_ty : field_oomir_type,
@@ -686,7 +696,7 @@ pub fn convert_rvalue_to_operand<'a>(
686696 & mut instructions,
687697 ) ;
688698 instructions. push ( oomir:: Instruction :: SetField {
689- object_var : temp_aggregate_var. clone ( ) ,
699+ object : temp_aggregate_var. clone ( ) ,
690700 field_name,
691701 value : value_operand,
692702 field_ty : field_oomir_type,
@@ -768,34 +778,37 @@ pub fn convert_rvalue_to_operand<'a>(
768778 // 1. Generate instructions to get the actual value from the place
769779 let ( actual_value_var_name, get_instructions, actual_value_oomir_type) =
770780 emit_instructions_to_get_on_own ( place, tcx, mir, data_types) ;
771-
781+
772782 // Add the instructions needed to get the value (e.g., ArrayGet)
773783 instructions. extend ( get_instructions) ;
774-
784+
775785 // 2. Now operate on the variable holding the actual value
776786 let temp_discriminant_var = generate_temp_var_name ( & base_temp_name) ;
777-
787+
778788 let place_class_name = match actual_value_oomir_type. clone ( ) {
779789 oomir:: Type :: Class ( name) => name. clone ( ) ,
780790 // Handle potential references if get_on_own returns Ref(Class)
781791 oomir:: Type :: Reference ( inner) => {
782- if let oomir:: Type :: Class ( name) = inner. as_ref ( ) {
792+ if let oomir:: Type :: Class ( name) = inner. as_ref ( ) {
783793 name. clone ( )
784- } else {
785- panic ! ( "Discriminant on Ref to non-class type: {:?}" , inner)
786- }
794+ } else {
795+ panic ! ( "Discriminant on Ref to non-class type: {:?}" , inner)
796+ }
787797 }
788- _ => panic ! ( "Discriminant on non-class type: {:?}" , actual_value_oomir_type) ,
798+ _ => panic ! (
799+ "Discriminant on non-class type: {:?}" ,
800+ actual_value_oomir_type
801+ ) ,
789802 } ;
790-
803+
791804 let method_name = "getVariantIdx" . to_string ( ) ;
792805 let method_return_type = oomir:: Type :: I32 ;
793-
806+
794807 let method_ty = oomir:: Signature {
795808 params : vec ! [ ] ,
796809 ret : Box :: new ( method_return_type. clone ( ) ) ,
797810 } ;
798-
811+
799812 // 3. Call InvokeVirtual on the CORRECT variable
800813 instructions. push ( oomir:: Instruction :: InvokeVirtual {
801814 class_name : place_class_name. clone ( ) ,
@@ -808,13 +821,13 @@ pub fn convert_rvalue_to_operand<'a>(
808821 ty : actual_value_oomir_type,
809822 } ,
810823 } ) ;
811-
824+
812825 // 4. The result is the temporary variable holding the discriminant value
813826 result_operand = oomir:: Operand :: Variable {
814827 name : temp_discriminant_var,
815828 ty : method_return_type, // Should be I32
816829 } ;
817- }
830+ }
818831 // Handle other Rvalue variants by generating a placeholder
819832 _ => {
820833 println ! (
0 commit comments