home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / kaffe-0.5p4-src.tgz / tar.out / contrib / kaffe / kaffevm / jit / slots.h < prev   
C/C++ Source or Header  |  1996-09-28  |  2KB  |  97 lines

  1. /* slots.h
  2.  * Slots.
  3.  *
  4.  * Copyright (c) 1996 Systems Architecture Research Centre,
  5.  *           City University, London, UK.
  6.  *
  7.  * See the file "license.terms" for information on usage and redistribution
  8.  * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  9.  *
  10.  * Written by Tim Wilkinson <tim@sarc.city.ac.uk>, June 1996.
  11.  */
  12.  
  13. #ifndef __slots_h
  14. #define __slots_h
  15.  
  16. #define    USE_NO_SLOTS        0
  17. #define    USE_SLOT_1        1
  18. #define    USE_SLOT_2        2
  19. #define    USE_SLOT_12        (USE_SLOT_1 | USE_SLOT_2)
  20. #define    SLOT_1(_s)        ((_s) & USE_SLOT_1)
  21. #define    SLOT_2(_s)        ((_s) & USE_SLOT_2)
  22.  
  23. #define    Tcomplex        0
  24. #define    Tnull            Tcomplex
  25. #define    Tconst            1
  26. #define    Tcopy            2
  27. #define    Taddregconst        3
  28. #define    Tstore            4
  29. #define    Tload            5
  30.  
  31. #define    MAXSLOT            64
  32. #define    NOSLOT            0
  33.  
  34. /* Return slots */
  35. #define    returnInt        0
  36. #define    returnRef        0
  37. #define    returnLong        0 /* 1 */
  38. #define    returnFloat        2
  39. #define    returnDouble        2 /* 3 */
  40. #define    MAXRETURNS        4
  41.  
  42. struct _slots;
  43.  
  44. typedef struct _slots {
  45.     union {
  46.         jint        tint;
  47.         jlong        tlong;
  48.         jdouble        tdouble;
  49.         void*        taddr;
  50.         char*        tstr;
  51.     } v;
  52.     struct _sequence*    insn;
  53.     int            regno;
  54.     int            modified;
  55. } slots;
  56.  
  57. extern slots slotinfo[];
  58. extern slots* returninfo;
  59. extern slots* localinfo;
  60. extern slots* stackinfo;
  61. extern slots* tempinfo;
  62. extern int tmpslot;
  63. extern int stackno;
  64.  
  65. void initSlots(void);
  66. void markReturns(void);
  67.  
  68. /* Slot access macros */
  69.  
  70. #define    stack(_s)        (&stackinfo[stackno+(_s)])
  71. #define    local(_s)        (&localinfo[(_s)])
  72. #define    local_long(_s)        (&localinfo[(_s)])
  73. #define    local_float        local
  74. #define    local_double        local_long
  75.  
  76. #define    slot_return(_s)        ((_s) >= &returninfo[0] &&        \
  77.                  (_s) < &returninfo[MAXRETURNS])
  78.  
  79. #define    slot_value(_s)        ((_s)->v.tint)
  80. #define    slot_fvalue(_s)        ((_s)->v.tdouble)
  81. #define    slot_type(_s)        (flag_optimise && (_s)->insn ? (_s)->insn->type : Tnull)
  82. #define    slot_insn(_s)        ((_s)->insn)
  83. #define    slot_ref(_s)        ((_s)->insn->ref)
  84. #define    slot_pop(_s)        (seq_pop(slot_insn(_s)))
  85.  
  86. #define    slot_alloctmp(t)    (t) = &tempinfo[tmpslot],        \
  87.                 tmpslot += 1
  88. #define    slot_alloc2tmp(t)    (t) = &tempinfo[tmpslot],        \
  89.                 tmpslot += 2
  90. #define    slot_invalidate(_s)    (_s)->regno = NOREG;            \
  91.                 (_s)->modified = 0
  92. #define    slot_nowriteback(_s)    if (flag_optimise) {            \
  93.                     slot_slot_const(0, 0, (uintp)(_s), invalSlot, Tcomplex); \
  94.                 }
  95.  
  96. #endif
  97.