|
[Sbcl-commits] master: alien type improvement: handle offsets in
unparse-alien-record-type
From: Cyrus Harmon <slyrus@us...> - 2012-11-04 17:48
|
The branch "master" has been updated in SBCL:
via c78d726af276ff97f8ec85eb42aa72cb31766284 (commit)
from 2f9585060d5fe2c525955d80f34123761ded80fe (commit)
- Log -----------------------------------------------------------------
commit c78d726af276ff97f8ec85eb42aa72cb31766284
Author: Cyrus Harmon <ch-github@...>
Date: Sun Oct 14 23:12:58 2012 -0700
alien type improvement: handle offsets in unparse-alien-record-type
Previously, when recomputing the offset to struct fields we would
ignore the offset and attempt to recompute it, occasionally getting it
wrong. Now store the offset in uparse-alien-record-field and use in
parse-alien-record-fields.
Also, fix some comment typos.
---
src/code/host-alieneval.lisp | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/src/code/host-alieneval.lisp b/src/code/host-alieneval.lisp
index 1f554c6..eb883db 100644
--- a/src/code/host-alieneval.lisp
+++ b/src/code/host-alieneval.lisp
@@ -1003,7 +1003,7 @@
;;; FIXME: This is really pretty horrible: we avoid creating new
;;; ALIEN-RECORD-TYPE objects when a live one is flitting around the
-;;; system already. This way forwrd-references sans fields get get
+;;; system already. This way forward-references sans fields get
;;; "updated" for free to contain the field info. Maybe rename
;;; MAKE-ALIEN-RECORD-TYPE to %MAKE-ALIEN-RECORD-TYPE and use
;;; ENSURE-ALIEN-RECORD-TYPE instead. --NS 20040729
@@ -1052,7 +1052,8 @@
(overall-alignment 1)
(parsed-fields nil))
(dolist (field fields)
- (destructuring-bind (var type &key alignment) field
+ (destructuring-bind (var type &key alignment bits offset) field
+ (declare (ignore bits))
(let* ((field-type (parse-alien-type type env))
(bits (alien-type-bits field-type))
(parsed-field
@@ -1068,7 +1069,7 @@
(setf overall-alignment (max overall-alignment alignment))
(ecase kind
(:struct
- (let ((offset (align-offset total-bits alignment)))
+ (let ((offset (or offset (align-offset total-bits alignment))))
(setf (alien-record-field-offset parsed-field) offset)
(setf total-bits (+ offset bits))))
(:union
@@ -1095,7 +1096,9 @@
`(,(alien-record-field-name field)
,(%unparse-alien-type (alien-record-field-type field))
,@(when (alien-record-field-bits field)
- (list (alien-record-field-bits field)))))
+ (list :bits (alien-record-field-bits field)))
+ ,@(when (alien-record-field-offset field)
+ (list :offset (alien-record-field-offset field)))))
;;; Test the record fields. Keep a hashtable table of already compared
;;; types to detect cycles.
-----------------------------------------------------------------------
hooks/post-receive
--
SBCL
|
| Thread | Author | Date |
|---|---|---|
| [Sbcl-commits] master: alien type improvement: handle offsets in unparse-alien-record-type | Cyrus Harmon <slyrus@us...> |