guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Issues in ia64


From: Thien-Thi Nguyen
Subject: Re: Issues in ia64
Date: Tue, 02 Jul 2002 02:59:08 -0700

see below for a diff that addresses this lack of slack in three places.

thi


_______________________________________________________
*** struct.c.~1.1.1.1.~ Thu Jun  6 02:36:37 2002
--- struct.c    Tue Jul  2 02:51:41 2002
***************
*** 59,64 ****
--- 59,77 ----
  #include <string.h>
  #endif
  
+ /* +------------------+----+-----+
+    | POINTER          | 0* | 000 |
+    +------------------+----+-----+
+                        ^^^^
+ 
+    This is the machine-alignment-immediate-slack field, which may have width 0
+    (but no less ;-), and Must Be Zero (MBZ).
+ 
+    For structs, we actually use two words.  */
+ 
+ #define two_word_size (sizeof (scm_t_bits) * 2)
+ #define space (two_word_size - 1)
+ 
  
  
  static SCM required_vtable_fields = SCM_BOOL_F;
***************
*** 306,319 ****
  scm_bits_t *
  scm_alloc_struct (int n_words, int n_extra, char *who)
  {
!   int size = sizeof (scm_bits_t) * (n_words + n_extra) + 7;
    void * block = scm_must_malloc (size, who);
  
    /* Adjust the pointer to hide the extra words.  */
    scm_bits_t * p = (scm_bits_t *) block + n_extra;
  
    /* Adjust it even further so it's aligned on an eight-byte boundary.  */
!   p = (scm_bits_t *) (((scm_bits_t) p + 7) & ~7);
  
    /* Initialize a few fields as described above.  */
    p[scm_struct_i_free] = (scm_bits_t) scm_struct_free_standard;
--- 319,332 ----
  scm_bits_t *
  scm_alloc_struct (int n_words, int n_extra, char *who)
  {
!   int size = sizeof (scm_bits_t) * (n_words + n_extra) + space;
    void * block = scm_must_malloc (size, who);
  
    /* Adjust the pointer to hide the extra words.  */
    scm_bits_t * p = (scm_bits_t *) block + n_extra;
  
    /* Adjust it even further so it's aligned on an eight-byte boundary.  */
!   p = (scm_bits_t *) (((scm_bits_t) p + space) & ~space);
  
    /* Initialize a few fields as described above.  */
    p[scm_struct_i_free] = (scm_bits_t) scm_struct_free_standard;
***************
*** 341,347 ****
  scm_struct_free_standard (scm_bits_t * vtable, scm_bits_t * data)
  {
    size_t n = (data[scm_struct_i_n_words] + scm_struct_n_extra_words)
!            * sizeof (scm_bits_t) + 7;
    scm_must_free ((void *) data[scm_struct_i_ptr]);
    return n;
  }
--- 354,360 ----
  scm_struct_free_standard (scm_bits_t * vtable, scm_bits_t * data)
  {
    size_t n = (data[scm_struct_i_n_words] + scm_struct_n_extra_words)
!            * sizeof (scm_bits_t) + space;
    scm_must_free ((void *) data[scm_struct_i_ptr]);
    return n;
  }
***************
*** 350,356 ****
  scm_struct_free_entity (scm_bits_t * vtable, scm_bits_t * data)
  {
    size_t n = (data[scm_struct_i_n_words] + scm_struct_entity_n_extra_words)
!            * sizeof (scm_bits_t) + 7;
    scm_must_free ((void *) data[scm_struct_i_ptr]);
    return n;
  }
--- 363,369 ----
  scm_struct_free_entity (scm_bits_t * vtable, scm_bits_t * data)
  {
    size_t n = (data[scm_struct_i_n_words] + scm_struct_entity_n_extra_words)
!            * sizeof (scm_bits_t) + space;
    scm_must_free ((void *) data[scm_struct_i_ptr]);
    return n;
  }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]