SNSystems / llvm-project-prepo

Fork of LLVM with modifications to support a program repository
26 stars 0 forks source link

Reliably record ticket file directories for repository GC #141

Closed paulhuggett closed 3 years ago

paulhuggett commented 3 years ago

Part of a fix for issue #133 along with pstore PR#88.

I have been very aware every time a new test for rld is committed using the pstore exchange format, that these JSON files will need to be revisited following the fix for issue #133 since this will change the underlying schema. That has been a disincentive to add new tests and added to the need to resolve this problem swiftly.

The matching pstore change adds a new index to the repo which contains the set of ticket file paths. Here we update the compiler, repo-create-ticket, and rld-gen to manipulate this new collection as well as correcting the existing test files.

Here’s a short example showing the effect of this change:

$ cd /home/prepo
$ mkdir test
$ cd test
$ echo "int main () {}" > main.c
$ clang -target x86_64-pc-linux-gnu-repo -c -o main.o main.c
$ pstore-dump --paths clang.db
---

- file  : 
      path : clang.db
      size : 752
  paths : 
      - /home/prepo/test
...

Now create a new ticket file in a different directory and dump the updated database:

$ repo-create-ticket -o ../copy.o $(repo-ticket-dump main.o)
$ pstore-dump --paths clang.db
---

- file  : 
      path : clang.db
      size : 1016
  paths : 
      - /home/prepo
      - /home/prepo/test
...

This shows that the database is now aware of the two ticket files so it will be possible for the GC process to discover them and treat the compilations that they reference as live during collection. Note that CI for this PR will fail until pstore PR#88 is committed.

paulhuggett commented 3 years ago

When runing the test rld :: undefined_reference.json. the following error is given:

'!': command not found

In the lit test, we could use not instead of !.

This isn’t something that I’ve changed as part of this PR so I would rather resolve that problem separately.