Skip to content

Commit 15cb1fe

Browse files
committed
Start to suppress generation of various deserialization events that are covered by the new serializer when $NEW_SER is set.
1 parent 6291382 commit 15cb1fe

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/HLL/World.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ class HLL::World {
260260
# Code references.
261261
my $cr_past := PAST::Op.new( :pasttype('list') );
262262
for $!code_ref_blocks -> $block {
263-
$cr_past.push(PAST::Val.new( :value($block) ));
263+
$cr_past.push(PAST::Val.new( :value($block), :returns('Sub') ));
264264
}
265265

266266
# Overall deserialization PAST.

src/NQP/World.pm

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class NQP::World is HLL::World {
9090
($target.WHO){$name} := $obj;
9191

9292
# Add deserialization installation of the symbol.
93-
if self.is_precompilation_mode() {
93+
if self.is_precompilation_mode() && !$NEW_SER {
9494
my $path := self.get_slot_past_for_object($package);
9595
for @sym {
9696
$path := PAST::Op.new(:pirop('nqp_get_package_through_who PPs'), $path, ~$_);
@@ -161,7 +161,7 @@ class NQP::World is HLL::World {
161161

162162
# Add an event. There's no fixup to do, just a type object to create
163163
# on deserialization.
164-
if self.is_precompilation_mode() {
164+
if self.is_precompilation_mode() && !$NEW_SER {
165165
my @how_ns := pir::split('::', $how.HOW.name($how));
166166
my $how_name := @how_ns.pop();
167167
my $setup_call := PAST::Op.new(
@@ -193,7 +193,7 @@ class NQP::World is HLL::World {
193193
$obj.HOW.add_attribute($obj, $attr);
194194

195195
# Emit code to create and add it when deserializing.
196-
if self.is_precompilation_mode() {
196+
if self.is_precompilation_mode() && !$NEW_SER {
197197
my $create_call := PAST::Op.new(
198198
:pasttype('callmethod'), :name('new'),
199199
self.get_ref($meta_attr)
@@ -233,6 +233,7 @@ class NQP::World is HLL::World {
233233
# See if we already have our compile-time dummy. If not, create it.
234234
my $fixups := PAST::Stmts.new();
235235
my $dummy;
236+
my $code_ref_idx;
236237
if pir::defined($method_past<compile_time_dummy>) {
237238
$dummy := $method_past<compile_time_dummy>;
238239
}
@@ -261,7 +262,7 @@ class NQP::World is HLL::World {
261262
pir::assign__vPS($dummy, $name);
262263
if $NEW_SER {
263264
pir::setprop__vPsP($dummy, 'STATIC_CODE_REF', $dummy);
264-
self.add_root_code_ref($dummy, $method_past);
265+
$code_ref_idx := self.add_root_code_ref($dummy, $method_past);
265266
}
266267
else {
267268
self.add_code_LEGACY($dummy);
@@ -278,7 +279,13 @@ class NQP::World is HLL::World {
278279
# For fixup, need to assign the method body we actually compiled
279280
# onto the one that went into the SC. Deserializing is easier -
280281
# just the straight meta-method call.
281-
unless $NEW_SER {
282+
if $NEW_SER {
283+
$fixups.push(PAST::Op.new(
284+
:pirop('assign vPP'),
285+
self.get_slot_past_for_code_ref_at($code_ref_idx),
286+
PAST::Val.new( :value($method_past) )
287+
));
288+
} else {
282289
# XXX need to re-do the following for the new serialization
283290
$fixups.push(PAST::Op.new(
284291
:pirop('assign vPP'),
@@ -382,7 +389,7 @@ class NQP::World is HLL::World {
382389
$obj.HOW."$meta_method_name"($obj, $to_add);
383390

384391
# Emit code to add it when deserializing.
385-
if self.is_precompilation_mode() {
392+
if self.is_precompilation_mode() && !$NEW_SER {
386393
my $slot_past := self.get_slot_past_for_object($obj);
387394
self.add_event(:deserialize_past(PAST::Op.new(
388395
:pasttype('callmethod'), :name($meta_method_name),
@@ -415,7 +422,7 @@ class NQP::World is HLL::World {
415422
$obj.HOW.compose($obj);
416423

417424
# Emit code to do the composition when deserializing.
418-
if self.is_precompilation_mode() {
425+
if self.is_precompilation_mode() && !$NEW_SER {
419426
my $slot_past := self.get_slot_past_for_object($obj);
420427
self.add_event(:deserialize_past(PAST::Op.new(
421428
:pasttype('callmethod'), :name('compose'),

0 commit comments

Comments
 (0)