This is an archive of the discontinued LLVM Phabricator instance.

[OCaml] Code simplification using option allocation functions
ClosedPublic

Authored by jberdine on Mar 28 2021, 3:31 PM.

Details

Summary

Using the caml_alloc_some and ptr_to_option functions that
allocate OCaml option values enables simplifications in many
cases. These simplifications also result in avoiding unnecessary
double initialization in many cases, so yield a minor optimization as
well.

Also, change to avoid using the old unprefixed functions such as
alloc_small and instead use the current caml_alloc_small.

A few of the changed functions were slightly rewritten in the
early-return style.

Diff Detail

Event Timeline

jberdine created this revision.Mar 28 2021, 3:31 PM
jberdine requested review of this revision.Mar 28 2021, 3:31 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 28 2021, 3:31 PM
vaivaswatha accepted this revision.Mar 29 2021, 10:13 AM
This revision is now accepted and ready to land.Mar 29 2021, 10:13 AM
This revision was landed with ongoing or failed builds.Apr 5 2021, 2:59 AM
This revision was automatically updated to reflect the committed changes.