K.Sasada's Home Page

Diary - 2005 June

研究日記

水無月

_30(Thu)

評価の合間に読んでいたハリーポッターを読みきってしまった orz


明示的に変数(の値)の生存範囲を指定できればいいのに。現在ではこれをやるために

{
  VALUE v = x;
  ...
}
{
  VALUE v = y;
  ...
}

と、ブロックを切ってやってるんだけど、gcc はそれぞれ別の領域を割り当ててしまう。つまり、上記ブロックが大量に、1000個くらいあると、1000個の領域をスタックから取ってしまう。

だけど、

VALUE v;
{
  v = x;
}
{
  v = y;
}

にすると、コンパイラの最適化が難しくなりそうな気がするんだけれど。きちんと代入によって分けてくれるかな。


あれ、単純な例だと再現しない。


よくよく調べてみると、きちんと共有できるところは共有してた。

[[-1220, [["epc:(1,11)", 109], ["epc:(1,11)", 109]]],
 [-1216,
  [["len:(0,1)", 7987],
   ["len:(0,1)", 8068],
   ["len:(0,1)", 8149],
   ["len:(0,1)", 8230]]],
 [-1212,
  [["iseqobj:(55,21)", 108],
   ["len:(0,1)", 831],
   ["len:(0,1)", 7906],
   ["iseqobj:(55,21)", 108]]],
 [-1200, [["cont_sp:(1,11)", 109], ["cont_sp:(1,11)", 109]]],
 [-1196, [["cont:(1,11)", 109], ["cont:(1,11)", 109]]],
 [-1192, [["catch_iseq:(2,1)", 107], ["catch_iseq:(2,1)", 107]]],
 [-1188, [["val_1:(2,1)", 22789], ["val_1:(2,1)", 22789]]],
 [-1184, [["val_1:(2,1)", 22723], ["val_1:(2,1)", 22723]]],
 [-1180, [["val_1:(2,1)", 22657], ["val_1:(2,1)", 22657]]],
 [-1176, [["val_1:(2,1)", 22591], ["val_1:(2,1)", 22591]]],
 [-1172, [["val_1:(2,1)", 22525], ["val_1:(2,1)", 22525]]],
 [-1168,
  [["prev_lfp:(2,13)", 15088],
   ["prev_lfp:(2,13)", 15088],
   ["prev_lfp:(2,13)", 15088]]],
 [-1164,
  [["prev_dfp:(2,13)", 15088],
   ["prev_dfp:(2,13)", 15088],
   ["prev_dfp:(2,13)", 15088]]],
 [-1160,
  [["iseq:(2,1)", 15087], ["iseq:(2,1)", 15087], ["iseq:(2,1)", 15087]]],
 [-1156,
  [["prev_lfp:(2,13)", 14994],
   ["prev_lfp:(2,13)", 14994],
   ["prev_lfp:(2,13)", 14994]]],
 [-1152,
  [["prev_dfp:(2,13)", 14994],
   ["prev_dfp:(2,13)", 14994],
   ["prev_dfp:(2,13)", 14994]]],
 [-1148,
  [["iseq:(2,1)", 14993], ["iseq:(2,1)", 14993], ["iseq:(2,1)", 14993]]],
 [-1144,
  [["prev_lfp:(2,13)", 14900],
   ["prev_lfp:(2,13)", 14900],
   ["prev_lfp:(2,13)", 14900]]],
 [-1140,
  [["prev_dfp:(2,13)", 14900],
   ["prev_dfp:(2,13)", 14900],
   ["prev_dfp:(2,13)", 14900]]],
 [-1136,
  [["iseq:(2,1)", 14899], ["iseq:(2,1)", 14899], ["iseq:(2,1)", 14899]]],
 [-1132,
  [["prev_lfp:(2,13)", 14807],
   ["prev_lfp:(2,13)", 14807],
   ["prev_lfp:(2,13)", 14807]]],
 [-1128,
  [["prev_dfp:(2,13)", 14807],
   ["prev_dfp:(2,13)", 14807],
   ["prev_dfp:(2,13)", 14807]]],
 [-1124,
  [["iseq:(2,1)", 14806], ["iseq:(2,1)", 14806], ["iseq:(2,1)", 14806]]],
 [-1120,
  [["prev_lfp:(2,13)", 14714],
   ["prev_lfp:(2,13)", 14714],
   ["prev_lfp:(2,13)", 14714]]],
 [-1116,
  [["prev_dfp:(2,13)", 14714],
   ["prev_dfp:(2,13)", 14714],
   ["prev_dfp:(2,13)", 14714]]],
 [-1112,
  [["iseq:(2,1)", 14713], ["iseq:(2,1)", 14713], ["iseq:(2,1)", 14713]]],
 [-1108,
  [["clear_local_size:(0,1)", 14213],
   ["clear_local_size:(0,1)", 14213],
   ["clear_local_size:(0,1)", 14213]]],
 [-1104,
  [["opt_pc:(0,1)", 14212], ["opt_pc:(0,1)", 14212], ["opt_pc:(0,1)", 14212]]],
 [-1100,
  [["newiseq:(2,1)", 14210],
   ["newiseq:(2,1)", 14210],
   ["newiseq:(2,1)", 14210]]],
 [-1096,
  [["niseqobj:(55,21)", 14209],
   ["niseqobj:(55,21)", 14209],
   ["niseqobj:(55,21)", 14209]]],
 [-1092,
  [["num:(1,11)", 14008],
   ["num:(1,11)", 14008],
   ["num:(1,11)", 14008],
   ["num:(1,11)", 14008]]],
 [-1088,
  [["block_ptr:(51,5)", 14007],
   ["block_ptr:(51,5)", 14007],
   ["block_ptr:(51,5)", 14007],
   ["block_ptr:(51,5)", 14007]]],
 [-1084,
  [["klass:(2,1)", 14006],
   ["klass:(2,1)", 14006],
   ["klass:(2,1)", 14006],
   ["klass:(2,1)", 14006]]],
 [-1080,
  [["procblock:(2,1)", 14005],
   ["procblock:(2,1)", 14005],
   ["procblock:(2,1)", 14005],
   ["procblock:(2,1)", 14005]]],
 [-1076,
  [["recv:(2,1)", 14004],
   ["recv:(2,1)", 14004],
   ["recv:(2,1)", 14004],
   ["recv:(2,1)", 14004]]],
 [-1072,
  [["id:(2,2)", 13986],
   ["id:(2,2)", 13986],
   ["id:(2,2)", 13986],
   ["id:(2,2)", 13986]]],
 [-1068,
  [["block:(2,1)", 13984],
   ["block:(2,1)", 13984],
   ["block:(2,1)", 13984],
   ["block:(2,1)", 13984]]],
 [-1064,
  [["ic:(55,29)", 13982],
   ["ic:(55,29)", 13982],
   ["ic:(55,29)", 13982],
   ["ic:(55,29)", 13982]]],
 [-1060,
  [["clear_local_size:(0,1)", 13805],
   ["clear_local_size:(0,1)", 13805],
   ["clear_local_size:(0,1)", 13805]]],
 [-1056,
  [["opt_pc:(0,1)", 13804], ["opt_pc:(0,1)", 13804], ["opt_pc:(0,1)", 13804]]],
 [-1052,
  [["newiseq:(2,1)", 13802],
   ["newiseq:(2,1)", 13802],
   ["newiseq:(2,1)", 13802]]],
 [-1048,
  [["niseqobj:(55,21)", 13801],
   ["niseqobj:(55,21)", 13801],
   ["niseqobj:(55,21)", 13801]]],
 [-1044,
  [["num:(1,11)", 13600],
   ["num:(1,11)", 13600],
   ["num:(1,11)", 13600],
   ["num:(1,11)", 13600]]],
 [-1040,
  [["block_ptr:(51,5)", 13599],
   ["block_ptr:(51,5)", 13599],
   ["block_ptr:(51,5)", 13599],
   ["block_ptr:(51,5)", 13599]]],
 [-1036,
  [["klass:(2,1)", 13598],
   ["klass:(2,1)", 13598],
   ["klass:(2,1)", 13598],
   ["klass:(2,1)", 13598]]],
 [-1032,
  [["procblock:(2,1)", 13597],
   ["procblock:(2,1)", 13597],
   ["procblock:(2,1)", 13597],
   ["procblock:(2,1)", 13597]]],
 [-1028,
  [["recv:(2,1)", 13596],
   ["recv:(2,1)", 13596],
   ["recv:(2,1)", 13596],
   ["recv:(2,1)", 13596]]],
 [-1024,
  [["id:(2,2)", 13578],
   ["id:(2,2)", 13578],
   ["id:(2,2)", 13578],
   ["id:(2,2)", 13578]]],
 [-1020,
  [["block:(2,1)", 13576],
   ["block:(2,1)", 13576],
   ["block:(2,1)", 13576],
   ["block:(2,1)", 13576]]],
 [-1016,
  [["ic:(55,29)", 13574],
   ["ic:(55,29)", 13574],
   ["ic:(55,29)", 13574],
   ["ic:(55,29)", 13574]]],
 [-1012,
  [["clear_local_size:(0,1)", 13397],
   ["clear_local_size:(0,1)", 13397],
   ["clear_local_size:(0,1)", 13397]]],
 [-1008,
  [["opt_pc:(0,1)", 13396], ["opt_pc:(0,1)", 13396], ["opt_pc:(0,1)", 13396]]],
 [-1004,
  [["newiseq:(2,1)", 13394],
   ["newiseq:(2,1)", 13394],
   ["newiseq:(2,1)", 13394]]],
 [-1000,
  [["niseqobj:(55,21)", 13393],
   ["niseqobj:(55,21)", 13393],
   ["niseqobj:(55,21)", 13393]]],
 [-996,
  [["num:(1,11)", 13192],
   ["num:(1,11)", 13192],
   ["num:(1,11)", 13192],
   ["num:(1,11)", 13192]]],
 [-992,
  [["block_ptr:(51,5)", 13191],
   ["block_ptr:(51,5)", 13191],
   ["block_ptr:(51,5)", 13191],
   ["block_ptr:(51,5)", 13191]]],
 [-988,
  [["klass:(2,1)", 13190],
   ["klass:(2,1)", 13190],
   ["klass:(2,1)", 13190],
   ["klass:(2,1)", 13190]]],
 [-984,
  [["procblock:(2,1)", 13189],
   ["procblock:(2,1)", 13189],
   ["procblock:(2,1)", 13189],
   ["procblock:(2,1)", 13189]]],
 [-980,
  [["recv:(2,1)", 13188],
   ["recv:(2,1)", 13188],
   ["recv:(2,1)", 13188],
   ["recv:(2,1)", 13188]]],
 [-976,
  [["id:(2,2)", 13170],
   ["id:(2,2)", 13170],
   ["id:(2,2)", 13170],
   ["id:(2,2)", 13170]]],
 [-972,
  [["block:(2,1)", 13168],
   ["block:(2,1)", 13168],
   ["block:(2,1)", 13168],
   ["block:(2,1)", 13168]]],
 [-968,
  [["ic:(55,29)", 13166],
   ["ic:(55,29)", 13166],
   ["ic:(55,29)", 13166],
   ["ic:(55,29)", 13166]]],
 [-964,
  [["clear_local_size:(0,1)", 12990],
   ["clear_local_size:(0,1)", 12990],
   ["clear_local_size:(0,1)", 12990]]],
 [-960,
  [["opt_pc:(0,1)", 12989], ["opt_pc:(0,1)", 12989], ["opt_pc:(0,1)", 12989]]],
 [-956,
  [["newiseq:(2,1)", 12987],
   ["newiseq:(2,1)", 12987],
   ["newiseq:(2,1)", 12987]]],
 [-952,
  [["niseqobj:(55,21)", 12986],
   ["niseqobj:(55,21)", 12986],
   ["niseqobj:(55,21)", 12986]]],
 [-948,
  [["num:(1,11)", 12785],
   ["num:(1,11)", 12785],
   ["num:(1,11)", 12785],
   ["num:(1,11)", 12785]]],
 [-944,
  [["block_ptr:(51,5)", 12784],
   ["block_ptr:(51,5)", 12784],
   ["block_ptr:(51,5)", 12784],
   ["block_ptr:(51,5)", 12784]]],
 [-940,
  [["klass:(2,1)", 12783],
   ["klass:(2,1)", 12783],
   ["klass:(2,1)", 12783],
   ["klass:(2,1)", 12783]]],
 [-936,
  [["procblock:(2,1)", 12782],
   ["procblock:(2,1)", 12782],
   ["procblock:(2,1)", 12782],
   ["procblock:(2,1)", 12782]]],
 [-932,
  [["recv:(2,1)", 12781],
   ["recv:(2,1)", 12781],
   ["recv:(2,1)", 12781],
   ["recv:(2,1)", 12781]]],
 [-928,
  [["id:(2,2)", 12763],
   ["id:(2,2)", 12763],
   ["id:(2,2)", 12763],
   ["id:(2,2)", 12763]]],
 [-924,
  [["block:(2,1)", 12761],
   ["block:(2,1)", 12761],
   ["block:(2,1)", 12761],
   ["block:(2,1)", 12761]]],
 [-920,
  [["ic:(55,29)", 12759],
   ["ic:(55,29)", 12759],
   ["ic:(55,29)", 12759],
   ["ic:(55,29)", 12759]]],
 [-916, [["pack_size:(0,1)", 12610], ["pack_size:(0,1)", 12610]]],
 [-912,
  [["opt_pc:(0,1)", 12582], ["opt_pc:(0,1)", 12582], ["opt_pc:(0,1)", 12582]]],
 [-908,
  [["newiseq:(2,1)", 12580],
   ["newiseq:(2,1)", 12580],
   ["newiseq:(2,1)", 12580]]],
 [-904,
  [["niseqobj:(55,21)", 12579],
   ["niseqobj:(55,21)", 12579],
   ["niseqobj:(55,21)", 12579]]],
 [-900,
  [["num:(1,11)", 12378],
   ["num:(1,11)", 12378],
   ["num:(1,11)", 12378],
   ["num:(1,11)", 12378],
   ["num:(1,11)", 12378],
   ["num:(1,11)", 12378],
   ["num:(1,11)", 12378]]],
 [-896,
  [["block_ptr:(51,5)", 12377],
   ["block_ptr:(51,5)", 12377],
   ["block_ptr:(51,5)", 12377],
   ["block_ptr:(51,5)", 12377],
   ["block_ptr:(51,5)", 12377],
   ["block_ptr:(51,5)", 12377],
   ["block_ptr:(51,5)", 12377]]],
 [-892,
  [["klass:(2,1)", 12376],
   ["klass:(2,1)", 12376],
   ["klass:(2,1)", 12376],
   ["klass:(2,1)", 12376],
   ["klass:(2,1)", 12376],
   ["klass:(2,1)", 12376],
   ["klass:(2,1)", 12376]]],
 [-888,
  [["procblock:(2,1)", 12375],
   ["procblock:(2,1)", 12375],
   ["procblock:(2,1)", 12375],
   ["procblock:(2,1)", 12375],
   ["procblock:(2,1)", 12375],
   ["procblock:(2,1)", 12375],
   ["procblock:(2,1)", 12375]]],
 [-884,
  [["recv:(2,1)", 12374],
   ["recv:(2,1)", 12374],
   ["recv:(2,1)", 12374],
   ["recv:(2,1)", 12374],
   ["recv:(2,1)", 12374],
   ["recv:(2,1)", 12374],
   ["recv:(2,1)", 12374]]],
 [-880,
  [["id:(2,2)", 12356],
   ["id:(2,2)", 12356],
   ["id:(2,2)", 12356],
   ["id:(2,2)", 12356],
   ["id:(2,2)", 12356],
   ["id:(2,2)", 12356],
   ["id:(2,2)", 12356]]],
 [-876,
  [["block:(2,1)", 12354],
   ["block:(2,1)", 12354],
   ["block:(2,1)", 12354],
   ["block:(2,1)", 12354],
   ["block:(2,1)", 12354],
   ["block:(2,1)", 12354],
   ["block:(2,1)", 12354]]],
 [-872,
  [["ic:(55,29)", 12352],
   ["ic:(55,29)", 12352],
   ["ic:(55,29)", 12352],
   ["ic:(55,29)", 12352],
   ["ic:(55,29)", 12352],
   ["ic:(55,29)", 12352],
   ["ic:(55,29)", 12352]]],
 [-868, [["module:(2,1)", 12131], ["module:(2,1)", 12131]]],
 [-864, [["module_iseq:(2,1)", 12115], ["module_iseq:(2,1)", 12115]]],
 [-860, [["module:(2,1)", 12034], ["module:(2,1)", 12034]]],
 [-856, [["module_iseq:(2,1)", 12018], ["module_iseq:(2,1)", 12018]]],
 [-852, [["module:(2,1)", 11937], ["module:(2,1)", 11937]]],
 [-848, [["module_iseq:(2,1)", 11921], ["module_iseq:(2,1)", 11921]]],
 [-844, [["module:(2,1)", 11840], ["module:(2,1)", 11840]]],
 [-840, [["module_iseq:(2,1)", 11824], ["module_iseq:(2,1)", 11824]]],
 [-836, [["module:(2,1)", 11743], ["module:(2,1)", 11743]]],
 [-832, [["module_iseq:(2,1)", 11726], ["module_iseq:(2,1)", 11726]]],
 [-828, [["klass:(2,1)", 11494], ["klass:(2,1)", 11494]]],
 [-824, [["super:(2,1)", 11480], ["super:(2,1)", 11480]]],
 [-820, [["klass_iseq:(2,1)", 11477], ["klass_iseq:(2,1)", 11477]]],
 [-816, [["klass:(2,1)", 11391], ["klass:(2,1)", 11391]]],
 [-812, [["super:(2,1)", 11377], ["super:(2,1)", 11377]]],
 [-808, [["klass_iseq:(2,1)", 11374], ["klass_iseq:(2,1)", 11374]]],
 [-804, [["klass:(2,1)", 11288], ["klass:(2,1)", 11288]]],
 [-800, [["super:(2,1)", 11273], ["super:(2,1)", 11273]]],
 [-796, [["klass_iseq:(2,1)", 11270], ["klass_iseq:(2,1)", 11270]]],
 [-792, [["klass:(2,1)", 11184], ["klass:(2,1)", 11184]]],
 [-788, [["super:(2,1)", 11169], ["super:(2,1)", 11169]]],
 [-784, [["klass_iseq:(2,1)", 11166], ["klass_iseq:(2,1)", 11166]]],
 [-780, [["id:(2,2)", 11063], ["id:(2,2)", 11063]]],
 [-776, [["klass_iseq:(2,1)", 11062], ["klass_iseq:(2,1)", 11062]]],
 [-772,
  [["needstr:(2,1)", 10984],
   ["needstr:(2,1)", 10984],
   ["needstr:(2,1)", 10984]]],
 [-768, [["val:(2,1)", 10982], ["val:(2,1)", 10982], ["val:(2,1)", 10982]]],
 [-764,
  [["needstr:(2,1)", 10905],
   ["needstr:(2,1)", 10905],
   ["needstr:(2,1)", 10905]]],
 [-760, [["val:(2,1)", 10903], ["val:(2,1)", 10903], ["val:(2,1)", 10903]]],
 [-756,
  [["needstr:(2,1)", 10826],
   ["needstr:(2,1)", 10826],
   ["needstr:(2,1)", 10826]]],
 [-752, [["val:(2,1)", 10824], ["val:(2,1)", 10824], ["val:(2,1)", 10824]]],
 [-748,
  [["needstr:(2,1)", 10748],
   ["needstr:(2,1)", 10748],
   ["needstr:(2,1)", 10748]]],
 [-744, [["val:(2,1)", 10746], ["val:(2,1)", 10746], ["val:(2,1)", 10746]]],
 [-740,
  [["needstr:(2,1)", 10670],
   ["needstr:(2,1)", 10670],
   ["needstr:(2,1)", 10670]]],
 [-736, [["val:(2,1)", 10668], ["val:(2,1)", 10668], ["val:(2,1)", 10668]]],
 [-732,
  [["klass:(2,1)", 10256], ["klass:(2,1)", 10256], ["klass:(2,1)", 10256]]],
 [-728, [["id:(2,2)", 10243], ["id:(2,2)", 10243], ["id:(2,2)", 10243]]],
 [-724,
  [["klass:(2,1)", 10193], ["klass:(2,1)", 10193], ["klass:(2,1)", 10193]]],
 [-720, [["id:(2,2)", 10180], ["id:(2,2)", 10180], ["id:(2,2)", 10180]]],
 [-716,
  [["klass:(2,1)", 10130], ["klass:(2,1)", 10130], ["klass:(2,1)", 10130]]],
 [-712, [["id:(2,2)", 10117], ["id:(2,2)", 10117], ["id:(2,2)", 10117]]],
 [-708,
  [["klass:(2,1)", 10067], ["klass:(2,1)", 10067], ["klass:(2,1)", 10067]]],
 [-704, [["id:(2,2)", 10054], ["id:(2,2)", 10054], ["id:(2,2)", 10054]]],
 [-700,
  [["klass:(2,1)", 10004], ["klass:(2,1)", 10004], ["klass:(2,1)", 10004]]],
 [-696, [["id:(2,2)", 9990], ["id:(2,2)", 9990], ["id:(2,2)", 9990]]],
 [-692, [["id:(2,2)", 9934], ["id:(2,2)", 9934]]],
 [-688, [["id:(2,2)", 9878], ["id:(2,2)", 9878]]],
 [-684, [["id:(2,2)", 9822], ["id:(2,2)", 9822]]],
 [-680, [["id:(2,2)", 9766], ["id:(2,2)", 9766]]],
 [-676, [["id:(2,2)", 9710], ["id:(2,2)", 9710]]],
 [-672, [["num:(1,11)", 8447]]],
 [-668, [["val:(2,1)", 8445]]],
 [-664, [["num:(1,11)", 8408]]],
 [-660, [["val:(2,1)", 8406]]],
 [-656, [["num:(1,11)", 8369]]],
 [-652, [["val:(2,1)", 8367]]],
 [-648, [["num:(1,11)", 8331]]],
 [-644, [["val:(2,1)", 8329]]],
 [-640, [["num:(1,11)", 8293]]],
 [-636, [["val:(2,1)", 8291]]],
 [-632, [["holdnum:(0,3)", 8264]]],
 [-628, [["flag:(2,1)", 8212], ["flag:(2,1)", 8212]]],
 [-624, [["holdnum:(0,3)", 8183]]],
 [-620, [["flag:(2,1)", 8131], ["flag:(2,1)", 8131]]],
 [-616, [["holdnum:(0,3)", 8102]]],
 [-612, [["flag:(2,1)", 8050], ["flag:(2,1)", 8050]]],
 [-608, [["holdnum:(0,3)", 8021]]],
 [-604, [["flag:(2,1)", 7969], ["flag:(2,1)", 7969]]],
 [-600, [["holdnum:(0,3)", 7940]]],
 [-596, [["flag:(2,1)", 7887], ["flag:(2,1)", 7887]]],
 [-592, [["num:(1,11)", 7266]]],
 [-588, [["val:(2,1)", 7264]]],
 [-584, [["num:(1,11)", 7228]]],
 [-580, [["val:(2,1)", 7226]]],
 [-576, [["num:(1,11)", 7190]]],
 [-572, [["val:(2,1)", 7188]]],
 [-568, [["num:(1,11)", 7153]]],
 [-564, [["val:(2,1)", 7151]]],
 [-560, [["num:(1,11)", 7116]]],
 [-556, [["val:(2,1)", 7114]]],
 [-552, [["val:(2,1)", 5900], ["val:(2,1)", 5900]]],
 [-548, [["id:(2,2)", 5899], ["id:(2,2)", 5899]]],
 [-544, [["val:(2,1)", 5862], ["val:(2,1)", 5862]]],
 [-540, [["id:(2,2)", 5861], ["id:(2,2)", 5861]]],
 [-536, [["val:(2,1)", 5824], ["val:(2,1)", 5824]]],
 [-532, [["id:(2,2)", 5823], ["id:(2,2)", 5823]]],
 [-528, [["val:(2,1)", 5786], ["val:(2,1)", 5786]]],
 [-524, [["id:(2,2)", 5785], ["id:(2,2)", 5785]]],
 [-520, [["val:(2,1)", 5747], ["val:(2,1)", 5747]]],
 [-516, [["id:(2,2)", 5746], ["id:(2,2)", 5746]]],
 [-512, [["val_1:(2,1)", 3752], ["val_1:(2,1)", 3752]]],
 [-508,
  [["prev_lfp:(2,13)", 2195],
   ["prev_lfp:(2,13)", 2195],
   ["prev_lfp:(2,13)", 2195]]],
 [-504,
  [["prev_dfp:(2,13)", 2195],
   ["prev_dfp:(2,13)", 2195],
   ["prev_dfp:(2,13)", 2195]]],
 [-500, [["iseq:(2,1)", 2194], ["iseq:(2,1)", 2194], ["iseq:(2,1)", 2194]]],
 [-496, [["pack_size:(0,1)", 1969], ["pack_size:(0,1)", 1969]]],
 [-492,
  [["opt_pc:(0,1)", 1941], ["opt_pc:(0,1)", 1941], ["opt_pc:(0,1)", 1941]]],
 [-488,
  [["newiseq:(2,1)", 1939], ["newiseq:(2,1)", 1939], ["newiseq:(2,1)", 1939]]],
 [-484,
  [["niseqobj:(55,21)", 1938],
   ["niseqobj:(55,21)", 1938],
   ["niseqobj:(55,21)", 1938]]],
 [-480,
  [["num:(1,11)", 1737],
   ["num:(1,11)", 1737],
   ["num:(1,11)", 1737],
   ["num:(1,11)", 1737],
   ["num:(1,11)", 1737],
   ["num:(1,11)", 1737],
   ["num:(1,11)", 1737]]],
 [-476,
  [["block_ptr:(51,5)", 1736],
   ["block_ptr:(51,5)", 1736],
   ["block_ptr:(51,5)", 1736],
   ["block_ptr:(51,5)", 1736],
   ["block_ptr:(51,5)", 1736],
   ["block_ptr:(51,5)", 1736],
   ["block_ptr:(51,5)", 1736]]],
 [-472,
  [["klass:(2,1)", 1735],
   ["klass:(2,1)", 1735],
   ["klass:(2,1)", 1735],
   ["klass:(2,1)", 1735],
   ["klass:(2,1)", 1735],
   ["klass:(2,1)", 1735],
   ["klass:(2,1)", 1735]]],
 [-468,
  [["procblock:(2,1)", 1734],
   ["procblock:(2,1)", 1734],
   ["procblock:(2,1)", 1734],
   ["procblock:(2,1)", 1734],
   ["procblock:(2,1)", 1734],
   ["procblock:(2,1)", 1734],
   ["procblock:(2,1)", 1734]]],
 [-464,
  [["recv:(2,1)", 1733],
   ["recv:(2,1)", 1733],
   ["recv:(2,1)", 1733],
   ["recv:(2,1)", 1733],
   ["recv:(2,1)", 1733],
   ["recv:(2,1)", 1733],
   ["recv:(2,1)", 1733]]],
 [-460,
  [["id:(2,2)", 1715],
   ["id:(2,2)", 1715],
   ["id:(2,2)", 1715],
   ["id:(2,2)", 1715],
   ["id:(2,2)", 1715],
   ["id:(2,2)", 1715],
   ["id:(2,2)", 1715]]],
 [-456,
  [["block:(2,1)", 1713],
   ["block:(2,1)", 1713],
   ["block:(2,1)", 1713],
   ["block:(2,1)", 1713],
   ["block:(2,1)", 1713],
   ["block:(2,1)", 1713],
   ["block:(2,1)", 1713]]],
 [-452,
  [["ic:(55,29)", 1711],
   ["ic:(55,29)", 1711],
   ["ic:(55,29)", 1711],
   ["ic:(55,29)", 1711],
   ["ic:(55,29)", 1711],
   ["ic:(55,29)", 1711],
   ["ic:(55,29)", 1711]]],
 [-448, [["module:(2,1)", 1602], ["module:(2,1)", 1602]]],
 [-444, [["module_iseq:(2,1)", 1585], ["module_iseq:(2,1)", 1585]]],
 [-440, [["id:(2,2)", 1452], ["id:(2,2)", 1452]]],
 [-436, [["klass_iseq:(2,1)", 1451], ["klass_iseq:(2,1)", 1451]]],
 [-432,
  [["needstr:(2,1)", 1373], ["needstr:(2,1)", 1373], ["needstr:(2,1)", 1373]]],
 [-428, [["val:(2,1)", 1371], ["val:(2,1)", 1371], ["val:(2,1)", 1371]]],
 [-424, [["klass:(2,1)", 1251], ["klass:(2,1)", 1251], ["klass:(2,1)", 1251]]],
 [-420, [["id:(2,2)", 1237], ["id:(2,2)", 1237], ["id:(2,2)", 1237]]],
 [-416, [["id:(2,2)", 1181], ["id:(2,2)", 1181]]],
 [-412, [["num:(1,11)", 894]]],
 [-408, [["val:(2,1)", 892]]],
 [-404, [["holdnum:(0,3)", 865]]],
 [-400, [["flag:(2,1)", 812], ["flag:(2,1)", 812]]],
 [-396, [["num:(1,11)", 657]]],
 [-392, [["val:(2,1)", 655]]],
 [-388, [["val:(2,1)", 382], ["val:(2,1)", 382]]],
 [-384, [["id:(2,2)", 381], ["id:(2,2)", 381]]],
 [-380, [["state:(0,1)", 57]]],
 [-376, [["throwed:(2,1)", 55]]],
 [-372, [["reg_cfp:(2,13)", 52]]],
 [-368, [["reg_dfp:(2,13)", 51]]],
 [-364, [["reg_lfp:(2,13)", 50]]],
 [-360, [["reg_sp:(2,13)", 49]]],
 [-356, [["reg_b:(2,1)", 28]]],
 [-352, [["reg_a:(2,1)", 27]]],
 [-348, [["th:(1,4)", 20]]],
 [-344, [["val:(2,1)", 16868], ["val:(2,1)", 16868]]],
 [-340, [["val:(2,1)", 16826], ["val:(2,1)", 16826]]],
 [-336, [["val:(2,1)", 16784], ["val:(2,1)", 16784]]],
 [-332, [["val:(2,1)", 16742], ["val:(2,1)", 16742]]],
 [-328, [["val:(2,1)", 16700], ["val:(2,1)", 16700]]],
 [-324,
  [["newbody:(55,18)", 10257],
   ["newbody:(55,18)", 10257],
   ["newbody:(55,18)", 10257]]],
 [-320,
  [["newbody:(55,18)", 10194],
   ["newbody:(55,18)", 10194],
   ["newbody:(55,18)", 10194]]],
 [-316,
  [["newbody:(55,18)", 10131],
   ["newbody:(55,18)", 10131],
   ["newbody:(55,18)", 10131]]],
 [-312,
  [["newbody:(55,18)", 10068],
   ["newbody:(55,18)", 10068],
   ["newbody:(55,18)", 10068]]],
 [-308,
  [["newbody:(55,18)", 10005],
   ["newbody:(55,18)", 10005],
   ["newbody:(55,18)", 10005]]],
 [-304, [["val:(2,1)", 2599], ["val:(2,1)", 2599]]],
 [-300,
  [["newbody:(55,18)", 1252],
   ["newbody:(55,18)", 1252],
   ["newbody:(55,18)", 1252]]],
 [-296,
  [["cmi:(51,10)", 12519],
   ["cmi:(51,10)", 14149],
   ["cmi:(51,10)", 13741],
   ["cmi:(51,10)", 13333],
   ["cmi:(51,10)", 12926],
   ["cmi:(51,10)", 1878],
   ["cmi:(51,10)", 1878],
   ["cmi:(51,10)", 12926],
   ["cmi:(51,10)", 13333],
   ["cmi:(51,10)", 13741],
   ["cmi:(51,10)", 14149],
   ["cmi:(51,10)", 12519]]],
 [-280, [["_tag:(1,14)", 58]]],
 [-28, [["reg_pc_store:(61,1)=B(2,13)", 34]]]]

スタックの利用方法。tag が意外にでかい。

で、なんか沢山あるのは、ブロック間で goto していて、それで解析がおっつかなかった(解析しても不可能?)だったからみたい。まとめれば半分くらいになるかしらん。

あれれ、よくよくよくよく見てみると、もっと共有できるはず。

変数名が違うと駄目なんだろうか。

関数で変数宣言は一箇所にしちゃったほうがいいんだろうか。


各VM命令ごとの機械語命令数を数えてみた(x86)。本当にこれが正しいかはパーサ次第なんだけど。

send_SC_xx_ax 2770
send 2748
send_SC_ba_ax 2191
send_SC_ab_ax 2191
send_SC_bx_ax 2188
send_SC_ax_ax 2180
expandarray_SC_ba_xx 802
expandarray_SC_ab_xx 802
expandarray_SC_ax_xx 766
expandarray_SC_bx_xx 766
expandarray 747
expandarray_SC_xx_xx 747
defined_SC_ba_ax 542
defined_SC_ab_ax 542
defined_SC_ax_ax 531
defined_SC_bx_ax 531
defined 519
defined_SC_xx_ax 499
singletonmethoddef_SC_bx_xx 420
singletonmethoddef_SC_ba_bx 420
singletonmethoddef_SC_ax_xx 420
singletonmethoddef_SC_ab_ax 420
singletonmethoddef_SC_xx_xx 413
singletonmethoddef 413
opt_plus 273
opt_plus_SC_bx_ax 262
opt_plus_SC_ax_ax 262
opt_plus_SC_xx_ax 253
opt_plus_SC_ab_ax 249
opt_plus_SC_ba_ax 249
opt_ltlt_SC_bx_ax 219
opt_ltlt_SC_ax_ax 219
opt_ltlt 212
getspecial_SC_ab_ba 212
getspecial_SC_ba_ab 212
UNIFIED_putnil_end_SC_ab_ba 212
end 210
setclassvariable 208
setclassvariable_SC_xx_xx 208
opt_ltlt_SC_ba_ax 208
opt_ltlt_SC_ab_ax 208
UNIFIED_putnil_end_SC_ba_ab 206
opt_mult 203
getspecial 200
opt_regexpmatch2 198
methoddef 195
methoddef_SC_ab_ab 195
methoddef_SC_ba_ba 195
methoddef_SC_ax_ax 195
methoddef_SC_bx_bx 195
methoddef_SC_xx_xx 195
opt_ltlt_SC_xx_ax 192
end_SC_xx_ax 190
opt_minus 189
concatstrings_SC_ab_ax 188
concatstrings_SC_ba_ax 188
UNIFIED_putnil_end 188
opt_mult_SC_bx_ax 186
opt_regexpmatch2_SC_ab_ax 186
opt_regexpmatch2_SC_ba_ax 186
opt_mult_SC_ax_ax 186
opt_mult_SC_xx_ax 185
setclassvariable_SC_ab_ax 183
setclassvariable_SC_ax_xx 183
setclassvariable_SC_ba_bx 183
setclassvariable_SC_bx_xx 183
newhash_SC_ba_ax 182
newhash_SC_ab_ax 182
opt_regexpmatch2_SC_ax_ax 181
opt_regexpmatch2_SC_bx_ax 181
getspecial_SC_ax_ab 180
getspecial_SC_xx_ax 180
getspecial_SC_bx_ba 180
UNIFIED_putnil_end_SC_ax_ab 180
UNIFIED_putnil_end_SC_bx_ba 180
UNIFIED_putnil_end_SC_xx_ax 180
opt_regexpmatch2_SC_xx_ax 178
concatstrings_SC_bx_ax 177
concatstrings_SC_ax_ax 177
end_SC_bx_ax 175
end_SC_ab_ax 175
opt_minus_SC_bx_ax 174
opt_minus_SC_ax_ax 174
end_SC_ax_ax 169
end_SC_ba_ax 169
opt_minus_SC_xx_ax 167
newhash_SC_bx_ax 167
newhash_SC_ax_ax 167
opt_mult_SC_ba_ax 165
opt_mult_SC_ab_ax 165
yield_SC_ba_ax 158
yield_SC_ab_ax 158
opt_minus_SC_ab_ax 149
opt_minus_SC_ba_ax 149
yield_SC_bx_ax 141
yield_SC_ax_ax 141
concatstrings_SC_xx_ax 141
concatstrings 140
newhash_SC_xx_ax 139
newhash 134
yield 126
getclassvariable_SC_ab_ba 119
getclassvariable_SC_ba_ab 119
dupn_SC_ab_xx 117
dupn_SC_ba_xx 117
yield_SC_xx_ax 115
setconstant_SC_ax_xx 111
setconstant_SC_bx_xx 111
alias_SC_ba_ba 110
alias_SC_ab_ab 110
alias 110
alias_SC_xx_xx 110
alias_SC_bx_bx 110
alias_SC_ax_ax 110
getclassvariable 107
setconstant_SC_xx_xx 106
dupn_SC_bx_xx 106
dupn_SC_ax_xx 106
setconstant 104
newarray_SC_ba_ax 103
newarray_SC_ab_ax 103
opt_case_dispatch_SC_ba_xx 102
opt_case_dispatch_SC_ab_xx 102
undef_SC_bx_bx 100
undef_SC_ax_ax 100
undef 100
undef_SC_ab_ab 100
undef_SC_xx_xx 100
undef_SC_ba_ba 100
UNIFIED_getlocal_getlocal_SC_ab_ab 98
UNIFIED_getlocal_getlocal_SC_ba_ba 98
opt_lt 97
opt_lt_SC_bx_ax 97
opt_lt_SC_ax_ax 97
getconstant 93
setconstant_SC_ba_xx 92
setconstant_SC_ab_xx 92
newarray_SC_ax_ax 92
newarray_SC_bx_ax 92
opt_case_dispatch_SC_xx_xx 91
opt_case_dispatch 91
UNIFIED_putstring_putstring_SC_ab_ab 90
UNIFIED_putstring_putstring_SC_ba_ba 90
opt_lt_SC_xx_ax 87
getclassvariable_SC_bx_ba 87
getclassvariable_SC_ax_ab 87
getclassvariable_SC_xx_ax 87
UNIFIED_getlocal_getlocal_SC_ax_ba 87
UNIFIED_getlocal_getlocal_SC_bx_ab 87
setspecial_SC_xx_xx 85
setspecial 85
UNIFIED_getlocal_putobject_SC_ba_ba 85
UNIFIED_getlocal_putobject_SC_ab_ab 85
toregexp 83
getdynamic_SC_ba_ab 81
getdynamic_SC_ab_ba 81
UNIFIED_putobject_putstring_SC_ab_ab 80
UNIFIED_putstring_putobject_SC_ab_ab 80
UNIFIED_putobject_putstring_SC_ba_ba 80
UNIFIED_putstring_putobject_SC_ba_ba 80
getinlinecache_SC_ab_ba 79
getconstant_SC_xx_ax 79
getinlinecache_SC_ba_ab 79
UNIFIED_putstring_putstring_SC_ax_ba 79
UNIFIED_putstring_putstring_SC_bx_ab 79
setinlinecache 74
dupn 74
dupn_SC_xx_xx 74
UNIFIED_getlocal_putobject_SC_ax_ba 74
UNIFIED_getlocal_putobject_SC_bx_ab 74
UNIFIED_getlocal_getlocal 74
opt_lt_SC_ba_ax 72
opt_lt_SC_ab_ax 72
getinstancevariable_SC_ab_ba 72
getinstancevariable_SC_ba_ab 72
UNIFIED_putobject_putobject_SC_ba_ba 72
UNIFIED_putobject_putobject_SC_ab_ab 72
topn_SC_ba_ax 71
topn_SC_ab_ax 71
setdynamic_SC_xx_xx 70
setdynamic 70
opt_case_dispatch_SC_bx_xx 70
opt_case_dispatch_SC_ax_xx 70
newrange 70
toregexp_SC_xx_ax 69
newrange_SC_ax_ax 69
newrange_SC_bx_ax 69
newarray 69
getdynamic 69
UNIFIED_putstring_putobject_SC_ax_ba 69
UNIFIED_putobject_putstring_SC_bx_ab 69
UNIFIED_putobject_putstring_SC_ax_ba 69
UNIFIED_putstring_putobject_SC_bx_ab 69
newrange_SC_xx_ax 68
UNIFIED_putstring_putstring 68
opt_regexpmatch1 67
getinlinecache 67
topn_SC_bx_ax 66
tostring 66
setinstancevariable_SC_xx_xx 65
setinstancevariable 65
getdynamic_OP__WC__0_SC_ab_ba 65
getdynamic_OP__WC__0_SC_ba_ab 65
getlocal_SC_ab_ba 65
getlocal_SC_ba_ab 65
setspecial_SC_bx_xx 64
setspecial_SC_ab_ax 64
setspecial_SC_ax_xx 64
setspecial_SC_ba_bx 64
getconstant_SC_ab_ab 64
getconstant_SC_ax_ax 64
getconstant_SC_bx_ax 64
getconstant_SC_ba_ba 64
setinlinecache_SC_xx_ax 63
UNIFIED_putobject_putobject_SC_bx_ab 61
UNIFIED_putobject_putobject_SC_ax_ba 61
UNIFIED_getlocal_putobject 61
topn_SC_ax_ax 60
putstring_SC_ba_ab 60
putstring_SC_ab_ba 60
newarray_SC_xx_ax 60
getglobal_SC_ba_ab 60
getglobal_SC_ab_ba 60
getinstancevariable 60
duparray_SC_ab_ba 60
duparray_SC_ba_ab 60
UNIFIED_putstring_setdynamic_SC_xx_xx 60
UNIFIED_dup_setlocal_SC_xx_ax 60
UNIFIED_putstring_setdynamic_SC_bx_bx 60
UNIFIED_putstring_setdynamic 60
UNIFIED_putstring_setdynamic_SC_ab_ab 60
UNIFIED_putstring_setdynamic_SC_ba_ba 60
UNIFIED_putstring_setdynamic_SC_ax_ax 60
opt_regexpmatch1_SC_xx_ax 59
UNIFIED_dup_setlocal 59
getdynamic_OP_1_0_SC_ba_ab 58
getlocal_OP_3_SC_ba_ab 58
getlocal_OP_2_SC_ba_ab 58
getlocal_OP_3_SC_ab_ba 58
getdynamic_OP_1_0_SC_ab_ba 58
getlocal_OP_2_SC_ab_ba 58
putself_SC_ba_ab 57
putself_SC_ab_ba 57
swap_SC_bx_ab 56
putnot_SC_xx_ax 56
UNIFIED_putobject_putstring 56
UNIFIED_putstring_putobject 56
reput_SC_ab_ax 55
putnot 55
dup_SC_ba_ab 55
dup_SC_ab_ba 55
UNIFIED_getlocal_getlocal_SC_xx_ab 55
topn 54
setlocal_SC_xx_xx 54
setlocal 54
putobject_OP_INT2FIX_O_1_C__SC_ba_ab 54
putobject_OP_Qtrue_SC_ab_ba 54
putnil_SC_ba_ab 54
putobject_OP_Qtrue_SC_ba_ab 54
putobject_OP_INT2FIX_O_0_C__SC_ab_ba 54
putobject_OP_INT2FIX_O_1_C__SC_ab_ba 54
putnil_SC_ab_ba 54
putobject_OP_INT2FIX_O_0_C__SC_ba_ab 54
swap_SC_xx_ab 53
setglobal_SC_xx_xx 53
setglobal 53
getlocal 53
getdynamic_OP__WC__0 53
tostring_SC_xx_ax 52
putobject_SC_ab_ba 52
putobject_SC_ba_ab 52
swap 51
putobject_OP_Qfalse_SC_ba_ab 51
putobject_OP_Qfalse_SC_ab_ba 51
dup_SC_xx_ab 50
unless 49
unless_SC_xx_xx 49
setdynamic_SC_ba_bx 49
setdynamic_SC_bx_xx 49
setdynamic_SC_ax_xx 49
setdynamic_SC_ab_ax 49
if 49
if_SC_xx_xx 49
getdynamic_SC_bx_ba 49
getdynamic_SC_ax_ab 49
getdynamic_SC_xx_ax 49
toregexp_SC_ba_ba 48
toregexp_SC_ax_ax 48
toregexp_SC_bx_ax 48
toregexp_SC_ab_ab 48
singletonclassdef 48
putstring 48
newrange_SC_ab_ax 48
newrange_SC_ba_ax 48
getglobal 48
duparray 48
UNIFIED_putobject_putobject 48
setlocal_OP_2 47
setlocal_OP_2_SC_xx_xx 47
setlocal_OP_3_SC_xx_xx 47
setlocal_OP_3 47
getinlinecache_SC_ax_ab 47
getinlinecache_SC_bx_ba 47
getinlinecache_SC_xx_ax 47
UNIFIED_putstring_putstring_SC_xx_ab 47
getlocal_OP_3 46
getdynamic_OP_1_0 46
getlocal_OP_2 46
dup 46
UNIFIED_putobject_setdynamic_SC_ab_ab 46
UNIFIED_putobject_setdynamic_SC_bx_bx 46
UNIFIED_putobject_setdynamic 46
UNIFIED_putobject_setdynamic_SC_ba_ba 46
UNIFIED_putobject_setdynamic_SC_ax_ax 46
UNIFIED_putobject_setdynamic_SC_xx_xx 46
putself 45
setinstancevariable_SC_bx_xx 44
setinstancevariable_SC_ab_ax 44
swap_SC_ax_ab 44
setinstancevariable_SC_ba_bx 44
singletonclassdef_SC_xx_ax 44
setinstancevariable_SC_ax_xx 44
reput_SC_xx_ax 44
reput_SC_ba_ax 43
setinlinecache_SC_bx_ax 42
UNIFIED_getlocal_putobject_SC_xx_ab 42
putobject_OP_INT2FIX_O_1_C_ 41
putobject_OP_Qfalse 41
putobject_OP_Qtrue 41
putobject_OP_INT2FIX_O_0_C_ 41
putnil 41
putobject 40
getinstancevariable_SC_bx_ba 40
getinstancevariable_SC_ax_ab 40
getinstancevariable_SC_xx_ax 40
UNIFIED_putstring_setlocal_SC_bx_bx 40
UNIFIED_putstring_setlocal_SC_ax_ax 40
UNIFIED_putstring_setlocal 40
UNIFIED_putstring_setlocal_SC_xx_xx 40
UNIFIED_putstring_setlocal_SC_ba_ba 40
UNIFIED_putstring_setlocal_SC_ab_ab 40
UNIFIED_dup_setlocal_SC_bx_ax 39
reput 38
opt_regexpmatch1_SC_bx_ax 38
opt_regexpmatch1_SC_ax_ax 38
opt_regexpmatch1_SC_ba_ba 38
opt_regexpmatch1_SC_ab_ab 38
UNIFIED_putobject_putstring_SC_xx_ab 37
UNIFIED_putstring_putobject_SC_xx_ab 37
setinlinecache_SC_ab_ab 36
setinlinecache_SC_ax_ax 36
setinlinecache_SC_ba_ba 36
swap_SC_ab_ab 35
putnot_SC_ab_ab 35
putnot_SC_bx_ax 35
putnot_SC_ax_ax 35
putnot_SC_ba_ba 35
topn_SC_xx_ax 34
setlocal_SC_ax_xx 33
setlocal_SC_bx_xx 33
setlocal_SC_ba_bx 33
setlocal_SC_ab_ax 33
pop 33
pop_SC_xx_xx 33
getdynamic_OP__WC__0_SC_bx_ba 33
getlocal_SC_bx_ba 33
getlocal_SC_xx_ax 33
getlocal_SC_ax_ab 33
getdynamic_OP__WC__0_SC_xx_ax 33
getdynamic_OP__WC__0_SC_ax_ab 33
UNIFIED_dup_setlocal_SC_ba_ba 33
UNIFIED_dup_setlocal_SC_ab_ab 33
UNIFIED_dup_setlocal_SC_ax_ax 33
setglobal_SC_ba_bx 32
setglobal_SC_bx_xx 32
setglobal_SC_ax_xx 32
setglobal_SC_ab_ax 32
tostring_SC_ba_ba 31
tostring_SC_bx_ax 31
tostring_SC_ab_ab 31
tostring_SC_ax_ax 31
UNIFIED_putobject_setlocal_SC_xx_xx 30
UNIFIED_putobject_setlocal_SC_ab_ab 30
UNIFIED_putobject_setlocal 30
UNIFIED_putobject_setlocal_SC_ba_ba 30
UNIFIED_putobject_setlocal_SC_ax_ax 30
UNIFIED_putobject_setlocal_SC_bx_bx 30
unless_SC_ba_bx 29
unless_SC_bx_xx 29
unless_SC_ab_ax 29
unless_SC_ax_xx 29
if_SC_bx_xx 29
if_SC_ax_xx 29
if_SC_ba_bx 29
if_SC_ab_ax 29
UNIFIED_putobject_putobject_SC_xx_ab 29
popcref_SC_ax_ax 28
popcref_SC_ab_ab 28
popcref 28
popcref_SC_xx_xx 28
putstring_SC_ax_ab 28
popcref_SC_bx_bx 28
putstring_SC_bx_ba 28
putstring_SC_xx_ax 28
popcref_SC_ba_ba 28
getglobal_SC_ax_ab 28
getglobal_SC_xx_ax 28
getglobal_SC_bx_ba 28
duparray_SC_ax_ab 28
duparray_SC_xx_ax 28
duparray_SC_bx_ba 28
setlocal_OP_2_SC_ba_bx 26
setlocal_OP_2_SC_bx_xx 26
setlocal_OP_2_SC_ax_xx 26
setlocal_OP_3_SC_bx_xx 26
setlocal_OP_3_SC_ab_ax 26
setlocal_OP_2_SC_ab_ax 26
setlocal_OP_3_SC_ax_xx 26
setlocal_OP_3_SC_ba_bx 26
getlocal_OP_3_SC_ax_ab 26
getlocal_OP_2_SC_bx_ba 26
getdynamic_OP_1_0_SC_bx_ba 26
getlocal_OP_2_SC_ax_ab 26
getlocal_OP_2_SC_xx_ax 26
getlocal_OP_3_SC_bx_ba 26
getdynamic_OP_1_0_SC_xx_ax 26
getlocal_OP_3_SC_xx_ax 26
getdynamic_OP_1_0_SC_ax_ab 26
putself_SC_ax_ab 25
putself_SC_bx_ba 25
putself_SC_xx_ax 25
reput_SC_bx_ax 23
dup_SC_bx_ab 23
dup_SC_ax_ab 23
singletonclassdef_SC_ab_ab 22
singletonclassdef_SC_bx_ax 22
singletonclassdef_SC_ba_ba 22
singletonclassdef_SC_ax_ax 22
putobject_OP_INT2FIX_O_0_C__SC_xx_ax 22
putnil_SC_ax_ab 22
putobject_OP_INT2FIX_O_0_C__SC_bx_ba 22
putobject_OP_Qtrue_SC_xx_ax 22
putnil_SC_xx_ax 22
putobject_OP_INT2FIX_O_1_C__SC_ax_ab 22
putobject_OP_INT2FIX_O_0_C__SC_ax_ab 22
putnil_SC_bx_ba 22
putobject_OP_Qtrue_SC_bx_ba 22
putobject_OP_INT2FIX_O_1_C__SC_xx_ax 22
putobject_OP_INT2FIX_O_1_C__SC_bx_ba 22
putobject_OP_Qtrue_SC_ax_ab 22
putobject_SC_bx_ba 20
putobject_SC_xx_ax 20
putobject_SC_ax_ab 20
putobject_OP_Qfalse_SC_xx_ax 19
putobject_OP_Qfalse_SC_ax_ab 19
putobject_OP_Qfalse_SC_bx_ba 19
jump 19
jump_SC_ax_ax 19
jump_SC_bx_bx 19
jump_SC_ab_ab 19
jump_SC_xx_xx 19
jump_SC_ba_ba 19
swap_SC_ba_ab 11
reput_SC_ax_ax 11
pop_SC_ax_xx 11
pop_SC_ab_ax 11
pop_SC_ba_bx 11
pop_SC_bx_xx 11
nop_SC_ab_ab 11
nop 11
nop_SC_ax_ax 11
nop_SC_bx_bx 11
nop_SC_xx_xx 11
nop_SC_ba_ba 11

total: 58451

send でかすぎ。

ちょっと修正。


if(COND1){
  if(COND1_1){
    body1;
  }
  else if(COND1_2){
    body2;
  }
  else{
    elsebody;
  }
}
else{
  elsebody;
}

さて、elsebody がダブってる。もっと綺麗でカッコイイ書き方は無いものか。

ちなみに、goto を使っちゃった。


Ruby の場合、CLASS_OF(obj) == klass よりも !SPECIAL_CONST_P(obj) && RBASIC(obj)->klass == klass のほうが速い。


send_SC_xx_ax 2770
send 2748
send_SC_ba_ax 2191
send_SC_ab_ax 2191
send_SC_bx_ax 2188
send_SC_ax_ax 2180
send_OP__WC__1_Qfalse_0__WC__SC_ba_ax 1630
send_OP__WC__2_Qfalse_0__WC__SC_ab_ax 1630
send_OP__WC__3_Qfalse_0__WC__SC_ba_ax 1630
send_OP__WC__2_Qfalse_0__WC__SC_ba_ax 1630
send_OP__WC__3_Qfalse_0__WC__SC_ab_ax 1630
send_OP__WC__1_Qfalse_0__WC__SC_ab_ax 1630
send_OP__WC___WC__Qfalse_0__WC__SC_ba_ax 1629
send_OP__WC___WC__Qfalse_0__WC__SC_ab_ax 1629
send_OP__WC__0_Qfalse_0__WC__SC_ba_ax 1627
send_OP__WC__0_Qfalse_0__WC__SC_ab_ax 1627
send_OP__WC___WC__Qfalse_0__WC__SC_ax_ax 1618
send_OP__WC___WC__Qfalse_0__WC__SC_bx_ax 1618
send_OP__WC__2_Qfalse_0__WC__SC_ax_ax 1617
send_OP__WC__3_Qfalse_0__WC__SC_ax_ax 1617
send_OP__WC__1_Qfalse_0__WC__SC_bx_ax 1617
send_OP__WC__2_Qfalse_0__WC__SC_bx_ax 1617
send_OP__WC__3_Qfalse_0__WC__SC_bx_ax 1617
send_OP__WC__1_Qfalse_0__WC__SC_ax_ax 1617
send_OP__WC__0_Qfalse_0__WC__SC_ax_ax 1614
send_OP__WC__0_Qfalse_0__WC__SC_bx_ax 1614
send_OP__WC___WC__Qfalse_0__WC_ 1606
send_OP__WC__1_Qfalse_0__WC_ 1605
send_OP__WC__3_Qfalse_0__WC_ 1605
send_OP__WC__2_Qfalse_0__WC_ 1605
send_OP__WC__0_Qfalse_0__WC_ 1602
send_OP__WC__1_Qfalse_0__WC__SC_xx_ax 1589
send_OP__WC__3_Qfalse_0__WC__SC_xx_ax 1589
send_OP__WC__2_Qfalse_0__WC__SC_xx_ax 1589
send_OP__WC__0_Qfalse_0__WC__SC_xx_ax 1586
send_OP__WC___WC__Qfalse_0__WC__SC_xx_ax 1586
expandarray_SC_ba_xx 802
expandarray_SC_ab_xx 802
expandarray_SC_ax_xx 766
expandarray_SC_bx_xx 766
expandarray_SC_xx_xx 747
expandarray 747
defined_SC_ba_ax 542
defined_SC_ab_ax 542
defined_SC_bx_ax 531
defined_SC_ax_ax 531
defined 519
defined_SC_xx_ax 499
classdef_SC_bx_ax 465
classdef_SC_ax_ax 459
classdef_SC_ab_ax 442
classdef_SC_xx_ax 442
classdef_SC_ba_ax 442
classdef 436
singletonmethoddef_SC_ba_bx 420
singletonmethoddef_SC_ab_ax 420
singletonmethoddef_SC_bx_xx 420
singletonmethoddef_SC_ax_xx 420
singletonmethoddef 413
singletonmethoddef_SC_xx_xx 413
moduledef_SC_xx_ax 406
moduledef 406
moduledef_SC_ab_ax 391
moduledef_SC_bx_ax 391
moduledef_SC_ba_ax 391
moduledef_SC_ax_ax 391
opt_plus 273
opt_plus_SC_bx_ax 262
opt_plus_SC_ax_ax 262
opt_plus_SC_xx_ax 253
opt_plus_SC_ab_ax 249
opt_plus_SC_ba_ax 249
opt_ltlt_SC_ax_ax 219
opt_ltlt_SC_bx_ax 219
opt_ltlt 212
getspecial_SC_ab_ba 212
getspecial_SC_ba_ab 212
UNIFIED_putnil_end_SC_ab_ba 212
end 210
setclassvariable_SC_xx_xx 208
setclassvariable 208
opt_ltlt_SC_ab_ax 208
opt_ltlt_SC_ba_ax 208
UNIFIED_putnil_end_SC_ba_ab 206
opt_mult 203
end_OP_5 201
getspecial 200
opt_regexpmatch2 198
methoddef_SC_ax_ax 195
methoddef_SC_ab_ab 195
methoddef_SC_ba_ba 195
methoddef 195
methoddef_SC_xx_xx 195
methoddef_SC_bx_bx 195
throw_SC_xx_xx 192
throw 192
opt_ltlt_SC_xx_ax 192
end_SC_xx_ax 190
opt_minus 189
concatstrings_SC_ab_ax 188
concatstrings_SC_ba_ax 188
UNIFIED_putnil_end 188
end_OP_5_SC_xx_ax 187
opt_mult_SC_bx_ax 186
opt_mult_SC_ax_ax 186
opt_regexpmatch2_SC_ba_ax 186
opt_regexpmatch2_SC_ab_ax 186
opt_mult_SC_xx_ax 185
setclassvariable_SC_ax_xx 183
setclassvariable_SC_ba_bx 183
setclassvariable_SC_bx_xx 183
setclassvariable_SC_ab_ax 183
newhash_SC_ba_ax 182
newhash_SC_ab_ax 182
opt_regexpmatch2_SC_bx_ax 181
opt_regexpmatch2_SC_ax_ax 181
getspecial_SC_xx_ax 180
getspecial_SC_ax_ab 180
getspecial_SC_bx_ba 180
UNIFIED_putnil_end_SC_ax_ab 180
UNIFIED_putnil_end_SC_bx_ba 180
UNIFIED_putnil_end_SC_xx_ax 180
opt_regexpmatch2_SC_xx_ax 178
throw_SC_ax_xx 177
throw_SC_bx_xx 177
throw_SC_ba_bx 177
throw_SC_ab_ax 177
concatstrings_SC_ax_ax 177
concatstrings_SC_bx_ax 177
end_SC_bx_ax 175
end_SC_ab_ax 175
opt_minus_SC_ax_ax 174
opt_minus_SC_bx_ax 174
end_OP_5_SC_bx_ax 172
end_SC_ba_ax 169
end_SC_ax_ax 169
opt_minus_SC_xx_ax 167
newhash_SC_ax_ax 167
newhash_SC_bx_ax 167
end_OP_5_SC_ab_ax 166
opt_mult_SC_ba_ax 165
opt_mult_SC_ab_ax 165
end_OP_5_SC_ax_ax 160
end_OP_5_SC_ba_ax 160
yield_SC_ab_ax 158
yield_SC_ba_ax 158
opt_minus_SC_ab_ax 149
opt_minus_SC_ba_ax 149
yield_SC_bx_ax 141
yield_SC_ax_ax 141
concatstrings_SC_xx_ax 141
concatstrings 140
newhash_SC_xx_ax 139
newhash 134
yield 126
getclassvariable_SC_ba_ab 119
getclassvariable_SC_ab_ba 119
dupn_SC_ab_xx 117
dupn_SC_ba_xx 117
yield_SC_xx_ax 115
setconstant_SC_bx_xx 111
setconstant_SC_ax_xx 111
alias_SC_ab_ab 110
alias 110
alias_SC_ax_ax 110
alias_SC_bx_bx 110
alias_SC_ba_ba 110
alias_SC_xx_xx 110
getclassvariable 107
setconstant_SC_xx_xx 106
dupn_SC_ax_xx 106
dupn_SC_bx_xx 106
setconstant 104
newarray_SC_ba_ax 103
newarray_SC_ab_ax 103
opt_case_dispatch_SC_ba_xx 102
opt_case_dispatch_SC_ab_xx 102
undef_SC_bx_bx 100
undef_SC_ab_ab 100
undef_SC_ba_ba 100
undef_SC_ax_ax 100
undef_SC_xx_xx 100
undef 100
UNIFIED_getlocal_getlocal_SC_ba_ba 98
UNIFIED_getlocal_getlocal_SC_ab_ab 98
opt_lt_SC_ax_ax 97
opt_lt_SC_bx_ax 97
opt_lt 97
getconstant 93
setconstant_SC_ab_xx 92
setconstant_SC_ba_xx 92
newarray_SC_bx_ax 92
newarray_SC_ax_ax 92
opt_case_dispatch 91
opt_case_dispatch_SC_xx_xx 91
UNIFIED_putstring_putstring_SC_ba_ba 90
UNIFIED_putstring_putstring_SC_ab_ab 90
opt_lt_SC_xx_ax 87
getclassvariable_SC_x

_25(Sat)

るびまの一番大きな宣伝は、Matz にっきだと思うんですが、今月はタイミングが合わず(http://www.rubyist.net/~matz/20050621.html#p03)。残念。

毎月(無駄に?)頑張ってるんで、良ければ見てください、って、この日記を見てる人はるびまは見ているような気がする。

ちなみに,投票もよろしく。


NX bit test:

int func(int a, int b){
  return a + b;
}

int main(){
  int (*fp1)(int a, int b);
  int (*fp2)(int a, int b);
  char buff[0x100];
  fp1 = (void *) buff;
  fp2 = (void *)malloc(0x100);
  memcpy(fp1, func, 0x100);
  memcpy(fp2, func, 0x100);

  printf("%d\n", fp1(1, 2));
  printf("%d\n", fp2(1, 2));
  return 0;
}
#include <sys/mman.h>

int func(int a, int b){
  return a + b;
}

void dump(int *p){
  int i;
  for(i=0; i<5; i++){
    printf("%4d: %08x\n", i, p[i]);
  }
}

void *memalloc(int size){
  void *p;
  int prot = PROT_EXEC | PROT_WRITE;// | PROT_READ | PROT_WRITE;
  int flags= MAP_PRIVATE | MAP_ANONYMOUS;
  if(1){
    p = malloc(size);
    printf("mprotect: %d\n", mprotect(p, size, prot));
  }
  else{
    p = mmap(0, 0x100, prot, flags, 0, 0);
  }
  return p;
}

int main(){
  int (*fp1)(int a, int b);
  fp1 = memalloc(0x100);
  memcpy(fp1, func, 0x100);
  dump((int*)fp1);
  printf("%d\n", fp1(1, 2));
  return 0;
}

mmap version doesn't work. hmm.


Skype doesn't work on DEP (Data Execution Prevent) mode of Windows XP.


512MB 増設メモリキター (http://www.adtec.co.jp/products/adf3200m-_/index.html)。

1024GB MB メモリなんて初めて。凄い凄い。

なんというか、ますます俺の持っているどのデスクトップマシンよりも高性能だ。


a = []
while true
  s = a.size
  b = [1, 2, 3]
  a << s % 10 == 0 ? b : nil
  p s if s % 1024 == 0
end

とりあえずこんなのを動かしてるんだけど、終わらない終わらない。熱い熱い。


T4、キーボードが打ちづらい...。性能を重視したとはいえ、これに慣れるのは結構つらい。ひとつのキーを大きくするためにいわゆる普通のキーボードとちょっと違って。


cross jumping の問題再発。

出現コード:

Ljmp:
  jmp *%eax

...
  Insn1:
    ...
    jmp Ljmp
  Insn2:
    ...
    jmp Ljmp
  ...
  InsnN:
    ...
    jmp Ljmp

ジャンプ先がジャンプ命令なんだから、けちるなよ!

んー、gcc 3.4 にしたからかなぁ (gcc (GCC) 3.4.4 (cygming special))。3.3 だったら平気だったような気がしたんだけど。

どうしたもんだか。最適化オプションに何かあるのかなぁ。


オペランド統合した命令に対しても命令統合の対象にしたら、命令数が案の定爆発した。

命令 I について、オペランド統合した命令(Io1, Io2, ...)があって、命令 I と J を統合するという支持があるとする。

I_J という命令のほかに、Io1_J, Io2_J, ... という命令が作られる。

で、スタックキャッシングのためにその命令数は単純に5倍になる。簡単に命令数は爆発する。

ちょっとやっただけで、50命令が 700命令になってしまった。

どうやって減らすか、というのもテーマになるのか。これは試行によって出来そうな気はするが。

とりあえず、Io1_J, ... は生成しないようにした。

(ほかにもバグがある、という理由もあるのだけれど)。

てゆーか、まさにこれが前田さんのあの論文のテーマだった気がする。


大体バグの原因はわかっていて、ここを全部こう書き直せばいい、ってのはわかってるんだけど、そうやりたいところが沢山あって、泣ける。

_しゅ(Sat Jun 25 13:57:19 JST 2005)

Linux (少なくとも 2.6 ,2.4 / x86) だと、mprotect(2) の第一引数(ポインタ)がページのサイズに整列されていないと、エラー(invalid argument)になってしまうようです。 参考:http://www.shudo.net/diary/2004may.html#20040517

_こーのいけ(Sat Jun 25 18:26:56 JST 2005)

 それはすごい>1TBメモリ

_ (Sat Jun 25 22:10:51 JST 2005)

 USBキーボード使ってみれば?

_ささだ(Sat Jun 25 23:03:28 JST 2005)

 これ以上かさばるのはいやだなぁ。