MWCC/compiler_and_linker/unsorted/CClass.c

176 lines
7.8 KiB
C
Raw Normal View History

2022-11-07 03:06:21 +00:00
#include "compiler/CClass.h"
#include "compiler/CError.h"
#include "compiler/CInline.h"
#include "compiler/CMangler.h"
#include "compiler/CParser.h"
#include "compiler/CompilerTools.h"
#include "compiler/CodeGen.h"
#include "compiler/objects.h"
2022-11-07 03:06:21 +00:00
typedef struct OVClassBase {
struct OVClassBase *next;
struct OVClass *ovclass;
Boolean is_virtual;
} OVClassBase;
typedef struct OVFunc {
struct OVFunc *next;
Object *obj;
struct OVClass *ovc8;
struct OVFunc *ovfC;
struct OVFunc *ovf10;
} OVFunc;
typedef struct OVClass {
TypeClass *tclass;
OVFunc *vfuncs;
OVClassBase *bases;
SInt32 offset;
SInt32 voffset;
Boolean alloced_vtable;
} OVClass;
typedef struct ThunkList {
struct ThunkList *next;
Object *thunkobj;
Object *obj;
SInt32 a;
SInt32 b;
SInt32 c;
} ThunkList;
2022-11-07 03:06:21 +00:00
static TypeClass *main_class;
static ThunkList *cclass_thunklist;
2022-11-07 03:06:21 +00:00
static TypeClass *cclass_isbase_mostderived;
static void *cclass_isbase_foundoffset; // TODO type
static Boolean cclass_isambigbase;
static short cclass_founddepth;
static void *vtable_object_data; // TODO type
static void *vtable_data_size; // TODO type
static VTableObjectLink *vtable_object_links;
static TypeClass *cclass_vbase;
static OVClass *cclass_ovbase;
static OVClass *cclass_root;
static Object *found_pure;
static Boolean check_pures;
static Object *cclass_dominator_vobject;
static SInt32 cclass_dominator_voffset;
static Object *cclass_dominator_oobject;
static TypeClass *cclass_dominator_oclass;
static SInt32 cclass_dominator_ooffset;
static Object *cclass_dominator_eobject;
void CClass_Init(void) {}
void CClass_GenThunks(void) {
ThunkList *list;
for (list = cclass_thunklist; list; list = list->next) {
list->obj->flags |= OBJECT_FLAGS_4;
CodeGen_GenVDispatchThunk(list->thunkobj, list->obj, list->a, list->b, list->c);
}
}
static Object *CClass_ThunkObject(Object *obj, SInt32 a, SInt32 b, SInt32 c) {
Object *thunkobj;
ThunkList *list;
CInline_ObjectAddrRef(obj);
for (list = cclass_thunklist; list; list = list->next) {
if (obj == list->obj && a == list->a && b == list->b && c == list->c)
return list->thunkobj;
}
thunkobj = CParser_NewCompilerDefFunctionObject();
thunkobj->name = CMangler_ThunkName(obj, a, b, c);
thunkobj->type = TYPE(&rt_func);
thunkobj->sclass = TK_EXTERN;
thunkobj->qual = Q_20000;
thunkobj->u.func.linkname = thunkobj->name;
list = galloc(sizeof(ThunkList));
list->thunkobj = thunkobj;
list->obj = obj;
list->a = a;
list->b = b;
list->c = c;
list->next = cclass_thunklist;
cclass_thunklist = list;
return thunkobj;
}
2022-11-07 03:06:21 +00:00
static Boolean CClass_IsZeroOffsetClass(TypeClass *a, TypeClass *b) {}
static UInt8 CClass_IsCovariantResult(Type *a, UInt32 qualA, Type *b, UInt32 qualB) {}
UInt8 CClass_GetOverrideKind(TypeFunc *a, TypeFunc *b, Boolean errorflag) {}
Boolean CClass_IsEmpty(TypeClass *tclass) {}
Boolean CClass_IsNonStaticMemberFunc(TypeMethod *tmethod) {}
Object *CClass_DefaultConstructor(TypeClass *tclass) {}
Object *CClass_DummyDefaultConstructor(TypeClass *tclass) {}
ENode *CClass_DefaultConstructorCall(TypeClass *a, TypeClass *b, ENode *expr, SInt32 unkshortparam, Boolean flag1, Boolean flag2, Boolean *errorflag) {}
Object *CClass_AssignmentOperator(TypeClass *tclass) {}
Object *CClass_CopyConstructor(TypeClass *tclass) {}
NameSpaceObjectList *CClass_MemberObject(TypeClass *tclass, HashNameNode *name) {}
NameSpaceObjectList *CClass_Constructor(TypeClass *tclass) {}
2022-11-07 03:06:21 +00:00
Object *CClass_Destructor(TypeClass *tclass) {}
Boolean CClass_IsConstructor(Object *obj) {}
Boolean CClass_IsDestructor(Object *obj) {}
Boolean CClass_IsPODClass(TypeClass *tclass) {}
Boolean CClass_IsTrivialCopyClass(TypeClass *tclass) {}
Boolean CClass_IsTrivialCopyAssignClass(TypeClass *tclass) {}
Boolean CClass_ReferenceArgument(TypeClass *tclass) {}
BClassList *CClass_GetPathCopy(BClassList *path, Boolean is_global) {}
BClassList *CClass_AppendPath(BClassList *a, BClassList *b) {}
static AccessType CClass_GetPathAccess(BClassList *path) {}
Boolean CClass_IsMoreAccessiblePath(BClassList *path1, BClassList *path2) {}
static BClassList *CClass_GetBasePathRec(TypeClass *a, TypeClass *b, SInt32 offset, short depth) {}
BClassList *CClass_GetBasePath(TypeClass *a, TypeClass *b, short *founddepth, Boolean *isambigbase) {}
Boolean CClass_IsBaseClass(TypeClass *a, TypeClass *b, short *founddepth, Boolean pathcheckflag, Boolean ambigerrorflag) {}
TypeClass *CClass_GetQualifiedClass(void) {}
ENode *CClass_AccessPathCast(BClassList *path, ENode *expr, Boolean flag) {}
ENode *CClass_ClassPointerCast(ENode *expr, TypeClass *a, TypeClass *b, Boolean typconflag, Boolean ambigerrorflag, Boolean pathcheckflag) {}
ENode *CClass_DirectBasePointerCast(ENode *expr, TypeClass *a, TypeClass *b) {}
SInt32 CClass_GetPathOffset(BClassList *path) {}
Boolean CClass_ClassDominates(TypeClass *a, TypeClass *b) {}
SInt32 CClass_VirtualBaseOffset(TypeClass *a, TypeClass *b) {}
SInt32 CClass_VirtualBaseVTableOffset(TypeClass *a, TypeClass *b) {}
SInt32 CClass_GetMemberOffset(TypeClass *tclass, HashNameNode *name, ObjMemberVar **obj) {}
Boolean CClass_OverridesBaseMember(TypeClass *tclass, HashNameNode *name, Object *obj) {}
static OVClass *CClass_FindOVClass(OVClass *ovclass, TypeClass *tclass, SInt32 offset) {}
static OVClass *CClass_BuildOVClassTree(OVClass *root, TypeClass *tclass, SInt32 offset, SInt32 voffset) {}
static Boolean CClass_IsBaseOf(OVClass *a, OVClass *b) {}
static void CClass_FindOVFunc(OVClass *a, OVClass *b, OVFunc *func) {}
static TypeList *CClass_GetCoVariantClassList(TypeList *list, TypeClass *tclass, Object *func, Boolean flag) {}
static TypeMethod *CClass_GetCovariantType(TypeMethod *tmethod, Type *type) {}
static Object *CClass_FindCovariantFunction(Object *func, Type *type) {}
static ObjectList *CClass_DeclareCovariantFuncs(ObjectList *list, Object *func, TypeClass *tclass) {}
void CClass_DefineCovariantFuncs(Object *method, CI_FuncData *ifuncdata) {}
static void CClass_OverrideOVClassTree(OVClass *ovclass) {}
static void CClass_AllocVTableRec(OVClass *ovclass) {}
static Object *CClass_CheckClass(OVClass *ovclass, Boolean errorflag) {}
static void CClass_AllocVTable(TypeClass *tclass) {}
static Object *CClass_CheckVirtuals(TypeClass *tclass) {}
static void CClass_CheckVirtualBaseOverrides(OVClass *a, OVClass *b, Boolean flag) {}
static void CClass_CheckHideVirtual(OVClass *a, OVClass *b) {}
void CClass_CheckOverrides(TypeClass *tclass) {}
static void CClass_FindDominator(TypeClass *tclass1, SInt32 offset1, Object *object1, TypeClass *tclass2, SInt32 offset2, TypeClass *base) {}
static void CClass_ConstructVTable(TypeClass *tclass, SInt32 voffset, SInt32 offset, TypeClass *base) {}
void CClass_ClassDefaultFuncAction(TypeClass *tclass) {}
void CClass_ClassAction(TypeClass *tclass) {}
void CClass_MakeStaticActionClass(TypeClass *tclass) {}
Object *CClass_CheckPures(TypeClass *tclass) {}
void CClass_MemberDef(Object *obj, TypeClass *tclass) {}
Object *CClass_ThisSelfObject(void) {}
ENode *CClass_CreateThisSelfExpr(void) {}
static Boolean CClass_BaseMemberAccess(BClassList *path, AccessType access) {}
static Boolean CClass_CanAccess(BClassList *path, AccessType access) {}
void CClass_CheckPathAccess(BClassList *path, Object *obj, AccessType access) {}
static BClassList *CClass_PathCleanup(BClassList *path, TypeClass *tclass) {}
void CClass_CheckStaticAccess(BClassList *path, TypeClass *tclass, AccessType access) {}
void CClass_CheckObjectAccess(BClassList *path, Object *obj) {}
void CClass_CheckEnumAccess(BClassList *path, ObjEnumConst *objec) {}
static Type *CClass_PointerTypeCopy(Type *type) {}
Type *CClass_CombineClassAccessQualifiers(Type *type, UInt32 qual1, UInt32 qual2, UInt32 *outflags) {}
static void CClass_OptimizeBitFieldAccess(Type **type, SInt32 *offset) {}
ENode *CClass_AccessMember(ENode *classexpr, Type *type, UInt32 qual, SInt32 offset) {}