forked from rubinius/rubinius
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Evan Phoenix
committed
May 11, 2009
1 parent
d32a63e
commit a352624
Showing
4,347 changed files
with
890 additions
and
694,668 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
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
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
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
namespace :jit do | ||
task :generate_header do | ||
classes = %w!rubinius::ObjectHeader | ||
rubinius::Object | ||
rubinius::CallFrame | ||
rubinius::UnwindInfo | ||
rubinius::VariableScope | ||
rubinius::CompiledMethod | ||
rubinius::Executable | ||
rubinius::Dispatch | ||
rubinius::Arguments | ||
rubinius::Tuple | ||
rubinius::Array | ||
rubinius::Class | ||
rubinius::Module | ||
rubinius::StaticScope | ||
rubinius::InstructionSequence | ||
jit_state! | ||
require 'tempfile' | ||
|
||
files = %w!vm/call_frame.hpp vm/arguments.hpp vm/dispatch.hpp! | ||
path = "llvm-type-temp.cpp" | ||
|
||
File.open(path, "w+") do |f| | ||
files.each do |file| | ||
f.puts "#include \"#{file}\"" | ||
end | ||
|
||
i = 0 | ||
classes.each do |klass| | ||
f.puts "void useme#{i}(#{klass}* thing);" | ||
f.puts "void blah#{i}(#{klass}* thing) { useme#{i}(thing); }" | ||
i += 1 | ||
end | ||
end | ||
|
||
str = `llvm-g++ -I. -Ivm -Ivm/external_libs/libtommath -emit-llvm -S -o - "#{path}"` | ||
|
||
types = [] | ||
|
||
str.split("\n").each do |line| | ||
classes.each do |klass| | ||
if /%"?struct.#{klass}(::\$[^\s]+)?"? = type/.match(line) | ||
types << line | ||
end | ||
end | ||
end | ||
|
||
opaque = %w!VM TypeInfo VMMethod Fixnum Symbol! | ||
|
||
File.open("vm/gen/types.ll","w+") do |f| | ||
opaque.each do |o| | ||
f.puts "%\"struct.rubinius::#{o}\" = type opaque" | ||
end | ||
f.puts(*types) | ||
end | ||
|
||
`llvm-as < vm/gen/types.ll > vm/gen/types.bc` | ||
`llc -march=cpp -cppgen=contents -f -o vm/gen/types.cpp vm/gen/types.bc` | ||
end | ||
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
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
file = ARGV.shift | ||
klass = ARGV.shift | ||
|
||
require 'tempfile' | ||
|
||
path = "llvm-type-temp.cpp" | ||
|
||
File.open(path, "w+") do |f| | ||
f.puts "#include \"#{file}\"" | ||
f.puts "void useme(#{klass}* thing);" | ||
f.puts "void blah(#{klass}* thing) { useme(thing); }" | ||
end | ||
|
||
str = `llvm-g++ -I. -I.. -Iexternal_libs/libtommath -emit-llvm -S -o - "#{path}"` | ||
|
||
str.split("\n").each do |line| | ||
if /%"?struct.#{klass}"? = type/.match(line) | ||
puts line | ||
end | ||
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
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
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
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 file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require "#{File.dirname(__FILE__)}/../../kernel/compiler/iseq" | ||
|
||
File.open "#{File.dirname(__FILE__)}/../gen/inst_list.hpp", "w" do |f| | ||
InstructionSet::OpCodes.each do |ins| | ||
case ins.arg_count | ||
when 2 | ||
f.puts "HANDLE_INST2(#{ins.bytecode}, #{ins.opcode});" | ||
when 1 | ||
f.puts "HANDLE_INST1(#{ins.bytecode}, #{ins.opcode});" | ||
when 0 | ||
f.puts "HANDLE_INST0(#{ins.bytecode}, #{ins.opcode});" | ||
end | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require "#{File.dirname(__FILE__)}/../../kernel/compiler/iseq" | ||
|
||
puts "template <class SubClass>" | ||
puts "void VisitInstructions::drive() {" | ||
puts " switch(current_instruction()) {" | ||
|
||
InstructionSet::OpCodes.each do |ins| | ||
puts " case #{ins.bytecode}: // #{ins.opcode}" | ||
case ins.arg_count | ||
when 2 | ||
puts " SPECIFIC->visit_#{ins.opcode}(opcode_arg(0), opcode_arg(1));" | ||
when 1 | ||
puts " SPECIFIC->visit_#{ins.opcode}(opcode_arg(0));" | ||
when 0 | ||
puts " SPECIFIC->visit_#{ins.opcode}();" | ||
else | ||
raise "huh?" | ||
end | ||
puts " advance(#{ins.arg_count + 1});" | ||
puts " return;" | ||
end | ||
|
||
puts " }" | ||
|
||
puts "}" | ||
|
||
InstructionSet::OpCodes.each do |ins| | ||
puts "template <class SubClass>" | ||
case ins.arg_count | ||
when 2 | ||
puts "void VisitInstructions::visit_#{ins.opcode}(opcode arg1, opcode arg2)" | ||
puts "{\n SPECIFIC->visit(#{ins.bytecode}, arg1, arg2);\n}" | ||
when 1 | ||
puts "void VisitInstructions::visit_#{ins.opcode}(opcode arg1)" | ||
puts "{\n SPECIFIC->visit(#{ins.bytecode}, arg1, -1);\n}" | ||
when 0 | ||
puts "void VisitInstructions::visit_#{ins.opcode}()" | ||
puts "{\n SPECIFIC->visit(#{ins.bytecode}, -1, -1);\n}" | ||
else | ||
raise "huh?" | ||
end | ||
|
||
puts | ||
|
||
end |
Oops, something went wrong.