Enforce modularity boundaries for top level functions and various function pointers
commit9ec7b443cbd1f38ee1b379e09db4b76cfa1a5862
authorOguz Ulgen <oulgen@fb.com>
Wed, 8 Jun 2022 16:14:21 +0000 (8 09:14 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 8 Jun 2022 16:14:21 +0000 (8 09:14 -0700)
treee349f2bad758ac4ee4797c83c4d2aeb59a764130
parent77719312fa544e58db21f59c62ba5b9fb39fc5c2
Enforce modularity boundaries for top level functions and various function pointers

Summary:
This diff adds module level boundary enforcement for
* Calling top level function
  * with its name: `foo()`
  * dynamically: `$f = "foo"; $f();`
* Creating function pointers via
  * `foo<>`
  * `foo::bar<>`
  * closures
  * clsmeth
  * methcaller

Note that for function pointers the error happens when they are created, not when they are invoked.

Reviewed By: edwinsmith

Differential Revision: D36597564

fbshipit-source-id: ba507040d95c6080bdc680a92c6c1a375b859b68
36 files changed:
hphp/doc/ir.specification
hphp/hhbbc/interp-internal.h
hphp/runtime/base/builtin-functions.cpp
hphp/runtime/vm/bytecode.cpp
hphp/runtime/vm/func.cpp
hphp/runtime/vm/func.h
hphp/runtime/vm/jit/dce.cpp
hphp/runtime/vm/jit/extra-data.h
hphp/runtime/vm/jit/ir-opcode.cpp
hphp/runtime/vm/jit/irgen-call.cpp
hphp/runtime/vm/jit/irlower-call.cpp
hphp/runtime/vm/jit/irlower-exception.cpp
hphp/runtime/vm/jit/memory-effects.cpp
hphp/runtime/vm/jit/simplify.cpp
hphp/runtime/vm/method-lookup.cpp
hphp/runtime/vm/method-lookup.h
hphp/runtime/vm/runtime.cpp
hphp/runtime/vm/unit.h
hphp/test/slow/modules/basic-1.inc
hphp/test/slow/modules/basic-1.php
hphp/test/slow/modules/basic-1.php.expectf
hphp/test/slow/modules/basic-throw-1.php
hphp/test/slow/modules/basic-throw-1.php.expect
hphp/test/slow/modules/resolve-1.inc [new file with mode: 0644]
hphp/test/slow/modules/resolve-1.inc1 [new file with mode: 0644]
hphp/test/slow/modules/resolve-1.php [new file with mode: 0644]
hphp/test/slow/modules/resolve-1.php.expectf [new file with mode: 0644]
hphp/test/slow/modules/resolve-2.inc [new file with mode: 0644]
hphp/test/slow/modules/resolve-2.php [new file with mode: 0644]
hphp/test/slow/modules/resolve-2.php.expectf [new file with mode: 0644]
hphp/test/slow/modules/resolve-throw-1.php [new file with mode: 0644]
hphp/test/slow/modules/resolve-throw-1.php.expectf [new file with mode: 0644]
hphp/test/slow/modules/resolve-throw-1.php.opts [new file with mode: 0644]
hphp/test/slow/modules/resolve-throw-2.php [new file with mode: 0644]
hphp/test/slow/modules/resolve-throw-2.php.expectf [new file with mode: 0644]
hphp/test/slow/modules/resolve-throw-2.php.opts [new file with mode: 0644]