2 * STOR.H - Physical storage information for interpreter
4 * (c)Copyright 1993-2014, Matthew Dillon, All Rights Reserved. See the
5 * COPYRIGHT file at the base of the distribution.
10 typedef struct ThreadCall {
14 Thread *tc_CallingThread;
18 * XXX XXX bad bad... assumes variable is on process local stack. We
25 * XXX import/class through object, import/class through type name..
26 * determines whether we must require GLOBAL or not.
29 Context *BuildSemGroupContext(SemGroup *sg, int isglobal);
30 void InterpSemGroupDefaultInit(runctx_p ct, RefStor *rs, char *data,
31 runesize_t bytes, SemGroup *sg, int isglobal);
32 void freeRefStor(RefStor *rs);
34 #define REFSTOR_DEBUG 0
35 #define USE_CONTEXT_REFSTOR 1
38 #define REFSTOR_DEBUG_ARGS , const char *file, int line
39 #define REFSTOR_DEBUG_CALL , file, line
40 #define allocRefStor(op) allocRefStor_debug(op, __FILE__, __LINE__)
41 #define refsRefStor(rs) _refsRefStor(rs, __FILE__, __LINE__)
42 #define relsRefStor(rs) _relsRefStor(rs, __FILE__, __LINE__)
43 #define updateRefStor(prs, rs) \
44 _updateRefStor(prs, rs, __FILE__, __LINE__)
45 #define replaceRefStor(prs, rs) \
46 _replaceRefStor(prs, rs, __FILE__, __LINE__)
48 #define REFSTOR_DEBUG_ARGS
49 #define REFSTOR_DEBUG_CALL
50 #define allocRefStor(op) allocRefStor_norm(op)
51 #define refsRefStor(rs) _refsRefStor(rs)
52 #define relsRefStor(rs) _relsRefStor(rs)
53 #define updateRefStor(prs, rs) _updateRefStor(prs, rs)
54 #define replaceRefStor(prs, rs) _replaceRefStor(prs, rs)
59 _relsRefStor(RefStor *rs REFSTOR_DEBUG_ARGS)
63 printf("RELSREFSTOR %s/%d %p %d %s (%04x)\n",
64 file, line, rs, rs->rs_Refs - 1,
65 TypeToStr(rs->rs_Type, NULL), rs->rs_Op);
67 if (--rs->rs_Refs <= 0)
74 _refsRefStor(RefStor *rs REFSTOR_DEBUG_ARGS)
77 dassert(rs->rs_Refs > 0);
80 printf("REFSREFSTOR %s/%d %p %d (%04x)\n",
81 file, line, rs, rs->rs_Refs, rs->rs_Op);
88 _updateRefStor(RefStor **prs, RefStor *rs REFSTOR_DEBUG_ARGS)
90 _refsRefStor(rs REFSTOR_DEBUG_CALL);
91 _relsRefStor(*prs REFSTOR_DEBUG_CALL);
97 _replaceRefStor(RefStor **prs, RefStor *rs REFSTOR_DEBUG_ARGS)
99 _relsRefStor(*prs REFSTOR_DEBUG_CALL);
105 getExpTmpData(runctx_p ct, Exp *exp)
107 runesize_t offset = exp->ex_TmpOffset;
109 dassert_exp(exp, (exp->ex_Flags & EXF_TMP_OK) &&
110 offset + exp->ex_Type->ty_Bytes <= ct->ct_TmpBytes);
112 return(ct->ct_TmpData + offset);