Project

General

Profile

Actions

Bug #20340

open

Ractor comments not applying to constant targets

Added by kddnewton (Kevin Newton) 8 months ago. Updated 7 months ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:117188]

Description

In this example:

C, = { foo: bar }

You get:

== disasm: #<ISeq:<main>@test.rb:1 (1,0)-(1,17)>
0000 putobject                              :foo                      (   1)[Li]
0002 putself
0003 opt_send_without_block                 <calldata!mid:bar, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0005 newhash                                2
0007 dup
0008 expandarray                            1, 0
0011 putspecialobject                       3
0013 setconstant                            :C
0015 leave

But there's no difference from:

# shareable_constant_value: literal
C, = { foo: bar }

I would have expected:

== disasm: #<ISeq:<main>@test.rb:1 (1,0)-(2,16)>
0000 putobject                              RubyVM::FrozenCore        (   2)[Li]
0002 putobject                              :foo
0004 putobject                              RubyVM::FrozenCore
0006 putself
0007 opt_send_without_block                 <calldata!mid:bar, argc:0, FCALL|VCALL|ARGS_SIMPLE>
0009 putobject                              "C"
0011 opt_send_without_block                 <calldata!mid:ensure_shareable, argc:2, ARGS_SIMPLE>
0013 newhash                                2
0015 opt_send_without_block                 <calldata!mid:make_shareable, argc:1, ARGS_SIMPLE>
0017 dup
0018 expandarray                            1, 0
0021 putspecialobject                       3
0023 setconstant                            :C
0025 leave

Is this omission intentional? For context, I'm building this in prism and I need to know if I should explicitly disable this behavior.

Actions

Also available in: Atom PDF

Like0
Like0