http://wiki.apidesign.org/index.php?title=TwoYearsWithTruffle&feed=atom&action=historyTwoYearsWithTruffle - Revision history2024-03-28T23:57:59ZRevision history for this page on the wikiMediaWiki 1.12.0rc1http://wiki.apidesign.org/index.php?title=TwoYearsWithTruffle&diff=9209&oldid=prevJaroslavTulach: /* Runtime Sharing of ASTs */2017-08-02T12:01:15Z<p><span class="autocomment">Runtime Sharing of ASTs</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 12:01, 2 August 2017</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 91:</td>
<td colspan="2" class="diff-lineno">Line 91:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Runtime Sharing of ASTs ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Runtime Sharing of ASTs ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Designing [[API]] for sharing of [[AST]]s between different contexts/threads turned out to be a huge task. Without help of Christian - the [[Domain Expert]] - I couldn't even get started. But when we <del style="color: red; font-weight: bold; text-decoration: none;">overcome </del>the first obstacle - e.g. how to keep reference to a context in the most effective way - the rest started to materialize itself. The trick was to create a group of {{Truffle|com/oracle/truffle/api/vm|PolyglotEngine}} that would share their settings.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Designing [[API]] for sharing of [[AST]]s between different contexts/threads turned out to be a huge task. Without help of Christian - the [[Domain Expert]] - I couldn't even get started. But when we <ins style="color: red; font-weight: bold; text-decoration: none;">overcame </ins>the first obstacle - e.g. <ins style="color: red; font-weight: bold; text-decoration: none;">we found out </ins>how to keep reference to a context in the most effective way - the rest started to materialize itself. The trick was to create a group of {{Truffle|com/oracle/truffle/api/vm|PolyglotEngine}} <ins style="color: red; font-weight: bold; text-decoration: none;">instances </ins>that would share their settings.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>However technical issues (especially with interop) hold me back. At the end Christian tried and got to a working state (while some of the issues persisted). Then I massaged the [[API]]s trying to remove all that seemed superfluous and at the end we got to state that I envisioned - I just had to expose the interface <del style="color: red; font-weight: bold; text-decoration: none;">for </del>group of engines in the [[API]] as {{Truffle|com/oracle/truffle/api/vm|PolyglotRuntime}} - the rest stayed as planned. In spring 2017 we integrated the change.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>However technical issues (especially with interop) hold me back. At the end Christian tried and got to a working state (while some of the issues persisted). Then I massaged the [[API]]s trying to remove all that seemed superfluous and at the end we got to state that I envisioned - I just had to expose the interface <ins style="color: red; font-weight: bold; text-decoration: none;">representing </ins>group of engines in the [[API]] as {{Truffle|com/oracle/truffle/api/vm|PolyglotRuntime}} - the rest stayed as planned. In spring 2017 we integrated the change.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Clearly without [[Domain Expert]] knowledge this task would not be finished yet - but that was more an implementation detail - the [[API]]s ended up as designed without proper domain knowledge.</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>Clearly without [[Domain Expert]] knowledge this task would not be finished yet - but that was more an implementation detail - the [[API]]s ended up as designed without proper domain knowledge.</div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=TwoYearsWithTruffle&diff=9208&oldid=prevJaroslavTulach: /* Node.js & Java Interop */2017-08-02T11:59:57Z<p><span class="autocomment">Node.js & Java Interop</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 11:59, 2 August 2017</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 83:</td>
<td colspan="2" class="diff-lineno">Line 83:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Node.js & Java Interop ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Node.js & Java Interop ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>[[NodeJS]] and [[Java]] interaction has always been interesting to me since the days of ''avatar.js'' and [[I]] was thrilled to contribute to it when working on [[Truffle]]. The essential part is of course [[Java]] interop - by building it around ''typesafe view'' of dynamic object from [[Java]] (see [https://graalvm.github.io/graal/truffle/javadoc/com/oracle/truffle/tutorial/embedding/package-summary.html#Access_guest_language_classes_from_Java example]) I tried to make the co-operation between [[Java]] and [[JavaScript]] as smooth as possible and natural for both sides. An internal [[APIUsabilityStudy]] revealed certain implementation glitches (especially with respect to higher order collections like ''List<Map<String,List<Integer>>>'' <del style="color: red; font-weight: bold; text-decoration: none;">then </del>required few fixes, but otherwise the [[API]] turned to be quite usable for the early [[Truffle]] adopters. </div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>[[NodeJS]] and [[Java]] interaction has always been interesting to me since the days of ''avatar.js'' and [[I]] was thrilled to contribute to it when working on [[Truffle]]. The essential part is of course [[Java]] interop - by building it around ''typesafe view'' of <ins style="color: red; font-weight: bold; text-decoration: none;">any </ins>dynamic object from [[Java]] (see [https://graalvm.github.io/graal/truffle/javadoc/com/oracle/truffle/tutorial/embedding/package-summary.html#Access_guest_language_classes_from_Java example]) I tried to make the co-operation between [[Java]] and [[JavaScript]] as smooth as possible and natural for both sides. An internal [[APIUsabilityStudy]] revealed certain implementation glitches (especially with respect to higher order collections like ''List<Map<String,List<Integer>>>'' <ins style="color: red; font-weight: bold; text-decoration: none;">that </ins>required few fixes<ins style="color: red; font-weight: bold; text-decoration: none;">)</ins>, but otherwise the [[API]] <ins style="color: red; font-weight: bold; text-decoration: none;">approach </ins>turned <ins style="color: red; font-weight: bold; text-decoration: none;">out </ins>to be quite usable for the early [[Truffle]] adopters. </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Integration of [[NodeJS]] and [[Java]] isn't only about the calls, but also about tooling. How do you build your [[Java]] code? How do you launch your [[Java]] code in context of [[NodeJS]] then? How do you isolate your code from the [[Truffle]] language implementations? As part of this project [[I]] managed to find a way <del style="color: red; font-weight: bold; text-decoration: none;">how </del>to use industry standard [[Maven]] build tool to work with [[Java]] sources, <del style="color: red; font-weight: bold; text-decoration: none;">how </del>to launch the application and also <del style="color: red; font-weight: bold; text-decoration: none;">found </del>how to hide all the [[language]] classes away from the end user application by use of '''TruffleLocator''' class.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Integration of [[NodeJS]] and [[Java]] isn't only about the calls, but also about tooling. How do you build your [[Java]] code? How do you launch your [[Java]] code in context of [[NodeJS]] then? How do you isolate your code from the [[Truffle]] language implementations? As part of this project [[I]] managed to find a way to use industry standard [[Maven]] build tool to work with [[Java]] sources, to launch the <ins style="color: red; font-weight: bold; text-decoration: none;">[[Java]]+[[NodeJS]] </ins>application and also how to hide all the [[language]] classes away from the end user application <ins style="color: red; font-weight: bold; text-decoration: none;">classpath </ins>by use of '''TruffleLocator''' class.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>This <del style="color: red; font-weight: bold; text-decoration: none;">require </del>a bit of [[ClassLoader]] tricks, but that is something a [[NetBeans]] architect shall know. Not much [[Truffle]] [[Domain Expert]]ise <del style="color: red; font-weight: bold; text-decoration: none;">was </del>needed.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>This <ins style="color: red; font-weight: bold; text-decoration: none;">required </ins>a bit of [[ClassLoader]] tricks, but that is something a <ins style="color: red; font-weight: bold; text-decoration: none;">former </ins>[[NetBeans]] architect shall know. Not much [[Truffle]] [[Domain Expert]]ise needed <ins style="color: red; font-weight: bold; text-decoration: none;">otherwise</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Runtime Sharing of ASTs ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Runtime Sharing of ASTs ==</div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=TwoYearsWithTruffle&diff=9207&oldid=prevJaroslavTulach: /* Javadoc */2017-08-02T11:57:24Z<p><span class="autocomment">Javadoc</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 11:57, 2 August 2017</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 73:</td>
<td colspan="2" class="diff-lineno">Line 73:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Javadoc ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Javadoc ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>The original '''mx javadoc''' support wasn't suitable for [[API]] development. It generated [[Javadoc]] for all project classes - however that isn't what one wants in case of [[API]]. In [[API]]<del style="color: red; font-weight: bold; text-decoration: none;">s </del>some packages are public, some are an implementation detail. The [[Javadoc]] shall only be generated for the public ones. I addressed that in the [[Truffle]] project by modifying '''mx''' to pay attention to `package-info.java` file - if it was present, then the package was considered public (and included in the [[Truffle]] [[Javadoc]]) - all other packages were kept <del style="color: red; font-weight: bold; text-decoration: none;">away</del>. That contributed to quality of the documentation a lot.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>The original '''mx javadoc''' support wasn't suitable for [[API]] development. It generated [[Javadoc]] for all project classes - however that isn't what one wants in case of [[API]]<ins style="color: red; font-weight: bold; text-decoration: none;">s</ins>. In <ins style="color: red; font-weight: bold; text-decoration: none;">an </ins>[[API]] some packages are public, some are an implementation detail. The [[Javadoc]] shall only be generated for the public ones. I addressed that in the [[Truffle]] project by modifying '''mx''' to pay attention to `package-info.java` file - if it was present, then the package was considered public (and included in the [[Truffle]] [[Javadoc]]) - all other packages were kept <ins style="color: red; font-weight: bold; text-decoration: none;">out of the sight</ins>. That contributed to quality of the documentation a lot.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Yet there still were problems. Each [[API]] contains sample snippets of code. Soon I realized that most of the snippets in the documentation are wrong, uncompilable or at least outdated. The solution is easy - make sure these snippets are compiled together with rest of your code - then they'd be always up-to-date. It is just necessary to extract them from the source code and insert them into the documentation. That is why I created [[Codesnippet4Javadoc]] doclet and integrated it with '''mx javadoc'''. Btw. similar technology was used when writing [[TheAPIBook]]. As such the [[Truffle]] samples in the [[Javadoc]] documentation can easily be made always correct and <del style="color: red; font-weight: bold; text-decoration: none;">recent</del>.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Yet there still were problems. Each [[API]] contains sample snippets of code. Soon I realized that most of the snippets in the documentation are wrong, uncompilable or at least outdated. The solution is easy - make sure these snippets are compiled together with rest of your code - then they'd be always up-to-date. It is just necessary to extract them from the source code and insert them into the documentation. That is why I created [[Codesnippet4Javadoc]] doclet and integrated it with '''mx javadoc'''. Btw. similar technology was used when <ins style="color: red; font-weight: bold; text-decoration: none;">[[I]] was </ins>writing [[TheAPIBook]]. As such the [[Truffle]] samples in the [[Javadoc]] documentation can easily be made always correct and <ins style="color: red; font-weight: bold; text-decoration: none;">up to date</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Still, the [[Truffle]] [[API]] is huge (that is <del style="color: red; font-weight: bold; text-decoration: none;">an often sign </del>of [[API]]s) and it is not easy to know where to start. To address this the [[Truffle]] [[Javadoc]] now <del style="color: red; font-weight: bold; text-decoration: none;">starts </del>with a tutorial <del style="color: red; font-weight: bold; text-decoration: none;">section </del>and <del style="color: red; font-weight: bold; text-decoration: none;">only </del>from there (and embedded code samples) one can navigate to the actual classes and their methods. Such setup makes sure the tutorial text is always up-to-date with code samples and the <del style="color: red; font-weight: bold; text-decoration: none;">rest </del>of the [[Javadoc]] documentation<del style="color: red; font-weight: bold; text-decoration: none;">.</del></div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Still, the [[Truffle]] [[API]] is huge (that is <ins style="color: red; font-weight: bold; text-decoration: none;">a common feature </ins>of <ins style="color: red; font-weight: bold; text-decoration: none;">almost all </ins>[[API]]s) and it is not easy to know where to start. To address this the [[Truffle]] [[Javadoc]] now <ins style="color: red; font-weight: bold; text-decoration: none;">opens </ins>with a <ins style="color: red; font-weight: bold; text-decoration: none;">page containing a prose </ins>tutorial <ins style="color: red; font-weight: bold; text-decoration: none;">text. Such text guides [[API]] users </ins>and <ins style="color: red; font-weight: bold; text-decoration: none;">introduces them various [[Truffle]] concepts. Only </ins>from there (and <ins style="color: red; font-weight: bold; text-decoration: none;">in text </ins>embedded code samples) one can navigate to the actual classes and their methods <ins style="color: red; font-weight: bold; text-decoration: none;">to find out details about calling conventions and other low level details</ins>. Such setup makes sure the tutorial text is always up-to-date with code samples and <ins style="color: red; font-weight: bold; text-decoration: none;">cross referenced with </ins>the <ins style="color: red; font-weight: bold; text-decoration: none;">classical part </ins>of the [[Javadoc]] documentation.</div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div> </div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div></div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">Setting this up was of course easy to do without any [[Domain Expert]] knowledge (except the need to read the '''mx''' [[Python]] code)</del>.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">Setting this up was of course easy to do without any [[Domain Expert]] knowledge (except the need to read and change the enormous '''mx.py''' [[Python]] file).</ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Node.js & Java Interop ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Node.js & Java Interop ==</div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=TwoYearsWithTruffle&diff=9206&oldid=prevJaroslavTulach: /* Jackpot */2017-08-02T11:52:14Z<p><span class="autocomment">Jackpot</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 11:52, 2 August 2017</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 67:</td>
<td colspan="2" class="diff-lineno">Line 67:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>While [[backward compatibility]] is important, [[Truffle]] is also a young project that still wanted to perform necessary [[API]] fixes. To balance that I defined following compatibility policy:</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>While [[backward compatibility]] is important, [[Truffle]] is also a young project that still wanted to perform necessary [[API]] fixes. To balance that I defined following compatibility policy:</div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>an [[API]] element has to be deprecated first and <del style="color: red; font-weight: bold; text-decoration: none;">can </del>only <del style="color: red; font-weight: bold; text-decoration: none;">be </del>removed in subsequent release. <del style="color: red; font-weight: bold; text-decoration: none;">This, </del>we strong <del style="color: red; font-weight: bold; text-decoration: none;">awareness of </del>teams <del style="color: red; font-weight: bold; text-decoration: none;">to avoid using deprecated [[API]]s shall lead to </del>relatively stable <del style="color: red; font-weight: bold; text-decoration: none;">system</del>. To simplify switching from a deprecated [[API]]s, I convinced Jan Lahoda (master of anything [[AST]] related in [[Javac]] and [[NetBeans]] teams) to integrate his [[Jackpot]] project with '''mx''' build tool. In an ideal state it was just about typing '''mx jackpot --apply''' and the necessary changes to migrate from deprecated [[API]] to new replacement were done automatically.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">''</ins>an [[API]] element has to be deprecated first and only <ins style="color: red; font-weight: bold; text-decoration: none;">then </ins>removed in <ins style="color: red; font-weight: bold; text-decoration: none;">a </ins>subsequent release<ins style="color: red; font-weight: bold; text-decoration: none;">''</ins>. <ins style="color: red; font-weight: bold; text-decoration: none;">With this policy </ins>we <ins style="color: red; font-weight: bold; text-decoration: none;">could provide </ins>strong <ins style="color: red; font-weight: bold; text-decoration: none;">compatibility guarantee for our downstream </ins>teams<ins style="color: red; font-weight: bold; text-decoration: none;">. Warn them via deprecations and still have </ins>relatively stable <ins style="color: red; font-weight: bold; text-decoration: none;">development environment</ins>. To simplify switching from a deprecated [[API]]s, I convinced Jan Lahoda (master of anything [[AST]] related in [[Javac]] and [[NetBeans]] teams) to integrate his [[Jackpot]] project with '''mx''' build tool. In an ideal state it was just about typing '''mx jackpot --apply''' and the necessary changes to migrate from deprecated [[API]] to new replacement were done automatically <ins style="color: red; font-weight: bold; text-decoration: none;">in any code base downstream teams could have</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>[[Jackpot]] was also useful when we decided to witch to [[JDK]]8, but wanted to avoid the startup overhead associated with [[Lamdas]]. It was possible to create a [[Jackpot]] rule that detects [[lamdas]] and fails the compilation.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>[[Jackpot]] was also useful when we decided to witch to [[JDK]]8, but wanted to avoid the startup overhead associated with [[Lamdas]]. It was possible to create a [[Jackpot]] rule that detects [[lamdas]] and fails the compilation<ins style="color: red; font-weight: bold; text-decoration: none;">. Knowing these tools can significantly improve [[evolution]] of your [[API]] and give users of the [[API]] more pleasant experience when consuming it</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Javadoc ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Javadoc ==</div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=TwoYearsWithTruffle&diff=9205&oldid=prevJaroslavTulach: /* Sigtest */2017-08-02T11:47:48Z<p><span class="autocomment">Sigtest</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 11:47, 2 August 2017</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 60:</td>
<td colspan="2" class="diff-lineno">Line 60:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== [[Sigtest]] ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== [[Sigtest]] ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Essential part of developing [[API]] in a [[modular]] way is to keep [[backward compatibility]] - only then each <del style="color: red; font-weight: bold; text-decoration: none;">([[language]]) </del>team can update on <del style="color: red; font-weight: bold; text-decoration: none;">its </del>own independent schedule without the need to orchestrate adjustments to incompatible changes. However it is hard to keep [[backward compatibility]] while relying on one's cleverness. Just like people no longer test their programs by proof-reading their source code, we shall <del style="color: red; font-weight: bold; text-decoration: none;">used </del>tools test [[API]] compatibility: [[NetBeans]] <del style="color: red; font-weight: bold; text-decoration: none;">was </del>using [[Sigtest]] for a long time and thus I decided to use it for [[Truffle]] project as well.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Essential part of developing [[API]] in a [[modular]] way is to keep [[backward compatibility]] - only then each <ins style="color: red; font-weight: bold; text-decoration: none;">downstream </ins>team can update <ins style="color: red; font-weight: bold; text-decoration: none;">to new version of your project </ins>on own independent schedule without the need to <ins style="color: red; font-weight: bold; text-decoration: none;">mutually </ins>orchestrate adjustments to incompatible changes <ins style="color: red; font-weight: bold; text-decoration: none;">across all teams</ins>. However it is hard to keep [[backward compatibility]] while relying <ins style="color: red; font-weight: bold; text-decoration: none;">only </ins>on one's cleverness. Just like people no longer test their programs <ins style="color: red; font-weight: bold; text-decoration: none;">only </ins>by proof-reading their source code, we shall <ins style="color: red; font-weight: bold; text-decoration: none;">use </ins>tools <ins style="color: red; font-weight: bold; text-decoration: none;">to </ins>test [[API]] compatibility: [[NetBeans]] <ins style="color: red; font-weight: bold; text-decoration: none;">had been </ins>using [[Sigtest]] for a long time and thus I decided to use it for [[Truffle]] project as well.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Details are given in the [[TruffleSigtest]] page, I just want to stress that running [[Sigtest]] isn't just about starting some job as part of the build process. It requires an infrastructure to keep daily and release [[API]] snapshots and continuously compare the status against the previous snapshots. I have integrated [[Sigtest]] into [[Truffle]] build infrastructure ('''mx<del style="color: red; font-weight: bold; text-decoration: none;">'</del>''') and maintained necessary servers to give us early warnings in case of [[backward compatibility]] violations.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Details are given in the [[TruffleSigtest]] page, I just want to stress that running [[Sigtest]] isn't just about starting some job as part of the build process. It requires an infrastructure to keep daily and release [[API]] snapshots and continuously compare the status against the previous snapshots. I have integrated [[Sigtest]] into [[Truffle]] build infrastructure ('''mx''') and maintained necessary servers to give us early warnings in case of [[backward compatibility]] violations.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== [[Jackpot]] ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== [[Jackpot]] ==</div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=TwoYearsWithTruffle&diff=9204&oldid=prevJaroslavTulach: /* Source API */2017-08-02T11:43:14Z<p><span class="autocomment">Source API</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 11:43, 2 August 2017</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 52:</td>
<td colspan="2" class="diff-lineno">Line 52:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Source [[API]] ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Source [[API]] ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>{{Truffle|com/oracle/truffle/api/source|Source}} class was the central point of [[Truffle] source [[API]]. As its name suggests the [[API]] was created by Michael to encapsulate the sources. Usually I advocate to separate [[APIvsSPI]], but as the {{Truffle|com/oracle/truffle/api/source|Source}} class was '''final''' and just holding the code, I decided to keep it and use the same class for both the [[ClientAPI]] (e.g. {{Truffle|com/oracle/truffle/api/vm<del style="color: red; font-weight: bold; text-decoration: none;">/</del>PolyglotEngine}}) as well as [[ProviderAPI]] (e.g. {{Truffle|com/oracle/truffle/api<del style="color: red; font-weight: bold; text-decoration: none;">/</del>TruffleLanguage}}). As far as I can tell, this worked fine.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>{{Truffle|com/oracle/truffle/api/source|Source}} class was the central point of [[Truffle] source [[API]]. As its name suggests the [[API]] was created by Michael to encapsulate the sources. Usually I advocate to separate [[APIvsSPI]], but as the {{Truffle|com/oracle/truffle/api/source|Source}} class was '''final''' and just holding the code, I decided to keep it and use the same class for both the [[ClientAPI]] (e.g. {{Truffle|com/oracle/truffle/api/vm<ins style="color: red; font-weight: bold; text-decoration: none;">|</ins>PolyglotEngine}}) as well as [[ProviderAPI]] (e.g. {{Truffle|com/oracle/truffle/api<ins style="color: red; font-weight: bold; text-decoration: none;">|</ins>TruffleLanguage}}). As far as I can tell, this worked fine.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>However once we realized that the source object is mutable - in case of a change of a file on disk, it could reload its content. That was wild: imagine a [[language]] parser having an [[AST]] build around the source buffer and the buffer suddenly changes. All character references are suddenly wrong! </div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>However once we realized that the source object is mutable - in case of a change of a file on disk, it could reload its content. That was wild: imagine a [[language]] parser having an [[AST]] build around the source buffer and the buffer suddenly changes. All character references are suddenly wrong! </div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=TwoYearsWithTruffle&diff=9203&oldid=prevJaroslavTulach: /* Source API */2017-08-02T11:42:43Z<p><span class="autocomment">Source API</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 11:42, 2 August 2017</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 52:</td>
<td colspan="2" class="diff-lineno">Line 52:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Source [[API]] ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Source [[API]] ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>{{Truffle|com/oracle/truffle/api/source|Source}} was the central point of <del style="color: red; font-weight: bold; text-decoration: none;">a </del>source [[API]]. As its name suggests the [[API]] was created by Michael to encapsulate the sources. Usually I advocate to separate [[<del style="color: red; font-weight: bold; text-decoration: none;">ClientVsProviderAPI</del>]], but as the {{Truffle|com/oracle/truffle/api/source|Source}} class was final and just holding the code, I decided to keep it and use the same class for both the [[ClientAPI]] as well as [[ProviderAPI]]. As far as I can tell, this worked fine.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>{{Truffle|com/oracle/truffle/api/source|Source}} <ins style="color: red; font-weight: bold; text-decoration: none;">class </ins>was the central point of <ins style="color: red; font-weight: bold; text-decoration: none;">[[Truffle] </ins>source [[API]]. As its name suggests the [[API]] was created by Michael to encapsulate the sources. Usually I advocate to separate [[<ins style="color: red; font-weight: bold; text-decoration: none;">APIvsSPI</ins>]], but as the {{Truffle|com/oracle/truffle/api/source|Source}} class was <ins style="color: red; font-weight: bold; text-decoration: none;">'''</ins>final<ins style="color: red; font-weight: bold; text-decoration: none;">''' </ins>and just holding the code, I decided to keep it and use the same class for both the [[ClientAPI]] <ins style="color: red; font-weight: bold; text-decoration: none;">(e.g. {{Truffle|com/oracle/truffle/api/vm/PolyglotEngine}}) </ins>as well as [[ProviderAPI]] <ins style="color: red; font-weight: bold; text-decoration: none;">(e.g. {{Truffle|com/oracle/truffle/api/TruffleLanguage}})</ins>. As far as I can tell, this worked fine.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>However once we realized that the source object is mutable - in case of a change of a file on disk, it could reload <del style="color: red; font-weight: bold; text-decoration: none;">the </del>content. That <del style="color: red; font-weight: bold; text-decoration: none;">is </del>wild: imagine a [[language]] parser having an [[AST]] build around the source buffer and the buffer suddenly changes. All character references are suddenly wrong! </div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>However once we realized that the source object is mutable - in case of a change of a file on disk, it could reload <ins style="color: red; font-weight: bold; text-decoration: none;">its </ins>content. That <ins style="color: red; font-weight: bold; text-decoration: none;">was </ins>wild: imagine a [[language]] parser having an [[AST]] build around the source buffer and the buffer suddenly changes. All character references are suddenly wrong! </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>This had to stop and thus I made everything immutable with the help of few newly invented [[API Design]] patterns: [[BuilderWithConditionalException]], [[ChameleonBuilder]], [[HiddenBuilder]] and [[WhiningBuilder]]. Innovation and [[design as a service]] at your service!</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>This had to stop and thus I made everything immutable with the help of few newly invented [[API Design]] patterns: [[BuilderWithConditionalException]], [[ChameleonBuilder]], [[HiddenBuilder]] and [[WhiningBuilder]]. Innovation and [[design as a service]] at your service!</div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=TwoYearsWithTruffle&diff=9202&oldid=prevJaroslavTulach: /* Debugger */2017-08-02T11:39:56Z<p><span class="autocomment">Debugger</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 11:39, 2 August 2017</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 45:</td>
<td colspan="2" class="diff-lineno">Line 45:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>This all was achievable without [[Domain Expert]] knowledge of [[Truffle]]. However there were few problems that had to be addressed:</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>This all was achievable without [[Domain Expert]] knowledge of [[Truffle]]. However there were few problems that had to be addressed:</div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>* The AST instrumentation API was found to need to much memory overhead and real [[Truffle]] AST expert, Christian Humer had to be called to rewrite that<del style="color: red; font-weight: bold; text-decoration: none;">|</del>* Initial evaluation (that talked to a debugger) was slow - after weeks of struggling and help from Christian I finally learned enough about partial evaluation tricks ({{Truffle|com/oracle/truffle/api|Assumption}}, {{Truffle|com/oracle/truffle/api<del style="color: red; font-weight: bold; text-decoration: none;">/</del>CompilerDirectives.CompilationFinal}}) to speed it up</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>* The AST instrumentation API was found to need to much memory overhead and real [[Truffle]] AST expert, Christian Humer had to be called to rewrite that</div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>* Initial evaluation (that talked to a debugger) was slow - after weeks of struggling and help from Christian I finally learned enough about partial evaluation tricks ({{Truffle|com/oracle/truffle/api|Assumption}}, {{Truffle|com/oracle/truffle/api<ins style="color: red; font-weight: bold; text-decoration: none;">|</ins>CompilerDirectives.CompilationFinal}}) to speed it up</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>* Debugger could only be attached when new {{Truffle|com/oracle/truffle/api/vm|PolyglotEngine}} evaluation was about to start - again, it needed Christian's new instrumentation API to fix that up</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>* Debugger could only be attached when new {{Truffle|com/oracle/truffle/api/vm|PolyglotEngine}} evaluation was about to start - again, it needed Christian's new instrumentation API to fix that up</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>These problems show the limits of [[design API as a service]] - designing an [[API]] worked, but making it fast required a lot of understanding of what happens under the cover.</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>These problems show the limits of [[design API as a service]] - designing an [[API]] worked, but making it fast required a lot of understanding of what happens under the cover.</div></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=TwoYearsWithTruffle&diff=9201&oldid=prevJaroslavTulach: /* Debugger */2017-08-02T11:39:11Z<p><span class="autocomment">Debugger</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 11:39, 2 August 2017</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 38:</td>
<td colspan="2" class="diff-lineno">Line 38:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Debugger ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Debugger ==</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>The [[Truffle]] team master of [[debugger]] related tasks was Michael Van De Vanter - author of revolutionary article ''Debugging at Full Speed'' and many others. Michael had an implementation of [[debugger]] for [[Truffle]] implementation of [[Ruby]] and [[JavaScript]] running and also the implementation for [[R]] was sort of working. However the situation was similar to Matthias [[polyglot]] attempts - each language needed its own setup to turn the [[debugger]] on. In addition to that the way to start <del style="color: red; font-weight: bold; text-decoration: none;">normal </del>execution <del style="color: red; font-weight: bold; text-decoration: none;">- </del>e.g. via {{Truffle|com/oracle/truffle/api/vm|PolyglotEngine}} <del style="color: red; font-weight: bold; text-decoration: none;">- was different than the way to start debugging</del>. As a result one needed to decide ahead of time whether debugging will be needed or one wants just a plain execution. Of course this had to be unified.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>The [[Truffle]] team master of [[debugger]] related tasks was Michael Van De Vanter - author of revolutionary article ''Debugging at Full Speed'' and many others. Michael had an implementation of [[debugger]] for [[Truffle]] implementation of [[Ruby]] and [[JavaScript]] running and also the implementation for [[R]] was sort of working. However the situation was similar to Matthias [[polyglot]] attempts - each language needed its own setup to turn the [[debugger]] on. In addition to that the way to start <ins style="color: red; font-weight: bold; text-decoration: none;">[[debugging]] was quite different than the way to start regular </ins>execution <ins style="color: red; font-weight: bold; text-decoration: none;">(</ins>e.g. via {{Truffle|com/oracle/truffle/api/vm|PolyglotEngine}}<ins style="color: red; font-weight: bold; text-decoration: none;">)</ins>. As a result one needed to decide ahead of time whether debugging will be needed or <ins style="color: red; font-weight: bold; text-decoration: none;">whether </ins>one wants just a plain execution. Of course this had to be unified.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>After a bit of struggling I managed to reverse the dependency - e.g. one could always start the execution with {{Truffle|com/oracle/truffle/api/vm|PolyglotEngine}} and, if the [[debugger]] was initialized, debugging started automatically. Moreover I added few hooks that could be triggered via '''JPDA''' [[debugger]] protocol <del style="color: red; font-weight: bold; text-decoration: none;">and then </del>Martin Entlicher (the [[NetBeans]] debugger guy) <del style="color: red; font-weight: bold; text-decoration: none;">could implement </del>[[TruffleNetBeansDebugger]]. Since then [[NetBeans]] became able to debug any [[Truffle]] based language, step through the sources (even without the IDE understanding them), see stack variable, etc.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>After a bit of struggling I managed to reverse the dependency - e.g. one could always start the execution with {{Truffle|com/oracle/truffle/api/vm|PolyglotEngine}} and, if the [[debugger]] was initialized, debugging started automatically. Moreover I added few hooks that could be triggered via '''JPDA''' [[debugger]] protocol<ins style="color: red; font-weight: bold; text-decoration: none;">. Based on them </ins>Martin Entlicher (the [[NetBeans]] debugger guy) <ins style="color: red; font-weight: bold; text-decoration: none;">then implemented </ins>[[TruffleNetBeansDebugger]]. Since then [[NetBeans]] became able to debug any [[Truffle]] based language, step through the sources (even without the IDE understanding them), see stack variable, etc.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>Of course the behavior was buggy and had to be tested. I was thinking of putting the test into [[TruffleTCK]], but except one trivial case (using [[debugger]] to kill long running execution) the tests seemed too language specific to be tested ''from bottom''. Thus I created '''SLDebugTest''' which verified that stepping over a factorial computation works, shows <del style="color: red; font-weight: bold; text-decoration: none;">good </del>values for local variables, etc. <del style="color: red; font-weight: bold; text-decoration: none;">and asked other </del>teams <del style="color: red; font-weight: bold; text-decoration: none;">to copy </del>the test and <del style="color: red; font-weight: bold; text-decoration: none;">adopt </del>it to their language. As far as I can tell then the consistency of debugger implementations increased.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>Of course the behavior was buggy and had to be tested. I was thinking of putting the test into [[TruffleTCK]], but except one trivial case (using [[debugger]] to kill long running execution) the tests seemed too language specific to be tested ''from bottom''. Thus I created '''SLDebugTest''' which verified that stepping over a factorial computation works <ins style="color: red; font-weight: bold; text-decoration: none;">in our testing ''Simple Language''</ins>, shows <ins style="color: red; font-weight: bold; text-decoration: none;">proper </ins>values for local variables, etc. <ins style="color: red; font-weight: bold; text-decoration: none;">Other </ins>teams <ins style="color: red; font-weight: bold; text-decoration: none;">then copied </ins>the test and <ins style="color: red; font-weight: bold; text-decoration: none;">adopted </ins>it to their language. As far as I can tell then the consistency of debugger implementations increased.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>This all was achievable without [[Domain Expert]] knowledge of [[Truffle]]. However there were few problems that had to be addressed:</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>This all was achievable without [[Domain Expert]] knowledge of [[Truffle]]. However there were few problems that had to be addressed:</div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>* The AST instrumentation API was found <del style="color: red; font-weight: bold; text-decoration: none;">ineffective </del>and real [[Truffle]] AST expert, Christian Humer had to be called to rewrite that</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>* The AST instrumentation API was found <ins style="color: red; font-weight: bold; text-decoration: none;">to need to much memory overhead </ins>and real [[Truffle]] AST expert, Christian Humer had to be called to rewrite that<ins style="color: red; font-weight: bold; text-decoration: none;">|</ins>* Initial evaluation (that talked to a debugger) was slow - after weeks of struggling and help from Christian I finally learned enough about partial evaluation tricks <ins style="color: red; font-weight: bold; text-decoration: none;">({{Truffle|com/oracle/truffle/api|Assumption}}, {{Truffle|com/oracle/truffle/api/CompilerDirectives.CompilationFinal}}) </ins>to speed it up</div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>* Initial evaluation (that talked to a debugger) was slow - after weeks of struggling and help from Christian I finally learned enough about partial evaluation tricks to speed it up</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>* Debugger could only be attached when new {{Truffle|com/oracle/truffle/api/vm|PolyglotEngine}} <ins style="color: red; font-weight: bold; text-decoration: none;">evaluation </ins>was about to start - again, it needed Christian's new instrumentation API to fix that up</div></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>* Debugger could only be attached when new {{Truffle|com/oracle/truffle/api/vm|PolyglotEngine}} was about to start - again, it needed Christian's new instrumentation API to fix that up</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>These problems show the limits of [[design API as a service]] - designing an [[API]] worked, but making it fast required a lot of understanding of what happens under the cover.</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>These problems show the limits of [[design API as a service]] - designing an [[API]] worked, but making it fast required a lot of understanding of what happens under the cover.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
</table>JaroslavTulachhttp://wiki.apidesign.org/index.php?title=TwoYearsWithTruffle&diff=9200&oldid=prevJaroslavTulach: /* Polishing Interop */2017-08-02T11:31:59Z<p><span class="autocomment">Polishing Interop</span></p>
<table style="background-color: white; color:black;">
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr>
<td colspan='2' style="background-color: white; color:black;">←Older revision</td>
<td colspan='2' style="background-color: white; color:black;">Revision as of 11:31, 2 August 2017</td>
</tr>
<tr><td colspan="2" class="diff-lineno">Line 32:</td>
<td colspan="2" class="diff-lineno">Line 32:</td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>[[Image:Truffle-interop-polished.png|thumb|right|Simplified Interop API]]</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>[[Image:Truffle-interop-polished.png|thumb|right|Simplified Interop API]]</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div>[[I]] was so proud <del style="color: red; font-weight: bold; text-decoration: none;">of my result </del>that I even <del style="color: red; font-weight: bold; text-decoration: none;">talked about it </del>at a conference <del style="color: red; font-weight: bold; text-decoration: none;">speech</del>. Matthias was listening and <del style="color: red; font-weight: bold; text-decoration: none;">told me that he </del>felt ashamed. But there was no <del style="color: red; font-weight: bold; text-decoration: none;">need </del>- I <del style="color: red; font-weight: bold; text-decoration: none;">have </del>kept 99% of original Matthias code - I just <del style="color: red; font-weight: bold; text-decoration: none;">hide </del>it. [[API]] should <del style="color: red; font-weight: bold; text-decoration: none;">be like </del>a facade - <del style="color: red; font-weight: bold; text-decoration: none;">it </del>should hide the gory details of <del style="color: red; font-weight: bold; text-decoration: none;">implementation </del>in order to help users to stay [[clueless]] and still <del style="color: red; font-weight: bold; text-decoration: none;">be </del>productive. There is no need to be ashamed, we <del style="color: red; font-weight: bold; text-decoration: none;">should be </del>all <del style="color: red; font-weight: bold; text-decoration: none;">proud</del>.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div>[[I]] was so proud that I even <ins style="color: red; font-weight: bold; text-decoration: none;">presented my result </ins>at a conference. Matthias was listening <ins style="color: red; font-weight: bold; text-decoration: none;">to my speech </ins>and felt ashamed. But there was no <ins style="color: red; font-weight: bold; text-decoration: none;">reason </ins>- I <ins style="color: red; font-weight: bold; text-decoration: none;">had </ins>kept 99% of original Matthias code - I<ins style="color: red; font-weight: bold; text-decoration: none;">'d </ins>just <ins style="color: red; font-weight: bold; text-decoration: none;">hidden </ins>it. [[API]]<ins style="color: red; font-weight: bold; text-decoration: none;">s </ins>should <ins style="color: red; font-weight: bold; text-decoration: none;">act as </ins>a facade - <ins style="color: red; font-weight: bold; text-decoration: none;">they </ins>should hide the gory details of <ins style="color: red; font-weight: bold; text-decoration: none;">implementations </ins>in order to help users to stay [[clueless]] and still <ins style="color: red; font-weight: bold; text-decoration: none;">remain </ins>productive. There is no need to be ashamed, we all <ins style="color: red; font-weight: bold; text-decoration: none;">did good job (impl & [[API]] wise)</ins>.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'>-</td><td style="background: #ffa; color:black; font-size: smaller;"><div><del style="color: red; font-weight: bold; text-decoration: none;">Of course over </del>the next months we added more classes into the interop package to support exception handling, simplify writing of boiler plate code when resolving interop messages, etc. However it is always better to start with some smaller [[API]] and later expand it than trying to do it the opposite way.</div></td><td class='diff-marker'>+</td><td style="background: #cfc; color:black; font-size: smaller;"><div><ins style="color: red; font-weight: bold; text-decoration: none;">Over </ins>the next months we added more classes into the interop package to support exception handling, simplify writing of boiler plate code when resolving interop messages, etc. However it is always better to start with some smaller [[API]] and later expand it than trying to do it the opposite way.</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Debugger ==</div></td><td class='diff-marker'> </td><td style="background: #eee; color:black; font-size: smaller;"><div>== Debugger ==</div></td></tr>
</table>JaroslavTulach