optional integer overflow logging/exception (#8585)
commitec04340ea0cf3985842f13fcb78011428278ac47
authorStephan Zuercher <szuercher@slack-corp.com>
Thu, 24 Oct 2019 16:43:53 +0000 (24 09:43 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 24 Oct 2019 16:45:58 +0000 (24 09:45 -0700)
tree5cd715af743dc730904433abb9d54717e894f028
parent38ad376a7f171aa5a134e35a63b7fd42a4277080
optional integer overflow logging/exception (#8585)

Summary:
Adds a configuration setting hhvm.hack.lang.check_int_overflow. When enabled,
compilation generates overflow variants of the Add, MinusEqual, Mul, MulEqual,
PlusEqual, PostDec, PostInc, PreDec, PreInc, and Sub instructions (with O
suffixes). During execution, if an integer overflow occurs, the variant
instructions raise an E_WARNING (if check_int_overflow=1) or throws an
ArithmeticError (if check_int_overflow=2).
Pull Request resolved: https://github.com/facebook/hhvm/pull/8585

Reviewed By: markw65

Differential Revision: D17859679

fbshipit-source-id: 76cfefef7085275be2c9801dd509a24eadf19da9
92 files changed:
hphp/compiler/option.cpp
hphp/hack/src/hhbc/emit_expression.ml
hphp/hack/src/hhbc/hhbc_options.ml
hphp/runtime/base/runtime-option.cpp
hphp/runtime/base/runtime-option.h
hphp/runtime/base/strings.h
hphp/runtime/base/tv-arith.cpp
hphp/runtime/base/unit-cache.cpp
hphp/test/slow/int_overflow/add_0.php [new file with mode: 0644]
hphp/test/slow/int_overflow/add_0.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/add_0.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/add_0.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/add_1.php [new file with mode: 0644]
hphp/test/slow/int_overflow/add_1.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/add_1.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/add_1.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/add_2.php [new file with mode: 0644]
hphp/test/slow/int_overflow/add_2.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/add_2.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/add_2.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/inc_dec_0.php [new file with mode: 0644]
hphp/test/slow/int_overflow/inc_dec_0.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/inc_dec_0.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/inc_dec_0.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/inc_dec_1.php [new file with mode: 0644]
hphp/test/slow/int_overflow/inc_dec_1.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/inc_dec_1.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/inc_dec_1.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/inc_dec_2.php [new file with mode: 0644]
hphp/test/slow/int_overflow/inc_dec_2.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/inc_dec_2.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/inc_dec_2.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/minus_equal_0.php [new file with mode: 0644]
hphp/test/slow/int_overflow/minus_equal_0.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/minus_equal_0.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/minus_equal_0.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/minus_equal_1.php [new file with mode: 0644]
hphp/test/slow/int_overflow/minus_equal_1.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/minus_equal_1.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/minus_equal_1.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/minus_equal_2.php [new file with mode: 0644]
hphp/test/slow/int_overflow/minus_equal_2.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/minus_equal_2.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/minus_equal_2.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_0.php [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_0.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_0.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_0.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_1.php [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_1.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_1.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_1.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_2.php [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_2.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_2.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_2.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_equal_0.php [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_equal_0.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_equal_0.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_equal_0.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_equal_1.php [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_equal_1.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_equal_1.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_equal_1.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_equal_2.php [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_equal_2.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_equal_2.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/mul_equal_2.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/plus_equal_0.php [new file with mode: 0644]
hphp/test/slow/int_overflow/plus_equal_0.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/plus_equal_0.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/plus_equal_0.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/plus_equal_1.php [new file with mode: 0644]
hphp/test/slow/int_overflow/plus_equal_1.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/plus_equal_1.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/plus_equal_1.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/plus_equal_2.php [new file with mode: 0644]
hphp/test/slow/int_overflow/plus_equal_2.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/plus_equal_2.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/plus_equal_2.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/sub_0.php [new file with mode: 0644]
hphp/test/slow/int_overflow/sub_0.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/sub_0.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/sub_0.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/sub_1.php [new file with mode: 0644]
hphp/test/slow/int_overflow/sub_1.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/sub_1.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/sub_1.php.opts [new file with mode: 0644]
hphp/test/slow/int_overflow/sub_2.php [new file with mode: 0644]
hphp/test/slow/int_overflow/sub_2.php.expectf [new file with mode: 0644]
hphp/test/slow/int_overflow/sub_2.php.hphp_opts [new file with mode: 0644]
hphp/test/slow/int_overflow/sub_2.php.opts [new file with mode: 0644]