MCPcopy Create free account
hub / github.com/beefytech/Beef / WriteTypeData

Method WriteTypeData

IDEHelper/Linker/BlCodeView.cpp:733–822  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

731}
732
733void BlCodeView::WriteTypeData(int streamId, BlTypeInfo& typeInfo)
734{
735 int hashStream = StartStream();
736 int pos = 0;
737 uint8 tempData[0x10002];
738
739 int hashBucketsSize = 0x3FFFF;
740 int numTags = typeInfo.mCurTagId - 0x1000;
741
742 struct _JumpEntry
743 {
744 int mTypeIdx;
745 int mOfs;
746 };
747
748 Array<_JumpEntry> indexEntries;
749 uint8* curChunk = NULL;
750
751 typeInfo.mData.SetReadPos(0);
752 for (int tagId = 0x1000; tagId < typeInfo.mCurTagId; tagId++)
753 {
754 // Align
755 typeInfo.mData.mReadCurPtr = (uint8*)(((intptr)typeInfo.mData.mReadCurPtr + 3) & ~3);
756
757 // Chunks are every 8k, which is perfect for the jump table
758 if (curChunk != typeInfo.mData.mReadCurAlloc)
759 {
760 indexEntries.Add({ tagId, typeInfo.mData.GetReadPos() });
761 curChunk = typeInfo.mData.mReadCurAlloc;
762 }
763
764 uint8* dataHead = (uint8*)typeInfo.mData.FastRead(tempData, 4);
765 // Pointer not valid
766 uint8* data = dataHead;
767 int trLength = GET(uint16);
768 if (dataHead == tempData)
769 {
770 typeInfo.mData.Read(tempData + 4, trLength - 2);
771 }
772 else
773 {
774 uint8* leafData = (uint8*)typeInfo.mData.FastRead(tempData + 4, trLength - 2);
775 if (leafData != dataHead + 4)
776 {
777 memcpy(tempData, dataHead, 4);
778 dataHead = tempData;
779 }
780 }
781
782 data = dataHead;
783 int32 hashVal = BlHash::GetTypeHash(data) % hashBucketsSize;
784 mWriter.WriteT(hashVal);
785
786 //typeInfo.mData.TryGetPtr
787 }
788
789 mWriter.Write(&indexEntries[0], (int)indexEntries.size() * 8);
790

Callers

nothing calls this directly

Calls 9

SetReadPosMethod · 0.80
GetReadPosMethod · 0.80
FastReadMethod · 0.80
AddMethod · 0.45
ReadMethod · 0.45
WriteTMethod · 0.45
WriteMethod · 0.45
sizeMethod · 0.45
GetSizeMethod · 0.45

Tested by

no test coverage detected