Re: [racket-users] 6.2 regression in running tests?
Update: No so good news, my idea of yesterday was slightly wrong. I think it causes no errors, but it makes the compiler pessimistic and it avoid some optimizations. I found another fix, but I want to test it more before submitting the patch. More details: In some cases, the optimizer reoptimize an expression with fuel=0, to get the correct values of some internal flags. So some code in optimize_for_inline must run even when fuel=0. The idea is that when fuel=0 there should be no inlining, but the compiler tries to inline the functions that are used only once even when there is not enough fuel, so the original copy disappear and only the inlined code survives. (When the function is used more than one time this may increase the size of the bytecode. But this is a good idea for single used functions.) So this modified version hangs: #lang racket (define dup (lambda (f) (f f))) (lambda () (let ([rep (lambda (f) (f f))]) (list (dup rep) dup))) ; -- look here But this modified version is ok #lang racket (define dup (lambda (f) (f f))) (lambda () (let ([rep (lambda (f) (f f))]) (list (dup rep) rep))) ; -- look here This also explains why only '(dup rep)' caused problems. Todays fix is in line 1900 of optimize.c - if ((sz = 0) (single_use || (sz = threshold))) { + if ((sz = 0) (single_use || (sz = threshold)) (info-inline_fuel 0)) { But perhaps the problem is in the code that tracks the single_use value. After 'dup' is applied, 'rep' is not long a singled used function. ... I must test this a little more ... Gustavo On Wed, Jul 15, 2015 at 4:14 AM, Ryan Davis zenspi...@gmail.com wrote: On Jul 14, 2015, at 20:19, Gustavo Massaccesi gust...@oma.org.ar wrote: Replacing the line 1758 of optimize.c - if ((info-inline_fuel 0) info-has_nonleaf !noapp) + if ((info-inline_fuel = 0) info-has_nonleaf !noapp) make the problem disappear, but I still don't understand why (dup rep) is the only combination that creates a problem. I also want to think about the (info-inline_fuel = 0) in line 1872 and how that interacts with the if (noapp) in line 1876 ... Thanks! I can test against my whole suite in tomorrow's daily if you'd like. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] 6.2 regression in running tests?
On Jul 14, 2015, at 20:19, Gustavo Massaccesi gust...@oma.org.ar wrote: Replacing the line 1758 of optimize.c - if ((info-inline_fuel 0) info-has_nonleaf !noapp) + if ((info-inline_fuel = 0) info-has_nonleaf !noapp) make the problem disappear, but I still don't understand why (dup rep) is the only combination that creates a problem. I also want to think about the (info-inline_fuel = 0) in line 1872 and how that interacts with the if (noapp) in line 1876 ... Thanks! I can test against my whole suite in tomorrow's daily if you'd like. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] sub-range-binders
No, I don't think that this can be made to work with the current sub-range-binders. The way DrRacket thinks about this is that those are two different binders (symb and symb?), and you are renaming either one of them or the other one. It can't connect them the way you are seeming to want to connect them (if I'm understanding correctly?). Robby On Tue, Jul 14, 2015 at 11:50 AM, Jens Axel Søgaard jensa...@soegaard.net wrote: Hi All, I am experimenting with the sub-range-binders syntax property. Given this program: (define symb? symbol?) (define-no? symb?) symb I want to use DrRacket's renaming facility to rename the symb? in the second line to sym?. I expect to get this program: (define sym? symbol?) (define-no? sym?) sym However I get this: (define sym? symbol?) (define-no? sym?) sym? (notice the extra ? in the last line). Is this possible using sub-range-binders ? /Jens Axel #lang racket/base (require (for-syntax racket/base)) (define-syntax (define-no? stx) (syntax-case stx () [(_ id?) (let () (define s (symbol-string (syntax-e #'id?))) (define l1 (string-length s)) (define l2 (- l1 1)) (define id-str (substring s 0 l2)) (define id (datum-syntax #'id? (string-symbol id-str))) (syntax-property #`(define #,id id?) 'sub-range-binders (vector (syntax-local-introduce id) 0 l2 0.5 0.5 (syntax-local-introduce #'id?) 0 l1 0.5 0.5)))])) (define symb? symbol?) (define-no? symb?) symb -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] sub-range-binders
So then, out of curiosity, how does it do this for structs? (I thought it was using sub-range-binders there.) For example: If I have the program: #lang racket (struct foo (bar)) (define x (foo 2)) (foo-bar x) I can use the rename tool to rename bar to baz and get: #lang racket (struct foo (bar)) (define x (foo 2)) (foo-bar x) ~Leif Andersen On Wed, Jul 15, 2015 at 3:48 PM, Robby Findler ro...@eecs.northwestern.edu wrote: No, I don't think that this can be made to work with the current sub-range-binders. The way DrRacket thinks about this is that those are two different binders (symb and symb?), and you are renaming either one of them or the other one. It can't connect them the way you are seeming to want to connect them (if I'm understanding correctly?). Robby On Tue, Jul 14, 2015 at 11:50 AM, Jens Axel Søgaard jensa...@soegaard.net wrote: Hi All, I am experimenting with the sub-range-binders syntax property. Given this program: (define symb? symbol?) (define-no? symb?) symb I want to use DrRacket's renaming facility to rename the symb? in the second line to sym?. I expect to get this program: (define sym? symbol?) (define-no? sym?) sym However I get this: (define sym? symbol?) (define-no? sym?) sym? (notice the extra ? in the last line). Is this possible using sub-range-binders ? /Jens Axel #lang racket/base (require (for-syntax racket/base)) (define-syntax (define-no? stx) (syntax-case stx () [(_ id?) (let () (define s (symbol-string (syntax-e #'id?))) (define l1 (string-length s)) (define l2 (- l1 1)) (define id-str (substring s 0 l2)) (define id (datum-syntax #'id? (string-symbol id-str))) (syntax-property #`(define #,id id?) 'sub-range-binders (vector (syntax-local-introduce id) 0 l2 0.5 0.5 (syntax-local-introduce #'id?) 0 l1 0.5 0.5)))])) (define symb? symbol?) (define-no? symb?) symb -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] sub-range-binders
Oh, I understand Jens Axel to be doing something more subtle than that. In particular, in his example check syntax sees two distinct identifiers (sym and sym?) that have overlapping ranges. When you rename one, it just renames that one and hopes for the best. (Well, to see what it actually does, you'll want to look at the code.) With define-struct, the sub identifiers don't actually overlap, their ranges are always disjoint. I'm not opposed to changing its behavior for the overlapping case if there is a more sensible thing to do. Hopefully suggestions wil be made in the form of pull requests with test suites, tho :) Robby On Wed, Jul 15, 2015 at 3:03 PM, Leif Andersen l...@leifandersen.net wrote: So then, out of curiosity, how does it do this for structs? (I thought it was using sub-range-binders there.) For example: If I have the program: #lang racket (struct foo (bar)) (define x (foo 2)) (foo-bar x) I can use the rename tool to rename bar to baz and get: #lang racket (struct foo (bar)) (define x (foo 2)) (foo-bar x) ~Leif Andersen On Wed, Jul 15, 2015 at 3:48 PM, Robby Findler ro...@eecs.northwestern.edu wrote: No, I don't think that this can be made to work with the current sub-range-binders. The way DrRacket thinks about this is that those are two different binders (symb and symb?), and you are renaming either one of them or the other one. It can't connect them the way you are seeming to want to connect them (if I'm understanding correctly?). Robby On Tue, Jul 14, 2015 at 11:50 AM, Jens Axel Søgaard jensa...@soegaard.net wrote: Hi All, I am experimenting with the sub-range-binders syntax property. Given this program: (define symb? symbol?) (define-no? symb?) symb I want to use DrRacket's renaming facility to rename the symb? in the second line to sym?. I expect to get this program: (define sym? symbol?) (define-no? sym?) sym However I get this: (define sym? symbol?) (define-no? sym?) sym? (notice the extra ? in the last line). Is this possible using sub-range-binders ? /Jens Axel #lang racket/base (require (for-syntax racket/base)) (define-syntax (define-no? stx) (syntax-case stx () [(_ id?) (let () (define s (symbol-string (syntax-e #'id?))) (define l1 (string-length s)) (define l2 (- l1 1)) (define id-str (substring s 0 l2)) (define id (datum-syntax #'id? (string-symbol id-str))) (syntax-property #`(define #,id id?) 'sub-range-binders (vector (syntax-local-introduce id) 0 l2 0.5 0.5 (syntax-local-introduce #'id?) 0 l1 0.5 0.5)))])) (define symb? symbol?) (define-no? symb?) symb -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [racket-users] sub-range-binders
Oh, okay, that makes complete sense. Thanks. ~Leif Andersen On Wed, Jul 15, 2015 at 4:24 PM, Robby Findler ro...@eecs.northwestern.edu wrote: Oh, I understand Jens Axel to be doing something more subtle than that. In particular, in his example check syntax sees two distinct identifiers (sym and sym?) that have overlapping ranges. When you rename one, it just renames that one and hopes for the best. (Well, to see what it actually does, you'll want to look at the code.) With define-struct, the sub identifiers don't actually overlap, their ranges are always disjoint. I'm not opposed to changing its behavior for the overlapping case if there is a more sensible thing to do. Hopefully suggestions wil be made in the form of pull requests with test suites, tho :) Robby On Wed, Jul 15, 2015 at 3:03 PM, Leif Andersen l...@leifandersen.net wrote: So then, out of curiosity, how does it do this for structs? (I thought it was using sub-range-binders there.) For example: If I have the program: #lang racket (struct foo (bar)) (define x (foo 2)) (foo-bar x) I can use the rename tool to rename bar to baz and get: #lang racket (struct foo (bar)) (define x (foo 2)) (foo-bar x) ~Leif Andersen On Wed, Jul 15, 2015 at 3:48 PM, Robby Findler ro...@eecs.northwestern.edu wrote: No, I don't think that this can be made to work with the current sub-range-binders. The way DrRacket thinks about this is that those are two different binders (symb and symb?), and you are renaming either one of them or the other one. It can't connect them the way you are seeming to want to connect them (if I'm understanding correctly?). Robby On Tue, Jul 14, 2015 at 11:50 AM, Jens Axel Søgaard jensa...@soegaard.net wrote: Hi All, I am experimenting with the sub-range-binders syntax property. Given this program: (define symb? symbol?) (define-no? symb?) symb I want to use DrRacket's renaming facility to rename the symb? in the second line to sym?. I expect to get this program: (define sym? symbol?) (define-no? sym?) sym However I get this: (define sym? symbol?) (define-no? sym?) sym? (notice the extra ? in the last line). Is this possible using sub-range-binders ? /Jens Axel #lang racket/base (require (for-syntax racket/base)) (define-syntax (define-no? stx) (syntax-case stx () [(_ id?) (let () (define s (symbol-string (syntax-e #'id?))) (define l1 (string-length s)) (define l2 (- l1 1)) (define id-str (substring s 0 l2)) (define id (datum-syntax #'id? (string-symbol id-str))) (syntax-property #`(define #,id id?) 'sub-range-binders (vector (syntax-local-introduce id) 0 l2 0.5 0.5 (syntax-local-introduce #'id?) 0 l1 0.5 0.5)))])) (define symb? symbol?) (define-no? symb?) symb -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups Racket Users group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.