diff options
author | Ludovic Courtès <ludo@gnu.org> | 2010-01-26 00:00:58 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2010-01-26 00:00:58 +0100 |
commit | e03b7f73e2927178f2d9485320435edb6260c311 (patch) | |
tree | 1de60bf13065a5ef6bc7bf58a1e48a492c5468ff /libguile/struct.c | |
parent | bb190ddbba216251f2a8490adf9feadf0dbb7104 (diff) | |
download | guile-e03b7f73e2927178f2d9485320435edb6260c311.tar.gz |
Recognize structs with both "pr" and "pw" flags as simple.
* libguile/struct.c (set_vtable_layout_flags): Keep the
`SCM_VTABLE_FLAG_SIMPLE' flag when VTABLE has a mixture of `r' and `w'
fields.
* libguile/struct.h (SCM_VTABLE_FLAG_SIMPLE): Adjust comment.
Diffstat (limited to 'libguile/struct.c')
-rw-r--r-- | libguile/struct.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/libguile/struct.c b/libguile/struct.c index 4a9455517..c28a76d48 100644 --- a/libguile/struct.c +++ b/libguile/struct.c @@ -180,18 +180,13 @@ set_vtable_layout_flags (SCM vtable) { case 'w': case 'W': - if (!(flags & SCM_VTABLE_FLAG_SIMPLE_RW) && field > 0) - /* There's a mixture of `w' and `r' flags. */ - flags = 0; - else + if (field == 0) flags |= SCM_VTABLE_FLAG_SIMPLE_RW; break; case 'r': case 'R': - if (flags & SCM_VTABLE_FLAG_SIMPLE_RW) - /* There's a mixture of `w' and `r' flags. */ - flags = 0; + flags &= ~SCM_VTABLE_FLAG_SIMPLE_RW; break; default: @@ -711,10 +706,8 @@ SCM_DEFINE (scm_struct_ref, "struct-ref", 2, 0, 0, if (SCM_LIKELY (SCM_VTABLE_FLAG_IS_SET (vtable, SCM_VTABLE_FLAG_SIMPLE) && p < SCM_STRUCT_DATA_REF (vtable, scm_vtable_index_size))) - { - /* The fast path: HANDLE is a struct with only "p" fields. */ - answer = SCM_PACK (data[p]); - } + /* The fast path: HANDLE is a struct with only "p" fields. */ + answer = SCM_PACK (data[p]); else { SCM layout; @@ -801,7 +794,7 @@ SCM_DEFINE (scm_struct_set_x, "struct-set!", 3, 0, 0, if (SCM_LIKELY (SCM_VTABLE_FLAG_IS_SET (vtable, SCM_VTABLE_FLAG_SIMPLE) && SCM_VTABLE_FLAG_IS_SET (vtable, SCM_VTABLE_FLAG_SIMPLE_RW) && p < SCM_STRUCT_DATA_REF (vtable, scm_vtable_index_size))) - /* The fast path: HANDLE is a struct with only "p" fields. */ + /* The fast path: HANDLE is a struct with only "pw" fields. */ data[p] = SCM_UNPACK (val); else { |