MCPcopy Create free account
hub / github.com/WheretIB/nullc / FixupPointer

Method FixupPointer

NULLC/Executor.cpp:1990–2013  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1988}
1989
1990void Executor::FixupPointer(char* ptr, const ExternTypeInfo& type)
1991{
1992 char **rPtr = (char**)ptr;
1993 if(*rPtr > (char*)0x00010000)
1994 {
1995 if(*rPtr >= ExPriv::oldBase && *rPtr < (ExPriv::oldBase + ExPriv::oldSize))
1996 {
1997// printf("\tFixing from %p to %p\r\n", ptr, ptr - ExPriv::oldBase + ExPriv::newBase);
1998
1999 *rPtr = *rPtr - ExPriv::oldBase + ExPriv::newBase;
2000 }else{
2001 ExternTypeInfo &subType = exTypes[type.subType];
2002// printf("\tGlobal pointer %s %p (at %p)\r\n", symbols + subType.offsetToName, *rPtr, ptr);
2003 markerType *marker = (markerType*)((char*)*rPtr - sizeof(markerType));
2004// printf("\tMarker is %d\r\n", *marker);
2005 if(NULLC::IsBasePointer(*rPtr) && (*marker & 1))
2006 {
2007 *marker &= ~1;
2008 if(type.subCat != ExternTypeInfo::CAT_NONE)
2009 FixupVariable(*rPtr, subType);
2010 }
2011 }
2012 }
2013}
2014
2015void Executor::FixupArray(char* ptr, const ExternTypeInfo& type)
2016{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected