[racket-dev] [plt] Push #21564: master branch updated

From: Jay McCarthy (jay.mccarthy at gmail.com)
Date: Thu Nov 25 12:20:35 EST 2010

When I re-generate src/mzmark.c on my machine, I get the following
error when compiling:

ECT -m32 -pthread  -fno-common  -DNEWGC_BTC_ACCOUNT    -Wall  -c
xsrc/type.c -o type.o
../../../racket/gc2/../src/mzmark.c: In function ‘cpointer_obj_SIZE’:
../../../racket/gc2/../src/mzmark.c:155: error: expected expression before ‘if’
../../../racket/gc2/../src/mzmark.c:157: error: expected expression
before ‘else’
../../../racket/gc2/../src/mzmark.c: In function ‘cpointer_obj_MARK’:
../../../racket/gc2/../src/mzmark.c:167: error: expected expression before ‘if’
../../../racket/gc2/../src/mzmark.c:169: error: expected expression
before ‘else’
../../../racket/gc2/../src/mzmark.c: In function ‘cpointer_obj_FIXUP’:
../../../racket/gc2/../src/mzmark.c:179: error: expected expression before ‘if’
../../../racket/gc2/../src/mzmark.c:181: error: expected expression
before ‘else’

I did this because I wanted to get rid of the other error messages
with by adding an UNUSED attribute, but while testing _that patch_ I
found _this problem_.

Jay

On Wed, Nov 24, 2010 at 4:25 PM,  <mflatt at racket-lang.org> wrote:
> mflatt has updated `master' from 370c97165a to 470ed7c996.
>  http://git.racket-lang.org/plt/370c97165a..470ed7c996
>
> =====[ 2 Commits ]======================================================
>
> Directory summary:
>   6.1% collects/scribblings/foreign/
>   3.0% src/foreign/
>   6.3% src/racket/include/
>  81.4% src/racket/src/
>
> ~~~~~~~~~~
>
> bd28f2a Matthew Flatt <mflatt at racket-lang.org> 2010-11-24 13:41
> :
> | make `equal?' equate C pointers that refer to the same address
> :
>  M collects/scribblings/foreign/pointers.scrbl |    6 ++-
>  M collects/scribblings/foreign/types.scrbl    |    6 ++-
>  M doc/release-notes/racket/HISTORY.txt        |    1 +
>  M src/foreign/foreign.c                       |    2 +-
>  M src/foreign/foreign.rktc                    |    2 +-
>  M src/racket/include/scheme.h                 |    7 ++-
>  M src/racket/src/bool.c                       |    3 +
>  M src/racket/src/cstartup.inc                 |   68 ++++++++++++------------
>  M src/racket/src/hash.c                       |   10 ++++
>  M src/racket/src/mzmarksrc.c                  |   15 ++----
>  M src/racket/src/salloc.c                     |    7 ++-
>  M src/racket/src/stypes.h                     |    3 +-
>  M src/racket/src/type.c                       |    2 -
>
> ~~~~~~~~~~
>
> 470ed7c Matthew Flatt <mflatt at racket-lang.org> 2010-11-24 14:25
> :
> | fix get-face-list bug (caused Windows 7 crash on my test)
> :
>  M collects/racket/draw/unsafe/pango.rkt |    2 +-
>
> =====[ Overall Diff ]===================================================
>
> collects/racket/draw/unsafe/pango.rkt
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/collects/racket/draw/unsafe/pango.rkt
> +++ NEW/collects/racket/draw/unsafe/pango.rkt
> @@ -230,7 +230,7 @@
>                                                  -> (begin0
>                                                       (for/list ([i (in-range len)])
>                                                         (ptr-ref fams PangoFontFamily i))
> -                                                      (free fams))))
> +                                                      (g_free fams))))
>
>  (define-pango pango_font_description_free (_fun PangoFontDescription -> _void)
>   #:wrap (deallocator))
>
> collects/scribblings/foreign/pointers.scrbl
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/collects/scribblings/foreign/pointers.scrbl
> +++ NEW/collects/scribblings/foreign/pointers.scrbl
> @@ -14,7 +14,11 @@ Returns @scheme[#f] for other values.}
>  @defproc[(ptr-equal? [cptr1 cpointer?] [cptr2 cpointer?]) boolean?]{
>
>  Compares the values of the two pointers. Two different Racket
> -pointer objects can contain the same pointer.}
> +pointer objects can contain the same pointer.
> +
> +If the values are both C pointers---as opposed to @racket[#f], a byte
> +string, @scheme[ffi-obj], or callback---this comparison is the same as
> + at racket[equal?].}
>
>
>  @defproc[(ptr-add [cptr cpointer?] [offset exact-integer?] [type ctype? _byte])
>
> collects/scribblings/foreign/types.scrbl
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/collects/scribblings/foreign/types.scrbl
> +++ NEW/collects/scribblings/foreign/types.scrbl
> @@ -284,7 +284,11 @@ The address referenced by a @scheme[_pointer] value must not refer to
>  memory managed by the garbage collector (unless the address
>  corresponds to a value that supports interior pointers and that is
>  otherwise referenced to preserve the value from garbage collection).
> -The reference is not traced or updated by the garbage collector.}
> +The reference is not traced or updated by the garbage collector.
> +
> +The @racket[equal?] predicate equates C pointers (including pointers
> +for @racket[_gcpointer] and possibly containing an offset) when they
> +refer to the same address.}
>
>
>  @defthing[_gcpointer ctype?]{
>
> doc/release-notes/racket/HISTORY.txt
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/doc/release-notes/racket/HISTORY.txt
> +++ NEW/doc/release-notes/racket/HISTORY.txt
> @@ -1,5 +1,6 @@
>  5.0.99.2
>  proxy => impersonator
> +equal? equates C pointers when they refer to the same address
>
>  5.0.99.1
>  Internal: weak boxes are cleared before non-will-like
>
> src/foreign/foreign.c
> ~~~~~~~~~~~~~~~~~~~~~
> --- OLD/src/foreign/foreign.c
> +++ NEW/src/foreign/foreign.c
> @@ -1212,7 +1212,7 @@ END_XFORM_SKIP;
>   W_OFFSET(SCHEME_FFIANYPTR_VAL(x), SCHEME_FFIANYPTR_OFFSET(x))
>
>  #define SCHEME_CPOINTER_W_OFFSET_P(x) \
> -  SAME_TYPE(SCHEME_TYPE(x), scheme_offset_cpointer_type)
> +  (SCHEME_CPTRP(x) && SCHEME_CPTR_HAS_OFFSET(x))
>
>  #define scheme_make_foreign_cpointer(x) \
>   ((x==NULL)?scheme_false:scheme_make_cptr(x,NULL))
>
> src/foreign/foreign.rktc
> ~~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/src/foreign/foreign.rktc
> +++ NEW/src/foreign/foreign.rktc
> @@ -1008,7 +1008,7 @@ ffi_abi sym_to_abi(char *who, Scheme_Object *sym)
>   W_OFFSET(SCHEME_FFIANYPTR_VAL(x), SCHEME_FFIANYPTR_OFFSET(x))
>
>  #define SCHEME_CPOINTER_W_OFFSET_P(x) \
> -  SAME_TYPE(SCHEME_TYPE(x), scheme_offset_cpointer_type)
> +  (SCHEME_CPTRP(x) && SCHEME_CPTR_HAS_OFFSET(x))
>
>  #define scheme_make_foreign_cpointer(x) \
>   ((x==NULL)?scheme_false:scheme_make_cptr(x,NULL))
>
> src/racket/include/scheme.h
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/src/racket/include/scheme.h
> +++ NEW/src/racket/include/scheme.h
> @@ -461,7 +461,7 @@ typedef long (*Scheme_Secondary_Hash_Proc)(Scheme_Object *obj, void *cycle_data)
>  #define SCHEME_UDPP(obj) SAME_TYPE(SCHEME_TYPE(obj), scheme_udp_type)
>  #define SCHEME_UDP_EVTP(obj) SAME_TYPE(SCHEME_TYPE(obj), scheme_udp_evt_type)
>
> -#define SCHEME_CPTRP(obj) (SAME_TYPE(SCHEME_TYPE(obj), scheme_cpointer_type) || SAME_TYPE(SCHEME_TYPE(obj), scheme_offset_cpointer_type))
> +#define SCHEME_CPTRP(obj) (SAME_TYPE(SCHEME_TYPE(obj), scheme_cpointer_type))
>
>  #define SCHEME_MUTABLEP(obj) (!(MZ_OPT_HASH_KEY((Scheme_Inclhash_Object *)(obj)) & 0x1))
>  #define SCHEME_IMMUTABLEP(obj) (MZ_OPT_HASH_KEY((Scheme_Inclhash_Object *)(obj)) & 0x1)
> @@ -562,7 +562,7 @@ typedef long (*Scheme_Secondary_Hash_Proc)(Scheme_Object *obj, void *cycle_data)
>
>  typedef struct Scheme_Cptr
>  {
> -  Scheme_Inclhash_Object so; /* 0x1 => an external pointer (not GCable) */
> +  Scheme_Inclhash_Object so; /* 0x1 => an external pointer (not GCable); 0x2 => has offset */
>   void *val;
>   Scheme_Object *type;
>  } Scheme_Cptr;
> @@ -574,8 +574,9 @@ typedef struct Scheme_Offset_Cptr
>
>  #define SCHEME_CPTR_VAL(obj) (((Scheme_Cptr *)(obj))->val)
>  #define SCHEME_CPTR_TYPE(obj) (((Scheme_Cptr *)(obj))->type)
> -#define SCHEME_CPTR_OFFSET(obj) (SAME_TYPE(_SCHEME_TYPE(obj), scheme_offset_cpointer_type) ? ((Scheme_Offset_Cptr *)obj)->offset : 0)
> +#define SCHEME_CPTR_OFFSET(obj) (SCHEME_CPTR_HAS_OFFSET(obj) ? ((Scheme_Offset_Cptr *)obj)->offset : 0)
>  #define SCHEME_CPTR_FLAGS(obj) MZ_OPT_HASH_KEY(&((Scheme_Cptr *)(obj))->so)
> +#define SCHEME_CPTR_HAS_OFFSET(obj) (SCHEME_CPTR_FLAGS(obj) & 0x2)
>
>  #define SCHEME_SET_IMMUTABLE(obj)  ((MZ_OPT_HASH_KEY((Scheme_Inclhash_Object *)(obj)) |= 0x1))
>  #define SCHEME_SET_CHAR_STRING_IMMUTABLE(obj) SCHEME_SET_IMMUTABLE(obj)
>
> src/racket/src/bool.c
> ~~~~~~~~~~~~~~~~~~~~~
> --- OLD/src/racket/src/bool.c
> +++ NEW/src/racket/src/bool.c
> @@ -588,6 +588,9 @@ int is_equal (Scheme_Object *obj1, Scheme_Object *obj2, Equal_Info *eql)
>     if (union_check(obj1, obj2, eql))
>       return 1;
>     return scheme_bucket_table_equal_rec((Scheme_Bucket_Table *)obj1, (Scheme_Bucket_Table *)obj2, eql);
> +  } else if (SCHEME_CPTRP(obj1)) {
> +    return (((char *)SCHEME_CPTR_VAL(obj1) + SCHEME_CPTR_OFFSET(obj1))
> +            == ((char *)SCHEME_CPTR_VAL(obj2) + SCHEME_CPTR_OFFSET(obj2)));
>   } else if (SAME_TYPE(SCHEME_TYPE(obj1), scheme_wrap_chunk_type)) {
>     return vector_equal(obj1, obj2, eql);
>   } else if (SAME_TYPE(SCHEME_TYPE(obj1), scheme_resolved_module_path_type)) {
>
> src/racket/src/cstartup.inc
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/src/racket/src/cstartup.inc
> +++ NEW/src/racket/src/cstartup.inc
> @@ -1,44 +1,44 @@
>   {
>     SHARED_OK static MZCOMPILED_STRING_FAR unsigned char expr[] = {35,126,8,53,46,48,46,57,57,46,50,51,0,0,0,1,0,0,10,0,13,
> -0,22,0,35,0,40,0,44,0,49,0,54,0,58,0,65,0,68,0,75,0,
> +0,22,0,35,0,39,0,43,0,46,0,53,0,58,0,63,0,70,0,75,0,
>  82,0,88,0,102,0,116,0,119,0,125,0,129,0,131,0,142,0,144,0,158,
>  0,165,0,187,0,189,0,203,0,14,1,43,1,54,1,65,1,75,1,111,1,
>  144,1,177,1,236,1,46,2,124,2,190,2,195,2,215,2,106,3,126,3,177,
>  3,243,3,128,4,14,5,66,5,89,5,168,5,0,0,109,7,0,0,69,35,
>  37,109,105,110,45,115,116,120,29,11,11,68,104,101,114,101,45,115,116,120,72,
> -112,97,114,97,109,101,116,101,114,105,122,101,64,108,101,116,42,63,108,101,116,
> -64,119,104,101,110,64,99,111,110,100,63,97,110,100,66,108,101,116,114,101,99,
> -62,111,114,66,100,101,102,105,110,101,66,117,110,108,101,115,115,65,113,117,111,
> +112,97,114,97,109,101,116,101,114,105,122,101,63,108,101,116,63,97,110,100,62,
> +111,114,66,100,101,102,105,110,101,64,119,104,101,110,64,99,111,110,100,66,108,
> +101,116,114,101,99,64,108,101,116,42,66,117,110,108,101,115,115,65,113,117,111,
>  116,101,29,94,2,14,68,35,37,107,101,114,110,101,108,11,29,94,2,14,68,
>  35,37,112,97,114,97,109,122,11,62,105,102,65,98,101,103,105,110,63,115,116,
>  120,61,115,70,108,101,116,45,118,97,108,117,101,115,61,120,73,108,101,116,114,
>  101,99,45,118,97,108,117,101,115,66,108,97,109,98,100,97,1,20,112,97,114,
>  97,109,101,116,101,114,105,122,97,116,105,111,110,45,107,101,121,61,118,73,100,
> -101,102,105,110,101,45,118,97,108,117,101,115,97,36,11,8,240,88,83,0,0,
> -95,159,2,16,36,36,159,2,15,36,36,159,2,15,36,36,16,20,2,11,2,
> -2,2,5,2,2,2,6,2,2,2,7,2,2,2,4,2,2,2,8,2,2,
> +101,102,105,110,101,45,118,97,108,117,101,115,97,36,11,8,240,252,81,0,0,
> +95,159,2,16,36,36,159,2,15,36,36,159,2,15,36,36,16,20,2,4,2,
> +2,2,11,2,2,2,5,2,2,2,6,2,2,2,7,2,2,2,8,2,2,
>  2,9,2,2,2,10,2,2,2,12,2,2,2,13,2,2,97,37,11,8,240,
> -88,83,0,0,93,159,2,15,36,37,16,2,2,3,161,2,2,37,2,3,2,
> -2,2,3,96,38,11,8,240,88,83,0,0,16,0,96,11,11,8,240,88,83,
> +252,81,0,0,93,159,2,15,36,37,16,2,2,3,161,2,2,37,2,3,2,
> +2,2,3,96,38,11,8,240,252,81,0,0,16,0,96,11,11,8,240,252,81,
>  0,0,16,0,13,16,4,36,29,11,11,2,2,11,18,16,2,99,64,104,101,
> -114,101,8,32,8,31,8,30,8,29,8,28,93,8,224,95,83,0,0,95,9,
> -8,224,95,83,0,0,2,2,27,248,22,151,4,195,249,22,144,4,80,158,39,
> +114,101,8,32,8,31,8,30,8,29,8,28,93,8,224,3,82,0,0,95,9,
> +8,224,3,82,0,0,2,2,27,248,22,151,4,195,249,22,144,4,80,158,39,
>  36,251,22,82,2,17,248,22,97,199,12,249,22,72,2,18,248,22,99,201,27,
>  248,22,151,4,195,249,22,144,4,80,158,39,36,251,22,82,2,17,248,22,97,
>  199,249,22,72,2,18,248,22,99,201,12,27,248,22,74,248,22,151,4,196,28,
>  248,22,80,193,20,15,159,37,36,37,28,248,22,80,248,22,74,194,248,22,73,
>  193,249,22,144,4,80,158,39,36,251,22,82,2,17,248,22,73,199,249,22,72,
> -2,9,248,22,74,201,11,18,16,2,101,10,8,32,8,31,8,30,8,29,8,
> -28,16,4,11,11,2,19,3,1,8,101,110,118,49,51,51,48,49,16,4,11,
> -11,2,20,3,1,8,101,110,118,49,51,51,48,50,93,8,224,96,83,0,0,
> -95,9,8,224,96,83,0,0,2,2,27,248,22,74,248,22,151,4,196,28,248,
> +2,6,248,22,74,201,11,18,16,2,101,10,8,32,8,31,8,30,8,29,8,
> +28,16,4,11,11,2,19,3,1,8,101,110,118,49,50,57,51,52,16,4,11,
> +11,2,20,3,1,8,101,110,118,49,50,57,51,53,93,8,224,4,82,0,0,
> +95,9,8,224,4,82,0,0,2,2,27,248,22,74,248,22,151,4,196,28,248,
>  22,80,193,20,15,159,37,36,37,28,248,22,80,248,22,74,194,248,22,73,193,
>  249,22,144,4,80,158,39,36,250,22,82,2,21,248,22,82,249,22,82,248,22,
> -82,2,22,248,22,73,201,251,22,82,2,17,2,22,2,22,249,22,72,2,11,
> +82,2,22,248,22,73,201,251,22,82,2,17,2,22,2,22,249,22,72,2,7,
>  248,22,74,204,18,16,2,101,11,8,32,8,31,8,30,8,29,8,28,16,4,
> -11,11,2,19,3,1,8,101,110,118,49,51,51,48,52,16,4,11,11,2,20,
> -3,1,8,101,110,118,49,51,51,48,53,93,8,224,97,83,0,0,95,9,8,
> -224,97,83,0,0,2,2,248,22,151,4,193,27,248,22,151,4,194,249,22,72,
> +11,11,2,19,3,1,8,101,110,118,49,50,57,51,55,16,4,11,11,2,20,
> +3,1,8,101,110,118,49,50,57,51,56,93,8,224,5,82,0,0,95,9,8,
> +224,5,82,0,0,2,2,248,22,151,4,193,27,248,22,151,4,194,249,22,72,
>  248,22,82,248,22,73,196,248,22,74,195,27,248,22,74,248,22,151,4,23,197,
>  1,249,22,144,4,80,158,39,36,28,248,22,57,248,22,145,4,248,22,73,23,
>  198,2,27,249,22,2,32,0,89,162,8,44,37,43,9,222,33,40,248,22,151,
> @@ -52,7 +52,7 @@
>  44,37,47,9,222,33,43,248,22,151,4,248,22,73,201,248,22,74,198,27,248,
>  22,74,248,22,151,4,196,27,248,22,151,4,248,22,73,195,249,22,144,4,80,
>  158,40,36,28,248,22,80,195,250,22,83,2,21,9,248,22,74,199,250,22,82,
> -2,6,248,22,82,248,22,73,199,250,22,83,2,5,248,22,74,201,248,22,74,
> +2,5,248,22,82,248,22,73,199,250,22,83,2,12,248,22,74,201,248,22,74,
>  202,27,248,22,74,248,22,151,4,23,197,1,27,249,22,1,22,86,249,22,2,
>  22,151,4,248,22,151,4,248,22,73,199,249,22,144,4,80,158,40,36,251,22,
>  82,1,22,119,105,116,104,45,99,111,110,116,105,110,117,97,116,105,111,110,45,
> @@ -63,13 +63,13 @@
>  22,151,4,196,28,248,22,80,193,20,15,159,37,36,37,249,22,144,4,80,158,
>  39,36,27,248,22,151,4,248,22,73,197,28,249,22,128,9,62,61,62,248,22,
>  145,4,248,22,97,196,250,22,82,2,21,248,22,82,249,22,82,21,93,2,26,
> -248,22,73,199,250,22,83,2,8,249,22,82,2,26,249,22,82,248,22,106,203,
> +248,22,73,199,250,22,83,2,10,249,22,82,2,26,249,22,82,248,22,106,203,
>  2,26,248,22,74,202,251,22,82,2,17,28,249,22,128,9,248,22,145,4,248,
>  22,73,200,64,101,108,115,101,10,248,22,73,197,250,22,83,2,21,9,248,22,
> -74,200,249,22,72,2,8,248,22,74,202,100,8,32,8,31,8,30,8,29,8,
> -28,16,4,11,11,2,19,3,1,8,101,110,118,49,51,51,50,55,16,4,11,
> -11,2,20,3,1,8,101,110,118,49,51,51,50,56,93,8,224,98,83,0,0,
> -18,16,2,158,94,10,64,118,111,105,100,8,48,95,9,8,224,98,83,0,0,
> +74,200,249,22,72,2,10,248,22,74,202,100,8,32,8,31,8,30,8,29,8,
> +28,16,4,11,11,2,19,3,1,8,101,110,118,49,50,57,54,48,16,4,11,
> +11,2,20,3,1,8,101,110,118,49,50,57,54,49,93,8,224,6,82,0,0,
> +18,16,2,158,94,10,64,118,111,105,100,8,48,95,9,8,224,6,82,0,0,
>  2,2,27,248,22,74,248,22,151,4,196,249,22,144,4,80,158,39,36,28,248,
>  22,57,248,22,145,4,248,22,73,197,250,22,82,2,27,248,22,82,248,22,73,
>  199,248,22,97,198,27,248,22,145,4,248,22,73,197,250,22,82,2,27,248,22,
> @@ -83,17 +83,17 @@
>  11,11,11,16,0,16,0,16,0,36,36,16,11,16,5,2,3,20,15,159,36,
>  36,36,36,20,105,159,36,16,0,16,1,33,33,10,16,5,2,13,89,162,8,
>  44,37,53,9,223,0,33,34,36,20,105,159,36,16,1,2,3,16,0,11,16,
> -5,2,7,89,162,8,44,37,53,9,223,0,33,35,36,20,105,159,36,16,1,
> -2,3,16,0,11,16,5,2,9,89,162,8,44,37,53,9,223,0,33,36,36,
> -20,105,159,36,16,1,2,3,16,1,33,37,11,16,5,2,11,89,162,8,44,
> +5,2,9,89,162,8,44,37,53,9,223,0,33,35,36,20,105,159,36,16,1,
> +2,3,16,0,11,16,5,2,6,89,162,8,44,37,53,9,223,0,33,36,36,
> +20,105,159,36,16,1,2,3,16,1,33,37,11,16,5,2,7,89,162,8,44,
>  37,56,9,223,0,33,38,36,20,105,159,36,16,1,2,3,16,1,33,39,11,
> -16,5,2,6,89,162,8,44,37,58,9,223,0,33,42,36,20,105,159,36,16,
> -1,2,3,16,0,11,16,5,2,10,89,162,8,44,37,53,9,223,0,33,44,
> -36,20,105,159,36,16,1,2,3,16,0,11,16,5,2,5,89,162,8,44,37,
> +16,5,2,5,89,162,8,44,37,58,9,223,0,33,42,36,20,105,159,36,16,
> +1,2,3,16,0,11,16,5,2,11,89,162,8,44,37,53,9,223,0,33,44,
> +36,20,105,159,36,16,1,2,3,16,0,11,16,5,2,12,89,162,8,44,37,
>  54,9,223,0,33,45,36,20,105,159,36,16,1,2,3,16,0,11,16,5,2,
>  4,89,162,8,44,37,55,9,223,0,33,46,36,20,105,159,36,16,1,2,3,
> -16,0,11,16,5,2,8,89,162,8,44,37,58,9,223,0,33,47,36,20,105,
> -159,36,16,1,2,3,16,1,33,49,11,16,5,2,12,89,162,8,44,37,54,
> +16,0,11,16,5,2,10,89,162,8,44,37,58,9,223,0,33,47,36,20,105,
> +159,36,16,1,2,3,16,1,33,49,11,16,5,2,8,89,162,8,44,37,54,
>  9,223,0,33,50,36,20,105,159,36,16,1,2,3,16,0,11,16,0,94,2,
>  15,2,16,93,2,15,9,9,36,0};
>     EVAL_ONE_SIZED_STR((char *)expr, 2025);
> @@ -520,7 +520,7 @@
>  117,116,105,108,115,11,29,94,2,2,69,35,37,110,101,116,119,111,114,107,11,
>  29,94,2,2,68,35,37,112,97,114,97,109,122,11,29,94,2,2,68,35,37,
>  101,120,112,111,98,115,11,29,94,2,2,68,35,37,107,101,114,110,101,108,11,
> -97,36,11,8,240,237,83,0,0,98,159,2,3,36,36,159,2,4,36,36,159,
> +97,36,11,8,240,145,82,0,0,98,159,2,3,36,36,159,2,4,36,36,159,
>  2,5,36,36,159,2,6,36,36,159,2,7,36,36,159,2,7,36,36,16,0,
>  159,36,20,105,159,36,16,1,11,16,0,83,158,42,20,103,145,2,1,2,1,
>  29,11,11,11,11,11,18,96,11,44,44,44,36,80,158,36,36,20,105,159,36,
>
> src/racket/src/hash.c
> ~~~~~~~~~~~~~~~~~~~~~
> --- OLD/src/racket/src/hash.c
> +++ NEW/src/racket/src/hash.c
> @@ -1076,6 +1076,12 @@ static long equal_hash_key(Scheme_Object *o, long k, Hash_Info *hi)
>       o = SCHEME_CDR(o);
>       break;
>     }
> +  case scheme_cpointer_type:
> +    {
> +      k = (k << 3) + k;
> +      k += (long)((char *)SCHEME_CPTR_VAL(o) + SCHEME_CPTR_OFFSET(o));
> +      break;
> +    }
>   case scheme_vector_type:
>   case scheme_fxvector_type:
>   case scheme_wrap_chunk_type:
> @@ -1490,6 +1496,10 @@ static long equal_hash_key2(Scheme_Object *o, Hash_Info *hi)
>       v2 = equal_hash_key2(SCHEME_CDR(o), hi);
>       return v1 + v2;
>     }
> +  case scheme_cpointer_type:
> +    {
> +      return (long)((char *)SCHEME_CPTR_VAL(o) + SCHEME_CPTR_OFFSET(o));
> +    }
>   case scheme_vector_type:
>   case scheme_fxvector_type:
>   case scheme_wrap_chunk_type:
>
> src/racket/src/mzmarksrc.c
> ~~~~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/src/racket/src/mzmarksrc.c
> +++ NEW/src/racket/src/mzmarksrc.c
> @@ -61,17 +61,10 @@ cpointer_obj {
>   }
>   gcMARK2(SCHEME_CPTR_TYPE(p), gc);
>  size:
> -  gcBYTES_TO_WORDS(sizeof(Scheme_Cptr));
> -}
> -
> -offset_cpointer_obj {
> - mark:
> -  if (!(SCHEME_CPTR_FLAGS(p) & 0x1)) {
> -    gcMARK2(SCHEME_CPTR_VAL(p), gc);
> -  }
> -  gcMARK2(SCHEME_CPTR_TYPE(p), gc);
> - size:
> -  gcBYTES_TO_WORDS(sizeof(Scheme_Offset_Cptr));
> +  if (SCHEME_CPTR_HAS_OFFSET(p))
> +    return gcBYTES_TO_WORDS(sizeof(Scheme_Offset_Cptr));
> +  else
> +    return gcBYTES_TO_WORDS(sizeof(Scheme_Cptr));
>  }
>
>  twoptr_obj {
>
> src/racket/src/salloc.c
> ~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/src/racket/src/salloc.c
> +++ NEW/src/racket/src/salloc.c
> @@ -527,7 +527,7 @@ Scheme_Object *scheme_make_external_cptr(GC_CAN_IGNORE void *cptr, Scheme_Object
>  {
>   Scheme_Object *o;
>   o = scheme_make_cptr(NULL, typetag);
> -  SCHEME_CPTR_FLAGS(o) |= 1;
> +  SCHEME_CPTR_FLAGS(o) |= 0x1;
>   SCHEME_CPTR_VAL(o) = cptr;
>   return o;
>  }
> @@ -537,7 +537,8 @@ Scheme_Object *scheme_make_offset_cptr(void *cptr, long offset, Scheme_Object *t
>   Scheme_Object *o;
>
>   o = (Scheme_Object *)scheme_malloc_small_tagged(sizeof(Scheme_Offset_Cptr));
> -  o->type = scheme_offset_cpointer_type;
> +  o->type = scheme_cpointer_type;
> +  SCHEME_CPTR_FLAGS(o) |= 0x2;
>   SCHEME_CPTR_VAL(o) = cptr;
>   SCHEME_CPTR_TYPE(o) = (void *)typetag;
>   ((Scheme_Offset_Cptr *)o)->offset = offset;
> @@ -549,7 +550,7 @@ Scheme_Object *scheme_make_offset_external_cptr(GC_CAN_IGNORE void *cptr, long o
>  {
>   Scheme_Object *o;
>   o = scheme_make_offset_cptr(NULL, offset, typetag);
> -  SCHEME_CPTR_FLAGS(o) |= 1;
> +  SCHEME_CPTR_FLAGS(o) |= 0x1;
>   SCHEME_CPTR_VAL(o) = cptr;
>   return o;
>  }
>
> src/racket/src/stypes.h
> ~~~~~~~~~~~~~~~~~~~~~~~
> --- OLD/src/racket/src/stypes.h
> +++ NEW/src/racket/src/stypes.h
> @@ -88,7 +88,7 @@ enum {
>   scheme_hash_table_type,               /* 69 */
>   scheme_hash_tree_type,                /* 70 */
>   scheme_cpointer_type,                 /* 71 */
> -  scheme_offset_cpointer_type,          /* 72 */
> +  scheme_currently_unused_type,         /* 72 */
>   scheme_weak_box_type,                 /* 73 */
>   scheme_ephemeron_type,                /* 74 */
>   scheme_struct_type_type,              /* 75 */
> @@ -183,6 +183,7 @@ enum {
>   scheme_once_used_type,                /* 164 */
>   scheme_serialized_symbol_type,        /* 165 */
>   scheme_serialized_structure_type,     /* 166 */
> +  /* use scheme_currently_unused_type above, first */
>
>  #ifdef MZTAG_REQUIRED
>   _scheme_last_normal_type_,            /* 167 */
>
> src/racket/src/type.c
> ~~~~~~~~~~~~~~~~~~~~~
> --- OLD/src/racket/src/type.c
> +++ NEW/src/racket/src/type.c
> @@ -220,7 +220,6 @@ scheme_init_type ()
>   set_name(scheme_subprocess_type, "<subprocess>");
>
>   set_name(scheme_cpointer_type, "<cpointer>");
> -  set_name(scheme_offset_cpointer_type, "<cpointer>");
>
>   set_name(scheme_wrap_chunk_type, "<wrap-chunk>");
>
> @@ -555,7 +554,6 @@ void scheme_register_traversers(void)
>   GC_REG_TRAV(scheme_flvector_type, flvector_obj);
>   GC_REG_TRAV(scheme_fxvector_type, fxvector_obj);
>   GC_REG_TRAV(scheme_cpointer_type, cpointer_obj);
> -  GC_REG_TRAV(scheme_offset_cpointer_type, offset_cpointer_obj);
>
>   GC_REG_TRAV(scheme_bucket_type, bucket_obj);
>
>



-- 
Jay McCarthy <jay at cs.byu.edu>
Assistant Professor / Brigham Young University
http://faculty.cs.byu.edu/~jay

"The glory of God is Intelligence" - D&C 93


Posted on the dev mailing list.