Skip to content

Commit c7bf530

Browse files
committed
Detect whether we're in pre-compilation or run-right-away mode and only code-gen the things we need. Quite a notable speedup for NQP tests; can always put it back if we need to debug it, but problems with this have been pretty rare.
1 parent c0d2879 commit c7bf530

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/HLL/SerializationContextBuilder.pm

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,17 @@ class HLL::Compiler::SerializationContextBuilder {
120120
}
121121

122122
# Add an event that may have an action to deserialize or fix up.
123+
# Note that we can determine which one we need and just save the
124+
# needed one.
123125
method add_event(:$deserialize_past, :$fixup_past) {
124-
@!event_stream.push(Event.new(
125-
:deserialize_past($deserialize_past), :fixup_past($fixup_past)
126-
));
126+
if %*COMPILING<%?OPTIONS><target> eq 'pir' {
127+
# Pre-compilation; only need deserialization PAST.
128+
@!event_stream.push(Event.new(:deserialize_past($deserialize_past)));
129+
}
130+
else {
131+
# Presumably, going all the way to running, so just fixups.
132+
@!event_stream.push(Event.new(:fixup_past($fixup_past)));
133+
}
127134
}
128135

129136
# Gets PAST for referencing an object in a serialization context,

0 commit comments

Comments
 (0)