<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">On Jan 24, 2014, at 5:38 AM, Jay K <<a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a>> wrote:<br><div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr">Is our garbage collector compacting?<br></div></div></blockquote><div><br></div><div>Yes, it is mostly-copying.</div><div>Only pages that are not referred to from the stack (i.e., only from other objects) have their objects relocated (compacted).</div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><span style="font-size: 12pt;">In particular, what model do we need for "volatile" in codegen?</span><br>Does the compactor read the registers or just the stack?<br></div></div></blockquote><div><br></div><div>It reads both registers and stack.</div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr">Update references anywhere? Just the stack? Also context?<br></div></div></blockquote><div><br></div><div>The collector first pins all pages referenced from the stacks, including registers.</div><div>Any page not pinned has its reachable objects evacuated and all references to those objects (i.e., from other objects) are updated to refer to the the new location.</div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><span style="font-size: 12pt;">There are tradeoffs either way.</span><br></div></div></blockquote><div><br></div><div>Indeed. Too many to enumerate here.</div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><span style="font-size: 12pt;">If it is not compacting and only reads the stack, then it can be more</span><br>portable, but every write of a collected type/pointer would have to be volatile.<br>Or is that what the barriers are for?<br></div></div></blockquote><div><br></div><div>The write barrier allows the collector to run concurrently with the mutator (once all stack roots have been sampled).</div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><span style="font-size: 12pt;">If we update values on the stack, then there is some portability,</span><br>but reads and writes would have to be volatile.<br></div></div></blockquote><div><br></div><div>No updates to values on the stacks.</div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><span style="font-size: 12pt;">If we read and write registers in the collector, then nothing has to be volatile.</span><br></div></div></blockquote><div><br></div><div>Read only. No writes to registers.</div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><span style="font-size: 12pt;">Should this all be parameters passed to the backend?</span><br></div></div></blockquote><div><br></div><div>Nope.</div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr">And/or preserved via #ifdef in the C backend?<br>That last part is easy enough, for generated C to take #ifdefs<br>indicating if reads and/or writes should be volatile.<br></div></div></blockquote><div><br></div><div>Nope.</div><br><blockquote type="cite"><div class="hmmessage" style="font-size: 12pt; font-family: Calibri; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div dir="ltr"><span style="font-size: 12pt;">If the collector is not compacting, then it need not update</span><br>stack or register values, just possibly read them.<br><br>I recall reading that it is compacting.<br></div></div></blockquote></div><div><br></div><div>It is mostly-copying.</div><div><br></div></body></html>