[security][CVE-2022-27809] Builtins should always take int64_t, not int
[hiphop-php.git] / hphp / runtime / vm / minstr-state.h
blob3583ac76c3504bcf28b7016761c7c8cf0e17e8ba
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
17 #pragma once
19 #include "hphp/runtime/base/tv-val.h"
20 #include "hphp/runtime/base/typed-value.h"
22 namespace HPHP {
25 * MInstrState contains VM registers used while executing member instructions.
26 * It lives with the other VM registers in the RDS header, and is also saved and
27 * restored with them when we reenter the VM.
29 struct MInstrState {
32 * This space is used for the return value of builtin functions that return by
33 * reference, and for storing $this as the base for the BaseH bytecode,
34 * without needing to acquire a reference to it. Since we don't ever use the
35 * two at the same time, it is okay to use a union.
37 union {
38 TypedValue tvBuiltinReturn;
39 TypedValue tvTempBase;
42 // The JIT passes &tvBuiltinReturn::m_data to builtins returning
43 // Array/Object/String, which perform RVO in C++, thus writing valid
44 // pointers without updating m_type, preventing the GC from scanning
45 // the pointer. But conservative scanning doesn't really hurt here
46 // (given that the pointer is also passed into a C++ function), and
47 // it allows us to keep rds::Header below 128 bytes.
48 TYPE_SCAN_CONSERVATIVE_FIELD(tvBuiltinReturn);
50 tv_lval base;
52 // In order to support modifying readonly value type arrays, we need a bit to
53 // determine whether the last prop access in a member chain is readonly and
54 // COW.
55 bool roProp;
57 // type-scan driven scanner
58 TYPE_SCAN_IGNORE_FIELD(base);