Do not use std::containers in request roots
commitdb7803e6f51dc87a2afd9788fb3eb609fc254ce5
authorEdwin Smith <smith@fb.com>
Wed, 9 Nov 2016 17:06:56 +0000 (9 09:06 -0800)
committerHhvm Bot <hhvm-bot-bot@fb.com>
Wed, 9 Nov 2016 17:08:10 +0000 (9 09:08 -0800)
tree02cfc9092979f69865c552b10999eaad19a74b61
parenta82fd8980cd18dc8883b77fc32457f04e5a66115
Do not use std::containers in request roots

Summary:
The problem with using std::containers, is even if you write
your own custom scanner, the custom scanner cannot be called
in conservative mode. This is the same reason we cannot use
std::containers (of ponters) on the C++ stack.

This converts them to either folly::Optional(req::container),
for set/maps that allocate memory even when empty, or just
req::vector, which doesn't allocate memory until you insert
an element.

Stream::Wrapper subclasses: removed virtual scan() call. Either
the subclass is a static singleton, with no pointers, or req-heap
allocated with make_raw<T>, which makes it scannable.

HotProfilers: these were std allocated, but some contained req heap pointers.
made them all req::make_raw<T> allocated, since they (appear to) have
req-lifetime anyway.

Reviewed By: ricklavoie

Differential Revision: D4051201

fbshipit-source-id: 2fbcc72b35911abc2747845e2362efb30d7e5ee1
29 files changed:
hphp/runtime/base/data-stream-wrapper.h
hphp/runtime/base/file-stream-wrapper.h
hphp/runtime/base/glob-stream-wrapper.h
hphp/runtime/base/http-stream-wrapper.h
hphp/runtime/base/ini-setting.cpp
hphp/runtime/base/intercept.cpp
hphp/runtime/base/php-stream-wrapper.h
hphp/runtime/base/stream-wrapper-registry.cpp
hphp/runtime/base/stream-wrapper-registry.h
hphp/runtime/base/stream-wrapper.h
hphp/runtime/base/system-profiler.h
hphp/runtime/base/type-string.h
hphp/runtime/base/user-stream-wrapper.h
hphp/runtime/ext/bz2/ext_bz2.cpp
hphp/runtime/ext/hotprofiler/ext_hotprofiler.cpp
hphp/runtime/ext/hotprofiler/ext_hotprofiler.h
hphp/runtime/ext/intervaltimer/ext_intervaltimer.cpp
hphp/runtime/ext/phar/ext_phar.cpp
hphp/runtime/ext/reflection/ext_reflection.cpp
hphp/runtime/ext/stream/ext_stream.cpp
hphp/runtime/ext/xdebug/xdebug_profiler.h
hphp/runtime/ext/zip/ext_zip.cpp
hphp/runtime/ext/zlib/ext_zlib.cpp
hphp/runtime/ext_zend_compat/hhvm/zend-execution-stack.h
hphp/runtime/ext_zend_compat/hhvm/zend-object-store.cpp
hphp/runtime/ext_zend_compat/hhvm/zend-object-store.h
hphp/runtime/ext_zend_compat/hhvm/zend-request-local.h
hphp/runtime/ext_zend_compat/php-src/Zend/zend_objects_API.h
hphp/util/type-scan.h