Skip to content

Commit 5d03efb

Browse files
author
cpprefjp-autoupdate
committed
update automatically
1 parent 0bf510c commit 5d03efb

3 files changed

Lines changed: 67 additions & 37 deletions

File tree

‎reference/memory/pointer_tag_pair.html‎

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@
189189
<p class="text-right"><small>
190190
最終更新日時:
191191
<time itemprop="datePublished" class="js-local-time"
192-
datetime="2026-09-08T15:10:34+09:00">
193-
2026年09月08日 15時10分34秒 (JST)
192+
datetime="2026-09-25T22:08:17+09:00">
193+
2026年09月25日 22時08分17秒 (JST)
194194
</time>
195195
<br/>
196196
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
@@ -291,6 +291,28 @@ <h2>説明専用エンティティ</h2>
291291
</code></pre></div>
292292
</p>
293293
<p>また、コンストラクタなどの制約には説明専用コンセプト<code><a href="tagging-compatible-pointee.html">tagging-compatible-pointee</a></code>を使用する。</p>
294+
<h2>備考</h2>
295+
<h3>応用事例</h3>
296+
<p>ポインタタギングは広く使われている手法である。代表的な応用例を以下に挙げる。</p>
297+
<ul>
298+
<li>LLVMは<code>PointerIntPair</code>と<code>PointerUnion</code>として同種のクラスを提供している。本クラスと同じく、指す先のアライメントから使えるビット数を求め、下位ビットへ小さな整数値や型の判別情報を格納する<ul>
299+
<li><a href="https://llvm.org/docs/ProgrammersManual.html#the-pointerintpair-class" target="_blank">The PointerIntPair class - LLVM Programmer's Manual</a></li>
300+
</ul>
301+
</li>
302+
<li>CPythonのガベージコレクタは、収集対象のオブジェクトをつなぐ双方向リストのポインタにフラグを埋め込む。<code>_gc_prev</code>の下位2ビットに「収集中か」と「ファイナライズ済みか」を格納し、収集の最中は<code>_gc_next</code>の最下位ビットに「到達不能と暫定判定されたか」を格納する。オブジェクト1個あたりの追加メモリを増やさずにフラグを持たせるための最適化である<ul>
303+
<li><a href="https://github.com/python/cpython/blob/main/InternalDocs/garbage_collector.md" target="_blank">Garbage collector design - CPython Internals Docs</a></li>
304+
</ul>
305+
</li>
306+
<li><code><a href="../atomic/atomic.html">std::atomic</a>&lt;<a href="shared_ptr.html">std::shared_ptr</a>&lt;T&gt;&gt;</code>のlibstdc++とMSVCの実装は、制御ブロックへのポインタの最下位ビットをスピンロックのフラグに使用する。指す先のオブジェクトへのポインタではなく制御ブロックへのポインタを選ぶのは、制御ブロックの確保をライブラリ側が行うためアライメントを保証できるからである<ul>
307+
<li><a href="https://devblogs.microsoft.com/oldnewthing/20241219-00/?p=110663" target="_blank">Inside STL: The atomic shared_ptr - The Old New Thing</a></li>
308+
</ul>
309+
</li>
310+
<li>レイトレーシングのpbrtは、形状やマテリアルなど多数の型を仮想関数なしで扱うために<code>TaggedPointer</code>を使う。こちらは下位ビットではなく上位7ビット (ビット57以上) に型の番号を格納し、128種類までの型を判別して、型に応じた処理を呼び分ける<ul>
311+
<li><a href="https://pbr-book.org/4ed/Utilities/Containers_and_Memory_Management" target="_blank">B.4.4 Tagged Pointers - Physically Based Rendering</a></li>
312+
</ul>
313+
</li>
314+
</ul>
315+
<p>pbrtのように上位ビットを使う方法は、アドレス空間が64ビット全体を使わないことに依存するため、対象とする環境を限定する。上位ビットを無視するハードウェア機構としては、IntelのLAM (linear address masking)、AMDのUAI (upper address ignore)、ARMのTBI (top byte ignore) などがある。</p>
294316
<h2>メンバ関数</h2>
295317
<h3>構築・破棄</h3>
296318
<table border="1" bordercolor="#888" style="border-collapse:collapse">

‎rss.xml‎

Lines changed: 42 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,50 @@
22
<feed xmlns="http://www.w3.org/2005/Atom">
33
<title>cpprefjp - C++日本語リファレンス</title>
44
<link href="https://cpprefjp.github.io" />
5-
<updated>2026-09-24T18:34:29.333174</updated>
6-
<id>3fdbe057-b464-41e6-88ac-40bc1561f940</id>
5+
<updated>2026-09-25T13:10:18.228310</updated>
6+
<id>e3d7acbc-8f20-45a2-85ea-fc84b56e1815</id>
77

88

9+
<entry>
10+
<title>pointer_tag_pair -- pointer_tag_pair : 応用事例を記載</title>
11+
<link href="https://cpprefjp.github.io/reference/memory/pointer_tag_pair.html"/>
12+
<id>a3828624ef73f273f917ea7a59a0ba88ba1f8222:reference/memory/pointer_tag_pair.md</id>
13+
<updated>2026-09-25T22:08:17+09:00</updated>
14+
15+
<summary type="html">&lt;pre&gt;&lt;code&gt;diff --git a/reference/memory/pointer_tag_pair.md b/reference/memory/pointer_tag_pair.md
16+
index f2e97a387..e8f2b5918 100644
17+
--- a/reference/memory/pointer_tag_pair.md
18+
+++ b/reference/memory/pointer_tag_pair.md
19+
@@ -76,6 +76,21 @@ namespace std {
20+
21+
また、コンストラクタなどの制約には説明専用コンセプト[`tagging-compatible-pointee`](tagging-compatible-pointee.md)を使用する。
22+
23+
+## 備考
24+
+### 応用事例
25+
+ポインタタギングは広く使われている手法である。代表的な応用例を以下に挙げる。
26+
+
27+
+- LLVMは`PointerIntPair`と`PointerUnion`として同種のクラスを提供している。本クラスと同じく、指す先のアライメントから使えるビット数を求め、下位ビットへ小さな整数値や型の判別情報を格納する
28+
+ - [The PointerIntPair class - LLVM Programmer&amp;#39;s Manual](https://llvm.org/docs/ProgrammersManual.html#the-pointerintpair-class)
29+
+- CPythonのガベージコレクタは、収集対象のオブジェクトをつなぐ双方向リストのポインタにフラグを埋め込む。`_gc_prev`の下位2ビットに「収集中か」と「ファイナライズ済みか」を格納し、収集の最中は`_gc_next`の最下位ビットに「到達不能と暫定判定されたか」を格納する。オブジェクト1個あたりの追加メモリを増やさずにフラグを持たせるための最適化である
30+
+ - [Garbage collector design - CPython Internals Docs](https://github.com/python/cpython/blob/main/InternalDocs/garbage_collector.md)
31+
+- [`std::atomic`](/reference/atomic/atomic.md)`&amp;lt;`[`std::shared_ptr`](shared_ptr.md)`&amp;lt;T&amp;gt;&amp;gt;`のlibstdc++とMSVCの実装は、制御ブロックへのポインタの最下位ビットをスピンロックのフラグに使用する。指す先のオブジェクトへのポインタではなく制御ブロックへのポインタを選ぶのは、制御ブロックの確保をライブラリ側が行うためアライメントを保証できるからである
32+
+ - [Inside STL: The atomic shared_ptr - The Old New Thing](https://devblogs.microsoft.com/oldnewthing/20241219-00/?p=110663)
33+
+- レイトレーシングのpbrtは、形状やマテリアルなど多数の型を仮想関数なしで扱うために`TaggedPointer`を使う。こちらは下位ビットではなく上位7ビット (ビット57以上) に型の番号を格納し、128種類までの型を判別して、型に応じた処理を呼び分ける
34+
+ - [B.4.4 Tagged Pointers - Physically Based Rendering](https://pbr-book.org/4ed/Utilities/Containers_and_Memory_Management)
35+
+
36+
+pbrtのように上位ビットを使う方法は、アドレス空間が64ビット全体を使わないことに依存するため、対象とする環境を限定する。上位ビットを無視するハードウェア機構としては、IntelのLAM (linear address masking)、AMDのUAI (upper address ignore)、ARMのTBI (top byte ignore) などがある。
37+
+
38+
39+
## メンバ関数
40+
### 構築・破棄
41+
&lt;/code&gt;&lt;/pre&gt;</summary>
42+
43+
<author>
44+
<name>Akira Takahashi</name>
45+
<email>faithandbrave@gmail.com</email>
46+
</author>
47+
</entry>
48+
949
<entry>
1050
<title>機能テストマクロ -- is_within_lifetime : Clangで実装された</title>
1151
<link href="https://cpprefjp.github.io/lang/cpp26/feature_test_macros.html"/>
@@ -1223,36 +1263,4 @@ index 713856be2..79971f459 100644
12231263
</author>
12241264
</entry>
12251265

1226-
<entry>
1227-
<title>what -- exception::what : 基底クラスの宣言にoverrideが付いており、存在しないC++17版が記載されていたのを修正</title>
1228-
<link href="https://cpprefjp.github.io/reference/exception/exception/what.html"/>
1229-
<id>5113f2599ddf3c03d03f0556cfd6363181fc5595:reference/exception/exception/what.md</id>
1230-
<updated>2026-09-23T07:19:44+09:00</updated>
1231-
1232-
<summary type="html">&lt;pre&gt;&lt;code&gt;diff --git a/reference/exception/exception/what.md b/reference/exception/exception/what.md
1233-
index 80402d417..f3fb62475 100644
1234-
--- a/reference/exception/exception/what.md
1235-
+++ b/reference/exception/exception/what.md
1236-
@@ -5,10 +5,9 @@
1237-
* function[meta id-type]
1238-
1239-
```cpp
1240-
-virtual const char* what() const; // (1) C++98
1241-
-virtual const char* what() const noexcept; // (1) C++11
1242-
-const char* what() const noexcept override; // (1) C++17
1243-
-constexpr const char* what() const noexcept override; // (1) C++26
1244-
+virtual const char* what() const; // (1) C++98
1245-
+virtual const char* what() const noexcept; // (1) C++11
1246-
+constexpr virtual const char* what() const noexcept; // (1) C++26
1247-
```
1248-
1249-
## 概要
1250-
&lt;/code&gt;&lt;/pre&gt;</summary>
1251-
1252-
<author>
1253-
<name>rotarymars</name>
1254-
<email>s.goto2050@gmail.com</email>
1255-
</author>
1256-
</entry>
1257-
12581266
</feed>

‎sitemap.xml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29340,7 +29340,7 @@
2934029340

2934129341
<url>
2934229342
<loc>https://cpprefjp.github.io/reference/memory/pointer_tag_pair.html</loc>
29343-
<lastmod>2026-09-15T16:05:27+09:00</lastmod>
29343+
<lastmod>2026-09-25T22:08:17+09:00</lastmod>
2934429344
<changefreq>daily</changefreq>
2934529345
<priority>0.7</priority>
2934629346
</url>

0 commit comments

Comments
 (0)