@@ -37,6 +37,11 @@ pub static IMPORT_SIGNATURES: &[(&str, &[ValType], &[ValType])] = &[
3737 & [ ValType :: I32 ] ,
3838 ) ,
3939 ( "componentize-py#Free" , & [ ValType :: I32 ; 3 ] , & [ ] ) ,
40+ (
41+ "componentize-py#ToCanonBool" ,
42+ & [ ValType :: I32 ; 2 ] ,
43+ & [ ValType :: I32 ] ,
44+ ) ,
4045 (
4146 "componentize-py#ToCanonI32" ,
4247 & [ ValType :: I32 ; 2 ] ,
@@ -78,6 +83,11 @@ pub static IMPORT_SIGNATURES: &[(&str, &[ValType], &[ValType])] = &[
7883 & [ ValType :: I32 ; 3 ] ,
7984 & [ ValType :: I32 ] ,
8085 ) ,
86+ (
87+ "componentize-py#FromCanonBool" ,
88+ & [ ValType :: I32 ; 2 ] ,
89+ & [ ValType :: I32 ] ,
90+ ) ,
8191 (
8292 "componentize-py#FromCanonI32" ,
8393 & [ ValType :: I32 ; 2 ] ,
@@ -575,7 +585,14 @@ impl<'a> FunctionBindgen<'a> {
575585
576586 fn to_canon ( & mut self , ty : Type , context : u32 , value : u32 ) {
577587 match ty {
578- Type :: Bool | Type :: U8 | Type :: U16 | Type :: U32 | Type :: S8 | Type :: S16 | Type :: S32 => {
588+ Type :: Bool => {
589+ self . push ( Ins :: LocalGet ( context) ) ;
590+ self . push ( Ins :: LocalGet ( value) ) ;
591+ self . push ( Ins :: Call (
592+ * IMPORTS . get ( "componentize-py#ToCanonBool" ) . unwrap ( ) ,
593+ ) ) ;
594+ }
595+ Type :: U8 | Type :: U16 | Type :: U32 | Type :: S8 | Type :: S16 | Type :: S32 => {
579596 self . push ( Ins :: LocalGet ( context) ) ;
580597 self . push ( Ins :: LocalGet ( value) ) ;
581598 self . push ( Ins :: Call (
@@ -850,7 +867,16 @@ impl<'a> FunctionBindgen<'a> {
850867
851868 fn store ( & mut self , ty : Type , context : u32 , value : u32 , destination : u32 ) {
852869 match ty {
853- Type :: Bool | Type :: U8 | Type :: S8 => {
870+ Type :: Bool => {
871+ self . push ( Ins :: LocalGet ( destination) ) ;
872+ self . push ( Ins :: LocalGet ( context) ) ;
873+ self . push ( Ins :: LocalGet ( value) ) ;
874+ self . push ( Ins :: Call (
875+ * IMPORTS . get ( "componentize-py#ToCanonBool" ) . unwrap ( ) ,
876+ ) ) ;
877+ self . push ( Ins :: I32Store8 ( mem_arg ( 0 , 0 ) ) ) ;
878+ }
879+ Type :: U8 | Type :: S8 => {
854880 self . push ( Ins :: LocalGet ( destination) ) ;
855881 self . to_canon ( ty, context, value) ;
856882 self . push ( Ins :: I32Store8 ( mem_arg ( 0 , 0 ) ) ) ;
@@ -1384,7 +1410,14 @@ impl<'a> FunctionBindgen<'a> {
13841410
13851411 fn from_canon ( & mut self , ty : Type , context : u32 , value : & [ u32 ] ) {
13861412 match ty {
1387- Type :: Bool | Type :: U8 | Type :: U16 | Type :: U32 | Type :: S8 | Type :: S16 | Type :: S32 => {
1413+ Type :: Bool => {
1414+ self . push ( Ins :: LocalGet ( context) ) ;
1415+ self . push ( Ins :: LocalGet ( value[ 0 ] ) ) ;
1416+ self . push ( Ins :: Call (
1417+ * IMPORTS . get ( "componentize-py#FromCanonBool" ) . unwrap ( ) ,
1418+ ) ) ;
1419+ }
1420+ Type :: U8 | Type :: U16 | Type :: U32 | Type :: S8 | Type :: S16 | Type :: S32 => {
13881421 self . push ( Ins :: LocalGet ( context) ) ;
13891422 self . push ( Ins :: LocalGet ( value[ 0 ] ) ) ;
13901423 self . push ( Ins :: Call (
0 commit comments