#ifndef COGIT_H__
#define COGIT_H__
/* Automatically generated by
	MLVMCCodeGenerator Melchor-tonel.1 uuid: 58962f5d-dbff-0d00-a4de-9e2607f47eec
 */


/*** 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 void cogMethodIfPossibleselector(sqInt _methodOrSelectorIndex, sqInt _selector);
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 patchToMegamorphicICFornumArgsreceiver(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 setHeaderOopOfto(CogMethod *_cogMethod, sqInt _aMethodHeaderOop);
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 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