Allow users to specify part of a mangled closure name
commitcf91da04b83614fd50a2a33e1eee437ce6f73139
authorJoseph Griego <jgriego@fb.com>
Fri, 5 Apr 2019 21:25:40 +0000 (5 14:25 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Fri, 5 Apr 2019 21:30:28 +0000 (5 14:30 -0700)
treeb87cec1a84ace9f662bc5a2b1416ec0884214a4e
parent806292dcd7c3e0d11e727b81e56d107cc08e6e9d
Allow users to specify part of a mangled closure name

Summary:
The HHJS transpiler emits a godawful number of closures--we'd like to profile
the output code but it's difficult to do with the default name-mangling; and it
seems like overkill to do our own closure conversion that names things more sensibly.

This adds support for a user attribute `__ClosureName` that inserts a
user-provided string into the mangled closure name.

Not sure if this is a kosher thing to do or not--feedback on this approach is
more than welcome.

Reviewed By: oulgen

Differential Revision: D13975389

fbshipit-source-id: b83da6beb570bbc94b2a723d7904daf9cfadcf8c
hphp/hack/src/hh_single_compile.ml
hphp/hack/src/hhbc/closure_convert.ml
hphp/hack/src/hhbc/emit_env.ml
hphp/hack/src/hhbc/emit_program.ml
hphp/hack/src/hhbc/hhbc_string_utils.ml
hphp/test/slow/user-named-closures.php [new file with mode: 0644]
hphp/test/slow/user-named-closures.php.expect [new file with mode: 0644]