aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe
diff options
context:
space:
mode:
authorGravatar brandjon <brandjon@google.com>2018-03-20 10:47:31 -0700
committerGravatar Copybara-Service <copybara-piper@google.com>2018-03-20 10:48:43 -0700
commit7ba9d764dfdea96da470f612d360824269fda132 (patch)
tree76dae3fc33f32c2e1c9bbe396a37dcf4bab39c09 /src/main/java/com/google/devtools/build/lib/skyframe
parentadb27dc3783509768f8a2ba5f2913185ccd90eec (diff)
Add ability to shallow-freeze individual objects
Clarify that the IMMUTABLE Mutability should only be used for deeply immutable things, not tuples. Created a new SHALLOW_IMMUTABLE Mutability for them. Note that the new shallow-freezing functionality marks things as deeply IMMUTABLE without traversing its contents. I.e., it lies, and it is up to the caller to ensure this doesn't cause problems. RELNOTES: NONE PiperOrigin-RevId: 189767422
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/serialization/DeserializationContext.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/serialization/DeserializationContext.java b/src/main/java/com/google/devtools/build/lib/skyframe/serialization/DeserializationContext.java
index 54b5820d31..55908b9e64 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/serialization/DeserializationContext.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/serialization/DeserializationContext.java
@@ -97,6 +97,14 @@ public class DeserializationContext {
* {@link A}.
*/
public <A, T> T makeInitialValue(Function<A, T> initialValueFunction, Class<A> klass) {
+ // TODO(janakr): Possibly remove the "additional data" mechanism entirely now that it's no
+ // longer needed to thread Skylark Mutability's around. Instead of initial value functions, we
+ // can just have codecs construct their initial values directly. The only reasons to keep
+ // additional data around are 1) if we think something else might need it in the future (but
+ // YAGNI), or 2) if we want to share the same Mutability across multiple deserializations
+ // (within a single thread) to reduce garbage. For 2), we could even access the Mutability
+ // through dedicated methods instead of a generic "additional data" mechanism, though it might
+ // require subclassing DeserializationContext to avoid adding a dependency on Skylark.
return deserializer.makeInitialValue(initialValueFunction, klass);
}