From d898d561e3c76ecf38db434ec7fbb4bbd0e25cb2 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 18 Nov 2020 14:52:58 -0500 Subject: Serialized stdlib working (#1603) * #include an absolute path didn't work - because paths were taken to always be relative. * Mangling/module name extraction for GenericDecl * Add comment on SerialFilter to explain re-enabling Stmt. * Support setting up SyntaxDecl when reconstructed after deserialization. * Improvements to setup SyntaxDecl. * Fix typo so can read compressed SourceLocs. * Fix issue with SourceManger. --- source/slang/slang-serialize-factory.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'source/slang/slang-serialize-factory.cpp') diff --git a/source/slang/slang-serialize-factory.cpp b/source/slang/slang-serialize-factory.cpp index 3ff536137..9b3ba9994 100644 --- a/source/slang/slang-serialize-factory.cpp +++ b/source/slang/slang-serialize-factory.cpp @@ -86,6 +86,16 @@ SerialIndex ModuleSerialFilter::writePointer(SerialWriter* writer, const NodeBas } } + // TODO(JS): If I enable this section then the stdlib doesn't work correctly, it appears to be because of + // `addCatchAllIntrinsicDecorationIfNeeded`. If this is enabled when AST is serialized, the 'body' (ie Stmt) + // will not be serialized. When serialized back in, it will appear to be a function without a body. + // In that case `addCatchAllIntrinsicDecorationIfNeeded` will add an intrinsic which in some cases is incorrect. + // This happens during lowering. + // + // So it seems the fix is for some other mechanism. Another solution is perhaps to run something like `addCatchAllIntrinsicDecorationIfNeeded` + // on the stdlib after compilation, and before serialization. Then removing it from lowering. + +#if 0 // TODO(JS): What we really want to do here is to ignore bodies functions. // It's not 100% clear if this is even right though - for example does type inference // imply the body is needed to say infer a return type? @@ -99,6 +109,7 @@ SerialIndex ModuleSerialFilter::writePointer(SerialWriter* writer, const NodeBas writer->setPointerIndex(stmt, SerialIndex(0)); return SerialIndex(0); } +#endif // For now for everything else just write it return writer->writeObject(ptr); -- cgit v1.2.3