Movatterモバイル変換


[0]ホーム

URL:


青木日記

<前月 |最新 |次月>

2005-12-01

GS でたー

http://page14.auctions.yahoo.co.jp/jp/auction/s9212735

AlphaServer GS320 (21264A? 1GHz * 32, 32GB) なんていう化物が登場。ラック三本で 700 万スタートかよ……。こんなのヤフオクで買う人いるのかなあ。

(20:47)


2005-12-04

Distribution.Compat.FilePath

なんで FilePath がエクスポートされてないんじゃあああああああああああ!存在するのに使えないってメチャクチャ腹立つよ!

しょうがないので必要なやつだけ適当に書いといた (かなり用途特化ぎみ)。

module PathUtils    (concatPath, joinPath, basename, dirname, components, ancestors)where import Data.List (intersperse) concatPath :: [String] -> StringconcatPath []   = "/"concatPath [""] = "/"concatPath cs   = join "/" cs joinPath :: String -> String -> StringjoinPath a b    | null a        = '/' : b    | last a == '/' = a ++ b    | otherwise     = a ++ "/" ++ b basename :: String -> Stringbasename "/"  = "/"basename path = last (components path) ancestors :: String -> [String]ancestors path = case scanl1 (joinPath) $ components path of                   ("":xs) -> reverse ("/":xs)                   xs      -> reverse xs components :: String -> [String]components = split '/' dirname :: String -> Stringdirname "/" = "/"dirname path = case components path of                 []  -> ""                 [_] -> "."                 cs  -> concatPath (init cs) split :: Char -> String -> [String]split _ [] = []split sep str = word : split sep cont  where    (word, cont') = break (==sep) str    cont = case cont' of             []     -> ""             (c:cs) -> cs join :: String -> [String] -> Stringjoin sep = concat . intersperse sep

ところで、この日記の記法だと Haskell のコメントが pre に入れられないことが判明した。BitChannel と同じく {{{ ... }}} 記法を実装するべきか。

はじめての HUnit

HUnit、記述がめちゃうざったい……。関数名を三回書かないといけないのもさることながら、頭の runTestTT なんたらもさることながら、assert のメッセージ書くのがあまりにめんどい。あまりにめんどくさいので番号にしてしまった。やっぱりこういうとこは Ruby のほうが圧倒的に気楽でいいなあ。

import Test.HUnitimport PathUtils main = runTestTT $ test $    [ "test_ancestors"  ~: test_ancestors,      "test_components" ~: test_components,      "test_concatPath" ~: test_concatPath,      "test_joinPath"   ~: test_joinPath,      "test_basename"   ~: test_basename,      "test_dirname"    ~: test_dirname ] test_ancestors =    do assertEqual "1" ["/"] (ancestors "/")       assertEqual "2" ["/a", "/"] (ancestors "/a")       assertEqual "3" ["/a/b", "/a", "/"] (ancestors "/a/b")       assertEqual "4" ["/a/b", "/a", "/"] (ancestors "/a/b/")       assertEqual "5" ["a/b", "a"] (ancestors "a/b")       assertEqual "6" ["a/b", "a"] (ancestors "a/b/")       assertEqual "7" ["a"] (ancestors "a") test_components =    do assertEqual "1" [""] (components "/")       assertEqual "2" ["", "a"] (components "/a")       assertEqual "3" ["", "a", "b"] (components "/a/b")       assertEqual "4" ["", "a", "b"] (components "/a/b/")       assertEqual "5" ["a", "b"] (components "a/b")       assertEqual "6" ["a", "b"] (components "a/b/") test_concatPath =    do assertEqual "1" "/" (concatPath [])       assertEqual "2" "/" (concatPath [""])       assertEqual "3" "/" (concatPath ["/"])       assertEqual "4" "/a" (concatPath ["", "a"])       assertEqual "5" "/a/b" (concatPath ["", "a", "b"]) test_joinPath =    do assertEqual "1" "/a" (joinPath "/" "a")       assertEqual "2" "/a/b" (joinPath "/a" "b")       assertEqual "3" "a/b" (joinPath "a" "b") test_basename =    do assertEqual "1" "/" (basename "/")       assertEqual "2" "a" (basename "/a")       assertEqual "3" "b" (basename "/a/b")       assertEqual "4" "a" (basename "a")       assertEqual "5" "b" (basename "a/b")       assertEqual "6" "." (basename ".")       assertEqual "7" ".." (basename "..") test_dirname =    do assertEqual "1" "/" (dirname "/")       assertEqual "2" "/" (dirname "/a")       assertEqual "3" "/a" (dirname "/a/b")       assertEqual "4" "/a/b" (dirname "/a/b/c")       assertEqual "5" "a" (dirname "a/b")       assertEqual "6" "." (dirname "a")       assertEqual "7" "." (dirname ".")       assertEqual "8" "." (dirname "..")

(02:50)

href 0.3

Haskell リファレンスマニュアル検索ツール href の 0.3 をリリースしました。

おかしい……原稿を書いていたところから転じてWash のチュートリアルをやっていたはずがなぜ href をアップデートしているんだろう。

(02:51)

href 0.3.1

あー、そうだ、href の変更はこんなとこです。

  • リファレンスマニュアル増量 (Data.Maybe とか)
  • stdout が tty かどうかで出力形式が変わるようにした
  • 補完の精度向上

あとは外に変化の出ないリファクタリングとか。

それとビルドに GHC 6.4 が必要です。うちのメインは Debian なので GHC 6.2 なんですが、そっちだと URI の関数が足りなくてエラーになります。(まあたいしたエラーじゃないのでそこだけ変えりゃ通ります)

……なんて書いているあいだに直したほうが早いなーと思いいたったので対応しておきました。

リリースから 3 時間もたってないよ……。まあダウンロードした人はまだいないみたいだからいいか。

(04:04)

本日のツッコミ (全3件)

shelarcy [darcs get http://www.scannedinavian.org/~lemmih/FilePath/]

shelarcy [あっ、後 patch です。入れてくれてないので、適当にファイル名つけて darcs apply して下さい。


New patches:

[fixed joinFileName bug for "../" prefixed fileName and directoryName that endend non pathSeparator.
shelarcy@capella.freemail.ne.jp**20050907143754] {
hunk ./System/FilePath.hs 146
- | chr == '.' && isPathSeparator (head fname) = joinFileName (reverse $ dropWhile (not . isPathSeparator) $ reverse dir) (tail fname)
+ | chr == '.' && isPathSeparator (head fname) =
+ joinFileName (reverse $ dropWhile (not . isPathSeparator) $ dropWhile isPathSeparator $ reverse dir) (tail fname)
}

Context:

[change joinFilePath works well for file name that use "../" or "./" prefix. And added basename, dirname, dropFileExt (dropSuffix) functions that inspired by hs-plugins' function.
shelarcy@capella.freemail.ne.jp**20050907123002]
[CPP fixes from CosmicRay.
lemmih@gmail.com**20050721174613]
[Set me (lemmih) as the maintainer.
lemmih@gmail.com**20050721173849]
[Added LICENSE
lemmih@gmail.com**20050721173422]
[Initial record.
lemmih@gmail.com**20050426222116]
Patch bundle hash:
65a356504e79c8a892b310e80f1bcb1c4b0eb59d]

青木 [む、なるほど、別配布になっているのですか。
ありがとうございます。
GHC に添付してほしいっすね……。]


2005-12-05

るびま #12 の添削

るびま 12 月号、添削記事は筆者の一身上の都合によりお休みです。すんまそん。どうやら運がよくなかったらしいです。

と思ったら、一月が最初から休みの月だったので二ヶ月あいちゃうのね。まあ、そのころならだいたい原稿も書き終わって気楽に書ける

わけないんだよな。前科からして。

(21:14)

YARV

とりあえず YARV ビルド……

% ./build.sh allzsh: 1906 segmentation fault (core dumped)  ./build.sh all

なぜここで sh が落ちる―――!

(21:35)

忘れる病

Ruby ばっか書いてると C でセミコロンを忘れるというのは常識だが、今日は Haskell / sh ばっかり書いてたために Ruby で引数間のカンマを忘れた。文字列二つだと連結されちゃって文法エラーにならないという例のやつだ。

(22:04)

YARV (2)

sh の core は見なかったことにして Ruby に逃げた

~ % ./build.rb configure make test/var/www/autobuild-yarv/src/file.c: In function `chmod_internal':/var/www/autobuild-yarv/src/file.c:1565: warning: cast from pointer to integer of different size/var/www/autobuild-yarv/src/parse.y: In function `local_push_gen':/var/www/autobuild-yarv/src/parse.y:8019: warning: cast to pointer from integer of different size/var/www/autobuild-yarv/src/compile.c: In function `search_block_local_parameters':/var/www/autobuild-yarv/src/compile.c:899: warning: cast from pointer to integer of different size/var/www/autobuild-yarv/src/compile.c: In function `set_block_local_tbl':/var/www/autobuild-yarv/src/compile.c:1024: warning: cast from pointer to integer of different sizelibruby-static.a(thread.o): In function `thread_start_func_1':/var/www/autobuild-yarv/src/thread_pthread.h:50: undefined reference to `__pthread_register_cancel'/var/www/autobuild-yarv/src/thread_pthread.h:55: undefined reference to `__pthread_unregister_cancel'libruby-static.a(thread.o): In function `yarv_thread_s_new':/var/www/autobuild-yarv/src/thread_pthread.h:76: undefined reference to `pthread_attr_setstacksize'/var/www/autobuild-yarv/src/thread_pthread.h:77: undefined reference to `pthread_create'/var/www/autobuild-yarv/src/thread_pthread.h:111: undefined reference to `pthread_create'libruby-static.a(thread.o): In function `yarv_thread_join':/var/www/autobuild-yarv/src/thread.c:154: undefined reference to `pthread_join'collect2: ld returned 1 exit statusmake: *** [miniruby] Error 1libruby-static.a(thread.o): In function `thread_start_func_1':/var/www/autobuild-yarv/src/thread_pthread.h:50: undefined reference to `__pthread_register_cancel'/var/www/autobuild-yarv/src/thread_pthread.h:55: undefined reference to `__pthread_unregister_cancel'libruby-static.a(thread.o): In function `yarv_thread_s_new':/var/www/autobuild-yarv/src/thread_pthread.h:76: undefined reference to `pthread_attr_setstacksize'/var/www/autobuild-yarv/src/thread_pthread.h:77: undefined reference to `pthread_create'/var/www/autobuild-yarv/src/thread_pthread.h:111: undefined reference to `pthread_create'libruby-static.a(thread.o): In function `yarv_thread_join':/var/www/autobuild-yarv/src/thread.c:154: undefined reference to `pthread_join'collect2: ld returned 1 exit statusmake: *** [miniruby] Error 1

あれ? ああそうか --enable-pthread か

(22:14)

YARV (3)

Finished in 5.665476 seconds.   1) Failure:test_for(TestBlock)    [/var/www/autobuild-yarv/src/yarvtest/yarvtest.rb:107:in `ae'     /var/www/autobuild-yarv/src/yarvtest/test_block.rb:292:in `test_for']:<"1..3\n"> expected but was<"">.   2) Failure:test_rest(TestBlock)    [/var/www/autobuild-yarv/src/yarvtest/yarvtest.rb:107:in `ae'     /var/www/autobuild-yarv/src/yarvtest/test_block.rb:335:in `test_rest']:<"[1, [2]]\n"> expected but was<"[[1, 2], nil]\n">. 159 tests, 402 assertions, 2 failures, 0 errors make: *** [yarv-test-all] Error 1

普通に F が出るようになったな

(22:17)

本日のツッコミ (全1件)

ささだ [うーん、64bit のせいだといいんだけど(最近チェックしてなかった)。]


2005-12-06

YARV (4)

ls の出力を眺めていたら何気に core があった。for の出力が空になってたのはこのせいか?

#0  yarv_bug () at /home/aamine/c/yarv/vm_dump.c:492492       for(i=0; i<RARRAY(bt)->len; i++){(gdb) bt#0  yarv_bug () at /home/aamine/c/yarv/vm_dump.c:492#1  0x000000000048d6a4 in rb_bug (fmt=0x4bc595 "Segmentation fault")    at /home/aamine/c/yarv/error.c:165#2  0x00000000004623e4 in sigsegv (sig=11) at /home/aamine/c/yarv/signal.c:503#3  <signal handler called>#4  rb_funcall (recv=18446744071929847312, mid=3185, n=0) at ruby.h:667#5  0x0000000000432396 in rb_inspect (obj=18446744071929847312)    at /home/aamine/c/yarv/object.c:301#6  0x0000000000427079 in rb_p (obj=18446744071929847312)    at /home/aamine/c/yarv/io.c:3726#7  0x0000000000427121 in rb_f_p (argc=1, argv=0x2a95ee2030)    at /home/aamine/c/yarv/io.c:3753#8  0x000000000047b8c6 in call_cfunc (func=0x4270b0 <rb_f_p>,    recv=182904026184, len=0, argc=-1779704304, argv=0x0) at call_cfunc.h:24#9  0x00000000004799b5 in th_eval (th=0x66ba60, initial=0) at vm.inc:2022#10 0x000000000047b559 in th_eval_body (th=0x66ba60)    at /home/aamine/c/yarv/vm.c:1208#11 0x00000000004145da in ruby_exec_internal ()    at /home/aamine/c/yarv/eval.c:267#12 0x0000000000414603 in ruby_exec () at /home/aamine/c/yarv/eval.c:279#13 0x000000000041463d in ruby_run () at /home/aamine/c/yarv/eval.c:296#14 0x00000000004116a9 in main (argc=2, argv=0x7fbffff528, envp=0x0)    at /home/aamine/c/yarv/main.c:36 ~/obj/yarv % ./miniruby --versionruby 1.9.0 (2005-11-18) [x86_64-linux]YARVCore 0.3.2 (rev: 303) [opts: ] ~/obj/yarv % uname -aLinux serenade 2.6.8-11-amd64-k8 #1 Wed Jun 1 01:03:08 CEST 2005 x86_64 GNU/Linux ~/obj/yarv % gcc -dumpversion3.3.5

(01:52)

YARV (5)

とりあえず型関係の warning くらいは潰しとくかなーと思ってプロトタイプを付けたら

ruby -I/home/aamine/c/yarv /home/aamine/c/yarv/yarvtest/runner.rb  yarv=./miniruby ruby=ruby"/home/aamine/c/yarv/yarvtest/test_massign.rb""/home/aamine/c/yarv/yarvtest/test_jump.rb""/home/aamine/c/yarv/yarvtest/test_exception.rb""/home/aamine/c/yarv/yarvtest/test_test.rb""/home/aamine/c/yarv/yarvtest/test_flow.rb""/home/aamine/c/yarv/yarvtest/test_bin.rb""/home/aamine/c/yarv/yarvtest/test_block.rb""/home/aamine/c/yarv/yarvtest/test_syntax.rb""/home/aamine/c/yarv/yarvtest/test_yield.rb""/home/aamine/c/yarv/yarvtest/test_method.rb""/home/aamine/c/yarv/yarvtest/test_class.rb""/home/aamine/c/yarv/yarvtest/test_proc.rb"Loaded suite /home/aamine/c/yarv/yarvtest/runnerStarted.............................BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] FBUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F....F...BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F....BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F..........BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F.....BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] FBUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] FBUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F.BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] FBUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] FBUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] FBUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F..BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] FBUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] FBUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F.....BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] FBUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F........................................BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F.BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F......BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F......BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F..BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F...........BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F.BUG: should not reach here: compile_each#NODE_ARGS[BUG] Segmentation faultruby 1.9.0 (2005-11-18) [x86_64-linux] F(eval):8: warning: multiple values for a block parameter (0 for 1)        from (eval):4(eval):14: warning: multiple values for a block parameter (2 for 1)        from (eval):4(eval):17: warning: multiple values for a block parameter (3 for 1)        from (eval):4....Finished in 6.383639 seconds.   1) Failure:test_for(TestBlock)中略 159 tests, 382 assertions, 25 failures, 0 errorsmake: *** [yarv-test-all] Error 1

激しく悪化。何が起きているのかどきどきです。

(02:46)


2005-12-09

RHG 読書会

おおっとそうか、ここでも宣伝しておこう。

明日 (今日) 10 日の土曜日は RHG 読書会です!

(01:59)


2005-12-12

YARV

とりあえず pathname.rb で落とせた。今夜追跡してみるっと。

(08:11)

Haskellのはまりどころ

山下さん (だけ) には何度も何度も何度も訴えた記憶があるんだけど、Ruby とか C とか Java に慣れきっている人がHaskell で一番ハマるのは演算子の優先順位だと思う。

こないだはまったのはこんな感じの式で

viewPageResponse name =    return . HTTPResponse pageContentType =<< fill "view" name =<< pageHTML db name

name の前に $ を入れて型エラー。かなり悩んだ。どうも「=<<」がからむとまだ瞬間的にパースできん。あと do の中の if とかね。let とかね。

てな感じのことを、ふつうの H に書く予定。

(01:35)

ネットワーク工事

プロバイダが工事中でインターネットにつながらない。寝る。

(02:58)

本日のツッコミ (全2件)

alpassa [Olive garden - only for you! http://www.weblog.ro/oyoyoy/ olive garden http://www.weblog.ro/etalave/ job search]

palena [Buy cialis - Best page! http://jroller.com/page/ciala buy cialis]


2005-12-14

YARV / Tru64UNIX 5.1B

こう寒いと暖房なしじゃ生活できないよね。具体的には AlphaServer とか。

というわけで YARV を Tru64UNIX でコンパイルしてみた。当然のようにエラーになる。

/usr/local/pkg/gcc-3.4.3/lib/gcc/alphaev6-dec-osf5.1/3.4.3/include/pthread.h:335:4: #error "Please compile the module including pthread.h with -pthread"

つうことで CC='gcc -pthread' で再挑戦。

次は gperf 関係でエラーになった。YARV だと毎回出るよなこれ。keywords が lex.c より後に update されるのがまずいみたいだ。一回 lex.c を消して svn up lex.c でリストア、ついでに touch lex.c しておく。

tunami:~/src/yarv % make >> log.make 2>&1 && echo OKOK

よし通った。

tunami:~/src/yarv % make yarv-test-all略Finished in 48.732625 seconds.   1) Failure:test_proc_with_block(TestProc)    [./yarvtest/yarvtest.rb:107:in `ae'     ./yarvtest/test_proc.rb:215:in `test_proc_with_block']:<"1\n"> expected but was<"false\n">. 159 tests, 416 assertions, 1 failures, 0 errors

本物のエラーがきたー。ちなみに core は出てない。

(20:26)

『コンピュータが計算機と呼ばれた時代』

いただきもの。

なんつーんですか、栄光の日々リバイバルといいましょうか、爺さんどもの懐古趣味じゃねーのこれと思わなくもないというかメッチャあるんだけど、この本でそれを指摘するのもムゴいので楽しめるところだけ読んでおくことにする。

写真がたくさんあるのが嬉しい。重厚長大マシンはいいですなあ。コードの束がいいんだよ束が!やっぱりコードは束ねてナンボだよ。

あとラックな、ラック。ラック萌え。ラックに隙間なく機械を詰め込むのがいい。

この本は 1950 年代から 70 年くらいまでのコンピュータを扱ってるらしいんだけど、このへんになると何が何だか全然わからんね。パラメトロンとか初めて聞いたよ。トランジスタより安定してたけど速度で劣るのが敗因か。コンピュータまわりってそんなのばっかだな。

それから当然のようにコアメモリは出ている。

本当に、アトムに出てくるコンピュータのイメージそのままだなあ。

リレーを使った非同期コンピュータか。いままた話が出始めてるよね、非同期コンピュータ。最初の RubyConf の帰りにアメリカで買った雑誌を読んでたら非同期システムの話が出てたな。

ああそういえば、家に父親の昔の物をひたすらつめこんである部屋があるんだけどね、そこを整理してたらパンチカードとかラインプリンタの用紙とかが大量に出てきた。センター試験のマークシートみたいなやつ。

……レポートやってたの忘れてた。やばいよー、終わらないよー。

(03:34)


2005-12-15

れぽーつ

本を一冊読んで書かなければいけないのだが現在 42 ページ / 271 ページ。ピンチだ!

「斜め読み」を実行しますか? [Y/y] Y

しかし MP がたりない!

(06:08)

Apache2 死亡

Apache が突如としてこんなメッセージを残しお亡くなりになってしまった。

[Thu Dec 15 05:22:36 2005] [alert] (11)Resource temporarily unavailable: apr_thread_create: unable to create worker thread[Thu Dec 15 05:22:46 2005] [alert] Child 9028 returned a Fatal error... Apache is exiting!

ログを見ても特にアクセスが集中していたわけではないみたいだしなあ。いったい何が起きたんだ。

(06:43)


2005-12-16

NVIDIA が ULi を買収

http://slashdot.jp/article.pl?sid=05/12/15/0155219

うわ……これは地味に嫌だな。

俺は ATI は買わないので直接被害を受けることはなさそうだけど、この結果 NVIDIA 一人勝ちってのは嬉しくない。ただでさえ AMD 関係はいいチップセットがないというのに。NVIDIA V.S. ATI の戦いがもうちょっと長引いて両方が安定に向かうのがベストなんだけどな。

ま、そんなこと言いつつ今使ってる AMD64 システムは二つとも nForce4 ですけどね。今度買うときは Serverworks にしたい。

(21:13)


2005-12-17

Haskell 製 Wiki clone : LazyLines

Haskell で Wiki 書いた →http://i.loveruby.net/ll/

思ったこと

  • 全然気付かなかったが BitChannel の ReverseLink はとても便利だったらしい
  • 検索もないと辛い

って Haskell じゃなくて Wiki の話かよ。

(08:31)

LazyLines (2)

いちおうソースコードの入手方法だけはこっちにも書いとくか。

% cvs -d :pserver:anonymous@cvs.loveruby.net:/src co lazylines

パッケージはどんどんバージョン上がるんで書きません。

(08:46)

YARV

socket.so もあるみたいだから YARV で BitChannel を試して (落として) みよう。

と思って make ext したら落ちた。話が早いな。

~/c/yarv % ./miniruby ./ext/extmk.rb --dest-dir="" --make=make --mflags=-n --make-flags=n --extout=.ext --extension --extstatic --compiling Win32APImake: Nothing to be done for `all'.compiling bigdecimalmake: Nothing to be done for `all'.compiling digestmake: Nothing to be done for `all'.compiling digest/md5make: Nothing to be done for `all'.compiling digest/rmd160make: Nothing to be done for `all'.compiling digest/sha1make: Nothing to be done for `all'.compiling digest/sha2make: Nothing to be done for `all'.compiling etcgcc -fPIC -g -O2 -Wall  -I. -I../.. -I../../. -I../.././ext/etc -DHAVE_GETLOGIN -DHAVE_GETPWENT -DHAVE_GETGRENT -DHAVE_ST_PW_GECOS -DHAVE_ST_PW_PASSWD -DHAVE_ST_GR_PASSWD  -c etc.crm -f ../../.ext/x86_64-linux/etc.somkdir -p ../../.ext/x86_64-linuxgcc -shared  -L'../..' -o ../../.ext/x86_64-linux/etc.so etc.o  -lpthread -ldl -lcrypt -lm   -lccompiling socketzsh: 15604 abort (core dumped)  ./miniruby ./ext/extmk.rb --dest-dir="" --make=make --mflags=-n --make-flags=

スタックトレース

#0  0x0000002a95b6fdd0 in raise () from /lib/libc.so.6#1  0x0000002a95b71280 in abort () from /lib/libc.so.6#2  0x000000000048d15d in rb_bug (fmt=0x4a0ec0 "rb_gc_mark(): unknown data type 0x%lx(%p) %s") at error.c:173#3  0x000000000041d9b3 in gc_mark_children (ptr=6732432, lev=1) at gc.c:596#4  0x000000000047c90c in iseq_mark (ptr=0x71e410) at yarvcore.c:401#5  0x000000000041d901 in gc_mark_children (ptr=182902858312, lev=2)    at gc.c:918#6  0x000000000041d89e in gc_mark_children (ptr=9, lev=1) at gc.c:899#7  0x000000000047c92a in iseq_mark (ptr=0x71ce40) at yarvcore.c:401#8  0x000000000041d901 in gc_mark_children (ptr=182902858632, lev=8)    at gc.c:918#9  0x000000000041d55e in mark_entry (key=15692, value=15692, lev=15692)    at gc.c:638#10 0x0000000000465e30 in st_foreach (table=0x6116d0,    func=0x41d550 <mark_entry>, arg=7) at st.c:468#11 0x000000000041d7e1 in gc_mark_children (ptr=182904035944, lev=7)    at gc.c:884#12 0x000000000041d55e in mark_entry (key=15692, value=15692, lev=15692)    at gc.c:638#13 0x0000000000465e30 in st_foreach (table=0x611e00,    func=0x41d550 <mark_entry>, arg=6) at st.c:468#14 0x000000000041d7ed in gc_mark_children (ptr=182904035824, lev=6)    at gc.c:885#15 0x000000000041d7bb in gc_mark_children (ptr=182904035904, lev=5)    at gc.c:879#16 0x000000000041d55e in mark_entry (key=15692, value=15692, lev=15692)    at gc.c:638#17 0x0000000000465e30 in st_foreach (table=0x6120e0,    func=0x41d550 <mark_entry>, arg=4) at st.c:468#18 0x000000000041d7ed in gc_mark_children (ptr=182904035744, lev=4)    at gc.c:885#19 0x000000000041d7bb in gc_mark_children (ptr=182904016904, lev=3)    at gc.c:879#20 0x000000000041d7bb in gc_mark_children (ptr=182904016944, lev=2)    at gc.c:879#21 0x000000000041d7bb in gc_mark_children (ptr=182905577184, lev=1)    at gc.c:879#22 0x000000000041d52f in mark_locations_array (x=0x7fbfffbc60, n=24)    at gc.c:620#23 0x000000000041e4fb in garbage_collect () at gc.c:1307#24 0x000000000041cc55 in ruby_xmalloc (size=131073) at gc.c:121#25 0x0000000000465fcb in str_new (klass=15692, ptr=0x0, len=131072)    at string.c:83#26 0x0000000000466079 in rb_tainted_str_new (    ptr=0x3d4c <Address 0x3d4c out of bounds>, len=15692) at string.c:109#27 0x00000000004243d6 in io_read (argc=15692, argv=0x3d4c, io=182905577344)    at io.c:1404#28 0x000000000047b386 in call_cfunc (func=0x424280 <io_read>,    recv=182905577344, len=6, argc=15692, argv=0x3d4c) at call_cfunc.h:24#29 0x000000000047963a in th_eval (th=0x66ba90, initial=15692) at vm.inc:2023#30 0x000000000047aff3 in th_eval_body (th=0x66ba90) at vm.c:1129#31 0x000000000047763d in th_invoke_yield (th=0x66ba90, argc=1,    argv=0x7fbfffc840) at vm.c:579#32 0x0000000000415903 in rb_yield_0 (val=182905577344, self=15692, klass=6,    flags=-1, avalue=15692) at yarv.h:49#33 0x0000000000416262 in rb_ensure (b_proc=0x4159a0 <rb_yield>,    data1=182905577344, e_proc=0x425010 <io_close>, data2=182905577344)    at eval.c:1425#34 0x000000000047b386 in call_cfunc (func=0x4262e0 <rb_io_s_open>,    recv=182903948584, len=6, argc=15692, argv=0x3d4c) at call_cfunc.h:24#35 0x000000000047963a in th_eval (th=0x66ba90, initial=15692) at vm.inc:2023#36 0x000000000047aff3 in th_eval_body (th=0x66ba90) at vm.c:1129#37 0x000000000047c4c9 in yarv_load (file=0x2a96087070 "\a") at yarv.h:43#38 0x000000000048fdd1 in rb_load (fname=182905807424, wrap=0)    at eval_load.c:141#39 0x000000000048ff23 in rb_f_load (argc=15692, argv=0x3d4c)    at eval_load.c:198#40 0x000000000047b386 in call_cfunc (func=0x48fef0 <rb_f_load>,    recv=182904026184, len=6, argc=15692, argv=0x3d4c) at call_cfunc.h:24#41 0x000000000047963a in th_eval (th=0x66ba90, initial=15692) at vm.inc:2023#42 0x000000000047aff3 in th_eval_body (th=0x66ba90) at vm.c:1129#43 0x000000000047763d in th_invoke_yield (th=0x66ba90, argc=1,    argv=0x7fbfffe540) at vm.c:579#44 0x0000000000415903 in rb_yield_0 (val=182905889424, self=15692, klass=6,    flags=-1, avalue=15692) at yarv.h:49#45 0x000000000048043e in rb_ary_each (ary=182905883784) at array.c:1149#46 0x000000000047b38f in call_cfunc (func=0x4803c0 <rb_ary_each>,    recv=182905883784, len=6, argc=15692, argv=0x3d4c) at call_cfunc.h:27#47 0x000000000047963a in th_eval (th=0x66ba90, initial=15692) at vm.inc:2023#48 0x000000000047aff3 in th_eval_body (th=0x66ba90) at vm.c:1129#49 0x000000000041451a in ruby_exec_internal () at eval.c:268#50 0x0000000000414543 in ruby_exec () at eval.c:280#51 0x000000000041457d in ruby_run () at eval.c:297#52 0x0000000000411629 in main (argc=10, argv=0x7fbffff468, envp=0x6)    at main.c:36

GC の途中かあ。本家みたく、ひたすら GC しまくるやつを入れてみるべきかな。

(11:03)

YARV (2)

うーん、gcc -O0 では起こらない……。どうしようかな。

(11:29)

LazyLines (3)

本当は TwoTailって名前にしようかと思ったんだよ。その前は TwinTail を考えたんだけど、「ついんて〜る」って 2ch ブラウザがあるから。

(12:58)

るびま

あ……今号ほとんど読んでねーや。編集担当らしい YARV だけ読もう。

(13:15)

本日のツッコミ (全1件)

ささだ [むぅ。iseq_mark っぽいので printf デバッグ希望。]


2005-12-20

流行に便乗

るびまの次回予告を書こうとして

  • あなたの Ruby コードを添削し

なんか退屈だったので

  • ちゃうんだからっ! べ、別にあんたのためなんかじゃないんだからねっ 【第 3 回】 dbf.rb

とつなげたところで正気に戻って修正しといた。

(06:41)

YARV バグを追う

うーむ。-O2 のときだけ起こるってやだなあ。

(gdb) bt#0  0x0000002a95b6fdd0 in raise () from /lib/libc.so.6#1  0x0000002a95b71280 in abort () from /lib/libc.so.6#2  0x000000000041dc87 in gc_mark_children (ptr=6732336, lev=2) at gc.c:1017#3  0x000000000041d87b in gc_mark_children (ptr=6732608, lev=1) at gc.c:929#4  0x000000000047ca4c in iseq_mark (ptr=0x71f380) at yarvcore.c:401#5  0x000000000041d9c1 in gc_mark_children (ptr=182902853632, lev=2)    at gc.c:968#6  0x000000000041d95e in gc_mark_children (ptr=9, lev=1) at gc.c:949#7  0x000000000047ca6a in iseq_mark (ptr=0x71ddb0) at yarvcore.c:401#8  0x000000000041d9c1 in gc_mark_children (ptr=182902853952, lev=8)    at gc.c:968#9  0x000000000041d61e in mark_entry (key=24148, value=24148, lev=24148)    at gc.c:688#10 0x0000000000465eb0 in st_foreach (table=0x6116d0,    func=0x41d610 <mark_entry>, arg=7) at st.c:468#11 0x000000000041d89e in gc_mark_children (ptr=182904035944, lev=7)    at gc.c:934#12 0x000000000041d61e in mark_entry (key=24148, value=24148, lev=24148)    at gc.c:688#13 0x0000000000465eb0 in st_foreach (table=0x611e00,    func=0x41d610 <mark_entry>, arg=6) at st.c:468#14 0x000000000041d8aa in gc_mark_children (ptr=182904035824, lev=6)    at gc.c:935#15 0x000000000041d87b in gc_mark_children (ptr=182904035904, lev=5)    at gc.c:929

まあこれくらい見とけばいいだろ。

frame 2。ptr が壊れてる。

frame 3。T_REGEXP と出たが中身は壊れてる。だいたい iseq に正規表現が入っているというのがよくわからない。

frame 4。これは本当に iseq なのだろうか。

(gdb) p *$15$16 = {self = 182902853632, name = 182902853672, iseq = 0x71ff50,  iseq_encoded = 0x71ff50, iseq_mark_ary = 182902853592, size = 34,  insn_info_tbl = 0x720070, insn_info_size = 10, file_name = 182902888232,  local_tbl = 0x71aa90, local_size = 2, jit_compiled = 0x0, iseq_orig = 0x0,  argc = 2, arg_simple = 1, arg_rest = 0, arg_block = 0, arg_opts = 0,  arg_opt_tbl = 0x0, rewind_frame_size = 3, stack_max = 10, type = 7,  klass_nest_stack = 6732608, klass = 0, catch_table_ary = 0,  catch_table = 0x7200a0, catch_table_size = 2, parent_iseq = 0x71ddb0,  local_iseq = 0x71ddb0, node = 0x2a95e06c18, special_block_builder = 0x0,  cached_special_block_builder = 0x0, cached_special_block = 0,  compile_data = 0x0}

うーん。これは本物のような気がする。うーん。

(gdb) p *(struct RString*)$15->name$20 = {basic = {flags = 39, klass = 182904016944}, len = 22,  ptr = 0x71aa70 "block in install_files", aux = {capa = 22, shared = 22}}(gdb) p *(struct RString*)$15->file_name$21 = {basic = {flags = 39, klass = 182904016944}, len = 31,  ptr = 0x67cbb0 "/home/aamine/c/yarv/lib/mkmf.rb", aux = {capa = 31,    shared = 31}}

やっぱり本物っぽいなあ……。

あ、T_REGEXP があった。

(gdb) rp $15->klass_nest_stackT_REGEXP$22 = {basic = {flags = 182903892776, klass = 6732336}, ptr = 0x2a95ee2010,  len = 131072, str = 0x2a95fe1890 ""}

なぜこんなところに正規表現が。

つづく

(09:08)

YARV のバグを追う (2)

longjmp で変数が壊れてる、で解決か?と一瞬思ったが全然関係なかった。くそう。

VALUE が malloc() した何らかの値にすりかわっているらしいことはわかった。ような気がする。単に壊れてるだけのような気もする。

あーもう! どこで壊れてんだよこれ! わからん! 寝る!

(01:28)

本日のツッコミ (全1件)

すぎむし [中味のスタイルを合わせて、正気のままで、ぜひ。 > べ、別に]


2005-12-25

RS/6000 type 7046 model B50

にゅー RS/6000 来た。

RS/6000 7046-B50 ですよ。ラックマウント黒匡体ですよ。PowerPC なのがちと惜しいが、値段は四桁のかなり前のほうだったのでよしとしよう。

仕様

CPU     PowerPC 604e 375MHzRAM     512MBHDD     IBM IC 18GB * 2Ether   10/100Base-T

なんとメモリが 512MB ものっていた。HDD も ATA ではあるが、マウンタつきの IC シリーズが二枚。ホットスワップ可能かどうかは知らん。

値段は詳しくは言えないが 4 桁の前のほう。この値段でいままでの倍速以上出るんだからとんでもないコストパフォーマンスだ。これまでが遅すぎたとかそういうことを言ってはいけない。このマシンなら ruby をビルドするのも楽になることだろう。

(23:54)

YARV: test/ruby を試してみる

ruby の test/ruby を全部試して core 7 個を採取。

(02:17)

本日のツッコミ (全2件)

mput [いいなー]

なかだ [core 7 個? > いいなー]


2005-12-26

26 日だからね

メリクリでした。

クリスマスは華麗にスルーするのがここでのたしなみ。

(15:11)


2005-12-30

ふつうの H

うむむ、hello, cat, head, tail, wc は簡単なんだがなあ。sort, uniq を練習問題にするのは意外と難しそうだ。高階関数の例として grep (filter) を使おうと思ったけど、Maybe と部分適用が必要になってしまうのでちょっと考え中。できればこの章は Maybe とか部分適用とか lambda とかなしで通過したいのだが、他にちょうどいいネタがない。

うーん……。tr でも作ったほうがいいかなあ……。ん、tr か、そうだ tr があった! tr なら map で済むよ!ああでもやっぱ部分適用と lambda なしだと変換文字列が固定になるな。そのへんはこのさい妥協するか。

(02:58)

ふつうの H

expand もいいかもしんない。

(03:00)

ふつうの H (3)

cat -n もいいなあ。zip の例題になりそう。

ちなみに最後の例題は LazyLines (Wiki) の予定。hello, cat, head, tail, echo, ... というラインナップからいきなり Wiki に飛ぶのは無理なので、言語仕様の例題として LazyLines のパーツを解説していって、最後にどかーんとまとめるような感じにしようかと思ってます。

……つーか、いまごろ「思ってる」だけじゃまずいんですが。

(03:29)

本日のツッコミ (全1件)

hyuki [『ふつうのH』すごく期待してます!絶対買います!がんばってください!]


2005-12-31

cvs, svn, svk

CVS と Subversion と svk が混じってるとどれを打てばいいのやら混乱してくる。CVS/ とか .svn があるかどうか見て自動判別するようなラッパーを書くべきか。しかしコマンドが少し違うから最終的には使い分けなきゃいかんのだよなあ。

(16:48)

ふつうの H: cat -n

やべ、気軽に printf を使ってしまったが GHC 6.2 には printf がなかった。6.2 と 6.4って意外と違うんだなあ。

Ruby のマイナーバージョンほどじゃないけどね。

(17:12)

struct st_table_entry の割り当て

struct st_table_entry はいまのところmalloc で普通に割り当ててる。これをある程度まとまった単位でmalloc するようにしたら速くなるんじゃないかと思ってやってみた。

結果

~/c/ruby % ./ruby.normal ../yarv/st-benchmark.rb 1000000                      user     system      total        realempty             0.110000   0.000000   0.110000 (  0.376736)ivar              0.500000   0.000000   0.500000 (  0.508973)hash/addrm        0.790000   0.000000   0.790000 (  0.794872)hash/add          0.080000   0.010000   0.090000 (  0.082135) ~/c/ruby % ./ruby.mempool ../yarv/st-benchmark.rb 1000000                      user     system      total        realempty             0.130000   0.000000   0.130000 (  0.133526)ivar              0.500000   0.000000   0.500000 (  0.508887)hash/addrm        0.760000   0.000000   0.760000 (  0.768688)hash/add          0.070000   0.000000   0.070000 (  0.077429)

差が出ない。Hash の要素を追加してはすぐ削除する hash/addrm あたり、もうちょっと差がつくかと思ったけどぜんぜん効果なし。空ループが遅くなっているのも気になる。

なぜか知らないが、YARV のほうがまだ効果が大きい (とある事情によりベンチマークは別コード)。

~/c/yarv % ./miniruby.normal st-benchmark.rb 1000000                      user     system      total        realempty             0.230000   0.000000   0.230000 (  0.234428)ivar              0.510000   0.000000   0.510000 (  0.510785)hash/addrm        0.690000   0.000000   0.690000 (  0.699603)hash/add          0.720000   0.030000   0.750000 (  0.755435) ~/c/yarv % ./miniruby.mempool st-benchmark.rb 1000000                      user     system      total        realempty             0.230000   0.000000   0.230000 (  0.233647)ivar              0.470000   0.000000   0.470000 (  0.479570)hash/addrm        0.610000   0.000000   0.610000 (  0.617374)hash/add          0.610000   0.030000   0.640000 (  0.646592)

かなり有利と思われる操作ばっかりやってこの差では、あんまり意味ないな。

(04:50)

st_table_entry の割り当て (2)

しかも SEGV

(04:50)


<前月 |最新 |次月>
2002|04|05|06|07|08|09|10|11|12|
2003|01|02|03|04|05|06|07|08|09|10|11|12|
2004|01|02|03|04|05|06|07|08|09|10|11|12|
2005|01|02|03|04|05|06|07|08|09|10|11|12|
2006|01|02|03|04|05|06|07|08|09|10|11|12|
2007|01|02|03|04|05|06|07|08|09|10|11|12|
2008|01|02|04|05|06|09|10|
2009|07|
2010|09|
Generated bytDiary version A

[8]ページ先頭

©2009-2025 Movatter.jp