https://github.com/shader-slang/slang
Revision 935b629448fedc187243bfe88d4149bf30d89c05 authored by Tim Foley on 23 January 2019, 17:13:03 UTC, committed by GitHub on 23 January 2019, 17:13:03 UTC
There was a bug in the logic for emitting initial IR, such that it was neglecting to emit "methods" (member functions) unless they were also referenced by a non-member (global) function, or were needed to satisfy an interface requirement. This would only matter for `import`ed modules, since for non-`import`ed code, anything relevant would be referenced by the entry point so that the problem would never surface.

This change fixes the underlying problem by adding a step to the IR lowering pass called `ensureAllDeclsRec` that makes sure that not only global-scope declarations, but also anything nested under a `struct` type gets emitted to the initial IR module.

There are also a few unrelated fixes in this PR, which are things I ran into while making the fix:

* Deleted support for the (long gone) `IRDeclRef` type in our `slang.natvis` file

* Added support for visualizing the value of IR string and integer literals when they appear in the debugger

* Fixed IR dumping logic to not skip emitting `struct` and `interface` instructions. Switching those to inherit from `IRType` accidentally affected how they get printed in IR dumps by default.

* Fixed up the IR linking logic so that it correctly takes `[export]` decorations into account, so that an exported definition will always be taken over any other (unless the latter is more specialized for the target). I initially implemented this in an attempt to fix the original issue, but found it wasn't a fix for the root cause. It is still a better approach than what was implemented previously, so I'm leaving it in place.
1 parent a08a314
History
Tip revision: 935b629448fedc187243bfe88d4149bf30d89c05 authored by Tim Foley on 23 January 2019, 17:13:03 UTC
Fix IR emit logic for methods in `struct` types (#791)
Tip revision: 935b629
File Mode Size
allocator.h -rw-r--r-- 959 bytes
array-view.h -rw-r--r-- 2.1 KB
array.h -rw-r--r-- 2.5 KB
basic.h -rw-r--r-- 239 bytes
common.h -rw-r--r-- 2.0 KB
core.natvis -rw-r--r-- 1.8 KB
core.vcxproj -rw-r--r-- 10.4 KB
core.vcxproj.filters -rw-r--r-- 5.2 KB
dictionary.h -rw-r--r-- 12.6 KB
exception.h -rw-r--r-- 2.1 KB
hash.h -rw-r--r-- 2.4 KB
int-set.h -rw-r--r-- 3.8 KB
list.h -rw-r--r-- 13.3 KB
platform.cpp -rw-r--r-- 4.2 KB
platform.h -rw-r--r-- 2.6 KB
secure-crt.h -rw-r--r-- 2.2 KB
slang-byte-encode-util.cpp -rw-r--r-- 8.0 KB
slang-byte-encode-util.h -rw-r--r-- 6.2 KB
slang-cpu-defines.h -rw-r--r-- 2.9 KB
slang-free-list.cpp -rw-r--r-- 4.2 KB
slang-free-list.h -rw-r--r-- 4.5 KB
slang-io.cpp -rw-r--r-- 9.0 KB
slang-io.h -rw-r--r-- 2.0 KB
slang-math.h -rw-r--r-- 4.5 KB
slang-memory-arena.cpp -rw-r--r-- 8.6 KB
slang-memory-arena.h -rw-r--r-- 15.2 KB
slang-object-scope-manager.cpp -rw-r--r-- 436 bytes
slang-object-scope-manager.h -rw-r--r-- 1.8 KB
slang-random-generator.cpp -rw-r--r-- 3.0 KB
slang-random-generator.h -rw-r--r-- 2.7 KB
slang-shared-library.cpp -rw-r--r-- 4.2 KB
slang-shared-library.h -rw-r--r-- 4.0 KB
slang-std-writers.cpp -rw-r--r-- 982 bytes
slang-std-writers.h -rw-r--r-- 1.3 KB
slang-string-slice-pool.cpp -rw-r--r-- 1.7 KB
slang-string-slice-pool.h -rw-r--r-- 2.0 KB
slang-string-util.cpp -rw-r--r-- 4.1 KB
slang-string-util.h -rw-r--r-- 2.8 KB
slang-string.cpp -rw-r--r-- 9.5 KB
slang-string.h -rw-r--r-- 20.7 KB
slang-test-tool-util.cpp -rw-r--r-- 272 bytes
slang-test-tool-util.h -rw-r--r-- 646 bytes
slang-writer.cpp -rw-r--r-- 5.0 KB
slang-writer.h -rw-r--r-- 4.7 KB
smart-pointer.h -rw-r--r-- 4.9 KB
stream.cpp -rw-r--r-- 6.9 KB
stream.h -rw-r--r-- 2.8 KB
text-io.cpp -rw-r--r-- 7.0 KB
text-io.h -rw-r--r-- 7.5 KB
token-reader.cpp -rw-r--r-- 23.1 KB
token-reader.h -rw-r--r-- 7.1 KB
type-traits.h -rw-r--r-- 1010 bytes

back to top