Changeset 6528


Ignore:
Timestamp:
May 9, 2007, 9:00:36 AM (15 years ago)
Author:
gb
Message:

New TRA handling; new node regs in exception contexts.

File:
1 edited

Legend:

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

    r5963 r6528  
    101101    */
    102102    {
    103       int disp = ((int *)n)[-1];
     103      int disp = 0;
    104104      LispObj m = n;
    105105
    106       if (disp > 0) {
    107         n = m - disp;
    108       }
    109       if ((disp <= 0) ||
     106      if ((*((unsigned short *)n) == RECOVER_FN_FROM_RIP_WORD0) &&
     107          (*((unsigned char *)(n+2)) == RECOVER_FN_FROM_RIP_BYTE2)) {
     108        disp = (*(int *) (n+3));
     109        n = RECOVER_FN_FROM_RIP_LENGTH+m+disp;
     110      }
     111      if ((disp == 0) ||
    110112          (fulltag_of(n) != fulltag_function) ||
    111113          (heap_area_containing((BytePtr)ptr_from_lispobj(n)) != a)) {
    112         Bug(NULL, "TRA at 0x%lx has bad displacement ~d\n", n, disp);
     114        Bug(NULL, "TRA at 0x%lx has bad displacement %d\n", n, disp);
    113115      }
    114116    }
     
    291293
    292294  if (tag_of(n) == tag_tra) {
    293     n = n - (((int *)n)[-1]);
    294     tag_n = fulltag_function;
     295    if ((*((unsigned short *)n) == RECOVER_FN_FROM_RIP_WORD0) &&
     296        (*((unsigned char *)(n+2)) == RECOVER_FN_FROM_RIP_BYTE2)) {
     297      int sdisp = (*(int *) (n+3));
     298      n = RECOVER_FN_FROM_RIP_LENGTH+n+sdisp;
     299      tag_n = fulltag_function;
     300    }
     301    else {
     302      return;
     303    }
    295304  }
    296305
     
    456465
    457466  if (tag_of(n) == tag_tra) {
    458     n -= ((int *)n)[-1];
    459     tag_n = fulltag_function;   
     467    if ((*((unsigned short *)n) == RECOVER_FN_FROM_RIP_WORD0) &&
     468        (*((unsigned char *)(n+2)) == RECOVER_FN_FROM_RIP_BYTE2)) {
     469      int sdisp = (*(int *) (n+3));
     470      n = RECOVER_FN_FROM_RIP_LENGTH+n+sdisp;
     471      tag_n = fulltag_function;
     472    } else {
     473      return;
     474    }
    460475  }
    461476
     
    710725    if ((tag_n == fulltag_tra_0) ||
    711726        (tag_n == fulltag_tra_1)) {
    712       int disp = ((int *)n)[-1];
     727      int disp = (*(int *) (n+3)) + RECOVER_FN_FROM_RIP_LENGTH;
    713728
    714729      base = (LispObj *) (untag(n-disp));
     
    14541469mark_xp(ExceptionInformation *xp)
    14551470{
    1456   natural *regs = (natural *) xpGPRvector(xp);
    1457 
     1471  natural *regs = (natural *) xpGPRvector(xp), dnode;
     1472  LispObj rip;
     1473   
     1474 
    14581475
    14591476  mark_root(regs[Iarg_z]);
     
    14641481  mark_root(regs[Isave1]);
    14651482  mark_root(regs[Isave0]);
    1466   mark_root(regs[Ira0]);
    14671483  mark_root(regs[Ifn]);
    14681484  mark_root(regs[Itemp0]);
    14691485  mark_root(regs[Itemp1]);
    14701486  mark_root(regs[Itemp2]);
    1471   /* If the IP isn't pointing into a marked function,
    1472      we're in big trouble.  Check for that here ? */
     1487  /* If the RIP isn't pointing into a marked function,
     1488     we can -maybe- recover from that if it's tagged as
     1489     a TRA. */
     1490  rip = regs[Iip];
     1491  dnode = gc_area_dnode(rip);
     1492  if ((dnode < GCndnodes_in_area) &&
     1493      (! ref_bit(GCmarkbits,dnode))) {
     1494    if (tag_of(rip) == tag_tra) {
     1495      mark_root(rip);
     1496    } else if ((fulltag_of(rip) == fulltag_function) &&
     1497               (*((unsigned short *)rip) == RECOVER_FN_FROM_RIP_WORD0) &&
     1498               (*((unsigned char *)(rip+2)) == RECOVER_FN_FROM_RIP_BYTE2) &&
     1499               ((*(int *) (rip+3))) == -RECOVER_FN_FROM_RIP_LENGTH) {
     1500      mark_root(rip);
     1501    } else {
     1502      Bug(NULL, "Can't find function for rip 0x%16lx",rip);
     1503    }
     1504  }
    14731505}
    14741506
     
    20392071  update_noderef(&(regs[Isave1]));
    20402072  update_noderef(&(regs[Isave0]));
    2041   update_noderef(&(regs[Ira0]));
    20422073  update_noderef(&(regs[Ifn]));
    20432074  update_noderef(&(regs[Itemp0]));
     
    30273058  copy_ivector_reference(&(regs[Isave1]), low, high, to, what);
    30283059  copy_ivector_reference(&(regs[Isave0]), low, high, to, what);
    3029   copy_ivector_reference(&(regs[Ira0]), low, high, to, what);
    30303060  copy_ivector_reference(&(regs[Ifn]), low, high, to, what);
    30313061  copy_ivector_reference(&(regs[Itemp0]), low, high, to, what);
     
    32343264  impurify_noderef(&(regs[Isave1]), low, high, delta);
    32353265  impurify_noderef(&(regs[Isave0]), low, high, delta);
    3236   impurify_noderef(&(regs[Ira0]), low, high, delta);
    32373266  impurify_noderef(&(regs[Ifn]), low, high, delta);
    32383267  impurify_noderef(&(regs[Itemp0]), low, high, delta);
     
    35183547  adjust_noderef((LispObj *) (&(regs[Isave1])),base,limit,delta);
    35193548  adjust_noderef((LispObj *) (&(regs[Isave0])),base,limit,delta);
    3520   adjust_noderef((LispObj *) (&(regs[Ira0])),base,limit,delta);
    35213549  adjust_noderef((LispObj *) (&(regs[Ifn])),base,limit,delta);
    35223550  adjust_noderef((LispObj *) (&(regs[Itemp0])),base,limit,delta);
     
    35403568  nuke_noderef((LispObj *) (&(regs[Isave1])),base,limit);
    35413569  nuke_noderef((LispObj *) (&(regs[Isave0])),base,limit);
    3542   nuke_noderef((LispObj *) (&(regs[Ira0])),base,limit);
    35433570  nuke_noderef((LispObj *) (&(regs[Ifn])),base,limit);
    35443571  nuke_noderef((LispObj *) (&(regs[Itemp0])),base,limit);
Note: See TracChangeset for help on using the changeset viewer.