Guest User

Untitled

a guest
Feb 18th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. Index: asmcomp/cmmgen.ml
  2. ===================================================================
  3. --- asmcomp/cmmgen.ml (revision 16106)
  4. +++ asmcomp/cmmgen.ml (working copy)
  5. @@ -1387,19 +1387,7 @@
  6. | _ ->
  7. bind "met" (lookup_tag obj (transl met)) (call_met obj args))
  8. | Ulet(id, exp, body) ->
  9. - begin match is_unboxed_number exp with
  10. - No_unboxing ->
  11. - Clet(id, transl exp, transl body)
  12. - | Boxed_float ->
  13. - transl_unbox_let box_float unbox_float transl_unbox_float
  14. - Double_u 0
  15. - id exp body
  16. - | Boxed_integer bi ->
  17. - transl_unbox_let (box_int bi) (unbox_int bi) (transl_unbox_int bi)
  18. - (if bi = Pint32 then Thirtytwo_signed else Word)
  19. - size_addr
  20. - id exp body
  21. - end
  22. + transl_let id exp (transl body)
  23. | Uletrec(bindings, body) ->
  24. transl_letrec bindings (transl body)
  25.  
  26. @@ -2056,6 +2044,7 @@
  27.  
  28. and transl_unbox_float = function
  29. Uconst(Uconst_ref(_, Uconst_float f)) -> Cconst_float f
  30. + | Ulet(id, exp, body) -> transl_let id exp (transl_unbox_float body)
  31. | exp -> unbox_float(transl exp)
  32.  
  33. and transl_unbox_int bi = function
  34. @@ -2067,12 +2056,26 @@
  35. assert (size_int = 8); Cconst_natint (Int64.to_nativeint n)
  36. | Uprim(Pbintofint bi',[Uconst(Uconst_int i)],_) when bi = bi' ->
  37. Cconst_int i
  38. + | Ulet(id, exp, body) -> transl_let id exp (transl_unbox_int bi body)
  39. | exp -> unbox_int bi (transl exp)
  40.  
  41. +and transl_let id exp tr_body =
  42. + match is_unboxed_number exp with
  43. + No_unboxing ->
  44. + Clet(id, transl exp, tr_body)
  45. + | Boxed_float ->
  46. + transl_unbox_let box_float unbox_float transl_unbox_float
  47. + Double_u 0
  48. + id exp tr_body
  49. + | Boxed_integer bi ->
  50. + transl_unbox_let (box_int bi) (unbox_int bi) (transl_unbox_int bi)
  51. + (if bi = Pint32 then Thirtytwo_signed else Word)
  52. + size_addr
  53. + id exp tr_body
  54. +
  55. and transl_unbox_let box_fn unbox_fn transl_unbox_fn box_chunk box_offset
  56. - id exp body =
  57. + id exp trbody1 =
  58. let unboxed_id = Ident.create (Ident.name id) in
  59. - let trbody1 = transl body in
  60. let (trbody2, need_boxed, is_assigned) =
  61. subst_boxed_number unbox_fn id unboxed_id box_chunk box_offset trbody1 in
  62. if need_boxed && is_assigned then
Add Comment
Please, Sign In to add comment