Discussion:
[Sbcl-devel] [Sbcl-commits] master: Simplify %SET-FILL-POINTER transform
Stas Boukarev
2017-07-17 12:31:14 UTC
Permalink
Also, always transforming makes it quite larger, 89 bytes vs 30 for a full call.
And there is really no way to restrict that, due to the known declaration.
And the error changes from
#(A B C) is not an array with a fill pointer.

to

The value
#(A B C)
is not of type
(AND VECTOR (NOT SIMPLE-ARRAY))


On Mon, Jul 17, 2017 at 3:19 PM, Douglas Katzman via Sbcl-commits
via 5a31f05ed1ab75c3bc8ca9c0559ec76d409982c4 (commit)
from 4fc6d2eb98d551727c7a361fde6e0a5ecd08584f (commit)
- Log -----------------------------------------------------------------
commit 5a31f05ed1ab75c3bc8ca9c0559ec76d409982c4
Date: Mon Jul 17 08:19:14 2017 -0400
Simplify %SET-FILL-POINTER transform
---
src/compiler/array-tran.lisp | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/compiler/array-tran.lisp b/src/compiler/array-tran.lisp
index 7a9185e..4052216 100644
--- a/src/compiler/array-tran.lisp
+++ b/src/compiler/array-tran.lisp
@@ -1296,12 +1296,8 @@
"The array type is ambiguous; must call ~
ARRAY-HAS-FILL-POINTER-P at runtime.")))))))
-(deftransform %set-fill-pointer ((vector fill-pointer) (vector (eql 0)))
- (or (let ((type (lvar-type vector)))
- (when (and (= (length (array-type-dimensions-or-give-up type)) 1)
- (eq (conservative-array-type-complexp type) t))
- `(setf (%array-fill-pointer vector) 0)))
- (give-up-ir1-transform)))
+(deftransform %set-fill-pointer ((vector fill-pointer) (complex-vector (eql 0)))
+ `(setf (%array-fill-pointer vector) 0))
(deftransform check-bound ((array dimension index) * * :node node)
;; This is simply to avoid multiple evaluation of INDEX by the
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sbcl-commits mailing list
https://lists.sourceforge.net/lists/listinfo/sbcl-commits
--
With best regards, Stas.
Stas Boukarev
2017-07-17 14:31:38 UTC
Permalink
Right. It could be more useful to transform %set-fill-pointer on an
independently derived complex vector to
%complex-vector-set-fill-pointer, but I guess it would have to be at
some other stage, not in a transform.
and it's not even technically right, I need to add add one bit in the array
header to make it so.
Users can declare adjustable vectors with :fill-pointer nil and I think
we're "supposed" to disallow setting the fill-pointer, despite that all our
non-simple vectors are at the implementation level acceptable to
%set-fill-pointer.
Depending on how much simpler or hairy this makes things I might just revert
it.
Post by Stas Boukarev
Also, always transforming makes it quite larger, 89 bytes vs 30 for a full call.
And there is really no way to restrict that, due to the known declaration.
And the error changes from
#(A B C) is not an array with a fill pointer.
to
The value
#(A B C)
is not of type
(AND VECTOR (NOT SIMPLE-ARRAY))
On Mon, Jul 17, 2017 at 3:19 PM, Douglas Katzman via Sbcl-commits
via 5a31f05ed1ab75c3bc8ca9c0559ec76d409982c4 (commit)
from 4fc6d2eb98d551727c7a361fde6e0a5ecd08584f (commit)
- Log -----------------------------------------------------------------
commit 5a31f05ed1ab75c3bc8ca9c0559ec76d409982c4
Date: Mon Jul 17 08:19:14 2017 -0400
Simplify %SET-FILL-POINTER transform
---
src/compiler/array-tran.lisp | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/src/compiler/array-tran.lisp b/src/compiler/array-tran.lisp
index 7a9185e..4052216 100644
--- a/src/compiler/array-tran.lisp
+++ b/src/compiler/array-tran.lisp
@@ -1296,12 +1296,8 @@
"The array type is ambiguous; must call ~
ARRAY-HAS-FILL-POINTER-P at runtime.")))))))
-(deftransform %set-fill-pointer ((vector fill-pointer) (vector (eql 0)))
- (or (let ((type (lvar-type vector)))
- (when (and (= (length (array-type-dimensions-or-give-up type)) 1)
- (eq (conservative-array-type-complexp type) t))
- `(setf (%array-fill-pointer vector) 0)))
- (give-up-ir1-transform)))
+(deftransform %set-fill-pointer ((vector fill-pointer) (complex-vector (eql 0)))
+ `(setf (%array-fill-pointer vector) 0))
(deftransform check-bound ((array dimension index) * * :node node)
;; This is simply to avoid multiple evaluation of INDEX by the
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Sbcl-commits mailing list
https://lists.sourceforge.net/lists/listinfo/sbcl-commits
--
With best regards, Stas.
--
With best regards, Stas.
Loading...