Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 48 lines (40 sloc) 1.178 kB
a352624 Start of new LLVM JIT
Evan Phoenix authored
1 namespace :jit do
ddc4961 Add hand mantained types.ll and offset gen code
Evan Phoenix authored
2 task :generate_header do
3 puts "GEN vm/llvm/types.cpp.gen"
eff4aa4 @brixen Changed references from vm/external_libs to vendor.
brixen authored
4 `vendor/llvm/Release/bin/llvm-as < vm/llvm/types.ll > vm/gen/types.bc`
5 `vendor/llvm/Release/bin/llc -march=cpp -cppgen=contents -o vm/llvm/types.cpp.gen vm/gen/types.bc`
ddc4961 Add hand mantained types.ll and offset gen code
Evan Phoenix authored
6 end
7
8 task :generate_offsets do
9 classes = {}
10 File.open "vm/llvm/types.ll" do |f|
11 while line = f.gets
12 if m1 = /%"?(struct|union)\.rubinius::([^"]*)"?\s*=\s*type\s*\{\n/.match(line)
13 line = f.gets
14
15 fields = []
16 while line.strip != "}"
17 if m2 = /;\s*(.*)/.match(line)
18 fields << m2[1].strip
19 else
20 fields << nil
21 end
22
23 line = f.gets
24 end
25
26 classes[m1[2]] = fields
27 end
28 end
29 end
30
31 File.open "vm/llvm/offset_specific.hpp", "w" do |f|
32 f.puts "namespace offset {"
33
34 classes.each do |name, fields|
35 f.puts "namespace #{name.gsub('::', '_')} {"
36af7d9 @brixen Fixed shadowed local warning on 1.9.
brixen authored
36 fields.each_with_index do |n, idx|
37 if n
38 f.puts " const static int #{n} = #{idx};"
ddc4961 Add hand mantained types.ll and offset gen code
Evan Phoenix authored
39 end
40 end
41 f.puts "}"
42 end
43
44 f.puts "}"
45 end
46 end
a352624 Start of new LLVM JIT
Evan Phoenix authored
47 end
Something went wrong with that request. Please try again.