aboutsummaryrefslogtreecommitdiffstats
path: root/tool/mjit
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-09-19 09:25:04 +0900
committerTakashi Kokubun <takashikkbn@gmail.com>2022-09-23 06:44:28 +0900
commit280ff1707e1e0e5f06d9819dc5f8d8deb38b3f6c (patch)
treecd059b3aa935d7f208609efba91a0253b1c2e817 /tool/mjit
parent5cda5938f899ca9ac72f1e44c216f63826516422 (diff)
downloadruby-280ff1707e1e0e5f06d9819dc5f8d8deb38b3f6c.tar.gz
Drop c_64 and c_32
Diffstat (limited to 'tool/mjit')
-rwxr-xr-xtool/mjit/bindgen.rb21
1 files changed, 7 insertions, 14 deletions
diff --git a/tool/mjit/bindgen.rb b/tool/mjit/bindgen.rb
index ac95bbe639..9676069b16 100755
--- a/tool/mjit/bindgen.rb
+++ b/tool/mjit/bindgen.rb
@@ -126,7 +126,7 @@ class BindingGenerator
@references = Set.new
end
- def generate(_nodes)
+ def generate(nodes)
println @preamble
# Define USE_* macros
@@ -145,18 +145,9 @@ class BindingGenerator
println
end
- print @postamble
- end
-
- # TODO: Remove this
- def legacy_generate(nodes)
# TODO: Support nested declarations
nodes_index = nodes.group_by(&:spelling).transform_values(&:last)
- println "require_relative 'c_type'"
- println
- println "module RubyVM::MJIT"
-
# Define types
@types.each do |type|
unless definition = generate_node(nodes_index[type])
@@ -170,12 +161,13 @@ class BindingGenerator
# Leave a stub for types that are referenced but not targeted
(@references - @types).each do |type|
- println " def C.#{type} = #{DEFAULTS[type]}"
+ println " def C.#{type}"
+ println " #{DEFAULTS[type]}"
+ println " end"
println
end
- chomp
- println "end"
+ print @postamble
end
private
@@ -261,10 +253,11 @@ class BindingGenerator
else
begin
ctype = Fiddle::Importer.parse_ctype(type)
- "CType::Immediate.new(#{ctype})"
rescue Fiddle::DLError
push_target(type)
"self.#{type}"
+ else
+ "CType::Immediate.new(#{ctype})"
end
end
end