chapel-lang/chapel — pull request #102 by hildeth (2014-08-02 07:10:55+00:00)
Title: Hoist duplicate malloc wrappers from localeModels to ChapelLocale.

I noticed that chpl_here_alloc() and kin are identical in the two localeModels, and can be hoisted into ChapelLocale. I noticed because my work on calling user default constructors exposes a circular dependency in the modules, wherein the size of a chpl_nodeID (defined in the localeModel) must be known in order to allocate a wide pointer, but ChapelLocale is a dependency of LocaleModel and was getting resolved first. This left chpl_nodeID unresolved in the place where it is first used.

I solved this by creating an explicit dependency of ChapelLocale on the locale model -- by adding a use statement at the beginning of ChapelLocale. I also removed the redundant definition for chpl_nodeID there, since the locale model may have a different idea on the subject.

I consolidated the redundant copies of chpl_here_alloc() and kin by hoisting them from the localeModel files to ChapelLocale.chpl. This may not be strictly necessary, but it is a nice factoring.

I checked to ensure that the "locale model alloc" pragma is not affected by this move. The effect of that pragma is to prevent the widening of the interface to that particular function. I also checked to ensure that the "locale model free" pragma was not affected. It is used for some consistency checks and an optimization that removes setting the CID in the calling context. It appears that a change in these effects would be unlikely merely due to moving the marked functions between modules.

[tested on domains distributions multilocale parallel (std-flat)]