From 3cf5935b434a8b9a07a6df5a6ab4c4dc373a1ac3 Mon Sep 17 00:00:00 2001 From: kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> Date: Fri, 30 Aug 2024 15:57:11 -0500 Subject: capture component type (#4967) * Refactor the IComponentType recording Refactor the `IComponentType` recording by creating a abstract class `IComponentTypeRecorder` to record all the methods of `IComponentType`, so that `ICompositeComponentType`, `IModule`, 'IEntryPoint', 'ITypeConformance' can share the same recording implementation. Capture the out IComponentType from linkWithOptions() link() specialize() renameEntryPoint() * fix bugs * Finish the unimeplemented functions in json consumer Fix the address print to use 64 bit hex. Fix the reference count issue when allocating new recorder object. * Disable few examples using reflection APIs * Add gpu-printing example into slang-test * Replace of using std::unique_ptr with RefPtr --- source/slang-record-replay/record/output-stream.h | 2 +- .../slang-record-replay/record/record-manager.cpp | 2 +- source/slang-record-replay/record/record-manager.h | 4 +- .../record/slang-component-type.cpp | 353 +++++++++++++++++++++ .../record/slang-component-type.h | 79 +++++ .../record/slang-composite-component-type.cpp | 293 +---------------- .../record/slang-composite-component-type.h | 68 ++-- .../record/slang-entrypoint.cpp | 294 +---------------- .../slang-record-replay/record/slang-entrypoint.h | 106 ++++++- .../record/slang-global-session.cpp | 2 +- .../record/slang-global-session.h | 4 +- source/slang-record-replay/record/slang-module.cpp | 303 ++---------------- source/slang-record-replay/record/slang-module.h | 108 +++++-- .../slang-record-replay/record/slang-session.cpp | 48 ++- source/slang-record-replay/record/slang-session.h | 6 +- .../record/slang-type-conformance.cpp | 288 +---------------- .../record/slang-type-conformance.h | 97 +++++- .../slang-record-replay/replay/json-consumer.cpp | 302 +++++++++++------- source/slang-record-replay/replay/json-consumer.h | 4 +- .../slang-record-replay/replay/replay-consumer.cpp | 43 ++- .../slang-record-replay/replay/replay-consumer.h | 5 +- source/slang-record-replay/util/emum-to-string.h | 35 +- source/slang-record-replay/util/record-format.h | 122 ++++--- 23 files changed, 1118 insertions(+), 1450 deletions(-) create mode 100644 source/slang-record-replay/record/slang-component-type.cpp create mode 100644 source/slang-record-replay/record/slang-component-type.h (limited to 'source') diff --git a/source/slang-record-replay/record/output-stream.h b/source/slang-record-replay/record/output-stream.h index 537434ed5..e322bccb1 100644 --- a/source/slang-record-replay/record/output-stream.h +++ b/source/slang-record-replay/record/output-stream.h @@ -6,7 +6,7 @@ namespace SlangRecord { - class OutputStream + class OutputStream: public Slang::RefObject { public: virtual ~OutputStream() {} diff --git a/source/slang-record-replay/record/record-manager.cpp b/source/slang-record-replay/record/record-manager.cpp index dc58590e1..03abffcce 100644 --- a/source/slang-record-replay/record/record-manager.cpp +++ b/source/slang-record-replay/record/record-manager.cpp @@ -23,7 +23,7 @@ namespace SlangRecord } Slang::String recordFilePath = Slang::Path::combine(m_recordFileDirectory, Slang::String(ss.str().c_str())); - m_fileStream = std::make_unique(recordFilePath); + m_fileStream = new FileOutputStream(recordFilePath); } void RecordManager::clearWithHeader(const ApiCallId& callId, uint64_t handleId) diff --git a/source/slang-record-replay/record/record-manager.h b/source/slang-record-replay/record/record-manager.h index 365e28312..f46264824 100644 --- a/source/slang-record-replay/record/record-manager.h +++ b/source/slang-record-replay/record/record-manager.h @@ -9,7 +9,7 @@ namespace SlangRecord { - class RecordManager + class RecordManager: public Slang::RefObject { public: RecordManager(uint64_t globalSessionHandle); @@ -29,7 +29,7 @@ namespace SlangRecord void clearWithTailer(); MemoryStream m_memoryStream; - std::unique_ptr m_fileStream; + Slang::RefPtr m_fileStream; Slang::String m_recordFileDirectory = Slang::Path::getCurrentPath(); ParameterRecorder m_recorder; }; diff --git a/source/slang-record-replay/record/slang-component-type.cpp b/source/slang-record-replay/record/slang-component-type.cpp new file mode 100644 index 000000000..5ebf73574 --- /dev/null +++ b/source/slang-record-replay/record/slang-component-type.cpp @@ -0,0 +1,353 @@ +#include "../util/record-utility.h" +#include "slang-component-type.h" +#include "slang-composite-component-type.h" +#include "slang-session.h" + +namespace SlangRecord +{ + IComponentTypeRecorder::IComponentTypeRecorder( + slang::IComponentType* componentType, RecordManager* recordManager) + : m_actualComponentType(componentType), + m_recordManager(recordManager) + { + SLANG_RECORD_ASSERT(m_actualComponentType != nullptr); + SLANG_RECORD_ASSERT(m_recordManager != nullptr); + + m_componentHandle = reinterpret_cast(m_actualComponentType.get()); + slangRecordLog(LogLevel::Verbose, "%s: %p\n", __PRETTY_FUNCTION__, componentType); + } + + SLANG_NO_THROW slang::ISession* IComponentTypeRecorder::getSession() + { + slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); + + ApiCallId callId = static_cast(makeApiCallId(getClassId(), IComponentTypeMethodId::getSession)); + ParameterRecorder* recorder {}; + { + recorder = m_recordManager->beginMethodRecord(callId, m_componentHandle); + recorder = m_recordManager->endMethodRecord(); + } + + slang::ISession* res = m_actualComponentType->getSession(); + + { + recorder->recordAddress(res); + m_recordManager->apendOutput(); + } + + // instead of returning the actual session, we need to return the recorder + SessionRecorder* sessionRecorder = getSessionRecorder(); + return static_cast(sessionRecorder); + } + + SLANG_NO_THROW slang::ProgramLayout* IComponentTypeRecorder::getLayout( + SlangInt targetIndex, + slang::IBlob** outDiagnostics) + { + slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); + + ApiCallId callId = static_cast(makeApiCallId(getClassId(), IComponentTypeMethodId::getLayout)); + ParameterRecorder* recorder {}; + { + recorder = m_recordManager->beginMethodRecord(callId, m_componentHandle); + recorder->recordInt64(targetIndex); + recorder = m_recordManager->endMethodRecord(); + } + + slang::ProgramLayout* programLayout = m_actualComponentType->getLayout(targetIndex, outDiagnostics); + + { + recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); + recorder->recordAddress(programLayout); + m_recordManager->apendOutput(); + } + + return programLayout; + } + + SLANG_NO_THROW SlangInt IComponentTypeRecorder::getSpecializationParamCount() + { + // No need to record this call as it is just a query. + slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); + SlangInt res = m_actualComponentType->getSpecializationParamCount(); + return res; + } + + SLANG_NO_THROW SlangResult IComponentTypeRecorder::getEntryPointCode( + SlangInt entryPointIndex, + SlangInt targetIndex, + slang::IBlob** outCode, + slang::IBlob** outDiagnostics) + { + slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); + + ApiCallId callId = static_cast(makeApiCallId(getClassId(), IComponentTypeMethodId::getEntryPointCode)); + ParameterRecorder* recorder {}; + { + recorder = m_recordManager->beginMethodRecord(callId, m_componentHandle); + recorder->recordInt64(entryPointIndex); + recorder->recordInt64(targetIndex); + recorder = m_recordManager->endMethodRecord(); + } + + SlangResult res = m_actualComponentType->getEntryPointCode(entryPointIndex, targetIndex, outCode, outDiagnostics); + + { + recorder->recordAddress(*outCode); + recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); + m_recordManager->apendOutput(); + } + + return res; + } + + SLANG_NO_THROW SlangResult IComponentTypeRecorder::getTargetCode( + SlangInt targetIndex, + slang::IBlob** outCode, + slang::IBlob** outDiagnostics) + { + slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); + + ApiCallId callId = static_cast(makeApiCallId(getClassId(), IComponentTypeMethodId::getTargetCode)); + ParameterRecorder* recorder {}; + { + recorder = m_recordManager->beginMethodRecord(callId, m_componentHandle); + recorder->recordInt64(targetIndex); + recorder = m_recordManager->endMethodRecord(); + } + + SlangResult res = m_actualComponentType->getTargetCode(targetIndex, outCode, outDiagnostics); + + { + recorder->recordAddress(*outCode); + recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); + m_recordManager->apendOutput(); + } + + return res; + } + + SLANG_NO_THROW SlangResult IComponentTypeRecorder::getResultAsFileSystem( + SlangInt entryPointIndex, + SlangInt targetIndex, + ISlangMutableFileSystem** outFileSystem) + { + slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); + + ApiCallId callId = static_cast(makeApiCallId(getClassId(), IComponentTypeMethodId::getResultAsFileSystem)); + ParameterRecorder* recorder {}; + { + recorder = m_recordManager->beginMethodRecord(callId, m_componentHandle); + recorder->recordInt64(entryPointIndex); + recorder->recordInt64(targetIndex); + recorder = m_recordManager->endMethodRecord(); + } + + SlangResult res = m_actualComponentType->getResultAsFileSystem(entryPointIndex, targetIndex, outFileSystem); + + { + recorder->recordAddress(*outFileSystem); + } + + // TODO: We might need to wrap the file system object. + return res; + } + + SLANG_NO_THROW void IComponentTypeRecorder::getEntryPointHash( + SlangInt entryPointIndex, + SlangInt targetIndex, + slang::IBlob** outHash) + { + slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); + + ApiCallId callId = static_cast(makeApiCallId(getClassId(), IComponentTypeMethodId::getEntryPointHash)); + ParameterRecorder* recorder {}; + { + recorder = m_recordManager->beginMethodRecord(callId, m_componentHandle); + recorder->recordInt64(entryPointIndex); + recorder->recordInt64(targetIndex); + recorder = m_recordManager->endMethodRecord(); + } + + m_actualComponentType->getEntryPointHash(entryPointIndex, targetIndex, outHash); + + { + recorder->recordAddress(*outHash); + m_recordManager->apendOutput(); + } + } + + SLANG_NO_THROW SlangResult IComponentTypeRecorder::specialize( + slang::SpecializationArg const* specializationArgs, + SlangInt specializationArgCount, + slang::IComponentType** outSpecializedComponentType, + ISlangBlob** outDiagnostics) + { + slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); + + ApiCallId callId = static_cast(makeApiCallId(getClassId(), IComponentTypeMethodId::specialize)); + ParameterRecorder* recorder {}; + { + recorder = m_recordManager->beginMethodRecord(callId, m_componentHandle); + recorder->recordInt64(specializationArgCount); + recorder->recordStructArray(specializationArgs, specializationArgCount); + recorder = m_recordManager->endMethodRecord(); + } + + SlangResult res = m_actualComponentType->specialize(specializationArgs, specializationArgCount, outSpecializedComponentType, outDiagnostics); + + { + recorder->recordAddress(*outSpecializedComponentType); + recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); + m_recordManager->apendOutput(); + } + + if (SLANG_SUCCEEDED(res)) + { + // replaced output with our recorder + *outSpecializedComponentType = getComponentTypeRecorder(*outSpecializedComponentType); + } + return res; + } + + SLANG_NO_THROW SlangResult IComponentTypeRecorder::link( + slang::IComponentType** outLinkedComponentType, + ISlangBlob** outDiagnostics) + { + slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); + + ApiCallId callId = static_cast(makeApiCallId(getClassId(), IComponentTypeMethodId::link)); + ParameterRecorder* recorder {}; + { + recorder = m_recordManager->beginMethodRecord(callId, m_componentHandle); + recorder = m_recordManager->endMethodRecord(); + } + + SlangResult res = m_actualComponentType->link(outLinkedComponentType, outDiagnostics); + + { + recorder->recordAddress(*outLinkedComponentType); + recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); + m_recordManager->apendOutput(); + } + + if (SLANG_SUCCEEDED(res)) + { + // replaced output with our recorder + *outLinkedComponentType = getComponentTypeRecorder(*outLinkedComponentType); + } + return res; + } + + SLANG_NO_THROW SlangResult IComponentTypeRecorder::getEntryPointHostCallable( + int entryPointIndex, + int targetIndex, + ISlangSharedLibrary** outSharedLibrary, + slang::IBlob** outDiagnostics) + { + slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); + + ApiCallId callId = static_cast(makeApiCallId(getClassId(), IComponentTypeMethodId::getEntryPointHostCallable)); + ParameterRecorder* recorder {}; + { + recorder = m_recordManager->beginMethodRecord(callId, m_componentHandle); + recorder->recordInt32(entryPointIndex); + recorder->recordInt32(targetIndex); + recorder = m_recordManager->endMethodRecord(); + } + + SlangResult res = m_actualComponentType->getEntryPointHostCallable(entryPointIndex, targetIndex, outSharedLibrary, outDiagnostics); + + { + recorder->recordAddress(*outSharedLibrary); + recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); + m_recordManager->apendOutput(); + } + + return res; + } + + SLANG_NO_THROW SlangResult IComponentTypeRecorder::renameEntryPoint( + const char* newName, IComponentType** outEntryPoint) + { + slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); + + ApiCallId callId = static_cast(makeApiCallId(getClassId(), IComponentTypeMethodId::renameEntryPoint)); + ParameterRecorder* recorder {}; + { + recorder = m_recordManager->beginMethodRecord(callId, m_componentHandle); + recorder->recordString(newName); + recorder = m_recordManager->endMethodRecord(); + } + + SlangResult res = m_actualComponentType->renameEntryPoint(newName, outEntryPoint); + + { + recorder->recordAddress(*outEntryPoint); + m_recordManager->apendOutput(); + } + + // replaced output with our recorder + // 'outEntryPoint' is not actually a IEntryPoint type, but a ComponentType type, so we + // keep using CompositeComponentTypeRecorder to record it. + if (SLANG_SUCCEEDED(res)) + { + // replaced output with our recorder + *outEntryPoint = getComponentTypeRecorder(*outEntryPoint); + } + return res; + } + + SLANG_NO_THROW SlangResult IComponentTypeRecorder::linkWithOptions( + IComponentType** outLinkedComponentType, + uint32_t compilerOptionEntryCount, + slang::CompilerOptionEntry* compilerOptionEntries, + ISlangBlob** outDiagnostics) + { + slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); + + ApiCallId callId = static_cast(makeApiCallId(getClassId(), IComponentTypeMethodId::linkWithOptions)); + ParameterRecorder* recorder {}; + { + recorder = m_recordManager->beginMethodRecord(callId, m_componentHandle); + recorder->recordUint32(compilerOptionEntryCount); + recorder->recordStructArray(compilerOptionEntries, compilerOptionEntryCount); + recorder = m_recordManager->endMethodRecord(); + } + + SlangResult res = m_actualComponentType->linkWithOptions(outLinkedComponentType, compilerOptionEntryCount, compilerOptionEntries, outDiagnostics); + + { + recorder->recordAddress(*outLinkedComponentType); + recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); + m_recordManager->apendOutput(); + } + + if (SLANG_SUCCEEDED(res)) + { + // replaced output with our recorder + *outLinkedComponentType = getComponentTypeRecorder(*outLinkedComponentType); + } + return res; + } + + IComponentTypeRecorder* IComponentTypeRecorder::getComponentTypeRecorder(slang::IComponentType* componentTypes) + { + IComponentTypeRecorder* recorder = nullptr; + + if (componentTypes) + { + if (m_mapComponentTypeToRecorder.tryGetValue(componentTypes, recorder)) + { + ComPtr result(recorder); + return result.detach(); + } + + recorder = new CompositeComponentTypeRecorder(getSessionRecorder(), componentTypes, m_recordManager); + ComPtr result(recorder); + m_componentTypeRecorderAlloation.add(result); + m_mapComponentTypeToRecorder.add(componentTypes, result.detach()); + } + return recorder; + } +} diff --git a/source/slang-record-replay/record/slang-component-type.h b/source/slang-record-replay/record/slang-component-type.h new file mode 100644 index 000000000..110733044 --- /dev/null +++ b/source/slang-record-replay/record/slang-component-type.h @@ -0,0 +1,79 @@ +#ifndef SLANG_COMPONENT_TYPE_H +#define SLANG_COMPONENT_TYPE_H + +#include "slang-com-ptr.h" +#include "slang.h" +#include "slang-com-helper.h" +#include "../../core/slang-smart-pointer.h" +#include "../../slang/slang-compiler.h" +#include "record-manager.h" +#include "../util/record-utility.h" + +namespace SlangRecord +{ + using namespace Slang; + class SessionRecorder; + + class IComponentTypeRecorder: public slang::IComponentType + { + public: + explicit IComponentTypeRecorder(slang::IComponentType* componentType, RecordManager* recordManager); + + virtual SLANG_NO_THROW slang::ISession* SLANG_MCALL getSession() override; + virtual SLANG_NO_THROW slang::ProgramLayout* SLANG_MCALL getLayout( + SlangInt targetIndex = 0, + slang::IBlob** outDiagnostics = nullptr) override; + virtual SLANG_NO_THROW SlangInt SLANG_MCALL getSpecializationParamCount() override; + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointCode( + SlangInt entryPointIndex, + SlangInt targetIndex, + slang::IBlob** outCode, + slang::IBlob** outDiagnostics = nullptr) override; + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getResultAsFileSystem( + SlangInt entryPointIndex, + SlangInt targetIndex, + ISlangMutableFileSystem** outFileSystem) override; + virtual SLANG_NO_THROW void SLANG_MCALL getEntryPointHash( + SlangInt entryPointIndex, + SlangInt targetIndex, + slang::IBlob** outHash) override; + virtual SLANG_NO_THROW SlangResult SLANG_MCALL specialize( + slang::SpecializationArg const* specializationArgs, + SlangInt specializationArgCount, + slang::IComponentType** outSpecializedComponentType, + ISlangBlob** outDiagnostics = nullptr) override; + virtual SLANG_NO_THROW SlangResult SLANG_MCALL link( + slang::IComponentType** outLinkedComponentType, + ISlangBlob** outDiagnostics = nullptr) override; + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointHostCallable( + int entryPointIndex, + int targetIndex, + ISlangSharedLibrary** outSharedLibrary, + slang::IBlob** outDiagnostics = 0) override; + virtual SLANG_NO_THROW SlangResult SLANG_MCALL renameEntryPoint( + const char* newName, IComponentType** outEntryPoint) override; + virtual SLANG_NO_THROW SlangResult SLANG_MCALL linkWithOptions( + IComponentType** outLinkedComponentType, + uint32_t compilerOptionEntryCount, + slang::CompilerOptionEntry* compilerOptionEntries, + ISlangBlob** outDiagnostics = nullptr) override; + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getTargetCode( + SlangInt targetIndex, + slang::IBlob** outCode, + slang::IBlob** outDiagnostics = nullptr) override; + protected: + virtual ApiClassId getClassId() = 0; + virtual SessionRecorder* getSessionRecorder() = 0; + Slang::ComPtr m_actualComponentType; + uint64_t m_componentHandle = 0; + RecordManager* m_recordManager = nullptr; + private: + + IComponentTypeRecorder* getComponentTypeRecorder(slang::IComponentType* componentTypes); + + Dictionary m_mapComponentTypeToRecorder; + List> m_componentTypeRecorderAlloation; + }; +} + +#endif // #ifndef SLANG_COMPONENT_TYPE_H diff --git a/source/slang-record-replay/record/slang-composite-component-type.cpp b/source/slang-record-replay/record/slang-composite-component-type.cpp index 29ac5da8d..92e94040b 100644 --- a/source/slang-record-replay/record/slang-composite-component-type.cpp +++ b/source/slang-record-replay/record/slang-composite-component-type.cpp @@ -3,302 +3,21 @@ namespace SlangRecord { - CompositeComponentTypeRecorder::CompositeComponentTypeRecorder( - slang::IComponentType* componentType, RecordManager* recordManager) - : m_actualCompositeComponentType(componentType), - m_recordManager(recordManager) + CompositeComponentTypeRecorder::CompositeComponentTypeRecorder(SessionRecorder* sessionRecorder, + slang::IComponentType* componentType, + RecordManager* recordManager) + : IComponentTypeRecorder(componentType, recordManager), + m_sessionRecorder(sessionRecorder) { - SLANG_RECORD_ASSERT(m_actualCompositeComponentType != nullptr); - SLANG_RECORD_ASSERT(m_recordManager != nullptr); - - m_compositeComponentHandle = reinterpret_cast(m_actualCompositeComponentType.get()); slangRecordLog(LogLevel::Verbose, "%s: %p\n", __PRETTY_FUNCTION__, componentType); } ISlangUnknown* CompositeComponentTypeRecorder::getInterface(const Guid& guid) { - if (guid == IComponentType::getTypeGuid()) + if (guid == CompositeComponentTypeRecorder::getTypeGuid()) { return static_cast(this); } return nullptr; } - - SLANG_NO_THROW slang::ISession* CompositeComponentTypeRecorder::getSession() - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ICompositeComponentType_getSession, m_compositeComponentHandle); - recorder = m_recordManager->endMethodRecord(); - } - - slang::ISession* res = m_actualCompositeComponentType->getSession(); - - { - recorder->recordAddress(res); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW slang::ProgramLayout* CompositeComponentTypeRecorder::getLayout( - SlangInt targetIndex, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ICompositeComponentType_getLayout, m_compositeComponentHandle); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - slang::ProgramLayout* programLayout = m_actualCompositeComponentType->getLayout(targetIndex, outDiagnostics); - - { - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - recorder->recordAddress(programLayout); - m_recordManager->apendOutput(); - } - - return programLayout; - } - - SLANG_NO_THROW SlangInt CompositeComponentTypeRecorder::getSpecializationParamCount() - { - // No need to record this call as it is just a query. - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - SlangInt res = m_actualCompositeComponentType->getSpecializationParamCount(); - return res; - } - - SLANG_NO_THROW SlangResult CompositeComponentTypeRecorder::getEntryPointCode( - SlangInt entryPointIndex, - SlangInt targetIndex, - slang::IBlob** outCode, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ICompositeComponentType_getEntryPointCode, m_compositeComponentHandle); - recorder->recordInt64(entryPointIndex); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualCompositeComponentType->getEntryPointCode(entryPointIndex, targetIndex, outCode, outDiagnostics); - - { - recorder->recordAddress(*outCode); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult CompositeComponentTypeRecorder::getTargetCode( - SlangInt targetIndex, - slang::IBlob** outCode, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ICompositeComponentType_getTargetCode, m_compositeComponentHandle); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualCompositeComponentType->getTargetCode(targetIndex, outCode, outDiagnostics); - - { - recorder->recordAddress(*outCode); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult CompositeComponentTypeRecorder::getResultAsFileSystem( - SlangInt entryPointIndex, - SlangInt targetIndex, - ISlangMutableFileSystem** outFileSystem) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ICompositeComponentType_getResultAsFileSystem, m_compositeComponentHandle); - recorder->recordInt64(entryPointIndex); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualCompositeComponentType->getResultAsFileSystem(entryPointIndex, targetIndex, outFileSystem); - - { - recorder->recordAddress(*outFileSystem); - } - - // TODO: We might need to wrap the file system object. - return res; - } - - SLANG_NO_THROW void CompositeComponentTypeRecorder::getEntryPointHash( - SlangInt entryPointIndex, - SlangInt targetIndex, - slang::IBlob** outHash) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ICompositeComponentType_getEntryPointHash, m_compositeComponentHandle); - recorder->recordInt64(entryPointIndex); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - m_actualCompositeComponentType->getEntryPointHash(entryPointIndex, targetIndex, outHash); - - { - recorder->recordAddress(*outHash); - m_recordManager->apendOutput(); - } - } - - SLANG_NO_THROW SlangResult CompositeComponentTypeRecorder::specialize( - slang::SpecializationArg const* specializationArgs, - SlangInt specializationArgCount, - slang::IComponentType** outSpecializedComponentType, - ISlangBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ICompositeComponentType_specialize, m_compositeComponentHandle); - recorder->recordInt64(specializationArgCount); - recorder->recordStructArray(specializationArgs, specializationArgCount); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualCompositeComponentType->specialize(specializationArgs, specializationArgCount, outSpecializedComponentType, outDiagnostics); - - { - recorder->recordAddress(*outSpecializedComponentType); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult CompositeComponentTypeRecorder::link( - slang::IComponentType** outLinkedComponentType, - ISlangBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ICompositeComponentType_link, m_compositeComponentHandle); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualCompositeComponentType->link(outLinkedComponentType, outDiagnostics); - - { - recorder->recordAddress(*outLinkedComponentType); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult CompositeComponentTypeRecorder::getEntryPointHostCallable( - int entryPointIndex, - int targetIndex, - ISlangSharedLibrary** outSharedLibrary, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ICompositeComponentType_getEntryPointHostCallable, m_compositeComponentHandle); - recorder->recordInt32(entryPointIndex); - recorder->recordInt32(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualCompositeComponentType->getEntryPointHostCallable(entryPointIndex, targetIndex, outSharedLibrary, outDiagnostics); - - { - recorder->recordAddress(*outSharedLibrary); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult CompositeComponentTypeRecorder::renameEntryPoint( - const char* newName, IComponentType** outEntryPoint) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ICompositeComponentType_renameEntryPoint, m_compositeComponentHandle); - recorder->recordString(newName); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualCompositeComponentType->renameEntryPoint(newName, outEntryPoint); - - { - recorder->recordAddress(*outEntryPoint); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult CompositeComponentTypeRecorder::linkWithOptions( - IComponentType** outLinkedComponentType, - uint32_t compilerOptionEntryCount, - slang::CompilerOptionEntry* compilerOptionEntries, - ISlangBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ICompositeComponentType_linkWithOptions, m_compositeComponentHandle); - recorder->recordUint32(compilerOptionEntryCount); - recorder->recordStructArray(compilerOptionEntries, compilerOptionEntryCount); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualCompositeComponentType->linkWithOptions(outLinkedComponentType, compilerOptionEntryCount, compilerOptionEntries, outDiagnostics); - - { - recorder->recordAddress(*outLinkedComponentType); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } } diff --git a/source/slang-record-replay/record/slang-composite-component-type.h b/source/slang-record-replay/record/slang-composite-component-type.h index 2374bcda2..c5b77f432 100644 --- a/source/slang-record-replay/record/slang-composite-component-type.h +++ b/source/slang-record-replay/record/slang-composite-component-type.h @@ -7,69 +7,37 @@ #include "../../core/slang-smart-pointer.h" #include "../../core/slang-dictionary.h" #include "../../slang/slang-compiler.h" +#include "slang-component-type.h" #include "record-manager.h" namespace SlangRecord { using namespace Slang; - class CompositeComponentTypeRecorder: public slang::IComponentType, public RefObject + class SessionRecorder; + + class CompositeComponentTypeRecorder: public IComponentTypeRecorder, public RefObject { public: + SLANG_COM_INTERFACE(0x354f30a0, 0x3662, 0x4147, { 0xa2, 0x5d, 0x9b, 0xc6, 0x95, 0x73, 0x8e, 0x07 }) + SLANG_REF_OBJECT_IUNKNOWN_ALL ISlangUnknown* getInterface(const Guid& guid); - explicit CompositeComponentTypeRecorder(slang::IComponentType* componentType, RecordManager* recordManager); + explicit CompositeComponentTypeRecorder(SessionRecorder* sessionRecorder, slang::IComponentType* componentType, RecordManager* recordManager); - // Interfaces for `IComponentType` - virtual SLANG_NO_THROW slang::ISession* SLANG_MCALL getSession() override; - virtual SLANG_NO_THROW slang::ProgramLayout* SLANG_MCALL getLayout( - SlangInt targetIndex = 0, - slang::IBlob** outDiagnostics = nullptr) override; - virtual SLANG_NO_THROW SlangInt SLANG_MCALL getSpecializationParamCount() override; - virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointCode( - SlangInt entryPointIndex, - SlangInt targetIndex, - slang::IBlob** outCode, - slang::IBlob** outDiagnostics = nullptr) override; - virtual SLANG_NO_THROW SlangResult SLANG_MCALL getResultAsFileSystem( - SlangInt entryPointIndex, - SlangInt targetIndex, - ISlangMutableFileSystem** outFileSystem) override; - virtual SLANG_NO_THROW void SLANG_MCALL getEntryPointHash( - SlangInt entryPointIndex, - SlangInt targetIndex, - slang::IBlob** outHash) override; - virtual SLANG_NO_THROW SlangResult SLANG_MCALL specialize( - slang::SpecializationArg const* specializationArgs, - SlangInt specializationArgCount, - slang::IComponentType** outSpecializedComponentType, - ISlangBlob** outDiagnostics = nullptr) override; - virtual SLANG_NO_THROW SlangResult SLANG_MCALL link( - slang::IComponentType** outLinkedComponentType, - ISlangBlob** outDiagnostics = nullptr) override; - virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointHostCallable( - int entryPointIndex, - int targetIndex, - ISlangSharedLibrary** outSharedLibrary, - slang::IBlob** outDiagnostics = 0) override; - virtual SLANG_NO_THROW SlangResult SLANG_MCALL renameEntryPoint( - const char* newName, IComponentType** outEntryPoint) override; - virtual SLANG_NO_THROW SlangResult SLANG_MCALL linkWithOptions( - IComponentType** outLinkedComponentType, - uint32_t compilerOptionEntryCount, - slang::CompilerOptionEntry* compilerOptionEntries, - ISlangBlob** outDiagnostics = nullptr) override; - virtual SLANG_NO_THROW SlangResult SLANG_MCALL getTargetCode( - SlangInt targetIndex, - slang::IBlob** outCode, - slang::IBlob** outDiagnostics = nullptr) override; + slang::IComponentType* getActualCompositeComponentType() const { return m_actualComponentType; } + protected: + virtual ApiClassId getClassId() override + { + return ApiClassId::Class_ICompositeComponentType; + } - slang::IComponentType* getActualCompositeComponentType() const { return m_actualCompositeComponentType; } + virtual SessionRecorder* getSessionRecorder() override + { + return m_sessionRecorder; + } private: - Slang::ComPtr m_actualCompositeComponentType; - uint64_t m_compositeComponentHandle = 0; - RecordManager* m_recordManager = nullptr; - + SessionRecorder* m_sessionRecorder = nullptr; }; } #endif // SLANG_COMPOSITE_COMPONENT_TYPE_H diff --git a/source/slang-record-replay/record/slang-entrypoint.cpp b/source/slang-record-replay/record/slang-entrypoint.cpp index 7d43700e2..038ec321f 100644 --- a/source/slang-record-replay/record/slang-entrypoint.cpp +++ b/source/slang-record-replay/record/slang-entrypoint.cpp @@ -3,301 +3,23 @@ namespace SlangRecord { - EntryPointRecorder::EntryPointRecorder(slang::IEntryPoint* entryPoint, RecordManager* recordManager) - : m_actualEntryPoint(entryPoint), - m_recordManager(recordManager) + EntryPointRecorder::EntryPointRecorder(SessionRecorder* sessionRecorder, slang::IEntryPoint* entryPoint, RecordManager* recordManager) + : IComponentTypeRecorder(entryPoint, recordManager), + m_sessionRecorder(sessionRecorder), + m_actualEntryPoint(entryPoint) { SLANG_RECORD_ASSERT(m_actualEntryPoint != nullptr); - SLANG_RECORD_ASSERT(m_recordManager != nullptr); - - m_entryPointHandle = reinterpret_cast(m_actualEntryPoint.get()); slangRecordLog(LogLevel::Verbose, "%s: %p\n", __PRETTY_FUNCTION__, entryPoint); } ISlangUnknown* EntryPointRecorder::getInterface(const Guid& guid) { - if(guid == EntryPointRecorder::getTypeGuid()) - return static_cast(this); - else - return nullptr; - } - - SLANG_NO_THROW slang::ISession* EntryPointRecorder::getSession() - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IEntryPoint_getSession, m_entryPointHandle); - recorder = m_recordManager->endMethodRecord(); - } - - slang::ISession* session = m_actualEntryPoint->getSession(); - - { - recorder->recordAddress(session); - m_recordManager->apendOutput(); - } - - return session; - } - - SLANG_NO_THROW slang::ProgramLayout* EntryPointRecorder::getLayout( - SlangInt targetIndex, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IEntryPoint_getLayout, m_entryPointHandle); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - slang::ProgramLayout* programLayout = m_actualEntryPoint->getLayout(targetIndex, outDiagnostics); - - { - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - recorder->recordAddress(programLayout); - m_recordManager->apendOutput(); - } - - return programLayout; - } - - SLANG_NO_THROW SlangInt EntryPointRecorder::getSpecializationParamCount() - { - // No need to record this call as it is just a query. - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - SlangInt res = m_actualEntryPoint->getSpecializationParamCount(); - return res; - } - - SLANG_NO_THROW SlangResult EntryPointRecorder::getEntryPointCode( - SlangInt entryPointIndex, - SlangInt targetIndex, - slang::IBlob** outCode, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IEntryPoint_getEntryPointCode, m_entryPointHandle); - recorder->recordInt64(entryPointIndex); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualEntryPoint->getEntryPointCode(entryPointIndex, targetIndex, outCode, outDiagnostics); - - { - recorder->recordAddress(*outCode); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult EntryPointRecorder::getTargetCode( - SlangInt targetIndex, - slang::IBlob** outCode, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IEntryPoint_getTargetCode, m_entryPointHandle); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualEntryPoint->getTargetCode(targetIndex, outCode, outDiagnostics); - - { - recorder->recordAddress(*outCode); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult EntryPointRecorder::getResultAsFileSystem( - SlangInt entryPointIndex, - SlangInt targetIndex, - ISlangMutableFileSystem** outFileSystem) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IEntryPoint_getResultAsFileSystem, m_entryPointHandle); - recorder->recordInt64(entryPointIndex); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualEntryPoint->getResultAsFileSystem(entryPointIndex, targetIndex, outFileSystem); - - { - recorder->recordAddress(*outFileSystem); - } - - // TODO: We might need to wrap the file system object. - return res; - } - - SLANG_NO_THROW void EntryPointRecorder::getEntryPointHash( - SlangInt entryPointIndex, - SlangInt targetIndex, - slang::IBlob** outHash) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IEntryPoint_getEntryPointHash, m_entryPointHandle); - recorder->recordInt64(entryPointIndex); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - m_actualEntryPoint->getEntryPointHash(entryPointIndex, targetIndex, outHash); - - { - recorder->recordAddress(*outHash); - m_recordManager->apendOutput(); - } - } - - SLANG_NO_THROW SlangResult EntryPointRecorder::specialize( - slang::SpecializationArg const* specializationArgs, - SlangInt specializationArgCount, - slang::IComponentType** outSpecializedComponentType, - ISlangBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IEntryPoint_specialize, m_entryPointHandle); - recorder->recordInt64(specializationArgCount); - recorder->recordStructArray(specializationArgs, specializationArgCount); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualEntryPoint->specialize(specializationArgs, specializationArgCount, outSpecializedComponentType, outDiagnostics); - - { - recorder->recordAddress(*outSpecializedComponentType); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult EntryPointRecorder::link( - slang::IComponentType** outLinkedComponentType, - ISlangBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IEntryPoint_link, m_entryPointHandle); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualEntryPoint->link(outLinkedComponentType, outDiagnostics); - + if(guid == IEntryPointRecorder::getTypeGuid()) { - recorder->recordAddress(*outLinkedComponentType); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); + return static_cast(this); } - - return res; - } - - SLANG_NO_THROW SlangResult EntryPointRecorder::getEntryPointHostCallable( - int entryPointIndex, - int targetIndex, - ISlangSharedLibrary** outSharedLibrary, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IEntryPoint_getEntryPointHostCallable, m_entryPointHandle); - recorder->recordInt32(entryPointIndex); - recorder->recordInt32(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualEntryPoint->getEntryPointHostCallable(entryPointIndex, targetIndex, outSharedLibrary, outDiagnostics); - - { - recorder->recordAddress(*outSharedLibrary); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult EntryPointRecorder::renameEntryPoint( - const char* newName, IComponentType** outEntryPoint) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IEntryPoint_renameEntryPoint, m_entryPointHandle); - recorder->recordString(newName); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualEntryPoint->renameEntryPoint(newName, outEntryPoint); - - { - recorder->recordAddress(*outEntryPoint); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult EntryPointRecorder::linkWithOptions( - IComponentType** outLinkedComponentType, - uint32_t compilerOptionEntryCount, - slang::CompilerOptionEntry* compilerOptionEntries, - ISlangBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IEntryPoint_linkWithOptions, m_entryPointHandle); - recorder->recordUint32(compilerOptionEntryCount); - recorder->recordStructArray(compilerOptionEntries, compilerOptionEntryCount); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualEntryPoint->linkWithOptions(outLinkedComponentType, compilerOptionEntryCount, compilerOptionEntries, outDiagnostics); - - { - recorder->recordAddress(*outLinkedComponentType); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; + else + return nullptr; } SLANG_NO_THROW slang::FunctionReflection* EntryPointRecorder::getFunctionReflection() diff --git a/source/slang-record-replay/record/slang-entrypoint.h b/source/slang-record-replay/record/slang-entrypoint.h index 60c1bf369..abe2dc9c0 100644 --- a/source/slang-record-replay/record/slang-entrypoint.h +++ b/source/slang-record-replay/record/slang-entrypoint.h @@ -8,69 +8,141 @@ #include "../../core/slang-dictionary.h" #include "../../slang/slang-compiler.h" #include "record-manager.h" +#include "slang-component-type.h" namespace SlangRecord { using namespace Slang; - class EntryPointRecorder : public slang::IEntryPoint, public RefObject + class SessionRecorder; + + class IEntryPointRecorder : public slang::IEntryPoint, public RefObject { public: + // SLANG_COM_INTERFACE(0xf4c1e23d, 0xb321, 0x4931, { 0x8f, 0x37, 0xf1, 0x22, 0x6a, 0xf9, 0x20, 0x85 }) + // SLANG_REF_OBJECT_IUNKNOWN_ALL + // ISlangUnknown* getInterface(const Guid& guid) { (void)guid; return nullptr;} SLANG_COM_INTERFACE(0xf4c1e23d, 0xb321, 0x4931, { 0x8f, 0x37, 0xf1, 0x22, 0x6a, 0xf9, 0x20, 0x85 }) + }; + class EntryPointRecorder : public IEntryPointRecorder, public IComponentTypeRecorder + { + typedef IComponentTypeRecorder Super; + + public: SLANG_REF_OBJECT_IUNKNOWN_ALL ISlangUnknown* getInterface(const Guid& guid); - explicit EntryPointRecorder(slang::IEntryPoint* entryPoint, RecordManager* recordManager); + explicit EntryPointRecorder(SessionRecorder* sessionRecorder, slang::IEntryPoint* entryPoint, RecordManager* recordManager); // Interfaces for `IComponentType` - virtual SLANG_NO_THROW slang::ISession* SLANG_MCALL getSession() override; + virtual SLANG_NO_THROW slang::ISession* SLANG_MCALL getSession() override + { + return Super::getSession(); + } + virtual SLANG_NO_THROW slang::ProgramLayout* SLANG_MCALL getLayout( SlangInt targetIndex = 0, - slang::IBlob** outDiagnostics = nullptr) override; - virtual SLANG_NO_THROW SlangInt SLANG_MCALL getSpecializationParamCount() override; + slang::IBlob** outDiagnostics = nullptr) override + { + return Super::getLayout(targetIndex, outDiagnostics); + } + + virtual SLANG_NO_THROW SlangInt SLANG_MCALL getSpecializationParamCount() override + { + return Super::getSpecializationParamCount(); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointCode( SlangInt entryPointIndex, SlangInt targetIndex, slang::IBlob** outCode, - slang::IBlob** outDiagnostics = nullptr) override; + slang::IBlob** outDiagnostics = nullptr) override + { + return Super::getEntryPointCode(entryPointIndex, targetIndex, outCode, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getTargetCode( SlangInt targetIndex, slang::IBlob** outCode, - slang::IBlob** outDiagnostics = nullptr) override; + slang::IBlob** outDiagnostics = nullptr) override + { + return Super::getTargetCode(targetIndex, outCode, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getResultAsFileSystem( SlangInt entryPointIndex, SlangInt targetIndex, - ISlangMutableFileSystem** outFileSystem) override; + ISlangMutableFileSystem** outFileSystem) override + { + return Super::getResultAsFileSystem(entryPointIndex, targetIndex, outFileSystem); + } + virtual SLANG_NO_THROW void SLANG_MCALL getEntryPointHash( SlangInt entryPointIndex, SlangInt targetIndex, - slang::IBlob** outHash) override; + slang::IBlob** outHash) override + { + return Super::getEntryPointHash(entryPointIndex, targetIndex, outHash); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL specialize( slang::SpecializationArg const* specializationArgs, SlangInt specializationArgCount, slang::IComponentType** outSpecializedComponentType, - ISlangBlob** outDiagnostics = nullptr) override; + ISlangBlob** outDiagnostics = nullptr) override + { + return Super::specialize(specializationArgs, specializationArgCount, outSpecializedComponentType, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL link( slang::IComponentType** outLinkedComponentType, - ISlangBlob** outDiagnostics = nullptr) override; + ISlangBlob** outDiagnostics = nullptr) override + { + return Super::link(outLinkedComponentType, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointHostCallable( int entryPointIndex, int targetIndex, ISlangSharedLibrary** outSharedLibrary, - slang::IBlob** outDiagnostics = 0) override; + slang::IBlob** outDiagnostics = 0) override + { + return Super::getEntryPointHostCallable(entryPointIndex, targetIndex, outSharedLibrary, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL renameEntryPoint( - const char* newName, IComponentType** outEntryPoint) override; + const char* newName, IComponentType** outEntryPoint) override + { + return Super::renameEntryPoint(newName, outEntryPoint); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL linkWithOptions( IComponentType** outLinkedComponentType, uint32_t compilerOptionEntryCount, slang::CompilerOptionEntry* compilerOptionEntries, - ISlangBlob** outDiagnostics = nullptr) override; + ISlangBlob** outDiagnostics = nullptr) override + { + return Super::linkWithOptions(outLinkedComponentType, compilerOptionEntryCount, compilerOptionEntries, outDiagnostics); + } + + // Interfaces for `IEntryPoint` virtual SLANG_NO_THROW slang::FunctionReflection* SLANG_MCALL getFunctionReflection() override; + slang::IEntryPoint* getActualEntryPoint() const { return m_actualEntryPoint; } + + protected: + virtual ApiClassId getClassId() override + { + return ApiClassId::Class_IEntryPoint; + } + + virtual SessionRecorder* getSessionRecorder() override + { + return m_sessionRecorder; + } private: - Slang::ComPtr m_actualEntryPoint; - uint64_t m_entryPointHandle = 0; - RecordManager* m_recordManager = nullptr; + SessionRecorder* m_sessionRecorder; + Slang::ComPtr m_actualEntryPoint; }; } #endif // SLANG_ENTRY_POINT_H diff --git a/source/slang-record-replay/record/slang-global-session.cpp b/source/slang-record-replay/record/slang-global-session.cpp index c5350f760..e35b0ab76 100644 --- a/source/slang-record-replay/record/slang-global-session.cpp +++ b/source/slang-record-replay/record/slang-global-session.cpp @@ -13,7 +13,7 @@ namespace SlangRecord SLANG_RECORD_ASSERT(m_actualGlobalSession != nullptr); m_globalSessionHandle = reinterpret_cast(m_actualGlobalSession.get()); - m_recordManager = std::make_unique(m_globalSessionHandle); + m_recordManager = new RecordManager(m_globalSessionHandle); // We will use the address of the global session as the filename for the record manager // to make it unique for each global session. diff --git a/source/slang-record-replay/record/slang-global-session.h b/source/slang-record-replay/record/slang-global-session.h index 4242f4bff..25504ff02 100644 --- a/source/slang-record-replay/record/slang-global-session.h +++ b/source/slang-record-replay/record/slang-global-session.h @@ -76,8 +76,8 @@ namespace SlangRecord // be executed in different threads. But it's not a big problem, because slang doesn't allow multiple threads to access the same // session at the same time. So even if there is one session used by multiple threads, those threads will execute the compile jobs // sequentially. - std::unique_ptr m_recordManager; - uint64_t m_globalSessionHandle = 0; + Slang::RefPtr m_recordManager; + uint64_t m_globalSessionHandle = 0; }; } // namespace Slang diff --git a/source/slang-record-replay/record/slang-module.cpp b/source/slang-record-replay/record/slang-module.cpp index 3acda5d22..1ad04d4dc 100644 --- a/source/slang-record-replay/record/slang-module.cpp +++ b/source/slang-record-replay/record/slang-module.cpp @@ -1,10 +1,13 @@ #include "../util/record-utility.h" #include "slang-module.h" +#include "slang-session.h" namespace SlangRecord { - ModuleRecorder::ModuleRecorder(slang::IModule* module, RecordManager* recordManager) - : m_actualModule(module), + ModuleRecorder::ModuleRecorder(SessionRecorder* sessionRecorder, slang::IModule* module, RecordManager* recordManager) + : IComponentTypeRecorder(module, recordManager), + m_sessionRecorder(sessionRecorder), + m_actualModule(module), m_recordManager(recordManager) { SLANG_RECORD_ASSERT(m_actualModule != nullptr); @@ -16,8 +19,8 @@ namespace SlangRecord ISlangUnknown* ModuleRecorder::getInterface(const Guid& guid) { - if(guid == ModuleRecorder::getTypeGuid()) - return static_cast(this); + if(guid == IModuleRecorder::getTypeGuid()) + return static_cast(this); else return nullptr; } @@ -52,7 +55,7 @@ namespace SlangRecord if (SLANG_OK == res) { - EntryPointRecorder* entryPointRecord = getEntryPointRecorder(*outEntryPoint); + IEntryPointRecorder* entryPointRecord = getEntryPointRecorder(*outEntryPoint); *outEntryPoint = static_cast(entryPointRecord); } return res; @@ -88,13 +91,14 @@ namespace SlangRecord if (*outEntryPoint) { - EntryPointRecorder* entryPointRecord = nullptr; + IEntryPointRecorder* entryPointRecord = nullptr; bool ret = m_mapEntryPointToRecord.tryGetValue(*outEntryPoint, entryPointRecord); if (!ret) { SLANG_RECORD_ASSERT(!"Entrypoint not found in mapEntryPointToRecord"); } - *outEntryPoint = static_cast(entryPointRecord); + ComPtr result(static_cast(entryPointRecord)); + *outEntryPoint = result.detach(); } else *outEntryPoint = nullptr; @@ -187,7 +191,7 @@ namespace SlangRecord if (SLANG_OK == res) { - EntryPointRecorder* entryPointRecord = getEntryPointRecorder(*outEntryPoint); + IEntryPointRecorder* entryPointRecord = getEntryPointRecorder(*outEntryPoint); *outEntryPoint = static_cast(entryPointRecord); } return res; @@ -220,286 +224,23 @@ namespace SlangRecord return res; } - SLANG_NO_THROW slang::ISession* ModuleRecorder::getSession() - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - slang::ISession* session = m_actualModule->getSession(); - - return session; - } - - SLANG_NO_THROW slang::ProgramLayout* ModuleRecorder::getLayout( - SlangInt targetIndex, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IModule_getLayout, m_moduleHandle); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - slang::ProgramLayout* programLayout = m_actualModule->getLayout(targetIndex, outDiagnostics); - - { - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - recorder->recordAddress(programLayout); - m_recordManager->apendOutput(); - } - - return programLayout; - } - - SLANG_NO_THROW SlangInt ModuleRecorder::getSpecializationParamCount() - { - // No need to record this call as it is just a query. - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - SlangInt res = m_actualModule->getSpecializationParamCount(); - return res; - } - - SLANG_NO_THROW SlangResult ModuleRecorder::getEntryPointCode( - SlangInt entryPointIndex, - SlangInt targetIndex, - slang::IBlob** outCode, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IModule_getEntryPointCode, m_moduleHandle); - recorder->recordInt64(entryPointIndex); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualModule->getEntryPointCode(entryPointIndex, targetIndex, outCode, outDiagnostics); - - { - recorder->recordAddress(*outCode); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult ModuleRecorder::getTargetCode( - SlangInt targetIndex, - slang::IBlob** outCode, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IModule_getTargetCode, m_moduleHandle); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualModule->getTargetCode(targetIndex, outCode, outDiagnostics); - - { - recorder->recordAddress(*outCode); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult ModuleRecorder::getResultAsFileSystem( - SlangInt entryPointIndex, - SlangInt targetIndex, - ISlangMutableFileSystem** outFileSystem) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IModule_getResultAsFileSystem, m_moduleHandle); - recorder->recordInt64(entryPointIndex); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualModule->getResultAsFileSystem(entryPointIndex, targetIndex, outFileSystem); - - { - recorder->recordAddress(*outFileSystem); - m_recordManager->apendOutput(); - } - - // TODO: We might need to wrap the file system object. - return res; - } - - SLANG_NO_THROW void ModuleRecorder::getEntryPointHash( - SlangInt entryPointIndex, - SlangInt targetIndex, - slang::IBlob** outHash) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IModule_getEntryPointHash, m_moduleHandle); - recorder->recordInt64(entryPointIndex); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - m_actualModule->getEntryPointHash(entryPointIndex, targetIndex, outHash); - - { - recorder->recordAddress(*outHash); - m_recordManager->apendOutput(); - } - } - - SLANG_NO_THROW SlangResult ModuleRecorder::specialize( - slang::SpecializationArg const* specializationArgs, - SlangInt specializationArgCount, - slang::IComponentType** outSpecializedComponentType, - ISlangBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IModule_specialize, m_moduleHandle); - recorder->recordInt64(specializationArgCount); - recorder->recordStructArray(specializationArgs, specializationArgCount); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualModule->specialize(specializationArgs, specializationArgCount, outSpecializedComponentType, outDiagnostics); - - { - recorder->recordAddress(*outSpecializedComponentType); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult ModuleRecorder::link( - IComponentType** outLinkedComponentType, - ISlangBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IModule_link, m_moduleHandle); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualModule->link(outLinkedComponentType, outDiagnostics); - - { - recorder->recordAddress(*outLinkedComponentType); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult ModuleRecorder::getEntryPointHostCallable( - int entryPointIndex, - int targetIndex, - ISlangSharedLibrary** outSharedLibrary, - slang::IBlob** outDiagnostics) + IEntryPointRecorder* ModuleRecorder::getEntryPointRecorder(slang::IEntryPoint* entryPoint) { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IModule_getEntryPointHostCallable, m_moduleHandle); - recorder->recordInt32(entryPointIndex); - recorder->recordInt32(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualModule->getEntryPointHostCallable(entryPointIndex, targetIndex, outSharedLibrary, outDiagnostics); - - { - recorder->recordAddress(*outSharedLibrary); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult ModuleRecorder::renameEntryPoint( - const char* newName, IComponentType** outEntryPoint) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IModule_renameEntryPoint, m_moduleHandle); - recorder->recordString(newName); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualModule->renameEntryPoint(newName, outEntryPoint); - - { - recorder->recordAddress(*outEntryPoint); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult ModuleRecorder::linkWithOptions( - IComponentType** outLinkedComponentType, - uint32_t compilerOptionEntryCount, - slang::CompilerOptionEntry* compilerOptionEntries, - ISlangBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::IModule_linkWithOptions, m_moduleHandle); - recorder->recordUint32(compilerOptionEntryCount); - recorder->recordStructArray(compilerOptionEntries, compilerOptionEntryCount); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualModule->linkWithOptions(outLinkedComponentType, compilerOptionEntryCount, compilerOptionEntries, outDiagnostics); - - { - recorder->recordAddress(*outLinkedComponentType); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - EntryPointRecorder* ModuleRecorder::getEntryPointRecorder(slang::IEntryPoint* entryPoint) - { - EntryPointRecorder* entryPointRecord = nullptr; + IEntryPointRecorder* entryPointRecord = nullptr; bool ret = m_mapEntryPointToRecord.tryGetValue(entryPoint, entryPointRecord); if (!ret) { - entryPointRecord = new EntryPointRecorder(entryPoint, m_recordManager); - Slang::ComPtr result(entryPointRecord); + entryPointRecord = new EntryPointRecorder(m_sessionRecorder, entryPoint, m_recordManager); + Slang::ComPtr result(entryPointRecord); m_entryPointsRecordAllocation.add(result); m_mapEntryPointToRecord.add(entryPoint, result.detach()); + return entryPointRecord; + } + else + { + Slang::ComPtr result(entryPointRecord); + return result.detach(); } - return entryPointRecord; } } diff --git a/source/slang-record-replay/record/slang-module.h b/source/slang-record-replay/record/slang-module.h index ed684c680..e793bea98 100644 --- a/source/slang-record-replay/record/slang-module.h +++ b/source/slang-record-replay/record/slang-module.h @@ -12,15 +12,23 @@ namespace SlangRecord { using namespace Slang; - class ModuleRecorder : public slang::IModule, public RefObject + class SessionRecorder; + + class IModuleRecorder : public slang::IModule, public RefObject { public: SLANG_COM_INTERFACE(0xb1802991, 0x185a, 0x4a03, { 0xa7, 0x7e, 0x0c, 0x86, 0xe0, 0x68, 0x2a, 0xab }) + }; + + class ModuleRecorder : public IModuleRecorder, public IComponentTypeRecorder + { + typedef IComponentTypeRecorder Super; + public: SLANG_REF_OBJECT_IUNKNOWN_ALL ISlangUnknown* getInterface(const Guid& guid); - explicit ModuleRecorder(slang::IModule* module, RecordManager* recordManager); + explicit ModuleRecorder(SessionRecorder* sessionRecorder, slang::IModule* module, RecordManager* recordManager); // Interfaces for `IModule` virtual SLANG_NO_THROW SlangResult SLANG_MCALL findEntryPointByName( @@ -43,62 +51,126 @@ namespace SlangRecord ISlangBlob** outDiagnostics) override; // Interfaces for `IComponentType` - virtual SLANG_NO_THROW slang::ISession* SLANG_MCALL getSession() override; + virtual SLANG_NO_THROW slang::ISession* SLANG_MCALL getSession() override + { + return Super::getSession(); + } + virtual SLANG_NO_THROW slang::ProgramLayout* SLANG_MCALL getLayout( SlangInt targetIndex = 0, - slang::IBlob** outDiagnostics = nullptr) override; - virtual SLANG_NO_THROW SlangInt SLANG_MCALL getSpecializationParamCount() override; + slang::IBlob** outDiagnostics = nullptr) override + { + return Super::getLayout(targetIndex, outDiagnostics); + } + + virtual SLANG_NO_THROW SlangInt SLANG_MCALL getSpecializationParamCount() override + { + return Super::getSpecializationParamCount(); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointCode( SlangInt entryPointIndex, SlangInt targetIndex, slang::IBlob** outCode, - slang::IBlob** outDiagnostics = nullptr) override; + slang::IBlob** outDiagnostics = nullptr) override + { + return Super::getEntryPointCode(entryPointIndex, targetIndex, outCode, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getTargetCode( SlangInt targetIndex, slang::IBlob** outCode, - slang::IBlob** outDiagnostics = nullptr) override; + slang::IBlob** outDiagnostics = nullptr) override + { + return Super::getTargetCode(targetIndex, outCode, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getResultAsFileSystem( SlangInt entryPointIndex, SlangInt targetIndex, - ISlangMutableFileSystem** outFileSystem) override; + ISlangMutableFileSystem** outFileSystem) override + { + return Super::getResultAsFileSystem(entryPointIndex, targetIndex, outFileSystem); + } + virtual SLANG_NO_THROW void SLANG_MCALL getEntryPointHash( SlangInt entryPointIndex, SlangInt targetIndex, - slang::IBlob** outHash) override; + slang::IBlob** outHash) override + { + return Super::getEntryPointHash(entryPointIndex, targetIndex, outHash); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL specialize( slang::SpecializationArg const* specializationArgs, SlangInt specializationArgCount, slang::IComponentType** outSpecializedComponentType, - ISlangBlob** outDiagnostics = nullptr) override; + ISlangBlob** outDiagnostics = nullptr) override + { + return Super::specialize(specializationArgs, specializationArgCount, outSpecializedComponentType, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL link( slang::IComponentType** outLinkedComponentType, - ISlangBlob** outDiagnostics = nullptr) override; + ISlangBlob** outDiagnostics = nullptr) override + { + return Super::link(outLinkedComponentType, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointHostCallable( int entryPointIndex, int targetIndex, ISlangSharedLibrary** outSharedLibrary, - slang::IBlob** outDiagnostics = 0) override; + slang::IBlob** outDiagnostics = 0) override + { + return Super::getEntryPointHostCallable(entryPointIndex, targetIndex, outSharedLibrary, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL renameEntryPoint( - const char* newName, IComponentType** outEntryPoint) override; + const char* newName, IComponentType** outEntryPoint) override + { + return Super::renameEntryPoint(newName, outEntryPoint); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL linkWithOptions( IComponentType** outLinkedComponentType, uint32_t compilerOptionEntryCount, slang::CompilerOptionEntry* compilerOptionEntries, - ISlangBlob** outDiagnostics = nullptr) override; + ISlangBlob** outDiagnostics = nullptr) override + { + return Super::linkWithOptions(outLinkedComponentType, compilerOptionEntryCount, compilerOptionEntries, outDiagnostics); + } + virtual SLANG_NO_THROW slang::DeclReflection* getModuleReflection() override; slang::IModule* getActualModule() const { return m_actualModule; } + + protected: + + // `IComponentTypeRecorder` interface + virtual ApiClassId getClassId() override + { + return ApiClassId::Class_IModule; + } + + virtual SessionRecorder* getSessionRecorder() override + { + return m_sessionRecorder; + } + private: - EntryPointRecorder* getEntryPointRecorder(slang::IEntryPoint* entryPoint); + IEntryPointRecorder* getEntryPointRecorder(slang::IEntryPoint* entryPoint); + + SessionRecorder* m_sessionRecorder; Slang::ComPtr m_actualModule; uint64_t m_moduleHandle = 0; - RecordManager* m_recordManager = nullptr; + RecordManager* m_recordManager = nullptr; // `IEntryPoint` can only be created from 'IModule', so we need to record it in // this class, and create a map such that we don't create new `EntryPointRecorder` // for the same `IEntryPoint`. - Dictionary m_mapEntryPointToRecord; - List> m_entryPointsRecordAllocation; + Dictionary m_mapEntryPointToRecord; + List> m_entryPointsRecordAllocation; }; } // namespace SlangRecord diff --git a/source/slang-record-replay/record/slang-session.cpp b/source/slang-record-replay/record/slang-session.cpp index f38d18aa1..9ccaedc6e 100644 --- a/source/slang-record-replay/record/slang-session.cpp +++ b/source/slang-record-replay/record/slang-session.cpp @@ -3,6 +3,7 @@ #include "slang-entrypoint.h" #include "slang-composite-component-type.h" #include "slang-type-conformance.h" +#include "slang-component-type.h" namespace SlangRecord { @@ -54,7 +55,7 @@ namespace SlangRecord m_recordManager->apendOutput(); } - ModuleRecorder* pModuleRecorder = getModuleRecorder(pModule); + IModuleRecorder* pModuleRecorder = getModuleRecorder(pModule); return static_cast(pModuleRecorder); } @@ -83,7 +84,7 @@ namespace SlangRecord m_recordManager->apendOutput(); } - ModuleRecorder* pModuleRecorder = getModuleRecorder(pModule); + IModuleRecorder* pModuleRecorder = getModuleRecorder(pModule); return static_cast(pModuleRecorder); } @@ -112,7 +113,7 @@ namespace SlangRecord m_recordManager->apendOutput(); } - ModuleRecorder* pModuleRecorder = getModuleRecorder(pModule); + IModuleRecorder* pModuleRecorder = getModuleRecorder(pModule); return static_cast(pModuleRecorder); } @@ -142,7 +143,7 @@ namespace SlangRecord m_recordManager->apendOutput(); } - ModuleRecorder* pModuleRecorder = getModuleRecorder(pModule); + IModuleRecorder* pModuleRecorder = getModuleRecorder(pModule); return static_cast(pModuleRecorder); } @@ -181,7 +182,7 @@ namespace SlangRecord if (SLANG_OK == result) { CompositeComponentTypeRecorder* compositeComponentTypeRecord = - new CompositeComponentTypeRecorder(*outCompositeComponentType, m_recordManager); + new CompositeComponentTypeRecorder(this, *outCompositeComponentType, m_recordManager); Slang::ComPtr resultRecord(compositeComponentTypeRecord); *outCompositeComponentType = resultRecord.detach(); } @@ -387,8 +388,8 @@ namespace SlangRecord if (SLANG_OK != result) { - TypeConformanceRecorder* conformanceRecord = new TypeConformanceRecorder(*outConformance, m_recordManager); - Slang::ComPtr resultRecord(conformanceRecord); + ITypeConformanceRecorder* conformanceRecord = new TypeConformanceRecorder(this, *outConformance, m_recordManager); + Slang::ComPtr resultRecord(conformanceRecord); *outConformance = resultRecord.detach(); } @@ -444,13 +445,14 @@ namespace SlangRecord if (pModule) { - ModuleRecorder* moduleRecord = nullptr; + IModuleRecorder* moduleRecord = nullptr; bool ret = m_mapModuleToRecord.tryGetValue(pModule, moduleRecord); if (!ret) { SLANG_RECORD_ASSERT(!"Module not found in mapModuleToRecord"); } - return static_cast(moduleRecord); + ComPtr result(static_cast(moduleRecord)); + return result.detach(); } return pModule; @@ -464,17 +466,23 @@ namespace SlangRecord return result; } - ModuleRecorder* SessionRecorder::getModuleRecorder(slang::IModule* module) + IModuleRecorder* SessionRecorder::getModuleRecorder(slang::IModule* module) { - ModuleRecorder* moduleRecord = nullptr; + IModuleRecorder* moduleRecord = nullptr; bool ret = m_mapModuleToRecord.tryGetValue(module, moduleRecord); if (!ret) { - moduleRecord = new ModuleRecorder(module, m_recordManager); - Slang::ComPtr result(moduleRecord); + moduleRecord = new ModuleRecorder(this, module, m_recordManager); + Slang::ComPtr result(moduleRecord); m_moduleRecordersAlloation.add(result); m_mapModuleToRecord.add(module, result.detach()); } + else + { + ComPtr result(moduleRecord); + return result.detach(); + } + return moduleRecord; } @@ -488,16 +496,26 @@ namespace SlangRecord slang::IComponentType* const& componentType = componentTypes[i]; void* outObj = nullptr; - if (componentType->queryInterface(ModuleRecorder::getTypeGuid(), &outObj) == SLANG_OK) + if (componentType->queryInterface(IModuleRecorder::getTypeGuid(), &outObj) == SLANG_OK) { ModuleRecorder* moduleRecord = static_cast(outObj); outActualComponentTypes.add(moduleRecord->getActualModule()); } - else if (componentType->queryInterface(EntryPointRecorder::getTypeGuid(), &outObj) == SLANG_OK) + else if (componentType->queryInterface(IEntryPointRecorder::getTypeGuid(), &outObj) == SLANG_OK) { EntryPointRecorder* entrypointRecord = static_cast(outObj); outActualComponentTypes.add(entrypointRecord->getActualEntryPoint()); } + else if (componentType->queryInterface(CompositeComponentTypeRecorder::getTypeGuid(), &outObj) == SLANG_OK) + { + CompositeComponentTypeRecorder* compositeComponentTypeRecord = static_cast(outObj); + outActualComponentTypes.add(compositeComponentTypeRecord->getActualCompositeComponentType()); + } + else if (componentType->queryInterface(ITypeConformanceRecorder::getTypeGuid(), &outObj) == SLANG_OK) + { + TypeConformanceRecorder* typeConformanceRecorder = static_cast(outObj); + outActualComponentTypes.add(typeConformanceRecorder->getActualTypeConformance()); + } // will fall back to the actual component type, it means that we didn't record this type. else { diff --git a/source/slang-record-replay/record/slang-session.h b/source/slang-record-replay/record/slang-session.h index 644c975ff..e1f88675f 100644 --- a/source/slang-record-replay/record/slang-session.h +++ b/source/slang-record-replay/record/slang-session.h @@ -96,13 +96,13 @@ namespace SlangRecord SlangInt componentTypeCount, List& outActualComponentTypes); - ModuleRecorder* getModuleRecorder(slang::IModule* module); + IModuleRecorder* getModuleRecorder(slang::IModule* module); Slang::ComPtr m_actualSession; uint64_t m_sessionHandle = 0; - Dictionary m_mapModuleToRecord; - List> m_moduleRecordersAlloation; + Dictionary m_mapModuleToRecord; + List> m_moduleRecordersAlloation; RecordManager* m_recordManager = nullptr; }; } diff --git a/source/slang-record-replay/record/slang-type-conformance.cpp b/source/slang-record-replay/record/slang-type-conformance.cpp index 56433f700..9b27215d0 100644 --- a/source/slang-record-replay/record/slang-type-conformance.cpp +++ b/source/slang-record-replay/record/slang-type-conformance.cpp @@ -3,9 +3,10 @@ namespace SlangRecord { - TypeConformanceRecorder::TypeConformanceRecorder(slang::ITypeConformance* typeConformance, RecordManager* recordManager) - : m_actualTypeConformance(typeConformance), - m_recordManager(recordManager) + TypeConformanceRecorder::TypeConformanceRecorder(SessionRecorder* sessionRecorder, slang::ITypeConformance* typeConformance, RecordManager* recordManager) + : IComponentTypeRecorder(typeConformance, recordManager), + m_sessionRecorder(sessionRecorder), + m_actualTypeConformance(typeConformance) { SLANG_RECORD_ASSERT(m_actualTypeConformance != nullptr); SLANG_RECORD_ASSERT(m_recordManager != nullptr); @@ -16,290 +17,13 @@ namespace SlangRecord ISlangUnknown* TypeConformanceRecorder::getInterface(const Guid& guid) { - if (guid == TypeConformanceRecorder::getTypeGuid()) + if (guid == ITypeConformanceRecorder::getTypeGuid()) { - return static_cast(this); + return static_cast(this); } else { return nullptr; } } - - SLANG_NO_THROW slang::ISession* TypeConformanceRecorder::getSession() - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ITypeConformance_getSession, m_typeConformanceHandle); - recorder = m_recordManager->endMethodRecord(); - } - - slang::ISession* res = m_actualTypeConformance->getSession(); - - { - recorder->recordAddress(res); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW slang::ProgramLayout* TypeConformanceRecorder::getLayout( - SlangInt targetIndex, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ICompositeComponentType_getLayout, m_typeConformanceHandle); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - slang::ProgramLayout* programLayout = m_actualTypeConformance->getLayout(targetIndex, outDiagnostics); - - { - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - recorder->recordAddress(programLayout); - m_recordManager->apendOutput(); - } - - return programLayout; - } - - SLANG_NO_THROW SlangInt TypeConformanceRecorder::getSpecializationParamCount() - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - SlangInt res = m_actualTypeConformance->getSpecializationParamCount(); - return res; - } - - SLANG_NO_THROW SlangResult TypeConformanceRecorder::getEntryPointCode( - SlangInt entryPointIndex, - SlangInt targetIndex, - slang::IBlob** outCode, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ITypeConformance_getEntryPointCode, m_typeConformanceHandle); - recorder->recordInt64(entryPointIndex); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualTypeConformance->getEntryPointCode(entryPointIndex, targetIndex, outCode, outDiagnostics); - - { - recorder->recordAddress(*outCode); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult TypeConformanceRecorder::getTargetCode( - SlangInt targetIndex, - slang::IBlob** outCode, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ITypeConformance_getTargetCode, m_typeConformanceHandle); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualTypeConformance->getTargetCode(targetIndex, outCode, outDiagnostics); - - { - recorder->recordAddress(*outCode); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult TypeConformanceRecorder::getResultAsFileSystem( - SlangInt entryPointIndex, - SlangInt targetIndex, - ISlangMutableFileSystem** outFileSystem) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ITypeConformance_getResultAsFileSystem, m_typeConformanceHandle); - recorder->recordInt64(entryPointIndex); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualTypeConformance->getResultAsFileSystem(entryPointIndex, targetIndex, outFileSystem); - - { - recorder->recordAddress(*outFileSystem); - } - - // TODO: We might need to wrap the file system object. - return res; - } - - SLANG_NO_THROW void TypeConformanceRecorder::getEntryPointHash( - SlangInt entryPointIndex, - SlangInt targetIndex, - slang::IBlob** outHash) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ITypeConformance_getEntryPointHash, m_typeConformanceHandle); - recorder->recordInt64(entryPointIndex); - recorder->recordInt64(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - m_actualTypeConformance->getEntryPointHash(entryPointIndex, targetIndex, outHash); - - { - recorder->recordAddress(*outHash); - m_recordManager->apendOutput(); - } - } - - SLANG_NO_THROW SlangResult TypeConformanceRecorder::specialize( - slang::SpecializationArg const* specializationArgs, - SlangInt specializationArgCount, - slang::IComponentType** outSpecializedComponentType, - ISlangBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ITypeConformance_specialize, m_typeConformanceHandle); - recorder->recordInt64(specializationArgCount); - recorder->recordStructArray(specializationArgs, specializationArgCount); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualTypeConformance->specialize(specializationArgs, specializationArgCount, outSpecializedComponentType, outDiagnostics); - - { - recorder->recordAddress(*outSpecializedComponentType); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult TypeConformanceRecorder::link( - slang::IComponentType** outLinkedComponentType, - ISlangBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ITypeConformance_link, m_typeConformanceHandle); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualTypeConformance->link(outLinkedComponentType, outDiagnostics); - - { - recorder->recordAddress(*outLinkedComponentType); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult TypeConformanceRecorder::getEntryPointHostCallable( - int entryPointIndex, - int targetIndex, - ISlangSharedLibrary** outSharedLibrary, - slang::IBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ITypeConformance_getEntryPointHostCallable, m_typeConformanceHandle); - recorder->recordInt32(entryPointIndex); - recorder->recordInt32(targetIndex); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualTypeConformance->getEntryPointHostCallable(entryPointIndex, targetIndex, outSharedLibrary, outDiagnostics); - - { - recorder->recordAddress(*outSharedLibrary); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult TypeConformanceRecorder::renameEntryPoint( - const char* newName, IComponentType** outEntryPoint) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ITypeConformance_renameEntryPoint, m_typeConformanceHandle); - recorder->recordString(newName); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualTypeConformance->renameEntryPoint(newName, outEntryPoint); - - { - recorder->recordAddress(*outEntryPoint); - m_recordManager->apendOutput(); - } - - return res; - } - - SLANG_NO_THROW SlangResult TypeConformanceRecorder::linkWithOptions( - IComponentType** outLinkedComponentType, - uint32_t compilerOptionEntryCount, - slang::CompilerOptionEntry* compilerOptionEntries, - ISlangBlob** outDiagnostics) - { - slangRecordLog(LogLevel::Verbose, "%s\n", __PRETTY_FUNCTION__); - - ParameterRecorder* recorder {}; - { - recorder = m_recordManager->beginMethodRecord(ApiCallId::ITypeConformance_linkWithOptions, m_typeConformanceHandle); - recorder->recordUint32(compilerOptionEntryCount); - recorder->recordStructArray(compilerOptionEntries, compilerOptionEntryCount); - recorder = m_recordManager->endMethodRecord(); - } - - SlangResult res = m_actualTypeConformance->linkWithOptions(outLinkedComponentType, compilerOptionEntryCount, compilerOptionEntries, outDiagnostics); - - { - recorder->recordAddress(*outLinkedComponentType); - recorder->recordAddress(outDiagnostics ? *outDiagnostics : nullptr); - m_recordManager->apendOutput(); - } - - return res; - } } diff --git a/source/slang-record-replay/record/slang-type-conformance.h b/source/slang-record-replay/record/slang-type-conformance.h index 7beabcca5..d1dfb3238 100644 --- a/source/slang-record-replay/record/slang-type-conformance.h +++ b/source/slang-record-replay/record/slang-type-conformance.h @@ -8,69 +8,136 @@ #include "../../core/slang-dictionary.h" #include "../../slang/slang-compiler.h" #include "record-manager.h" +#include "slang-component-type.h" namespace SlangRecord { using namespace Slang; - class TypeConformanceRecorder: public slang::ITypeConformance, public RefObject + class SessionRecorder; + + class ITypeConformanceRecorder : public slang::ITypeConformance, public RefObject { public: SLANG_COM_INTERFACE(0x0e67d05d, 0xee0a, 0x41e1, { 0xb5, 0xa3, 0x23, 0xe3, 0xb0, 0xec, 0x33, 0xf1 }) + }; + class TypeConformanceRecorder: public ITypeConformanceRecorder, public IComponentTypeRecorder + { + typedef IComponentTypeRecorder Super; + public: SLANG_REF_OBJECT_IUNKNOWN_ALL ISlangUnknown* getInterface(const Guid& guid); - explicit TypeConformanceRecorder(slang::ITypeConformance* typeConformance, RecordManager* recordManager); + explicit TypeConformanceRecorder(SessionRecorder* sessionRecorder, slang::ITypeConformance* typeConformance, RecordManager* recordManager); // Interfaces for `IComponentType` - virtual SLANG_NO_THROW slang::ISession* SLANG_MCALL getSession() override; + virtual SLANG_NO_THROW slang::ISession* SLANG_MCALL getSession() override + { + return Super::getSession(); + } + virtual SLANG_NO_THROW slang::ProgramLayout* SLANG_MCALL getLayout( SlangInt targetIndex = 0, - slang::IBlob** outDiagnostics = nullptr) override; - virtual SLANG_NO_THROW SlangInt SLANG_MCALL getSpecializationParamCount() override; + slang::IBlob** outDiagnostics = nullptr) override + { + return Super::getLayout(targetIndex, outDiagnostics); + } + + virtual SLANG_NO_THROW SlangInt SLANG_MCALL getSpecializationParamCount() override + { + return Super::getSpecializationParamCount(); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointCode( SlangInt entryPointIndex, SlangInt targetIndex, slang::IBlob** outCode, - slang::IBlob** outDiagnostics = nullptr) override; + slang::IBlob** outDiagnostics = nullptr) override + { + return Super::getEntryPointCode(entryPointIndex, targetIndex, outCode, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getTargetCode( SlangInt targetIndex, slang::IBlob** outCode, - slang::IBlob** outDiagnostics = nullptr) override; + slang::IBlob** outDiagnostics = nullptr) override + { + return Super::getTargetCode(targetIndex, outCode, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getResultAsFileSystem( SlangInt entryPointIndex, SlangInt targetIndex, - ISlangMutableFileSystem** outFileSystem) override; + ISlangMutableFileSystem** outFileSystem) override + { + return Super::getResultAsFileSystem(entryPointIndex, targetIndex, outFileSystem); + } + virtual SLANG_NO_THROW void SLANG_MCALL getEntryPointHash( SlangInt entryPointIndex, SlangInt targetIndex, - slang::IBlob** outHash) override; + slang::IBlob** outHash) override + { + return Super::getEntryPointHash(entryPointIndex, targetIndex, outHash); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL specialize( slang::SpecializationArg const* specializationArgs, SlangInt specializationArgCount, slang::IComponentType** outSpecializedComponentType, - ISlangBlob** outDiagnostics = nullptr) override; + ISlangBlob** outDiagnostics = nullptr) override + { + return Super::specialize(specializationArgs, specializationArgCount, outSpecializedComponentType, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL link( slang::IComponentType** outLinkedComponentType, - ISlangBlob** outDiagnostics = nullptr) override; + ISlangBlob** outDiagnostics = nullptr) override + { + return Super::link(outLinkedComponentType, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL getEntryPointHostCallable( int entryPointIndex, int targetIndex, ISlangSharedLibrary** outSharedLibrary, - slang::IBlob** outDiagnostics = 0) override; + slang::IBlob** outDiagnostics = 0) override + { + return Super::getEntryPointHostCallable(entryPointIndex, targetIndex, outSharedLibrary, outDiagnostics); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL renameEntryPoint( - const char* newName, IComponentType** outEntryPoint) override; + const char* newName, IComponentType** outEntryPoint) override + { + return Super::renameEntryPoint(newName, outEntryPoint); + } + virtual SLANG_NO_THROW SlangResult SLANG_MCALL linkWithOptions( IComponentType** outLinkedComponentType, uint32_t compilerOptionEntryCount, slang::CompilerOptionEntry* compilerOptionEntries, - ISlangBlob** outDiagnostics = nullptr) override; + ISlangBlob** outDiagnostics = nullptr) override + { + return Super::linkWithOptions(outLinkedComponentType, compilerOptionEntryCount, compilerOptionEntries, outDiagnostics); + } slang::ITypeConformance* getActualTypeConformance() const { return m_actualTypeConformance; } + + protected: + virtual ApiClassId getClassId() override + { + return ApiClassId::Class_ITypeConformance; + } + + virtual SessionRecorder* getSessionRecorder() override + { + return m_sessionRecorder; + } private: + SessionRecorder* m_sessionRecorder = nullptr; Slang::ComPtr m_actualTypeConformance; uint64_t m_typeConformanceHandle = 0; - RecordManager* m_recordManager = nullptr; + RecordManager* m_recordManager = nullptr; }; } #endif // SLANG_TYPE_CONFORMANCE_H diff --git a/source/slang-record-replay/replay/json-consumer.cpp b/source/slang-record-replay/replay/json-consumer.cpp index d8079c255..27b2830d6 100644 --- a/source/slang-record-replay/replay/json-consumer.cpp +++ b/source/slang-record-replay/replay/json-consumer.cpp @@ -77,8 +77,8 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, functionName); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); - _writePairNoComma(builder, indent, "retSession", Slang::StringUtil::makeStringWithFormat("0x%X", outSessionId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePairNoComma(builder, indent, "retSession", Slang::StringUtil::makeStringWithFormat("0x%llX", outSessionId)); } } @@ -97,10 +97,10 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, functionName); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "targetIndex", targetIndex); - _writePair(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%X", outDiagnosticsId)); - _writePairNoComma(builder, indent, "retProgramLayout", Slang::StringUtil::makeStringWithFormat("0x%X", retProgramLayoutId)); + _writePair(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnosticsId)); + _writePairNoComma(builder, indent, "retProgramLayout", Slang::StringUtil::makeStringWithFormat("0x%llX", retProgramLayoutId)); } } @@ -119,11 +119,11 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, functionName); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "entryPointIndex", entryPointIndex); _writePair(builder, indent, "targetIndex", targetIndex); - _writePair(builder, indent, "outCode", Slang::StringUtil::makeStringWithFormat("0x%X", outCodeId)); - _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%X", outDiagnosticsId)); + _writePair(builder, indent, "outCode", Slang::StringUtil::makeStringWithFormat("0x%llX", outCodeId)); + _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnosticsId)); } } @@ -142,10 +142,10 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, functionName); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "targetIndex", targetIndex); - _writePair(builder, indent, "outCode", Slang::StringUtil::makeStringWithFormat("0x%X", outCodeId)); - _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%X", outDiagnosticsId)); + _writePair(builder, indent, "outCode", Slang::StringUtil::makeStringWithFormat("0x%llX", outCodeId)); + _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnosticsId)); } } @@ -164,10 +164,10 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, functionName); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "entryPointIndex", entryPointIndex); _writePair(builder, indent, "targetIndex", targetIndex); - _writePairNoComma(builder, indent, "outFileSystem", Slang::StringUtil::makeStringWithFormat("0x%X", outFileSystemId)); + _writePairNoComma(builder, indent, "outFileSystem", Slang::StringUtil::makeStringWithFormat("0x%llX", outFileSystemId)); } } @@ -186,10 +186,10 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, functionName); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "entryPointIndex", entryPointIndex); _writePair(builder, indent, "targetIndex", targetIndex); - _writePairNoComma(builder, indent, "outHash", Slang::StringUtil::makeStringWithFormat("0x%X", outHashId)); + _writePairNoComma(builder, indent, "outHash", Slang::StringUtil::makeStringWithFormat("0x%llX", outHashId)); } } @@ -209,7 +209,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, functionName); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); if (specializationArgCount) { ScopeWritterForKey scopeWritterForArgs(&builder, &indent, "specializationArgs", false); @@ -219,7 +219,7 @@ namespace SlangRecord ScopeWritterForKey scopeWritterForArg(&builder, &indent, Slang::StringUtil::makeStringWithFormat("[%d]", i), isLastField); { _writePair(builder, indent, "kind", SpecializationArgKindToString(specializationArgs[i].kind)); - _writePairNoComma(builder, indent, "type", Slang::StringUtil::makeStringWithFormat("0x%X", specializationArgs[i].type)); + _writePairNoComma(builder, indent, "type", Slang::StringUtil::makeStringWithFormat("0x%llX", specializationArgs[i].type)); } } } @@ -228,8 +228,8 @@ namespace SlangRecord _writePair(builder, indent, "specializationArgs", "nullptr"); } _writePair(builder, indent, "specializationArgCount", specializationArgCount); - _writePair(builder, indent, "outSpecializedComponentType", Slang::StringUtil::makeStringWithFormat("0x%X", outSpecializedComponentTypeId)); - _writePairNoComma(builder, indent, "outSpecializedComponentType", Slang::StringUtil::makeStringWithFormat("0x%X", outDiagnosticsId)); + _writePair(builder, indent, "outSpecializedComponentType", Slang::StringUtil::makeStringWithFormat("0x%llX", outSpecializedComponentTypeId)); + _writePairNoComma(builder, indent, "outSpecializedComponentType", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnosticsId)); } } @@ -248,9 +248,9 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, functionName); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); - _writePair(builder, indent, "outLinkedComponentType", Slang::StringUtil::makeStringWithFormat("0x%X", outLinkedComponentTypeId)); - _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%X", outDiagnosticsId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePair(builder, indent, "outLinkedComponentType", Slang::StringUtil::makeStringWithFormat("0x%llX", outLinkedComponentTypeId)); + _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnosticsId)); } } @@ -270,11 +270,11 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, functionName); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "entryPointIndex", entryPointIndex); _writePair(builder, indent, "targetIndex", targetIndex); - _writePair(builder, indent, "outSharedLibrary", Slang::StringUtil::makeStringWithFormat("0x%X", outSharedLibraryId)); - _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%X", outDiagnosticsId)); + _writePair(builder, indent, "outSharedLibrary", Slang::StringUtil::makeStringWithFormat("0x%llX", outSharedLibraryId)); + _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnosticsId)); } } @@ -293,10 +293,10 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, functionName); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "newName", Slang::StringUtil::makeStringWithFormat("\"%s\"", newName != nullptr ? newName : "nullptr")); - _writePairNoComma(builder, indent, "outEntryPoint", Slang::StringUtil::makeStringWithFormat("0x%X", outEntryPointId)); + _writePairNoComma(builder, indent, "outEntryPoint", Slang::StringUtil::makeStringWithFormat("0x%llX", outEntryPointId)); } } @@ -318,13 +318,13 @@ namespace SlangRecord ScopeWritterForKey scopeWritter(&builder, &indent, functionName); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "compilerOptionEntryCount", compilerOptionEntryCount); JsonConsumer::_writeCompilerOptionEntryHelper(builder, indent, compilerOptionEntries, compilerOptionEntryCount); - _writePair(builder, indent, "outLinkedComponentType", Slang::StringUtil::makeStringWithFormat("0x%X", outLinkedComponentTypeId)); - _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%X", outDiagnosticsId)); + _writePair(builder, indent, "outLinkedComponentType", Slang::StringUtil::makeStringWithFormat("0x%llX", outLinkedComponentTypeId)); + _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnosticsId)); } } @@ -392,7 +392,7 @@ namespace SlangRecord if (desc.targetCount) { - ScopeWritterForKey scopeWritterForTarget(&builder, &indent, Slang::StringUtil::makeStringWithFormat("targets (0x%X)", desc.targets), isLastField); + ScopeWritterForKey scopeWritterForTarget(&builder, &indent, Slang::StringUtil::makeStringWithFormat("targets (0x%llX)", desc.targets), isLastField); { for (int i = 0; i < desc.targetCount; i++) { @@ -459,7 +459,7 @@ namespace SlangRecord _writePair(builder, indent, "preprocessorMacroCount", desc.preprocessorMacroCount); AddressFormat address = reinterpret_cast(desc.fileSystem); - _writePair(builder, indent, "fileSystem", Slang::StringUtil::makeStringWithFormat("0x%X", address)); + _writePair(builder, indent, "fileSystem", Slang::StringUtil::makeStringWithFormat("0x%llX", address)); _writePair(builder, indent, "enableEffectAnnotations", (desc.enableEffectAnnotations ? "true" : "false")); _writePair(builder, indent, "allowGLSLSyntax", (desc.allowGLSLSyntax ? "true" : "false")); _writePair(builder, indent, "compilerOptionEntryCount", desc.compilerOptionEntryCount); @@ -476,7 +476,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::createGlobalSession"); - _writePairNoComma(builder, indent, "outGlobalSession", Slang::StringUtil::makeStringWithFormat("0x%X", outGlobalSessionId)); + _writePairNoComma(builder, indent, "outGlobalSession", Slang::StringUtil::makeStringWithFormat("0x%llX", outGlobalSessionId)); } m_fileStream.write(builder.produceString().begin(), builder.produceString().getLength()); @@ -492,11 +492,11 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::createSession"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writeSessionDescHelper(builder, indent, desc, "inDesc"); - _writePairNoComma(builder, indent, "outSession", Slang::StringUtil::makeStringWithFormat("0x%X", outSessionId)); + _writePairNoComma(builder, indent, "outSession", Slang::StringUtil::makeStringWithFormat("0x%llX", outSessionId)); } } @@ -513,7 +513,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::findProfile"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePairNoComma(builder, indent, "name", Slang::StringUtil::makeStringWithFormat("\"%s\"", name != nullptr ? name : "nullptr")); } @@ -533,7 +533,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::setDownstreamCompilerPath"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "passThrough", SlangPassThroughToString(passThrough)); _writePairNoComma(builder, indent, "path", Slang::StringUtil::makeStringWithFormat("\"%s\"", path != nullptr ? path : "nullptr")); @@ -554,7 +554,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::setDownstreamCompilerPrelude"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "passThrough", SlangPassThroughToString(inPassThrough)); _writePairNoComma(builder, indent, "preludeText", Slang::StringUtil::makeStringWithFormat("\"%s\"", prelude != nullptr ? prelude : "nullptr")); @@ -575,9 +575,9 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::getDownstreamCompilerPrelude"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "passThrough", SlangPassThroughToString(inPassThrough)); - _writePairNoComma(builder, indent, "outPrelude", Slang::StringUtil::makeStringWithFormat("0x%X", outPreludeId)); + _writePairNoComma(builder, indent, "outPrelude", Slang::StringUtil::makeStringWithFormat("0x%llX", outPreludeId)); } } @@ -595,7 +595,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::setDefaultDownstreamCompiler"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "sourceLanguage", SlangSourceLanguageToString(sourceLanguage)); _writePairNoComma(builder, indent, "defaultCompiler", SlangPassThroughToString(defaultCompiler)); } @@ -615,7 +615,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::getDefaultDownstreamCompiler"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePairNoComma(builder, indent, "sourceLanguage", SlangSourceLanguageToString(sourceLanguage)); } } @@ -634,7 +634,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::setLanguagePrelude"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "sourceLanguage", SlangSourceLanguageToString(inSourceLanguage)); _writePairNoComma(builder, indent, "preludeText", Slang::StringUtil::makeStringWithFormat("\"%s\"", prelude != nullptr ? prelude : "nullptr")); @@ -655,9 +655,9 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::getLanguagePrelude"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "sourceLanguage", SlangSourceLanguageToString(inSourceLanguage)); - _writePairNoComma(builder, indent, "outPrelude", Slang::StringUtil::makeStringWithFormat("0x%X", outPreludeId)); + _writePairNoComma(builder, indent, "outPrelude", Slang::StringUtil::makeStringWithFormat("0x%llX", outPreludeId)); } } @@ -676,8 +676,8 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::createCompileRequest"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); - _writePairNoComma(builder, indent, "outCompileRequest", Slang::StringUtil::makeStringWithFormat("0x%X", outCompileRequest)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePairNoComma(builder, indent, "outCompileRequest", Slang::StringUtil::makeStringWithFormat("0x%llX", outCompileRequest)); } } @@ -696,7 +696,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::addBuiltins"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "sourcePath", Slang::StringUtil::makeStringWithFormat("\"%s\"", sourcePath != nullptr ? sourcePath : "nullptr")); _writePairNoComma(builder, indent, "sourceString", Slang::StringUtil::makeStringWithFormat("\"%s\"", @@ -718,8 +718,8 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::setSharedLibraryLoader"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); - _writePairNoComma(builder, indent, "loader", Slang::StringUtil::makeStringWithFormat("0x%X", loaderId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePairNoComma(builder, indent, "loader", Slang::StringUtil::makeStringWithFormat("0x%llX", loaderId)); } } @@ -737,8 +737,8 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::getSharedLibraryLoader"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); - _writePairNoComma(builder, indent, "retLoader", Slang::StringUtil::makeStringWithFormat("0x%X", outLoaderId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePairNoComma(builder, indent, "retLoader", Slang::StringUtil::makeStringWithFormat("0x%llX", outLoaderId)); } } @@ -758,7 +758,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::checkCompileTargetSupport"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePairNoComma(builder, indent, "target", SlangCompileTargetToString(target)); } } @@ -777,7 +777,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::checkPassThroughSupport"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePairNoComma(builder, indent, "passThrough", SlangPassThroughToString(passThrough)); } } @@ -796,7 +796,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::compileStdLib"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePairNoComma(builder, indent, "flags", CompileStdLibFlagsToString(flags)); } } @@ -816,8 +816,8 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::loadStdLib"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); - _writePair(builder, indent, "stdLib-Ignore-Data", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePair(builder, indent, "stdLib-Ignore-Data", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePairNoComma(builder, indent, "stdLibSizeInBytes", (uint32_t)stdLibSizeInBytes); } } @@ -835,9 +835,9 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::saveStdLib"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "archiveType", SlangArchiveTypeToString(archiveType)); - _writePairNoComma(builder, indent, "outBlobId", Slang::StringUtil::makeStringWithFormat("0x%X", outBlobId)); + _writePairNoComma(builder, indent, "outBlobId", Slang::StringUtil::makeStringWithFormat("0x%llX", outBlobId)); } } @@ -855,7 +855,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::findCapability"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePairNoComma(builder, indent, "name", Slang::StringUtil::makeStringWithFormat("\"%s\"", name != nullptr ? name : "nullptr")); } @@ -875,7 +875,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::setDownstreamCompilerForTransition"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "source", SlangCompileTargetToString(source)); _writePair(builder, indent, "target", SlangCompileTargetToString(target)); _writePairNoComma(builder, indent, "compiler", SlangPassThroughToString(compiler)); @@ -896,7 +896,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::getDownstreamCompilerForTransition"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "source", SlangCompileTargetToString(source)); _writePairNoComma(builder, indent, "target", SlangCompileTargetToString(target)); } @@ -916,7 +916,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::setSPIRVCoreGrammar"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePairNoComma(builder, indent, "jsonPath", Slang::StringUtil::makeStringWithFormat("\"%s\"", jsonPath != nullptr ? jsonPath : "nullptr")); } @@ -935,7 +935,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::parseCommandLineArguments"); - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "argc", argc); if (argv) @@ -969,18 +969,18 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IGlobalSession::getSessionDescDigest"); - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); if (sessionDesc) { - _writeSessionDescHelper(builder, indent, *sessionDesc, Slang::StringUtil::makeStringWithFormat("sessionDesc (0x%X)\n", sessionDesc)); + _writeSessionDescHelper(builder, indent, *sessionDesc, Slang::StringUtil::makeStringWithFormat("sessionDesc (0x%llX)\n", sessionDesc)); } else { _writePair(builder, indent, "sessionDesc", "nullptr"); } - _writePair(builder, indent, "outBlob", Slang::StringUtil::makeStringWithFormat("0x%X", outBlobId)); + _writePair(builder, indent, "outBlob", Slang::StringUtil::makeStringWithFormat("0x%llX", outBlobId)); } m_fileStream.write(builder.produceString().begin(), builder.produceString().getLength()); @@ -997,8 +997,8 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::getGlobalSession"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); - _writePairNoComma(builder, indent, "retGlobalSession", Slang::StringUtil::makeStringWithFormat("0x%X", outGlobalSessionId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePairNoComma(builder, indent, "retGlobalSession", Slang::StringUtil::makeStringWithFormat("0x%llX", outGlobalSessionId)); } } @@ -1016,11 +1016,11 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::loadModule"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "moduleName", Slang::StringUtil::makeStringWithFormat("\"%s\"", moduleName != nullptr ? moduleName : "nullptr")); - _writePair(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); - _writePairNoComma(builder, indent, "retIModule", Slang::StringUtil::makeStringWithFormat("0x%X", outModuleId)); + _writePair(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnostics)); + _writePairNoComma(builder, indent, "retIModule", Slang::StringUtil::makeStringWithFormat("0x%llX", outModuleId)); } } @@ -1038,7 +1038,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::loadModuleFromIRBlob"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "moduleName", Slang::StringUtil::makeStringWithFormat("\"%s\"", moduleName != nullptr ? moduleName : "nullptr")); _writePair(builder, indent, "path", Slang::StringUtil::makeStringWithFormat("\"%s\"", @@ -1048,9 +1048,9 @@ namespace SlangRecord void const* bufPtr = source->getBufferPointer(); size_t bufSize = source->getBufferSize(); - ScopeWritterForKey scopeWritterForSource(&builder, &indent, Slang::StringUtil::makeStringWithFormat("source (0x%X): {\n", source), false); + ScopeWritterForKey scopeWritterForSource(&builder, &indent, Slang::StringUtil::makeStringWithFormat("source (0x%llX): {\n", source), false); { - _writePair(builder, indent, "bufferPointer", Slang::StringUtil::makeStringWithFormat("0x%X", bufPtr)); + _writePair(builder, indent, "bufferPointer", Slang::StringUtil::makeStringWithFormat("0x%llX", bufPtr)); _writePairNoComma(builder, indent, "bufferSize", (uint32_t)bufSize); } } @@ -1059,8 +1059,8 @@ namespace SlangRecord _writePair(builder, indent, "source", "nullptr"); } - _writePair(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%X", outDiagnosticsId)); - _writePairNoComma(builder, indent, "retIModule", Slang::StringUtil::makeStringWithFormat("0x%X", outModuleId)); + _writePair(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnosticsId)); + _writePairNoComma(builder, indent, "retIModule", Slang::StringUtil::makeStringWithFormat("0x%llX", outModuleId)); } } @@ -1078,7 +1078,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::loadModuleFromSource"); - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "moduleName", Slang::StringUtil::makeStringWithFormat("\"%s\"", moduleName != nullptr ? moduleName : "nullptr")); _writePair(builder, indent, "path", Slang::StringUtil::makeStringWithFormat("\"%s\"", @@ -1087,9 +1087,9 @@ namespace SlangRecord { void const* bufPtr = source->getBufferPointer(); size_t bufSize = source->getBufferSize(); - ScopeWritterForKey scopeWritterForSource(&builder, &indent, Slang::StringUtil::makeStringWithFormat("source (0x%X): {\n", source), false); + ScopeWritterForKey scopeWritterForSource(&builder, &indent, Slang::StringUtil::makeStringWithFormat("source (0x%llX): {\n", source), false); { - _writePair(builder, indent, "bufferPointer", Slang::StringUtil::makeStringWithFormat("0x%X", bufPtr)); + _writePair(builder, indent, "bufferPointer", Slang::StringUtil::makeStringWithFormat("0x%llX", bufPtr)); _writePairNoComma(builder, indent, "bufferSize", (uint32_t)bufSize); } } @@ -1098,8 +1098,8 @@ namespace SlangRecord _writePair(builder, indent, "source", "nullptr"); } - _writePair(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%X", outDiagnosticsId)); - _writePairNoComma(builder, indent, "retIModule", Slang::StringUtil::makeStringWithFormat("0x%X", outModuleId)); + _writePair(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnosticsId)); + _writePairNoComma(builder, indent, "retIModule", Slang::StringUtil::makeStringWithFormat("0x%llX", outModuleId)); } m_fileStream.write(builder.produceString().begin(), builder.produceString().getLength()); @@ -1116,7 +1116,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::loadModuleFromSourceString"); - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "moduleName", Slang::StringUtil::makeStringWithFormat("\"%s\"", moduleName != nullptr ? moduleName : "nullptr")); @@ -1126,8 +1126,8 @@ namespace SlangRecord _writePair(builder, indent, "string", Slang::StringUtil::makeStringWithFormat("\"%s\"", string != nullptr ? string : "nullptr")); - _writePair(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%X", outDiagnosticsId)); - _writePairNoComma(builder, indent, "retIModule", Slang::StringUtil::makeStringWithFormat("0x%X", outModuleId)); + _writePair(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnosticsId)); + _writePairNoComma(builder, indent, "retIModule", Slang::StringUtil::makeStringWithFormat("0x%llX", outModuleId)); } m_fileStream.write(builder.produceString().begin(), builder.produceString().getLength()); @@ -1145,7 +1145,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::createCompositeComponentType"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); if (componentTypeCount) { ScopeWritterForKey scopeWritterForComponentTypes(&builder, &indent, "componentTypes", false); @@ -1153,11 +1153,11 @@ namespace SlangRecord { if (i != componentTypeCount - 1) { - _writeString(builder, indent, Slang::StringUtil::makeStringWithFormat("[%d]: 0x%X,\n", i, componentTypeIds[i])); + _writeString(builder, indent, Slang::StringUtil::makeStringWithFormat("[%d]: 0x%llX,\n", i, componentTypeIds[i])); } else { - _writeString(builder, indent, Slang::StringUtil::makeStringWithFormat("[%d]: 0x%X\n", i, componentTypeIds[i])); + _writeString(builder, indent, Slang::StringUtil::makeStringWithFormat("[%d]: 0x%llX\n", i, componentTypeIds[i])); } } } @@ -1167,8 +1167,8 @@ namespace SlangRecord } } _writePair(builder, indent, "componentTypeCount", componentTypeCount); - _writePair(builder, indent, "outCompositeComponentType", Slang::StringUtil::makeStringWithFormat("0x%X", outCompositeComponentTypeId)); - _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%X", outDiagnosticsId)); + _writePair(builder, indent, "outCompositeComponentType", Slang::StringUtil::makeStringWithFormat("0x%llX", outCompositeComponentTypeId)); + _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnosticsId)); } m_fileStream.write(builder.produceString().begin(), builder.produceString().getLength()); @@ -1185,8 +1185,8 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::specializeType"); - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); - _writePair(builder, indent, "type", Slang::StringUtil::makeStringWithFormat("0x%X", typeId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePair(builder, indent, "type", Slang::StringUtil::makeStringWithFormat("0x%llX", typeId)); if (specializationArgCount) { @@ -1196,7 +1196,7 @@ namespace SlangRecord ScopeWritterForKey scopeWritterForArg(&builder, &indent, Slang::StringUtil::makeStringWithFormat("[%d]\n", i), false); { _writePair(builder, indent, "kind", SpecializationArgKindToString(specializationArgs[i].kind)); - _writePairNoComma(builder, indent, "type", Slang::StringUtil::makeStringWithFormat("0x%X", specializationArgs[i].type)); + _writePairNoComma(builder, indent, "type", Slang::StringUtil::makeStringWithFormat("0x%llX", specializationArgs[i].type)); } } } @@ -1224,11 +1224,11 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::getTypeLayout"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); - _writePair(builder, indent, "type", Slang::StringUtil::makeStringWithFormat("0x%X", typeId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePair(builder, indent, "type", Slang::StringUtil::makeStringWithFormat("0x%llX", typeId)); _writePair(builder, indent, "rules", LayoutRulesToString(rules)); - _writePair(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%X", outDiagnosticsId)); - _writePairNoComma(builder, indent, "retTypeReflectionId", Slang::StringUtil::makeStringWithFormat("0x%X", outTypeLayoutReflectionId)); + _writePair(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnosticsId)); + _writePairNoComma(builder, indent, "retTypeReflectionId", Slang::StringUtil::makeStringWithFormat("0x%llX", outTypeLayoutReflectionId)); } } @@ -1236,34 +1236,116 @@ namespace SlangRecord m_fileStream.flush(); } - void JsonConsumer::ISession_getContainerType(ObjectID objectId, ObjectID elementType, + void JsonConsumer::ISession_getContainerType(ObjectID objectId, ObjectID elementTypeId, slang::ContainerType containerType, ObjectID outDiagnosticsId, ObjectID outTypeReflectionId) { + SANITY_CHECK(); + Slang::StringBuilder builder; + int indent = 0; + + { + ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::getContainerType"); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePair(builder, indent, "elementType", Slang::StringUtil::makeStringWithFormat("0x%llX", elementTypeId)); + _writePair(builder, indent, "containerType", ContainerTypeToString(containerType)); + _writePair(builder, indent, "outDiagnosticsId", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnosticsId)); + _writePairNoComma(builder, indent, "outTypeReflectionId", Slang::StringUtil::makeStringWithFormat("0x%llX", outTypeReflectionId)); + } + + m_fileStream.write(builder.produceString().begin(), builder.produceString().getLength()); + m_fileStream.flush(); } void JsonConsumer::ISession_getDynamicType(ObjectID objectId, ObjectID outTypeReflectionId) { + SANITY_CHECK(); + Slang::StringBuilder builder; + int indent = 0; + + { + ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::getDynamicType"); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePairNoComma(builder, indent, "outTypeReflectionId", Slang::StringUtil::makeStringWithFormat("0x%llX", outTypeReflectionId)); + } + + m_fileStream.write(builder.produceString().begin(), builder.produceString().getLength()); + m_fileStream.flush(); } void JsonConsumer::ISession_getTypeRTTIMangledName(ObjectID objectId, ObjectID typeId, ObjectID outNameBlobId) { + SANITY_CHECK(); + Slang::StringBuilder builder; + int indent = 0; + + { + ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::getTypeRTTIMangledName"); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePair(builder, indent, "type", Slang::StringUtil::makeStringWithFormat("0x%llX", typeId)); + _writePairNoComma(builder, indent, "outNameBlobId", Slang::StringUtil::makeStringWithFormat("0x%llX", outNameBlobId)); + } + + m_fileStream.write(builder.produceString().begin(), builder.produceString().getLength()); + m_fileStream.flush(); } void JsonConsumer::ISession_getTypeConformanceWitnessMangledName(ObjectID objectId, ObjectID typeId, ObjectID interfaceTypeId, ObjectID outNameBlobId) { + SANITY_CHECK(); + Slang::StringBuilder builder; + int indent = 0; + + { + ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::getTypeConformanceWitnessMangledName"); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePair(builder, indent, "type", Slang::StringUtil::makeStringWithFormat("0x%llX", typeId)); + _writePair(builder, indent, "interfaceType", Slang::StringUtil::makeStringWithFormat("0x%llX", interfaceTypeId)); + _writePairNoComma(builder, indent, "outNameBlobId", Slang::StringUtil::makeStringWithFormat("0x%llX", outNameBlobId)); + } + + m_fileStream.write(builder.produceString().begin(), builder.produceString().getLength()); + m_fileStream.flush(); } void JsonConsumer::ISession_getTypeConformanceWitnessSequentialID(ObjectID objectId, ObjectID typeId, ObjectID interfaceTypeId, uint32_t outId) { + SANITY_CHECK(); + Slang::StringBuilder builder; + int indent = 0; + + { + ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::getTypeConformanceWitnessSequentialID"); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePairNoComma(builder, indent, "type", Slang::StringUtil::makeStringWithFormat("0x%llX", typeId)); + } + + m_fileStream.write(builder.produceString().begin(), builder.produceString().getLength()); + m_fileStream.flush(); } void JsonConsumer::ISession_createTypeConformanceComponentType(ObjectID objectId, ObjectID typeId, ObjectID interfaceTypeId, ObjectID outConformanceId, SlangInt conformanceIdOverride, ObjectID outDiagnosticsId) { + SANITY_CHECK(); + Slang::StringBuilder builder; + int indent = 0; + + { + ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::createTypeConformanceComponentType"); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); + _writePair(builder, indent, "type", Slang::StringUtil::makeStringWithFormat("0x%llX", typeId)); + _writePair(builder, indent, "interfaceTypeId", Slang::StringUtil::makeStringWithFormat("0x%llX", interfaceTypeId)); + _writePair(builder, indent, "outConformanceId", Slang::StringUtil::makeStringWithFormat("0x%llX", outConformanceId)); + _writePair(builder, indent, "conformanceIdOverride", conformanceIdOverride); + _writePairNoComma(builder, indent, "outDiagnosticsId", Slang::StringUtil::makeStringWithFormat("0x%llX", typeId)); + } + + m_fileStream.write(builder.produceString().begin(), builder.produceString().getLength()); + m_fileStream.flush(); } @@ -1276,7 +1358,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::createCompileRequest"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "outCompileRequest", outCompileRequestId); } } @@ -1295,9 +1377,9 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "ISession::getLoadedModule"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "index", index); - _writePairNoComma(builder, indent, "retModule", Slang::StringUtil::makeStringWithFormat("0x%X", outModuleId)); + _writePairNoComma(builder, indent, "retModule", Slang::StringUtil::makeStringWithFormat("0x%llX", outModuleId)); } } @@ -1316,11 +1398,11 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IModule::findEntryPointByName"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "name", Slang::StringUtil::makeStringWithFormat("\"%s\"", name != nullptr ? name : "nullptr")); - _writePairNoComma(builder, indent, "outEntryPoint", Slang::StringUtil::makeStringWithFormat("0x%X", outEntryPointId)); + _writePairNoComma(builder, indent, "outEntryPoint", Slang::StringUtil::makeStringWithFormat("0x%llX", outEntryPointId)); } } @@ -1338,9 +1420,9 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IModule::getDefinedEntryPoint"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "index", index); - _writePairNoComma(builder, indent, "outEntryPoint", Slang::StringUtil::makeStringWithFormat("0x%X", outEntryPointId)); + _writePairNoComma(builder, indent, "outEntryPoint", Slang::StringUtil::makeStringWithFormat("0x%llX", outEntryPointId)); } } @@ -1358,7 +1440,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IModule::serialize"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePairNoComma(builder, indent, "outSerializedBlob", outSerializedBlobId); } } @@ -1377,7 +1459,7 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IModule::writeToFile"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePairNoComma(builder, indent, "fileName", Slang::StringUtil::makeStringWithFormat("\"%s\"", fileName != nullptr ? fileName : "nullptr")); } @@ -1397,12 +1479,12 @@ namespace SlangRecord { ScopeWritterForKey scopeWritter(&builder, &indent, "IModule::findAndCheckEntryPoint"); { - _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%X", objectId)); + _writePair(builder, indent, "this", Slang::StringUtil::makeStringWithFormat("0x%llX", objectId)); _writePair(builder, indent, "name", Slang::StringUtil::makeStringWithFormat("\"%s\"", name != nullptr ? name : "nullptr")); _writePair(builder, indent, "stage", SlangStageToString(stage)); - _writePair(builder, indent, "outEntryPoint", Slang::StringUtil::makeStringWithFormat("0x%X", outEntryPointId)); - _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%X", outDiagnostics)); + _writePair(builder, indent, "outEntryPoint", Slang::StringUtil::makeStringWithFormat("0x%llX", outEntryPointId)); + _writePairNoComma(builder, indent, "outDiagnostics", Slang::StringUtil::makeStringWithFormat("0x%llX", outDiagnostics)); } } diff --git a/source/slang-record-replay/replay/json-consumer.h b/source/slang-record-replay/replay/json-consumer.h index fd0866bc2..d0529aab4 100644 --- a/source/slang-record-replay/replay/json-consumer.h +++ b/source/slang-record-replay/replay/json-consumer.h @@ -53,11 +53,11 @@ namespace SlangRecord Slang::FileStream& m_fileStream; }; - class JsonConsumer : public IDecoderConsumer + class JsonConsumer : public IDecoderConsumer, public Slang::RefObject { public: JsonConsumer(const Slang::String& filePath); - + virtual ~JsonConsumer() = default; virtual void CreateGlobalSession(ObjectID outGlobalSessionId); virtual void IGlobalSession_createSession(ObjectID objectId, slang::SessionDesc const& desc, ObjectID outSessionId); virtual void IGlobalSession_findProfile(ObjectID objectId, char const* name); diff --git a/source/slang-record-replay/replay/replay-consumer.cpp b/source/slang-record-replay/replay/replay-consumer.cpp index 01de2f828..6fb114c47 100644 --- a/source/slang-record-replay/replay/replay-consumer.cpp +++ b/source/slang-record-replay/replay/replay-consumer.cpp @@ -139,6 +139,33 @@ namespace SlangRecord return res; } + SlangResult CommonInterfaceReplayer::specialize(ObjectID objectId, slang::SpecializationArg const* specializationArgs, + SlangInt specializationArgCount, ObjectID outSpecializedComponentTypeId, ObjectID outDiagnosticsId) + { + InputObjectSanityCheck(objectId); + + for (SlangInt i = 0; i < specializationArgCount; i++) + { + if (specializationArgs[i].type != nullptr) + { + slangRecordLog(LogLevel::Error, "We only support nullptr for 'type' as reflection is not supported yet, %s:%d\n", objectId, __PRETTY_FUNCTION__, __LINE__); + return SLANG_FAIL; + } + } + + slang::IComponentType* pObj = getObjectPointer(objectId); + slang::IComponentType* outSpecializedComponentType {}; + slang::IBlob* outDiagnostics {}; + + SlangResult res = pObj->specialize(specializationArgs, specializationArgCount, &outSpecializedComponentType, &outDiagnostics); + if (outSpecializedComponentType && SLANG_SUCCEEDED(res)) + { + m_objectMap.addIfNotExists(outSpecializedComponentTypeId, outSpecializedComponentType); + } + + ReplayConsumer::printDiagnosticMessage(outDiagnostics); + return res; + } SlangResult CommonInterfaceReplayer::link(ObjectID objectId, ObjectID outLinkedComponentTypeId, ObjectID outDiagnosticsId) { @@ -683,7 +710,8 @@ namespace SlangRecord InputObjectSanityCheck(componentTypeIds[i]); } - OutputObjectSanityCheck(outCompositeComponentTypeId); + // We don't need to check existence of outCompositeComponentTypeId, because it could be the same object + // as the input one slang::ISession* session = getObjectPointer(objectId); @@ -702,7 +730,7 @@ namespace SlangRecord if (outCompositeComponentType && SLANG_SUCCEEDED(res)) { - m_objectMap.add(outCompositeComponentTypeId, outCompositeComponentType); + m_objectMap.addIfNotExists(outCompositeComponentTypeId, outCompositeComponentType); } else { @@ -936,11 +964,11 @@ namespace SlangRecord void ReplayConsumer::IModule_specialize(ObjectID objectId, slang::SpecializationArg const* specializationArgs, SlangInt specializationArgCount, ObjectID outSpecializedComponentTypeId, ObjectID outDiagnosticsId) { - // TODO: Cannot replay this function because of the TypeReflection is not recorded. + SlangResult res = m_commonReplayer.specialize(objectId, specializationArgs, specializationArgCount, outSpecializedComponentTypeId, outDiagnosticsId); + FAIL_WITH_LOG(IModule::specialize); } - void ReplayConsumer::IModule_link(ObjectID objectId, ObjectID outLinkedComponentTypeId, ObjectID outDiagnosticsId) { SlangResult res = m_commonReplayer.link(objectId, outLinkedComponentTypeId, outDiagnosticsId); @@ -1015,7 +1043,8 @@ namespace SlangRecord void ReplayConsumer::IEntryPoint_specialize(ObjectID objectId, slang::SpecializationArg const* specializationArgs, SlangInt specializationArgCount, ObjectID outSpecializedComponentTypeId, ObjectID outDiagnosticsId) { - + SlangResult res = m_commonReplayer.specialize(objectId, specializationArgs, specializationArgCount, outSpecializedComponentTypeId, outDiagnosticsId); + FAIL_WITH_LOG(IModule::specialize); } @@ -1093,6 +1122,8 @@ namespace SlangRecord void ReplayConsumer::ICompositeComponentType_specialize(ObjectID objectId, slang::SpecializationArg const* specializationArgs, SlangInt specializationArgCount, ObjectID outSpecializedComponentTypeId, ObjectID outDiagnosticsId) { + SlangResult res = m_commonReplayer.specialize(objectId, specializationArgs, specializationArgCount, outSpecializedComponentTypeId, outDiagnosticsId); + FAIL_WITH_LOG(IModule::specialize); } @@ -1170,6 +1201,8 @@ namespace SlangRecord void ReplayConsumer::ITypeConformance_specialize(ObjectID objectId, slang::SpecializationArg const* specializationArgs, SlangInt specializationArgCount, ObjectID outSpecializedComponentTypeId, ObjectID outDiagnosticsId) { + SlangResult res = m_commonReplayer.specialize(objectId, specializationArgs, specializationArgCount, outSpecializedComponentTypeId, outDiagnosticsId); + FAIL_WITH_LOG(IModule::specialize); } diff --git a/source/slang-record-replay/replay/replay-consumer.h b/source/slang-record-replay/replay/replay-consumer.h index 5618598e1..b7620af0d 100644 --- a/source/slang-record-replay/replay/replay-consumer.h +++ b/source/slang-record-replay/replay/replay-consumer.h @@ -27,8 +27,7 @@ namespace SlangRecord SlangResult getResultAsFileSystem(ObjectID objectId, SlangInt entryPointIndex, SlangInt targetIndex, ObjectID outFileSystemId); SlangResult getEntryPointHash(ObjectID objectId, SlangInt entryPointIndex, SlangInt targetIndex, ObjectID outHashId); SlangResult specialize(ObjectID objectId, slang::SpecializationArg const* specializationArgs, - SlangInt specializationArgCount, ObjectID outSpecializedComponentTypeId, ObjectID outDiagnosticsId) - {return SLANG_FAIL;} + SlangInt specializationArgCount, ObjectID outSpecializedComponentTypeId, ObjectID outDiagnosticsId); SlangResult link(ObjectID objectId, ObjectID outLinkedComponentTypeId, ObjectID outDiagnosticsId); SlangResult getEntryPointHostCallable(ObjectID objectId, int entryPointIndex, int targetIndex, ObjectID outSharedLibraryId, ObjectID outDiagnosticsId); @@ -55,7 +54,7 @@ namespace SlangRecord uint32_t m_globalCounter = 0; }; - class ReplayConsumer : public IDecoderConsumer + class ReplayConsumer : public IDecoderConsumer, public Slang::RefObject { public: virtual void CreateGlobalSession(ObjectID outGlobalSessionId) override; diff --git a/source/slang-record-replay/util/emum-to-string.h b/source/slang-record-replay/util/emum-to-string.h index 3c7568818..7a7952555 100644 --- a/source/slang-record-replay/util/emum-to-string.h +++ b/source/slang-record-replay/util/emum-to-string.h @@ -388,24 +388,6 @@ namespace SlangRecord return str.toString(); } } - // enum SlangStage : SlangStageIntegral - // { - // SLANG_STAGE_NONE, - // SLANG_STAGE_VERTEX, - // SLANG_STAGE_HULL, - // SLANG_STAGE_DOMAIN, - // SLANG_STAGE_GEOMETRY, - // SLANG_STAGE_FRAGMENT, - // SLANG_STAGE_COMPUTE, - // SLANG_STAGE_RAY_GENERATION, - // SLANG_STAGE_INTERSECTION, - // SLANG_STAGE_ANY_HIT, - // SLANG_STAGE_CLOSEST_HIT, - // SLANG_STAGE_MISS, - // SLANG_STAGE_CALLABLE, - // SLANG_STAGE_MESH, - // SLANG_STAGE_AMPLIFICATION, - // }; static Slang::String SlangStageToString(const SlangStage stage) { @@ -435,4 +417,21 @@ namespace SlangRecord } #undef CASE } + + static Slang::String ContainerTypeToString(const slang::ContainerType type) + { + using namespace slang; + switch(type) + { + case ContainerType::None: return "None"; + case ContainerType::UnsizedArray: return "UnsizedArray"; + case ContainerType::StructuredBuffer: return "StructuredBuffer"; + case ContainerType::ConstantBuffer: return "ConstantBuffer"; + case ContainerType::ParameterBlock: return "ParameterBlock"; + default: + Slang::StringBuilder str; + str << "Unknown ContainerType: " << static_cast(type); + return str.toString(); + } + } } diff --git a/source/slang-record-replay/util/record-format.h b/source/slang-record-replay/util/record-format.h index d796abec6..1a32dbbd6 100644 --- a/source/slang-record-replay/util/record-format.h +++ b/source/slang-record-replay/util/record-format.h @@ -29,6 +29,7 @@ namespace SlangRecord Class_IEntryPoint = 5, Class_ICompositeComponentType = 6, Class_ITypeConformance = 7, + Unknown = 0xFFFF }; // Store the pointer value in a 64-bit integer @@ -41,6 +42,22 @@ namespace SlangRecord constexpr uint32_t MAGIC_HEADER = 0x44414548; constexpr uint32_t MAGIC_TAILER = 0x4C494154; + enum IComponentTypeMethodId : uint16_t + { + getSession = 0x000A, + getLayout = 0x000B, + getSpecializationParamCount = 0x000C, + getEntryPointCode = 0x000D, + getTargetCode = 0x000E, + getResultAsFileSystem = 0x000F, + getEntryPointHash = 0x0010, + specialize = 0x0011, + link = 0x0012, + getEntryPointHostCallable = 0x0013, + renameEntryPoint = 0x0014, + linkWithOptions = 0x0015, + }; + enum ApiCallId : uint32_t { InvalidCallId = 0x00000000, @@ -91,6 +108,7 @@ namespace SlangRecord ISession_getLoadedModule = makeApiCallId(Class_ISession, 0x0012), ISession_isBinaryModuleUpToDate = makeApiCallId(Class_ISession, 0x0013), + IModule_findEntryPointByName = makeApiCallId(Class_IModule, 0x0001), IModule_getDefinedEntryPointCount = makeApiCallId(Class_IModule, 0x0002), IModule_getDefinedEntryPoint = makeApiCallId(Class_IModule, 0x0003), @@ -100,57 +118,59 @@ namespace SlangRecord IModule_getFilePath = makeApiCallId(Class_IModule, 0x0007), IModule_getUniqueIdentity = makeApiCallId(Class_IModule, 0x0008), IModule_findAndCheckEntryPoint = makeApiCallId(Class_IModule, 0x0009), - IModule_getSession = makeApiCallId(Class_IModule, 0x000A), - IModule_getLayout = makeApiCallId(Class_IModule, 0x000B), - IModule_getSpecializationParamCount = makeApiCallId(Class_IModule, 0x000C), - IModule_getEntryPointCode = makeApiCallId(Class_IModule, 0x000D), - IModule_getTargetCode = makeApiCallId(Class_IModule, 0x000E), - IModule_getResultAsFileSystem = makeApiCallId(Class_IModule, 0x000F), - IModule_getEntryPointHash = makeApiCallId(Class_IModule, 0x0010), - IModule_specialize = makeApiCallId(Class_IModule, 0x0011), - IModule_link = makeApiCallId(Class_IModule, 0x0012), - IModule_getEntryPointHostCallable = makeApiCallId(Class_IModule, 0x0013), - IModule_renameEntryPoint = makeApiCallId(Class_IModule, 0x0014), - IModule_linkWithOptions = makeApiCallId(Class_IModule, 0x0015), - - IEntryPoint_getSession = makeApiCallId(Class_IEntryPoint, 0x0001), - IEntryPoint_getLayout = makeApiCallId(Class_IEntryPoint, 0x0002), - IEntryPoint_getSpecializationParamCount = makeApiCallId(Class_IEntryPoint, 0x0003), - IEntryPoint_getEntryPointCode = makeApiCallId(Class_IEntryPoint, 0x0004), - IEntryPoint_getTargetCode = makeApiCallId(Class_IEntryPoint, 0x0005), - IEntryPoint_getResultAsFileSystem = makeApiCallId(Class_IEntryPoint, 0x0006), - IEntryPoint_getEntryPointHash = makeApiCallId(Class_IEntryPoint, 0x0007), - IEntryPoint_specialize = makeApiCallId(Class_IEntryPoint, 0x0008), - IEntryPoint_link = makeApiCallId(Class_IEntryPoint, 0x0009), - IEntryPoint_getEntryPointHostCallable = makeApiCallId(Class_IEntryPoint, 0x000A), - IEntryPoint_renameEntryPoint = makeApiCallId(Class_IEntryPoint, 0x000B), - IEntryPoint_linkWithOptions = makeApiCallId(Class_IEntryPoint, 0x000C), - - ICompositeComponentType_getSession = makeApiCallId(Class_ICompositeComponentType, 0x0001), - ICompositeComponentType_getLayout = makeApiCallId(Class_ICompositeComponentType, 0x0002), - ICompositeComponentType_getSpecializationParamCount = makeApiCallId(Class_ICompositeComponentType, 0x0003), - ICompositeComponentType_getEntryPointCode = makeApiCallId(Class_ICompositeComponentType, 0x0004), - ICompositeComponentType_getTargetCode = makeApiCallId(Class_ICompositeComponentType, 0x0005), - ICompositeComponentType_getResultAsFileSystem = makeApiCallId(Class_ICompositeComponentType, 0x0006), - ICompositeComponentType_getEntryPointHash = makeApiCallId(Class_ICompositeComponentType, 0x0007), - ICompositeComponentType_specialize = makeApiCallId(Class_ICompositeComponentType, 0x0008), - ICompositeComponentType_link = makeApiCallId(Class_ICompositeComponentType, 0x0009), - ICompositeComponentType_getEntryPointHostCallable = makeApiCallId(Class_ICompositeComponentType, 0x000A), - ICompositeComponentType_renameEntryPoint = makeApiCallId(Class_ICompositeComponentType, 0x000B), - ICompositeComponentType_linkWithOptions = makeApiCallId(Class_ICompositeComponentType, 0x000C), - - ITypeConformance_getSession = makeApiCallId(Class_ITypeConformance, 0x0001), - ITypeConformance_getLayout = makeApiCallId(Class_ITypeConformance, 0x0002), - ITypeConformance_getSpecializationParamCount = makeApiCallId(Class_ITypeConformance, 0x0003), - ITypeConformance_getEntryPointCode = makeApiCallId(Class_ITypeConformance, 0x0004), - ITypeConformance_getTargetCode = makeApiCallId(Class_ITypeConformance, 0x0005), - ITypeConformance_getResultAsFileSystem = makeApiCallId(Class_ITypeConformance, 0x0006), - ITypeConformance_getEntryPointHash = makeApiCallId(Class_ITypeConformance, 0x0007), - ITypeConformance_specialize = makeApiCallId(Class_ITypeConformance, 0x0008), - ITypeConformance_link = makeApiCallId(Class_ITypeConformance, 0x0009), - ITypeConformance_getEntryPointHostCallable = makeApiCallId(Class_ITypeConformance, 0x000A), - ITypeConformance_renameEntryPoint = makeApiCallId(Class_ITypeConformance, 0x000B), - ITypeConformance_linkWithOptions = makeApiCallId(Class_ITypeConformance, 0x000C) + + IModule_getSession = makeApiCallId(Class_IModule, IComponentTypeMethodId::getSession), + IModule_getLayout = makeApiCallId(Class_IModule, IComponentTypeMethodId::getLayout), + IModule_getSpecializationParamCount = makeApiCallId(Class_IModule, IComponentTypeMethodId::getSpecializationParamCount), + IModule_getEntryPointCode = makeApiCallId(Class_IModule, IComponentTypeMethodId::getEntryPointCode), + IModule_getTargetCode = makeApiCallId(Class_IModule, IComponentTypeMethodId::getTargetCode), + IModule_getResultAsFileSystem = makeApiCallId(Class_IModule, IComponentTypeMethodId::getResultAsFileSystem), + IModule_getEntryPointHash = makeApiCallId(Class_IModule, IComponentTypeMethodId::getEntryPointHash), + IModule_specialize = makeApiCallId(Class_IModule, IComponentTypeMethodId::specialize), + IModule_link = makeApiCallId(Class_IModule, IComponentTypeMethodId::link), + IModule_getEntryPointHostCallable = makeApiCallId(Class_IModule, IComponentTypeMethodId::getEntryPointHostCallable), + IModule_renameEntryPoint = makeApiCallId(Class_IModule, IComponentTypeMethodId::renameEntryPoint), + IModule_linkWithOptions = makeApiCallId(Class_IModule, IComponentTypeMethodId::linkWithOptions), + + + IEntryPoint_getSession = makeApiCallId(Class_IEntryPoint, IComponentTypeMethodId::getSession), + IEntryPoint_getLayout = makeApiCallId(Class_IEntryPoint, IComponentTypeMethodId::getLayout), + IEntryPoint_getSpecializationParamCount = makeApiCallId(Class_IEntryPoint, IComponentTypeMethodId::getSpecializationParamCount), + IEntryPoint_getEntryPointCode = makeApiCallId(Class_IEntryPoint, IComponentTypeMethodId::getEntryPointCode), + IEntryPoint_getTargetCode = makeApiCallId(Class_IEntryPoint, IComponentTypeMethodId::getTargetCode), + IEntryPoint_getResultAsFileSystem = makeApiCallId(Class_IEntryPoint, IComponentTypeMethodId::getResultAsFileSystem), + IEntryPoint_getEntryPointHash = makeApiCallId(Class_IEntryPoint, IComponentTypeMethodId::getEntryPointHash), + IEntryPoint_specialize = makeApiCallId(Class_IEntryPoint, IComponentTypeMethodId::specialize), + IEntryPoint_link = makeApiCallId(Class_IEntryPoint, IComponentTypeMethodId::link), + IEntryPoint_getEntryPointHostCallable = makeApiCallId(Class_IEntryPoint, IComponentTypeMethodId::getEntryPointHostCallable), + IEntryPoint_renameEntryPoint = makeApiCallId(Class_IEntryPoint, IComponentTypeMethodId::renameEntryPoint), + IEntryPoint_linkWithOptions = makeApiCallId(Class_IEntryPoint, IComponentTypeMethodId::linkWithOptions), + + ICompositeComponentType_getSession = makeApiCallId(Class_ICompositeComponentType, IComponentTypeMethodId::getSession), + ICompositeComponentType_getLayout = makeApiCallId(Class_ICompositeComponentType, IComponentTypeMethodId::getLayout), + ICompositeComponentType_getSpecializationParamCount = makeApiCallId(Class_ICompositeComponentType, IComponentTypeMethodId::getSpecializationParamCount), + ICompositeComponentType_getEntryPointCode = makeApiCallId(Class_ICompositeComponentType, IComponentTypeMethodId::getEntryPointCode), + ICompositeComponentType_getTargetCode = makeApiCallId(Class_ICompositeComponentType, IComponentTypeMethodId::getTargetCode), + ICompositeComponentType_getResultAsFileSystem = makeApiCallId(Class_ICompositeComponentType, IComponentTypeMethodId::getResultAsFileSystem), + ICompositeComponentType_getEntryPointHash = makeApiCallId(Class_ICompositeComponentType, IComponentTypeMethodId::getEntryPointHash), + ICompositeComponentType_specialize = makeApiCallId(Class_ICompositeComponentType, IComponentTypeMethodId::specialize), + ICompositeComponentType_link = makeApiCallId(Class_ICompositeComponentType, IComponentTypeMethodId::link), + ICompositeComponentType_getEntryPointHostCallable = makeApiCallId(Class_ICompositeComponentType, IComponentTypeMethodId::getEntryPointHostCallable), + ICompositeComponentType_renameEntryPoint = makeApiCallId(Class_ICompositeComponentType, IComponentTypeMethodId::renameEntryPoint), + ICompositeComponentType_linkWithOptions = makeApiCallId(Class_ICompositeComponentType, IComponentTypeMethodId::linkWithOptions), + + ITypeConformance_getSession = makeApiCallId(Class_ITypeConformance, IComponentTypeMethodId::getSession), + ITypeConformance_getLayout = makeApiCallId(Class_ITypeConformance, IComponentTypeMethodId::getLayout), + ITypeConformance_getSpecializationParamCount = makeApiCallId(Class_ITypeConformance, IComponentTypeMethodId::getSpecializationParamCount), + ITypeConformance_getEntryPointCode = makeApiCallId(Class_ITypeConformance, IComponentTypeMethodId::getEntryPointCode), + ITypeConformance_getTargetCode = makeApiCallId(Class_ITypeConformance, IComponentTypeMethodId::getTargetCode), + ITypeConformance_getResultAsFileSystem = makeApiCallId(Class_ITypeConformance, IComponentTypeMethodId::getResultAsFileSystem), + ITypeConformance_getEntryPointHash = makeApiCallId(Class_ITypeConformance, IComponentTypeMethodId::getEntryPointHash), + ITypeConformance_specialize = makeApiCallId(Class_ITypeConformance, IComponentTypeMethodId::specialize), + ITypeConformance_link = makeApiCallId(Class_ITypeConformance, IComponentTypeMethodId::link), + ITypeConformance_getEntryPointHostCallable = makeApiCallId(Class_ITypeConformance, IComponentTypeMethodId::getEntryPointHostCallable), + ITypeConformance_renameEntryPoint = makeApiCallId(Class_ITypeConformance, IComponentTypeMethodId::renameEntryPoint), + ITypeConformance_linkWithOptions = makeApiCallId(Class_ITypeConformance, IComponentTypeMethodId::linkWithOptions), }; struct FunctionHeader -- cgit v1.2.3