I was learning from @jdelong and he said that you should use
double quotes for local includes and angle brackets for library
includes. I asked why our code was the way it was, and he said he wanted
to clean it up. I beat him to it :)
Conflicts:
hphp/runtime/base/server/admin_request_handler.cpp
hphp/runtime/vm/named_entity.h
This is intended so reflection can be used (via getTypehintText and getReturnTypehintText) to regenerate code the user annotated with types. Essentially using reflection to intrispect code in order to generate type safe
(hack safe) code. That is particularly important for the tools that do dependency injection. The runtime should be oblivious to the change as the rich type annotation is currently only stored for the sake of reflection. For
functions the values are in the shared portion which is cold and should also take care of traits.
After the "Great Test Refactor of 2013" these names didn't make sense.
After this diff, we now have 3 suites:
* Quick (old vm)
* Slow (old TestCodeRun)
* Zend
I like that Quick tests aren't in sub-suites and the Slow tests are. So that is a good litmus tests of what to put where.
I left all the old Makefile rules. I'll blow them up in a few weeks.
This diff is based on a simple unreviewable diff of
$ mv test/vm test/quick
$ mv test/tcr test/slow
I changed the ##run_verify.sh## script to recursivly search for a ##config.hdf## file and use that one. This allows us to easiy customize the options for each suite.
I converted the 6 different runtime options we supported to symlinks of ##.opts## files to the option that the test wants. If I was smarter I would then convert these to ##config.hdf## if the whole suite wanted the same options, but I'll save that for later cleanup if we want it.
I moved the config files around a bit. `test/cli.hdf` became the default `test/config.hdf`. `test/config.hdf` became `test/tcr/config.hdf`. `test/zend/config.hdf` is also now an empty file so it doesn't inherit `test/config.hdf`.
I'll handle the Repo part of the tests in the next diff. Then the next one after that will delete all the cpp code and Makefile targets and force you to just use ##tools/run_verify.sh## which I think we should rename ##test/run## or something easy.
While I was working on the TestCodeRun refactor I found two tests about Tainted code. I looked into it and coulnd't get HHVM to compile with TAINTED=1. Then I checked and none of the extension functions we exposed about tainting were used in WWW. Scratching my head I asked, @srenfro and @jdelong, who thought it was dead. So I killed this zombie.
I made a sample directory with a file, a symlink, a dir, a recursive symlink and an empty file. Hopefully that is enough edge cases.
I tried to find all the places that used weird files and ##test## in TCR and used this dir instead.
Generators should specify function names as the name instead of the
full name for consistency with Zend 5.5 (and more importantly because
this breaks PHPUnit), this was exposed by the backtrace removal of
file and line info
After some recent cleanup to generators, local analysis was
able to remove some stores that it shouldnt have done, because
it didnt take account of the fact that the locals were
generator parameters.
This is the first part of the work to expose type constraint and generic all the way to reflection. This first DIFF exposes the return type with generic types coming next.
The 'r' encoding for unserialization was broken for collections because the
code was calling Variant::unserialize() on a temporary Variant, which is a
no-no. unserialize() must be called directly on the value where it resides
in the collection.
Second, there was an inconsistency between serialize and unserialize with
how id numbers worked for the 'r' and 'R' encodings. This diff fixes
serialize and unserialize to count collection keys when assigning id
numbers. I also took the opportunity to tighten up enforcement to prevent
collections keys and values from being taken by reference when during
unserialization.
Continuation::send() uses m_received field to transfer the value inside
the continuation. This field remains set until the continuation is
iterated the next time.
Unset this field early by ContReceive so that the memory can be
reclaimed.
They both returned the late static bound class, not the context
class. This meant that eg "constant('self::FOO')" was actually
returning what "constant('static::FOO')" should have done.
In addition, we often want the Class*, not its name, so
change them to return Class*. The remaining places that then
read the name from the Class* should be fixed to use the Class*
directly (in a later diff).
Finally, noticed that while "defined()" was recently fixed to
support "static::", "constant()" was not. Pulled out a common
function to find the correct Class*.
In Zend 5.3 they decided that closures should inherit the ##$this## from the containing scope. This brings us close to paraity with them. The remaining thing is to make
function() use ($this) {}
fatal after we purge it from WWW.
This diff implements VectorTranslator::emitPropSpecialized and uses it
in three places: emitProp, emitSetProp, and emitCGetProp. The new test case in
test_code_run.cpp used to crash TranslatorX64; now it throws a fatal to keep
things simple. VectorTranslator has better control flow support at its disposal
and is able to get that case right.
Replace "collection" with "collections" in various file names since
we typically use the plural form in conversation and documentation.
Add set() and removeAt() methods needed for collection interfaces. Also
add the KeyedIterable and KeyedIterator interfaces.
Add __construct() methods for collections
Support == and != operators for collections. Also fix some bugs the <, <=,
>, and >= operators when comparing two objects or when comparing an array
with an object.
chars_len holds the capacity of the buffer on input,
and is filled in with the number of chars written.
It was not being set, causing random behavior (including
potential buffer overrun). The testcase actually relied
on it being set to a too-small value.
We only have recursion if what we're currently looking at is the same as
one of its parents in the nested arrays. We don't need to keep track of
everything that's been seen, only the elements seen in a path down to that
element.
Instead of having the body of the closure be in the ##__invoke()## on the ##Closure## class, instead we make an anonymous function on the real class and put the body there. The signature for this function is:
function methodForClosure$1234($arg1, $arg2, ..., $use1, $use2, ...)
and then ##__invoke## now just takes all the params that were passed to it, puts them as the first args to the anonymous function, then takes all the use variables it had saved up and passed them in as the next params.
I tried to not have an ##__invoke## at all, but I ended up basically doing the same parameter and use var repacking in iopFCall (and would have had to do it in x86 code too). I opted for doing the rejiggering in bytecode. If I did it in raw PHP I think it would have been much slower with many ##func_get_args()## and array operations.