Gráfico de Commits

80 Commits

Autor SHA1 Mensagem Data
Sean Cannella db987b4a4d clean up gcc 4.7.1 warnings on OSX
- cleans up new warnings
2013-07-18 17:28:43 -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
Owen Yamauchi 86eb82ec2f Fix break/continue parsing
This is exactly what Zend's parser does now. I'm a little sad about
adding the bool parameter, but all the checking code was exactly
duplicated otherwise, and that seemed like the worse alternative.

Fixes #854
2013-07-18 17:28:38 -07:00
Kyle Delong a8e3321fbd HPHP/XHP: 'mixed' type in attribute declarations
We'd like to start using ##mixed## instead of ##var## for attribute types to be consistent with Hack. As a followup to this (once released), we would codemod all ##var## to ##mixed##.
2013-07-18 17:28:37 -07:00
Sanjeev Singh 75397a10c7 Initial rough draft of xhpast2, a replacement for xhpast
The goal of this diff is to clean up the current work-in-progress and check
it in so that others may contribute if they have time.

The program currently outputs the HHVM tree as well as the xhpast-like
json, for ease of debugging. There is a little helper program jsonpretty.py
to make the trees more readable, e.g.

_build/dbg/hphp/util/parser/xhpast/xhpast2 <some php file> | hphp/util/parser/xhpast/xhpast2/jsonpretty.py
2013-07-15 15:46:32 -07:00
Kyle Delong 9108d3523d XHP comment syntax
XML comment syntax for XHP is one of the top wishlist items within the UIE group (+ some other people).

Currently, the only way to have comments inside XHP blocks is to use expressions and block comments, e.g.

  <div>{/* comment */}</div>

After this change, you can use the more familiar syntax. This syntax is limited to XHP child contexts:

  // Only single-line, doc, block comments work outside XHP
  $xhp =
    <div>
      <!--XML comments only work within XHP children contexts-->
    </div>;

Based on http://www.w3.org/TR/REC-xml/#sec-comments - except we ignore the rule about double hyphens ('--') within a comment because we don't care about SGML.
2013-07-06 11:12:26 -07:00
Dario Russi ef99ac3445 Allow parameter promotion in constructors
Extend PHP to allow constructor paramters to be promoted to fields. Reduce plumbing of class declaration and helps productivity.
2013-07-06 11:12:21 -07:00
Alok Menghrajani 7a9769a95b Fix HPHP's parser when handling generics
We need to allow any type after the AS keyword, including xhp class names.
2013-07-02 11:46:25 -07:00
Sean Cannella c891ec4d62 annotate printf-like functions
- added annotations to a few more functions
- fixed a few bugs exposed by the annotations
2013-07-01 13:41:02 -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
Jordan DeLong 62dd2e2aae Allow type constraints on opaque type aliases
Allows some syntax that is ignored at runtime; only used
ahead of time by the type checker.
2013-06-27 10:50:12 -07:00
Drew Paroski e6b6aa0b09 Clean up the hphp/system folder
I noticed that directorty structure of hphp/system was a bit scattered, so
I consolidated things to reduce the total number of folders and to put
related things together with each other.

This diff moves the contents of "hphp/system/classes_hhvm" into
"hphp/system", it moves the contents of "hphp/system/lib" into
"hphp/system", moves "hphp/idl" to "hphp/system/idl", and moves the
contents of "hphp/system/globals" into "hphp/system/idl".
2013-06-15 23:29:49 -07:00
Owen Yamauchi d7c2eac643 Get rid of variable break/continue
This is gone as of Zend 5.4: as far as I can tell, anything other than a
positive integer literal is a parse error (including constants, "1 + 1",
etc.) Let's get rid of it. The mere fact that this construct ever
existed in any programming language is deeply horrifying.

This lets us get rid of all the goofy code that subtracts 1 from the top
value on the stack, does IterFree if needed, and jumps to the next
level. Now, we can hardcode the necessary IterFrees and do a single
jump, right where the break/continue actually is.

The error message for using a non-integer expression is less helpful
than Zend's (Zend says "non-constant operand not supported"; ours is
"unexpected T_VARIABLE" or whatever). It wouldn't be that hard to do in
our parser, if we think that's helpful. I don't think it matters,
though.
2013-06-12 17:10:34 -07:00
Paul Tarjan 269ec416d5 Rename closures and generators - take 3
This reverts commit 2e9677b7c3f37e9627b9cbc9a6ddec82a10e7215.

Third time is the charm. I hid it from reflection, but I missed `get_class_methods`.

The diff betweenn this and what was reverted is https://phabricator.fb.com/P2217891 and then I did https://phabricator.fb.com/P2217904 because it looked like it should be done.
2013-06-12 11:34:39 -07:00
Jan Oravec 9662396bf0 Store variable arguments in optional local
Save 8 bytes of m_args and its initialization for Continuations without
func_get_args() call (does not save real memory due to 16-byte alignment).
Store variable arguments in optional local.
2013-06-11 11:48:06 -07:00
Drew Paroski 9b95c48416 Fix issue with XHP and keywords 2013-06-11 11:47:47 -07:00
Paul Tarjan d5ee17487a allow constants in systemlib
The problem was a few:

* All constant declarations were wrapped in a statement list. The merge-only check was allowing top-level `define()`s but not top level statement lists. I unwrapped them. I have no idea why it was done. Probalby just cargo cult programming.
* When converting a UnitEmitter to a Unit we only allowed constants in RepoAuthoritative mode and not systemlib mode.
* Systemlib constants weren't being set as UnitMergeKindPersistentDefine
* UnitMergeKindPersistentDefine constants weren't being marked mergeOnly when pulling out of a repro
2013-06-11 11:47:28 -07:00
Drew Paroski a41fb387a7 Fix parsing for generic constraints with the "as" keyword
For generic constraints, the grammar (incorrectly) did not allow for
generic types on the right hand side of the "as" keyword. This diff fixes
the grammar appropriately.
2013-06-03 23:54:38 -07:00
Paul Tarjan 9519cefd00 fix parser tests
I was quite stupid in my rewrite and totally broke this. Wow, it runs fast!

I had to switch to `HHVM_BIN` as the env var, since it seems we force `HHVM` to 1 all the time...
2013-06-03 23:54:38 -07:00
mwilliams 013c18b1f8 Fixup lots of include paths
This fixes most remaining paths to be relative to the git root.
2013-06-03 23:54:37 -07:00
Tim Starling 998951619f update copyright date
We did not intend to imply our copyrights last forever

Closes #759
2013-06-03 12:43:56 -07:00
Drew Paroski 9e1e4e0573 Revert "Rename closures and generators"
This reverts commit f9e1a492285d27021ba50c49049823e7516edb6a.
2013-06-03 10:54:39 -07:00
mwilliams 23919b915f Fix crash/hang in Parser::newClosureName
The parser was updating a static std::map without a lock.
It looks like this is supposed to be local to a file anyway,
so add the map as a member of ParserBase.
2013-05-28 10:30:27 -07:00
Paul Tarjan abb171eb41 allow (clone)->bar() and (<xhp>)->bar()
People have asked for ##(new Foo)->bar()##, ##(clone Foo)->bar## and ##(<xhp>)->toString()##.
2013-05-28 10:30:07 -07:00
Erling Ellingsen dcf471996e Fix shapes
The keys were dropped.
2013-05-21 11:17:35 -07:00
Sara Golemon 5e655de3d0 Remove FB specific makefile fragment from OSS repo
To rebuild generated files, see: hphp/tools/generated_files.sh help
2013-05-20 13:52:33 -07:00
Paul Tarjan 4da410ab58 Rename closures and generators
Closures and generators are really hard to reason about in backtraces.

For generators, I took the exact name of the method and put ##$continuation##. I put it at the end so it reads exactly like a method name since in WWW we use them almost the same as the method itself.

For closures, I named the class ##Closue$Class::method#num## where num is an optional autoincrementing number.

I decided to stop prefixing the methods with ##0## which is breaking the reflection tests.

This basically redoes D782498 and D750608 but it works in repo mode.
2013-05-20 13:52:30 -07:00
Matt Glazar d6d9955136 Allow shebang/hashbang (#!) as first line in Hack files
A shebang allow a script to be run as an executable on UNIX
systems. PHP allows shebangs, but Hack does not. This
changeset allows Hack to have shebangs like in PHP.
2013-05-20 13:52:27 -07:00
Paul Tarjan d8b36de433 allow namespaced classes in type args
This is a bug that running Symphony found. This part of the AST is weird as it doesn't introduce any more nodes, but I think I got it right...
2013-05-20 13:52:26 -07:00
Rasmus Lerdorf be93cbfa08 Fix Bison paths
Some internal FB bison version thing?
2013-05-17 23:37:36 -03:00
Rasmus Lerdorf 4530d5d25e Need short array syntax here too 2013-05-16 15:04:16 -03:00
mwilliams 27601d53fd Revert "Allow shebang/hashbang (#!) as first line of Hack files"
This reverts commit d1f3c9e03d4eed7a3262bcdb461b77bbd661e5d6.

Its breaking tests
2013-05-15 13:05:09 -07:00
Matt Glazar eb6eb3f495 Allow shebang/hashbang (#!) as first line of Hack files
A shebang allow a script to be run as an executable on UNIX
systems.  PHP allows shebangs, but Hack does not.  This
changeset allows Hack to have shebangs like in PHP.
2013-05-15 13:05:08 -07:00
Sara Golemon 6ec64e8bf9 make #includes consistent
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
2013-05-15 13:05:06 -07:00
Drew Paroski a8d84e2f21 Refactor HipHopSyntax and HackMode to play nice 2013-05-15 13:05:04 -07:00
Alok Menghrajani db9577b140 Rename strict with Hack
Strict mode was the old name. Let's avoid any confusion in the future and rename things.
2013-05-15 13:05:03 -07:00
Paul Tarjan 1e0f032ba7 absorb comments on namespaces
This test didn't really intentionally test this, but it caught us not eating comments on namespaces.

I don't understand the difference between ##ParserBase## and ##Parser##. Maybe this belongs here? It needed to be here to have access to ##pushComment##.
2013-05-15 13:05:03 -07:00
Paul Tarjan 06cb6611dc handle closing tag in ?>
I wanted to get closer to zend's implementation but they seem to do scanning and parsing at the same time. We don't have the state of the parser when the scanner sees the ##?>## token. I think this is the next best thing if we don't want the refactor of D808985
2013-05-15 13:05:03 -07:00
Paul Tarjan 2f023e66db allow \ in function types
I looked at all the other uses of ##ident## and I think they are correct to not allow namespaces but we'll see.
2013-05-15 13:05:02 -07:00
Paul Tarjan efbb53323e clear aliases between namespaces 2013-05-15 13:05:02 -07:00
Paul Tarjan 96e793360b function and constant fallback for namespaces
It turned out a lot of the namespace stuff still worked. The biggest thing for the first pass is that we don't fallback to the global function or constant if there isn't a namespaced one.

Also, when a constant has a ##\## anywhere in it it throw an error when it isn't defined, instead of assuming the string.
2013-05-15 13:05:01 -07:00
Paul Tarjan 8047bac356 line up stuff
These are the only braces not lined up on that column in this file.
2013-05-09 11:33:53 -07:00
Erling Ellingsen 1e78ff4999 Allow type aliases to take (ignored) type arguments
type Foo<T> = Bar<T,T> is treated as Foo = Bar; Foo<T> = @?T isn't supported.
2013-05-09 11:33:23 -07:00
Sara Golemon 38f9fab773 Fix __HALT_COMPILER() support
Actually halt the compiler, and set __COMPILER_HALT_OFFSET__ constant
2013-05-01 20:59:44 -07:00
Drew Paroski 6a2c5150ed "trait implements" syntax 2013-05-01 20:59:44 -07:00
Owen Yamauchi a57ae0488a Generate the parser at build time, part one
Update a number of things to make optionally generating the parser at
build time possible.  @sgolemon will add the OSS pieces of this in a
separate commit.
2013-04-30 09:57:57 -07:00
Rasmus Lerdorf 441c137dcb Implement PHP 5.4's short array syntax
We have traits and some other PHP 5.4'isms why not the short array syntax as well?
2013-04-26 13:28:39 -07:00
Owen Yamauchi 05b6e5be7d Rename lexer source and add generator rule 2013-04-25 00:50:00 -07:00
bsimmers fa0a201dde Revert "name anonymous continuations as Class::Method$continuation" 2013-04-22 14:43:52 -07:00
Jordan DeLong 3db2140e3e Fix some cpplint errors about illegal symbols
Various perling.
2013-04-22 14:43:49 -07:00