Library: verify the simplest possible allocation
...by inspecting the raw memory locations -- looks good thus far...
This commit is contained in:
parent
e8d9dcd9bf
commit
037a5f2dd0
2 changed files with 57 additions and 11 deletions
|
|
@ -205,18 +205,47 @@ namespace test {
|
|||
CHECK (0 == clu.numExtents());
|
||||
CHECK (0 == clu.numBytes());
|
||||
|
||||
auto i1 = clu.create<uint16_t> (1 + uint16_t(rand()));
|
||||
SHOW_EXPR(clu.storage_.rest);
|
||||
SHOW_EXPR(size_t(clu.storage_.pos));
|
||||
CHECK (nullptr == clu.storage_.pos);
|
||||
CHECK ( 0 == clu.storage_.rest);
|
||||
|
||||
auto& i1 = clu.create<uint16_t> (1 + uint16_t(rand()));
|
||||
CHECK (i1 > 0);
|
||||
CHECK (1 == clu.numExtents());
|
||||
SHOW_EXPR(clu.numBytes())
|
||||
CHECK (2 == clu.numBytes());
|
||||
SHOW_EXPR(clu.storage_.rest);
|
||||
SHOW_EXPR(clu.storage_.pos);
|
||||
SHOW_EXPR(size_t(clu.storage_.pos));
|
||||
CHECK (clu.storage_.pos != nullptr);
|
||||
CHECK (clu.storage_.rest == BLOCKSIZ - (2*sizeof(void*) + sizeof(uint16_t)));
|
||||
|
||||
byte* blk = static_cast<std::byte*>(clu.storage_.pos);
|
||||
SHOW_EXPR(blk);
|
||||
CHECK (blk);
|
||||
SHOW_EXPR(size_t(blk));
|
||||
blk += clu.storage_.rest - BLOCKSIZ;
|
||||
SHOW_EXPR(blk);
|
||||
SHOW_EXPR(blk[0]);
|
||||
SHOW_EXPR(size_t(blk));
|
||||
SHOW_EXPR((size_t*)blk);
|
||||
CHECK(size_t(blk) < size_t(clu.storage_.pos));
|
||||
|
||||
auto currBlock = [&]{
|
||||
byte* blk = static_cast<std::byte*>(clu.storage_.pos);
|
||||
blk += clu.storage_.rest - BLOCKSIZ;
|
||||
return blk;
|
||||
};
|
||||
auto slot = [&](size_t i)
|
||||
{
|
||||
size_t* slot = reinterpret_cast<size_t*> (currBlock());
|
||||
return slot[i];
|
||||
};
|
||||
auto posOffset = [&]{
|
||||
return size_t(clu.storage_.pos) - size_t(currBlock());
|
||||
};
|
||||
SHOW_EXPR(size_t(currBlock()))
|
||||
SHOW_EXPR(slot(0))
|
||||
SHOW_EXPR(slot(1))
|
||||
SHOW_EXPR(size_t(clu.storage_.pos) - size_t(currBlock()))
|
||||
CHECK (posOffset() == 2 * sizeof(void*) + sizeof(uint16_t));
|
||||
CHECK (slot(0) == 0);
|
||||
}
|
||||
CHECK (0==checksum);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -81698,7 +81698,18 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<node COLOR="#338800" CREATED="1715820259913" ID="ID_13842300" MODIFIED="1716563038609" TEXT="Check für zu große Objekte">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1716563047722" ID="ID_848423419" MODIFIED="1716563055539" TEXT="Storage-Diagnose">
|
||||
<node COLOR="#338800" CREATED="1716563047722" ID="ID_848423419" MODIFIED="1716566615378" TEXT="Storage-Diagnose">
|
||||
<richcontent TYPE="NOTE"><html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<p>
|
||||
muß hier leider eine schecklicke low-level-Trickserei machen; das ist die Konsequenz der Entscheidung, mit dem absolut minimalen Storage-Overhead zu arbeiten, und außerdem muß ich auch noch das Non-Copyable <i>aushebeln...</i>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
</richcontent>
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1715820289221" ID="ID_1541316374" MODIFIED="1716130701433" TEXT="Überlauf: neuen Block belegen">
|
||||
|
|
@ -81898,11 +81909,17 @@ Date:   Thu Apr 20 18:53:17 2023 +0200<br/>
|
|||
<arrowlink COLOR="#4173be" DESTINATION="ID_1783945506" ENDARROW="Default" ENDINCLINATION="204;17;" ID="Arrow_ID_1547348126" STARTARROW="None" STARTINCLINATION="292;-22;"/>
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1716552160019" ID="ID_146077309" MODIFIED="1716552282949" TEXT="die Mechanik überhaupt erst mal zum Laufen bekommen">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1716552160019" ID="ID_146077309" MODIFIED="1716566510566" TEXT="die Mechanik überhaupt erst mal zum Laufen bekommen">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1716552180480" ID="ID_1382140920" MODIFIED="1716566512774" TEXT="eine Allokation im bestehenden Extent">
|
||||
<icon BUILTIN="pencil"/>
|
||||
<node COLOR="#338800" CREATED="1716566627518" ID="ID_874153150" MODIFIED="1716566633607" TEXT="sieht erst mal gut aus">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node COLOR="#338800" CREATED="1716566635117" ID="ID_674171131" MODIFIED="1716566656562" TEXT="lokale abkürzungs-λ im Test">
|
||||
<icon BUILTIN="button_ok"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1716552180480" ID="ID_1382140920" MODIFIED="1716552189738" TEXT="eine Allokation im bestehenden Extent">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
</node>
|
||||
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1716552190584" ID="ID_1042988047" MODIFIED="1716552206544" TEXT="einen Überlauf provozieren">
|
||||
<icon BUILTIN="flag-yellow"/>
|
||||
|
|
|
|||
Loading…
Reference in a new issue