Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/source/SourceManager.java @ 13664:f150a67b99e3
Truffle: SourceManager documentation concerning file caching
author | Michael Van De Vanter <michael.van.de.vanter@oracle.com> |
---|---|
date | Thu, 16 Jan 2014 17:23:50 -0800 |
parents | 35f637594acc |
children | c54f5fa05fd5 |
comparison
equal
deleted
inserted
replaced
13663:434b86962d0d | 13664:f150a67b99e3 |
---|---|
31 | 31 |
32 /** | 32 /** |
33 * A representation of source code information, suitable for hash table keys with equality defined | 33 * A representation of source code information, suitable for hash table keys with equality defined |
34 * in terms of content. There are three kinds of sources supported at present. | 34 * in terms of content. There are three kinds of sources supported at present. |
35 * <ul> | 35 * <ul> |
36 * <li><strong>File:</strong>Each file is represented as a canonical object, indexed by the | 36 * <li><strong>File:</strong> Each file is represented as a canonical object, indexed by the |
37 * absolute, canonical path name of the file. The textual contents of the file may be supplied when | 37 * absolute, canonical path name of the file. The textual contents of the file may be supplied when |
38 * the object is created, or it may be read lazily. Only one lazy attempt will be made to read a | 38 * the object is created, or it may be read lazily. Only one lazy attempt will be made to read a |
39 * file, and failure will result silently in null content.</li> | 39 * file, and failure will result silently in null content.</li> |
40 * <li><strong>Literal Source:</strong> A named text string, whose contents are supplied concretely | 40 * <li><strong>Literal Source:</strong> A named text string, whose contents are supplied concretely |
41 * (possibly via an {@link InputStream}), can also be used as a source. These are represented as | 41 * (possibly via an {@link InputStream}), can also be used as a source. These are represented as |
42 * value objects whose equality depends on both name and contents.</li> | 42 * value objects whose equality depends on both name and contents.</li> |
43 * <li><strong>Fake Files:</strong> A named text string used for testing; its contents can be | 43 * <li><strong>Fake Files:</strong> A named text string used for testing; its contents can be |
44 * retrieved by name, unlike literal sources.</li> | 44 * retrieved by name, unlike literal sources.</li> |
45 * </ul> | 45 * </ul> |
46 * <p> | |
47 * <strong>Cache:</strong> | |
48 * <ol> | |
49 * <li>Access to source file contents via {@link Source#getInputStream()} or | |
50 * {@link Source#getReader()} does <em>not</em> by itself result in the file's contents being cached | |
51 * in the {@link Source} object.</li> | |
52 * <li>Access to source file contents via {@link Source#getCode()} or any other {@link Source} | |
53 * methods related to file's contents <em>will</em> result in the contents being cached in the | |
54 * {@link Source} object.</li> | |
55 * <li>Once source file contents have been cached, access to source file contents via | |
56 * {@link Source#getInputStream()} or {@link Source#getReader()} will be provided from the cache.</li> | |
57 * <li>Any access to source file contents via the cache will result in a timestamp check and | |
58 * possible cache reload.</li> | |
59 * </ol> | |
46 */ | 60 */ |
47 public final class SourceManager { | 61 public final class SourceManager { |
48 | 62 |
49 // Only files and fake files are indexed. | 63 // Only files and fake files are indexed. |
50 private final Map<String, SourceImpl> pathToSource = new HashMap<>(); | 64 private final Map<String, SourceImpl> pathToSource = new HashMap<>(); |