Camelia, the Perl 6 bug

IRC log for #parrot, 2011-12-30

Parrot | source cross referenced

| Channels | #parrot index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
00:52 whiteknight joined #parrot
00:54 alvis joined #parrot
00:59 jsut_ joined #parrot
01:07 whiteknight masak: ping
01:15 dukeleto ~~
01:16 whiteknight hello dukeleto
01:17 dukeleto whiteknight: wazzup
01:18 whiteknight dukeleto: nothing much. you?
01:19 whiteknight masak requested a new sprintf format sequence be added. The more I look at this code, the more angry I am that I agreed to do it
01:19 whiteknight the sprintf implementation is terrible
01:22 dukeleto whiteknight: which sprintf is terrible?
01:28 whiteknight there is really only one implementation
01:28 whiteknight lots of different wrapper functions for it
01:39 cotto That's a very organic piece of code.
01:39 cotto needs to be composted
01:40 whiteknight the SPRINTF_OBJ, which contains the state of the translator, is a global singleton
01:40 whiteknight which means sprintf is inherently not thread-safe
01:55 cotto I thought that was a problem with most *printf variants.
02:00 whiteknight we could make it thread-safe by simply not using the global object
02:07 cotto That was a bad response.  Even if sprintf is usually non-thread-safe, we don't need to continue the pattern.  +1 to fixing if it makes you angry enough.
02:07 cotto *bad response from me
02:12 whiteknight Eventually I may go in and rewrite most of this crap
02:12 whiteknight certainly reorganize some of these files
02:16 * whiteknight says that about all the code
03:30 cotto ~
03:37 Psyche^ joined #parrot
05:27 alvis joined #parrot
06:07 preflex_ joined #parrot
06:33 alvis joined #parrot
07:10 baest joined #parrot
09:01 masak whiteknight: sorry for (indirectly) making you angry. :/
09:16 contingencyplan joined #parrot
09:45 masak ok, I've now killed off %C in the Perl 6 spec: https://github.com/perl6/specs/commit/8​ef142f7f49fc62be17dd0569d34e7e17e02bc7b
10:22 moritz masak++ # making Perl 6 smaller and simpler
10:28 moritz nom: printf('foo %s')
10:28 p6eval nom e6fee1: OUTPUT«Null PMC access in get_string()␤  in sub sprintf at src/gen/CORE.setting:1841␤  in sub printf at src/gen/CORE.setting:1846␤  in block <anon> at /tmp/K8fijDG3rR:1␤  in <anon> at /tmp/K8fijDG3rR:1␤»
10:29 moritz that's kind of a problem too for us
10:29 moritz we don't know how many arguments (and of what type) printf wants, and get Null PMC access when there are too few arguments
10:32 masak Perl 5 gives a 'Missing argument' warning (but formats the string anyway), which feels more sensible.
10:56 moritz we could have an sprintf that takes a callback
10:56 moritz and sprintf calls it for each argument it needs to obtain, together with the type
10:57 moritz so that sprintf('%s %d', &foo) would call &foo once with argument 'string', and once with argument 'int'
10:57 moritz or so
10:57 moritz (low-level, of course)
10:57 moritz so that in the Perl 6 runtime library we can introspect our arguments, and fiddle them in a way that parrot can work with them
11:41 whiteknight joined #parrot
11:42 whiteknight good morning, #parrot
11:46 tadzik good morning whiteknight
11:46 tadzik how are things?
11:50 masak whiteknight: I de-spec'd %C :)
11:51 whiteknight masak: I wasn't stressing about %C. I wanted to do it. My stress came from finally seeing the sprintf code internals and realizing how much it needs to be cleaned
11:51 mj41 joined #parrot
11:53 tadzik :)
11:53 masak whiteknight: right. I guess it still needs to be cleaned.
11:53 masak but I don't feel we need %C.
11:54 whiteknight okay, but let the record show I was both willing and eager to do it
12:01 masak absolutely. whiteknight++
12:01 masak let's apply that willing-eagerness to features we actually care about ;)
12:02 whiteknight sure, what's next on the list?
12:02 tadzik DESTROY I guess
12:02 tadzik as in "call me just before I get GC'd"
12:03 whiteknight yeah, I figured you might say that
12:13 dalek Rosella: d62d4c2 | Whiteknight++ | s (5 files):
12:13 dalek Rosella: Several fixes and cleanups to iterable. Add in a factory type for sources. Add in a method for Tap
12:13 dalek Rosella: review: https://github.com/Whiteknig​ht/Rosella/commit/d62d4c2f49
12:13 dalek Rosella: 38f4d8c | Whiteknight++ | src/ (4 files):
12:13 dalek Rosella: Refactor out iterable source common logic into a new base class. Add in on_data and on_iterator methods to mirror what stream has
12:13 dalek Rosella: review: https://github.com/Whiteknig​ht/Rosella/commit/38f4d8c568
12:13 dalek Rosella: b55d9a1 | Whiteknight++ | / (3 files):
12:13 dalek Rosella: Update Harness to use iterable instead of stream.
12:13 dalek Rosella: review: https://github.com/Whiteknig​ht/Rosella/commit/b55d9a1212
12:13 dalek Rosella: 7ce07f8 | Whiteknight++ | src/ (6 files):
12:13 dalek Rosella: Completely update Harness to use Iterable instead of Queryable and Stream. Some fixes to bugs found in Iterable during the process
12:13 dalek Rosella: review: https://github.com/Whiteknig​ht/Rosella/commit/7ce07f8785
12:13 dalek Rosella: 3a74120 | Whiteknight++ | / (17 files):
12:13 dalek Rosella: Merge branch 'iterable'
12:13 dalek Rosella: review: https://github.com/Whiteknig​ht/Rosella/commit/3a741200a7
12:15 masak yes, DESTROY
12:24 whiteknight masak: do you guys have anything like a failing test case I can start with?
12:24 tadzik I can write one quickly
12:25 tadzik oh, there is S12-construction/destruction.t in roast
12:26 tadzik I wonder if it can be written better, moving this to #perl6
12:29 tadzik with lazy enough GC I'm afraid that test will never pass :/
12:31 tadzik masak: what do you think about https://gist.github.com/1539638 ?
12:32 masak tadzik: I think I do not know enough about the workings of GC hooks to tell you if that is a good test or not :)
12:32 masak though to me it looks at least like a stab in the right direction.
12:32 tadzik masak: I just think that the spectest is a bit bogus
12:32 tadzik imagine that GC chooses to run after all the test cases. DESTROY may work, but spectest will fail
12:36 whiteknight what if we had an opcode at the parrot level to manually destroy a PMC (and trigger finalizers at that moment)?
12:36 moritz tadzik: notice that 6model already has some DESTROY-like callbacks for memory deallocation
12:36 moritz it "just" needs to call into Perl 6 code
12:36 tadzik oh
12:37 masak tadzik: hm. maybe have DESTROY set a global flag, and test the flag at the END phase of the test file?
12:38 tadzik masak: what if the flag gets GC'd before the class?
12:38 moritz tadzik: grep for gc_mark and gc_free in nqp/src/6model
12:42 masak tadzik: yes, this is the general problem. :/
12:42 masak so maybe your 'pass' solution is cleaner.
12:43 masak is the GC guaranteed to run on objects that survive till the very end of the program.
12:43 bluescreen joined #parrot
12:43 tadzik but...but what if Test.pm gets collected before? :D
12:43 masak in many languages, it isn't.
12:43 masak s/program\./program?/
13:05 jsut joined #parrot
13:19 whiteknight masak: I don't know if Parrot runs one last "finalize" GC run at the end of the program
13:19 whiteknight I know that the code for that exists, but I also know that it frequently gets commented out as a "performance improvement"
13:25 masak right, that's always a risk.
13:25 masak and then DESTROY gets labeled as "not guaranteed to run".
13:26 masak and then people decide to use different mechanisms.
13:26 whiteknight right
13:27 whiteknight the question is, what is the common case? Are short scripts that don't utilize DESTROY common, (in which case GC finalization can dominate execution time)
13:27 whiteknight especially if you're running multiple instances, such as in a test suite
13:27 tadzik I guess most of the times no one will use DESTROY for anything
13:28 tadzik it'd be useful for ie freeing non-Perl6 resources
13:28 tadzik or flushing data to files
13:28 whiteknight Parrot will do whatever Rakudo needs, of course. It just isn't straight-forward because of the tradeoffs
13:29 masak tadzik: right, but absent any guarantees that DESTROY will run... it'll just be like in C++ and Java, where people call explicit home-made finalizers.
13:29 tadzik yeah
13:31 dalek parrot: 8c4a2b1 | Whiteknight++ | src/pmc/ (5 files):
13:31 dalek parrot: Iterator PMC and family now implement the 'iterator' role.
13:31 dalek parrot:
13:31 dalek parrot: If we test for this role, HLLs can easily implement and transparently use their own iterator types, and can easily detect when an object is an iterator (vs some other kind of data)
13:31 dalek parrot: review: https://github.com/parrot/parrot/commit/8c4a2b19e3
13:32 whiteknight What if Parrot had a kill_this_pmc op which immediately killed and finalized a PMC? And then Rakudo could keep a queue of PMCs needing finalization and kill them explicitly at program end?
13:32 whiteknight The costs of GC finalization are in sweeping through huge swaths of PMCs like arrays and contexts which don't need finalization
13:32 whiteknight so if you separate out the ones that absolutely need finalization (filehandles, network resources, etc) we can get the same results with none of the costs
13:36 masak sounds intriguing.
13:37 jsut_ joined #parrot
13:38 masak is some sensible order guaranteed at the end of the program? that's a separate question from "is GC guaranteed at the end of the program?"
13:38 masak i.e. if object B has a reference to object A, will Parrot guarantee that the GC collects A before B?
13:42 dalek rakudo/nom: 5b58e03 | tadzik++ | lib/Test.pm:
13:42 dalek rakudo/nom: Cleanup Test.pm
13:42 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/5b58e03c04
14:06 whiteknight masak: Ah, the million dollar question
14:06 whiteknight currently we don't guarantee order of destruction in any way, shape or form
14:07 whiteknight Let's say we have an opcode "finalize_all" which takes an array. It iterates over that array calling finalizers, then it iterates the array a second time to collect PMCs
14:07 whiteknight we can't guarantee order that the finalizers are called it (save for the order of the array)
14:07 whiteknight but we can guarantee that all finalizers are called before all of them are swept
14:13 whiteknight there's a reason this problem hasn't been solved adequately yet, and it's not because writing the code takes time
14:28 masak of course, for things like circular references, this condition cannot be upheld.
14:56 PacoAir joined #parrot
14:58 mtk joined #parrot
16:06 dalek Rosella/query_2: 14a8a39 | Whiteknight++ | s (9 files):
16:06 dalek Rosella/query_2: Rough hewn version of what the new query library will look like.
16:06 dalek Rosella/query_2:
16:06 dalek Rosella/query_2: Remove Stream. Add a new Sort namespace with the hybrid sort and a cleaned up version of Timsort from the benchmarks. Better detection of iterators with Parrot's new
16:06 dalek Rosella/query_2: 'iterator' role. All Queryables are in-place, since that object type is intended to be for performance
16:06 dalek Rosella/query_2: review: https://github.com/Whiteknig​ht/Rosella/commit/14a8a396aa
16:06 dalek Rosella/query_2: 058c486 | Whiteknight++ | / (10 files):
16:06 dalek Rosella/query_2: Several cleanups.
16:06 dalek Rosella/query_2:
16:06 dalek Rosella/query_2: Remove uses of old qsort method from the codebase. Add Sort, Shuffle, and GroupBy iterators, to replace eager methods of the same names. Fixes so we build.
16:06 dalek Rosella/query_2: review: https://github.com/Whiteknig​ht/Rosella/commit/058c486624
17:27 PacoLinux joined #parrot
17:30 PacoAir joined #parrot
17:51 estrabd joined #parrot
19:02 davidfetter joined #parrot
19:31 fperrad joined #parrot
19:56 particle joined #parrot
20:03 jsut joined #parrot
20:29 bluescreen joined #parrot
20:47 perlite joined #parrot
21:23 dalek rakudo/nom: a8c513b | moritz++ | src/core/Hash.pm:
21:23 dalek rakudo/nom: make Hash.push a bit more efficient and correct
21:23 dalek rakudo/nom: review: https://github.com/rakudo/rakudo/commit/a8c513ba14
21:48 bluescreen joined #parrot
22:25 mj41 joined #parrot
22:31 PacoAir joined #parrot
22:56 aloha (parrot/parrot) Issues opened : 239 (Add an exception handler around check for can __dump.) by KrisShannon : https://github.com/parrot/parrot/issues/239
23:29 jsut_ joined #parrot
23:44 davidfetter joined #parrot

| Channels | #parrot index | Today | | Search | Google Search | Plain-Text | summary

Parrot | source cross referenced