Enforce simple reactive function call rules
commit64eed57eac655c6766913960713df4e8faade860
authorJan Oravec <jan@fb.com>
Mon, 19 Nov 2018 23:34:29 +0000 (19 15:34 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Mon, 19 Nov 2018 23:48:41 +0000 (19 15:48 -0800)
tree32abdb055b817b904696ef9f3ba87984bb96e436
parent17099f43acc35b534446d2de82a3be3871b3a28e
Enforce simple reactive function call rules

Summary:
Enforce the reactivity rules for function calls between rx, rx-shallow,
rx-local and non-rx functions. RxEnforceCalls option can be used to control the
enforcement (0 = off, 1 = warning, 2 = exception).

Limitations:

Conditional reactivity is not tracked yet, so we pretend every conditionally
reactive caller is non-reactive and every conditionally reactive callee is as
reactive as possible. This is needed to prevent spurious warnings/exceptions
before conditional reactivity is implemented.

Calls that reenter VM are another known source of enforcement holes not
addressed by this diff.

Usage of Rx\IS_ENABLED is not tracked yet either and this is a known source
of spurious warnings.

Rx-incompatible callee may get folded by hhbbc, skipping rx check. The
next diff fixes this.

Reviewed By: markw65

Differential Revision: D10443336

fbshipit-source-id: 869e1c796ab6b6be7cdfeae979e80c6f91852ec4
33 files changed:
hphp/doc/ir.specification
hphp/runtime/base/attr.h
hphp/runtime/base/runtime-option.h
hphp/runtime/vm/act-rec-inl.h
hphp/runtime/vm/act-rec.h
hphp/runtime/vm/as-shared.cpp
hphp/runtime/vm/as.cpp
hphp/runtime/vm/bytecode.cpp
hphp/runtime/vm/func-inl.h
hphp/runtime/vm/func.cpp
hphp/runtime/vm/func.h
hphp/runtime/vm/interp-helpers.h
hphp/runtime/vm/jit/dce.cpp
hphp/runtime/vm/jit/ir-opcode.cpp
hphp/runtime/vm/jit/irgen-builtin.cpp
hphp/runtime/vm/jit/irgen-call.cpp
hphp/runtime/vm/jit/irgen-call.h
hphp/runtime/vm/jit/irgen-inlining.cpp
hphp/runtime/vm/jit/irgen-internal.h
hphp/runtime/vm/jit/irlower-class-func.cpp
hphp/runtime/vm/jit/memory-effects.cpp
hphp/runtime/vm/jit/simplify.cpp
hphp/runtime/vm/rx-inl.h
hphp/runtime/vm/rx.h
hphp/system/php/lang/null.ns.php
hphp/system/systemlib.cpp
hphp/test/slow/rx/call_enforcement.php [new file with mode: 0644]
hphp/test/slow/rx/call_enforcement.php.expect [new file with mode: 0644]
hphp/test/slow/rx/call_enforcement.php.opts [new file with mode: 0644]
hphp/test/slow/rx/call_enforcement_soft.php [new file with mode: 0644]
hphp/test/slow/rx/call_enforcement_soft.php.expectf [new file with mode: 0644]
hphp/test/slow/rx/call_enforcement_soft.php.opts [new file with mode: 0644]
hphp/test/slow/rx/freeze_mutable.php