Gráfico de Commits

217 Commits

Autor SHA1 Mensagem Data
bsimmers 48dc5639f1 Rename curFunc() to liveFunc() 2013-07-26 11:31:17 -07:00
bsimmers c16d3b3536 Rename curUnit() to liveUnit()
curUnit and friends are evil and have been the source of many bugs
I've had to track down in the region translator. Time to force an audit of all
callsites. Most of the uses of curUnit() could be changed to grab the unit from
somewhere else, and the few where that wasn't reasonable use liveUnit to make
the intent more clear.
2013-07-26 11:31:16 -07:00
Paul Bissonnette d63459b8e5 Adding floor and ceil to interpreter/jit
Added floor and ceil to the interp and jit, also fixed some type conversion simplifications.
2013-07-26 11:31:14 -07:00
Eric Caruso 2a793e36dc Instrument smart allocator
Dumps information about allocation events in smart
allocator, and aggregates some information such as bytes
allocated per callsite in the current request (or across
requests). This information can be gathered in the heaptrace
command, and the information collected during the trace is
enough to find how much memory an object is responsible for
(i.e. keeping reachable).

It's all conditionally compiled because perflab showed a pretty
significant instruction regression if it was a runtime option.
You'll need to fbconfig with --extra-cxxflags=-DMEMORY_PROFILING
in order to use it.

This isn't done, but I wanted to get some feedback on where I
should take this (general design, what to log, where to dump
stuff, etc)
2013-07-25 12:10:56 -07:00
Owen Yamauchi 6451f9fc04 Delete GlobalCache, take 3
Pulling the trigger; it's unused post-tx64. This diff preserves the
ability to mark units as merge-only when the pseudomain only contains
assignments to known globals. When the unit is being merged, the set
operation goes directly to the global varenv instead of through the
targetcache (GlobalCache stored pointers into the global varenv's
NameValueTable).
2013-07-25 10:56:08 -07:00
Paul Tarjan c1af7f57f5 fix str_split
This was coming up when installing Symphony using composer, and while I was in there I fixed a zend mode bug. We weren't doing the warning in the interpreter (and we were doing null instead of uninit). That was enough to move most of the tests over. The other problem is tasked.
2013-07-24 10:35:47 -07:00
mwilliams a946a8eb35 Get rid of TimeoutThread(s)
Use timer events instead. A side effect is that we now
support timeout in client mode. We also get much more
accurate timeouts. Previously starting a server with
a timeout of 4s, and GETing an endpoint that just looped,
would timeout somewhere between 3.5(!) and 8 seconds. Now
it times out between 4.0001 and 4.02s.

This will also make fixing pagelet timeouts much easier.
2013-07-24 10:35:43 -07:00
Jordan DeLong 7df1338063 Remove unused undef stuff in bytecode.cpp
Vestigial.
2013-07-24 10:35:40 -07:00
Jordan DeLong a466faf52d Implement more of php assert()
Adds support for string arguments to assert (outside of repo
authoritative mode), and support for ASSERT_QUIET_EVAL.
2013-07-24 10:32:26 -07:00
Jordan DeLong d709f1c6b1 Make fooIsPlausible functions take args by value
Also, checkTv is redundant now, since I added the refcount
assertions to tvIsPlausible earlier.
2013-07-24 10:32:26 -07:00
Jordan DeLong e250fd6336 Implement bitwise negation outside of Variant 2013-07-24 10:32:26 -07:00
Jordan DeLong 5732b1c491 Remove tvReadCell; use cellDup, sometimes with tvToCell instead
This function used memcpy on TypedValues where it doesn't
know the storage location, which is dangerous if the target lives in a
HphpArray (or anything else that uses m_aux).  It also just seems like
it's now an unnecessary/redundant entry point in the typed value API.
Several uses of it are on things that can't be KindOfRef anyway (I
fixed constants, but where I wasn't sure I used tvToCell first).
2013-07-24 10:32:25 -07:00
Edwin Smith 27e29de6f4 Move _count to offset 12, and rename to m_count.
This allows us to swap TypedValue.m_type and m_aux, which puts
m_type at offset 8 and simplifies the necessary code for passing
TypedValue by value.  It also makes the m_type and m_data fields
of TypedValue contiguous.
2013-07-23 11:44:14 -07:00
aravind 95664338cb Revert "Treadmill for shared variants" 2013-07-23 11:44:12 -07:00
mwilliams f57bc3bf88 Revert "Delete GlobalCache" 2013-07-23 11:44:05 -07:00
mwilliams 236f9d427c Revert "IterInit, IterInitK, IterNet and IterNextK specializations and guards" 2013-07-23 11:43:56 -07:00
bsimmers 75751d201c Run object destructors before clearing autoload handler
Our request shutdown procedure cleared the autoload handler
before running destructors of any remaining objects. This was causing
fatals when some of those destructors tried to use a
class/function/constant that hadn't already been autoloaded.
2013-07-22 11:34:11 -07:00
Edwin Smith 1140d2f313 Rename typedef Var to Ref (its a reference)
And, several helper functions with the prefix "var" were changed
to the prefix "ref".  I reworded the bytecode spec; the flavor letter
for PHP references is still 'V', but I reworded parts of it to use
the term 'pointer' instead of 'reference' in places where reference
was too overloaded.  Renamed 'var' to 'ref' throughout.
2013-07-22 11:34:11 -07:00
Dario Russi f2f631c163 IterInit, IterInitK, IterNet and IterNextK specializations and guards
Specialize IterInit and IterInitK after collection gurads and specialize IterNext and IterNextK after iter guard for collections and array
2013-07-22 11:34:10 -07:00
Owen Yamauchi 68202e773c Delete GlobalCache
Pulling the trigger; it's unused post-tx64. This diff preserves the
ability to mark units as merge-only when the pseudomain only contains
assignments to known globals. When the unit is being merged, the set
operation goes directly to the global varenv instead of through the
targetcache (GlobalCache stored pointers into the global varenv's
NameValueTable).

Supersedes D891179 -- I was overly aggressive in that one.
2013-07-22 11:34:08 -07:00
Jan Oravec 7cd2bb8c42 Use Cell instead of TypedValue whenever possible
Most of the values stored in TypedValue in ext_asio are always Cells.
Let's use Cell type alias to improve code readability, pass them by
reference where null is not allowed and use Cell-specific functions
from tv_helpers.h.
2013-07-22 11:34:07 -07:00
Jan Oravec 87fa04b2f2 tv{Cell,Var}As*(TypedValue*) -> {cell,var}As*({Cell,Var}&)
Make tv{Cell,Var}As* take {Cell,Var} instead of TypedValue. Take them by
reference instead of by pointer.
2013-07-22 11:34:05 -07:00
mwilliams 76aed9f150 Empty loops need to check surprise flags
We didnt count a brach to itself as a backward branch.
Also, there seemed to be a signed vs unsigned issue with IterBreak.
2013-07-19 12:57:28 -07:00
Mirek Klimos 90b7170582 Remove Continuation from local 0
No emitted bytecode relies on Continuation being stored in local 0
anymore. Stop using local 0 for this purpose and compute offset
to the Continuation at JIT time. 16 bytes of memory freed.

At this point all locals of Continuation construction wrapper share the
same indices with their respective locals of Continuation body, which
should allow further optimizations.
2013-07-18 17:28:42 -07:00
Edwin Smith 721f89b890 Flatten directories under runtime/base
This moves runtime/base/*/* to runtime/base, and fixes paths.
2013-07-18 17:28:35 -07:00
Edwin Smith c4e406b62f Move runtime/base/server to runtime/server
This is an incremental step towards moving it all the way
to hphp/server.  This flattens base but doesn't untangle
the server files from lib_hphp_runtime
2013-07-15 18:13:25 -07:00
Mike Magruder f051e2fe04 Don't go back to the interpreter after the end of pseudo main when debugging
Fix a long-standing bug where if you step off of the end of pseudo main we'd segfault in the interpreter loop. To get this we have to have a breakpoint in the final TC in pseudo main, and have that called from another TC, then Step or Next off the end. We'd end up with a PC of zero after the ret, which makes sense, but the logic after interpreting a block of code to stay in the interpreter when debugging was blind to this case.
2013-07-15 17:34:47 -07:00
Edwin Smith 9b6bf426b9 Move runtime/base/array/* up one level.
Also rename array_inline.h to array_data-inl.h
2013-07-15 17:34:47 -07:00
Edwin Smith 746862246f Fix typos from "Remove do/while(0) trick in iopFCallBuiltin macros"
s/-1/-i/
Add missing \
2013-07-15 15:46:28 -07:00
Jordan DeLong a28b21c191 Remove do/while(0) trick in iopFCallBuiltin macros
It doesn't really make sense in this context.  Also pushed
the if statement down into the CASE macro for now and fixed some
indentation.
2013-07-15 15:46:28 -07:00
Sean Cannella 61d58af783 fix compilation on Ubuntu 13.04
- missing inline generates warnings on Ubuntu which seems to
make compiler very unhappy

Closes #848
2013-07-11 17:25:02 -07:00
Jordan DeLong da32bc9d88 Turn off extended type hint checks 2013-07-11 15:12:06 -07:00
Guilherme Ottoni 244d4da93a Replace _ with - in file names under runtime/vm/jit/
Makes things more consistent, at least within this directory.
2013-07-11 15:11:11 -07:00
Jordan DeLong 524cbb5d3e Implement shift operators outside of Variant 2013-07-11 15:11:09 -07:00
Jordan DeLong dec333dd14 Implement most bitwise arithmetic outside of Variant
Everything except unary bitwise not.
2013-07-11 15:11:09 -07:00
bsimmers 182ced3575 Remove operator==(Op, Opcode) and friends
I added them to ease the transition but since Opcode is just
uint8_t, they remove a lot of the safety of making Op an enum class.
2013-07-10 11:16:52 -07:00
Alexandru Suhan c330882232 Combine IssetM and EmptyM implementations 2013-07-10 11:16:32 -07:00
mwilliams 795aa1309c Cleanup lifetime management for translation units
For PhpFiles, there was a mixed management system, where references from
translated code were held until the code was made unreachable, while
references from interpreted code were held for the duration of the
current request. Under the new scheme, PhpFiles are always treadmilled.
They are owned by the FileRepository, and so need to be ref-counted
because the FileRepository can have the same PhpFile under multiple
paths. But we don't ref-count the *uses* of PhpFiles anymore.

Classes still need to be ref-counted, but as soon as their Unit
goes away, most of their internals can be freed. We just need to
hold onto them if derived classes are referencing them. Even in
that case, the next time we try to instantiate the derived class,
we can kill any that reference this Class.

There were also lots of holes where references were not dropped,
or owned data structures were not destroyed. eg a Class's methods
were not destroyed when the Class was destroyed; there were
several paths where an entry was erased from the file map, but the
corresponding PhpFile was not decRef'd - or worse, a null entry
was left in the map (something we had asserts to check for).

This tries to make the handling more consistent.
2013-07-08 10:30:58 -07:00
Drew Paroski d336b46cc7 Merge ObjectData and Instance together, part 2
When object support was first added to HHVM, a class named "Instance"
was introduced (deriving from ObjectData) to represent instances of user
defined classes. Since then, things have evolved and HPHPc and HPHPi have
been retired, and now there really is no needed to have ObjectData and
Instance be separate classes anymore.

This diff moves all of the functionality from the Instance class to the
ObjectData and removes the Instance class. In the process, I got rid of
a bunch of dead methods and fixed some indentation and other style issues.
2013-07-08 10:30:57 -07:00
Paul Bissonnette 0d5d5bca72 Added IterBreakV, MIter{Init,InitK,Next,NextK,Free} and fixed memory tracking bug.
Added IR opcodes to perform MIter* instructions in JIT.  Added IterBreakV bytecode
operation to break out of multiple loops containing iterators.  Emitter and assembler
were modified to support such use.
2013-07-06 11:12:28 -07:00
Jordan DeLong 5371743d9d Convert tv_comparisons/tv_conversions by-pointer TypedValue/Cells to by value
If we're not going to mutate the Cell, it might make sense to
pass it by value rather than pointer to const.  Do folks like this
better?  I can see a couple arguments various ways.  But it does seem
like even if we want to pass it by pointer at the hardware level we
would ideally passing by const reference at the language level, so
this choice would be transparent at callsite code.  This diff doesn't
change anything in tv_helpers.h for now.
2013-07-06 11:12:27 -07:00
Eric Caruso 5c486012c9 Basic heap tracing framework + debugger command
Adds an extension command to the debugger which provides
heap tracing functionality, and adds the framework needed to get
heap traces. The heaptrace command can dump the current heap to the
debugger session or it can save a GraphViz specification to a file.

I'm hoping to add a backend which can put the graph in GML format,
so it can be explored interactively. I also hope at some point to
see this integrated into FBIDE if we can do that.
2013-07-06 11:12:16 -07:00
mwilliams db29a1127c Disable code coverage for systemlib.hhas
It has no line number information.
2013-07-02 11:46:28 -07:00
Jordan DeLong 361df7eb45 Convert tvSet family to take TypedValues by reference
Turns out I need to use tvSet with temporaries.  Also removes
unused tvSetObject*, and replaces some tvSetNull* callsites with using
make_tv temporaries.
2013-07-02 11:46:27 -07:00
Mirek Klimos 5a98277b6c Replace ContSend by CGetL+CUnsetL
The behavior of ContSend is equivalent to CGetL+CUnsetL. Let's kill this
unnecessary opcode. Let's remove this logic from ContRaise opcode as
well.
2013-07-02 11:46:25 -07:00
Jordan DeLong c51583cfb8 Functions for basic php arithmetic operators in tv_arith.h @override-unit-failures
Deletes operator overloads on variant for the same and points
bytecode.cpp at them.  Also fixes one known accidental deviation from
zend.  These functions take Cells by value because it seemed to make
sense---I'll likely convert the various functions in the new
tv_conversions.h (and tv_comparisons.h) to do the same but in another
diff.
2013-07-01 13:41:01 -07:00
Jordan DeLong 8220a18060 Convert a few tvFoo functions to take parameters by reference
Since TypedValue::operator= is dangerous, something like
tvTeleport is usually what you want to use, but it doesn't work with
temporary TypedValues (e.g. return values of things like make_tv or
cellAdd), because it took the arguments by pointer.  This also means
we can change it to take parameters by value later without updating
callsites.  This diff does the tvDup family and changes tvTeleport to
tvCopy.  I'll gradually get the other ones done, but I just need these
for now to work with temporaries for changing SetOp to not use Variant
arithmetic.
2013-07-01 13:41:00 -07:00
Eric Caruso 97a23e5ea7 Support for yield k => v;
Updates continuations to allow yielding of a key-value
pair from a generator. Adds bytecode instructions (PackContK,
ContKey) for using the new feature, and adds IR instructions
(ContUpdateIdx, ContIncKey) to help get it down to the metal
(in particular, ContIncKey attempts to keep the current use-cases
as fast as possible).
2013-07-01 13:41:00 -07:00
Drew Paroski e7b90fa691 Clean up how the DebuggerDummyEnv is set up and torn down
A recent diff called my attention to the logic in enterDebuggerDummyEnv()
and exitDebuggerDummyEnv() and I noticed it didn't look quite right.

The first time enterDebuggerDummyEnv() is called it creates a frame on an
empty call stack, but then exitDebuggerDummyEnv() does not correctly tear
down this frame and null out m_fp and m_pc, and this leads to subtle issues.
For example, invokeFunc() checks if m_fp is null to decide whether to call
enterVM() or reenterVM(). I found a case with the "flow_gen_excep.php" test
where invokeFunc was incorrectly calling reenterVM (because m_fp hadn't
been nulled out) and it was pushing bogus VM state info into m_nestedVMs.
This in turn was causing the logic in CmdNext::onBeginInterrupt() to get
confused when comparing the original stack depth with the current stack
depth.

This diff updates exitDebuggerDummyEnv() to correctly tear down the frame
and null out m_fp and m_pc, and it updates enterDebuggerDummyEnv() to
assume the callstack is always empty (which should be the case). I've also
beefed up the asserts in both of these methods.
2013-07-01 13:40:59 -07:00
Mirek Klimos eddef7ffc0 Replacing PackCont and ContExit opcodes with ContSuspend.
PackCont opcode is always followed by ContExit so let's join them into ContSuspend. ContResume counterpart may come later (replacing ContNext/Send/Raise/Enter).
2013-06-28 10:33:50 -07:00