Ignore:
Timestamp:
Dec 14, 2006, 11:00:27 PM (13 years ago)
Author:
gb
Message:

If a memory allocation request fails, signal a lisp error (what a concept.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/lisp-kernel/x86-exceptions.c

    r5614 r5616  
    233233
    234234 
    235 Boolean
    236 handle_alloc_trap(ExceptionInformation *xp, TCR *tcr)
    237 {
    238   natural cur_allocptr, bytes_needed;
    239   unsigned allocptr_tag;
    240   signed_natural disp;
    241  
    242   cur_allocptr = xpGPR(xp,Iallocptr);
    243   allocptr_tag = fulltag_of(cur_allocptr);
    244   if (allocptr_tag == fulltag_misc) {
    245     disp = xpGPR(xp,Iimm1);
    246   } else {
    247     disp = dnode_size-fulltag_cons;
    248   }
    249   bytes_needed = disp+allocptr_tag;
    250 
    251   update_bytes_allocated(tcr,((BytePtr)(cur_allocptr+disp)));
    252   if (allocate_object(xp, bytes_needed, disp, tcr)) {
    253     return true;
    254   }
    255 
    256   return false;
    257 }
     235
    258236
    259237
     
    376354}
    377355
     356#ifndef XMEMFULL
     357#define XMEMFULL (76)
     358#endif
     359
     360Boolean
     361handle_alloc_trap(ExceptionInformation *xp, TCR *tcr)
     362{
     363  natural cur_allocptr, bytes_needed;
     364  unsigned allocptr_tag;
     365  signed_natural disp;
     366 
     367  cur_allocptr = xpGPR(xp,Iallocptr);
     368  allocptr_tag = fulltag_of(cur_allocptr);
     369  if (allocptr_tag == fulltag_misc) {
     370    disp = xpGPR(xp,Iimm1);
     371  } else {
     372    disp = dnode_size-fulltag_cons;
     373  }
     374  bytes_needed = disp+allocptr_tag;
     375
     376  update_bytes_allocated(tcr,((BytePtr)(cur_allocptr+disp)));
     377  if (allocate_object(xp, bytes_needed, disp, tcr)) {
     378    return true;
     379  }
     380 
     381  {
     382    LispObj xcf = create_exception_callback_frame(xp),
     383      cmain = nrs_CMAIN.vcell;
     384    int skip;
     385   
     386    tcr->save_allocptr = tcr->save_allocbase = (void *)VOID_ALLOCPTR;
     387    xpGPR(xp,Iallocptr) = VOID_ALLOCPTR;
     388
     389    skip = callback_to_lisp(tcr, cmain, xp, xcf, -1, XMEMFULL, 0, 0);
     390    xpPC(xp) += skip;
     391  }
     392
     393  return true;
     394}
    378395
    379396extern unsigned get_mxcsr();
Note: See TracChangeset for help on using the changeset viewer.