Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimization problem with is copy #3147

Closed
p6rt opened this issue May 26, 2013 · 5 comments
Closed

Optimization problem with is copy #3147

p6rt opened this issue May 26, 2013 · 5 comments

Comments

@p6rt
Copy link

p6rt commented May 26, 2013

Migrated from rt.perl.org#118183 (status was 'resolved')

Searchable as RT118183$

@p6rt
Copy link
Author

p6rt commented Apr 17, 2013

From @moritz

09​:56 < [0xF]> question #​2​: sub foo(Int $x is copy) { $x = 5; } f(1);
  # Cannot assign to a non-container
09​:56 < tadzik> r​: sub foo(Int $x is copy) { $x = 5; }; foo(1);
09​:56 <+camelia> rakudo 4109be​: OUTPUT«Cannot modify an immutable value␤
  in block at /tmp/eHvKDUJqEz​:1␤␤»

This is a bug. 'is copy' should make sure there's always a container.

Cheers,
Moritz

@p6rt
Copy link
Author

p6rt commented May 26, 2013

From @lizmat

[14​:28​:22] <lizmat> r​: sub a ( $a is copy ) { $a=5 }; a(1)
[14​:28​:24] <+camelia> rakudo 0e206e​: OUTPUT«Cannot modify an immutable value␤ in block at /tmp/Dmc8P4X3n2​:1␤␤»

While checking into this at the PLPW, it appears that this is an optimization problem. If rakudo is run with --optimize=0, this does not occur.

Initial investigation points at src/vm/parrot/guts/bind.c, line 1104, where some optimization magic apparently is making the wrong decision.

This seems to be up jnthn's alley :-)

@p6rt
Copy link
Author

p6rt commented Jan 13, 2015

From @jnthn

On Sun May 26 05​:33​:34 2013, elizabeth wrote​:

[14​:28​:22] <lizmat> r​: sub a ( $a is copy ) { $a=5 }; a(1)
[14​:28​:24] <+camelia> rakudo 0e206e​: OUTPUT«Cannot modify an
immutable value␤ in block at /tmp/Dmc8P4X3n2​:1␤␤»

While checking into this at the PLPW, it appears that this is an
optimization problem. If rakudo is run with --optimize=0, this does
not occur.

Initial investigation points at src/vm/parrot/guts/bind.c, line 1104,
where some optimization magic apparently is making the wrong decision.

This seems to be up jnthn's alley :-)

Fixed in Rakudo a6ac643, tested in roast 3b76c73.

@p6rt
Copy link
Author

p6rt commented Jan 13, 2015

The RT System itself - Status changed from 'new' to 'open'

@p6rt p6rt closed this as completed Jan 13, 2015
@p6rt
Copy link
Author

p6rt commented Jan 13, 2015

@jnthn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant