2007-01-01ãã1å¹´éã®è¨äºä¸è¦§
æ¥é±ãã The Scala Programming Language ã®åå¼·ä¼ãã¯ããããã¨ã«ãã¾ããã
ããã£ã¡ã ãé ãæ··ä¹±ããã®ã§ããé¢æ° ã«é¢ã㦠ã¯ãf ã i çªç®ã®å¼æ°ã§åå¾®åããé¢æ°ãåç¹ã§ã®è»¸æ¹åã®å¾ã ã¯ããåç¹ã§ã®å¾ããã¯ãã«ã ã¯ãf ãç¹ã«æéã¨ä½ç½®ã¨ä»ã®ä½ãã¨â¦ã«é¢ããé¢æ°ã®å ´åã«æå³ããã£ã¦ã ã¿ãããªä½ç½®ã«é¢ããåå¾®åã®çµ ãâ¦
åä½å¶ç´ã®ããç³»ï¼ããç¹ã¨ããç¹ã®è·é¢ã¯åºå®ãã¿ãããªå¶ç´ãããç³»ï¼ã®å ´åã©ã°ã©ã³ã¸ã¢ã³ã¯ã©ãããã°ããããã¡ããã©èªç±åº¦ã®åã ã次å ã®ããä¸è¬åº§æ¨ç³»èãã¦ãããã§ç³»ã表ç¾ãã¦ããã°ããã®å ´åã L = T - V ã§ãã¼ãã¼ããªãããä¾ãã°ãä¸åãâ¦
ã©ã°ã©ã³ã¸ã¢ã³ã®è¦ã¤ãæ¹ãååã¯ãå®éã«ç©ççã«å®ç¾ãããéåãæºãããªããã°ãªããªãæ¹ç¨å¼ããªã¤ã©ã¼ã»ã©ã°ã©ã³ã¸ã¥æ¹ç¨å¼ãããã©ã°ã©ã³ã¸ã¢ã³ããå°åºãã¾ãããä»åã¯ãããããããããã®ã©ã°ã©ã³ã¸ã¢ã³ã¦ã©ãç¨æããã®ãã¨ãã話ãã©ããªå ´åâ¦
ã¯ããããã¾ãã§ããYARVã½ã¼ã¹ã³ã¼ãåå¼·ä¼ç¬¬ä¸é¨å®ã§ãããã¦æ¬¡ã¯ä½ããããããªã¼ããã Parrotãèªãä¼ JRubyãèªãä¼ ã¨ãããåã«ããµããããã®SICMåå¼·ä¼ããªãã¨ãããªãã¨ã§ãããããã¼ãã
ã¹ã¬ããå®è¡ä¸ã«I/Oãªã©ã·ã¹ãã é¢ä¿ã®æä½ã§å¦çããããã¯ããã¨ãã¯ãã°ãã¼ãã«ããã¯ã解é¤ãã¾ããYARVã®ã¹ã¬ããã¢ãã«ã§ã¯ãããããªãã¨ä»ã®ã¹ã¬ããã¾ã§ä¸æã«æ¢ã¾ã£ã¦ãã¾ãã®ã§ãããã¯ããããã¯ããå¦çãå®è£ ããé¢æ°ã¸ã®ãã¤ã³ã¿ã rb_threâ¦
ï¼åã ãå®è¡ããã¹ã¬ããããã°ãã¼ãã«ãªMutexã®ããã¯ã¨ããå½¢ã§æ示çã«ç®¡çãã¦ããã®ã§ãã¹ã¬ããã®åãæ¿ãã®é¨åã§ãããã¯ã®åå¾/解æ¾ãæ示çã«å®è£ ãããã¨ã«ãªãã¾ãããããããã®ã rb_thread_schedule @ thread.c é¢æ°ã void rb_thread_scheâ¦
ã¡ã¤ã³ã¹ã¬ãã VMã®ã¡ã¤ã³ã¹ã¬ããã«é¢ããæ å ±ã¯ãInit_VM é¢æ°ï¼2006-10-27 - ã²ã¨ãåå¼·ä¼ï¼ã§è¨é²ããã¾ãã Thread.new Thread.new ã«ããæ°è¦ã¹ã¬ããèµ·åã®æµããè¦ã¦ããã¾ããã¾ããThreadã¯ã©ã¹ã®å®ç¾©ã¯ Init_Thread @ thread.c ã§ãã void Initâ¦
YARV ã®ã¹ã¬ããã¢ãã«ã®æ¦ç¥ãã¤ããã®ã«ã¯ãyarv-dev ã ruby-dev ã®ããã ããã®æ稿ãåèã«ãã¾ããã http://www.atdot.net/~ko1/w3ml/w3ml.cgi/yarv-dev/msg/631 [ruby-dev:30202] Re: YARV ã® thread ã«ã¤ã㦠ä»ã®ã¨ããã¯ãmodel 2ãã¤ã¾ããä¸ã¤â¦
ã³ã³ãã¤ã©ç·¨ï¼PPT or PDFï¼ã«å¼ãç¶ããVMç·¨ã®ã¾ã¨ãã¹ã©ã¤ããä½ãã¾ããã 第11åã第15åã¾ã¨ã PowerPoint 第11åã第15åã¾ã¨ã PDF ã¨ããããã§ãæçµåã§ããä»æ¥ã¯ãã«ãã¹ã¬ããå¨ãã®ã½ã¼ã¹ãèªãã§ããã¾ãã
ãã®åã®Scheme or YARVãé¢ç½ãã£ãã®ã§ããªãã¨ãªã楽ãããªã£ã¦ãToy Lispãä½ã£ã¦ãã£ãããæ¥è¨ãæ¤ç´¢ãã¦è¦ã¦åã£ãããã¦ã¾ããã ãªã¹ã 2007-03-14 - Haskellã§Lispãæ¸ãæ¥è¨ - haskell ã§ã¯Haskellã§Lispãã¡ããã¨ããSå¼ãã¼ã¶ãã¨ã¦ãã³ã³ãã¯â¦
éä¸ããå ¨ç¶YARVã½ã¼ã¹ã³ã¼ãåå¼·ä¼ãããªããªã£ã¦ãã¾ãã¾ããããä»æ¥ã¯ããã¾ã§ã§ãã ããã ãããæ¸ããã¦ããã¨ãããã»ãã¨ã«ç°¡åã«ã§ãã¡ãããã§ãããããã¯ããªã楽ããã£ãã§ããããå°ããã¸ã¡ã«ä½ã£ã¦ã¿ãã¨ãã£ã¨æ¥½ããããããã¾ãããä»åâ¦
ããã§ä»æ¥ã®YARVåå¼·ä¼ã¯ããã¾ãã§ããã£ã¦ãããã§ã¯ããã«çããªã£ã¦ãã¾ã£ãã®ã§ããã¾ãã¨ãã¦ããã³ã¾ ã§è§¦ãããã¦ãã æ¬å½ã¯ãä»åä½ãç°¡åãªè¨èªã®ã³ã³ãã¤ã©ãä½ããã¨æã£ã¦ããã®ã§ãããéã«åãã¾ããã§ããã誰ã Scheme ãããã§ææ¦ãã¦â¦
insns.defã§ã®å½ä»¤å®ç¾©ã¯ã°ã«ã¼ãå¥ã«ã¾ã¨ã¾ã£ã¦ãã¦ãä¸ããé ã« å¤æ°ã®æä½ (getlocal, ...) å¤ã®æä½ (putnil, ...) ã¹ã¿ãã¯æä½ (pop, dup, ...) ã¡ã½ãããå¥åå®ç¾©é¢ä¿ (definemethod, alias, ...) ã¯ã©ã¹/ã¢ã¸ã¥ã¼ã«å®ç¾© (defineclass, ...) ã¡ã½ãâ¦
ãä¹ ãã¶ãã§ããé±ä¸ã®åå¼·ä¼ã ã£ãã¯ããªã®ã«ãä¹ ãã¶ãã§ãã [YARV] insnhelper.h insns.defã¯YARVã®å½ä»¤ã®å®è£ ãªã®ã§ãVMã®å é¨ç¶æ ãããããã¨æä½ãã¾ããVMã¯åã åè¦ããããªãã¼ã¿æ§é ã§è¡¨ç¾ããã¦ãããã§ããããããããå°ãæ½è±¡åãã¦ãç°¡æ½â¦
ãã°ããæ¸ãã¦ãªãã£ããã²ã¨ãåå¼·ä¼ã®æ¸ãæ¹ãå¿ãã¦ãã¾ãï¼ããããªããå¤ãªæãã 次åã¯ãinsns.def ã®å 容ãé¢ç½ãããªã¨ãããã¤ã¾ã¿é£ãããªããä¸æ°ã«çºãã¦ã¿ããã¨æãã¾ãããã¨èªãã§ã¿ããã®ã¯ãã¹ã¬ããå¨ãã®å®è£ ãããã§ãããããã¨ããâ¦
æ¹ãã¦è©±ãæ»ãã¦ãä¾å¤å¦çã«ã¤ãã¦ãraiseãrescueãthrowãcatchã®ä»ã«ããbreak/redo/next, returnãªã©ãåãä»çµã¿ã使ã£ã¦å®è£ ããã¦ãã¾ãããã®è¾ºãã®å¦ç㯠th_eval_body ã«ã¾ã¨ã¾ã£ã¦ãã¾ããåºæ¬çãªæµãã¨ãã¦ã¯â¦ exception_handler: cont_pc = â¦
th_set_top_stack ã§å¶å¾¡ãã¬ã¼ã ã®è¨å®ãçµãã£ãããããããå®è¡éå§ãth_eval_body é¢æ°ã§ãã VALUE th_eval_body(yarv_thread_t *th) { ... TH_PUSH_TAG(th); if ((state = EXEC_TAG()) == 0) { vm_loop_start: result = th_eval(th, initial); if ((sâ¦
ä¸æã¶ãã®YARVåå¼·ä¼ã«ãªã£ã¦ãã¾ãã¾ãããä»æ¥ã®ãªãã¸ã§ã³ã¯ r11982 ã§ãããã¤ã®ã¾ã«ã yarv_iseq_t ã rb_iseq_t ã«ãªã£ãããyarv_control_frame_t ã rb_control_frame_t ã«ãªã£ã¦ã¾ããããããã
ä»æ¥ã¯ããã¾ã§ã次åã¯ããããããã©ã°ã©ã³ã¸ã¢ã³ãã£ã¦ã©ããã£ã¦åºãã¦ããã®ï¼ããã¼ãã®1.6ç¯ã«ç§»ãã¾ãã
ãªã¤ã©ã¼ã»ã©ã°ã©ã³ã¸ã¥æ¹ç¨å¼ã actionï¼pathããå®æ°å¤ã¸ã®é¢æ°ï¼ãæå°ã«ãªããããªpathããç¾å®ã«å®ç¾ããããpathãªã®ã§ãããã¨ããã§ãf(x)ãæå°ã«ãããããªxã¯ãfã®å¾®åã0ã«ãªããããªxã§ãããã®ã¨åãã§ãpathã«ã¤ãã¦ãããaction(path)ãæå°â¦
æå°ä½ç¨ã®è»è·¡ãæ¢ã ååã¯ã ã©ã°ã©ã³ã¸ã¢ã³ãããã£ã¦ã ä½ç¨ãæå°ã«ããpathãããã£ã¦ã ã¨ãã«ãå®éã«ãã®pathã使ã£ã¦è¨ç®ããä½ç¨ã極å°å¤ã«ãªã£ã¦ããã¨ã確ããã¾ãããä»å㯠ã©ã°ã©ã³ã¸ã¢ã³ãããã£ã¦ã å§ç¹ã¨çµç¹ã®ä¸è¬åº§æ¨ãããã£ã¦ã ã¨â¦
å宿ã¨è¬å¼ã¨è±ç²çãä¸åº¦ã«æ¥ããããªå¿ããï¼æ¯å©ã«ãªã£ã¦ãªãï¼ã§æãã£ãããµãã£ã¦ãã¾ãã¾ãããåçã大å¤ãä¹ ãã¶ãã§ããã第ï¼åSICMã²ã¨ãåå¼·ä¼ã§ããä»åã¯ãã©ã°ã©ã³ã¸ã¢ã³ããå®éã®ãã¹ãæ±ããæç¶ããããã¡ããå ·ä½åããã¨ããã§ãã
SICMã®ãã¨å®ã£ç§ã«å¿ãã¦ãï¼ï¼ï¼ï¼ï¼
ä»æ¥ã¯ãYARVä»®æ³ãã·ã³ã®å®è¡æã®ãã¼ã¿æ§é ã«ã¤ãã¦ã¨ãå®éã«ã³ã¼ãã®å®è¡ã«ç§»ãã¾ã§ã®ãã®ã»ããã¢ããã«ã¤ãã¦è¦ã¦ã¿ã¾ããã次åã¯ãå®éã«ä»®æ³ãã·ã³èªãå®è¡ããé¢æ° th_eval_body ã®æ¹ã«è¡ãäºå®ã§ãã
åæåå¾ãRubyã½ã¼ã¹ã®ã³ã³ãã¤ã«ãè¡ããã¦ãã³ã³ãã¤ã«çµæã®å½ä»¤åãã¼ã¿ã yarvcore_eval_iseq é¢æ°ã«æ¸¡ããã¾ãããããVMã«ããå®è¡ã®éå§ç¹ã§ãã static VALUE yarvcore_eval_iseq(VALUE iseq) { return yarv_th_eval(GET_THREAD(), iseq); } æå®â¦
VM ã¾ããYARV ã®ä»®æ³ãã·ã³ã表ããã¼ã¿æ§é ãããã¾ããyarvcore.h ã§å®ç¾©ããã¦ãã yarv_vm_t æ§é ä½ã§ãã typedef struct yarv_vm_struct { VALUE self; ...ç¥... struct yarv_thread_struct *main_thread; struct yarv_thread_struct *running_threadâ¦
æè¿ææ¥ã®æè¦ããããããªã£ã¦ãã hzkr ã§ããä»æ¥ã¯ãYARV ã®ä»®æ³ãã·ã³ã®å®è£ ã®å ¥ãå£ãã®ããã¯ããã¾ãã
ã¨ããããã§ãããã§ã³ã³ãã¤ã«å¦çã¯å®æã§ãã次åããã¯VMã®å®è¡é¨ã®ã³ã¼ãèªã¿ã«ç§»ãã¾ããã§ã¯ã§ã¯ã¼ã