Readonly enforcement for SetM
commit96710b3a93237e82ce47741c9cac6f54910c60df
authorKaty Voor <voork@fb.com>
Tue, 6 Apr 2021 02:14:09 +0000 (5 19:14 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Tue, 6 Apr 2021 02:15:31 +0000 (5 19:15 -0700)
treeec19fad5ecf7f81b380ac101156be4ac787fe2f0
parentee5ff05072abae27b2f9fe1f8c945f2e51a2a7b3
Readonly enforcement for SetM

Summary:
Enforcement of SetM Readonly for properties
Assume readonly COW Collection types cannot be modified.
```
    <expr>[5] = $x;             // <expr>, $x must be mutable
    <expr>->c = $x;             // <expr>, $x must be mutable
    <expr>[5] = readonly $x;    // Hack error. <expr> must be readonly and you are modifying readonly value.
(1) <expr>->c = readonly $x;    // <expr> must be mutable, c must be readonly.
```
These are all property accesses so we only need to cover that path for this bytecode.
I tried to be conservative when threading more information through to only the places that were necessary for this check.

Reviewed By: ricklavoie

Differential Revision: D27475886

fbshipit-source-id: 8c4cd0e3902d8866f5f1d012b53699fcf50a225e
19 files changed:
hphp/doc/ir.specification
hphp/hhbbc/interp-minstr.cpp
hphp/runtime/base/object-data.cpp
hphp/runtime/base/object-data.h
hphp/runtime/vm/bytecode.cpp
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-minstr.cpp
hphp/runtime/vm/jit/irlower-exception.cpp
hphp/runtime/vm/jit/irlower-minstr.cpp
hphp/runtime/vm/jit/memory-effects.cpp
hphp/runtime/vm/jit/minstr-helpers.h
hphp/runtime/vm/jit/native-calls.cpp
hphp/runtime/vm/member-operations.h
hphp/runtime/vm/runtime.cpp
hphp/runtime/vm/runtime.h
hphp/test/slow/readonly/setm.hhas [new file with mode: 0644]
hphp/test/slow/readonly/setm.hhas.expectf [new file with mode: 0644]