Skip to content

tool for compiling a swiftmodule in memory #26848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 27, 2019

Conversation

marcrasi
Copy link

@marcrasi marcrasi commented Aug 26, 2019

This is a tool for compiling swiftmodules in memory. There is a single entry point compileSwiftModule with comments. There are also tests.

The purpose is to make it possible to develop a code intelligence server that doesn't rely on an external build system to build dependencies and that doesn't write to the filesystem. See https://forums.swift.org/t/building-swiftmodules-for-sourcekit/28030 for more discussion.

This should be very upstreamable, but I want to get it into the tensorflow branch first so that I can unblock development of the internal google code intelligence server.

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi marcrasi force-pushed the inmemoryfrontend branch 3 times, most recently from 2c5fa9c to 6160946 Compare August 26, 2019 19:29
@marcrasi
Copy link
Author

@swift-ci please test tensorflow

2 similar comments
@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi marcrasi changed the title [do not merge] testing if my test is set up correctly tool for compiling a swiftmodule in memory Aug 26, 2019
@marcrasi marcrasi requested a review from burmako August 26, 2019 20:35
@marcrasi
Copy link
Author

@swift-ci please test tensorflow linux

const SerializationOptions &options,
std::unique_ptr<llvm::MemoryBuffer> *moduleBuffer,
std::unique_ptr<llvm::MemoryBuffer> *moduleDocBuffer,
const SILModule *M);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the method above default to M == nullptr and this one doesn't?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change this to be consistent.

std::unique_ptr<llvm::MemoryBuffer> *moduleBuffer,
std::unique_ptr<llvm::MemoryBuffer> *moduleDocBuffer, const SILModule *M) {
if (moduleBuffer) {
SharedTimer timer("Serialization, swiftmodule, to buffer");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to memory?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

}

if (moduleDocBuffer) {
SharedTimer timer("Serialization, swiftdoc, to buffer");
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


using namespace swift;

class StreamDiagConsumer : public DiagnosticConsumer {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is a copy/paste of StreamDiagConsumer from SwiftASTManager, but I don't mind that for apple/swift:tensorflow.

@marcrasi
Copy link
Author

@swift-ci please test tensorflow

@marcrasi marcrasi merged commit 7dc9191 into swiftlang:tensorflow Aug 27, 2019
@marcrasi marcrasi deleted the inmemoryfrontend branch August 27, 2019 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants