#ifndef _INCLUDE_TITANIUM_CODE_H_ #define _INCLUDE_TITANIUM_CODE_H_ #define __SINST__ #include #include "using-std.h" class Decl; class FieldDecl; class MethodDecl; class TreeNode; class CodeContext; enum AssignKind { assignNormal, assignLocal, assignGlobal }; enum AssignType { assignNothing, assignUnknown, assignBoolean, assignByte, assignChar, assignDouble, assignFloat, assignInt, assignLong, assignVoid, assignShort, assignLP, assignGP, assignBulk }; extern string cFieldName(Decl *); extern string cMethodTypeString(const MethodDecl &); extern bool codeGen_libs; extern bool codeGen_main; extern string codeGen_outdir; extern bool compilerLocComments; #define compilerLoc() \ (compilerLocComments ? \ string("/*") + __FILE__ + ':' + int2string(__LINE__) + "*/" : \ string("")) // located in aux-code.cc extern const string locComment(TreeNode *t); // located in code-stmt.cc extern CodeContext * enclosingDeclContainer(TreeNode *t); // located in code-titan.cc extern const string int2string(int); extern const string long2hexstring(long); // OBSOLETE: TO BE REMOVED SOON: located in code-titan.cc #if 1 // OBSOLETE SECTION START extern char *int2str(int); extern char *long2hexstr(long); #endif // OBSOLETE SECTION END // defines to help to set points #define SET_POINT_INDEX_START(sep, arity) \ string("m7setThisIImT") sep int2string(string(arity).length() + 7) sep "tiPoint" sep (arity) sep "7domains2ti(" #define SET_POINT_INDEX_END(sep, index, value) \ (index) sep ',' sep value sep ')' #define NEW_POINT_1I_START(sep, arity) \ string("m3allImT") sep int2string(string(arity).length() + 7) sep "tiPoint" sep (arity) sep "7domains2ti(" #define NEW_POINT_1I_END() \ ')' // defines to help create domains #define NEW_RECTDOMAIN_3PT_MAX_START(sep, arity) \ string("m18createWithMaxPointT") sep int2string(string(arity).length() + 7) sep "tiPoint" sep (arity) sep "7domains2tiT" sep int2string(string(arity).length() + 7) sep "tiPoint" sep (arity) sep "7domains2tiT" sep int2string(string(arity).length() + 7) sep "tiPoint" sep (arity) sep "7domains2timT" sep int2string(string(arity).length() + 12) sep "tiRectDomain" sep (arity) sep "7domains2ti(" #define NEW_RECTDOMAIN_3PT_MAX_END() \ ')' #define NEW_RECTDOMAIN_3PT_UPB_START(sep, arity) \ string("m18createWithUpbPointT") sep int2string(string(arity).length() + 7) sep "tiPoint" sep (arity) sep "7domains2tiT" sep int2string(string(arity).length() + 7) sep "tiPoint" sep (arity) sep "7domains2tiT" sep int2string(string(arity).length() + 7) sep "tiPoint" sep (arity) sep "7domains2timT" sep int2string(string(arity).length() + 12) sep "tiRectDomain" sep (arity) sep "7domains2ti(" #define NEW_RECTDOMAIN_3PT_UPB_END() \ ')' #define NEW_RECTDOMAIN_DOMAIN_START(sep, arity) \ string("m") sep int2string(string(arity).length() + 12) sep "tiRectDomain" sep (arity) sep "PT" sep int2string(string(arity).length() + 8) sep "tiDomain" sep (arity) sep "7domains2timT" sep int2string(string(arity).length() + 12) sep "tiRectDomain" sep (arity) sep "7domains2ti(" #define NEW_RECTDOMAIN_DOMAIN_END() \ ')' #define NEW_RECTDOMAIN_EMPTY(sep, arity) \ string("m") sep int2string(string(arity).length() + 12) sep "tiRectDomain" sep (arity) sep "mT" sep int2string(string(arity).length() + 12) sep "tiRectDomain" sep (arity) sep "7domains2ti()" #define NEW_DOMAIN_EMPTY(sep, arity) \ string("m") sep int2string(string(arity).length() + 8) sep "tiDomain" sep (arity) sep "mPT" sep int2string(string(arity).length() + 8) sep "tiDomain" sep (arity) sep "7domains2ti()" // defines to use domains #define CAST_RECTDOMAIN_TO_DOMAIN(sep, arity) \ string("m7factoryT") sep int2string(string(arity).length() + 12) sep "tiRectDomain" sep (arity) sep "7domains2timT" sep int2string(string(arity).length() + 8) sep "tiDomain" sep (arity) sep "7domains2ti" // defines for mangling #define MANGLE_QID(sep, s) string(int2string((s).length())) sep (s) #define MANGLE_METH_HEAD(sep, namespace, s) string("m") sep namespace sep MANGLE_QID(sep, s) #define MANGLE_OP_HEAD(sep, s) string("o") sep MANGLE_QID(sep, s) #define MANGLE_FIELD(sep, s, typestr) string("f") sep MANGLE_QID(sep, s) sep typestr #define MANGLE_STACK_VAR(sep, s) string("a") sep MANGLE_QID(sep, s) #define MANGLE_TEMP(sep, s) string("t") sep MANGLE_QID(sep, s) #define MANGLE_THIS_VAR(sep) string("a4this") /* MANGLE_STACK_VAR(sep, "this") */ #define MANGLE_CLASS_INIT(sep, typestr) string("mi5initcm") sep typestr //#define MANGLE_CLASS_INST(sep, typestr) string("mi5initim") sep typestr // DOB: no longer used #define MANGLE_CLASS_DESC(sep, typestr) string("fi5cdesc") sep typestr #define MANGLE_CLASS_DTYP(sep, typestr) string("ti5cdescm") sep typestr #define MANGLE_CLASS_INTF(sep, typestr) string("fi4intf") sep typestr #define MANGLE_CLASS_EQUALS(sep, typestr) string("mi6equalsm") sep typestr #define MANGLE_CLASS_NULLLOC(sep, typestr) string("mi7nulllocm") sep typestr #define MANGLE_CLASS_BUILDST(sep, typestr) string("mi7buildstm") sep typestr #define MANGLE_INNER_CLASS_MARKER "C" #define MANGLE_METHOD_NAME_END_MARKER "m" #define MANGLE_TYPE_MARKER "T" #define MANGLE_TYPE_LOCAL_MARKER "L" #define MANGLE_TYPE_ILOCAL_MARKER "L" #define MANGLE_TYPE_GLOBAL_MARKER "P" #define MANGLE_TYPE_SHARED_MARKER "" #define MANGLE_TYPE_NONSHARED_MARKER "n" #define MANGLE_TYPE_POLYSHARED_MARKER "p" #define MANGLE_JAVA_ARRAY_TYPE_MARKER "A" #define MANGLE_TI_ARRAY_TYPE_MARKER "B" #define MANGLE_TI_POINT_TYPE_MARKER "P" #define MANGLE_TI_RECTDOMAIN_TYPE_MARKER "R" #define MANGLE_TI_DOMAIN_TYPE_MARKER "G" #define MANGLE_LOCAL_NAMESPACE_MARKER "l" #define MANGLE_LQI_NAMESPACE_MARKER "m" #define MANGLE_LQI_FORMAL_MARKER "M" #define MANGLE_NONSHARED_NAMESPACE_MARKER "n" #define MANGLE_POLYSHARED_NAMESPACE_MARKER "p" #define MANGLE_SHARING_INFERENCE_FORMAL_MARKER "s" #define MANGLE_GENERIC_MARKER "G" #define MANGLE_TI_LANG_THROWCLASSCASTEXCEPTION "m23throwClassCastExceptionmT11NativeUtils4lang2ti()" /* ti.lang.NativeUtils.throwClassCastException() */ #define MANGLE_TI_DOMAINS_RECTDOMAIN_TYPE(sep, arity) \ string("T") sep int2string(string(arity).length() + 12) sep "tiRectDomain" sep (arity) sep "7domains2ti" #define MANGLE_TI_DOMAINS_DOMAIN_TYPE(sep, arity) \ string("PT") sep int2string(string(arity).length() + 8) sep "tiDomain" sep (arity) sep "7domains2ti" #define MANGLE_TI_DOMAINS_POINT_TYPE(sep, arity) \ string("T") sep int2string(string(arity).length() + 7) sep "tiPoint" sep (arity) sep "7domains2ti" #define MANGLE_TI_DOMAINS_RECTDOMAIN_DISPATCH(sep, arity, fname, args) \ string("m") sep int2string(string(fname).length()) sep fname sep args sep "mT" sep int2string(string(arity).length() + 12) sep "tiRectDomain" sep (arity) sep "7domains2ti(" #define MANGLE_TI_DOMAINS_RECTDOMAIN_ARG(sep, arity) \ MANGLE_TI_DOMAINS_RECTDOMAIN_TYPE(sep, arity) #define MANGLE_TI_DOMAINS_DOMAIN_DISPATCH(sep, arity, fname, args) \ string("m") sep int2string(string(fname).length()) sep fname sep args sep "mT" sep int2string(string(arity).length() + 18) sep "tiMultiRectADomain" sep (arity) sep "7domains2ti(" #define MANGLE_TI_DOMAINS_POINT_ARG(sep, arity) \ MANGLE_TI_DOMAINS_POINT_TYPE(sep, arity) #define MANGLE_INT_ARG(sep) "I" #define MANGLE_TI_DOMAINS_POINT_DISPATCH(sep, name, arity, args) string("m") sep int2string(string(name).length()) sep name sep args sep "m" sep MANGLE_TI_DOMAINS_POINT_ARG(sep, arity) #define MANGLE_TI_DOMAINS_RECTDOMAIN_FIELD_ACCESS(sep, field, arity) \ string("f") sep string(int2string(string(field).length())) sep field sep "T" sep int2string(string(arity).length() + 12) sep "tiRectDomain" sep (arity) sep "7domains2ti" #define MANGLE_TI_DOMAINS_DOMAIN_GETRECTANGLES "m13getRectangles(" #define MANGLE_TI_DOMAINS_RDL_NEWITERATOR "m11newIterator(" #define MANGLE_TI_DOMAINS_RDL_ISEND "m5isEnd(" #define MANGLE_TI_DOMAINS_RDL_ADVANCE "m7advance(" #define MANGLE_TI_DOMAINS_RDL_DEREFERENCE "m11dereference(" #define MANGLE_TI_DOMAINS_POINT_GET(sep, arity) \ string("m3getImT") sep int2string(string(arity).length() + 7) sep "tiPoint" sep (arity) sep "7domains2ti(" #define MANGLE_TI_DOMAINS_POINT_CONSTRUCT(sep, arity) \ string("mi9constructmT") sep int2string(string(arity).length() + 7) sep "tiPoint" sep (arity) sep "7domains2ti(" #define MANGLE_TI_DOMAINS_POINT_EMPTY(sep, arity) \ string("mi5emptymT") sep int2string(string(arity).length() + 7) sep "tiPoint" sep (arity) sep "7domains2ti()" #define MANGLE_LOCAL_JAVA_LANG_STRING "LT6String4lang4java" #define MANGLE_TI_DOMAINS_POINTUTILS_TOSTRING(sep, arity) string("m8toString") sep MANGLE_TI_DOMAINS_POINT_ARG(sep, arity) sep "mT10PointUtils7domains2ti" #endif