Loading ...
Sorry, an error occurred while loading the content.

Re: "ocaml_beginners"::[] no inlining with libraries?

Expand Messages
  • Richard Jones
    ... Do you have the extlib .cmx files installed? They are required before the compiler will consider inlining across modules. Rich. -- Richard Jones Red Hat
    Message 1 of 5 , Jul 1, 2007
    • 0 Attachment
      On Sat, Jun 30, 2007 at 06:28:41PM +0200, yahoogroups@... wrote:
      > Hello,
      >
      > I'm calling Option.may from extlib, and the code doesn't seem to be
      > inlined.
      >
      > let inlinetest a =
      > let f x = x.(0) <- 0 in
      > Option.may f a
      >
      > _camlMain__inlinetest_70:
      > L109:
      > addis r11, 0, ha16(_camlOption)
      > lwz r5, lo16(_camlOption)(r11)
      > mr r4, r3
      > addis r3, 0, ha16(_camlMain__32)
      > addi r3, r3, lo16(_camlMain__32)
      > b _caml_apply2
      >
      > I thought ocamlopt was capable of inlining across files/modules (and
      > therefore libraries?)
      >
      > can someone enlighten me?

      Do you have the extlib .cmx files installed? They are required before
      the compiler will consider inlining across modules.

      Rich.

      --
      Richard Jones
      Red Hat
    • yahoogroups@chojin.neomagie.net
      Thanks, it worked. Looks like extlib doesn t install the .cmx files. By the way, although extlib v1.5 was released in Feb 2006, it seems godi s version is
      Message 2 of 5 , Jul 1, 2007
      • 0 Attachment
        Thanks, it worked.
        Looks like extlib doesn't install the .cmx files.

        By the way, although extlib v1.5 was released in Feb 2006, it seems
        godi's version is still 1.4 (I Cc Gerd Stolpmann)

        Here is the patch for it (I Cc'd the 3 main extlib's contributors
        since I don't want to subscribe to the ML just for that)
        In the "| Dir install_dir" case, it seems the ".mli" files are
        missing too. I added them, but since I'm using ocamlfind I didn't
        test it. Maybe the omission was done on purpose?

        With this patch the cmx files are correctly installed and therefore
        the inlining occurs.

        --- install.ml.ori 2007-07-01 15:28:08.000000000 +0200
        +++ install.ml 2007-07-01 15:31:09.000000000 +0200
        @@ -184,7 +184,11 @@
        Buffer.add_string files (m ^ ".cmi");
        Buffer.add_char files ' ';
        Buffer.add_string files (m ^ ".mli");
        - Buffer.add_char files ' ')
        + Buffer.add_char files ' ';
        + if !autonative then begin
        + Buffer.add_string files (m ^ ".cmx");
        + Buffer.add_char files ' ';
        + end)
        modules;
        Buffer.add_string files "extLib.cmi ";
        if !autobyte then Buffer.add_string files "extLib.cma ";
        @@ -198,6 +202,7 @@
        | Dir install_dir ->
        List.iter (fun m ->
        copy (m ^ ".cmi") install_dir;
        + copy (m ^ ".mli") install_dir;
        if !autonative then copy (m ^ ".cmx")
        install_dir
        ) ("extLib" :: modules);
        if !autobyte then copy "extLib.cma" install_dir;

        --
        Best Regards,
        Quôc

        On Jul 1, 2007, at 11:15 AM, Richard Jones wrote:

        > On Sat, Jun 30, 2007 at 06:28:41PM +0200,
        > yahoogroups@...:
        > > Hello,
        > >
        > > I'm calling Option.may from extlib, and the code doesn't seem to be
        > > inlined.
        > >
        > > let inlinetest a =
        > > let f x = x.(0) <- 0 in
        > > Option.may f a
        > >
        > > _camlMain__inlinetest_70:
        > > L109:
        > > addis r11, 0, ha16(_camlOption)
        > > lwz r5, lo16(_camlOption)(r11)
        > > mr r4, r3
        > > addis r3, 0, ha16(_camlMain__32)
        > > addi r3, r3, lo16(_camlMain__32)
        > > b _caml_apply2
        > >
        > > I thought ocamlopt was capable of inlining across files/modules (and
        > > therefore libraries?)
        > >
        > > can someone enlighten me?
        >
        > Do you have the extlib .cmx files installed? They are required before
        > the compiler will consider inlining across modules.
      • yahoogroups@chojin.neomagie.net
        Looks like my email didn t make it to the ML... Maybe yahoo s groups didn t like the CCs, I m trying again without them (hopefully they already received the
        Message 3 of 5 , Jul 1, 2007
        • 0 Attachment
          Looks like my email didn't make it to the ML... Maybe yahoo's groups
          didn't like the CCs,
          I'm trying again without them (hopefully they already received the
          email):

          ========================================

          Thanks, it worked.
          Looks like extlib doesn't install the .cmx files.

          By the way, although extlib v1.5 was released in Feb 2006, it seems
          godi's version is still 1.4 (I Cc Gerd Stolpmann)

          Here is the patch for it (I Cc'd the 3 main extlib's contributors
          since I don't want to subscribe to the ML just for that)
          In the "| Dir install_dir" case, it seems the ".mli" files are
          missing too. I added them, but since I'm using ocamlfind I didn't
          test it. Maybe the omission was done on purpose?

          With this patch the cmx files are correctly installed and therefore
          the inlining occurs.

          --- install.ml.ori 2007-07-01 15:28:08.000000000 +0200
          +++ install.ml 2007-07-01 15:31:09.000000000 +0200
          @@ -184,7 +184,11 @@
          Buffer.add_string files (m ^ ".cmi");
          Buffer.add_char files ' ';
          Buffer.add_string files (m ^ ".mli");
          - Buffer.add_char files ' ')
          + Buffer.add_char files ' ';
          + if !autonative then begin
          + Buffer.add_string files (m ^ ".cmx");
          + Buffer.add_char files ' ';
          + end)
          modules;
          Buffer.add_string files "extLib.cmi ";
          if !autobyte then Buffer.add_string files "extLib.cma ";
          @@ -198,6 +202,7 @@
          | Dir install_dir ->
          List.iter (fun m ->
          copy (m ^ ".cmi") install_dir;
          + copy (m ^ ".mli") install_dir;
          if !autonative then copy (m ^ ".cmx")
          install_dir
          ) ("extLib" :: modules);
          if !autobyte then copy "extLib.cma" install_dir;

          --
          Best Regards,
          Quôc

          On Jul 1, 2007, at 11:15 AM, Richard Jones wrote:

          > On Sat, Jun 30, 2007 at 06:28:41PM +0200,
          > yahoogroups@...:
          > > Hello,
          > >
          > > I'm calling Option.may from extlib, and the code doesn't seem to be
          > > inlined.
          > >
          > > let inlinetest a =
          > > let f x = x.(0) <- 0 in
          > > Option.may f a
          > >
          > > _camlMain__inlinetest_70:
          > > L109:
          > > addis r11, 0, ha16(_camlOption)
          > > lwz r5, lo16(_camlOption)(r11)
          > > mr r4, r3
          > > addis r3, 0, ha16(_camlMain__32)
          > > addi r3, r3, lo16(_camlMain__32)
          > > b _caml_apply2
          > >
          > > I thought ocamlopt was capable of inlining across files/modules (and
          > > therefore libraries?)
          > >
          > > can someone enlighten me?
          >
          > Do you have the extlib .cmx files installed? They are required before
          > the compiler will consider inlining across modules.
          >
          > Rich.
        • Richard Jones
          ... Good news - we changed this at the last minute in the Fedora packaging guidelines so that .cmx files should normally be installed, so as to allow
          Message 4 of 5 , Jul 1, 2007
          • 0 Attachment
            On Sun, Jul 01, 2007 at 07:22:28PM +0200, yahoogroups@... wrote:
            > Thanks, it worked.
            > Looks like extlib doesn't install the .cmx files.

            Good news - we changed this at the last minute in the Fedora packaging
            guidelines so that .cmx files should normally be installed, so as to
            allow cross-module inlining.

            Rich.

            --
            Richard Jones
            Red Hat
          Your message has been successfully submitted and would be delivered to recipients shortly.