<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/source/slang/slang-lookup.cpp, branch master</title>
<subtitle>Making it easier to work with shaders</subtitle>
<id>https://git.yummers.dev/slang.git/atom?h=master</id>
<link rel='self' href='https://git.yummers.dev/slang.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/'/>
<updated>2025-07-17T06:43:06+00:00</updated>
<entry>
<title>Improve lookup performance. (#7798)</title>
<updated>2025-07-17T06:43:06+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-07-17T06:43:06+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=020a16072923a66ae0985be618fd32310aa87242'/>
<id>urn:sha1:020a16072923a66ae0985be618fd32310aa87242</id>
<content type='text'>
* Improve lookup performance.

* Cleanup.

* Improve autocompletion latency.</content>
</entry>
<entry>
<title>Fix segfault with Ptr&lt;T&gt; extension using 'This' type reference (#7719)</title>
<updated>2025-07-11T22:24:41+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-07-11T22:24:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=243f522a9087a807d2dadbb3ef201694b6897bf7'/>
<id>urn:sha1:243f522a9087a807d2dadbb3ef201694b6897bf7</id>
<content type='text'>
* Fix segfault with Ptr&lt;T&gt; extension using 'This' type reference

Set LookupOptions::NoDeref when looking up target type members within
extension declarations to prevent automatic pointer dereferencing that
was causing breadcrumb handling issues and segfaults.

Fixes #7656

Co-authored-by: Yong He &lt;csyonghe@users.noreply.github.com&gt;

* Enhance test for ptr-extension-this-type to verify correctness with interpreter

- Changed function to return sizeof(This) - sizeof(Ptr&lt;int&gt;) + 1
- Modified test to use interpreter with filecheck to verify result equals 1
- Added main() function that calls the extension method and prints result
- Verifies that 'This' correctly refers to Ptr&lt;int&gt; in extension context

Co-authored-by: Yong He &lt;csyonghe@users.noreply.github.com&gt;

---------

Co-authored-by: github-actions[bot] &lt;41898282+github-actions[bot]@users.noreply.github.com&gt;
Co-authored-by: Yong He &lt;csyonghe@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>Allow interface methods to have default implementations. (#7439)</title>
<updated>2025-06-14T05:13:00+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-06-14T05:13:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=6a23949f07f4eba38086b656e7073ce3bf8cd2fe'/>
<id>urn:sha1:6a23949f07f4eba38086b656e7073ce3bf8cd2fe</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Mediate access to ContainerDecl members (#7242)</title>
<updated>2025-06-09T18:22:51+00:00</updated>
<author>
<name>Theresa Foley</name>
<email>10618364+tangent-vector@users.noreply.github.com</email>
</author>
<published>2025-06-09T18:22:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=bfae49d853e0f9b6f9de495b13bcd1642ca4a285'/>
<id>urn:sha1:bfae49d853e0f9b6f9de495b13bcd1642ca4a285</id>
<content type='text'>
Most of what this change does is straightforward: take all the places in the code that used to operate directly on `ContainerDecl::members` and related fields, and instead have them call into a smaller set of accessor methods defined on `ContainerDecl`.

The primary motivation for making this change is that in order to implement on-demand loading of members from serialized AST modules, we need a way to identify and intercept the "demand" for those members.

On-demand loading benefits from having all accesses to the members of a `ContainerDecl` be as narrow as possible.
If a part of the code only need a member at a specific index, it should say so.
If it only needs access to members with a specific name, or a given subclass of `Decl`, then it should say so.

A secondary motivation for this change is that there have recently been several changes that added complexity and special cases by introducing code that operated on (and *mutated*) the member list of a container decl in ways that the existing code had never done before.

Any code that mutates the member list of a `ContainerDecl` needs to be sure to not disrupt the invariants that the lookup acceleration structures currently rely on.
One of the recent changes added a declaration-to-index map to the set of acceleration structures (with different validation/invalidation behavior than the others...) while other recent changes would remove or insert declarations in ways that could change the indices of other declarations in the same container.
It is not clear if any of these pieces of code were aware of the others, and the invariants that might be expected or broken along the way.

This change bottlenecks the vast majority of accesses to the members of a `ContainerDecl` through the following operations:

* Getting a `List` of all of the direct member declarations of a container

* Get the number of direct member declarations, and accessing them by index.

* Looking up the list of direct member declarations with a given name.

* Adding a new direct member declaration to the end of the list.

Some other operations are layered on top of those (e.g., getting a list of all the direct member declarations of a given C++ class).
These layered operations are still centralized on the `ContainerDecl`, with the intention that we *can* change them to be non-layered implementations if we ever need to for performance (e.g., by building a lookup structure for finding member declarations by their type).

The exceptional cases of access/mutation on the direct members of a `ContainerDecl` have also been encapsulated, but rather than expose what would risk appearing like general-purpose accessors (e.g., `removeDecl(d)`, `setDecl(index)`, etc.), these operations have been explicitly named after the specific use case that they serve in the codebase today, to discourage others from using them for more kinds of operations we'd rather not support.
These operations have also been given parameter signatures that match their use cases, to make it so that even somebody determined to abuse them would have to invent suitable arguments out of thin air.

In the case of the declaration-to-index mapping, this change eliminates that acceleration structure, in favor or slightly more complicated (and possibly inefficient, yes) code at the use site.

Over time, it would be good to closely scrutinize each of the use cases that requires more complicated interaction with the members of a `ContainerDecl`, to see whether any of them can be reframed in terms of the more basic operations, or if there is some clean abstraction we can introduce to make operations that mutate the member list feel like... hacky.</content>
</entry>
<entry>
<title>Fix modifier parsing. (#6347)</title>
<updated>2025-02-13T21:09:11+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-02-13T21:09:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=adde2626720f23a5fd7151f6fb9109db14fc9263'/>
<id>urn:sha1:adde2626720f23a5fd7151f6fb9109db14fc9263</id>
<content type='text'>
* Fix modifier parsing.

* Fix.

* Fix.

* Fix.</content>
</entry>
<entry>
<title>Use two-stage parsing to disambiguate generic app and comparison. (#6281)</title>
<updated>2025-02-05T20:32:56+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-02-05T20:32:56+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=7911c9437333692db275d2dff41264f4c8023be8'/>
<id>urn:sha1:7911c9437333692db275d2dff41264f4c8023be8</id>
<content type='text'>
* Use two-stage parsing to disambiguate generic app and comparison.

* Typo fix.

* Update doc.</content>
</entry>
<entry>
<title>Fix bug: IgnoreInheritance in lookup (#6146)</title>
<updated>2025-01-21T21:26:36+00:00</updated>
<author>
<name>kaizhangNV</name>
<email>149626564+kaizhangNV@users.noreply.github.com</email>
</author>
<published>2025-01-21T21:26:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=151bdb837f514caf5cde873aa39571525ba2e80f'/>
<id>urn:sha1:151bdb837f514caf5cde873aa39571525ba2e80f</id>
<content type='text'>
* Fix bug: IgnoreInheritance in lookup

When specifying IgnoreInheritance in lookup, it will ignore
all members in the self extension for generic, the reason is
that it doesn't specialize the target type of the extension
decl when comparing with self type, so it will result that every
type is unequal to the target type.</content>
</entry>
<entry>
<title>Fix cyclic lookups with UnscopedEnums (#6110)</title>
<updated>2025-01-17T01:06:00+00:00</updated>
<author>
<name>Julius Ikkala</name>
<email>julius.ikkala@gmail.com</email>
</author>
<published>2025-01-17T01:06:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=d3ad6bb4997d3b7ba2dc9653a2d5f7dc965b150f'/>
<id>urn:sha1:d3ad6bb4997d3b7ba2dc9653a2d5f7dc965b150f</id>
<content type='text'>
* Fix cyclic lookups with UnscopedEnums

* Add test with multiple unscoped enums with explicit types

---------

Co-authored-by: Yong He &lt;yonghe@outlook.com&gt;</content>
</entry>
<entry>
<title>Initial implementation of SP#015 `DescriptorHandle&lt;T&gt;`. (#6028)</title>
<updated>2025-01-10T18:57:04+00:00</updated>
<author>
<name>Yong He</name>
<email>yonghe@outlook.com</email>
</author>
<published>2025-01-10T18:57:04+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=5290c580632cfb56847b863a32dc020a21d1c93e'/>
<id>urn:sha1:5290c580632cfb56847b863a32dc020a21d1c93e</id>
<content type='text'>
* Initial implementation of `ResourcePtr&lt;T&gt;`.

* Update docs

* Fix build error.

* Add more discussion.

* Update documentation.

* Update TOC.

* Fix.

* Fix.

* Add test case for custom `getResourceFromBindlessHandle`.

* Add namehint to generated descriptor heap param.

* Fix.

* Fix.

* format code

* Rename to `DescriptorHandle`, and add `T.Handle` alias.

* Fix compiler error.

* Fix.

* Fix build.

* Renames.

* Fix documentation.

* Documentation fix.

---------

Co-authored-by: slangbot &lt;186143334+slangbot@users.noreply.github.com&gt;</content>
</entry>
<entry>
<title>format</title>
<updated>2024-10-29T06:49:26+00:00</updated>
<author>
<name>Ellie Hermaszewska</name>
<email>ellieh@nvidia.com</email>
</author>
<published>2024-10-29T06:49:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21'/>
<id>urn:sha1:f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21</id>
<content type='text'>
* format

* Minor test fixes

* enable checking cpp format in ci</content>
</entry>
</feed>
