From d4f99c8bac8b28f18c864a717d8833db6a1c872d Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 22 Mar 2023 12:04:33 -0400 Subject: Source map obfuscation (#2717) * #include an absolute path didn't work - because paths were taken to always be relative. * WIP source map. * Split out handling of RttiTypeFuncs to a map type. * Make RttiTypeFuncsMap hold default impls. * Slightly more sophisticated RttiTypeFuncsMap * Source map decoding. * Fix tabs. * Fix asserts due to negative values. * Use less obscure mechanisms in SourceMap. * Source map decoding. Simplifying SourceMap usage. * First attempt at ouputting a source map as part of emit. * Added support for -source-map option. SourceMap is added to the artifact. * Small improvements around column calculation in SourceWriter. * Source Loc obuscation WIP. * Fix some issues around SourceMap obfuscation. * Split out obfuscation into its own file. * Keep obfuscated SourceMap even through serialization bottleneck. --- source/compiler-core/slang-artifact-desc-util.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/compiler-core/slang-artifact-desc-util.cpp') diff --git a/source/compiler-core/slang-artifact-desc-util.cpp b/source/compiler-core/slang-artifact-desc-util.cpp index ee014daf0..08b7c8412 100644 --- a/source/compiler-core/slang-artifact-desc-util.cpp +++ b/source/compiler-core/slang-artifact-desc-util.cpp @@ -175,6 +175,7 @@ bool isDerivedFrom(ENUM_TYPE kind, ENUM_TYPE base) { return g_table##ENUM_TYPE.i x(HumanText, Text) \ x(Source, Text) \ x(Assembly, Text) \ + x(Json, Text) \ x(Instance, Base) #define SLANG_ARTIFACT_KIND_ENTRY(TYPE, PARENT) { Index(ArtifactKind::TYPE), Index(ArtifactKind::PARENT), #TYPE }, @@ -239,13 +240,13 @@ SLANG_HIERARCHICAL_ENUM(ArtifactPayload, SLANG_ARTIFACT_PAYLOAD, SLANG_ARTIFACT_ x(Unknown, Base) \ x(CodeLike, Base) \ x(Kernel, CodeLike) \ - x(Host, CodeLike) + x(Host, CodeLike) \ + x(Obfuscated, Base) #define SLANG_ARTIFACT_STYLE_ENTRY(TYPE, PARENT) { Index(ArtifactStyle::TYPE), Index(ArtifactStyle::PARENT), #TYPE }, SLANG_HIERARCHICAL_ENUM(ArtifactStyle, SLANG_ARTIFACT_STYLE, SLANG_ARTIFACT_STYLE_ENTRY) - /* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ArtifactDescUtil !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */ /* static */ArtifactDesc ArtifactDescUtil::makeDescForCompileTarget(SlangCompileTarget target) @@ -555,7 +556,7 @@ static const KindExtension g_cpuKindExts[] = // Visual Studio. It's used here for source map. if (slice == toSlice("map")) { - return ArtifactDesc::make(ArtifactKind::Text, ArtifactPayload::SourceMap); + return ArtifactDesc::make(ArtifactKind::Json, ArtifactPayload::SourceMap); } if (slice == toSlice("pdb")) -- cgit v1.2.3