This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'pp' | |
files = {'vm.inc' => [], 'insns.def' => []} | |
current_insn = nil | |
current_filename = 'vm.inc' | |
lineno_offset = 0 | |
IO.foreach('vm.inc') do |line| | |
case line | |
when /^INSN_ENTRY\((\w+)\)/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original: | |
Performance counter stats for './miniruby -e@v=42; n=100_000_000;while n>0; x=@v; x=@v; x=@v; n-=1;end': | |
5675.422561 task-clock (msec) # 0.998 CPUs utilized | |
159 context-switches # 0.028 K/sec | |
2 cpu-migrations # 0.000 K/sec | |
889 page-faults # 0.157 K/sec | |
16521817067 cycles # 2.911 GHz | |
4121915626 stalled-cycles-frontend # 24.95% frontend cycles idle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resources: | |
- type: package | |
name: zsh | |
- type: package | |
name: screen | |
- type: package | |
name: subversion | |
- type: group | |
name: <%= user %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'nokogiri' | |
# XMLLexer - SAX with scanner like API | |
class XMLLexer | |
def initialize(path) | |
@f = Fiber.new do | |
parser = Nokogiri::HTML::SAX::Parser.new(DocProxy.new) | |
parser.parse_file(path) | |
raise EOFError | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- gen/thread_stack_pcs.c.orig 2013-02-04 15:51:02.000000000 +0900 | |
+++ gen/thread_stack_pcs.c 2013-02-05 14:45:47.000000000 +0900 | |
@@ -37,6 +37,7 @@ | |
#endif | |
#define INSTACK(a) ((a) >= stackbot && (a) <= stacktop) | |
+#define INALTSTACK(a) ((a) >= altstackbot && (a) <= altstacktop) | |
#if defined(__ppc__) || defined(__ppc64__) || defined(__x86_64__) | |
#define ISALIGNED(a) ((((uintptr_t)(a)) & 0xf) == 0) | |
#elif defined(__arm__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% time ./miniruby -e'a=100;i=0;while i<0xffffff;i+=1;a*=557;a+=2;a%=100000;end' | |
./miniruby -e'a=100;i=0;while i<0xffffff;i+=1;a*=557;a+=2;a%=100000;end' 2.64s user 0.01s system 99% cpu 2.649 total | |
% ruby -e'puts RubyVM::InstructionSequence.compile(%q{a=100;i=0;while i<0xffffff;i+=1;a*=557;a+=2;a%= | |
100000;end}).disasm' | |
== disasm: #<ISeq:<compiled>@<compiled>>================================ | |
== catch table | |
| catch type: break st: 0015 ed: 0060 sp: 0000 cont: 0060 | |
| catch type: next st: 0015 ed: 0060 sp: 0000 cont: 0012 | |
| catch type: redo st: 0015 ed: 0060 sp: 0000 cont: 0015 | |
|------------------------------------------------------------------------ |