[讨论] 自由讨论帖/建议帖/资料补充帖/马克帖(谢绝纯水)

RednaxelaFX 2010-02-12
不想开新帖,只是想做以下四种事的话回复这帖就好。

自由讨论:只要跟高级语言的实现相关就OK,当然涉及到解释器和虚拟机的最好。
建议:对圈子有啥想法?想了解些什么信息?
资料补充:我会把补充的资料整合到圈子里相应的资料帖中。
马克:就是马克……各种与高级语言实现相关的链接和引用都扔过来吧。

说真的,连这帖都在我的草稿箱里躺了一个多月……真是一杯具 =_=|||
lurker0 2010-02-17
建议:大家把没写完的草稿也扔出来吧。

这样看帖的人可以针对其中感兴趣的展开讨论,最后发帖人可以整理成自己的Blog。
我以前总以为写技术Blog总是要把事情说透彻,不然写出来误人子弟。
后来我据此实践后发现的后果是大部分的文稿都只是草稿,没有发布到Blog上。
所以我后来想是不是可以利用论坛(或者圈子)这种自由讨论的形式,
把一些不成熟的想法或者欠考证的稿子(哪怕是有不正确信息的)发布出来,回复参与讨论的人可能会对其中一部分特别了解的,可以提供新的素材,这样可以节省一下研究的时间。
有些主题发散性很大,比如虚拟机,一个人几乎是研究不完的,通过草稿的发布,可以第一时间引起大家的讨论,从而提炼出一些有意思的线索,以便于做深入的研究。
一点想法,欢迎拍砖。
RednaxelaFX 2010-02-18
嗯……顶楼上。
lurker0 写道
我以前总以为写技术Blog总是要把事情说透彻,不然写出来误人子弟。
后来我据此实践后发现的后果是大部分的文稿都只是草稿,没有发布到Blog上。

这准确的描述了我的窘境……于是,来吧!近期可能会把之前的一部分已经有些内容的草稿扔出来让大家慢慢踩然后再想办法整理成文。刚把一篇V8/Nitro相关的笔记的草稿放了出来。
RednaxelaFX 2010-03-02
刚在Windows XP上跑了一下SunSpider,用Opera 10.50和Chrome 4.0.249.89。
两者的结果是:
Opera 10.50
引用
http://www2.webkit.org/perf/sunspider-0.9/sunspider-results.html?{%223d-cube%22:[11,10,11,11,11],%223d-morph%22:[13,12,13,13,13],%223d-raytrace%22:[14,13,14,14,14],%22access-binary-trees%22:[4,4,3,4,4],%22access-fannkuch%22:[15,15,14,15,15],%22access-nbody%22:[9,9,9,9,8],%22access-nsieve%22:[4,4,4,5,4],%22bitops-3bit-bits-in-byte%22:[2,1,2,2,2],%22bitops-bits-in-byte%22:[3,3,3,3,2],%22bitops-bitwise-and%22:[2,1,1,1,2],%22bitops-nsieve-bits%22:[6,6,6,6,7],%22controlflow-recursive%22:[3,3,3,4,3],%22crypto-aes%22:[11,10,10,10,10],%22crypto-md5%22:[5,4,4,4,3],%22crypto-sha1%22:[2,2,2,2,3],%22date-format-tofte%22:[14,14,13,14,13],%22date-format-xparb%22:[41,23,24,23,23],%22math-cordic%22:[6,6,6,6,7],%22math-partial-sums%22:[21,20,20,20,19],%22math-spectral-norm%22:[5,4,5,4,5],%22regexp-dna%22:[11,11,11,11,11],%22string-base64%22:[20,20,20,21,20],%22string-fasta%22:[16,15,16,15,15],%22string-tagcloud%22:[28,28,28,28,28],%22string-unpack-code%22:[23,23,23,23,22],%22string-validate-input%22:[21,22,21,22,22]}

Chrome 4.0.249.89
引用
http://www2.webkit.org/perf/sunspider-0.9/sunspider-results.html?{%223d-cube%22:[17,17,20,19,19],%223d-morph%22:[25,20,20,21,21],%223d-raytrace%22:[20,18,18,19,18],%22access-binary-trees%22:[1,1,2,1,2],%22access-fannkuch%22:[11,10,11,11,12],%22access-nbody%22:[14,13,14,14,14],%22access-nsieve%22:[4,3,3,3,2],%22bitops-3bit-bits-in-byte%22:[2,2,2,2,2],%22bitops-bits-in-byte%22:[7,7,6,7,6],%22bitops-bitwise-and%22:[7,7,9,7,7],%22bitops-nsieve-bits%22:[12,13,13,13,11],%22controlflow-recursive%22:[2,2,2,2,2],%22crypto-aes%22:[11,7,6,7,7],%22crypto-md5%22:[8,8,8,9,8],%22crypto-sha1%22:[8,8,8,8,8],%22date-format-tofte%22:[23,24,22,23,23],%22date-format-xparb%22:[23,22,21,22,22],%22math-cordic%22:[15,14,13,14,14],%22math-partial-sums%22:[16,15,15,17,16],%22math-spectral-norm%22:[6,6,7,5,5],%22regexp-dna%22:[14,13,13,14,12],%22string-base64%22:[15,15,16,15,15],%22string-fasta%22:[21,21,21,21,21],%22string-tagcloud%22:[31,30,30,31,30],%22string-unpack-code%22:[46,44,44,45,44],%22string-validate-input%22:[26,22,22,23,2]}


直观的比较结果是:
TEST                   COMPARISON            FROM                 TO             DETAILS

=============================================================================

** TOTAL **:           1.26x as fast     365.8ms +/- 5.3%   291.0ms +/- 4.7%     significant

=============================================================================

  3d:                  1.56x as fast      58.4ms +/- 5.3%    37.4ms +/- 4.5%     significant
    cube:              1.70x as fast      18.4ms +/- 9.1%    10.8ms +/- 5.1%     significant
    morph:             1.67x as fast      21.4ms +/- 12.0%    12.8ms +/- 4.3%     significant
    raytrace:          1.35x as fast      18.6ms +/- 6.0%    13.8ms +/- 4.0%     significant

  access:              *1.08x as slow*    29.2ms +/- 5.6%    31.6ms +/- 4.5%     significant
    binary-trees:      *2.71x as slow*     1.4ms +/- 48.6%     3.8ms +/- 14.6%     significant
    fannkuch:          *1.35x as slow*    11.0ms +/- 8.0%    14.8ms +/- 3.8%     significant
    nbody:             1.57x as fast      13.8ms +/- 4.0%     8.8ms +/- 6.3%     significant
    nsieve:            *1.40x as slow*     3.0ms +/- 29.3%     4.2ms +/- 13.2%     significant

  bitops:              2.33x as fast      28.4ms +/- 6.6%    12.2ms +/- 8.5%     significant
    3bit-bits-in-byte: 1.11x as fast       2.0ms +/- 0.0%     1.8ms +/- 30.9%     significant
    bits-in-byte:      2.36x as fast       6.6ms +/- 10.3%     2.8ms +/- 19.9%     significant
    bitwise-and:       5.29x as fast       7.4ms +/- 15.0%     1.4ms +/- 48.6%     significant
    nsieve-bits:       2.00x as fast      12.4ms +/- 9.0%     6.2ms +/- 9.0%     significant

  controlflow:         *1.60x as slow*     2.0ms +/- 0.0%     3.2ms +/- 17.4%     significant
    recursive:         *1.60x as slow*     2.0ms +/- 0.0%     3.2ms +/- 17.4%     significant

  crypto:              1.45x as fast      23.8ms +/- 10.0%    16.4ms +/- 6.8%     significant
    aes:               *1.34x as slow*     7.6ms +/- 31.9%    10.2ms +/- 5.5%     significant
    md5:               2.05x as fast       8.2ms +/- 6.8%     4.0ms +/- 22.0%     significant
    sha1:              3.64x as fast       8.0ms +/- 0.0%     2.2ms +/- 25.3%     significant

  date:                1.11x as fast      45.0ms +/- 3.4%    40.4ms +/- 25.2%     significant
    format-tofte:      1.69x as fast      23.0ms +/- 3.8%    13.6ms +/- 5.0%     significant
    format-xparb:      *1.22x as slow*    22.0ms +/- 4.0%    26.8ms +/- 36.9%     significant

  math:                1.16x as fast      35.6ms +/- 3.1%    30.8ms +/- 3.4%     significant
    cordic:            2.26x as fast      14.0ms +/- 6.3%     6.2ms +/- 9.0%     significant
    partial-sums:      *1.27x as slow*    15.8ms +/- 6.6%    20.0ms +/- 4.4%     significant
    spectral-norm:     1.26x as fast       5.8ms +/- 17.9%     4.6ms +/- 14.8%     significant

  regexp:              1.20x as fast      13.2ms +/- 7.9%    11.0ms +/- 0.0%     significant
    dna:               1.20x as fast      13.2ms +/- 7.9%    11.0ms +/- 0.0%     significant

  string:              1.21x as fast     130.2ms +/- 10.0%   108.0ms +/- 0.8%     significant
    base64:            *1.33x as slow*    15.2ms +/- 3.7%    20.2ms +/- 2.8%     significant
    fasta:             1.36x as fast      21.0ms +/- 0.0%    15.4ms +/- 4.4%     significant
    tagcloud:          1.09x as fast      30.4ms +/- 2.2%    28.0ms +/- 0.0%     significant
    unpack-code:       1.96x as fast      44.6ms +/- 2.5%    22.8ms +/- 2.4%     significant
    validate-input:    ??                 19.0ms +/- 63.1%    21.6ms +/- 3.2%     not conclusive: might be *1.14x as slow*

from是Chrome,to是Opera。

Hmm,看起来Opera对数值计算是做了特别优化的,但在控制流和属性访问相关还是没有V8快。要是能再多了解点Carakan的细节的话……
RednaxelaFX 2010-03-11
马克俩东西,

BEA LiquidVM:
http://download.oracle.com/docs/cd/E13223_01/wls-ve/docs92-v11/config/lvmintro.html
http://dobbscodetalk.com/index.php?option=com_myblog&show=Oracle-BEAs-LiquidVM.html&Itemid=29

IBM Libra:
http://www.trl.ibm.com/people/kawatiya/pub/Ammons07vee.pdf
RednaxelaFX 2010-03-16
马克一个LtU帖:
Have tracing JIT compilers won?
http://lambda-the-ultimate.org/node/3851?a=1
<< 这个真的是信息非常浓缩的一帖,值得反复阅读和揣摩。LuaJIT没有论文,不过TraceMonkey和PyPy都有相应的论文描述其中的tracing JIT的做法和取舍点,Andreas Gal早期在KVM上做的tracing JIT和后来在J2VM之类的平台上做的也有一些文献,正好之前读过,再读这帖的时候可以清晰的感受到Andreas和Brendan Eich对战Mike Pall的时候双方都装满了了料,内容很充实。

引申马克一个关于编译优化顺序的帖:
Equality Saturation: A New Approach to Optimization
http://lambda-the-ultimate.org/node/3220

顺带把之前mryufeng老大引用的reddit帖的原帖马克一下:
LuaJIT 2 beta 3 is out: Support both x32 & x64
http://www.reddit.com/r/programming/comments/badl2/luajit_2_beta_3_is_out_support_both_x32_x64/c0lrus0

还有就是LuaJIT的基本设计帖:
LuaJIT 2.0 intellectual property disclosure and research opportunities
http://lua-users.org/lists/lua-l/2009-11/msg00089.html

The Secret Art of Futamura Projection
http://www.cubiclemuses.com/cm/blog/archives/000419.html/

Tagless Staged Interpreters for Simpler Typed Languages
http://lambda-the-ultimate.org/node/2438

7th Workshop on Compiler-Driven Performance

http://books.google.com/books?id=Sct_SUe7NXgC&pg=PA580&lpg=PA580&dq=tasuki+lock&source=bl&ots=tlgV0E4Byp&sig=WAXiGvsD12IYh1xPyt1W1bhnO9c&hl=en&ei=_h2UTYemIo70caGT9Z4H&sa=X&oi=book_result&ct=result&resnum=4&ved=0CCoQ6AEwAw#v=onepage&q=tasuki%20lock&f=false
Java locks ECOOP 2004
RednaxelaFX 2010-03-21
虚拟机加密真是有趣……
高性能HLL VM在不断追求消除中间代码的影响,而虚拟机加密则正好相反,硬要插入一个间接层来干扰分析。对应的逆向工程却也是用trace来分析。
RednaxelaFX 2010-03-23
马克一组工具的链接:

Eclipse Memory Analyzer
http://www.eclipse.org/mat/
http://wiki.eclipse.org/index.php/MemoryAnalyzer

其它的回头加……
RednaxelaFX 2010-04-18
今天翻出这篇论文来读:
The GC Interface in the EVM
里面有段话以前读的时候没留意到,这次读觉得真是喜感:
引用
The Java(TM) Technology Research Group (originally known as Java Topics) was formed late in 1995 to develop expertise in Java garbage collection (GC). The founding members of the group, Guy Steele, Derek White and Steve Heller, were joined by Ole Agesen during the summer of 1996, and we set the goal to explore soft real-time GC, probabilistically meeting real time constraints. We wanted to "solve the Java GC problem," but we soon realized that Java didn't have a GC problem. Java implementations at the time were so slow that GC was not the weakest link. We set out to build a high-performance Java(TM) Virtual Machine (JVM) that would have a GC problem so that we could solve it. And we carefully designed this JVM to facilitate GC experimentation.

真是强悍的研究员们……

顺带挖老文,超古老的文档(JDK 1.3时代的)
JDK Documentation: Why Developers Should Not Write Programs That Call 'sun' Packages
引用
The classes that Sun includes with the Java 2 SDK, Standard Edition, fall into package groups java.*, javax.*, org.* and sun.*. All but the sun.* packages are a standard part of the Java platform and will be supported into the future. In general, packages such as sun.*, that are outside of the Java platform, can be different across OS platforms (Solaris, Windows, Linux, Macintosh, etc.) and can change at any time without notice with SDK versions (1.2, 1.2.1, 1.2.3, etc). Programs that contain direct calls to the sun.* packages are not 100% Pure Java. In other words:

The java.*, javax.* and org.* packages documented in the Java 2 Platform Standard Edition API Specification make up the official, supported, public interface.
If a Java program directly calls only API in these packages, it will operate on all Java-compatible platforms, regardless of the underlying OS platform.

The sun.* packages are not part of the supported, public interface.
A Java program that directly calls into sun.* packages is not guaranteed to work on all Java-compatible platforms. In fact, such a program is not guaranteed to work even in future versions on the same platform.

For these reasons, there is no documentation available for the sun.* classes. Platform-independence is one of the great advantages of developing in the Java programming language. Furthermore, Sun and our licensees of Java technology are committed to maintaining backward compatibility of the APIs for future versions of the Java platform. (Except for code that relies on serious bugs that we later fix.) This means that once your program is written, the class files will work in future releases.

Each company that implements the Java platform will do so in their own private way. The classes in sun.* are present in the SDK to support the Sun implementation of the Java platform: the sun.* classes are what make the Java platform classes work "under the covers" for the Sun Java 2 SDK. These classes will not in general be present on another vendor's Java platform. If your Java program asks for a class "sun.package.Foo" by name, it may fail with ClassNotFoundError, and you will have lost a major advantage of developing in Java.

Technically, nothing prevents your program from calling into sun.* by name. From one release to another, these classes may be removed, or they may be moved from one package to another, and it's fairly likely that their interface (method names and signatures) will change. (From the Sun point of view, since we are committed to maintaining the Java platform, we need to be able to change sun.* to refine and enhance the platform.) In this case, even if you are willing to run only on the Sun implementation, you run the risk of a new version of the implementation breaking your program.

In general, writing java programs that rely on sun.* is risky: they are not portable, and are not supported.


继续挖,1.2.2_017的文档里说的:
Release Notes: Java 2 SDK, Standard Edition, Version 1.2.2_017 (Microsoft Windows, Linux and Solaris Reference and Version 1.2.2_17 (Solaris Production)
引用
-Xoptimize Command-line Option
The -X options provided in each release are specific to the VM implementation in that release and are subject to change in subsequent releases.
The virtual machine (VM) in version 1.2.2_11 (and prior versions) of the Java 2 SDK, Standard Edition, recognizes the experimental -Xoptimize command-line option. Subsequent update versions of the Java 2 SDK 1.2.2 do not and will not have the -Xoptimize option, and the use of this flag is strongly discouraged. Performance results using this flag have been very mixed, and there have been failures associated with its use.

Use of more recent releases of the Java 2 SDK such as versions 1.3.1 and 1.4.1 is strongly encouraged. These versions have many performance and reliability improvements as compared with version 1.2.2, and they are a better choice for deployment.

-Xoptimize这个flag貌似也只能在Solaris版的JDK上使用。它的说明是“Use optimizing JIT compiler (SPARC only)”。还有个相关的flag叫“jbe”,不知道是啥来的

Sun JDK里VM的文档链接收集:
The Java HotSpot Performance Engine: An In-Depth Look By Steve Meloan (June 1999)
The Java HotSpotTM Server VM: The Solution for Reliable, Secure Performance for the Enterprise
1.3
1.4.2
1.5.0
6

Java SE 6的fatal error log文档

ergo
http://java.sun.com/docs/hotspot/gc5.0/ergo5.html
http://www.oracle.com/technetwork/java/javase/6u18-142093.html

呃,virtual stack frame ("vframe")对HotSpot的安全性stack walking也有用么。
HotSpot在Solaris上也有过使用N-M线程模型的时候:HotSpot Thread Implementation (Solaris)

JPRT: JDK Performance Reliability Test
KTO
JPRT: Build/Test System for the JDK
PRT: Sun Hardware is so COOL!
PRT
IMGR
引用
Many people don't realize that building products like the JDK often require the use of very old OS releases, so that the resulting built product is capable of running on the largest set of OS releases (the least common platform story). And that once a product is shipped being built on a platform, that build platform must be pretty much frozen and kept available for all future update and patch builds. So build platforms are typically old and don't go away for a long time.


HotSpot MVM
Janice J. Heiss: The Multi-Tasking Virtual Machine: Building a Highly Scalable JVM 2005-03-22
JSR 121

Joseph D. Mocker: A Collection of JVM Options2007-08-28

引用
Starting with Java 5, the HotSpot JVM has included a feature known as Class Data Sharing (CDS). Originally created by Apple for their OS X version of HotSpot, this feature loads all the common JDK classes as a single archive into a shared memory location. Subsequent JVM startups then simply reuse this read-only shared memory rather than reloading the same data again. It's a large reason why startup times on Windows and OS X have been so much better in recent years, and users of those systems may be able to ignore this tip.


http://not.freedsoftware.org/lemote-misc/dvd-distributed-with-system/disc/system/usr/share/doc/sun-j2sdk1.5/safepoint.txt
引用
The VMThread or CMS_thread uses the SafepointSynchronize::begin/end methods to enter/exit
a safepoint region. The begin method will roll all JavaThreads forward to a safepoint.

  JavaThreads must use the ThreadSafepointState abstraction to indicate that that they are at a safepoint.

  The Mutex/Condition variable and ObjectLocker classes calls the enter/exit safepoint methods,
when a thread is blocked/restarted. Hence, all mutex enter/exit points *must* be at a safepoint.

每个java线程都有一个关联的ThreadSafepointState对象(safepoint_state())来表明它的状态。

和safepoint关联的几个配置常数是SafepointPolling、UseCompilerSafepoints、TraceSafepoint、PrintSafepointStatistics、UseLoopSafepoints、GuaranteedSafepointInterval、SafepointTimeoutDelay、MaxICLEStubsBeforeSafepoint、SafepointALot、StrictSafepointChecks、UseStrictCompilerSafepoints、ShowSafepointMsgs、SafepointTimeout、DieOnSafepointTimeout

在产生函数返回的代码时,如果SafepointPolling为真,会产生一个poll_return_type类型的重定位和一个对os::get_polling_page()的load


JDK 1.1 Compability
RednaxelaFX 2010-04-18
想不到我的某个老帖居然还有英文翻译版……真是GJ
Global site tag (gtag.js) - Google Analytics