[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, master, updated. release_1-9-7-11-ge03
From: |
Ludovic Courtès |
Subject: |
[Guile-commits] GNU Guile branch, master, updated. release_1-9-7-11-ge03b7f7 |
Date: |
Mon, 25 Jan 2010 23:09:03 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=e03b7f73e2927178f2d9485320435edb6260c311
The branch, master has been updated
via e03b7f73e2927178f2d9485320435edb6260c311 (commit)
via bb190ddbba216251f2a8490adf9feadf0dbb7104 (commit)
via 227eff6a77dd58d64775fe91ae0f1596bfe3371b (commit)
from d31b95195168ded0d3300159403adb2c4917e291 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit e03b7f73e2927178f2d9485320435edb6260c311
Author: Ludovic Courtès <address@hidden>
Date: Tue Jan 26 00:00:58 2010 +0100
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.
commit bb190ddbba216251f2a8490adf9feadf0dbb7104
Author: Ludovic Courtès <address@hidden>
Date: Mon Jan 25 23:43:41 2010 +0100
Add ASCII art representing the basic struct layout.
* libguile/struct.h: Add ASCII art version of the basic struct layout as
shown in Andy's diagrams.
commit 227eff6a77dd58d64775fe91ae0f1596bfe3371b
Author: Ludovic Courtès <address@hidden>
Date: Mon Jan 25 23:41:27 2010 +0100
Reinstate 2-word displacement for structs.
* libguile/struct.c (scm_init_struct): Reinstate 2-word displacement
removed by 01e74380f6170b5cb1105e5df9a368ab257420ef.
-----------------------------------------------------------------------
Summary of changes:
libguile/struct.c | 22 ++++++++++------------
libguile/struct.h | 32 ++++++++++++++++++++++++++++++--
2 files changed, 40 insertions(+), 14 deletions(-)
diff --git a/libguile/struct.c b/libguile/struct.c
index 6340a70..c28a76d 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
{
@@ -997,6 +990,11 @@ scm_init_struct ()
default. */
GC_REGISTER_DISPLACEMENT (2 * sizeof (scm_t_bits) + scm_tc3_struct);
+ /* In the general case, `SCM_STRUCT_DATA (obj)' points 2 words after the
+ beginning of a GC-allocated region; that region is different from that of
+ OBJ once OBJ has undergone class redefinition. */
+ GC_REGISTER_DISPLACEMENT (2 * sizeof (scm_t_bits));
+
scm_struct_table = scm_make_weak_key_hash_table (scm_from_int (31));
required_vtable_fields = scm_from_locale_string (SCM_VTABLE_BASE_LAYOUT);
required_applicable_fields = scm_from_locale_string
(SCM_APPLICABLE_BASE_LAYOUT);
diff --git a/libguile/struct.h b/libguile/struct.h
index 012d9b6..d2a05af 100644
--- a/libguile/struct.h
+++ b/libguile/struct.h
@@ -33,9 +33,37 @@
in turn means we need support for changing the "class" (vtable) of an
"instance" (struct). This necessitates some indirection and trickery.
- I would like to write this all up here, but for now:
+ To summarize, structs are laid out this way:
+
+ .-------.
+ | |
+ .----------------+---v------------- -
+ | vtable | data | slot0 | slot1 |
+ `----------------+----------------- -
+ | .-------.
+ | | |
+ .---v------------+---v------------- -
+ | vtable | data | slot0 | slot1 |
+ `----------------+----------------- -
+ |
+ v
+
+ ...
+ .-------.
+ | | |
+ .---v------------+---v------------- -
+ .-| vtable | data | slot0 | slot1 |
+ | `----------------+----------------- -
+ | ^
+ `-----'
+
+ The DATA indirection (which corresponds to `SCM_STRUCT_DATA ()') is
necessary
+ to implement class redefinition.
+
+ For more details, see:
http://wingolog.org/archives/2009/11/09/class-redefinition-in-guile
+
*/
/* All vtables have the following fields. */
@@ -79,7 +107,7 @@
#define SCM_VTABLE_FLAG_APPLICABLE (1L << 2) /* instances of this vtable are
applicable? */
#define SCM_VTABLE_FLAG_SETTER_VTABLE (1L << 3) /* instances of this vtable
are applicable-with-setter vtables? */
#define SCM_VTABLE_FLAG_SETTER (1L << 4) /* instances of this vtable are
applicable-with-setters? */
-#define SCM_VTABLE_FLAG_SIMPLE (1L << 5) /* instances of this vtable have only
"pr" fields */
+#define SCM_VTABLE_FLAG_SIMPLE (1L << 5) /* instances of this vtable have only
"p" fields */
#define SCM_VTABLE_FLAG_SIMPLE_RW (1L << 6) /* instances of this vtable have
only "pw" fields */
#define SCM_VTABLE_FLAG_SMOB_0 (1L << 7)
#define SCM_VTABLE_FLAG_GOOPS_0 (1L << 8)
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, master, updated. release_1-9-7-11-ge03b7f7,
Ludovic Courtès <=