/[cmucl]/src/lisp/gencgc.c
ViewVC logotype

Diff of /src/lisp/gencgc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.110 by rtoy, Mon Jul 26 17:17:13 2010 UTC revision 1.110.6.5 by rtoy, Mon Dec 20 23:32:55 2010 UTC
# Line 150  Line 150 
150    
151  /* Define for activating assertions.  */  /* Define for activating assertions.  */
152    
153  #if defined(DARWIN)  #if defined(x86) && defined(SOLARIS)
154  #define GC_ASSERTIONS 1  #define GC_ASSERTIONS 1
155  #endif  #endif
156    
# Line 2906  void Line 2906  void
2906  sniff_code_object(struct code *code, unsigned displacement)  sniff_code_object(struct code *code, unsigned displacement)
2907  {  {
2908      int nheader_words, ncode_words, nwords;      int nheader_words, ncode_words, nwords;
2909      void *p;      char *p;
2910      void *constants_start_addr, *constants_end_addr;      char *constants_start_addr, *constants_end_addr;
2911      void *code_start_addr, *code_end_addr;      char *code_start_addr, *code_end_addr;
2912      int fixup_found = 0;      int fixup_found = 0;
2913    
2914      if (!check_code_fixups)      if (!check_code_fixups)
# Line 2932  sniff_code_object(struct code *code, uns Line 2932  sniff_code_object(struct code *code, uns
2932      nheader_words = HeaderValue(*(lispobj *) code);      nheader_words = HeaderValue(*(lispobj *) code);
2933      nwords = ncode_words + nheader_words;      nwords = ncode_words + nheader_words;
2934    
2935      constants_start_addr = (void *) code + 5 * sizeof(lispobj);      constants_start_addr = (char *) code + 5 * sizeof(lispobj);
2936      constants_end_addr = (void *) code + nheader_words * sizeof(lispobj);      constants_end_addr = (char *) code + nheader_words * sizeof(lispobj);
2937      code_start_addr = (void *) code + nheader_words * sizeof(lispobj);      code_start_addr = (char *) code + nheader_words * sizeof(lispobj);
2938      code_end_addr = (void *) code + nwords * sizeof(lispobj);      code_end_addr = (char *) code + nwords * sizeof(lispobj);
2939    
2940      /* Work through the unboxed code. */      /* Work through the unboxed code. */
2941      for (p = code_start_addr; p < code_end_addr; p++) {      for (p = code_start_addr; p < code_end_addr; p++) {
2942          void *data = *(void **) p;          char *data = *(char **) p;
2943          unsigned d1 = *((unsigned char *) p - 1);          unsigned d1 = *((unsigned char *) p - 1);
2944          unsigned d2 = *((unsigned char *) p - 2);          unsigned d2 = *((unsigned char *) p - 2);
2945          unsigned d3 = *((unsigned char *) p - 3);          unsigned d3 = *((unsigned char *) p - 3);
# Line 3113  static void Line 3113  static void
3113  apply_code_fixups(struct code *old_code, struct code *new_code)  apply_code_fixups(struct code *old_code, struct code *new_code)
3114  {  {
3115      int nheader_words, ncode_words, nwords;      int nheader_words, ncode_words, nwords;
3116      void *constants_start_addr, *constants_end_addr;      char *constants_start_addr, *constants_end_addr;
3117      void *code_start_addr, *code_end_addr;      char *code_start_addr, *code_end_addr;
3118      lispobj fixups = NIL;      lispobj fixups = NIL;
3119      unsigned long displacement =      unsigned long displacement =
3120    
# Line 3141  apply_code_fixups(struct code *old_code, Line 3141  apply_code_fixups(struct code *old_code,
3141              "*** Compiled code object at %x: header_words=%d code_words=%d .\n",              "*** Compiled code object at %x: header_words=%d code_words=%d .\n",
3142              new_code, nheader_words, ncode_words);              new_code, nheader_words, ncode_words);
3143  #endif  #endif
3144      constants_start_addr = (void *) new_code + 5 * sizeof(lispobj);      constants_start_addr = (char *) new_code + 5 * sizeof(lispobj);
3145      constants_end_addr = (void *) new_code + nheader_words * sizeof(lispobj);      constants_end_addr = (char *) new_code + nheader_words * sizeof(lispobj);
3146      code_start_addr = (void *) new_code + nheader_words * sizeof(lispobj);      code_start_addr = (char *) new_code + nheader_words * sizeof(lispobj);
3147      code_end_addr = (void *) new_code + nwords * sizeof(lispobj);      code_end_addr = (char *) new_code + nwords * sizeof(lispobj);
3148  #if 0  #if 0
3149      fprintf(stderr,      fprintf(stderr,
3150              "*** Const. start = %x; end= %x; Code start = %x; end = %x\n",              "*** Const. start = %x; end= %x; Code start = %x; end = %x\n",
# Line 3444  scav_closure_header(lispobj * where, lis Line 3444  scav_closure_header(lispobj * where, lis
3444    
3445      closure = (struct closure *) where;      closure = (struct closure *) where;
3446      fun = closure->function - RAW_ADDR_OFFSET;      fun = closure->function - RAW_ADDR_OFFSET;
3447    #if !(defined(i386) && defined(SOLARIS))
3448      scavenge(&fun, 1);      scavenge(&fun, 1);
3449      /* The function may have moved so update the raw address. But don't      /* The function may have moved so update the raw address. But don't
3450         write unnecessarily. */         write unnecessarily. */
3451      if (closure->function != fun + RAW_ADDR_OFFSET)      if (closure->function != fun + RAW_ADDR_OFFSET)
3452          closure->function = fun + RAW_ADDR_OFFSET;          closure->function = fun + RAW_ADDR_OFFSET;
3453    #else
3454        /*
3455         * For some reason, on solaris/x86, we get closures (actually, it
3456         * appears to be funcallable instances where the closure function
3457         * is zero.  I don't know why, but they are.  They don't seem to
3458         * be created anywhere and it doesn't seem to be caused by GC
3459         * transport.
3460         *
3461         * Anyway, we check for zero and skip scavenging if so.
3462         * (Previously, we'd get a segfault scavenging the object at
3463         * address -RAW_ADDR_OFFSET.
3464         */
3465        if (closure->function) {
3466            scavenge(&fun, 1);
3467            /*
3468             * The function may have moved so update the raw address. But don't
3469             * write unnecessarily.
3470             */
3471            if (closure->function != fun + RAW_ADDR_OFFSET) {
3472    #if 0
3473                fprintf(stderr, "closure header 0x%04x moved from %p to %p\n",
3474                        closure->header, (void*) closure->function, (void*) (fun + RAW_ADDR_OFFSET));
3475    #endif
3476                closure->function = fun + RAW_ADDR_OFFSET;
3477            }
3478        }
3479    #if 0
3480         else {
3481            fprintf(stderr, "Weird closure!\n");
3482            fprintf(stderr, " where = %p, object = 0x%04x\n", where, object);
3483            fprintf(stderr, " closure->function = %p, fun = %p\n", closure->function, fun);
3484        }
3485    #endif
3486    #endif
3487      return 2;      return 2;
3488  }  }
3489    

Legend:
Removed from v.1.110  
changed lines
  Added in v.1.110.6.5

  ViewVC Help
Powered by ViewVC 1.1.5