#ifndef COGIT_H__
#define COGIT_H__
/* Automatically generated by
	MLVMCCodeGenerator Melchor-tonel.1 uuid: dbb34f09-5204-0e00-ac40-390a0b7f2457
 */


/*** Function Prototypes ***/


#if !PRODUCTION && defined(PlatformNoDbgRegParms)
# define NoDbgRegParms PlatformNoDbgRegParms
#endif

#if !defined(NoDbgRegParms)
# define NoDbgRegParms /*empty*/
#endif



#if !defined(NeverInline)
# define NeverInline /*empty*/
#endif

extern sqInt abortOffset(void);
extern void addCogMethodsToHeapMap(void);
extern sqInt bytecodePCForstartBcpcin(sqInt mcpc, sqInt startbcpc, CogMethod *cogMethod);
extern void callCogCodePopReceiver(void);
extern void callCogCodePopReceiverAndClassRegs(void);
extern sqInt ceCPICMissreceiver(CogMethod *cPIC, sqInt receiver);
extern void ceFree(void *pointer);
extern void* ceMalloc(size_t size);
extern sqInt ceSICMiss(sqInt receiver);
extern void checkAssertsEnabledInCogit(void);
extern sqInt checkIntegrityOfObjectReferencesInCode(sqInt gcModes);
extern char * codeEntryFor(char *address);
extern char * codeEntryNameFor(char *address);
extern sqInt cogCodeBase(void);
extern sqInt cogCodeConstituents(sqInt withDetails);
extern CogMethod * cogFullBlockMethodnumCopied(sqInt aMethodObj, sqInt numCopied);
extern void cogitPostGCAction(sqInt gcMode);
extern sqInt cogMethodDoesntLookKosher(CogMethod *cogMethod);
extern CogMethod * cogMNUPICSelectorreceivermethodOperandnumArgs(sqInt selector, sqInt rcvr, sqInt methodOperand, sqInt numArgs);
extern CogMethod * cogselector(sqInt aMethodObj, sqInt aSelectorOop);
extern void compactCogCompiledCode(void);
extern sqInt defaultCogCodeSize(void);
extern void enterCogCodePopReceiver(void);
extern void followForwardedLiteralsIn(CogMethod *cogMethod);
extern void followForwardedMethods(void);
extern void freeUnmarkedMachineCode(void);
extern sqInt getBlockCompilationCount(void);
extern sqInt getBlockCompilationMSecs(void);
extern sqInt getMethodCompilationCount(void);
extern sqInt getMethodCompilationMSecs(void);
extern void initializeCodeZoneFromupTo(sqInt startAddress, sqInt endAddress);
extern sqInt isPCWithinMethodZone(void *address);
extern sqInt isSendReturnPC(sqInt retpc);
extern void linkSendAtintooffsetreceiver(sqInt callSiteReturnAddress, CogMethod *sendingMethod, CogMethod *targetMethod, sqInt theEntryOffset, sqInt receiver);
extern void mapObjectReferencesInMachineCode(sqInt gcMode);
extern void markAndTraceMachineCodeOfMarkedMethods(void);
extern void markMethodAndReferents(CogMethod *aCogMethod);
extern usqInt maxCogMethodAddress(void);
extern usqInt mcPCForBackwardBranchstartBcpcin(sqInt bcpc, sqInt startbcpc, CogMethod *cogMethod);
extern sqInt minCogMethodAddress(void);
extern sqInt mnuOffset(void);
extern sqInt patchToOpenPICFornumArgsreceiver(sqInt selector, sqInt numArgs, sqInt receiver);
extern void printCogMethodFor(void *address);
extern void printTrampolineTable(void);
extern void printWhereIs(void *address);
extern sqInt recordPrimTraceFunc(void);
extern void safeFreeMethod(sqInt cogMethod);
extern void setBreakMethod(sqInt anObj);
extern void setPostCompileHook(void (*aFunction)(CogMethod *));
extern void setSelectorOfto(CogMethod *cogMethod, sqInt aSelectorOop);
extern int sizeOfTrampoline(char *address);
extern sqInt traceLinkedSendOffset(void);
extern void unlinkAllSends(void);
extern void unlinkSendsLinkedForInvalidClasses(void);
extern void unlinkSendsOfisMNUSelector(sqInt selector, sqInt isMNUSelector);
extern void unlinkSendsToFree(void);
extern void unlinkSendsToandFreeIf(sqInt targetMethodObject, sqInt freeIfTrue);
extern void addAllToYoungReferrers(void);
extern void freeMethod(CogMethod *cogMethod);
extern CogMethod * methodFor(void *address);
extern sqInt methodsCompiledToMachineCodeInto(sqInt arrayObj);
extern sqInt numMethods(void);
extern sqInt numMethodsOfType(sqInt cogMethodType);
extern void printCogMethods(void);
extern void printCogMethodsOfType(sqInt cmType);
extern void printCogMethodsWithMethod(sqInt methodOop);
extern void printCogMethodsWithPrimitive(sqInt primIdx);
extern void printCogMethodsWithSelector(sqInt selectorOop);
extern void printCogYoungReferrers(void);
extern sqInt printOpenPICList(void);
extern char * whereIsMaybeCodeThing(sqInt anOop);
extern sqInt numRegArgs(void);
extern sqInt genQuickReturnConst(void);
extern sqInt genQuickReturnInstVar(void);
extern sqInt genQuickReturnSelf(void);
extern sqInt mapPCDataForinto(CogMethod *cogMethod, sqInt arrayObj);
extern void recordCallOffsetIn(CogMethod *cogMethod);
extern void rewritePrimInvocationInto(CogMethod *cogMethod, void (*primFunctionPointer)(void));
extern void voidCogCompiledCode(void);
extern void callCogCodePopReceiverArg0Regs(void);
extern void callCogCodePopReceiverArg1Arg0Regs(void);
extern sqInt profilingDataForinto(CogMethod *cogMethod, sqInt arrayObj);


/*** Global Variables ***/
VM_EXPORT extern sqInt breakPC;
VM_EXPORT extern void * CFramePointer;
VM_EXPORT extern void * CStackPointer;
VM_EXPORT extern sqInt cbEntryOffset;
VM_EXPORT extern sqInt cbNoSwitchEntryOffset;
VM_EXPORT extern sqInt ceBaseFrameReturnTrampoline;
VM_EXPORT extern void (*ceCall0ArgsPIC)(void);
VM_EXPORT extern void (*ceCall1ArgsPIC)(void);
VM_EXPORT extern void (*ceCall2ArgsPIC)(void);
VM_EXPORT extern void (*ceCallCogCodePopReceiverAndClassRegs)(void);
VM_EXPORT extern void (*ceCallCogCodePopReceiverArg0Regs)(void);
VM_EXPORT extern void (*ceCallCogCodePopReceiverArg1Arg0Regs)(void);
VM_EXPORT extern void (*ceCallCogCodePopReceiverReg)(void);
VM_EXPORT extern sqInt ceCannotResumeTrampoline;
VM_EXPORT extern void (*ceCaptureCStackPointers)(void);
VM_EXPORT extern sqInt ceCheckForInterruptTrampoline;
VM_EXPORT extern void (*ceEnterCogCodePopReceiverReg)(void);
VM_EXPORT extern usqIntptr_t (*ceGetFP)(void);
VM_EXPORT extern usqIntptr_t (*ceGetSP)(void);
VM_EXPORT extern sqInt ceReturnToInterpreterTrampoline;
VM_EXPORT extern usqIntptr_t (*ceTryLockVMOwner)(void);
VM_EXPORT extern void (*ceUnlockVMOwner)(void);
VM_EXPORT extern sqInt cFramePointerInUse;
VM_EXPORT extern sqInt cmEntryOffset;
VM_EXPORT extern sqInt cmNoCheckEntryOffset;
VM_EXPORT extern usqIntptr_t debugPrimCallStackOffset;
VM_EXPORT extern sqInt missOffset;
VM_EXPORT extern void (*realCECallCogCodePopReceiverAndClassRegs)(void);
VM_EXPORT extern void (*realCECallCogCodePopReceiverArg0Regs)(void);
VM_EXPORT extern void (*realCECallCogCodePopReceiverArg1Arg0Regs)(void);
VM_EXPORT extern void (*realCECallCogCodePopReceiverReg)(void);
VM_EXPORT extern void (*realCEEnterCogCodePopReceiverReg)(void);
VM_EXPORT extern int traceFlags ;
VM_EXPORT extern sqInt traceStores;


/*** Macros ***/
#define blockAlignment() 8
#define breakOnImplicitReceiver() (traceFlags & 64)
#define ceBaseFrameReturnPC() ceBaseFrameReturnTrampoline
#define ceCannotResumePC() ((usqInt)ceCannotResumeTrampoline)
#define ceReturnToInterpreterPC() ((usqInt)ceReturnToInterpreterTrampoline)
#define cogitTryLockVMOwner() (ceTryLockVMOwner() != 0)
#define cogitUnlockVMOwner() ceUnlockVMOwner()
#define entryOffset() cmEntryOffset
#define getCFramePointer() CFramePointer
#define getCStackPointer() CStackPointer
#define interpretOffset() missOffset
#define maxCogCodeSize() (16*1024*1024)
#define noCheckEntryOffset() cmNoCheckEntryOffset
#define printOnTrace() (traceFlags & 1)
#define recordBlockTrace() (traceFlags & 4)
#define recordEventTrace() (traceFlags & 16)
#define recordOverflowTrace() (traceFlags & 32)
#define recordPrimTrace() (traceFlags & 8)
#define recordSendTrace() (traceFlags & 2)
#define setCFramePointer(theFP) (CFramePointer = (void *)(theFP))
#define setCStackPointer(theSP) (CStackPointer = (void *)(theSP))
#define fullBlockEntryOffset() cbEntryOffset
#define fullBlockNoContextSwitchEntryOffset() cbNoSwitchEntryOffset

#endif