Changeset 12837


Ignore:
Timestamp:
Sep 14, 2009, 6:47:46 PM (10 years ago)
Author:
rme
Message:

When unwatching an object, allocate space for it from lisp rather than
from the kernel. Change UNWATCH, %UNWATCH, and unwatch_object()
accordingly.

In unwatch_object(), just tenure everything after unwatching.

Location:
trunk/source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/level-0/X86/X8632/x8632-utils.lisp

    r12797 r12837  
    402402  (single-value-return))
    403403
    404 (defx8632lapfunction %unwatch ((watched arg_z))
    405   (check-nargs 1)
     404(defx8632lapfunction %unwatch ((watched arg_y) (new arg_z))
     405  (check-nargs 2)
    406406  (movl ($ arch::watch-trap-function-unwatch) (%l imm0))
    407407  (uuo-watch-trap)
    408   (movl ($ nil) (%l arg_z))
    409408  (single-value-return))
    410409
  • trunk/source/level-0/X86/x86-utils.lisp

    r12790 r12837  
    455455  (single-value-return))
    456456
    457 (defx86lapfunction %unwatch ((watched arg_z))
    458   (check-nargs 1)
     457(defx86lapfunction %unwatch ((watched arg_y) (new arg_z))
     458  (check-nargs 2)
    459459  (movl ($ arch::watch-trap-function-unwatch) (%l imm0))
    460460  (uuo-watch-trap)
    461   (movl ($ nil) (%l arg_z))
    462461  (single-value-return))
    463462
  • trunk/source/lib/misc.lisp

    r12794 r12837  
    10601060                    ;; list while %map-areas iterates over it, but I
    10611061                    ;; think we'll get away with it.
    1062                     (%unwatch thing)
    1063                     (return-from unwatch)))
     1062                    (let ((new (%alloc-misc (uvsize thing) (typecode thing))))
     1063                      (return-from unwatch (%unwatch thing new)))))
    10641064              area-watched area-watched))
    10651065     
  • trunk/source/lisp-kernel/x86-exceptions.c

    r12827 r12837  
    37073707watch_object(TCR *tcr, signed_natural param)
    37083708{
    3709   TCR *other_tcr;
    37103709  LispObj uvector = (LispObj)param;
    37113710  LispObj *noderef = (LispObj *)untag(uvector);
     
    37303729}
    37313730
     3731/*
     3732 * We expect the watched object in arg_y, and the new uninitialized
     3733 * object (which is just zeroed) in arg_z.
     3734 */
    37323735signed_natural
    37333736unwatch_object(TCR *tcr, signed_natural param)
    37343737{
    3735   TCR *other_tcr;
    3736   LispObj uvector = (LispObj)param;
    3737   LispObj *noderef = (LispObj *)untag(uvector);
    3738   LispObj old = uvector;
    3739   LispObj new;
    3740   natural size = uvector_total_size_in_bytes(noderef);
    3741   area *a = area_containing((BytePtr)noderef);
    37423738  ExceptionInformation *xp = tcr->xframe->curr;
     3739  LispObj old = xpGPR(xp, Iarg_y);
     3740  LispObj new = xpGPR(xp, Iarg_z);
     3741  LispObj *oldnode = (LispObj *)untag(old);
     3742  LispObj *newnode = (LispObj *)untag(new);
     3743  area *a = area_containing((BytePtr)old);
    37433744
    37443745  if (a && a->code == AREA_WATCHED) {
    3745     update_bytes_allocated(tcr, (void *)tcr->save_allocptr);
    3746     if (allocate_object(xp, size, size - fulltag_misc, tcr)) {
    3747       new = (LispObj)tcr->save_allocptr;
    3748       tcr->save_allocptr -= fulltag_misc;
    3749     } else {
    3750       lisp_allocation_failure(xp, tcr, size);
    3751     }
    3752 
    3753     memcpy(tcr->save_allocptr, noderef, size);
     3746    natural size = uvector_total_size_in_bytes(oldnode);
     3747
     3748    memcpy(newnode, oldnode, size);
    37543749    delete_watched_area(a, tcr);
    37553750    wp_update_references(tcr, old, new);
     3751    /* because wp_update_references doesn't update refbits */
     3752    tenure_to_area(tenured_area);
    37563753    check_all_areas(tcr);
     3754    xpGPR(xp, Iarg_z) = new;
    37573755  }
    37583756  return 0;
     
    37703768      break;
    37713769    case WATCH_TRAP_FUNCTION_UNWATCH:
    3772       gc_like_from_xp(xp, unwatch_object, uvector);
     3770      gc_like_from_xp(xp, unwatch_object, 0);
    37733771      break;
    37743772    default:
Note: See TracChangeset for help on using the changeset viewer.