Walrus,Visit. | 一覧 | 検索 | 更新履歴(RSS) | 新規作成
はてなブックマークに追加 はてなブックマークを表示 編集 | 編集(管理者用) | 差分

ヤマケン

編集

Linuxザウルスで遊んだり遊ばれたり。最近はSL-6000にお熱。

Walrus,Visit.に間借りしてLinuxザウルス開発メモを書いてみるテスト中。

メール: YamaKen <yamaken at bp.iij4u.or.jp>

関連ページ

編集

関わっているソフトウェア

アンテナ他

anthy

[[#antenna:anthy(3)]]

zaurus-ja

[[#antenna:zaurus-ja(3)]]

はてなアンテナ

使いはじめてみました。まだエントリは少ないです。登録してあるページの傾向から見ておすすめのページがあったら教えて下さい。

amazon.co.jpコミュニティ

試しに作ってみました。

日記

いまのところ開発日記風味。お気軽にツッコミを入れてください。

XML

Javaを使わずに一通りのXML環境を揃えられるか? できればC/C++で書かれたものがよい。

パーサ

  • libxml2
  • Expat 非検証パーサ
  • Xerces 検証パーサ
    • XML Schema, XIncludeのサポートあり
    • でかい。libxercesはstripped i386 binaryで3MBある

XSLT

  • libxslt
  • xsltprocコマンドで変換可能。

  • Xalan
    • Xalan_C++_Command-Line_Utility
    • Passing_in_a_Xerces_DOM_to_a_transformation
    • XalanTransformer?::transform()
    • XalanとXercesそれぞれにDOMを実現する抽象クラス群があり、XalanではXerces DOMにXalanの皮をかぶせて使っている。DOMDocument(Xerces)→XalanDocument?といった対応が大量にある。正直勘弁して欲しい。DOMはXercesに任せとけよ…と思ってる人はやっぱり多いらしい

XSL-FO

SVG

  • librsvg2
  • 2になってだいぶ中身が変わったらしい。rsvgコマンドでPNGまたはJPEGにレンダリング可能。

  • グラフ等をSVGで生成するためのライブラリが色々あるが、Perlで書かれていたり独自構文のテキストからの変換だったりする。XMLからXSLTでSVGに変換するものが欲しい

XMLデータベース

  • Berkeley_DB_XML
    • opensourceと商用のデュアルライセンス。opensourceライセンス下で利用する場合はGPLとコンパチブルとの事
    • FAQ等
    • パーサとしてXerces、XPath処理にPathanを使っている。開発段階ではExpatもサポートしていたらしいが削除された
    • Ruby_interface
      • BDB::XML
      • 0.4.4の時点ではXerces DOMは取れない。C++ APIと同名のDocumentクラスでattrやtextにアクセスしたりserializeしたりするだけ。このツリーをそのまま他のXSLTモジュール等に渡せるか?
      • RubyにはXercesもXalanもモジュールが存在しない
      • RubyにおけるDOMの参考資料: XMLinRuby
    • DOMDocument *Document::getDOM(XercesDOMParser &xmlParser, bool withMetaData?) const
  • 他にXindiceeXistもあるが、いずれもJavaで書かれているので扱いづらい

.NET

MS本家の情報

Common_Language_Runtime_(CLR)

  • Code that you develop with a language compiler that targets the runtime is called managed code
  • language compilers must emit metadata that describes the types, members, and references in your code
  • every loadable common language runtime portable executable (PE) file contains metadata
  • The runtime uses metadata to locate and load classes, lay out instances in memory, resolve method invocations, generate native code, enforce security, and set run-time context boundaries
  • The runtime automatically handles object layout and manages references to objects, releasing them when they are no longer being used. Objects whose lifetimes are managed in this way are called managed data
  • If your code is managed, you can use managed data, unmanaged data, or both managed and unmanaged data in your .NET Framework application
  • Objects written in different languages can communicate with each other
  • language compilers and tools that target the runtime use a common type system defined by the runtime, and they follow the runtime's rules for defining new types, as well as for creating, using, persisting, and binding to types
  • TODO: 'memory constraints'について調べる
  • As part of their metadata, all managed components carry information about the components and resources they were built against (dependencies)
  • Registration information and state data are no longer stored in the registry where they can be difficult to establish and maintain
  • During execution, managed code receives services such as garbage collection, security, interoperability with unmanaged code, cross-language debugging support, and enhanced deployment and versioning support
  • In Microsoft Windows XP, the operating system loader checks for managed modules by examining a bit in the common object file format (COFF) header. The bit being set denotes a managed module

Microsoft Intermediate Language (MSIL)

  • When compiling to managed code, the compiler translates your source code into Microsoft intermediate language (MSIL), which is a CPU-independent set of instructions that can be efficiently converted to native code
  • MSIL includes instructions for loading, storing, initializing, and calling methods on objects, as well as instructions for arithmetic and logical operations, control flow, direct memory access, exception handling, and other operations
  • MSIL must be converted to CPU-specific code, usually by a just-in-time_(JIT)_compiler
  • the common language runtime supplies one or more JIT compilers for each computer architecture it supports
  • The presence of metadata in the file along with the MSIL enables your code to describe itself, which means that there is no need for type libraries or Interface Definition Language (IDL)
  • your managed code will run only on a specific operating system if it calls platform-specific native APIs, or a platform-specific class library
  • Rather than using time and memory to convert all the MSIL in a portable executable (PE) file to native code, it converts the MSIL as needed during execution and stores the resulting native code so that it is accessible for subsequent calls
  • The runtime supplies another mode of compilation called install-time code generation
  • When using install-time code generation, the entire assembly that is being installed is converted into native code, taking into account what is known about other assemblies that are already installed. The resulting file loads and starts more quickly
  • As part of compiling MSIL to native code, code must pass a verification process unless an administrator has established a security policy that allows code to bypass verification

Automatic_Memory_Management

  • When you initialize a new process, the runtime reserves a contiguous region of address space for the process. This reserved address space is called the managed heap
  • All reference types are allocated on the managed heap
  • The garbage collector's optimizing engine determines the best time to perform a collection based on the allocations being made
  • As it discovers each unreachable object, it uses a memory-copying function to compact the reachable objects in memory, freeing up the blocks of address spaces allocated to unreachable objects
  • Once the memory for the reachable objects has been compacted, the garbage collector makes the necessary pointer corrections so that the application's roots point to the objects in their new locations
  • Note that memory is compacted only if a collection discovers a significant number of unreachable objects
  • To optimize the performance of the garbage collector, the managed heap is divided into three generations: 0, 1, and 2
  • The runtime's garbage collector stores new objects in generation 0. Objects created early in the application's lifetime that survive collections are promoted and stored in generations 1 and 2
  • this scheme allows the garbage collector to release the memory in a specific generation rather than release the memory for the entire managed heap each time it performs a collection
  • The garbage collector starts by examining the objects in generation 0 rather than all objects in the managed heap. This is the most efficient approach, because new objects tend to have short lifetimes
  • When you create an object that encapsulates an unmanaged resource, it is recommended that you provide the necessary code to clean up the unmanaged resource in a public Dispose method

Perl6

O'Reilly Safari_bookshelfPerl_6_Essentialsをsubscribeして拾い読み。こういう時事ネタ本を安く読み捨てできるのがSafariのいいところ。

文法

  • かなりRubyっぽくなった
  • @、%は残っているが、「変数名の一部」として扱われるようになった。$h{'key'}ではなく、%h{'key'}でOK
  • @a.length, %h.kvといった表記が可能
  • ファイルハンドルが通常のオブジェクト(ordinary object)になり、普通に変数に代入できるようになった
  • 英語センス的にはRubyより好ましい部分が多い。例えばRubyのcase〜whenにそっくりな制御構造が導入されたが、Perlではgiven〜whenと自然な英語になっている。
  • さんざん落し穴を掘ってくれた「コンテキスト」は健在。scalar, listだけでなく、boolean, numeric, string, object, それに加えてflattening listやらlazy listといった恐しげなコンテキストが大量導入されている
  • 変数に制限事項を加える"trait"と値に加える"property"が導入されている。一見便利そうだが新たな頭痛の種になりそうな気がする
    • trait
$hoge is constant = 14;
    • property
$true = 0 but true;
  • Perl5の緩やかなオブジェクト指向サポートと違い、普通の言語っぽくクラス定義できるようになった
  • attributes(instance variables)には"."を付ける
class Hoge {
  has $.fuga;
  has $.moga is public;  #traitを使ったアクセス制御
}

Parrot

  • JIT付きVM
  • 単純な操作は1CPUインストラクションに対応する
  • 7種類のスタックを持つ
  • 4種類のレジスタを持つ。Integer(I), floating point Number(N), String(S), Parrot Magic Cookies(P)それぞれ0〜31の32レジスタを持つ。
I0
N31
S14
P26
  • Parrot assembly languageは以下のように表記される
[label] opcode dest, source, source, ...
    • 返値がある場合はdestに入る
    • sourceはconstantでも可
    • 最初の引数がdestとsourceを兼ねる場合がある
  • "print"や"seek"がopcode扱いなのがイヤな感じ。標準入出力うんぬんはもっと上の層で扱ってほしい(Cのように)。opcodeにもcoreとそれ以外といった区分があるようなので要調査
    • hoge.opsというファイルを作れば独自opcodeを定義できるらしい(どの時点で?)
  • parrot/languagesの下に色々な言語のコンパイラが用意されている。実用度は不明
    • perl6
    • parrot_compiler
    • imcc
    • miniperl
    • python
    • ruby
    • scheme
    • regex
    • forth
    • BASIC
  • CPUアーキテクチャ毎に定義されたopcode別のマシンコード生成関数(マクロもあり)を呼ぶと、メモリ上にマシンコードを書き出すようになっている。アーキテクチャ依存のアセンブリや中間コードは介さず、バイトコードのopcode毎に定義されたマシンコード列生成関数でまとめてゴリゴリと書き出される。この方法ではマシンコードレベルの最適化が効かないが、GCCと連携するような仕組があるらしいので、そちらで何とかするのかもしれない。詳細はまだ調べていない

用語

IMCC
Intermediate Code Compiler
PIR
Parrot Intermediate Language

その他

  • Googleで Parrot, Ruby, Rite, JVM, CLR等の単語を組み合わせて検索すると色々引っかかる
  • CLR, Parrotと調べたから、ついでにInferno, QEMU, GNU Lightningあたりも調べてみるといいかもしれない。余力があればGNU PrologやSqueakも?

プログラミング言語関連

自然言語処理?

コメント

私の記録は無記名でやってるので、区別するためお名前を入れて下さい。

お名前: コメント: 更新