You can subscribe to this list here.
2000 |
Jan
|
Feb
(1) |
Mar
(11) |
Apr
|
May
(16) |
Jun
(5) |
Jul
(5) |
Aug
(27) |
Sep
(25) |
Oct
(10) |
Nov
(40) |
Dec
(40) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2001 |
Jan
(78) |
Feb
(80) |
Mar
(35) |
Apr
(73) |
May
(97) |
Jun
(44) |
Jul
(38) |
Aug
(43) |
Sep
(94) |
Oct
(124) |
Nov
(13) |
Dec
(79) |
2002 |
Jan
(144) |
Feb
(68) |
Mar
(128) |
Apr
(117) |
May
(90) |
Jun
(63) |
Jul
(42) |
Aug
(66) |
Sep
(97) |
Oct
(89) |
Nov
(92) |
Dec
(88) |
2003 |
Jan
(101) |
Feb
(127) |
Mar
(103) |
Apr
(145) |
May
(211) |
Jun
(143) |
Jul
(67) |
Aug
(184) |
Sep
(212) |
Oct
(117) |
Nov
(181) |
Dec
(86) |
2004 |
Jan
(92) |
Feb
(95) |
Mar
(163) |
Apr
(242) |
May
(202) |
Jun
(114) |
Jul
(94) |
Aug
(148) |
Sep
(163) |
Oct
(111) |
Nov
(95) |
Dec
(133) |
2005 |
Jan
(148) |
Feb
(102) |
Mar
(213) |
Apr
(178) |
May
(202) |
Jun
(199) |
Jul
(189) |
Aug
(309) |
Sep
(126) |
Oct
(128) |
Nov
(148) |
Dec
(156) |
2006 |
Jan
(222) |
Feb
(184) |
Mar
(152) |
Apr
(176) |
May
(189) |
Jun
(186) |
Jul
(75) |
Aug
(182) |
Sep
(103) |
Oct
(144) |
Nov
(265) |
Dec
(197) |
2007 |
Jan
(175) |
Feb
(202) |
Mar
(212) |
Apr
(309) |
May
(203) |
Jun
(162) |
Jul
(207) |
Aug
(156) |
Sep
(136) |
Oct
(99) |
Nov
(199) |
Dec
(201) |
2008 |
Jan
(190) |
Feb
(201) |
Mar
(180) |
Apr
(132) |
May
(204) |
Jun
(149) |
Jul
(125) |
Aug
(102) |
Sep
(86) |
Oct
(269) |
Nov
(167) |
Dec
(291) |
2009 |
Jan
(155) |
Feb
(119) |
Mar
(174) |
Apr
(186) |
May
(168) |
Jun
(217) |
Jul
(107) |
Aug
(134) |
Sep
(111) |
Oct
(184) |
Nov
(81) |
Dec
(140) |
2010 |
Jan
(91) |
Feb
(93) |
Mar
(132) |
Apr
(137) |
May
(86) |
Jun
(112) |
Jul
(38) |
Aug
(112) |
Sep
(111) |
Oct
(124) |
Nov
(52) |
Dec
(49) |
2011 |
Jan
(72) |
Feb
(115) |
Mar
(91) |
Apr
(38) |
May
(119) |
Jun
(129) |
Jul
(34) |
Aug
(140) |
Sep
(37) |
Oct
(58) |
Nov
(130) |
Dec
(59) |
2012 |
Jan
(20) |
Feb
(9) |
Mar
(41) |
Apr
(89) |
May
(69) |
Jun
(21) |
Jul
(14) |
Aug
(24) |
Sep
(52) |
Oct
(49) |
Nov
(45) |
Dec
(21) |
2013 |
Jan
(36) |
Feb
(53) |
Mar
(50) |
Apr
(142) |
May
(125) |
Jun
(120) |
Jul
(89) |
Aug
(82) |
Sep
(45) |
Oct
(104) |
Nov
(69) |
Dec
(40) |
2014 |
Jan
(28) |
Feb
(85) |
Mar
(99) |
Apr
(108) |
May
(92) |
Jun
(73) |
Jul
(49) |
Aug
(65) |
Sep
(48) |
Oct
(61) |
Nov
(34) |
Dec
(41) |
2015 |
Jan
(84) |
Feb
(46) |
Mar
(81) |
Apr
(83) |
May
(56) |
Jun
(27) |
Jul
(47) |
Aug
(30) |
Sep
(31) |
Oct
(57) |
Nov
(65) |
Dec
(90) |
2016 |
Jan
(52) |
Feb
(71) |
Mar
(76) |
Apr
(37) |
May
(43) |
Jun
(16) |
Jul
(17) |
Aug
(51) |
Sep
(48) |
Oct
(40) |
Nov
(21) |
Dec
(36) |
2017 |
Jan
(40) |
Feb
(57) |
Mar
(47) |
Apr
(45) |
May
(28) |
Jun
(30) |
Jul
(53) |
Aug
(71) |
Sep
(48) |
Oct
(58) |
Nov
(42) |
Dec
(49) |
2018 |
Jan
(94) |
Feb
(50) |
Mar
(59) |
Apr
(56) |
May
(27) |
Jun
(35) |
Jul
(32) |
Aug
(56) |
Sep
(35) |
Oct
(26) |
Nov
(35) |
Dec
(46) |
2019 |
Jan
(36) |
Feb
(53) |
Mar
(53) |
Apr
(37) |
May
(28) |
Jun
(12) |
Jul
(75) |
Aug
(81) |
Sep
(70) |
Oct
(46) |
Nov
(115) |
Dec
(124) |
2020 |
Jan
(65) |
Feb
(95) |
Mar
(289) |
Apr
(106) |
May
(165) |
Jun
(63) |
Jul
(129) |
Aug
(107) |
Sep
(86) |
Oct
(85) |
Nov
(94) |
Dec
(107) |
2021 |
Jan
(67) |
Feb
(103) |
Mar
(131) |
Apr
(98) |
May
(116) |
Jun
(85) |
Jul
(26) |
Aug
(133) |
Sep
(60) |
Oct
(130) |
Nov
(196) |
Dec
(120) |
2022 |
Jan
(155) |
Feb
(107) |
Mar
(123) |
Apr
(232) |
May
(194) |
Jun
(139) |
Jul
(82) |
Aug
(58) |
Sep
(49) |
Oct
(71) |
Nov
(69) |
Dec
(117) |
2023 |
Jan
(142) |
Feb
(64) |
Mar
(114) |
Apr
(34) |
May
(56) |
Jun
(113) |
Jul
(87) |
Aug
(99) |
Sep
(49) |
Oct
(97) |
Nov
(88) |
Dec
(131) |
2024 |
Jan
(158) |
Feb
(106) |
Mar
(181) |
Apr
(107) |
May
(87) |
Jun
(68) |
Jul
(125) |
Aug
(73) |
Sep
(96) |
Oct
(81) |
Nov
(80) |
Dec
(115) |
2025 |
Jan
(96) |
Feb
(93) |
Mar
(62) |
Apr
(105) |
May
(65) |
Jun
(71) |
Jul
(55) |
Aug
(56) |
Sep
|
Oct
|
Nov
|
Dec
|
From: Philipp M. <ph...@ma...> - 2025-08-22 06:32:37
|
Hi everybody, I'd like to ask for feedback regarding that contribution; furthermore, there are a few rough edges that I need help with. Summary: This patch series provides a column-oriented structure variant that's type-safe at compile- and runtime; such objects are addressed via immediates with an 8-bit SBCL tag and another 8-bit tag to provide multiple such types. This reduces memory usage, GC time, and therefore time required for safe-lisp-and-die. The intended use-case is a in-memory database that allocates lots (>10M) of small structures of a few different types. The full documentation is available at [1]. * The first patch in the series is concerned with making SBCL accept another tag for immediate values and to provide a further 8-bit fan-out of these, so that 256 different immediates with the chosen tag (5) can be used. * The second one patch is the one I need some help with. During XC, prototypes get checked -- but if I give a value of a different type (eg., a FIXNUM), it croaks, but providing an immediate with the correct tag breaks in another way. Please help me get through XC -- I consider this as a blocker concerning merging the contrib upstream. * The third patch fixes GC for the first - I kept it separate because of attribution. * The fourth patch implements the actual contrib -- code, Makefile, documentation, and tests. * On my `master` there is another related patch that tries to get DEFMETHOD working -- any help would be appreciated as well. This patch set is in use since some time in a project that reads data from disk, builds an in-memory database, and writes an executable that is then run in a Kubernetes cluster. CPU time for the import goes up, of course, but wall clock time is nearly halved (much less GC at s-l-a-d!) and the (uncompressed) image is reduced from 20GB to 5.5GB. Query time doesn't go (noticeably) up, but we're talking ranges of 0.5 to 2msec here anyway. This is to say that this contrib is stable (at least for my use-case) and doesn't break performance expectations. I'm sure there are quite some optimisation opportunities, and yes, the code still contains a few TODOs. Any help, ideas, or other feedback is welcome! Thanks! Ph. Ad 1: https://github.com/phmarek/sbcl/blob/udef-inttype/contrib/sb-udef-inttype/README.md |
From: Qiantan H. <qt...@st...> - 2025-08-22 04:21:59
|
Yes the third example is now fixed. I think NOTE-SOURCE-TRANSFORMATION is still needed for the second example. Moreover, SBCL's copy detection here is only enabled when debug>1, I assume because it has some computational cost to run. NOTE-SOURCE-TRANSFORMATION on the other hand has virtually no cost and works under any compilation policy. ________________________________ From: Stas Boukarev <sta...@gm...> Sent: Thursday, August 21, 2025 8:55 PM To: Qiantan Hong <qt...@st...> Cc: SBCL Devel-list <sbc...@li...> Subject: Re: [Sbcl-devel] Patch: add sb-ext:note-source-transformation The original code handled that. Should be fixed. On Fri, Aug 22, 2025 at 2:26 AM Qiantan Hong <qt...@st...> wrote: > > Thanks! Although the heurstic still won't work for the other example, and it works somewhat reliable only because the copy detection I added to ITERATE. The gist is that macros themselves know how they expand and if we allow them to provide information, we don't need to guess. > > An example where copy detection without collaboration from the macro is unreliable: > > ;; disable ITER's copy detection, which I added only recently > ;; and would like to disable if NOTE-SOURCE-TRANSFORMATION > ;; is available because it's rather costly > (defun iter::recycle-code (form original-form) form) > > (defun test () > (let ((i 0)) > (iter (repeat 3) > (incf i) > (when (= i 2) (error "test")) > (incf i) > (when (= i 2) (error "test"))))) > > (test) > > Debugger incorrectly jump to the first ERROR form. > > ________________________________ > From: Stas Boukarev <sta...@gm...> > Sent: Thursday, August 21, 2025 3:58 PM > To: Qiantan Hong <qt...@st...> > Cc: SBCL Devel-list <sbc...@li...> > Subject: Re: [Sbcl-devel] Patch: add sb-ext:note-source-transformation > > I resolved the first one in > https://github.com/sbcl/sbcl/commit/c97ff0df4425ceef378d6ed27b3b10f201a430b3 > > On Fri, Aug 22, 2025 at 12:04 AM Qiantan Hong <qt...@st...> wrote: > > > > Example of macroexpand-1 issue: > > > > (let ((x (make-array 1))) > > (iter (repeat 3) > > (setf (aref x 3) 2))) > > > > ITERATE will MACROEXPAND-1 the SETF form (it MACROEXPAND-1 any macro it sees so it can process potential ITER constructs from the expansion result), and now debugger can only jump to the whole ITER form for that (SETF AREF) error. With NOTE-SOURCE-TRANSFORMATION and my ITERATE patch debugger can jump to the SETF form. > > > > Example of subform expanded differently: > > > > (iter (repeat 3) > > (error (if (first-iteration-p) "test1" "test2"))) > > > > (FIRST-ITERATION-P) is expanded to a gensym, and debugger again can only jump to the whole ITER form. With NOTE-SOURCE-TRANSFORMATION and my ITERATE patch debugger can jump to the ERROR form. > > ________________________________ > > From: Stas Boukarev <sta...@gm...> > > Sent: Thursday, August 21, 2025 1:57 PM > > To: Qiantan Hong <qt...@st...> > > Cc: SBCL Devel-list <sbc...@li...> > > Subject: Re: [Sbcl-devel] Patch: add sb-ext:note-source-transformation > > > > On Thu, Aug 21, 2025 at 11:18 PM Qiantan Hong <qt...@st...> wrote: > > > > > > Yes, more magic is always desired, but there're case these will not work. E.g. ITERATE might call MACROEXPAND-1 on some input form and return the output (which can be unrecognizable). Or it might expand the subform of some form (e.g. (ordinary-function foo bar (special-construct ...))) differently but do nothing nontrivial to the whole form. > > > > Can you provide me example forms? |
From: Stas B. <sta...@gm...> - 2025-08-22 03:55:36
|
The original code handled that. Should be fixed. On Fri, Aug 22, 2025 at 2:26 AM Qiantan Hong <qt...@st...> wrote: > > Thanks! Although the heurstic still won't work for the other example, and it works somewhat reliable only because the copy detection I added to ITERATE. The gist is that macros themselves know how they expand and if we allow them to provide information, we don't need to guess. > > An example where copy detection without collaboration from the macro is unreliable: > > ;; disable ITER's copy detection, which I added only recently > ;; and would like to disable if NOTE-SOURCE-TRANSFORMATION > ;; is available because it's rather costly > (defun iter::recycle-code (form original-form) form) > > (defun test () > (let ((i 0)) > (iter (repeat 3) > (incf i) > (when (= i 2) (error "test")) > (incf i) > (when (= i 2) (error "test"))))) > > (test) > > Debugger incorrectly jump to the first ERROR form. > > ________________________________ > From: Stas Boukarev <sta...@gm...> > Sent: Thursday, August 21, 2025 3:58 PM > To: Qiantan Hong <qt...@st...> > Cc: SBCL Devel-list <sbc...@li...> > Subject: Re: [Sbcl-devel] Patch: add sb-ext:note-source-transformation > > I resolved the first one in > https://github.com/sbcl/sbcl/commit/c97ff0df4425ceef378d6ed27b3b10f201a430b3 > > On Fri, Aug 22, 2025 at 12:04 AM Qiantan Hong <qt...@st...> wrote: > > > > Example of macroexpand-1 issue: > > > > (let ((x (make-array 1))) > > (iter (repeat 3) > > (setf (aref x 3) 2))) > > > > ITERATE will MACROEXPAND-1 the SETF form (it MACROEXPAND-1 any macro it sees so it can process potential ITER constructs from the expansion result), and now debugger can only jump to the whole ITER form for that (SETF AREF) error. With NOTE-SOURCE-TRANSFORMATION and my ITERATE patch debugger can jump to the SETF form. > > > > Example of subform expanded differently: > > > > (iter (repeat 3) > > (error (if (first-iteration-p) "test1" "test2"))) > > > > (FIRST-ITERATION-P) is expanded to a gensym, and debugger again can only jump to the whole ITER form. With NOTE-SOURCE-TRANSFORMATION and my ITERATE patch debugger can jump to the ERROR form. > > ________________________________ > > From: Stas Boukarev <sta...@gm...> > > Sent: Thursday, August 21, 2025 1:57 PM > > To: Qiantan Hong <qt...@st...> > > Cc: SBCL Devel-list <sbc...@li...> > > Subject: Re: [Sbcl-devel] Patch: add sb-ext:note-source-transformation > > > > On Thu, Aug 21, 2025 at 11:18 PM Qiantan Hong <qt...@st...> wrote: > > > > > > Yes, more magic is always desired, but there're case these will not work. E.g. ITERATE might call MACROEXPAND-1 on some input form and return the output (which can be unrecognizable). Or it might expand the subform of some form (e.g. (ordinary-function foo bar (special-construct ...))) differently but do nothing nontrivial to the whole form. > > > > Can you provide me example forms? |
From: Qiantan H. <qt...@st...> - 2025-08-21 23:26:48
|
Thanks! Although the heurstic still won't work for the other example, and it works somewhat reliable only because the copy detection I added to ITERATE. The gist is that macros themselves know how they expand and if we allow them to provide information, we don't need to guess. An example where copy detection without collaboration from the macro is unreliable: ;; disable ITER's copy detection, which I added only recently ;; and would like to disable if NOTE-SOURCE-TRANSFORMATION ;; is available because it's rather costly (defun iter::recycle-code (form original-form) form) (defun test () (let ((i 0)) (iter (repeat 3) (incf i) (when (= i 2) (error "test")) (incf i) (when (= i 2) (error "test"))))) (test) Debugger incorrectly jump to the first ERROR form. ________________________________ From: Stas Boukarev <sta...@gm...> Sent: Thursday, August 21, 2025 3:58 PM To: Qiantan Hong <qt...@st...> Cc: SBCL Devel-list <sbc...@li...> Subject: Re: [Sbcl-devel] Patch: add sb-ext:note-source-transformation I resolved the first one in https://github.com/sbcl/sbcl/commit/c97ff0df4425ceef378d6ed27b3b10f201a430b3 On Fri, Aug 22, 2025 at 12:04 AM Qiantan Hong <qt...@st...> wrote: > > Example of macroexpand-1 issue: > > (let ((x (make-array 1))) > (iter (repeat 3) > (setf (aref x 3) 2))) > > ITERATE will MACROEXPAND-1 the SETF form (it MACROEXPAND-1 any macro it sees so it can process potential ITER constructs from the expansion result), and now debugger can only jump to the whole ITER form for that (SETF AREF) error. With NOTE-SOURCE-TRANSFORMATION and my ITERATE patch debugger can jump to the SETF form. > > Example of subform expanded differently: > > (iter (repeat 3) > (error (if (first-iteration-p) "test1" "test2"))) > > (FIRST-ITERATION-P) is expanded to a gensym, and debugger again can only jump to the whole ITER form. With NOTE-SOURCE-TRANSFORMATION and my ITERATE patch debugger can jump to the ERROR form. > ________________________________ > From: Stas Boukarev <sta...@gm...> > Sent: Thursday, August 21, 2025 1:57 PM > To: Qiantan Hong <qt...@st...> > Cc: SBCL Devel-list <sbc...@li...> > Subject: Re: [Sbcl-devel] Patch: add sb-ext:note-source-transformation > > On Thu, Aug 21, 2025 at 11:18 PM Qiantan Hong <qt...@st...> wrote: > > > > Yes, more magic is always desired, but there're case these will not work. E.g. ITERATE might call MACROEXPAND-1 on some input form and return the output (which can be unrecognizable). Or it might expand the subform of some form (e.g. (ordinary-function foo bar (special-construct ...))) differently but do nothing nontrivial to the whole form. > > Can you provide me example forms? |
From: Stas B. <sta...@gm...> - 2025-08-21 22:59:09
|
I resolved the first one in https://github.com/sbcl/sbcl/commit/c97ff0df4425ceef378d6ed27b3b10f201a430b3 On Fri, Aug 22, 2025 at 12:04 AM Qiantan Hong <qt...@st...> wrote: > > Example of macroexpand-1 issue: > > (let ((x (make-array 1))) > (iter (repeat 3) > (setf (aref x 3) 2))) > > ITERATE will MACROEXPAND-1 the SETF form (it MACROEXPAND-1 any macro it sees so it can process potential ITER constructs from the expansion result), and now debugger can only jump to the whole ITER form for that (SETF AREF) error. With NOTE-SOURCE-TRANSFORMATION and my ITERATE patch debugger can jump to the SETF form. > > Example of subform expanded differently: > > (iter (repeat 3) > (error (if (first-iteration-p) "test1" "test2"))) > > (FIRST-ITERATION-P) is expanded to a gensym, and debugger again can only jump to the whole ITER form. With NOTE-SOURCE-TRANSFORMATION and my ITERATE patch debugger can jump to the ERROR form. > ________________________________ > From: Stas Boukarev <sta...@gm...> > Sent: Thursday, August 21, 2025 1:57 PM > To: Qiantan Hong <qt...@st...> > Cc: SBCL Devel-list <sbc...@li...> > Subject: Re: [Sbcl-devel] Patch: add sb-ext:note-source-transformation > > On Thu, Aug 21, 2025 at 11:18 PM Qiantan Hong <qt...@st...> wrote: > > > > Yes, more magic is always desired, but there're case these will not work. E.g. ITERATE might call MACROEXPAND-1 on some input form and return the output (which can be unrecognizable). Or it might expand the subform of some form (e.g. (ordinary-function foo bar (special-construct ...))) differently but do nothing nontrivial to the whole form. > > Can you provide me example forms? |
From: Qiantan H. <qt...@st...> - 2025-08-21 21:04:26
|
Example of macroexpand-1 issue: (let ((x (make-array 1))) (iter (repeat 3) (setf (aref x 3) 2))) ITERATE will MACROEXPAND-1 the SETF form (it MACROEXPAND-1 any macro it sees so it can process potential ITER constructs from the expansion result), and now debugger can only jump to the whole ITER form for that (SETF AREF) error. With NOTE-SOURCE-TRANSFORMATION and my ITERATE patch debugger can jump to the SETF form. Example of subform expanded differently: (iter (repeat 3) (error (if (first-iteration-p) "test1" "test2"))) (FIRST-ITERATION-P) is expanded to a gensym, and debugger again can only jump to the whole ITER form. With NOTE-SOURCE-TRANSFORMATION and my ITERATE patch debugger can jump to the ERROR form. ________________________________ From: Stas Boukarev <sta...@gm...> Sent: Thursday, August 21, 2025 1:57 PM To: Qiantan Hong <qt...@st...> Cc: SBCL Devel-list <sbc...@li...> Subject: Re: [Sbcl-devel] Patch: add sb-ext:note-source-transformation On Thu, Aug 21, 2025 at 11:18 PM Qiantan Hong <qt...@st...> wrote: > > Yes, more magic is always desired, but there're case these will not work. E.g. ITERATE might call MACROEXPAND-1 on some input form and return the output (which can be unrecognizable). Or it might expand the subform of some form (e.g. (ordinary-function foo bar (special-construct ...))) differently but do nothing nontrivial to the whole form. Can you provide me example forms? |
From: Stas B. <sta...@gm...> - 2025-08-21 20:57:53
|
On Thu, Aug 21, 2025 at 11:18 PM Qiantan Hong <qt...@st...> wrote: > > Yes, more magic is always desired, but there're case these will not work. E.g. ITERATE might call MACROEXPAND-1 on some input form and return the output (which can be unrecognizable). Or it might expand the subform of some form (e.g. (ordinary-function foo bar (special-construct ...))) differently but do nothing nontrivial to the whole form. Can you provide me example forms? |
From: Qiantan H. <qt...@st...> - 2025-08-21 20:18:19
|
Yes, more magic is always desired, but there're case these will not work. E.g. ITERATE might call MACROEXPAND-1 on some input form and return the output (which can be unrecognizable). Or it might expand the subform of some form (e.g. (ordinary-function foo bar (special-construct ...))) differently but do nothing nontrivial to the whole form. In fact in a previous patch to ITERATE I already try to detect copied form and recycle them to return EQed form instead, so this will have all the effect of detecting copied form. The result is better than nothing but still fragile. Debugger source works for simple function call but many thing doesn't work. Useful functionality will get used. I contribute to ITERATE and if this gets merge I will get it to use it, and on my local branch everything works perfectly - so much better than our previous copy detection hack. I know a few more people considering this useful, plus the same functionality alreayd exists in Clozure CL, and hopefully this can be adopted to more implementations over time. We will work on a trivial-* portability library. ________________________________ From: Stas Boukarev <sta...@gm...> Sent: Thursday, August 21, 2025 4:29 AM To: Qiantan Hong <qt...@st...> Cc: SBCL Devel-list <sbc...@li...> Subject: Re: [Sbcl-devel] Patch: add sb-ext:note-source-transformation The problem with new functionality is that someone has to use it. And also it's not portable (even to older versions of SBCL itself). I would like more magic to happen to find source locations automatically. E.g. https://github.com/sbcl/sbcl/commit/110cd9a4de1321abf12298cd299247b7c9f1bfef is a move towards that, perhaps, something more clever is needed. On Thu, Aug 21, 2025 at 12:18 PM Qiantan Hong <qt...@st...> wrote: > > Hi there, > > The added function allows user macro to indicate correspondence between subforms before and after macro-expansion. This is particularly useful for code-walking macro (like ITERATE), and if used, allows more accurate source tracking when debugging runtime errors. > > Can someone help review this? Thanks! > > BTW if someone feel the need for tests, can you give guidance on where to put the tests? I couldn't find existing test for runtime error source tracking. > > Best, > Qiantan_______________________________________________ > Sbcl-devel mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-devel |
From: Stas B. <sta...@gm...> - 2025-08-21 20:04:22
|
On darwin, aprof.impure fails with: ::: UNEXPECTED-FAILURE :APROF-INSTANCE due to SB-KERNEL::UNDEFINED-ALIEN-VARIABLE-ERROR: "Attempt to access an undefined alien variable." On Thu, Aug 21, 2025 at 7:29 PM snuglas via Sbcl-commits <sbc...@li...> wrote: > > The branch "master" has been updated in SBCL: > via f91c424fcfe1993743ec08de35ef46f89e7f82c6 (commit) > from c3bcc6f886743ccb8a3f7377e5649200e84f7b57 (commit) > > - Log ----------------------------------------------------------------- > commit f91c424fcfe1993743ec08de35ef46f89e7f82c6 > Author: Douglas Katzman <do...@go...> > Date: Thu Aug 21 16:22:32 2025 +0000 > > Make sb-aprof output understandable if foreign threads start and stop rapidly > > Without an extra line of output it was impossible to see that 99% of consing > in the fcb-threads test is fictitious and merely accounts for unusable space > (due to the patch in rev f4ff026a) which helps GC run enough not to crash. > --- > src/code/aprof.lisp | 11 +++++++++-- > src/runtime/alloc.c | 5 +++++ > src/runtime/thread.c | 7 +++++++ > tests/fcb-threads.impure.lisp | 25 ++++++++++++++++++++++++- > 4 files changed, 45 insertions(+), 3 deletions(-) > > diff --git a/src/code/aprof.lisp b/src/code/aprof.lisp > index 6352fb13b..fda96c65e 100644 > --- a/src/code/aprof.lisp > +++ b/src/code/aprof.lisp > @@ -85,6 +85,8 @@ > > (define-alien-variable alloc-profile-buffer system-area-pointer) > (defun aprof-reset () > + (setf (extern-alien "close_region_nfillers" int) 0) > + (setf (extern-alien "close_region_tot_bytes_wasted" unsigned) 0) > (let ((buffer alloc-profile-buffer)) > (unless (= (sap-int buffer) 0) > (alien-funcall (extern-alien "memset" (function void system-area-pointer int size-t)) > @@ -605,10 +607,15 @@ > (dstate (sb-disassem:make-dstate nil)) > (collection (make-hash-table :test 'equal))) > (when stream > - (format stream "~&~d (of ~d max) profile entries consumed~2%" > - n-hit metadata-len)) > + (format stream "~&~d (of ~d max) profile entries consumed, ~D GCs done~2%" > + n-hit metadata-len (extern-alien "n_gcs_done" int))) > (loop > (when (>= index n-counters) > + ;; Add an item accounting for waste caused by closing regions on unfull pages > + (let ((count (extern-alien "close_region_nfillers" int)) > + (total-bytes (extern-alien "close_region_tot_bytes_wasted" unsigned))) > + (push (make-alloc total-bytes count 'sb-vm::filler 0) > + (gethash 'sb-vm::filler collection))) > (return collection)) > (let ((count (sap-ref-word sap (* index 8)))) > (multiple-value-bind (code pc-offset total-bytes) > diff --git a/src/runtime/alloc.c b/src/runtime/alloc.c > index 005176722..45b635a72 100644 > --- a/src/runtime/alloc.c > +++ b/src/runtime/alloc.c > @@ -128,6 +128,9 @@ CRITICAL_SECTION code_allocator_lock; // threads are mandatory for win32 > pthread_mutex_t code_allocator_lock = PTHREAD_MUTEX_INITIALIZER; > #endif > > +int close_region_nfillers; > +uword_t close_region_tot_bytes_wasted; > + > typedef struct { struct alloc_region* r; int type; } close_region_arg; > void sync_close_regions(int block_signals, int options, > close_region_arg* a, int count) > @@ -163,6 +166,8 @@ void sync_close_regions(int block_signals, int options, > // fillers may not be needed. This anticipates non-zero-filed pages though. > deposit_filler(freeptr, new_end); > a[i].r->free_pointer = new_end; > + close_region_nfillers++; > + close_region_tot_bytes_wasted += new_end - freeptr; > } > #endif > ensure_region_closed(a[i].r, a[i].type); > diff --git a/src/runtime/thread.c b/src/runtime/thread.c > index 38ddd5296..61dd3bbc8 100644 > --- a/src/runtime/thread.c > +++ b/src/runtime/thread.c > @@ -515,7 +515,14 @@ unregister_thread(struct thread *th, > th->remset = 0; > } > #endif > + /* Here's a thought: if this structure was for a native thread doing call-in > + * and so we're about to toss this into the recycle bin, what if we didn't > + * consume the remainder of all open regions but instead just kept them? > + * A subsequent call-in which reuses this structure could own the same open > + * regions if no GC ran in the meantime. If GC does need to run, > + * it should close TLABs of all thread structures in the recycle bin */ > gc_close_thread_regions(th, LOCK_PAGE_TABLE|CONSUME_REMAINDER); > + > #ifdef LISP_FEATURE_SB_SAFEPOINT > if (scribble) > pop_gcing_safety(&scribble->safety); > diff --git a/tests/fcb-threads.impure.lisp b/tests/fcb-threads.impure.lisp > index 195070b80..d287352f3 100644 > --- a/tests/fcb-threads.impure.lisp > +++ b/tests/fcb-threads.impure.lisp > @@ -46,7 +46,30 @@ > (defun trivial-call-test (n) > (with-alien ((testfun (function int system-area-pointer int) :extern "minimal_perftest")) > (alien-funcall testfun (alien-sap (alien-callable-function 'perftestcb)) n))) > -(time (trivial-call-test 200000)) > + > + > +;;; When compiled with APROF, the truly astounding amount of space taken up not by objects > +;;; but just closing the open regions in unregister_thread becomes evident: > +#| > +10 (of 150000 max) profile entries consumed, 367 GCs done > + % Bytes Count Function > + ------- ----------- --------- -------- > + 99.7 19590256480 600000 SB-VM::FILLER - SB-VM::FILLER > + 0.1 28800144 600003 SB-THREAD::AVLNODE - SB-THREAD::AVLNODE > + 0.1 28800000 200000 SB-THREAD::MAKE-FOREIGN-THREAD - SB-THREAD:FOREIGN-THREAD > + 00.0 6400000 200000 SB-THREAD:MAKE-MUTEX - SB-THREAD:MUTEX > + 00.0 3200000 200000 SB-THREAD::SYS-TLAB-LIST > + 00.0 5840 365 (FLET "WITHOUT-GCING-BODY-" :IN SB-KERNEL:SUB-GC) - LIST > + 00.0 16 1 SB-THREAD::%ENROLL-NEW-THREADS - LIST > + ======= =========== > + 100.0 19657462480 > +|# > +;;; Something is very off about these numbers though. If there are 20,000 thread creation/ > +;;; destructions, and each thread wastes all of its 4 TLABs, that should be 132KiB per thread, > +;;; for roughly 2.6GB of waste in total. How are we seing nearly 8x that? > +(if (> (sb-c:policy sb-c::*policy* sb-c:instrument-consing) 0) > + (sb-aprof:aprof-run #'trivial-call-test :arguments '(200000)) > + (time (trivial-call-test 200000))) > > ;;;; > (defglobal *counter* 0) > > ----------------------------------------------------------------------- > > > hooks/post-receive > -- > SBCL > > > _______________________________________________ > Sbcl-commits mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-commits |
From: Stas B. <sta...@gm...> - 2025-08-21 11:30:23
|
The problem with new functionality is that someone has to use it. And also it's not portable (even to older versions of SBCL itself). I would like more magic to happen to find source locations automatically. E.g. https://github.com/sbcl/sbcl/commit/110cd9a4de1321abf12298cd299247b7c9f1bfef is a move towards that, perhaps, something more clever is needed. On Thu, Aug 21, 2025 at 12:18 PM Qiantan Hong <qt...@st...> wrote: > > Hi there, > > The added function allows user macro to indicate correspondence between subforms before and after macro-expansion. This is particularly useful for code-walking macro (like ITERATE), and if used, allows more accurate source tracking when debugging runtime errors. > > Can someone help review this? Thanks! > > BTW if someone feel the need for tests, can you give guidance on where to put the tests? I couldn't find existing test for runtime error source tracking. > > Best, > Qiantan_______________________________________________ > Sbcl-devel mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-devel |
From: Qiantan H. <qt...@st...> - 2025-08-21 09:16:10
|
Hi there, The added function allows user macro to indicate correspondence between subforms before and after macro-expansion. This is particularly useful for code-walking macro (like ITERATE), and if used, allows more accurate source tracking when debugging runtime errors. Can someone help review this? Thanks! BTW if someone feel the need for tests, can you give guidance on where to put the tests? I couldn't find existing test for runtime error source tracking. Best, Qiantan |
From: Chun T. (binghe) <bin...@gm...> - 2025-08-20 06:24:05
|
Hi Chris, I was able to rebuild SBCL (any version) on Solaris 10 & 11 on x86, using OpenCSW GCC 5.5.0 (preferred) and Oracle Studio compiler 12.5 (both can work but only one is needed). I think there are at least two issues currently remaining in SBCL source code: 1) The file make-target-contrib.sh (at least sometime ago) may not be Bourne Shell-compliant, and if under your PATH environment variable the call of "sh" does not lead to GNU bash, calling that script may fail. A trivial fix is to explicitly call "bash" instead. 2) Some C code requires either C99 or special flags when being compiled with the above mentioned compilers. The attached patch may help you a bit, unless you meet other SPARC-specific issues. Regards, Chun Tian On 19/08/25 13:58, Chris Hanson wrote: > I have Solaris 11.3 on a T2000 (SPARC T1, sun4v architecture) and while the SBCL 2.0.4 binary on the downloads page appears to work fine, I can’t seem to build either 2.0.4 or any newer version using it and the GCC installed from the Solaris pkg system, I always get dropped to the debugger early on. > > I’d be a bit out of my depth if I tried to debug it, but on the off chance it’s helpful background information, does anyone remember what version of Solaris and (I assume) GCC was used to compile the 2.0.4 binary? > > — Chris > > Sent from my iPhone > > _______________________________________________ > Sbcl-devel mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-devel > |
From: Chris H. <cmh...@es...> - 2025-08-19 04:36:08
|
I have Solaris 11.3 on a T2000 (SPARC T1, sun4v architecture) and while the SBCL 2.0.4 binary on the downloads page appears to work fine, I can’t seem to build either 2.0.4 or any newer version using it and the GCC installed from the Solaris pkg system, I always get dropped to the debugger early on. I’d be a bit out of my depth if I tried to debug it, but on the off chance it’s helpful background information, does anyone remember what version of Solaris and (I assume) GCC was used to compile the 2.0.4 binary? — Chris Sent from my iPhone |
From: Stas B. <sta...@gm...> - 2025-08-16 21:54:40
|
launchpad is the best way to ensure things are not lost. On Sun, Aug 17, 2025 at 12:52 AM Brent Benson <bwb...@gm...> wrote: > > I created the attached patch with a fix and unit test for bug #1600610 (input and output buffers get out of sync in io streams). I also put the patch in the bug on Launchpad. > > The fix adds calls to finish-fd-stream-output before reading in the input-at-least and input-wrapper/variable-width macros, but only when fd-stream-synchronize-output is true (which is set for bidirectional file streams). This ensures output is flushed before reads without impacting performance of normal input-only or output-only streams. > > I'm just making sure this is the right way to submit a fix, rather than submitting a pull request, which I'd be happy to do as well. > > Thanks, > Brent > > _______________________________________________ > Sbcl-devel mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-devel |
From: Brent B. <bwb...@gm...> - 2025-08-16 21:51:04
|
I created the attached patch with a fix and unit test for bug #1600610 (input and output buffers get out of sync in io streams). I also put the patch in the bug on Launchpad. The fix adds calls to finish-fd-stream-output before reading in the input-at-least and input-wrapper/variable-width macros, but only when fd-stream-synchronize-output is true (which is set for bidirectional file streams). This ensures output is flushed before reads without impacting performance of normal input-only or output-only streams. I'm just making sure this is the right way to submit a fix, rather than submitting a pull request, which I'd be happy to do as well. Thanks, Brent |
From: Stas B. <sta...@gm...> - 2025-08-15 19:20:50
|
Well, maybe search ought to do that too. On Fri, Aug 15, 2025 at 9:46 PM Charles Zhang <cha...@ya...> wrote: > > Ah, then that’s definitely a quality of life improvement. > > > On Friday, August 15, 2025, 8:46 PM, Charles Zhang via Sbcl-commits <sbc...@li...> wrote: > > Its always worked for me to use ‘search’ to find the code object from an interior pointer. > > On Friday, August 15, 2025, 8:43 PM, Stas Boukarev <sta...@gm...> wrote: > > I see no calls to component_ptr_from_pc there. > > On Fri, Aug 15, 2025 at 9:42 PM Charles Zhang <cha...@ya...> wrote: > > > > Doesn’t search already do this? > > > > On Friday, August 15, 2025, 7:36 PM, stassats via Sbcl-commits <sbc...@li...> wrote: > > > > The branch "master" has been updated in SBCL: > > via c525ac98bdc79c3d87821abb8fa45dd60d76adfb (commit) > > from 84543e0050dc60b76ed8304abed50105e755d3b0 (commit) > > > > - Log ----------------------------------------------------------------- > > commit c525ac98bdc79c3d87821abb8fa45dd60d76adfb > > Author: Stas Boukarev <sta...@gm...> > > Date: Fri Aug 15 20:17:40 2025 +0300 > > > > ldb: add a command to find component_ptr_from_pc. > > --- > > src/runtime/monitor.c | 14 +++++++++++++- > > 1 file changed, 13 insertions(+), 1 deletion(-) > > > > diff --git a/src/runtime/monitor.c b/src/runtime/monitor.c > > index c5283ea2c..34cdd1b2e 100644 > > --- a/src/runtime/monitor.c > > +++ b/src/runtime/monitor.c > > @@ -279,7 +279,7 @@ void save_gc_crashdump(char *pathname, > > #endif > > > > static cmd call_cmd, dump_cmd, print_cmd, quit_cmd, help_cmd; > > -static cmd flush_cmd, regs_cmd, exit_cmd; > > +static cmd flush_cmd, regs_cmd, exit_cmd, print_code; > > static cmd print_context_cmd, pte_cmd, search_cmd, hashtable_cmd; > > static cmd backtrace_cmd, threadbt_cmd, catchers_cmd; > > static cmd threads_cmd, findpath_cmd, layouts_cmd; > > @@ -484,6 +484,7 @@ static struct cmd { > > {"layouts", "Dump LAYOUT instances.", layouts_cmd}, > > {"print", "Print object at ADDRESS.", print_cmd}, > > {"p", "(an alias for print)", print_cmd}, > > + {"code", "Print the code object at ADDRESS.", print_code}, > > {"pte", "Page table entry for address", pte_cmd}, > > {"quit", "Quit.", quit_cmd}, > > {"regs", "Display current Lisp registers.", regs_cmd}, > > @@ -633,6 +634,17 @@ static int print_cmd(char **ptr, iochannel_t io) > > return 0; > > } > > > > +static int print_code(char **ptr, iochannel_t io) > > +{ > > + lispobj obj; > > + if (parse_lispobj(ptr, &obj, io->out)) { > > + lispobj * code = component_ptr_from_pc((char *)obj); > > + if (code) > > + print_to_iochan((lispobj)code | OTHER_POINTER_LOWTAG, io); > > + } > > + return 0; > > +} > > + > > int verify_lisp_hashtable(__attribute__((unused)) struct hash_table* ht, > > __attribute__((unused)) FILE* file) > > { > > > > ----------------------------------------------------------------------- > > > > > > hooks/post-receive > > -- > > SBCL > > > > > > _______________________________________________ > > Sbcl-commits mailing list > > Sbc...@li... > > https://lists.sourceforge.net/lists/listinfo/sbcl-commits > > _______________________________________________ > Sbcl-commits mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-commits |
From: Charles Z. <cha...@ya...> - 2025-08-15 19:07:20
|
Ah, then that’s definitely a quality of life improvement. On Friday, August 15, 2025, 8:46 PM, Charles Zhang via Sbcl-commits <sbc...@li...> wrote: Its always worked for me to use ‘search’ to find the code object from an interior pointer. On Friday, August 15, 2025, 8:43 PM, Stas Boukarev <sta...@gm...> wrote: I see no calls to component_ptr_from_pc there. On Fri, Aug 15, 2025 at 9:42 PM Charles Zhang <cha...@ya...> wrote: > > Doesn’t search already do this? > > On Friday, August 15, 2025, 7:36 PM, stassats via Sbcl-commits <sbc...@li...> wrote: > > The branch "master" has been updated in SBCL: > via c525ac98bdc79c3d87821abb8fa45dd60d76adfb (commit) > from 84543e0050dc60b76ed8304abed50105e755d3b0 (commit) > > - Log ----------------------------------------------------------------- > commit c525ac98bdc79c3d87821abb8fa45dd60d76adfb > Author: Stas Boukarev <sta...@gm...> > Date: Fri Aug 15 20:17:40 2025 +0300 > > ldb: add a command to find component_ptr_from_pc. > --- > src/runtime/monitor.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/src/runtime/monitor.c b/src/runtime/monitor.c > index c5283ea2c..34cdd1b2e 100644 > --- a/src/runtime/monitor.c > +++ b/src/runtime/monitor.c > @@ -279,7 +279,7 @@ void save_gc_crashdump(char *pathname, > #endif > > static cmd call_cmd, dump_cmd, print_cmd, quit_cmd, help_cmd; > -static cmd flush_cmd, regs_cmd, exit_cmd; > +static cmd flush_cmd, regs_cmd, exit_cmd, print_code; > static cmd print_context_cmd, pte_cmd, search_cmd, hashtable_cmd; > static cmd backtrace_cmd, threadbt_cmd, catchers_cmd; > static cmd threads_cmd, findpath_cmd, layouts_cmd; > @@ -484,6 +484,7 @@ static struct cmd { > {"layouts", "Dump LAYOUT instances.", layouts_cmd}, > {"print", "Print object at ADDRESS.", print_cmd}, > {"p", "(an alias for print)", print_cmd}, > + {"code", "Print the code object at ADDRESS.", print_code}, > {"pte", "Page table entry for address", pte_cmd}, > {"quit", "Quit.", quit_cmd}, > {"regs", "Display current Lisp registers.", regs_cmd}, > @@ -633,6 +634,17 @@ static int print_cmd(char **ptr, iochannel_t io) > return 0; > } > > +static int print_code(char **ptr, iochannel_t io) > +{ > + lispobj obj; > + if (parse_lispobj(ptr, &obj, io->out)) { > + lispobj * code = component_ptr_from_pc((char *)obj); > + if (code) > + print_to_iochan((lispobj)code | OTHER_POINTER_LOWTAG, io); > + } > + return 0; > +} > + > int verify_lisp_hashtable(__attribute__((unused)) struct hash_table* ht, > __attribute__((unused)) FILE* file) > { > > ----------------------------------------------------------------------- > > > hooks/post-receive > -- > SBCL > > > _______________________________________________ > Sbcl-commits mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-commits _______________________________________________ Sbcl-commits mailing list Sbc...@li... https://lists.sourceforge.net/lists/listinfo/sbcl-commits |
From: Stas B. <sta...@gm...> - 2025-08-15 18:45:58
|
ldb> search 0xb80022952c #xb80022921f vs ldb> code 0xb80022952c 0xb80022921f: other pointer header: 0x6c06000035: codeblob f[0]: 0xb80022925b: #<ptr to simplefun> boxed_size: 0x00000038: 28 fixups: 0x00020f7e: 67519 debug_info: 0x1200a375e3: #<ptr to 50000603 COMPILED-DEBUG-INFO instance> ???: 0x5003b06f: *INTERRUPTS-ENABLED* ???: 0x5003b03f: *ALLOW-WITH-INTERRUPTS* ???: 0x5003b09f: *INTERRUPT-PENDING* On Fri, Aug 15, 2025 at 9:43 PM Stas Boukarev <sta...@gm...> wrote: > > I see no calls to component_ptr_from_pc there. > > On Fri, Aug 15, 2025 at 9:42 PM Charles Zhang <cha...@ya...> wrote: > > > > Doesn’t search already do this? > > > > On Friday, August 15, 2025, 7:36 PM, stassats via Sbcl-commits <sbc...@li...> wrote: > > > > The branch "master" has been updated in SBCL: > > via c525ac98bdc79c3d87821abb8fa45dd60d76adfb (commit) > > from 84543e0050dc60b76ed8304abed50105e755d3b0 (commit) > > > > - Log ----------------------------------------------------------------- > > commit c525ac98bdc79c3d87821abb8fa45dd60d76adfb > > Author: Stas Boukarev <sta...@gm...> > > Date: Fri Aug 15 20:17:40 2025 +0300 > > > > ldb: add a command to find component_ptr_from_pc. > > --- > > src/runtime/monitor.c | 14 +++++++++++++- > > 1 file changed, 13 insertions(+), 1 deletion(-) > > > > diff --git a/src/runtime/monitor.c b/src/runtime/monitor.c > > index c5283ea2c..34cdd1b2e 100644 > > --- a/src/runtime/monitor.c > > +++ b/src/runtime/monitor.c > > @@ -279,7 +279,7 @@ void save_gc_crashdump(char *pathname, > > #endif > > > > static cmd call_cmd, dump_cmd, print_cmd, quit_cmd, help_cmd; > > -static cmd flush_cmd, regs_cmd, exit_cmd; > > +static cmd flush_cmd, regs_cmd, exit_cmd, print_code; > > static cmd print_context_cmd, pte_cmd, search_cmd, hashtable_cmd; > > static cmd backtrace_cmd, threadbt_cmd, catchers_cmd; > > static cmd threads_cmd, findpath_cmd, layouts_cmd; > > @@ -484,6 +484,7 @@ static struct cmd { > > {"layouts", "Dump LAYOUT instances.", layouts_cmd}, > > {"print", "Print object at ADDRESS.", print_cmd}, > > {"p", "(an alias for print)", print_cmd}, > > + {"code", "Print the code object at ADDRESS.", print_code}, > > {"pte", "Page table entry for address", pte_cmd}, > > {"quit", "Quit.", quit_cmd}, > > {"regs", "Display current Lisp registers.", regs_cmd}, > > @@ -633,6 +634,17 @@ static int print_cmd(char **ptr, iochannel_t io) > > return 0; > > } > > > > +static int print_code(char **ptr, iochannel_t io) > > +{ > > + lispobj obj; > > + if (parse_lispobj(ptr, &obj, io->out)) { > > + lispobj * code = component_ptr_from_pc((char *)obj); > > + if (code) > > + print_to_iochan((lispobj)code | OTHER_POINTER_LOWTAG, io); > > + } > > + return 0; > > +} > > + > > int verify_lisp_hashtable(__attribute__((unused)) struct hash_table* ht, > > __attribute__((unused)) FILE* file) > > { > > > > ----------------------------------------------------------------------- > > > > > > hooks/post-receive > > -- > > SBCL > > > > > > _______________________________________________ > > Sbcl-commits mailing list > > Sbc...@li... > > https://lists.sourceforge.net/lists/listinfo/sbcl-commits |
From: Charles Z. <cha...@ya...> - 2025-08-15 18:45:55
|
Its always worked for me to use ‘search’ to find the code object from an interior pointer. On Friday, August 15, 2025, 8:43 PM, Stas Boukarev <sta...@gm...> wrote: I see no calls to component_ptr_from_pc there. On Fri, Aug 15, 2025 at 9:42 PM Charles Zhang <cha...@ya...> wrote: > > Doesn’t search already do this? > > On Friday, August 15, 2025, 7:36 PM, stassats via Sbcl-commits <sbc...@li...> wrote: > > The branch "master" has been updated in SBCL: > via c525ac98bdc79c3d87821abb8fa45dd60d76adfb (commit) > from 84543e0050dc60b76ed8304abed50105e755d3b0 (commit) > > - Log ----------------------------------------------------------------- > commit c525ac98bdc79c3d87821abb8fa45dd60d76adfb > Author: Stas Boukarev <sta...@gm...> > Date: Fri Aug 15 20:17:40 2025 +0300 > > ldb: add a command to find component_ptr_from_pc. > --- > src/runtime/monitor.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/src/runtime/monitor.c b/src/runtime/monitor.c > index c5283ea2c..34cdd1b2e 100644 > --- a/src/runtime/monitor.c > +++ b/src/runtime/monitor.c > @@ -279,7 +279,7 @@ void save_gc_crashdump(char *pathname, > #endif > > static cmd call_cmd, dump_cmd, print_cmd, quit_cmd, help_cmd; > -static cmd flush_cmd, regs_cmd, exit_cmd; > +static cmd flush_cmd, regs_cmd, exit_cmd, print_code; > static cmd print_context_cmd, pte_cmd, search_cmd, hashtable_cmd; > static cmd backtrace_cmd, threadbt_cmd, catchers_cmd; > static cmd threads_cmd, findpath_cmd, layouts_cmd; > @@ -484,6 +484,7 @@ static struct cmd { > {"layouts", "Dump LAYOUT instances.", layouts_cmd}, > {"print", "Print object at ADDRESS.", print_cmd}, > {"p", "(an alias for print)", print_cmd}, > + {"code", "Print the code object at ADDRESS.", print_code}, > {"pte", "Page table entry for address", pte_cmd}, > {"quit", "Quit.", quit_cmd}, > {"regs", "Display current Lisp registers.", regs_cmd}, > @@ -633,6 +634,17 @@ static int print_cmd(char **ptr, iochannel_t io) > return 0; > } > > +static int print_code(char **ptr, iochannel_t io) > +{ > + lispobj obj; > + if (parse_lispobj(ptr, &obj, io->out)) { > + lispobj * code = component_ptr_from_pc((char *)obj); > + if (code) > + print_to_iochan((lispobj)code | OTHER_POINTER_LOWTAG, io); > + } > + return 0; > +} > + > int verify_lisp_hashtable(__attribute__((unused)) struct hash_table* ht, > __attribute__((unused)) FILE* file) > { > > ----------------------------------------------------------------------- > > > hooks/post-receive > -- > SBCL > > > _______________________________________________ > Sbcl-commits mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-commits |
From: Stas B. <sta...@gm...> - 2025-08-15 18:44:05
|
I see no calls to component_ptr_from_pc there. On Fri, Aug 15, 2025 at 9:42 PM Charles Zhang <cha...@ya...> wrote: > > Doesn’t search already do this? > > On Friday, August 15, 2025, 7:36 PM, stassats via Sbcl-commits <sbc...@li...> wrote: > > The branch "master" has been updated in SBCL: > via c525ac98bdc79c3d87821abb8fa45dd60d76adfb (commit) > from 84543e0050dc60b76ed8304abed50105e755d3b0 (commit) > > - Log ----------------------------------------------------------------- > commit c525ac98bdc79c3d87821abb8fa45dd60d76adfb > Author: Stas Boukarev <sta...@gm...> > Date: Fri Aug 15 20:17:40 2025 +0300 > > ldb: add a command to find component_ptr_from_pc. > --- > src/runtime/monitor.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/src/runtime/monitor.c b/src/runtime/monitor.c > index c5283ea2c..34cdd1b2e 100644 > --- a/src/runtime/monitor.c > +++ b/src/runtime/monitor.c > @@ -279,7 +279,7 @@ void save_gc_crashdump(char *pathname, > #endif > > static cmd call_cmd, dump_cmd, print_cmd, quit_cmd, help_cmd; > -static cmd flush_cmd, regs_cmd, exit_cmd; > +static cmd flush_cmd, regs_cmd, exit_cmd, print_code; > static cmd print_context_cmd, pte_cmd, search_cmd, hashtable_cmd; > static cmd backtrace_cmd, threadbt_cmd, catchers_cmd; > static cmd threads_cmd, findpath_cmd, layouts_cmd; > @@ -484,6 +484,7 @@ static struct cmd { > {"layouts", "Dump LAYOUT instances.", layouts_cmd}, > {"print", "Print object at ADDRESS.", print_cmd}, > {"p", "(an alias for print)", print_cmd}, > + {"code", "Print the code object at ADDRESS.", print_code}, > {"pte", "Page table entry for address", pte_cmd}, > {"quit", "Quit.", quit_cmd}, > {"regs", "Display current Lisp registers.", regs_cmd}, > @@ -633,6 +634,17 @@ static int print_cmd(char **ptr, iochannel_t io) > return 0; > } > > +static int print_code(char **ptr, iochannel_t io) > +{ > + lispobj obj; > + if (parse_lispobj(ptr, &obj, io->out)) { > + lispobj * code = component_ptr_from_pc((char *)obj); > + if (code) > + print_to_iochan((lispobj)code | OTHER_POINTER_LOWTAG, io); > + } > + return 0; > +} > + > int verify_lisp_hashtable(__attribute__((unused)) struct hash_table* ht, > __attribute__((unused)) FILE* file) > { > > ----------------------------------------------------------------------- > > > hooks/post-receive > -- > SBCL > > > _______________________________________________ > Sbcl-commits mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-commits |
From: Charles Z. <cha...@ya...> - 2025-08-15 18:42:10
|
Doesn’t search already do this? On Friday, August 15, 2025, 7:36 PM, stassats via Sbcl-commits <sbc...@li...> wrote: The branch "master" has been updated in SBCL: via c525ac98bdc79c3d87821abb8fa45dd60d76adfb (commit) from 84543e0050dc60b76ed8304abed50105e755d3b0 (commit) - Log ----------------------------------------------------------------- commit c525ac98bdc79c3d87821abb8fa45dd60d76adfb Author: Stas Boukarev <sta...@gm...> Date: Fri Aug 15 20:17:40 2025 +0300 ldb: add a command to find component_ptr_from_pc. --- src/runtime/monitor.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/runtime/monitor.c b/src/runtime/monitor.c index c5283ea2c..34cdd1b2e 100644 --- a/src/runtime/monitor.c +++ b/src/runtime/monitor.c @@ -279,7 +279,7 @@ void save_gc_crashdump(char *pathname, #endif static cmd call_cmd, dump_cmd, print_cmd, quit_cmd, help_cmd; -static cmd flush_cmd, regs_cmd, exit_cmd; +static cmd flush_cmd, regs_cmd, exit_cmd, print_code; static cmd print_context_cmd, pte_cmd, search_cmd, hashtable_cmd; static cmd backtrace_cmd, threadbt_cmd, catchers_cmd; static cmd threads_cmd, findpath_cmd, layouts_cmd; @@ -484,6 +484,7 @@ static struct cmd { {"layouts", "Dump LAYOUT instances.", layouts_cmd}, {"print", "Print object at ADDRESS.", print_cmd}, {"p", "(an alias for print)", print_cmd}, + {"code", "Print the code object at ADDRESS.", print_code}, {"pte", "Page table entry for address", pte_cmd}, {"quit", "Quit.", quit_cmd}, {"regs", "Display current Lisp registers.", regs_cmd}, @@ -633,6 +634,17 @@ static int print_cmd(char **ptr, iochannel_t io) return 0; } +static int print_code(char **ptr, iochannel_t io) +{ + lispobj obj; + if (parse_lispobj(ptr, &obj, io->out)) { + lispobj * code = component_ptr_from_pc((char *)obj); + if (code) + print_to_iochan((lispobj)code | OTHER_POINTER_LOWTAG, io); + } + return 0; +} + int verify_lisp_hashtable(__attribute__((unused)) struct hash_table* ht, __attribute__((unused)) FILE* file) { ----------------------------------------------------------------------- hooks/post-receive -- SBCL _______________________________________________ Sbcl-commits mailing list Sbc...@li... https://lists.sourceforge.net/lists/listinfo/sbcl-commits |
From: Stas B. <sta...@gm...> - 2025-08-14 00:10:55
|
Surely, modern CPUs don't care about that kind of thing. On Thu, Aug 14, 2025 at 3:09 AM snuglas via Sbcl-commits <sbc...@li...> wrote: > > The branch "master" has been updated in SBCL: > via 08cae3d7ff651efa30ebb26db385b6247341bba2 (commit) > from 9bfa7d892808dede7ef82517a9282d32e0a270a3 (commit) > > - Log ----------------------------------------------------------------- > commit 08cae3d7ff651efa30ebb26db385b6247341bba2 > Author: Douglas Katzman <do...@go...> > Date: Wed Aug 13 20:08:52 2025 -0400 > > Remove inter-instruction dependency > --- > src/assembly/x86-64/assem-rtns.lisp | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/src/assembly/x86-64/assem-rtns.lisp b/src/assembly/x86-64/assem-rtns.lisp > index 02eb15511..df08161d1 100644 > --- a/src/assembly/x86-64/assem-rtns.lisp > +++ b/src/assembly/x86-64/assem-rtns.lisp > @@ -78,8 +78,8 @@ > ZERO-VALUES > (inst lea rbx (ea (* sp->fp-offset n-word-bytes) rbp-tn)) > (inst mov rdx null-tn) > - (inst mov rdi rdx) > - (inst mov rsi rdx) > + (inst mov rdi null-tn) > + (inst mov rsi null-tn) > (inst stc) > (inst leave) > (inst ret) > > ----------------------------------------------------------------------- > > > hooks/post-receive > -- > SBCL > > > _______________________________________________ > Sbcl-commits mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-commits |
From: Richard M K. <kr...@pr...> - 2025-08-13 21:12:03
|
Okay, thanks. Stas Boukarev writes: > (file-position fd-stream x) clears the cached value, at the moment. > > On Wed, Aug 13, 2025 at 10:24=E2=80=AFPM Richard M Kreuter via Sbcl-devel > <sbc...@li...> wrote: > > > > Hi Stas, > > > > Any idea if this change might ever leave a stream's idea of its position > > different from the fd's offset immediately after > > > > (assert (file-position fd-stream (file-position fd-stream))) > > > > succeeds? I can't infer the answer from the diff. > > > > Thanks, > > Richard > > > > stassats via Sbcl-commits writes: > > > The branch "master" has been updated in SBCL: > > > via 0dcf58ce89cf14af4d08c3d78cb824056b344df0 (commit) > > > from fb930c0c29af5db4c2984929386b09aba9f0bdfe (commit) > > > > > > - Log ----------------------------------------------------------------- > > > commit 0dcf58ce89cf14af4d08c3d78cb824056b344df0 > > > Author: Stas Boukarev <sta...@gm...> > > > Date: Wed Aug 13 20:00:40 2025 +0300 > > > > > > Don't call lseek for each file-position. > > > > > > Call it only when a new buffer is filled. > > > --- > > > src/code/fd-stream.lisp | 148 ++++++++++++++++++++++++++++-----------= > ------ > > > -- > > > xperfecthash63.lisp-expr | 17 ++++++ > > > 2 files changed, 106 insertions(+), 59 deletions(-) > > > > > > diff --git a/src/code/fd-stream.lisp b/src/code/fd-stream.lisp > > > index 87b6c9519..962eab577 100644 > > > --- a/src/code/fd-stream.lisp > > > +++ b/src/code/fd-stream.lisp > > > @@ -161,7 +161,13 @@ > > > ;; fixed width, or function to call with a character > > > (char-size 1 :type (or fixnum function)) > > > (replacement nil :type (or null character string (simple-array (unsi= > gned-b > > > yte 8) 1))) > > > - (output-bytes #'ill-out :type function)) > > > + (output-bytes #'ill-out :type function) > > > + (file-position -1 :type (or (and unsigned-byte > > > + #+64-bit index) > > > + ;; -1: uninitialized > > > + ;; -2: don't track > > > + ;; -3: can't be determined > > > + (member -1 -2 -3)))) > > > > > > (defun fd-stream-bivalent-p (stream) > > > (eq (fd-stream-element-mode stream) :bivalent)) > > > @@ -311,43 +317,47 @@ > > > (aver (< head tail)) > > > (when (fd-stream-synchronize-output stream) > > > (synchronize-stream-output stream)) > > > + (when (>=3D (fd-stream-file-position stream) 0) > > > + (setf (fd-stream-file-position stream) -1)) > > > (loop > > > - (let ((length (- tail head))) > > > - (multiple-value-bind (count errno) > > > - (sb-unix:unix-write (fd-stream-fd stream) (buff= > er-sap > > > obuf) > > > - head length) > > > - (flet ((queue-or-wait () > > > - (if (fd-stream-serve-events stream) > > > - (return (%queue-and-replace-output-b= > uffer > > > stream)) > > > - (or (wait-until-fd-usable (fd-stream= > -fd st > > > ream) :output > > > - (fd-stream= > -timeo > > > ut stream) > > > - nil) > > > - (signal-timeout 'io-timeout > > > - :stream stream > > > - :direction :outp= > ut > > > - :seconds (fd-str= > eam-ti > > > meout stream)))))) > > > - (cond ((eql count length) > > > - ;; Complete write -- we can use the sam= > e buff > > > er. > > > - (return (reset-buffer obuf))) > > > - (count > > > - ;; Partial write -- update buffer statu= > s and > > > - ;; queue or wait. > > > - (incf head count) > > > - (setf (buffer-head obuf) head) > > > - (queue-or-wait)) > > > - #-win32 > > > - ((eql errno sb-unix:ewouldblock) > > > - ;; Blocking, queue or wair. > > > - (queue-or-wait)) > > > - ;; if interrupted on win32, just try aga= > in > > > - #+win32 ((eql errno sb-unix:eintr)) > > > - (t > > > - (simple-stream-perror +write-failed+ > > > - stream errno)))))= > )))))) > > > )) > > > + (let ((length (- tail head))) > > > + (multiple-value-bind (count errno) > > > + (sb-unix:unix-write (fd-stream-fd stream) (buffe= > r-sap > > > obuf) > > > + head length) > > > + (flet ((queue-or-wait () > > > + (if (fd-stream-serve-events stream) > > > + (return (%queue-and-replace-output-bu= > ffer s > > > tream)) > > > + (or (wait-until-fd-usable (fd-stream-= > fd str > > > eam) :output > > > + (fd-stream-= > timeou > > > t stream) > > > + nil) > > > + (signal-timeout 'io-timeout > > > + :stream stream > > > + :direction :outpu= > t > > > + :seconds (fd-stre= > am-tim > > > eout stream)))))) > > > + (cond ((eql count length) > > > + ;; Complete write -- we can use the same = > buffer > > > . > > > + (return (reset-buffer obuf))) > > > + (count > > > + ;; Partial write -- update buffer status = > and > > > + ;; queue or wait. > > > + (incf head count) > > > + (setf (buffer-head obuf) head) > > > + (queue-or-wait)) > > > + #-win32 > > > + ((eql errno sb-unix:ewouldblock) > > > + ;; Blocking, queue or wair. > > > + (queue-or-wait)) > > > + ;; if interrupted on win32, just try again > > > + #+win32 ((eql errno sb-unix:eintr)) > > > + (t > > > + (simple-stream-perror +write-failed+ > > > + stream errno)))))))= > )))))) > > > > > > (defun finish-writing-sequence (sequence stream start end) > > > (when (fd-stream-synchronize-output stream) > > > (synchronize-stream-output stream)) > > > + (when (>=3D (fd-stream-file-position stream) 0) > > > + (setf (fd-stream-file-position stream) -1)) > > > (loop > > > (let ((length (- end start))) > > > (multiple-value-bind (count errno) > > > @@ -404,6 +414,8 @@ > > > (aver (fd-stream-serve-events stream)) > > > (when (fd-stream-synchronize-output stream) > > > (synchronize-stream-output stream)) > > > + (when (>=3D (fd-stream-file-position stream) 0) > > > + (setf (fd-stream-file-position stream) -1)) > > > (let (not-first-p) > > > (tagbody > > > :pop-buffer > > > @@ -460,6 +472,8 @@ > > > (let ((length (- end start))) > > > (when (fd-stream-synchronize-output stream) > > > (synchronize-stream-output stream)) > > > + (when (>=3D (fd-stream-file-position stream) 0) > > > + (setf (fd-stream-file-position stream) -1)) > > > (multiple-value-bind (count errno) > > > (sb-unix:unix-write (fd-stream-fd stream) thing start l= > ength) > > > (cond ((eql count length) > > > @@ -1036,6 +1050,8 @@ > > > (let ((fd (fd-stream-fd stream)) > > > (errno 0) > > > (count 0)) > > > + (when (>=3D (fd-stream-file-position stream) 0) > > > + (setf (fd-stream-file-position stream) -1)) > > > (tagbody > > > #+win32 > > > (go :main) > > > @@ -1381,6 +1397,8 @@ > > > (eq (fd-stream-fd-type stream) :regular) > > > ;; TODO: handle non-empty initial buffers > > > (=3D (buffer-head ibuf) (buffer-tail ibuf))) > > > + (when (>=3D (fd-stream-file-position stream) 0) > > > + (setf (fd-stream-file-position stream) -1)) > > > (prog ((fd (fd-stream-fd stream)) > > > (errno 0) > > > (count 0)) > > > @@ -1951,9 +1969,12 @@ > > > (setf (fd-stream-ibuf fd-stream) nil) > > > (release-buffer ibuf)))) > > > > > > - ;; FIXME: Why only for output? Why unconditionally? > > > (when output-p > > > - (setf (fd-stream-output-column fd-stream) 0)) > > > + ;; FIXME: Why only for output? Why unconditionally? > > > + (setf (fd-stream-output-column fd-stream) 0) > > > + (when input-p > > > + ;; Do not track > > > + (setf (fd-stream-file-position fd-stream) -2))) > > > > > > (when input-p > > > (flet ((no-input-routine () > > > @@ -2321,7 +2342,14 @@ > > > (defun fd-stream-get-file-position (stream) > > > (declare (fd-stream stream)) > > > (without-interrupts > > > - (let ((posn (sb-unix:unix-lseek (fd-stream-fd stream) 0 sb-unix:l_= > incr)) > > > ) > > > + (let* ((cached (fd-stream-file-position stream)) > > > + (posn (cond ((>=3D cached 0) > > > + cached) > > > + ((>=3D cached -2) > > > + (let ((r (sb-unix:unix-lseek (fd-stream-fd str= > eam) 0 > > > sb-unix:l_incr))) > > > + (unless (eq cached -2) > > > + (setf (fd-stream-file-position stream) (or= > r -3) > > > )) > > > + r))))) > > > (declare (type (or (alien sb-unix:unix-offset) null) posn)) > > > ;; We used to return NIL for errno=3D=3DESPIPE, and signal an er= > ror > > > ;; in other failure cases. However, CLHS says to return NIL if > > > @@ -2353,6 +2381,8 @@ > > > (check-type position-spec > > > (or (alien sb-unix:unix-offset) (member nil :start :end)= > ) > > > "valid file position designator") > > > + (when (>=3D (fd-stream-file-position stream) 0) > > > + (setf (fd-stream-file-position stream) -1)) > > > (tagbody > > > :again > > > ;; Make sure we don't have any output pending, because if we > > > @@ -2373,29 +2403,29 @@ > > > (flush-input-buffer stream) > > > ;; Trash cached value for listen, so that we check next time. > > > (setf (fd-stream-listen stream) nil) > > > - ;; Now move it. > > > - (multiple-value-bind (offset origin) > > > - (case position-spec > > > - (:start > > > - (values 0 sb-unix:l_set)) > > > - (:end > > > - (values 0 sb-unix:l_xtnd)) > > > - (t > > > - (values (* position-spec (fd-stream-element-size strea= > m)) > > > - sb-unix:l_set))) > > > - (declare (type (alien sb-unix:unix-offset) offset)) > > > - (let ((posn (sb-unix:unix-lseek (fd-stream-fd stream) > > > - offset origin))) > > > - ;; CLHS says to return true if the file-position was set > > > - ;; successfully, and NIL otherwise. We are to signal an e= > rror > > > - ;; only if the given position was out of bounds, and that= > is > > > - ;; dealt with above. In times past we used to return NIL = > for > > > - ;; errno=3D=3DESPIPE, and signal an error in other cases. > > > - ;; > > > - ;; FIXME: We are still liable to signal an error if flush= > ing > > > - ;; output fails. > > > - (return-from fd-stream-set-file-position > > > - (typep posn '(alien sb-unix:unix-offset)))))))) > > > + ;; Now move it. > > > + (multiple-value-bind (offset origin) > > > + (case position-spec > > > + (:start > > > + (values 0 sb-unix:l_set)) > > > + (:end > > > + (values 0 sb-unix:l_xtnd)) > > > + (t > > > + (values (* position-spec (fd-stream-element-size stream)= > ) > > > + sb-unix:l_set))) > > > + (declare (type (alien sb-unix:unix-offset) offset)) > > > + (let ((posn (sb-unix:unix-lseek (fd-stream-fd stream) > > > + offset origin))) > > > + ;; CLHS says to return true if the file-position was set > > > + ;; successfully, and NIL otherwise. We are to signal an err= > or > > > + ;; only if the given position was out of bounds, and that i= > s > > > + ;; dealt with above. In times past we used to return NIL fo= > r > > > + ;; errno=3D=3DESPIPE, and signal an error in other cases. > > > + ;; > > > + ;; FIXME: We are still liable to signal an error if flushin= > g > > > + ;; output fails. > > > + (return-from fd-stream-set-file-position > > > + (typep posn '(alien sb-unix:unix-offset)))))))) > > > > > > > > > ;;;; creation routines (MAKE-FD-STREAM and OPEN) > > > diff --git a/xperfecthash63.lisp-expr b/xperfecthash63.lisp-expr > > > index f5378c33e..9c758f03b 100644 > > > --- a/xperfecthash63.lisp-expr > > > +++ b/xperfecthash63.lisp-expr > > > @@ -1574,5 +1574,22 @@ > > > (#(A49305EF D0241AE7 E55E7F8C EE9A5410) > > > "(SB-PCL::%CLASS SB-PCL::%PARAMETER SB-PCL::%VARIABLE-REBINDING SPECI= > AL)" > > > "((& (>> val 8) 3))") > > > +(#(24D3B50 805A8CE D64C851 207E1321 26568C99 2870F40D 2B465CCD 2CC89B6= > A 42D8 > > > 3FFB 42E64121 46050970 49C05C00 57C2457C 5A355FA0 > > > + 665871AE 772C8C38 7B50A359 7E89C88A 81BF9BA5 8B32A898 8F463A15 9BD8= > B4B6 9 > > > D753C32 9E88666C 9EDCE097 9F1704E1 A7EE2BA1 > > > + AD4575D9 AEDCFD06 B11EF72D B256F00B D088DA49 D64A65E2 DB5C8A6A DDF4= > 78CA E > > > 6B647A0 F087745E F5306542 FA4BD0D1 FCFE2013) > > > + "(:ALLOW-OTHER-KEYS :FILE-POSITION :OUTPUT-BYTES :REPLACEMENT :CHAR-S= > IZE :E > > > XTERNAL-FORMAT :PATHNAME :TIMEOUT :HANDLER :OUTPUT-QUEUE :OBUF :EOF-FOR= > CED-P > > > :IBUF :INSTEAD :SERVE-EVENTS :LISTEN :OUTPUT-COLUMN :SYNCHRONIZE-OUTPUT= > :BUFF > > > ERING :FD-TYPE :FD :ELEMENT-MODE :ELEMENT-TYPE :ELEMENT-SIZE :DELETE-OR= > IGINAL > > > :ORIGINAL :FILE :NAME :INPUT-CHAR-POS :MISC :SOUT :BOUT :COUT :N-BIN := > BIN :I > > > N :IN-INDEX :CSIZE-BUFFER :CIN-BUFFER :IN-BUFFER)" > > > + "((let ((tab #a((32) (unsigned-byte 8) 0 49 0 51 0 0 28 0 22 0 31 51 = > 12 0 1 > > > 9 9 16 0 38 0 9 0 2 9 16 49 13 0 0 0 0 10))) > > > + (let ((b (& (>> val 7) #x1f))) > > > + (let ((a (>> (<< val 9) 27))) > > > + (^ a (aref tab b))))))") > > > +(#(13913B1 24D3B50 805A8CE D64C851 207E1321 26568C99 2870F40D 2B465CCD= > 2CC89 > > > B6A 42D83FFB 42E64121 46050970 49C05C00 57C2457C > > > + 5A355FA0 665871AE 7566B287 772C8C38 7B50A359 7E89C88A 81BF9BA5 8B32= > A898 8 > > > F463A15 9BD8B4B6 9D753C32 9E88666C 9EDCE097 > > > + 9F1704E1 A00DFCD7 A7EE2BA1 AD4575D9 AEDCFD06 B11EF72D B256F00B B71A= > FB68 D > > > 088DA49 D64A65E2 DB5C8A6A DDF478CA E57CFC3F > > > + E6B647A0 F087745E F5306542 FA4BD0D1 FCFE2013) > > > + "(:ALLOW-OTHER-KEYS :FORM-START-CHAR-POS :FORM-START-BYTE-POS :LAST-N= > EWLINE > > > :NEWLINES :OBSERVER :FILE-POSITION :OUTPUT-BYTES :REPLACEMENT :CHAR-SI= > ZE :EX > > > TERNAL-FORMAT :PATHNAME :TIMEOUT :HANDLER :OUTPUT-QUEUE :OBUF :EOF-FORC= > ED-P : > > > IBUF :INSTEAD :SERVE-EVENTS :LISTEN :OUTPUT-COLUMN :SYNCHRONIZE-OUTPUT = > :BUFFE > > > RING :FD-TYPE :FD :ELEMENT-MODE :ELEMENT-TYPE :ELEMENT-SIZE :DELETE-ORI= > GINAL > > > :ORIGINAL :FILE :NAME :INPUT-CHAR-POS :MISC :SOUT :BOUT :COUT :N-BIN :B= > IN :IN > > > :IN-INDEX :CSIZE-BUFFER :CIN-BUFFER :IN-BUFFER)" > > > + "((let ((tab #a((32) (unsigned-byte 8) 51 51 51 0 0 49 0 0 22 12 9 49= > 10 0 > > > 34 36 50 0 38 0 9 0 0 11 16 0 53 0 0 0 0 10))) > > > + (let ((b (& (>> val 7) #x1f))) > > > + (let ((a (>> (<< val 9) 27))) > > > + (^ a (aref tab b))))))") > > > ) > > > ;; EOF > > > > > > ----------------------------------------------------------------------- > > > > > > > > > hooks/post-receive > > > -- > > > SBCL > > > > > > > > > _______________________________________________ > > > Sbcl-commits mailing list > > > Sbc...@li... > > > https://lists.sourceforge.net/lists/listinfo/sbcl-commits > > > > > > _______________________________________________ > > Sbcl-devel mailing list > > Sbc...@li... > > https://lists.sourceforge.net/lists/listinfo/sbcl-devel |
From: Stas B. <sta...@gm...> - 2025-08-13 19:28:50
|
(file-position fd-stream x) clears the cached value, at the moment. On Wed, Aug 13, 2025 at 10:24 PM Richard M Kreuter via Sbcl-devel <sbc...@li...> wrote: > > Hi Stas, > > Any idea if this change might ever leave a stream's idea of its position > different from the fd's offset immediately after > > (assert (file-position fd-stream (file-position fd-stream))) > > succeeds? I can't infer the answer from the diff. > > Thanks, > Richard > > stassats via Sbcl-commits writes: > > The branch "master" has been updated in SBCL: > > via 0dcf58ce89cf14af4d08c3d78cb824056b344df0 (commit) > > from fb930c0c29af5db4c2984929386b09aba9f0bdfe (commit) > > > > - Log ----------------------------------------------------------------- > > commit 0dcf58ce89cf14af4d08c3d78cb824056b344df0 > > Author: Stas Boukarev <sta...@gm...> > > Date: Wed Aug 13 20:00:40 2025 +0300 > > > > Don't call lseek for each file-position. > > > > Call it only when a new buffer is filled. > > --- > > src/code/fd-stream.lisp | 148 ++++++++++++++++++++++++++++----------------- > > -- > > xperfecthash63.lisp-expr | 17 ++++++ > > 2 files changed, 106 insertions(+), 59 deletions(-) > > > > diff --git a/src/code/fd-stream.lisp b/src/code/fd-stream.lisp > > index 87b6c9519..962eab577 100644 > > --- a/src/code/fd-stream.lisp > > +++ b/src/code/fd-stream.lisp > > @@ -161,7 +161,13 @@ > > ;; fixed width, or function to call with a character > > (char-size 1 :type (or fixnum function)) > > (replacement nil :type (or null character string (simple-array (unsigned-b > > yte 8) 1))) > > - (output-bytes #'ill-out :type function)) > > + (output-bytes #'ill-out :type function) > > + (file-position -1 :type (or (and unsigned-byte > > + #+64-bit index) > > + ;; -1: uninitialized > > + ;; -2: don't track > > + ;; -3: can't be determined > > + (member -1 -2 -3)))) > > > > (defun fd-stream-bivalent-p (stream) > > (eq (fd-stream-element-mode stream) :bivalent)) > > @@ -311,43 +317,47 @@ > > (aver (< head tail)) > > (when (fd-stream-synchronize-output stream) > > (synchronize-stream-output stream)) > > + (when (>= (fd-stream-file-position stream) 0) > > + (setf (fd-stream-file-position stream) -1)) > > (loop > > - (let ((length (- tail head))) > > - (multiple-value-bind (count errno) > > - (sb-unix:unix-write (fd-stream-fd stream) (buffer-sap > > obuf) > > - head length) > > - (flet ((queue-or-wait () > > - (if (fd-stream-serve-events stream) > > - (return (%queue-and-replace-output-buffer > > stream)) > > - (or (wait-until-fd-usable (fd-stream-fd st > > ream) :output > > - (fd-stream-timeo > > ut stream) > > - nil) > > - (signal-timeout 'io-timeout > > - :stream stream > > - :direction :output > > - :seconds (fd-stream-ti > > meout stream)))))) > > - (cond ((eql count length) > > - ;; Complete write -- we can use the same buff > > er. > > - (return (reset-buffer obuf))) > > - (count > > - ;; Partial write -- update buffer status and > > - ;; queue or wait. > > - (incf head count) > > - (setf (buffer-head obuf) head) > > - (queue-or-wait)) > > - #-win32 > > - ((eql errno sb-unix:ewouldblock) > > - ;; Blocking, queue or wair. > > - (queue-or-wait)) > > - ;; if interrupted on win32, just try again > > - #+win32 ((eql errno sb-unix:eintr)) > > - (t > > - (simple-stream-perror +write-failed+ > > - stream errno))))))))))) > > )) > > + (let ((length (- tail head))) > > + (multiple-value-bind (count errno) > > + (sb-unix:unix-write (fd-stream-fd stream) (buffer-sap > > obuf) > > + head length) > > + (flet ((queue-or-wait () > > + (if (fd-stream-serve-events stream) > > + (return (%queue-and-replace-output-buffer s > > tream)) > > + (or (wait-until-fd-usable (fd-stream-fd str > > eam) :output > > + (fd-stream-timeou > > t stream) > > + nil) > > + (signal-timeout 'io-timeout > > + :stream stream > > + :direction :output > > + :seconds (fd-stream-tim > > eout stream)))))) > > + (cond ((eql count length) > > + ;; Complete write -- we can use the same buffer > > . > > + (return (reset-buffer obuf))) > > + (count > > + ;; Partial write -- update buffer status and > > + ;; queue or wait. > > + (incf head count) > > + (setf (buffer-head obuf) head) > > + (queue-or-wait)) > > + #-win32 > > + ((eql errno sb-unix:ewouldblock) > > + ;; Blocking, queue or wair. > > + (queue-or-wait)) > > + ;; if interrupted on win32, just try again > > + #+win32 ((eql errno sb-unix:eintr)) > > + (t > > + (simple-stream-perror +write-failed+ > > + stream errno))))))))))))) > > > > (defun finish-writing-sequence (sequence stream start end) > > (when (fd-stream-synchronize-output stream) > > (synchronize-stream-output stream)) > > + (when (>= (fd-stream-file-position stream) 0) > > + (setf (fd-stream-file-position stream) -1)) > > (loop > > (let ((length (- end start))) > > (multiple-value-bind (count errno) > > @@ -404,6 +414,8 @@ > > (aver (fd-stream-serve-events stream)) > > (when (fd-stream-synchronize-output stream) > > (synchronize-stream-output stream)) > > + (when (>= (fd-stream-file-position stream) 0) > > + (setf (fd-stream-file-position stream) -1)) > > (let (not-first-p) > > (tagbody > > :pop-buffer > > @@ -460,6 +472,8 @@ > > (let ((length (- end start))) > > (when (fd-stream-synchronize-output stream) > > (synchronize-stream-output stream)) > > + (when (>= (fd-stream-file-position stream) 0) > > + (setf (fd-stream-file-position stream) -1)) > > (multiple-value-bind (count errno) > > (sb-unix:unix-write (fd-stream-fd stream) thing start length) > > (cond ((eql count length) > > @@ -1036,6 +1050,8 @@ > > (let ((fd (fd-stream-fd stream)) > > (errno 0) > > (count 0)) > > + (when (>= (fd-stream-file-position stream) 0) > > + (setf (fd-stream-file-position stream) -1)) > > (tagbody > > #+win32 > > (go :main) > > @@ -1381,6 +1397,8 @@ > > (eq (fd-stream-fd-type stream) :regular) > > ;; TODO: handle non-empty initial buffers > > (= (buffer-head ibuf) (buffer-tail ibuf))) > > + (when (>= (fd-stream-file-position stream) 0) > > + (setf (fd-stream-file-position stream) -1)) > > (prog ((fd (fd-stream-fd stream)) > > (errno 0) > > (count 0)) > > @@ -1951,9 +1969,12 @@ > > (setf (fd-stream-ibuf fd-stream) nil) > > (release-buffer ibuf)))) > > > > - ;; FIXME: Why only for output? Why unconditionally? > > (when output-p > > - (setf (fd-stream-output-column fd-stream) 0)) > > + ;; FIXME: Why only for output? Why unconditionally? > > + (setf (fd-stream-output-column fd-stream) 0) > > + (when input-p > > + ;; Do not track > > + (setf (fd-stream-file-position fd-stream) -2))) > > > > (when input-p > > (flet ((no-input-routine () > > @@ -2321,7 +2342,14 @@ > > (defun fd-stream-get-file-position (stream) > > (declare (fd-stream stream)) > > (without-interrupts > > - (let ((posn (sb-unix:unix-lseek (fd-stream-fd stream) 0 sb-unix:l_incr)) > > ) > > + (let* ((cached (fd-stream-file-position stream)) > > + (posn (cond ((>= cached 0) > > + cached) > > + ((>= cached -2) > > + (let ((r (sb-unix:unix-lseek (fd-stream-fd stream) 0 > > sb-unix:l_incr))) > > + (unless (eq cached -2) > > + (setf (fd-stream-file-position stream) (or r -3) > > )) > > + r))))) > > (declare (type (or (alien sb-unix:unix-offset) null) posn)) > > ;; We used to return NIL for errno==ESPIPE, and signal an error > > ;; in other failure cases. However, CLHS says to return NIL if > > @@ -2353,6 +2381,8 @@ > > (check-type position-spec > > (or (alien sb-unix:unix-offset) (member nil :start :end)) > > "valid file position designator") > > + (when (>= (fd-stream-file-position stream) 0) > > + (setf (fd-stream-file-position stream) -1)) > > (tagbody > > :again > > ;; Make sure we don't have any output pending, because if we > > @@ -2373,29 +2403,29 @@ > > (flush-input-buffer stream) > > ;; Trash cached value for listen, so that we check next time. > > (setf (fd-stream-listen stream) nil) > > - ;; Now move it. > > - (multiple-value-bind (offset origin) > > - (case position-spec > > - (:start > > - (values 0 sb-unix:l_set)) > > - (:end > > - (values 0 sb-unix:l_xtnd)) > > - (t > > - (values (* position-spec (fd-stream-element-size stream)) > > - sb-unix:l_set))) > > - (declare (type (alien sb-unix:unix-offset) offset)) > > - (let ((posn (sb-unix:unix-lseek (fd-stream-fd stream) > > - offset origin))) > > - ;; CLHS says to return true if the file-position was set > > - ;; successfully, and NIL otherwise. We are to signal an error > > - ;; only if the given position was out of bounds, and that is > > - ;; dealt with above. In times past we used to return NIL for > > - ;; errno==ESPIPE, and signal an error in other cases. > > - ;; > > - ;; FIXME: We are still liable to signal an error if flushing > > - ;; output fails. > > - (return-from fd-stream-set-file-position > > - (typep posn '(alien sb-unix:unix-offset)))))))) > > + ;; Now move it. > > + (multiple-value-bind (offset origin) > > + (case position-spec > > + (:start > > + (values 0 sb-unix:l_set)) > > + (:end > > + (values 0 sb-unix:l_xtnd)) > > + (t > > + (values (* position-spec (fd-stream-element-size stream)) > > + sb-unix:l_set))) > > + (declare (type (alien sb-unix:unix-offset) offset)) > > + (let ((posn (sb-unix:unix-lseek (fd-stream-fd stream) > > + offset origin))) > > + ;; CLHS says to return true if the file-position was set > > + ;; successfully, and NIL otherwise. We are to signal an error > > + ;; only if the given position was out of bounds, and that is > > + ;; dealt with above. In times past we used to return NIL for > > + ;; errno==ESPIPE, and signal an error in other cases. > > + ;; > > + ;; FIXME: We are still liable to signal an error if flushing > > + ;; output fails. > > + (return-from fd-stream-set-file-position > > + (typep posn '(alien sb-unix:unix-offset)))))))) > > > > > > ;;;; creation routines (MAKE-FD-STREAM and OPEN) > > diff --git a/xperfecthash63.lisp-expr b/xperfecthash63.lisp-expr > > index f5378c33e..9c758f03b 100644 > > --- a/xperfecthash63.lisp-expr > > +++ b/xperfecthash63.lisp-expr > > @@ -1574,5 +1574,22 @@ > > (#(A49305EF D0241AE7 E55E7F8C EE9A5410) > > "(SB-PCL::%CLASS SB-PCL::%PARAMETER SB-PCL::%VARIABLE-REBINDING SPECIAL)" > > "((& (>> val 8) 3))") > > +(#(24D3B50 805A8CE D64C851 207E1321 26568C99 2870F40D 2B465CCD 2CC89B6A 42D8 > > 3FFB 42E64121 46050970 49C05C00 57C2457C 5A355FA0 > > + 665871AE 772C8C38 7B50A359 7E89C88A 81BF9BA5 8B32A898 8F463A15 9BD8B4B6 9 > > D753C32 9E88666C 9EDCE097 9F1704E1 A7EE2BA1 > > + AD4575D9 AEDCFD06 B11EF72D B256F00B D088DA49 D64A65E2 DB5C8A6A DDF478CA E > > 6B647A0 F087745E F5306542 FA4BD0D1 FCFE2013) > > + "(:ALLOW-OTHER-KEYS :FILE-POSITION :OUTPUT-BYTES :REPLACEMENT :CHAR-SIZE :E > > XTERNAL-FORMAT :PATHNAME :TIMEOUT :HANDLER :OUTPUT-QUEUE :OBUF :EOF-FORCED-P > > :IBUF :INSTEAD :SERVE-EVENTS :LISTEN :OUTPUT-COLUMN :SYNCHRONIZE-OUTPUT :BUFF > > ERING :FD-TYPE :FD :ELEMENT-MODE :ELEMENT-TYPE :ELEMENT-SIZE :DELETE-ORIGINAL > > :ORIGINAL :FILE :NAME :INPUT-CHAR-POS :MISC :SOUT :BOUT :COUT :N-BIN :BIN :I > > N :IN-INDEX :CSIZE-BUFFER :CIN-BUFFER :IN-BUFFER)" > > + "((let ((tab #a((32) (unsigned-byte 8) 0 49 0 51 0 0 28 0 22 0 31 51 12 0 1 > > 9 9 16 0 38 0 9 0 2 9 16 49 13 0 0 0 0 10))) > > + (let ((b (& (>> val 7) #x1f))) > > + (let ((a (>> (<< val 9) 27))) > > + (^ a (aref tab b))))))") > > +(#(13913B1 24D3B50 805A8CE D64C851 207E1321 26568C99 2870F40D 2B465CCD 2CC89 > > B6A 42D83FFB 42E64121 46050970 49C05C00 57C2457C > > + 5A355FA0 665871AE 7566B287 772C8C38 7B50A359 7E89C88A 81BF9BA5 8B32A898 8 > > F463A15 9BD8B4B6 9D753C32 9E88666C 9EDCE097 > > + 9F1704E1 A00DFCD7 A7EE2BA1 AD4575D9 AEDCFD06 B11EF72D B256F00B B71AFB68 D > > 088DA49 D64A65E2 DB5C8A6A DDF478CA E57CFC3F > > + E6B647A0 F087745E F5306542 FA4BD0D1 FCFE2013) > > + "(:ALLOW-OTHER-KEYS :FORM-START-CHAR-POS :FORM-START-BYTE-POS :LAST-NEWLINE > > :NEWLINES :OBSERVER :FILE-POSITION :OUTPUT-BYTES :REPLACEMENT :CHAR-SIZE :EX > > TERNAL-FORMAT :PATHNAME :TIMEOUT :HANDLER :OUTPUT-QUEUE :OBUF :EOF-FORCED-P : > > IBUF :INSTEAD :SERVE-EVENTS :LISTEN :OUTPUT-COLUMN :SYNCHRONIZE-OUTPUT :BUFFE > > RING :FD-TYPE :FD :ELEMENT-MODE :ELEMENT-TYPE :ELEMENT-SIZE :DELETE-ORIGINAL > > :ORIGINAL :FILE :NAME :INPUT-CHAR-POS :MISC :SOUT :BOUT :COUT :N-BIN :BIN :IN > > :IN-INDEX :CSIZE-BUFFER :CIN-BUFFER :IN-BUFFER)" > > + "((let ((tab #a((32) (unsigned-byte 8) 51 51 51 0 0 49 0 0 22 12 9 49 10 0 > > 34 36 50 0 38 0 9 0 0 11 16 0 53 0 0 0 0 10))) > > + (let ((b (& (>> val 7) #x1f))) > > + (let ((a (>> (<< val 9) 27))) > > + (^ a (aref tab b))))))") > > ) > > ;; EOF > > > > ----------------------------------------------------------------------- > > > > > > hooks/post-receive > > -- > > SBCL > > > > > > _______________________________________________ > > Sbcl-commits mailing list > > Sbc...@li... > > https://lists.sourceforge.net/lists/listinfo/sbcl-commits > > > _______________________________________________ > Sbcl-devel mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-devel |
From: Richard M K. <kr...@pr...> - 2025-08-13 19:22:21
|
Hi Stas, Any idea if this change might ever leave a stream's idea of its position different from the fd's offset immediately after (assert (file-position fd-stream (file-position fd-stream))) succeeds? I can't infer the answer from the diff. Thanks, Richard stassats via Sbcl-commits writes: > The branch "master" has been updated in SBCL: > via 0dcf58ce89cf14af4d08c3d78cb824056b344df0 (commit) > from fb930c0c29af5db4c2984929386b09aba9f0bdfe (commit) > > - Log ----------------------------------------------------------------- > commit 0dcf58ce89cf14af4d08c3d78cb824056b344df0 > Author: Stas Boukarev <sta...@gm...> > Date: Wed Aug 13 20:00:40 2025 +0300 > > Don't call lseek for each file-position. > > Call it only when a new buffer is filled. > --- > src/code/fd-stream.lisp | 148 ++++++++++++++++++++++++++++----------------- > -- > xperfecthash63.lisp-expr | 17 ++++++ > 2 files changed, 106 insertions(+), 59 deletions(-) > > diff --git a/src/code/fd-stream.lisp b/src/code/fd-stream.lisp > index 87b6c9519..962eab577 100644 > --- a/src/code/fd-stream.lisp > +++ b/src/code/fd-stream.lisp > @@ -161,7 +161,13 @@ > ;; fixed width, or function to call with a character > (char-size 1 :type (or fixnum function)) > (replacement nil :type (or null character string (simple-array (unsigned-b > yte 8) 1))) > - (output-bytes #'ill-out :type function)) > + (output-bytes #'ill-out :type function) > + (file-position -1 :type (or (and unsigned-byte > + #+64-bit index) > + ;; -1: uninitialized > + ;; -2: don't track > + ;; -3: can't be determined > + (member -1 -2 -3)))) > > (defun fd-stream-bivalent-p (stream) > (eq (fd-stream-element-mode stream) :bivalent)) > @@ -311,43 +317,47 @@ > (aver (< head tail)) > (when (fd-stream-synchronize-output stream) > (synchronize-stream-output stream)) > + (when (>= (fd-stream-file-position stream) 0) > + (setf (fd-stream-file-position stream) -1)) > (loop > - (let ((length (- tail head))) > - (multiple-value-bind (count errno) > - (sb-unix:unix-write (fd-stream-fd stream) (buffer-sap > obuf) > - head length) > - (flet ((queue-or-wait () > - (if (fd-stream-serve-events stream) > - (return (%queue-and-replace-output-buffer > stream)) > - (or (wait-until-fd-usable (fd-stream-fd st > ream) :output > - (fd-stream-timeo > ut stream) > - nil) > - (signal-timeout 'io-timeout > - :stream stream > - :direction :output > - :seconds (fd-stream-ti > meout stream)))))) > - (cond ((eql count length) > - ;; Complete write -- we can use the same buff > er. > - (return (reset-buffer obuf))) > - (count > - ;; Partial write -- update buffer status and > - ;; queue or wait. > - (incf head count) > - (setf (buffer-head obuf) head) > - (queue-or-wait)) > - #-win32 > - ((eql errno sb-unix:ewouldblock) > - ;; Blocking, queue or wair. > - (queue-or-wait)) > - ;; if interrupted on win32, just try again > - #+win32 ((eql errno sb-unix:eintr)) > - (t > - (simple-stream-perror +write-failed+ > - stream errno))))))))))) > )) > + (let ((length (- tail head))) > + (multiple-value-bind (count errno) > + (sb-unix:unix-write (fd-stream-fd stream) (buffer-sap > obuf) > + head length) > + (flet ((queue-or-wait () > + (if (fd-stream-serve-events stream) > + (return (%queue-and-replace-output-buffer s > tream)) > + (or (wait-until-fd-usable (fd-stream-fd str > eam) :output > + (fd-stream-timeou > t stream) > + nil) > + (signal-timeout 'io-timeout > + :stream stream > + :direction :output > + :seconds (fd-stream-tim > eout stream)))))) > + (cond ((eql count length) > + ;; Complete write -- we can use the same buffer > . > + (return (reset-buffer obuf))) > + (count > + ;; Partial write -- update buffer status and > + ;; queue or wait. > + (incf head count) > + (setf (buffer-head obuf) head) > + (queue-or-wait)) > + #-win32 > + ((eql errno sb-unix:ewouldblock) > + ;; Blocking, queue or wair. > + (queue-or-wait)) > + ;; if interrupted on win32, just try again > + #+win32 ((eql errno sb-unix:eintr)) > + (t > + (simple-stream-perror +write-failed+ > + stream errno))))))))))))) > > (defun finish-writing-sequence (sequence stream start end) > (when (fd-stream-synchronize-output stream) > (synchronize-stream-output stream)) > + (when (>= (fd-stream-file-position stream) 0) > + (setf (fd-stream-file-position stream) -1)) > (loop > (let ((length (- end start))) > (multiple-value-bind (count errno) > @@ -404,6 +414,8 @@ > (aver (fd-stream-serve-events stream)) > (when (fd-stream-synchronize-output stream) > (synchronize-stream-output stream)) > + (when (>= (fd-stream-file-position stream) 0) > + (setf (fd-stream-file-position stream) -1)) > (let (not-first-p) > (tagbody > :pop-buffer > @@ -460,6 +472,8 @@ > (let ((length (- end start))) > (when (fd-stream-synchronize-output stream) > (synchronize-stream-output stream)) > + (when (>= (fd-stream-file-position stream) 0) > + (setf (fd-stream-file-position stream) -1)) > (multiple-value-bind (count errno) > (sb-unix:unix-write (fd-stream-fd stream) thing start length) > (cond ((eql count length) > @@ -1036,6 +1050,8 @@ > (let ((fd (fd-stream-fd stream)) > (errno 0) > (count 0)) > + (when (>= (fd-stream-file-position stream) 0) > + (setf (fd-stream-file-position stream) -1)) > (tagbody > #+win32 > (go :main) > @@ -1381,6 +1397,8 @@ > (eq (fd-stream-fd-type stream) :regular) > ;; TODO: handle non-empty initial buffers > (= (buffer-head ibuf) (buffer-tail ibuf))) > + (when (>= (fd-stream-file-position stream) 0) > + (setf (fd-stream-file-position stream) -1)) > (prog ((fd (fd-stream-fd stream)) > (errno 0) > (count 0)) > @@ -1951,9 +1969,12 @@ > (setf (fd-stream-ibuf fd-stream) nil) > (release-buffer ibuf)))) > > - ;; FIXME: Why only for output? Why unconditionally? > (when output-p > - (setf (fd-stream-output-column fd-stream) 0)) > + ;; FIXME: Why only for output? Why unconditionally? > + (setf (fd-stream-output-column fd-stream) 0) > + (when input-p > + ;; Do not track > + (setf (fd-stream-file-position fd-stream) -2))) > > (when input-p > (flet ((no-input-routine () > @@ -2321,7 +2342,14 @@ > (defun fd-stream-get-file-position (stream) > (declare (fd-stream stream)) > (without-interrupts > - (let ((posn (sb-unix:unix-lseek (fd-stream-fd stream) 0 sb-unix:l_incr)) > ) > + (let* ((cached (fd-stream-file-position stream)) > + (posn (cond ((>= cached 0) > + cached) > + ((>= cached -2) > + (let ((r (sb-unix:unix-lseek (fd-stream-fd stream) 0 > sb-unix:l_incr))) > + (unless (eq cached -2) > + (setf (fd-stream-file-position stream) (or r -3) > )) > + r))))) > (declare (type (or (alien sb-unix:unix-offset) null) posn)) > ;; We used to return NIL for errno==ESPIPE, and signal an error > ;; in other failure cases. However, CLHS says to return NIL if > @@ -2353,6 +2381,8 @@ > (check-type position-spec > (or (alien sb-unix:unix-offset) (member nil :start :end)) > "valid file position designator") > + (when (>= (fd-stream-file-position stream) 0) > + (setf (fd-stream-file-position stream) -1)) > (tagbody > :again > ;; Make sure we don't have any output pending, because if we > @@ -2373,29 +2403,29 @@ > (flush-input-buffer stream) > ;; Trash cached value for listen, so that we check next time. > (setf (fd-stream-listen stream) nil) > - ;; Now move it. > - (multiple-value-bind (offset origin) > - (case position-spec > - (:start > - (values 0 sb-unix:l_set)) > - (:end > - (values 0 sb-unix:l_xtnd)) > - (t > - (values (* position-spec (fd-stream-element-size stream)) > - sb-unix:l_set))) > - (declare (type (alien sb-unix:unix-offset) offset)) > - (let ((posn (sb-unix:unix-lseek (fd-stream-fd stream) > - offset origin))) > - ;; CLHS says to return true if the file-position was set > - ;; successfully, and NIL otherwise. We are to signal an error > - ;; only if the given position was out of bounds, and that is > - ;; dealt with above. In times past we used to return NIL for > - ;; errno==ESPIPE, and signal an error in other cases. > - ;; > - ;; FIXME: We are still liable to signal an error if flushing > - ;; output fails. > - (return-from fd-stream-set-file-position > - (typep posn '(alien sb-unix:unix-offset)))))))) > + ;; Now move it. > + (multiple-value-bind (offset origin) > + (case position-spec > + (:start > + (values 0 sb-unix:l_set)) > + (:end > + (values 0 sb-unix:l_xtnd)) > + (t > + (values (* position-spec (fd-stream-element-size stream)) > + sb-unix:l_set))) > + (declare (type (alien sb-unix:unix-offset) offset)) > + (let ((posn (sb-unix:unix-lseek (fd-stream-fd stream) > + offset origin))) > + ;; CLHS says to return true if the file-position was set > + ;; successfully, and NIL otherwise. We are to signal an error > + ;; only if the given position was out of bounds, and that is > + ;; dealt with above. In times past we used to return NIL for > + ;; errno==ESPIPE, and signal an error in other cases. > + ;; > + ;; FIXME: We are still liable to signal an error if flushing > + ;; output fails. > + (return-from fd-stream-set-file-position > + (typep posn '(alien sb-unix:unix-offset)))))))) > > > ;;;; creation routines (MAKE-FD-STREAM and OPEN) > diff --git a/xperfecthash63.lisp-expr b/xperfecthash63.lisp-expr > index f5378c33e..9c758f03b 100644 > --- a/xperfecthash63.lisp-expr > +++ b/xperfecthash63.lisp-expr > @@ -1574,5 +1574,22 @@ > (#(A49305EF D0241AE7 E55E7F8C EE9A5410) > "(SB-PCL::%CLASS SB-PCL::%PARAMETER SB-PCL::%VARIABLE-REBINDING SPECIAL)" > "((& (>> val 8) 3))") > +(#(24D3B50 805A8CE D64C851 207E1321 26568C99 2870F40D 2B465CCD 2CC89B6A 42D8 > 3FFB 42E64121 46050970 49C05C00 57C2457C 5A355FA0 > + 665871AE 772C8C38 7B50A359 7E89C88A 81BF9BA5 8B32A898 8F463A15 9BD8B4B6 9 > D753C32 9E88666C 9EDCE097 9F1704E1 A7EE2BA1 > + AD4575D9 AEDCFD06 B11EF72D B256F00B D088DA49 D64A65E2 DB5C8A6A DDF478CA E > 6B647A0 F087745E F5306542 FA4BD0D1 FCFE2013) > + "(:ALLOW-OTHER-KEYS :FILE-POSITION :OUTPUT-BYTES :REPLACEMENT :CHAR-SIZE :E > XTERNAL-FORMAT :PATHNAME :TIMEOUT :HANDLER :OUTPUT-QUEUE :OBUF :EOF-FORCED-P > :IBUF :INSTEAD :SERVE-EVENTS :LISTEN :OUTPUT-COLUMN :SYNCHRONIZE-OUTPUT :BUFF > ERING :FD-TYPE :FD :ELEMENT-MODE :ELEMENT-TYPE :ELEMENT-SIZE :DELETE-ORIGINAL > :ORIGINAL :FILE :NAME :INPUT-CHAR-POS :MISC :SOUT :BOUT :COUT :N-BIN :BIN :I > N :IN-INDEX :CSIZE-BUFFER :CIN-BUFFER :IN-BUFFER)" > + "((let ((tab #a((32) (unsigned-byte 8) 0 49 0 51 0 0 28 0 22 0 31 51 12 0 1 > 9 9 16 0 38 0 9 0 2 9 16 49 13 0 0 0 0 10))) > + (let ((b (& (>> val 7) #x1f))) > + (let ((a (>> (<< val 9) 27))) > + (^ a (aref tab b))))))") > +(#(13913B1 24D3B50 805A8CE D64C851 207E1321 26568C99 2870F40D 2B465CCD 2CC89 > B6A 42D83FFB 42E64121 46050970 49C05C00 57C2457C > + 5A355FA0 665871AE 7566B287 772C8C38 7B50A359 7E89C88A 81BF9BA5 8B32A898 8 > F463A15 9BD8B4B6 9D753C32 9E88666C 9EDCE097 > + 9F1704E1 A00DFCD7 A7EE2BA1 AD4575D9 AEDCFD06 B11EF72D B256F00B B71AFB68 D > 088DA49 D64A65E2 DB5C8A6A DDF478CA E57CFC3F > + E6B647A0 F087745E F5306542 FA4BD0D1 FCFE2013) > + "(:ALLOW-OTHER-KEYS :FORM-START-CHAR-POS :FORM-START-BYTE-POS :LAST-NEWLINE > :NEWLINES :OBSERVER :FILE-POSITION :OUTPUT-BYTES :REPLACEMENT :CHAR-SIZE :EX > TERNAL-FORMAT :PATHNAME :TIMEOUT :HANDLER :OUTPUT-QUEUE :OBUF :EOF-FORCED-P : > IBUF :INSTEAD :SERVE-EVENTS :LISTEN :OUTPUT-COLUMN :SYNCHRONIZE-OUTPUT :BUFFE > RING :FD-TYPE :FD :ELEMENT-MODE :ELEMENT-TYPE :ELEMENT-SIZE :DELETE-ORIGINAL > :ORIGINAL :FILE :NAME :INPUT-CHAR-POS :MISC :SOUT :BOUT :COUT :N-BIN :BIN :IN > :IN-INDEX :CSIZE-BUFFER :CIN-BUFFER :IN-BUFFER)" > + "((let ((tab #a((32) (unsigned-byte 8) 51 51 51 0 0 49 0 0 22 12 9 49 10 0 > 34 36 50 0 38 0 9 0 0 11 16 0 53 0 0 0 0 10))) > + (let ((b (& (>> val 7) #x1f))) > + (let ((a (>> (<< val 9) 27))) > + (^ a (aref tab b))))))") > ) > ;; EOF > > ----------------------------------------------------------------------- > > > hooks/post-receive > -- > SBCL > > > _______________________________________________ > Sbcl-commits mailing list > Sbc...@li... > https://lists.sourceforge.net/lists/listinfo/sbcl-commits |