468468
469469let  prim  ~primitive :(prim  : Lam_primitive.t )  ~args   loc  : t  = 
470470  let  default  ()  : t  =  Lprim  { primitive =  prim; args; loc } in 
471+   (*  extract the runtime representation if possible *) 
471472  let  extract_const_as  c  def  =  
472473    (match  c with   
473474    |  Lam_constant. Pt_constructor ({cstr_name  = ({tag_type  = Some (Int(v ))} )} ) -> Int32. of_int v
@@ -494,8 +495,10 @@ let prim ~primitive:(prim : Lam_primitive.t) ~args loc : t =
494495      |  _  -> default () )
495496  |  [ Lconst  a; Lconst  b ] -> (
496497      match  (prim, a, b) with 
497-       |  Pintcomp  cmp , Const_int  a , Const_int  b  ->
498-           Lift. bool  (Lam_compat. cmp_int32 cmp a.i b.i)
498+       |  Pintcomp  cmp , Const_int  {i  = aa ; comment  = aa_pointer_info } , Const_int  {i  = bb ; comment  = bb_pointer_info }  ->
499+           let  aa =  extract_const_as aa_pointer_info aa in  
500+           let  bb =  extract_const_as bb_pointer_info bb in  
501+           Lift. bool  (Lam_compat. cmp_int32 cmp aa bb)
499502      |  Pfloatcomp  cmp , Const_float  a , Const_float  b  ->
500503          (*  FIXME: could raise? *) 
501504          Lift. bool 
@@ -540,7 +543,8 @@ let prim ~primitive:(prim : Lam_primitive.t) ~args loc : t =
540543          Lift. string  (a ^  b)
541544      |  ( (Pstringrefs  |  Pstringrefu ),
542545          Const_string  { s =  a; unicode =  false  },
543-           Const_int  { i =  b } ) -> (
546+           Const_int  { i =  b; comment =  pointer_info } ) -> (
547+           let  b =  extract_const_as pointer_info b in  
544548          try  Lift. char  (Char. code (String. get a (Int32. to_int b))) with  _  ->  default () )
545549      |  _  -> default () )
546550  |  _  -> (
0 commit comments