зеркало из https://github.com/github/ruby.git
Leave a comment about the limitation of Primitive
and adjust some code styling from that PR.
This commit is contained in:
Родитель
7ac74f5c77
Коммит
996776e936
12
rjit_c.rb
12
rjit_c.rb
|
@ -1541,13 +1541,17 @@ module RubyVM::RJIT # :nodoc: all
|
|||
end
|
||||
|
||||
def C.VALUE
|
||||
@VALUE ||= CType::Immediate.find(Primitive.cexpr!("SIZEOF(VALUE)"),
|
||||
Primitive.cexpr!("SIGNED_TYPE_P(VALUE)"))
|
||||
@VALUE ||= CType::Immediate.find(
|
||||
Primitive.cexpr!("SIZEOF(VALUE)"),
|
||||
Primitive.cexpr!("SIGNED_TYPE_P(VALUE)"),
|
||||
)
|
||||
end
|
||||
|
||||
def C.shape_id_t
|
||||
@shape_id_t ||= CType::Immediate.find(Primitive.cexpr!("SIZEOF(shape_id_t)"),
|
||||
Primitive.cexpr!("SIGNED_TYPE_P(shape_id_t)"))
|
||||
@shape_id_t ||= CType::Immediate.find(
|
||||
Primitive.cexpr!("SIZEOF(shape_id_t)"),
|
||||
Primitive.cexpr!("SIGNED_TYPE_P(shape_id_t)"),
|
||||
)
|
||||
end
|
||||
|
||||
def C.rb_id_table
|
||||
|
|
|
@ -182,9 +182,12 @@ class BindingGenerator
|
|||
unless generate_node(nodes_index[type])&.start_with?('CType::Immediate')
|
||||
raise "Non-immediate type is given to dynamic_types: #{type}"
|
||||
end
|
||||
# Only one Primitive.cexpr! is allowed for each line: https://github.com/ruby/ruby/pull/9612
|
||||
println " def C.#{type}"
|
||||
println " @#{type} ||= CType::Immediate.find(Primitive.cexpr!(\"SIZEOF(#{type})\"),"
|
||||
println " Primitive.cexpr!(\"SIGNED_TYPE_P(#{type})\"))"
|
||||
println " @#{type} ||= CType::Immediate.find("
|
||||
println " Primitive.cexpr!(\"SIZEOF(#{type})\"),"
|
||||
println " Primitive.cexpr!(\"SIGNED_TYPE_P(#{type})\"),"
|
||||
println " )"
|
||||
println " end"
|
||||
println
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче