« first day (3047 days earlier)      last day (1916 days later) » 
00:00 - 18:0018:00 - 00:00

12:08 AM
@JoeWatkins if you're around, I have a tiny ext proof of concept and I'm getting a memory leak that I have been unable to trace. Also would like some feedback on approach...
 
12:47 AM
^ I think I fixed it. :)
@LeviMorrison @JoeWatkins @NikiC this is a quick proof of concept for implicit copy-on-write. I would like to know if this could be considered the standard pattern for achieving this. Are there any drawbacks to doing something like this? This is still a WIP so feel free to commit directly. :)

https://github.com/php-ds/ext-ds/tree/cw
 
 
1 hour later…
1:59 AM
@NikiC There're two entries for the "Consistent type errors for internal functions" RFC at wiki.php.net/rfc under the "Under discussion" section.
Where/when does the type inference happen in the source code? I'd like to play with this feature request: bugs.php.net/bug.php?id=45569
 
 
1 hour later…
3:21 AM
After spending 20 minutes coming up with an example to paste into here, I think I finally convinced myself what I need to do to be happy with my unit tests...
writing up the example I was about to paste convinced me I may want to just restructure my code lol
In any case, still curious what the community may have to say. I'm rather new to unit testing and am trying to write sensible tests that have a purpose. And while writing tests for my abstract class I quickly became unhappy with the tests. Realizing "this isn't really proving anything useful here".
example was:
class AbstractCurrency
{
    const SUBUNIT_PRECISION = 0;

    public function getSubunitPrecision() : int
    {
        return static::SUBUNIT_PRECISION;
    }
}

class USDollar extends AbstractCurrency
{
    const SUBUNIT_PRECISION = 2;
}

class Dinar extends AbstractCurrency
{
    const SUBUNIT_PRECISION = 3;
}


class AbstractCurrencyTest extends \PHPUnit\Framework\TestCase
{
    public function testGetSubunitPrecision()
    {
        $abstractCurrency = new \ReflectionClass(AbstractCurrency::class);
My tests for the abstract class, in above example, don't really prove much in my mind.
What I really need to do, is ensure the function returns what I expect it to, in the concrete class.

So I think I've convinced myself, that, since I don't have much of a need for the class constants (they were just providing a way to write very small concrete classes)...

What I need to do, to get some tests I'll be happy with, is:

- forget using the constants
- in my abstract class, define the (current) concrete methods as abstract
Bah, and I just realized my example is off anyways.
public function testGetSubunitPrecision()
{
    $stub = $this->getMockForAbstractClass(AbstractCurrency::class);
    $this->assertEquals(0, $stub->getSubunitPrecision());
}
^ That's what I had meant. Which... is what I'm unhappy with. Doesn't seem to accomplish providing anything as it isn't until the concrete class inherits the abstract, and overrides the constant, that any value is yielded.

And therefore I may as well write out more tests for my concrete classes instead of pointless tests on the abstract.
 
4:00 AM
ugh two separate OCD compulsions still fighting in my head though. As converting my concrete methods (currently in the abstract) into abstract methods.... I'm going to have so much code duplication now.
 
4:44 AM
\o
 
o/
 
not going to do a million things today, woken up exhausted still
 
:< what gives you energy? Or what's been stealing it?
 
not sure, sleeping doesn't always work though, only had eyes closed for four hours
 
5:14 AM
nn all
 
@JoeWatkins Did you manage to make Runtime::kill() interrupt system calls such as sleep?
 
5:29 AM
no, it's not possible, it's not possible to interrupt any internal function call
 
@JoeWatkins Yep, turns out my test was killing the thread before it got to the sleep call.
 
ah, as a possible alternative while testing, use usleep loop and some small number so the vm keeps being entered ... maybe
I'm doing that
 
I simply used an event loop timer, which is interrupted every 250ms by the empty timer.
Though a loop with usleep might be another test to do.
 
6:09 AM
@beberlei fixed first test and a few other things, I'll leave backtrace stuff to you
need to rename includes *.inc, it's missing because deleted on make clean ...
 
6:25 AM
o/
 
\o/
 
We took Faf on a trip with us over the weekend. :)
 
pretty kitty
 
Often the only other breath around here.
(thanks)
 
MVS
7:16 AM
hello everyone
 
7:35 AM
@JoeWatkins hah that is some advanced level trickery in the commit :)
 
when it gets complicated, it gets complicated
it's not quite perfect, will be fun for you to debug :)
 
8:00 AM
prestigious archaic : of, relating to, or marked by illusion, conjuring, or trickery
 
Morning
 
8:16 AM
ormin
 
o/
 
@DaveRandom ping
I used cast_as_fd to pass a resource to the child, in unix this work, but in windows, it's got some nonsense fileno, 376, and fails to be fopen'd in the child ... I'm not sure if you told me already, but tell me again how I work around this ? it would seem like cast_as_fd is just broken in windows ? and cast_as_socketd has exactly the same behaviour, because there's no distinction and it seems from ms docs
that even FILE cannot be cast to SOCKET ... so ... fix it fix it fix it ...
 
8:39 AM
@GabrielCaruso Thanks, fixed
@GabrielCaruso What does this have to do with type inference?
 
0
Q: Changing the font styles in pdftk fillable fields

Deeban BabuI am using pdftk for filling the value in pdf forms. Req: Need to change font size and style based on string length in programmatically. Is there any way to change the font style for all textboxes programmatically? $pdf = new Pdf($localFilePath); $dataFields=$result[$name]['datafield']; $pdf->...

H guys
anyone have an idea about changing the font style for fillable pdf
 
9:41 AM
morns
 
10:08 AM
\o
 
we're going to need a new "assign to dmitry" button on bugsnet
 
it's dirty as absolute hell for now
plan on cleaning it up in the next few days, but there you go :)
 
10:48 AM
Precisely. Should strip that :)
 
license in composer.json says bsd but repo has mit
 
@Paul can you open a bug for that? I am out for a few hours without my laptop and I definitely don't want to forget that
 
sure thing
 
There is a ton of refactoring needed. But I am pretty happy with it for like 3.5 hours work on an airplane with almost no reference material other than 2 c++ man pages opened on my phone :)
One big thing that I couldn't remember my memory is Shunting-Yard. Need that for define expression evaluation
 
a good start
 
10:56 AM
Oh, and you can define before including headers (or after, though that's less useful) so if the header requires variables set it supports that :)
Question now that I am thinking about it. Would it be better to generate a class with all the functions and type helpers?
Rather than using dynamic magic methods...
As I am saying it, yes, yes it would, especially for my needs (since I will be teaching the compiler how to swap FFI calls for native c calls...
 
@ircmaxell What's it do?
I thought the FFI already had some kind of header parsing thingy?
 
yeah but it doesn't support #define
 
It only parsers the c definitions themselves. Has no preprocessor support
 
you generally can't just use a header on your system, you have to copy the bits out you need, and change stuff like attributes, cdecl and such
 
Which for simple cases is easy enough. But for complicated libs is just a bit annoying
 
11:10 AM
and it's not super portable at all, some public struct may have many defs in the wild
 
Ummm... Does this mean we can make uopz in PHP now?
 
that would be pretty complicated
 
Stupidly so. But that doesn't mean no.......
 
anything close to the engine is going to be quite hard, especially close to the vm ... how do you set an opcode handler ? what if the callback you set as the handler itself invokes the handler ...
 
I just like finding the craziest idea I can, and then stopping 1/4 way through
 
11:15 AM
haha
I've heard people say they could write modules in php now, but I don't think that makes any sense
 
@JoeWatkins true. I guess I am still stuck in jit mode where I am thinking by the time the hander us installed it is native code
 
the powerful hooks are on zend_extension api, which you can't load at runtime, the hooks on modules like rshutdown can't do user code, because it's gone already by rshutdown
 
@JoeWatkins for wrapping external c libraries like drivers and such, definitely. But not engine extensions
 
so all you've got left is registering functions ... and you can do that by just declaring a function ...
yeah I might look at the ui thing, it won't replace it quickly, but that seems a suitable target to try
 
Though, for specific things, you could in theory use it to manipulate op arrays and such, generating otherwise impossible opcodes
Not sure why you'd want to....
 
11:19 AM
it's not that simple anymore is it, you don't know where the op array is, you don't know what processes your changes are effecting, to modify op arrays take a lot of dancing around ...
once we can compile some code to a shared object, then we can really get into it ... LD_PRELOAD and replace zend_jit :D
all of the cfg stuff from optimizer should be accessible also ... that's got some good use cases in userland for analysis and such ...
 
If you are really careful (and stupid) you could patch the compiler to do things like phppreprocessor for all compiled files right through the engine
 
I can't figure out how to do new syntax from an extension, except if it's in comments, no idea how to do that from ffi if I can't do it from an extension
well, there's one way to do it from an extension, I got a prototype here ...
but it's crap ...
replacing the compiler hook and running your own first and stripping out invalid/your syntax works ... but it's pretty awful ...
 
we've secretly replaced the zend engine with folgers crystals.. let's see if anyone notices
2
 
also when the ffi calls user code, it doesn't free the call stack until the end of the request, I brought this up and got battered to death on internals like I didn't understand anything, but anything that calls from that side of the interface is broken, I don't care what dmitry says ...
if you can only do something a limited number of times before exhausting memory, it leaks ...
 
That's precisely how I would do it (how preprocessor does it)
 
11:30 AM
^^
 
Code generating
What do you mean doesn't free the call stack? You mean non-owned memory?
 
it doesn't free the memory it used to pass the arguments until the end of the request, according to dmitry that's good enough, but it ruddy well is not good enough, it means you can only call from C into PHP a limited number of times before exhausting memory, it don't know what to call that other than a leak ...
I see the problem, I see why it can't free the memory, but it still means one side of the interface is not generally usable like the other side is ... but I'm not going to bring it up again ...
 
Wait what? Are you serious? If I call pritnf, it will leak the cstring?
 
no the other way
if some c function calls into php
 
Ah. Okay. Not planning on using that functionality, so doesn't bite me ;)
 
11:36 AM
well how are you going to set zend_compile_file ?
 
And yes, that is extremely problematic and means that functionality should be pulled, or hidden behind a severe compile flag.
--enable-memory-leaks-for-ffi
 
well apparently I'm stupid for bringing it up ... so I'm not doing it again, but it looks broken on one side to me ...
 
It is even documented as "don't use this"
 
it clearly says in the rfc that it leaks when you do this, but when I tried to mention that it leaks, dmitry and zeev just started being shitty and asking me if I even understood ... I understand very well, it leaks, it says so in the rfc, but dmitry thinks because it's free'd at the end of the request it's not a real leak, but it still puts serious limitations on what you may do within a single request if you can exhaust memory ...
it can't determine when to free it, but it doesn't provide a way for you to do it, it leaks it and relies on the mm freeing at request end ... that's wrong/broken/leaky/shit ...
 
For something like this, I don't mind if it puts the onus on you. But it should give you the ability to not screw up
 
11:42 AM
it says in the rfc it's "not recomended" ...
 
I agree, it shouldn't be included if it isn't designed the production used. It's the same argument as the jit, experimental does not belong in production builds, unless it's suitably guarded by here be dragons
 
the suitable guard for that is not including it in production builds
 
they're both really cool, but they don't belong right now ... I was sick when the ffi was being discussed, I voted but didn't make noise ... it was a mistake, another example of zenv or rogueface or whatever they are called this week treating php as their pet project ...
 
Also, Kingsman tailors is real
I would upload a picture, but the mobile interface doesn't allow :/
 
11:58 AM
@tpunt there are quite a lot of mistakes in the programming of pht, objectively it's not less complicated or any more stable than pthreads is/was ... I tried the other day to do a benchmark to show you it performs no better than pthreads and it crashes, when you run the test suite with valgrind there are memory errors ...
I was trying to find nice words to tell you this, but there are none, sorry ...
 
Morgnins roomies
 
o/
 
@tpunt f you want things to look for, it tries to join threads twice, there is not enough exclusion around state, it tries to execute functions that have been freed, it doesn't copy opcodes in a compatible way ... I could go on ... my intention is not to bash you, there are not many capable hands interested in this sort of thing, and I would like some meaningful help with parallel at some time in the future ...
one of the things that makes pthreads untenable is that it tries to do all this copying, it can't work into the future, when people are preloading their framework, it will make the overhead of starting a thread unacceptable if they don't get to take advantage and they can't if you insist on copying whole contexts ...
zend needs to do that stuff, on it's own ...
 
@JoeWatkins what if you patch the executor to run preload for each thread? And define a separate global preload which can spawn threads or whatever
 
12:09 PM
there's talk of removing the executor hook entirely ...
 
Because of JIT?
 
not really, it's not well thought out and suffers from stackoverflows when the code gets real complex, phpdbg has to work around this but the same trick is not thread safe ... it's just a left over from history, the jit is just driving change, but it's change that should happen anyway ...
 
Fair enough :)
 
mornin
 
12:20 PM
@NikiC I can't think of any other possibility of get a const type without been by phpDocs, or type inference :(
Morning fellows
 
@GabrielCaruso what's the use case?
 
@ircmaxell I'm playing around with this bug bugs.php.net/bug.php?id=45569
Nikita closed as we can access the documentation, but just for studies cases, I was thinking about it
 
You want it native? Or looking for just the functionality?
 
@ircmaxell Just looking where/when we type inference things in the Core :)
 
I don't know type inference is relevant there...
A constant has a value. That value has a type. There is nothing to infer...
 
12:35 PM
@ircmaxell Is much simpler than I thought than :D
 
Though you can't get the doc comment? Why not?
It isn't exposed?
 
Yeah, it is, I'll be using it to get its type
 
1:08 PM
@JoeWatkins I really appreciate the feedback, thanks! Regarding parallel, do you have some sort of roadmap or list of todos? I don't have time just yet to contribute, but maybe I can find some time soon to begin helping.
 
the only real thing left to do is a channels impl, but I don't intend to include that in the first release, it's for sometime in the (very near) future ... I have no intention of supporting objects or any of the stuff that zend itself cannot support natively, so there's not a million things
@beberlei I'm going to rewrite that overload extension
 
@JoeWatkins Fair enough. What do you have in mind for the implementation of channels?
 
@tpunt that's the sort of thing I say when I'm not interested in what someone is saying ... I wouldn't just attack you, I've got no reason, I know you asked me to review it when you first wrote it, but pthreads was still my baby and I was annoyed, so I didn't pay it any attention .... I don't care about pthreads anymore, I've reviewed it, properly ... the two are not really a world apart, I see most of the same problems and I was surprised to see you say it doesn't have them ...
I know these things are hard work, but please, try to take on board what I'm saying ... these things are lost causes ...
@tpunt I've got a very shit implementation that doesn't work properly, so all I know right now is what it should not look like, I've spent a while reading the go implementation, but itself is written in go, so it's slow to read ... someone said an old version of go 1.5/1.6 is still written in C, so I intend to review that this weekend ... but the ideas are not fully formed yet ...
 
@JoeWatkins I don't take your comments personally - I know my code (or my creations) don't reflect me as a person, so criticisms of it are not directed at me. I really do appreciate the feedback you have given. Whilst I would like to still try to salvage pht, I do agree that this is probably a wasted effort, and that looking at yet another approach to threading in PHP (a la parallel) seems to be the better way to go.
 
we're the only two people in the last 20 years that got close, I really want us to work together on a thing ...
 
1:20 PM
Regarding not seeing the problems in pht, I guess we try to overlook our own faults :) Maybe I should look a little closer, though...
 
it's a product of what you have aimed for, the same as pthreads, they aim for slightly different things, but they both aim for beyond what is reasonably achievable, the only way to exist is to co-exist with zend, I've said this a million times to many many people, but never listened to what I was saying ... you just can't bend the rules far enough with sacrificing stability, and even if you could, you end up with a monster ... we need to be compatible with what is coming, and what is coming
 
@JoeWatkins Yes, I'd really like to work with you on this too. That's why I'm curious to see what you had in mind for channels. The only thing I can think of currently is passing an object around between multiple threading contexts for communication, but then that leads us right back to that mess again...
 
simply ruins the usability of these things ...
 
Completely agree. I haven't had chance to browse through the Parallel codebase yet, but I'll find some time this week for it. I'll also have a deeper think about how channels may work. Do you have your (bad) channels implementation in a separate branch, or is it really not worth looking at?
 
well, in go, they have an api like Channel::make, and the rule that a channel has to exist before use, so we don't need to pass around an object
you make the channel in the parent, and threads do Channel::open with just a name ...
so that's the first problem out of the way
the main problem is actually the comms part
well it has the open/make/send/recv but send/recv are very broken, I'll stick it up on a private gist if you want to have a look at it ... but it's all pretty basic stuff really ... the thing I don't have fully figured out is the send/recv
you know that goroutines are not a million miles from what parallel is doing, we actually have a realistic chance of competing with go when the jit is here ... there'll be no reason for people to say go is better, because it will be almost exactly the same ... goroutines are actually share nothing, except in special circumstances, just like php is ... that's why people find them easy to use, because they aren't like real threads, we get all of that for free, if we just stick to the rules ...
the thing that makes it tricky is that both send and recv have to block for it to be a useful sync, the programmer doesn't know they are using synchronization but that's exactly what they are doing, but the practicalities of that are so difficult to get right that embedded in the source of the go implementation is very strange code that appears to have the ability to resolve race conditions, a thing I've spent my whole life thinking is actually impossible, I don't understand this fully yet
and the source of that is written in assembly, so might as well be martian to me right now ...
 
1:33 PM
Yes, parallel looks like it is going down CSP-style concurrency, but backed via actual threads than green threads. There are some key advantages, though, to Go's CSP primitives. Automatic interruption of the goroutine when blocking IO is performed (I'm not sure if you have that planned for parallel, but I've tried it with phactor - another disgustingly complex beast...). Non-native threads also make concurrency easier, IMO.
@JoeWatkins Interesting... I'll take a look at this probably over this weekend. I also didn't really think it was possible
 
we have really nice solutions to that and they are maturing fast, aside from amp there's a fiber ext, and swoole, I'd like to leave async I/O to the people interested in working on it, and keep the scope of parallel as small as possible ... the basic facts are that doing async I/O in combination with real threads in PHP is going to be messy, because rules, I don't mind finding ways to make it possible for things like amp to utilize threads and have already started, but I've no interest
in writing it myself ...
@tpunt the only source I could find for it was arm assembly, can you read that ?
I mean I can see how it's used at levels above that, and I can see roughly how it works from picking apart asm and a billion google searches, but it's beyond me ...
 
@JoeWatkins Yeah, after having tried it myself, I'm not so sure it would be such a good idea to do anymore...
 
I was a bit mind blown when I first saw it, and couldn't really concentrate ... I mean I just know that you can't resolve race conditions, putting the words "resolve" "race" and "conditions" in that order doesn't make sense to me ...
 
@JoeWatkins I can partially read it. Got a link to it?
 
if you read the source for chan.go, you can see how it's used ... I sort a get that ... but I think, it may be possible without going to such low levels anyway, it seems the reason they use it may be avoidable with good use of atomics, but I'm not sure about any of that yet ...
even in go, this is an optional extra, it can and should function without this, but is available for the detection and resolution of races with specific options ... but that they need it at all, even as an option is a little scary ...
 
1:44 PM
@JoeWatkins wat? why? can we discuss first?
 
@JoeWatkins Yeah, writing something like this, stabilising it, and maintaining it with just a couple of us would probably be a bit of a nightmare... But it is definitely something worth looking more in to
 
@beberlei opcache is really in the way, the other day when I tested I didn't use a debug build, with a debug build assertions fail that will always fail and there's no possible resolution except writing it as a zend extension, so you can force load order (load after opcache)
@tpunt yeah, all of google against us two is a bit much ... but understanding it is enough to clue us up ...
 
@JoeWatkins i don't think this approach lends itself for production readiness on various hundret customer machines though :-)
 
@JoeWatkins Well, I work for Google, so does that mean I'm against myself? :P
 
@tpunt I didn't know that, but all of google and many years ... :)
@beberlei not sure what you're referring to ? the approach you use now is going to break, isn't it ?
I've got a slightly different approach in mind anyway, because being a zend extension gives you better options ...
 
1:50 PM
@JoeWatkins if dmitry doesn't build something else yes
 
as a ze, you can handle individual op arrays, so you don't have to keep looping over a huge table looking for overloads, my basic idea was to configure it with ini, possibly even allow the ini to call into another normal dso that contains that actual instrumentation ...
the very first thing you have to do, which is change the function name, this is what is causing assertion failure, and there's no way around it because of the way interned strings work ...
any thoughts on that approach ?
 
@JoeWatkins sounds too complex IMHO, isn't the complexity of this a good argument for adding a callback? its not that tideways would be the only extension requiring hooks into userland. I would show this to dmitry + including arguments about additional requirements and demand a new callback :-)
if there is a special callback, then the opcache + jit could also check explicitly if its instrumented and if not generate the fast code that skips the hooks completly, i suppose this is something dmitry would be ok with
 
which part sounds complicated ?
 
the various things that are needed to turn a zend_op_array into a zend_internal_function in all ways that makes them look like the same from outside, including what we haven't done yet the faking of the execute_data to get the right backtrace
 
you know the stuff I committed earlier today is not really complex, you just haven't seen it before, but opcache itself does quite similar things, so do many other extensions ... I'm not sure that a callback covers all use cases, some of the people using other tricks today don't just want to trace, but actually overload - replace implementations, that's not going to be possible with just tracing callbacks ... so they sound narrowly scoped to me which is why I haven't paid it any attention ...
also, inserting a couple of extra call instructions after prologue and before exit is going to damage the perf of jit, and I don't think demanding is going to convince dmitry to make that sort of change ...
he may well make it for the vm, but I'm not sure about the jit, his solution to tooling and the jit at the moment is "switch it off" ...
the backtrace stuff is tricky, I've not done that before either ...
 
2:04 PM
yeah maybe you are right
i feel a bit lost in the details of these changes
 
@JoeWatkins that pisses me off tho, because if literally anyone else said something like that, the response would be fix it before merge (or have Dmitry help)
 
I'm only trying to help ... there's overlap in the problems you have and the problems I have, so if I can help you while helping myself, that's perfect, if you want me to stop, I'll stop ...
@ircmaxell yeah, it's highly unreasonable ... but sine nobody else can actually change the jit right now, it's his way or no way at all ...
 
@JoeWatkins to be honest, I think there just must be a solution in core that makes this easier, because from my POV this is a -1 vote otherwise. for example Tideways right now allows to dynamically register additional tracers at runtime for users, \Tideways\Profiler::watch($function, $callback); and i know of a few extesnions that have the same approach to implement userland tracing or AOP. its not ok to break this just for some few % in web context
 
@Danack I wanted him to keep nailing that same lady with pies
 
2:12 PM
@JoeWatkins plus I feel uneasy you doing all this work, for something that I should pay you for :)
 
Hello All
please give me Answer
 
Hello every one,
 
@beberlei it's open source, there's no reason to feel uneasy ... if you'd been around regularly a little longer you wouldn't feel that most likely ... this is not hard work for me at all, it's what I enjoy and someone else is paying me already ... I've spent most of my career not being allowed to even share thoughts, it's what I value, above all else ...
 
Please check it..
 
@Paul phrasing, but yes.
 
2:21 PM
!!dad add mushroom / My friend badly grows fungus in his cramped apartment / There's no mushroom at all.
 
What kind of food does the Karma Cafe serve? Just desserts.
@MadaraUchiha Ha ha ha! Brilliant! I'll save that one about mushroom for later!
 
Bah
Is there's a !!dad edit or something?
 
@MadaraUchiha er, so that's blatantly a sock puppet account, right?
 
@Danack Hmm? Which?
Ah
lol
 
2:23 PM
jetbrains have started typed properties support for phpstorm ... which is nice ...
 
yeah, looks like he accidentally used his sockpuppet to spam his question
 
the "25 pending flags" notification is something new to me
 
@JoeWatkins as for approaches, in my mind I always wanted to evaluate the AST inject approach from stachdriver-debugger as well. I would say, introduce a function call to internal fucntion "profiler_start" at every beginning. finding all the exit points is probably difficult though
and that would make it possible to write a generic ast injector that ships with php-src, which all extensiosn requring profiling could then use
 
doesn't that have the same problem with the runtime creation of watches ?
 
depends, if the runtime watch is registered before the file is compiled then no
 
2:33 PM
well if you have the same rule for any approach, it's not a problem
hmm
it might be
I'll have a look at the stackdriver thing closely ...
logic for determining exit points can be found in php-src already
 
it would fix the stackframe problem, but also it would produce slightly wrong timers, because the entry and exit into the function VM/JIT wise is not captured
but measuring precisly is not really possible anyways, so that is delta that should be acceptable
 
there would still be internal function calls in the trace though ?
does debug_backtrace skip internals ?
 
if function foo($x, $y) { debug_backtrace(); return $x+$y; } will automatically become function foo($x, $y) { profiler_start("foo"); debug_backtrace(); return profiler_stop($x + $y, "foo"); }, then the debug_backtrace() is never called from within those functions so that they would appear
it doesn't skip internaly, although its hard to have them in there, only in array_map or array_filter case you will see them
 
right
 
but this approach incurrs zend_intenral_function call overhead, compared to current instrumentations of execute_ex which are just C function calls
that would probably make generic profilers that instrument all fucntiosn way slower than they are now
 
2:42 PM
In phpstorm, I have "Jump outside closing bracket/quote with Tab" enabled (under Settings->Editor->General->Smart Keys). I try typing an HTML div with a class, double quotes are auto-generated, but when I try tabbing out of the quotes, it produces a tab character instead of going outside of quotes. Has anyone had this issue?
<div class="" <- double quotes correctly produced, <div class="course-details-hour-breakdown" <- typing in class, <div class="course-details-hour-breakdown " <- attempting to tab out of quotes
 
@beberlei it would, but, given the target is compatibility with jit, maybe that won't matter so much
 
I saw there was a bug with a few months ago, but it should be fixed?
 
New "parallel" extension for #PHP released (A succinct parallel concurrency API) https://github.com/krakjoe/parallel Of course RPM, already available in @RemiRepository
2
w00t
 
holy shit @NikiC merged parallelised testing: github.com/php/php-src/commit/…
 
@JoeWatkins one "trick" for instrumenting very specific functions only is obviously registering an opcode handler for it so that the JIT doesn't trigger for that specific functions.
 
2:51 PM
@Andrea dope.
 
@Andrea very excellent
 
@Andrea hooraj16
 
Now I am leading the way with my horrible non-blocking I/O code merged in PHP
in fairness, it is much better than the non-blocking I/O I wrote 9 years ago
 
@JoeWatkins 🎉🎉🎉🎉🎉🎉
 
@Andrea I think any horrible code is in very good company inside the run-tests.php file :P
 
2:53 PM
you'd have a hard time making it worse
 
@NikiC Hmm, maybe I am damaging my career by adding myself to its author section…
@Paul you should see how I serialise $GLOBALS
 
@Andrea I'll try implementing the other conflict handling mechanism I mentioned now
Hopefully we can get this stuff running in CI soon, especially for Windows...
 
@NikiC alright! I would suggest maybe putting such information inside the @CAN_BE_PARALLELISED if we want to avoid parsing PHPTs twice
 
@JoeWatkins ah forget that idea, zend_set_user_opcode_handler is global, does it completly disable jit then? maybe we need a way for extensions to specifiy "@nojit" for a list of functions
 
@Andrea the good news is the thing is like 4000 lines long so no one will notice
 
2:57 PM
at the moment it does, and yeah effects everything ...
 
@Andrea I'm kinda hoping that parsing it twice is cheap enough, otherwise dealing with one or two non-parallelisable tests in a directory will get ugly
 
@NikiC mm. currently you could make a sub-directory named non_parallel or something but that's not pretty
 
in the filename maybe?
 
Possibly of interest:
A really cool memory allocation technique similar to compaction but for C. Mesh by @emeryberger and co. Great visual representation of the technique as well! https://arxiv.org/abs/1902.04738
3
 
@Danack 16% + 39% memory reduction for firefox and (some unspecific workload of) redis is quite amazing
 
3:07 PM
The test workload are explained in the paper. The 'working without making any changes to the Redis code', is the more amazing bit to me.
 
@NikiC random question, do you know how often git.php.net fetches SVNROOT from svn?
 
@Danack That's.... pretty ducking neato
 
@salathe nope
but I feel like the answer is "rarely"
 
@Danack Yeah, the fact that it's a drop-in replacement for malloc is pretty incredible
 
@salathe 30 4 * * * (cd /git/checkout/SVNROOT && /usr/bin/svn -q revert -R . && /usr/bin/svn -q up)
 
3:21 PM
@Danack github.com/plasma-umass/Mesh Code is open source, too
 
@salathe I ran it manually
After spending an unreasonable amount of time figuring out that the way to switch users without needing a password is sudo -i followed by su git...
 
o/
 
@JoeWatkins \o/
 
3:50 PM
now I have to start documentation though ... so it turned to /o\ very quickly ... I hate xml so much
 
oh nooooo I made a transcription error in parallelised tests
 
grep for intval in run-tests.php and you will find it :p
 
@beberlei maybe, if I just do the patch for enter/leave, it kinda twists dmitry's arm to support it in the jit, the jit can omit to emit the instructions entirely if the callbacks are not set, so it's not so terrible ... the only thing is, they can't actually be opcodes
it means changing a bunch of handlers, and determining where to place the call so that the frame is is consistent on enter/leave for all possibly combinations is tricky and I'm not sure I'm getting it right ...
and this still doesn't help for things like pcov which need to trace every instruction, nor things that want to overload functions like uopz
 
@NikiC awesome, thanks :)
 
4:01 PM
@Andrea damn shifty parenthesis.. though isn't 10 default for intval anyway?
 
@JoeWatkins to be honest, i am a bit at loss because there are so many possible ways to proceed, including use cases we haven't thought about yet out there.
 
yay, dmitri fixed my bug
 
actually I may have quite a neat patch for enter/leave
krakjoe@fiji:/opt/src/vm$ php -dextension=vm.so ../php-src/Zend/bench.php
/opt/lib/php/extensions/debug-zts-20190128/overload.so doesn't appear to be a valid Zend extension
entering function_exists
leaving function_exists
entering date_default_timezone_set
leaving date_default_timezone_set
entering start_test
entering ob_start
leaving ob_end_clean
entering number_format
leaving number_format
entering str_repeat
leaving str_repeat
simple             0.015
entering ob_start
leaving ob_end_clean
entering number_format
that's quite an impact
actually that's mostly just printing diff
/opt/lib/php/extensions/debug-zts-20190128/overload.so doesn't appear to be a valid Zend extension
simple             0.015
simplecall         0.008
simpleucall        0.007
simpleudcall       0.007
mandel             0.070
mandel2            0.102
ackermann(7)       0.069
ary(50000)         0.011
ary2(50000)        0.009
ary3(2000)         0.155
fibo(30)           0.251
hash1(50000)       0.039
hash2(500)         0.035
heapsort(20000)    0.076
matrix(20)         0.091
nestedloop(12)     0.068
sieve(30)          0.034
acceptable ?
@beberlei ?
 
4:22 PM
so, looks like there's no way to get the symbols from FFI. So I'd have to parse the C declarations myself if I wanted those
 
I'll open it for review, there's probably something wrong with it anyway, you get dmitrys attention best with code (and nikitas) @beberlei
 
@JoeWatkins your turnaround on ideas amazes me <3
i meant turnover
how does JIT work with debug_backtrace() btw, say callgraph A => B => C => debug_backtrace. does the jit maintain zend_execute_data correctly?
 
it should yeah
 
4:39 PM
@Paul ah yes, I think I assumed it was 0
 
@JoeWatkins In a thread if I call exit or trigger a fatal error, the socket I created in the thread appears to not be closed. Is that my problem or yours?
 
yours, tasks are not allowed to crash a thread
 
@JoeWatkins do you think a flag on zend_function required to enable vm enter/leave makes sense? wondering if the ZEND_DO_FCALL_BY_NAME opcodes make a big enough difference to warrant a whitelist
 
because think about the kind of logic you would have to have to restart the runtime if one task crashed it ...
if you have set executors today DO_FCALL_BY_NAME is not used anyway, so it's not different to setting executor in that regard
 
I don't care about restarting it, but I would think references in the thread should be cleaned up.
 
4:45 PM
well in general it would be horrible ... use finally ?
 
@JoeWatkins i know, but if it would be measurably faster, then why not change the semantics when introducing a new hook
 
finally isn't executed if I call exit or trigger a fatal.
At which point I would expect the thread to exit and close FDs left behind.
 
maybe run another task when you get a parallel\Exception or close() on parallel\Exception
 
I have no indication in the parent though that the thread has exited.
 
@Trowski you don't keep future ?
 
4:50 PM
@JoeWatkins I do, only because it blocks if I don't, but I never look at the future because I don't care about it's value.
And looking at it means blocking.
 
@beberlei I'm not sure how often fbc is actually set, at least in opcache which is going to majority use case, fbc can only be set if the function is in the same file ...
@Trowski you can check it without blocking using value(int timeout) ... set timeout to 0 ?
 
@JoeWatkins So just set a timer to look at it periodically?
 
it seems reasonable, but if it isn't shout at me again
@beberlei I'm not sure, dmitry has all of the optimal stuff in his head and will correct it if it's bad
this is an arm twisting thing to get him to move on it ... and come up with a thing that's suitable for the other use cases of execute_ex today so that this can be tidied up ... its quite horrible to have execute_ex and enter/leave, but one can't replace the other ...
I don't know what will replace execute_ex hook where the loop is implemented in ext, I can't think of anything acceptable ...
 
Hmm… seems I have to catch parallel\TimeoutException.
 
ah yeah, that's mentioned in the extensive docs that are half a page long
looked at other implementations, they all throw some non generic thing so it can be handled otherwise than a normal exception ...
 
4:55 PM
@JoeWatkins ah makes sense, not easy to modify the flag for an extension. I guess the FCALL behavior is best/simplest for now then. Have you started a discussion somewhere around this?
nm found the PR
 
yeah done that
 
hi
 
went down the EXPECTED/UNEXPECTED rabbit hole the first time, crazy stuff :)
 
@JoeWatkins Yeah, would help like hell if I actually read them.
 
5:04 PM
haha, it should take all of 30 seconds ... they are very extensive ...
 
if ($future->done()) { $future->value(0); } should avoid the try/catch for timeout exception, yes?
Hmm… no, apparently Future::done() is still false if it fails.
 
@NikiC ping
if vm is entered with ZEND_VM_ENTER_EX will leave helper always be entered ?
 
@JoeWatkins not sure
@JoeWatkins I think so
 
same for entering via execute_ex, right ?
urm. noooo ...
 
5:29 PM
posted on February 18, 2019 by CommitStrip

 
uhhhhhh
Fatal error: Uncaught TypeError: FFI::cast() expects parameter 1 to be FFI\CType, object given in /home/ircmaxell/Workspace/PHP-Compiler/FFIMe/lib/FFIMe.php:35
Stack trace:
#0 /home/ircmaxell/Workspace/PHP-Compiler/FFIMe/lib/FFIMe.php(35): FFI->cast(Object(FFI\CData:void*), Object(FFI\CType:<struct>*))
 
@JoeWatkins in general yes, except with generators
@JoeWatkins execute_ex - generators strike again
and obviously upon exit/die the longjmp is done
 
ahh, got the args backwards
 
@bwoebi I think that doesn't matter, it may even be useful to detect that execution ended abnormally
erf generators
 
5:45 PM
Yes, of course I'm triggering the fatal in a generator :-D
It's Amp… everything is a generator.
 
morning
 
o/
@JoeWatkins @kelunik I just pushed a branch of amphp/cluster that uses ext-parallel. Works quite well. Very cool run a threaded http server (see examples/simple-http-server.php) github.com/amphp/cluster/tree/ext-parallel
@JoeWatkins Here's how I'm checking to see if a thread crashed: github.com/amphp/parallel/commit/…
 
not too bad
 
A timer loops through the currently pending futures and checks to see if an exception is thrown from Future::value(0). If so, it closes the channel, which other code detects as an unexpected close of the execution context.
If you have suggestions to improve that I'm listening.
 
5:59 PM
I can't even tell there's threads involved, very cool
well you could use select
 
00:00 - 18:0018:00 - 00:00

« first day (3047 days earlier)      last day (1916 days later) »