-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathobjectgc.lyx
2167 lines (1749 loc) · 46.8 KB
/
objectgc.lyx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#LyX 2.2 created this file. For more info see http://www.lyx.org/
\lyxformat 508
\begin_document
\begin_header
\save_transient_properties true
\origin unavailable
\textclass extreport
\use_default_options true
\begin_modules
fixltx2e
fix-cm
theorems-ams-bytype
\end_modules
\maintain_unincluded_children false
\language british
\language_package default
\inputencoding auto
\fontencoding global
\font_roman "default" "default"
\font_sans "default" "default"
\font_typewriter "default" "default"
\font_math "auto" "auto"
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100 100
\font_tt_scale 100 100
\graphics default
\default_output_format default
\output_sync 0
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry false
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 1
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 1
\use_package mhchem 1
\use_package stackrel 1
\use_package stmaryrd 1
\use_package undertilde 1
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date true
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 1
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 2
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header
\begin_body
\begin_layout Chapter
\begin_inset CommandInset label
LatexCommand label
name "chap:Object-Collection"
\end_inset
Object Collection
\end_layout
\begin_layout Standard
As discussed in chapters
\begin_inset CommandInset ref
LatexCommand ref
reference "chap:Syntax-and-Operational"
\end_inset
and
\begin_inset CommandInset ref
LatexCommand ref
reference "chap:Reference-Capabilities"
\end_inset
, Pony, like many actor-model languages, has non-actor entities, in the
form of passive (synchronous) objects, and such objects can be passed between
actors in messages.
In order to pass such messages by reference, in order to have zero-copy
message passing, objects that have been passed or shared between actors
must be garbage collected, and this garbage collection must be more efficient
than copying objects in messages.
Garbage collecting such objects in an actor-model language faces similar
problems to garbage collecting actors themselves.
The inability to examine the global state of the program without pausing
the program results in existing approaches to object garbage collection
suffering performance problems, particularly when stop-the-world pauses
cause the program to become unresponsive.
\end_layout
\begin_layout Standard
Existing approaches to reducing stop-the-world pauses in garbage collection
\begin_inset CommandInset citation
LatexCommand cite
key "click2005pauseless,tene2011c4"
\end_inset
significantly reduce such program pauses.
However, such general approaches cannot leverage the properties of an actor-mod
el language, particularly the isolation of state within actors.
As a result, they rely on techniques such as
\emph on
read barriers
\emph default
, which adversely affect mutator thread performance, in order to reduce
pause times.
\end_layout
\begin_layout Standard
Erlang achieves fully concurrent passive object garbage collection by copying
passive objects sent in messages to the
\emph on
process-local heap
\emph default
of the destination.
This comes at a cost: copying the passive objects can be expensive when
large data structures are passed between actors, both when the message
is sent (due to the time taken to copy the message) and over time (due
to the resulting increased memory usage).
Copying message contents also means that
\emph on
object identity
\emph default
must be encoded in the data structure by the programmer, rather than being
implicitly derived from the object's memory address.
While this is less important for a functional language such as Erlang,
it is important for an
\emph on
object capability
\emph default
language such as Pony.
\end_layout
\begin_layout Standard
In Pony, a novel technique for passive object collection has been developed
based on Message-based Actor Collection (
\emph on
MAC
\emph default
), described in chapter
\begin_inset CommandInset ref
LatexCommand ref
reference "chap:Actor-Collection"
\end_inset
.
This approach, termed Ownership and Reference Counting for Actors (
\emph on
ORCA
\emph default
) extends
\emph on
MAC
\emph default
to allow synchronous objects allocated by some actor
\begin_inset Formula $\alpha$
\end_inset
and subsequently shared with other actors to be efficiently and safely
garbage collected by the allocating actor
\begin_inset Formula $\alpha$
\end_inset
without requiring any synchronisation mechanism other than message passing.
This combines
\emph on
actor-local heaps
\emph default
with an
\emph on
ownership
\emph default
model wherein an actor
\begin_inset Formula $\alpha$
\end_inset
may be able to reach an object
\begin_inset Formula $\omega$
\end_inset
in the heap of another actor
\begin_inset Formula $\alpha'$
\end_inset
, but the allocating actor
\begin_inset Formula $\alpha'$
\end_inset
(i.e.
the owner) remains responsible for garbage collecting
\begin_inset Formula $\omega$
\end_inset
.
\end_layout
\begin_layout Section
Background on Actor-Model Object GC
\end_layout
\begin_layout Standard
Existing approaches to collecting passive objects in actor-model languages
and libraries fall into four basic categories:
\end_layout
\begin_layout Enumerate
\emph on
Manual actor termination with global heap tracing.
\emph default
This approach relies on the programmer manually terminating actors and
leverages an existing garbage collection mechanism, such as is present
on the JVM or the CLR, as is done in Scala
\begin_inset CommandInset citation
LatexCommand cite
key "haller2009scala"
\end_inset
, Akka, Kilim
\begin_inset CommandInset citation
LatexCommand cite
key "srinivasan2008kilim"
\end_inset
, AmbientTalk
\begin_inset CommandInset citation
LatexCommand cite
key "van2008ambient"
\end_inset
, and SALSA 2.0
\begin_inset CommandInset citation
LatexCommand cite
key "varela2001programming"
\end_inset
.
Garbage collection in such systems does not leverage actor isolation, but
can leverage existing well-known garbage collection techniques for non-actor
languages.
\end_layout
\begin_layout Enumerate
\emph on
Manual actor termination with local heap tracing.
\emph default
This approach also relies on the programmer manually terminating actors,
but the tracing mechanism takes advantage of actor isolation to provide
local heaps.
To preserve heap locality, messages are copied into the heap of the receiving
actor.
This approach is taken by BEAM-based languages such as Erlang
\begin_inset CommandInset citation
LatexCommand cite
key "armstrong2007history"
\end_inset
and Elixir.
By accepting the costs of message copying, this technique allows garbage
collection to be fully concurrent.
\end_layout
\begin_layout Enumerate
\emph on
Actor graph transformation with global heap tracing
\emph default
.
By transforming the actor graph into a passive object graph and using a
tracing collector for both actors and objects
\begin_inset CommandInset citation
LatexCommand cite
key "vardhan2002using,wang2010actor"
\end_inset
, this approach allows actors themselves to be garbage collected.
ActorFoundry uses this technique.
While this approach requires significant stop-the-world pauses, it is also
the first approach to allow actors themselves to be garbage collected.
\end_layout
\begin_layout Enumerate
\emph on
Snapshots and reference listing with global heap tracing
\emph default
.
This technique, used in SALSA 1.0
\begin_inset CommandInset citation
LatexCommand cite
key "wang2006distributed,wang2006non,wang2013conservative"
\end_inset
, is able to collect both local and distributed actors.
While the approach is heavyweight and was removed in SALSA 2.0, it provided
a mechanism for collecting actors that did not rely on transforming the
actor graph to a passive object graph.
This approach uses an existing garbage collecting runtime, in this case
the JVM, to collect passive objects.
\end_layout
\begin_layout Standard
The purpose of
\emph on
ORCA
\emph default
is to provide an approach that combines garbage collected actors with local
heap tracing while not requiring messages to be copied to the destination
heap.
\end_layout
\begin_layout Section
Ownership and Reference Counting for Actors Algorithm
\end_layout
\begin_layout Standard
\emph on
ORCA
\emph default
extends
\emph on
MAC
\emph default
by tracking object references in external maps as well as actor references.
Through message receipt, actors may acquire references to objects allocated
by other actors, which we term
\emph on
foreign objects
\emph default
, and during execution they may release those references.
Therefore, to keep track of this, they acquire and release reference counts.
Importantly, such reference counts are not dependent on the shape of the
heap, but instead change only when messages are sent and received.
\end_layout
\begin_layout Standard
To do so, the operational semantics are altered to perform reference count
adjustments for passive objects as well as for actor references when sending
and receiving messages.
Similarly, actors can acquire and release reference counts for objects
owned by other actors.
To account for that,
\emph on
INC
\emph default
and
\emph on
DEC
\emph default
messages are changed to carry a map of address to reference count (that
is, an
\begin_inset Formula $\mathit{ExMap}$
\end_inset
) instead of a scalar reference count.
\end_layout
\begin_layout Subsection
Local Heap Tracing
\end_layout
\begin_layout Standard
The model for
\emph on
ORCA
\emph default
does not require a specific method of tracing a local heap.
In Pony, a mark-and-don't-sweep collector is used, as described in section
\begin_inset CommandInset ref
LatexCommand ref
reference "sec:Actor-GC"
\end_inset
.
However, alternate mechanisms for collecting a local heap, such as an increment
al garbage collector, or even a concurrent collector that examines a single
actor's local state and local heap at any given time, could be used.
\end_layout
\begin_layout Standard
The operational semantics accounts for this with a high level description
of when objects are unreachable by an actor
\begin_inset Formula $\alpha$
\end_inset
.
If such objects are owned by
\begin_inset Formula $\alpha$
\end_inset
, they may be collected if they have a local reference count of zero (or
have never had a local reference count).
If such objects are owned by some other actor, the foreign reference count
held by
\begin_inset Formula $\alpha$
\end_inset
can be released.
\end_layout
\begin_layout Subsection
Cyclic Passive Object Garbage
\end_layout
\begin_layout Standard
Importantly,
\emph on
ORCA
\emph default
does not require a cycle detector to collect passive objects.
This is because of the
\emph on
ownership
\emph default
model, wherein only actors hold reference counts for passive objects.
The topology of an object graph, that is, the number of paths by which
an object is reachable, does not affect the local or foreign reference
count for an object.
As such, a cyclic graph of passive objects does not result in reference
counts that will never reach zero.
\end_layout
\begin_layout Subsection
Local Heap Collection
\end_layout
\begin_layout Standard
The
\emph on
ownership
\emph default
model results in local heaps that are independently traceable and collectable,
without synchronisation.
Effectively, passive objects for which the owning (i.e.
allocating) actor maintains a positive local reference count are added
to the reachable set, preventing premature collection.
\end_layout
\begin_layout Standard
This local heap collection takes place without synchronisation, even though
the algorithm uses message passing to increment and decrement deferred
distributed weighted reference counts.
Importantly, none of the
\emph on
ORCA
\emph default
messages requires a reply, so there is never a situation in which an actor
\begin_inset Formula $\alpha$
\end_inset
must wait for another actor
\begin_inset Formula $\alpha'$
\end_inset
to make progress before
\begin_inset Formula $\alpha$
\end_inset
can itself make progress.
\end_layout
\begin_layout Section
Formal Model
\end_layout
\begin_layout Standard
The formal model for
\emph on
ORCA
\emph default
is expressed as an extension of the model for message-based actor collection
(
\emph on
MAC
\emph default
) presented in chapter
\begin_inset CommandInset ref
LatexCommand ref
reference "chap:Actor-Collection"
\end_inset
.
Where a rule or a definition is not changed, it is used unmodified.
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide true
sideways false
status open
\begin_layout Plain Layout
\align center
\begin_inset Formula $\begin{array}{rclcl}
\mu & \in & \mathit{Message} & = & {\color{gray}(\mathit{MethodID\times\overline{Value}})}\\
& & & | & INC(\mathit{ExMap})\,|\,DEC(\mathit{ExMap})\\
& & & | & {\color{gray}BLK(\mathit{ActorAddr},\mathit{RefCount},\mathit{ExMap})}\\
& & & | & {\color{gray}UNB(\mathit{ActorAddr})}\\
& & & | & {\color{gray}CNF(\mathit{Token})\,|\,ACK(\mathit{ActorAddr},\mathit{Token})}
\end{array}$
\end_inset
\end_layout
\begin_layout Plain Layout
\begin_inset Caption Standard
\begin_layout Plain Layout
\begin_inset CommandInset label
LatexCommand label
name "fig:Runtime-entities-for-object-GC"
\end_inset
\begin_inset Argument 1
status open
\begin_layout Plain Layout
Runtime entities for object GC
\end_layout
\end_inset
Runtime entities for object GC.
Elements that are unchanged are greyed out.
\end_layout
\end_inset
\end_layout
\end_inset
\end_layout
\begin_layout Standard
The only change in the runtime entities is a modification in the information
carried by
\emph on
INC
\emph default
and
\emph on
DEC
\emph default
messages.
Instead of a scalar reference count, those messages now carry a mapping
of address to reference count.
This allows a single message to communicate reference count changes for
a collection of objects allocated by some actor, and possibly the actor
itself.
\end_layout
\begin_layout Subsection
\begin_inset CommandInset label
LatexCommand label
name "subsec:Reachability-1"
\end_inset
Reachability
\end_layout
\begin_layout Standard
The rules for reachability remain unchanged from those delineated for
\emph on
MAC
\emph default
in section
\begin_inset CommandInset ref
LatexCommand ref
reference "subsec:Reachability"
\end_inset
.
Because
\emph on
MAC
\emph default
must find actor references anywhere in a passive object graph, the same
rules can be used to allow
\emph on
ORCA
\emph default
to find passive object references in the same graph.
Just as
\emph on
MAC
\emph default
does not have to determine global liveness for actor collection,
\emph on
ORCA
\emph default
does not need to determine global liveness for object collection.
\end_layout
\begin_layout Subsection
Reference Count Invariant
\end_layout
\begin_layout Standard
The reference count invariant for passive objects takes the same form as
the invariant for actors, and so can be stated for both as:
\end_layout
\begin_layout Standard
\begin_inset Formula
\[
\mathit{LRC}(\iota)+\mathit{INC}(\iota)-\mathit{DEC}(\iota)=\mathit{AMC}(\iota)+\mathit{FRC}(\iota)
\]
\end_inset
\end_layout
\begin_layout Standard
This invariant is evaluated in the context of some heap
\begin_inset Formula $\chi$
\end_inset
.
The reference count components for passive objects are effectively the
same as for actors, but use the external map exclusively for tracking reference
counts, without using the owning actor's local reference count.
\end_layout
\begin_layout Definition
Reference count invariant components
\end_layout
\begin_layout Definition
\begin_inset Formula $\begin{array}{lcl}
\mathit{LRC}(\omega) & = & \chi(\mathcal{O}(\omega))\downarrow_{8}(\omega)\\
\mathit{INC}(\omega) & = & \sum_{i=1}^{|Q(\chi,\mathcal{O}(\omega))|}\begin{cases}
\rho & \mathit{if}\,Q(\chi,\mathcal{O}(\omega))_{i}=\mathit{INC}(\xi)\wedge\xi(\omega)=\rho\\
0 & \mathit{otherwise}
\end{cases}\\
\mathit{DEC}(\omega) & = & \sum_{i=1}^{|Q(\chi,\mathcal{O}(\omega))|}\begin{cases}
\rho & \mathit{if}\,Q(\chi,\mathcal{O}(\omega))_{i}=\mathit{DEC}(\xi)\wedge\xi(\omega)=\rho\\
0 & \mathit{otherwise}
\end{cases}\\
\mathit{AMC}(\omega) & = & \sum_{\alpha\in\mathit{dom}(\chi)}\sum_{i=1}^{|Q(\chi,\alpha)|}\begin{cases}
1 & \mathit{if}\,\omega\in\mathit{Reach}(\chi,\alpha,Q(\chi,\alpha)_{i})\\
0 & \mathit{otherwise}
\end{cases}\\
\mathit{FRC}(\omega) & = & \sum_{\alpha\neq\mathcal{O}(\omega)}\chi(\alpha)\downarrow_{8}(\omega)
\end{array}$
\end_inset
\end_layout
\begin_layout Standard
The reference count invariant is maintained in the same way for passive
objects as for actors.
\end_layout
\begin_layout Standard
The reachability reference count invariant for objects differs from the
actor reachability reference count invariant in several ways.
When determining which queues should be examined, the owning actor
\begin_inset Formula $\alpha=\mathcal{O}(\omega)$
\end_inset
is considered.
Rather than an object
\begin_inset Formula $\omega$
\end_inset
tracking its own local reference count, the owning actor
\begin_inset Formula $\alpha$
\end_inset
for
\begin_inset Formula $\omega$
\end_inset
tracks the local reference count for
\begin_inset Formula $\omega$
\end_inset
in the external map of
\begin_inset Formula $\alpha$
\end_inset
.
When examining
\emph on
INC
\emph default
and
\emph on
DEC
\emph default
messages, external sets are examined rather than a scalar reference count
value.
\end_layout
\begin_layout Definition
\begin_inset CommandInset label
LatexCommand label
name "Reachability-invariant"
\end_inset
Reachability invariant
\end_layout
\begin_layout Definition
\begin_inset Formula $\forall\alpha,\omega.[\alpha\neq\mathcal{O}(\omega)\wedge\omega\in\mathit{Reach}(\chi,\alpha,\mathtt{ref})\Rightarrow\chi(\mathcal{O}(\omega))\downarrow_{8}(\omega)>0\wedge\chi(\alpha)\downarrow_{8}(\omega)>0]$
\end_inset
\end_layout
\begin_layout Subsection
Sending a Reference
\end_layout
\begin_layout Standard
When a sending a message that can reach some object
\begin_inset Formula $\omega$
\end_inset
,
\emph on
ORCA
\emph default
must perform a reference count adjustment.
This is accounted for by changing the definition of
\begin_inset Formula $\mathit{Send}$
\end_inset
when a passive object is being sent (previously defined in definition
\begin_inset CommandInset ref
LatexCommand ref
reference "Sending-a-reference"
\end_inset
) to perform reference a reference count adjustment, as defined by
\begin_inset Formula $\mathit{Adj}$
\end_inset
in figure
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:Auxiliary-definitions-for-object-gc"
\end_inset
.
\end_layout
\begin_layout Definition
\begin_inset CommandInset label
LatexCommand label
name "def:Sending-a-reference-1"
\end_inset
Sending a reference
\end_layout
\begin_layout Definition
\begin_inset Formula $\begin{array}{lcl}
\mathit{Send}(\chi,\alpha,\omega) & = & \mathit{Adj}(\chi,\alpha,\omega,1)\end{array}$
\end_inset
\end_layout
\begin_layout Standard
Note that
\begin_inset Formula $\mathit{Adj}$
\end_inset
is defined such that if
\begin_inset Formula $\alpha$
\end_inset
is the owner of
\begin_inset Formula $\omega$
\end_inset
, then
\begin_inset Formula $\alpha$
\end_inset
adds
\begin_inset Formula $n$
\end_inset
(here,
\begin_inset Formula $-1$
\end_inset
) to its local reference count for
\begin_inset Formula $\omega$
\end_inset
.
On the other hand, if
\begin_inset Formula $\alpha$
\end_inset
is not the owner of
\begin_inset Formula $\omega$
\end_inset
, then
\begin_inset Formula $\alpha$
\end_inset
subtracts
\begin_inset Formula $n$
\end_inset
from its foreign reference count for
\begin_inset Formula $\omega$
\end_inset
.
\end_layout
\begin_layout Subsection
Receiving a Reference
\end_layout
\begin_layout Standard
As with sending a reference to an object, when receiving a reference to
some object
\begin_inset Formula $\omega$
\end_inset
,
\emph on
ORCA
\emph default
must also perform a reference count adjustment.
The definition of
\begin_inset Formula $\mathit{Recv}$
\end_inset
, previously defined in definition
\begin_inset CommandInset ref
LatexCommand ref
reference "Receiving-a-reference"
\end_inset
, is altered in the same way as
\begin_inset Formula $\mathit{Send}$
\end_inset
, performing a reference count adjustment for passive objects.
\end_layout
\begin_layout Definition
\begin_inset CommandInset label
LatexCommand label
name "def:Receiving-a-reference-1"
\end_inset
Receiving a reference
\end_layout
\begin_layout Definition
\begin_inset Formula $\begin{array}{lcl}
\mathit{Recv}(\chi,\alpha,\omega) & = & \mathit{Adj}(\chi,\alpha,\omega,-1)\end{array}$
\end_inset
\end_layout
\begin_layout Subsection
Actor Local Execution
\end_layout
\begin_layout Standard
The operational semantics in figure
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:opsem-for-object-GC"
\end_inset
extends the semantics presented in figure
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:opsem-for-actor-GC"
\end_inset
.
Rules from figure
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:opsem-for-actor-GC"
\end_inset
that are not listed remain unchanged from
\emph on
MAC.
\end_layout
\begin_layout Standard
\begin_inset Float figure
wide false
sideways false
status open
\begin_layout Plain Layout
\align center
\begin_inset ERT
status open
\begin_layout Plain Layout
\backslash
makebox[
\backslash
textwidth][c]{
\end_layout
\end_inset
\begin_inset Formula $\begin{array}{ccc}
\dfrac{\begin{array}{c}
\neg\chi(\alpha)\downarrow_{9}\quad\mathit{INC}(\xi)\cdot\overline{\mu}=\chi(\alpha)\downarrow_{3}\\
\chi'=\mathit{Adj}(\chi,\alpha,\xi)
\end{array}}{\chi,\alpha,\varepsilon\rightsquigarrow\chi'[\alpha\mapsto\overline{\mu}],\alpha,\varepsilon}\;\textrm{\textsc{Inc}} & & \dfrac{\begin{array}{c}
\neg\chi(\alpha)\downarrow_{9}\quad\mathit{DEC}(\xi)\cdot\overline{\mu}=\chi(\alpha)\downarrow_{3}\\
\chi'=\mathit{Adj}(\chi,\alpha,-\xi)
\end{array}}{\chi,\alpha,\varepsilon\rightsquigarrow\chi'[\alpha\mapsto\overline{\mu}],\alpha,\varepsilon}\;\textrm{\textsc{Dec}}\\
\\
\dfrac{\begin{array}{c}
\neg\chi(\alpha)\downarrow_{9}\quad\alpha\neq\alpha'\\
\iota s\subseteq\mathit{dom}(\chi(\alpha)\downarrow_{8})\\
\forall\iota\in\iota s.[\mathcal{O}(\iota)=\alpha'\wedge\chi(\alpha)\downarrow_{8}(\iota)>0]\\
\xi=[\iota\mapsto n\,|\,\iota\in\iota s]\\
\chi'=\mathit{Adj}(\chi[\alpha,\alpha'++\mathit{INC}(\xi)],\alpha,-\xi)
\end{array}}{\chi,\alpha\cdot\overline{\varphi},\mathtt{e}\rightsquigarrow\chi',\alpha\cdot\overline{\varphi},\mathtt{e}}\;\textrm{\textsc{Acquire}} & & \dfrac{\begin{array}{c}
\neg\chi(\alpha)\downarrow_{9}\quad\alpha\neq\alpha'\\