翻蚳è ãã
ãæ¥çãå€ãããããåžå Žã§æé«ãããç»æçãªæè¡ããªã©ã®ç²Ÿç¥ã«åºã¥ããŠããã®èšäºã¯å€§äŒæ¥ã®ãã¬ãŒã³ããŒã·ã§ã³ã«äŒŒãŠããããšãããã«èŠåããããšæããŸããã³ã³ãã€ã©ãšä»®æ³ãã·ã³ã®æ°ããæè¡ã
ã¯ããã«
ã³ã³ãã¥ãŒã¿ãŒæ¥çã®å šçæãããå€ãã®äººãå®ç§ãªããã°ã©ãã³ã°èšèªãæ¢ãæ±ããããšã«æ ç±ãåŸããŠããŸããã ã¯ãšã¹ãã¯éåžžã«å°é£ã§ããæ°ããèšèªãäœæããããšã¯ç°¡åãªäœæ¥ã§ã¯ãããŸããã ãã®éçšã§éåžžã«é »ç¹ã«ãæ¢åã®ããã°ã©ãã³ã°ãšã³ã·ã¹ãã ãæçåãããæ°ããèšèªã®åºæ¬ããŒã«ãåæ§ç¯ããå¿ èŠããããŸãïŒã³ã³ãã€ã©ããããã¬ãHTTPã¹ã¿ãã¯ãIDEãã©ã€ãã©ãªãããã³ç¡éã®æ°ã®ããŒã¹ãããã¯ã¯ãæ°ããèšèªããšã«ãŒãããäœæãããŸãã ããã°ã©ãã³ã°èšèªã®èšèšã®åè¶æ§ã¯éæäžå¯èœã§ãããæ°ããã¢ã€ãã¢ãåžžã«åºçŸããŠããŸãã ç§ãã¡ã¯ã·ã·ã¥ãã¹ã®ããã«èŠããŸãïŒç¥ã«ãã£ãŠæ°žé ã«ç³ãäžãåã«æŒãåºãããã«å®£åãããæçµçã«ãããäœåºŠãäœåºŠã転ããã®ãèŠãããã«...
ã©ãããã°ãã®æªåŸªç°ãæã¡åãããšãã§ããŸããïŒ ç§ãã¡ãæããã®ã倢èŠãŠã¿ãŸãããã
äœããç§ãã¡ã次ã®ããšãè¡ããããã«ããç¹å¥ãªããŒã«ãå¿ èŠã§ãã
- ããã1é±éã§æ°ããèšèªãäœæããæ¹æ³
- ãããŠãä»ã®èšèªãšåããããéãèªåçã«åäœããããã«
- ãã®ãããé«å質ã®ãããã¬ãŒãèªåçã«ïŒçæ³çã«ã¯ãããã°ã©ã ã®é床ãèœãšãããšãªãïŒãµããŒãããŠããŸãã
- ãµããŒãã®èªåãããã¡ã€ãªã³ã°
- é«å質ã®ã¬ããŒãžã³ã¬ã¯ã¿ãŒãèªåçã«æã€...å¿ èŠãªå Žåã®ã¿
- èšèªã¯ããããäœã§æžãããŠããŠããæ¢åã®ãã¹ãŠã®ã³ãŒãã䜿çšã§ããããã«ãããã
- äœã¬ãã«ã®CãŸãã¯FORTRANããJavaãHaskellãããã³PythonãRubyãªã©ã®å®å
šã«åçãªã¹ã¯ãªããèšèªãŸã§ãããããããã°ã©ãã³ã°ã¹ã¿ã€ã«ããµããŒãããèšèªã
ãžã£ã¹ãã€ã³ã¿ã€ã ããã³äºåã®ã³ã³ãã€ã«ããµããŒãããã«ã¯ - ãããŠæåŸã«ããã§ã«å®è¡äžã®ããã°ã©ã ã§ãããã¹ã¯ããã³ãŒãããµããŒãããŸãã
ãããããã¡ããããã®éæ³ã®ããŒã«ã®ãªãŒãã³ãœãŒã¹ã³ãŒããå¿ èŠã§ãã ãããŠããããŒãããŸãããã ãã¹ãŠã®ããã§ãã
ãã¡ãããè³¢ãèªè ã¯ããã®ãããªããŒã«ãæã£ãŠããªããã°ãã®èšäºãå§ããªããšæããŸããã 圌ã®ååã¯å°ãå¥åŠã§ã-GraalïŒTruffleã ãããŠããã®ååã倧ãããªæµè¡ã«ææãªã¬ã¹ãã©ã³ã§ããå¯èœæ§ãé«ãå Žåã§ããå®éã«ã¯ãITæ¥çãšå€§åŠã®40人以äžã®ç§åŠè ãåå ããéèŠãªç 究ãããžã§ã¯ãã§ãã äžç·ã«ãªã£ãŠããªã¹ãã«ãããã¹ãŠã®ã¢ã€ãã ãå®è£ ããã³ã³ãã€ã©ãŒãšä»®æ³ãã·ã³çšã®æ°ãããã¯ãããžãŒãæ§ç¯ããŸãã
圌ãã¯ãã³ã³ãã€ã©ãŒããããã¬ãŒããããã¡ã€ã©ãŒãCã©ã€ãã©ãªãŒãžã®ãã€ã³ãã£ã³ã°ãããã³çŸä»£ã®ããã°ã©ãã³ã°èšèªã«å¿ èŠãªä»ã®å±æ§ãæé©åããã©ã€ãã©ãªãŒã§åé¡ãªãããã°ã©ãã³ã°èšèªãè¿ éã«äœæããæ°ããæ¹æ³ãçºæããŸããã ãã®ããŒã«ã¯ãããã°ã©ãã³ã°èšèªã®æ°ããã€ãããŒã·ã§ã³ã®æ³¢ãåŒãèµ·ããããšãçŽæããITæ¥çå šäœãåãã©ãŒãããããããšãé¡ã£ãŠããŸãã
ããã«ã€ããŠã話ããŸãã
Graal and Truffleãšã¯äœã§ããïŒ
Graalã¯ç 究ã³ã³ãã€ã©ã§ãã ãããŠãããªã¥ãã¯...ããã¯äœãšãæ¯èŒããã®ãé£ãããããªãã®ã§ãã èŠããã«ã次ã®ããšãæãæµ®ãã³ãŸããããªã¥ãã¯ãæœè±¡æ§æããªãŒã®ã€ã³ã¿ãŒããªã¿ãŒãäœæããããšã«ãããããã°ã©ãã³ã°èšèªãäœæããããã®ãã¬ãŒã ã¯ãŒã¯ã§ãã
æ°ããããã°ã©ãã³ã°èšèªãäœæããå Žåãæåã«ããããšã¯ææ³ã決å®ããããšã§ãã ææ³ã¯ãèšèªã®æ§æèŠåã®èª¬æã§ãã ææ³ãšANTLRã®ãããªããŒã«ã䜿çšããŠãããŒãµãŒãååŸããŸãã ããŒãµãŒã®åºåã«ã¯ã解æããªãŒããããŸã
ãã®å³ã¯ã次ã®ã³ãŒãè¡ã«å¯ŸããŠANTLRãå®è¡ããåŸã«ååŸããããªãŒã瀺ããŠããŸãã
Abishek AND (country = India OR City = BLR) LOGIN 404 | show name
æ§æ解æããªãŒãšæœè±¡æ§æããªãŒ ïŒASTïŒãšåŒã°ãããã®æŽŸçæ§æäœã¯ãããã°ã©ã ãè¡šçŸããèªç¶ãªæ¹æ³ã§ãã ãã®ãããªããªãŒãæ§ç¯ããåŸãäœæ¥ããã°ã©ã ãžã®1ã€ã®ç°¡åãªã¹ãããããããŸãã ããªãŒããŒãã¯ã©ã¹ã«ãå®è¡ãã¡ãœãããè¿œå ããå¿ èŠããããŸãã åããŒãã¯ããå®è¡ããå®è¡ãããšãã«ãåããŒããåŒã³åºããçµæãçµã¿åãããŠåŒã®å€ãååŸããããåœä»€ãå®è¡ãããã§ããŸãã ãããŠãååãšããŠãããã ãã§ãïŒ
PythonãJavaScriptãPHPãRubyãªã©ã®åçããã°ã©ãã³ã°èšèªãäŸãšããŠåãäžããŸãã ãããã®èšèªã®ãã€ãããºã ã¯ãæµæãæãå°ãªãçµè·¯ã«æ²¿ã£ãŠç§»åããçµæã§ããã èšèªããŒãããäœæããå Žåããã®èšèªãéçåã·ã¹ãã ãŸãã¯æé©åã³ã³ãã€ã©ã§è€éåãããšãèšèªéçºãå€§å¹ ã«é ããªãå¯èœæ§ããããŸãã ãã®éžæã®çµæãããã©ãŒãã³ã¹ãäœäžããŸãã ããããããã«æªãããšã«ãASTã·ã³ãã«/ã¹ããŒã€ã³ã¿ãŒããªã¿ãŒã«æ©èœããã°ããè¿œå ããã®ã¯é åçã§ãã çµå±ããããã®æ©èœã®ããã©ãŒãã³ã¹ãåŸã§æé©åããããšã¯éåžžã«å°é£ã§ãã
Truffleã¯ã泚éãšå°éã®è¿œå ã³ãŒãã䜿çšããŠã€ã³ã¿ãŒããªã¿ãŒãäœæããããã®ãã¬ãŒã ã¯ãŒã¯ã§ãã Graalãšãã¢ã«ãªã£ãããªã¥ãã¯ããã®ãããªã€ã³ã¿ãŒããªã¿ãŒãJITã³ã³ãã€ã«ä»®æ³ãã·ã³ïŒVMïŒã«èªåçã«å€æããããšãå¯èœã«ããŸãã ããã©ãŒãã³ã¹ã®ããŒã¯æã«åŸãããã©ã³ã¿ã€ã ã¯ãæ¢åã®æé«ã®ã³ã³ãã€ã©ãŒïŒç¹å®ã®èšèªã«æåã§æ§æããã調æŽãããïŒãšç«¶åããå¯èœæ§ããããŸãã ããšãã°ããã®ããã«TruffleJSãšããååã§ååŸãããJavaScriptå®è£ ã¯ãããã©ãŒãã³ã¹ãã¹ãã§V8ãšç«¶åã§ããŸãã
RubyTruffleãšã³ãžã³ã¯ãä»ã®ãã¹ãŠã®Rubyå®è£ ãããé«éã§ãã TruffleCãšã³ãžã³ã¯ãããããGCCãšç«¶åããŠããŸãã Truffleã䜿çšããããã€ãã®èšèªïŒæºåã®çšåºŠã¯ããŸããŸïŒã®å®è£ ã¯ãã§ã«ãããŸãã
- Javascript
- Python 3
- ã«ããŒ
- LLVMãããã³ãŒã-C / C ++ / Objective-C / Swiftã§ããã°ã©ã ãå®è¡ã§ããŸã
- LLVMã§ã³ã³ãã€ã«ããã«CãœãŒã¹ã³ãŒãã解éããããã®å¥ã®ãšã³ãžã³ïŒä»¥äžã®ãã®ã¢ãããŒãã®å©ç¹ããèªã¿ãã ããïŒ
- R
- Smalltalk
- ã«ã¢
- å€ãã®å°ããªå®éšèšèª
ãããã®ãšã³ãžã³ãç°¡åã«äœæã§ããããšãç解ããããããããã«ãTruffleJSã®ãœãŒã¹ã³ãŒãã¯ãV8ã®170äžè¡ã®ã³ãŒããšæ¯èŒããŠãçŽ80,000è¡ããå¿ èŠãšããŸããã
詳现ã説æããããã«ãããããã¹ãŠãã©ã®ããã«ãã¬ã€ããã°ããã§ããïŒ
GraalãšTruffleã¯ãä»®æ³ãã·ã³ã®ç 究ã«åãçµãã§ããJavaããŒã ã®äžéšã§ããOracle Labsã®ææã§ãã GraalVMã¯ãã¡ãã§ãã ããã¯é«åºŠãªJavaéçºãããã§ãããäžèšã®ãªã¹ãã®äžéšã®èšèªãããã³NodeJSãRubyãRã®ã³ã³ãœãŒã«ä»£æ¿ãå«ãŸããŠããŸããé ä¿¡ã«ã¯ãGraalãšTruffleã«æ £ããããã®æè²çšããã°ã©ãã³ã°èšèªãSimpleLanguageããå«ãŸããŠããŸãã
Graalã®ç®çã¯äœã§ããïŒ
TruffleãASTã€ã³ã¿ãŒããªã¿ãŒãäœæããããã®ãã¬ãŒã ã¯ãŒã¯ã§ããå ŽåãGraalã¯ãã®ãããªã€ã³ã¿ãŒããªã¿ãŒãå éããããã®ãã®ã§ãã Graalã¯ãã³ã³ãã€ã©ãæé©åããåéã®èžè¡äœåã§ãã 次ã®æ©èœããµããŒãããŠããŸãã
- ãžã£ã¹ãã€ã³ã¿ã€ã ããã³äºåæéã¢ãŒãã§èµ·åã§ããŸã
- éšåçãªãšã¹ã±ãŒãåæãå«ãéåžžã«é«åºŠãªæé©åã ãšã¹ã±ãŒãåæã¯ããããæ¬è³ªçã«äžèŠãªå ŽåãããŒãäžã®ãªããžã§ã¯ãã®å²ãåœãŠãåé¿ããŸãã EAã®äººæ°ã¯JVMã®éçºã«ãããã®ã§ããããã®æé©åã¯éåžžã«è€éã§ãããå°æ°ã®ä»®æ³ãã·ã³ããµããŒããããŠããŸãã Chromeãã©ãŠã¶ã§äœ¿çšããããã¿ãŒããã¡ã³ãJavaScriptã³ã³ãã€ã©ã¯ã2015幎æ«ã«ã®ã¿ãšã¹ã±ãŒãåæã®æé©åãéå§ããŸããã Graalã«ã¯ãããåºç¯ãªã±ãŒã¹ã«å¯Ÿå¿ããé«åºŠãªæé©åæ©èœããããŸãã
- TruffleããŒã¹ã®èšèªãšé£æºããŠåäœãã éšåèšç®ã«ããTruffle ASTãæé©åããããã€ãã£ãã³ãŒãã«å€æã§ããŸãã ç¹æ®ãªã€ã³ã¿ãŒããªã¿ãŒã®éšåèšç®ã¯ã ãæåã®äºæãããžã§ã¯ã·ã§ã³ããšåŒã°ããŸãã [Wikipediaããç解ããŠããããã«ãFutamuraã®æåã®ãããžã§ã¯ã·ã§ã³ã§ã¯ããœãŒã¹ã³ãŒãã«åãããŠã€ã³ã¿ãŒããªã¿ãŒãã«ã¹ã¿ãã€ãºã§ããŸãã ã€ãŸããèšèªã®äžéšã®æ©èœãã³ãŒãã§äœ¿çšãããŠããªãå Žåããããã®æ©èœã¯ã€ã³ã¿ãŒããªã¿ãŒãããã«ããã¢ãŠãããããŸãã ãããŠãã€ã³ã¿ããªã¿ã¯ãã€ãã£ãã³ãŒããçæããã³ã³ãã€ã©ã«ãå€ãããŸããã 倱æããå Žåã¯ä¿®æ£ããŸãã]
- é«åºŠãªèŠèŠåããŒã«ãå«ãŸããŠãããæé©åã®å段éã§ã³ã³ãã€ã©ãŒã®äžéè¡šçŸã調ã¹ãããšãã§ããŸãã
- Javaã§æžãããŠããŸãã ããã¯ãCãŸãã¯C ++ã§èšè¿°ãããåŸæ¥ã®ã³ã³ãã€ã©ãããç 究ããã³å®éšãã¯ããã«ç°¡åã§ããããšãæå³ããŸãã
- Java 9以éãGraalã¯JVMãã©ã°ã€ã³ãšããŠäœ¿çšã§ããŸãã
IGVã®èŠèŠå
Graalã¯æåããå€èšèªã³ã³ãã€ã©ãšããŠèšèšãããŸããã ãããããã®æé©åã¯ãæœè±¡åãšãã€ãããºã ã®é«ã¬ãã«èšèªã«ç¹ã«é©ããŠããŸãã Javaããã°ã©ã ã¯ãæ¢åã®JVMã³ã³ãã€ã©ãšåãæ¹æ³ã§ãã®ä»®æ³ãã·ã³ã§åäœããŸãã äžæ¹ãScalaããã°ã©ã ã®å®è¡é床ã¯çŽ20ïŒ é«éã§ãã Rubyããã°ã©ã ã¯ããããŸã§ã®æè¯ã®å®è£ ããã400ïŒ å¢å ããŸãïŒããã¯MRIã§ã¯ãããŸããïŒã
ããªã°ããã
ãŸã ç²ããŠããŸãããïŒ ããããããã¯ã»ãã®å§ãŸãã«éããŸããã
ããªã¥ãã«ã¯ããããªã°ãããããšåŒã°ããèšèªéçžäºäœçšã®ããã®ç¹å¥ãªãã¬ãŒã ã¯ãŒã¯ãå«ãŸããŠããŸãã ããã«ãããTruffleèšèªãçžäºã«åŒã³åºãããšãã§ããŸãã Truffle Object Storage ModelããããŸããããã¯ãåçã«åä»ããããèšèªã®ãªããžã§ã¯ãã®åäœã®ã»ãšãã©ãæšæºåããã³æé©åããŸãã ãããŠåæã«ããã®ãããªãªããžã§ã¯ããå ±æããããšãã§ããŸãã GraalãšTruffleã¯Javaãã¯ãããžãŒäžã«æ§ç¯ãããŠãããJavaãScalaãããã«ã¯Kotlinãªã©ã®JVMèšèªãšéä¿¡ã§ããããšãå¿ããªãã§ãã ããã ããã«ããã®éä¿¡ã¯åæ¹åã§ããGraal-Truffleã³ãŒãã¯Javaã©ã€ãã©ãªãåŒã³åºãããšãã§ããJavaã³ãŒãã¯Graal-Truffleã©ã€ãã©ãªãåŒã³åºãããšãã§ããŸãã
ããªã°ãããã¯éåžžã«çããæ¹æ³ã§åäœããŸãã èŠããŠãããããããŸããããTruffleã¯æœè±¡æ§æããªãŒïŒASTïŒã®ããŒããèšè¿°ããããã®ãã¬ãŒã ã¯ãŒã¯ã§ãã ãã®çµæãä»ã®èšèªãžã®ã¢ã¯ã»ã¹ã¯ãæœè±¡åãšã©ãããŒã®è¿œå ã¬ã€ã€ãŒãä»ããŠã§ã¯ãªãã2ã€ã®ASTããªãŒã1ã€ã«ããŒãžããããšã«ããçºçããŸãã ãã®çµæãçµæã®æ§æããªãŒã¯ãGraalå šäœã§ã³ã³ãã€ã«ïŒããã³æé©åïŒãããŸãã ããã¯ã2ã€ã®ããã°ã©ãã³ã°èšèªã®æ¥ç¹ã§çºçããå¯èœæ§ã®ããåé¡ãåæããç°¡çŽ åã§ããããšãæå³ããŸãã
ãã®ãããç 究è ãã¡ã¯Truffleãä»ããŠCã€ã³ã¿ãŒããªã¿ãŒãå®è£ ããããšã«ããŸããã éåžžãCã¯ã³ã³ãã€ã«ãããèšèªãšããŠèªèãããŸãã ããããããã«ã¯æ¬åœã®çç±ã¯ãããŸããã æŽå²ã¯ãCã€ã³ã¿ããªã¿ãå®éã®ããã°ã©ã ã§äœ¿çšãããå Žåãç¥ã£ãŠããŸãã ããšãã°ã Shakeç¹æ®å¹æãããªãšãã£ã¿ãŒã䜿çšãããšããŠãŒã¶ãŒã¯Cã§ã¹ã¯ãªãããäœæã§ããŸãã
ã¹ã¯ãªããèšèªã®ããã©ãŒãã³ã¹ã«é¢ããæ¢ç¥ã®åé¡ã«ãããããã°ã©ã ã®éèŠãªã»ã¯ã·ã§ã³ã¯å éšã€ã³ã¿ãŒããªã¿ãŒAPIã䜿çšããŠCã§æžãæããããããšããããããŸãã ãã®çµæããã®ã¢ãããŒãã§ã¯ãã€ã³ã¿ãŒããªã¿ãŒèªäœã«å ããŠCã§æ¡åŒµæ©èœãå®è¡ããå¿ èŠããããããèšèªãé«éåããã¿ã¹ã¯ãå€§å¹ ã«è€éã«ãªããŸãããããã®æ¡åŒµæ©èœã¯èšèªã®å éšå®è£ ã«é¢ããåæã«åºã¥ããŠãããããã°ããŒãã«æé©åã®ã¿ã¹ã¯ã¯è€éã§ãã
RubyTruffleã®äœè ããã®åé¡ã«åºãããããšãã圌ãã¯ãšã¬ã¬ã³ããªãœãªã¥ãŒã·ã§ã³ãæãä»ããŸãããåçŽãªCã ãã§ãªãããã¯ããRubyæ¡åŒµã«åºæã®ãã®ä»ã®æ§æãç解ã§ããç¹å¥ãªCã€ã³ã¿ãŒããªã¿ãŒãäœæããŸãããã 次ã«ãTruffleãä»ããŠRubyã€ã³ã¿ãŒããªã¿ãŒãšCã€ã³ã¿ãŒããªã¿ãŒãããŒãžãããšãåäžã®ã³ãŒããååŸãããèšèªéã®éä¿¡ã®ã³ã¹ãã¯ãªããã£ãã€ã¶ãŒã«ãã£ãŠå¹³æºåãããŸãã çµæã¯TriffleCã§ãã
ãã®ãããžã§ã¯ãã®ç 究è ã®1人ã§ããChris Seatonã®èšäºã§ããã®ãã¹ãŠãã©ã®ããã«æ©èœãããã«ã€ããŠã®çŽ æŽããã説æãèªãããšãã§ããŸãã ãŸãã¯ã詳现ãªèª¬æãå«ãç§åŠèšäºãåŠç¿ã§ããŸãã
Cã§å®å šãªã¡ã¢ãªç®¡çãããŸããã
Cããã°ã©ã ã¯é«éã§å®è¡ãããŸãã ããããã³ã€ã³ã«ã¯è£è¿ãããããŸããããã«ãŒã¯ããããéåžžã«å¥œãã§ããŸãããªããªããèšæ¶ãæäœããŠãããšãã«è¶³ã§èªåãæã€ã®ã¯ç°¡åãããããã§ãã
ManagedCã¯TruffleCã®ç¶ããšããŠç»å Žããæšæºã®ã¡ã¢ãªç®¡çãã¬ããŒãžã³ã¬ã¯ã¿ãŒã§å¶åŸ¡ãããå²ãåœãŠã«çœ®ãæããŸããã ManagedCã¯ãå€æ°ã®ãšã©ãŒãåé¿ããªããããã€ã³ã¿ãŒæŒç®ããã³ãã®ä»ã®äœã¬ãã«ã®æ§é ããµããŒãããŸãã ä¿¡é Œæ§ã®ä»£äŸ¡ã¯ãGCCãšæ¯èŒããŠããã©ãŒãã³ã¹ã15ïŒ äœäžããããšãããã³å€ãã®Cã³ã³ãã€ã©ã倧ãã«æãããäžå®ã®åäœãã®ç©æ¥µçãªäœ¿çšã§ããããã¯ãããã°ã©ã ãGCCã§åäœããå ŽåãManagedCã§å®è¡ãããããšãä¿èšŒããªãããšãæå³ããŸã åæã«ãManagedCèªäœãC99æšæºãå®å šã«å®è£ ããŠããŸãã
詳现ã«ã€ããŠã¯ãèšäºãJava VMã§ã®Cã®ã¡ã¢ãªã»ãŒããªå®è¡ããåç §ããŠãã ããã
æ¯åã®ãããã°ãšãããã¡ã€ãªã³ã°
ããã°ã©ãã³ã°èšèªã®ãã¹ãŠã®éçºè ã¯ãå質ã®é«ãããŒã«ãäžè¶³ããŠãããšããåé¡ã«çŽé¢ããŠããŸãã äŸãšããŠGoLangãåãäžããŸãã GoLangãšã³ã·ã¹ãã ã¯ãé·å¹Žã貧匱ã§åå§çã§ç§»æ€æ§ã®äœããããã¬ãŒãšãããã¡ã€ã©ãŒã«æ©ãŸãããŠããŸããã
å¥ã®åé¡ã¯ãã€ã³ã¿ãŒããªã¿ãŒã«ãããã¬ãŒã®ãµããŒããè¿œå ããããšã§ãã ã€ãŸããä»®æ³ãã·ã³ã®çŸåšã®ç¶æ ãšéçºè ãäœæããã³ãŒããšã®1察1ã®å¯Ÿå¿ã確ç«ã§ããããã«ããã€ãã£ãã³ãŒãã¯ãœãŒã¹ã³ãŒãã«è¿ãå¿ èŠããããŸãã éåžžãããã«ãããã³ã³ãã€ã©ãŒã®æé©åãæåŠããããããã°ãå šè¬çã«é ããªããŸãã
ãããŠãããã§Truffleãå©ãã«ãªããŸããããã¯ãããã°ã©ã ãé ãããããšãªããé«åºŠãªãããã¬ãŒãã€ã³ã¿ãŒããªã¿ãŒã«çµã¿èŸŒãããšãã§ããã·ã³ãã«ãªAPIãæäŸããŸãã ã³ã³ãã€ã©ãŒã¯åŒãç¶ãæé©åãé©çšãããããã°äžã®ããã°ã©ã ã®ç¶æ ã¯ããã°ã©ããŒãæåŸ ãããã®ãšåããŸãŸã§ãã GraalãšTruffleããã€ãã£ãã³ãŒãã«ã³ã³ãã€ã«ãããšãã«çæããã¡ã¿ããŒã¿ã®ãããã§ãã 次ã«ãååŸããã¡ã¿ããŒã¿ã䜿çšããŠãå®è¡äžã®ããã°ã©ã ã®äžéšã®æé©åã解é€ã ãã€ã³ã¿ãŒããªã¿ãŒã®åæç¶æ ãååŸããŸãã ãã¬ãŒã¯ãã€ã³ãããŠã©ãããã€ã³ãããããã¡ã€ãªã³ã°ãã€ã³ãããŸãã¯ãã®ä»ã®ãããã°ã¡ã«ããºã ã䜿çšããå Žåãä»®æ³ãã·ã³ã¯ããã°ã©ã ãã¹ããŒãã©ãŒã ã«ããŒã«ããã¯ããASTã«ããŒããè¿œå ããŠå¿ èŠãªæ©èœãå®è£ ãããã¹ãŠããã€ãã£ãã³ãŒãã«åã³ã³ãã€ã«ããŸãããã®å Žã§äº€æã
ãã¡ããããããã¬ã¯ã©ã³ã¿ã€ã ã®æ©èœã ãã§ã¯ãããŸããã ãŠãŒã¶ãŒã®ããã«ããã«UIãå¿ èŠã§ãã ãã®ãããTruffleèšèªããµããŒãããNetBeans IDEã®ãã©ã°ã€ã³ããããŸã ã
詳现ã«ã€ããŠã¯ãèšäºããããã¬ãŒããã³ãã®ä»ã®ããŒã«ã®æ§ç¯ïŒãã¹ãŠãçšæã§ããŸãããã芧ãã ããã
LLVMãµããŒã
ããªã¥ãã¯äž»ã«ãœãŒã¹ã³ãŒãã€ã³ã¿ãŒããªã¿ãŒã®äœæã«äœ¿çšãããŸãã ãããããã®ãã¬ãŒã ã¯ãŒã¯ãä»ã®ç®çã«äœ¿çšããããšã劚ãããã®ã¯ãããŸããã Sulongãããžã§ã¯ãã¯ãLLVMãã€ãã³ãŒãçšã®ããªã¥ãã€ã³ã¿ãŒããªã¿ãŒã§ãã
Sulongãããžã§ã¯ãã¯ãŸã éçºã®åæ段éã«ãããå€ãã®å¶éãå«ãŸããŠããŸãã ããããçè«çã«ã¯ãGraalãšTruffleã䜿çšããŠãã€ãã³ãŒããèµ·åãããšãCã ãã§ãªããC ++ãObjective-CãFORTRANãSwiftãããã«ã¯Rustã䜿çšããããšãã§ããŸãã
Sulongã«ã¯ã Polyglotãä»ããŠä»ã®Truffleèšèªãšå¯Ÿè©±ããããã®ã·ã³ãã«ãªC APIãå«ãŸããŠããŸã ã ç¹°ãè¿ããŸãããããã°ã©ãã³ã°èšèªã®ç¬ç«æ§ãšãã®APIã®å®å šã«åçãªæ§è³ªã«ãããçµæã®ã³ãŒãã¯ç©æ¥µçã«æé©åããããªãŒããŒãããã¯æå°éã«æããããŸãã
ãããã¹ã¯ããïŒHotSwapïŒ
ãããã¹ã¯ãããšã¯ãæäœäžã«åèµ·åããã«ããã°ã©ã ã³ãŒãã眮ãæããæ©èœã§ãã ããã¯ãåçããã°ã©ãã³ã°èšèªã®äž»ãªå©ç¹ã®1ã€ã§ãããããã°ã©ãã®é«ãçç£æ§ãå®çŸã§ããŸãã Truffleãã¬ãŒã ã¯ãŒã¯ã§ã®ãããã¹ã¯ããã®å®è£ ã«é¢ããç§åŠèšäºããããŸãïŒTruffleèªäœã«ãµããŒããæ¢ã«è¿œå ãããŠãããã©ããã¯ããããŸããïŒã ãããã¬ãŒããããã¡ã€ã©ãŒãããã³ãªããã£ãã€ã¶ãŒãšåæ§ã«ãTruffleèšèªã®éçºè ã¯ããããã¹ã¯ããããµããŒãããããã«æ°ããAPIã䜿çšããã ãã§ãã ãã®APIã¯ãç¬èªã®èªè»¢è»ãããã¯ããã«äŸ¿å©ã§ãã
ãã£ããã¯ã©ãã§ããïŒ
ãåç¥ã®ããã«ã人çã«ã¯å®ç§ãªãã®ã¯äœããããŸããã GraalãšTruffleã¯ãæåã®ãªã¹ãã«ããã»ãšãã©ãã¹ãŠã®ãŠã£ãã·ã¥ãªã¹ãã«ãœãªã¥ãŒã·ã§ã³ãæäŸããŸãã ããã°ã©ãã³ã°èšèªã®éçºè ã¯å¹žãã§ãªããã°ãªããŸããã ãããããã®ãããªå©äŸ¿æ§ã«ã¯ä»£åããããŸãã
- ãŠã©ãŒã ã¢ããæé
- ã¡ã¢ãªæ¶è²»
ã€ã³ã¿ãŒããªã¿ãŒãæé©åããããã€ãã£ãã³ãŒãã«å€æããããã»ã¹ã§ã¯ãå®éã®æ¡ä»¶ã§ããã°ã©ã ãã©ã®ããã«æ©èœãããã調ã¹ãå¿ èŠããããŸãã ãã¡ãããããã¯ãã¥ãŒã¹ã§ã¯ãããŸããã ãŠã©ãŒã ã¢ããïŒäœæ¥äžã®å éïŒãšããçšèªã¯ãHotSpotãV8ãªã©ã®ææ°ã®ä»®æ³ãã·ã³ã䜿çšãããã¹ãŠã®äººã«ç¥ãããŠããŸãã ããããGraalã¯ããã§ãé²æ©ãæšé²ããŠããããããã¡ã€ãªã³ã°ããŒã¹ã®æé©åãããé«ãã¬ãã«ã«åŒãäžããŠããŸãã ãã®çµæãGraalVMã¯ãããã¡ã€ãªã³ã°æ å ±ã«å€§ããäŸåããŠããŸãã
ãã®ãããç 究è ã¯ããŒã¯ããã©ãŒãã³ã¹ã®ã¿ã枬å®ããŸããã€ãŸããããã°ã©ã ããã°ããåäœãããŸãã ããã¯ããã®ãããªãŠã©ãŒã ã¢ããã«å¿ èŠãªæéãèæ ®ããŠããŸããã ãµãŒããŒã¢ããªã±ãŒã·ã§ã³ã®å Žåãããã¯å€§ããªåé¡ã§ã¯ãããŸããããã®é åã§ã¯ããŒã¯ããã©ãŒãã³ã¹ã®ã¿ãéèŠã ããã§ãã ããããä»ã®ã¢ããªã±ãŒã·ã§ã³ã§ã¯ãé·æéã®ãŠã©ãŒã ã¢ããã«ããGraalã®äœ¿çšãçµäºããå¯èœæ§ããããŸãã å®éã«ã¯ããã®åçã¯Octaneããã©ãŒãã³ã¹ãã¹ãã§äœæ¥ããŠãããšãã«èŠãããšãã§ããŸãïŒJDKãã¯ãã«ã«ãã¬ãã¥ãŒã§ç¢ºèªã§ããŸãïŒïŒæçµã¹ã³ã¢ã¯Chromeã®ã¹ã³ã¢ããããããã«äœããæçµçã«ã¯èæ ®ãããªãããªãé·ãGraalãŠã©ãŒã ã¢ããïŒ15-60ç§ïŒãèæ ®ããŸãè©äŸ¡ã
2çªç®ã®åé¡ïŒã¡ã¢ãªæ¶è²»ã ããã°ã©ã ãææ©çæé©åã«å€§ããäŸåããŠããå Žåãæé©å解é€ã®ããã«ã³ã³ãã€ã©ã®ã¡ã¿æ å ±ãå«ãããŒãã«ãä¿åããå¿ èŠããããŸããããã¯ããã·ã³ã®ç¶æ ããæœè±¡ã€ã³ã¿ãŒããªã¿ãŒãžã®éå€æã§ãã ãããŠããã®ã¡ã¿æ å ±ã¯ããã¹ãŠã®ã·ãŒã«ãšå§çž®ãèæ ®ã«å ¥ããŠããæçµçãªã³ãŒããšåããããã®ã¹ããŒã¹ãåããŸãã ãã€ãã£ãã³ãŒãã§ãã¥ãŒãªã¹ãã£ãã¯ãªä»®å®ã«éåããå Žåã«ãå ã®ASTãŸãã¯ãã€ãã³ãŒããä¿åããå¿ èŠãããããšãå¿ããªãã§ãã ããã ããã¯ãã¹ãŠå®¹èµŠãªãRAMãæ··ä¹±ãããŸãã
ããã«å ããŠãGraalãTruffleãããã³TruffleããŒã¹ã®èšèªèªäœãJavaã§äœæãããŠããŸãã ããã¯ãã³ã³ãã€ã©ãŒããŠã©ãŒã ã¢ãããå®å šã«æ©èœããããã«æéãå¿ èŠã§ããããšãæå³ããŸãã ãããŠãã¡ãããåºæ¬çãªããŒã¿æ§é ã®ã¡ã¢ãªæ¶è²»éã¯å¢å ãããããã®åºæ¬çãªã³ã³ãã€ã©æ§é ã¯ã¬ããŒãžã³ã¬ã¯ã·ã§ã³ã«åé¡ãããŸãã
ãã¡ãããGraalãšTruffleã®èåŸã«ãã人ã ã¯ããããã®åé¡ãèªèããŠããããã§ã«è§£æ±ºçãæ€èšããŠããŸãã ãããã®1ã€ã¯SubstrateVMãšåŒã°ããŸãã ããã¯å®å šã«Javaã§èšè¿°ãããé©åãªGraalããã³Truffleã³ã³ãã€ã©ã䜿çšããŠäºåã«ïŒäºåã«ïŒã³ã³ãã€ã«ãããä»®æ³ãã·ã³ã§ãã æ©èœçã«ã¯ãSubstrateVMã¯HotSpotã»ã©é«åºŠã§ã¯ãããŸãããã€ã³ã¿ãŒãããããã³ãŒããåçã«èªã¿èŸŒãããšãã§ãããã¬ããŒãžã³ã¬ã¯ã¿ãŒã¯éåžžã«åçŽã§ãã ãããããã®ä»®æ³ãã·ã³ãäžåºŠã³ã³ãã€ã«ãããšãå°æ¥ã®ãŠã©ãŒã ã¢ããæéãå€§å¹ ã«ç¯çŽã§ããŸãã
ãããŠãããäžã€ã®ç¹çŽ°ãã¯æ²é»ãä¿ã€ããšãã§ããŸããã ãŠã£ãã·ã¥ãªã¹ãã®æåã®ãªã¹ãã«ã¯ããœãŒã¹ã³ãŒãã®å ¬éæ§ã«é¢ããé ç®ããããŸãã GraalãšTrulleã¯ãçµéšè±å¯ãªäººã ã«ãã£ãŠæžããã倧èŠæš¡ã§éåžžã«é«äŸ¡ãªãããžã§ã¯ãã§ãã ãããã£ãŠããããã®éçºãå®äŸ¡ã«ããããšã¯ã§ããŸããã ãããŸã§ã®ãšããã説æãããŠãããã®ã®äžéšã®ã¿ããªãŒãã³ãœãŒã¹ã§é åžãããŠããŸãã
ãã¹ãŠã®ã³ãŒãã¯GitHubãŸãã¯ä»ã®ãã©ãŒã«ãããŸãã
- ã°ã©ãŒã« ïŒ ããªã¥ã ã
- HotSpotã®æ¡åŒµå¯èœãªããŒãžã§ã³ïŒãããžã§ã¯ãã®åºç€ïŒã
- RubyTruffle
- Sulong ïŒLLVMãããã³ãŒãã®ãµããŒãïŒ
- R ãPython 3ãããã³Luaã®å®è£ ïŒè¶£å³/ç 究ãããžã§ã¯ããšããŠäœæããããã®ããããŸãïŒã
ãããŠã次ã®éšåã¯ãªãŒãã³ãœãŒã¹ãšã¯é¢ä¿ãããŸãã
- TruffleC / ManagedC
- TruffleJS / NodeJS API
- SubstrateVM
- AOTãµããŒã
TruffleJSã¯ãGraalVMãã¬ãã¥ãŒãªãªãŒã¹ã®äžéšãšããŠç¡æã§ããŠã³ããŒãã§ããŸãã TruffleCãŸãã¯ManagedCã§éã¶æ¹æ³ãããããŸããã Sulongãããžã§ã¯ãã¯ããã®æ©èœã®äžéšã§ã«ããŒãããŠããŸãã
äœãèªã
ãã®è¬æŒã®GraalãšTruffleå šäœã«ãããæšæºçã§æ¬æ ŒçãªãªãŒã«ã€ã³ã¯ã³ãã¥ãŒããªã¢ã«ïŒ ã1ã€ã®VMã§ãã¹ãŠãæ¯é ãã1ã€ã®VMã§ãããããã€ã³ãããŸã ã ã 圌ã¯3æéæ©ããŠããŸããç§ã¯ããªãã«èŠåããŸããã çã®æ奜家ã®ã¿ã
Truffleã®äœ¿çšã«é¢ãããã¥ãŒããªã¢ã«ããããŸãã
次ã¯ïŒ
æåã«ãæ°ããããã°ã©ãã³ã°èšèªãäœæããéã®éå£ãåãé€ãããšãã§ãããšè¿°ã¹ãŸããã ããã«ãããèšèªã®é©æ°ã®æ°ããæ³¢ãžã®æãéãããŸãã ããã«å®éšèšèªã®çããªã¹ãããããŸã ã ãã®ãªã¹ããå°æ¥æŽæ°ãããããšãé¡ã£ãŠããŸãã
Graal and Truffleã§æäŸãããŠããæ°ããã¢ã€ãã¢ãè©ŠããŠã¿ããšããã®ååšã®æåã®æ¥ããããªãèªèº«ã®èšèªã§æ¬åœã«åãæ©äŒãçºèŠããã§ãããã ãã®çµæããããžã§ã¯ãã«ããªãã®èšèªãå±éã§ããåå è ã®ã³ãã¥ããã£ãæé·ããŸãã ããã«ãããéæ³ã®ãµã€ã¯ã«ãçºçããŸããã³ãã¥ããã£ã¯ãã£ãŒãããã¯ãšã¢ã€ãã¢ãæ®ããæ¹åãå°å ¥ããŸãã äžè¬ã«ãããã«ãããå®éšããæçµå®è£ ãŸã§ã®ãã¹ãå éãããŸãã ããã¯ãŸãã«ç§ãæåŸ ããŠããããšã§ãã