<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux.git/scripts/kconfig/internal.h, branch v6.12.80</title>
<subtitle>Clone of https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git</subtitle>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/'/>
<entry>
<title>kconfig: cache expression values</title>
<updated>2024-09-20T00:21:53+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-09-08T12:43:21+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=95573cac25c6b11f02d599d18e9a1c778706e838'/>
<id>95573cac25c6b11f02d599d18e9a1c778706e838</id>
<content type='text'>
Cache expression values to avoid recalculating them repeatedly.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Cache expression values to avoid recalculating them repeatedly.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kconfig: use hash table to reuse expressions</title>
<updated>2024-09-20T00:21:52+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-09-08T12:43:20+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=f93d6bfbd2f74d79041c153a59df5336f6e9a14a'/>
<id>f93d6bfbd2f74d79041c153a59df5336f6e9a14a</id>
<content type='text'>
Currently, every expression in Kconfig files produces a new abstract
syntax tree (AST), even if it is identical to a previously encountered
one.

Consider the following code:

    config FOO
           bool "FOO"
           depends on (A || B) &amp;&amp; C

    config BAR
           bool "BAR"
           depends on (A || B) &amp;&amp; C

    config BAZ
           bool "BAZ"
           depends on A || B

The "depends on" lines are similar, but currently a separate AST is
allocated for each one.

The current data structure looks like this:

  FOO-&gt;dep ==&gt; AND        BAR-&gt;dep ==&gt; AND        BAZ-&gt;dep ==&gt; OR
              /   \                   /   \                   /  \
            OR     C                OR     C                 A    B
           /  \                    /  \
          A    B                  A    B

This is redundant; FOO-&gt;dep and BAR-&gt;dep have identical ASTs but
different memory instances.

We can optimize this; FOO-&gt;dep and BAR-&gt;dep can share the same AST, and
BAZ-&gt;dep can reference its sub tree.

The optimized data structure looks like this:

  FOO-&gt;dep, BAR-&gt;dep ==&gt; AND
                        /   \
         BAZ-&gt;dep ==&gt; OR     C
                     /  \
                    A    B

This commit introduces a hash table to keep track of allocated
expressions. If an identical expression is found, it is reused.

This does not necessarily result in memory savings, as menu_finalize()
transforms expressions without freeing up stale ones. This will be
addressed later.

One optimization that can be easily implemented is caching the
expression's value. Once FOO's dependency, (A || B) &amp;&amp; C, is calculated,
it can be cached, eliminating the need to recalculate it for BAR.

This commit also reverts commit e983b7b17ad1 ("kconfig/menu.c: fix
multiple references to expressions in menu_add_prop()").

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently, every expression in Kconfig files produces a new abstract
syntax tree (AST), even if it is identical to a previously encountered
one.

Consider the following code:

    config FOO
           bool "FOO"
           depends on (A || B) &amp;&amp; C

    config BAR
           bool "BAR"
           depends on (A || B) &amp;&amp; C

    config BAZ
           bool "BAZ"
           depends on A || B

The "depends on" lines are similar, but currently a separate AST is
allocated for each one.

The current data structure looks like this:

  FOO-&gt;dep ==&gt; AND        BAR-&gt;dep ==&gt; AND        BAZ-&gt;dep ==&gt; OR
              /   \                   /   \                   /  \
            OR     C                OR     C                 A    B
           /  \                    /  \
          A    B                  A    B

This is redundant; FOO-&gt;dep and BAR-&gt;dep have identical ASTs but
different memory instances.

We can optimize this; FOO-&gt;dep and BAR-&gt;dep can share the same AST, and
BAZ-&gt;dep can reference its sub tree.

The optimized data structure looks like this:

  FOO-&gt;dep, BAR-&gt;dep ==&gt; AND
                        /   \
         BAZ-&gt;dep ==&gt; OR     C
                     /  \
                    A    B

This commit introduces a hash table to keep track of allocated
expressions. If an identical expression is found, it is reused.

This does not necessarily result in memory savings, as menu_finalize()
transforms expressions without freeing up stale ones. This will be
addressed later.

One optimization that can be easily implemented is caching the
expression's value. Once FOO's dependency, (A || B) &amp;&amp; C, is calculated,
it can be cached, eliminating the need to recalculate it for BAR.

This commit also reverts commit e983b7b17ad1 ("kconfig/menu.c: fix
multiple references to expressions in menu_add_prop()").

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kbuild: move some helper headers from scripts/kconfig/ to scripts/include/</title>
<updated>2024-07-21T14:10:43+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-07-20T07:27:38+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=fbaf242c956aff6a07d9e97eaa3a0a48d947de33'/>
<id>fbaf242c956aff6a07d9e97eaa3a0a48d947de33</id>
<content type='text'>
Move array_size.h, hashtable.h, list.h, list_types.h from scripts/kconfig/
to scripts/include/.

These headers will be useful for other host programs.

Remove scripts/mod/list.h.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Move array_size.h, hashtable.h, list.h, list_types.h from scripts/kconfig/
to scripts/include/.

These headers will be useful for other host programs.

Remove scripts/mod/list.h.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kconfig: use generic macros to implement symbol hashtable</title>
<updated>2024-02-20T11:47:45+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-02-11T12:41:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=91b69454f93d1c905f3a56bb39856db9a220c791'/>
<id>91b69454f93d1c905f3a56bb39856db9a220c791</id>
<content type='text'>
Use helper macros in hashtable.h for generic hashtable implementation.

We can git rid of the hash head index of for_all_symbols().

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Use helper macros in hashtable.h for generic hashtable implementation.

We can git rid of the hash head index of for_all_symbols().

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kconfig: remove zconf_curname() and zconf_lineno()</title>
<updated>2024-02-19T09:20:40+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2024-02-02T15:58:08+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=1d7c4f10baacbc658918f7ddec31e1d1962df6fc'/>
<id>1d7c4f10baacbc658918f7ddec31e1d1962df6fc</id>
<content type='text'>
Now zconf_curname() and zconf_lineno() are so simple that they just
return cur_filename, cur_lineno, respectively.

Remove these functions, and then use cur_filename and cur_lineno
directly.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now zconf_curname() and zconf_lineno() are so simple that they just
return cur_filename, cur_lineno, respectively.

Remove these functions, and then use cur_filename and cur_lineno
directly.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>kconfig: split menu.c out of parser.y</title>
<updated>2021-04-14T06:26:09+00:00</updated>
<author>
<name>Masahiro Yamada</name>
<email>masahiroy@kernel.org</email>
</author>
<published>2021-04-13T15:08:17+00:00</published>
<link rel='alternate' type='text/html' href='https://git.exis.tech/linux.git/commit/?id=a77a05dc9cf24a8c88b9d9c70e8984f936d075f3'/>
<id>a77a05dc9cf24a8c88b9d9c70e8984f936d075f3</id>
<content type='text'>
Compile menu.c as an independent compilation unit.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Compile menu.c as an independent compilation unit.

Signed-off-by: Masahiro Yamada &lt;masahiroy@kernel.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
