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

CALLING-METHOD: Unable to call postcircumfix $bt[ (Any) ] with a type object #40

Open
hythm7 opened this issue Nov 4, 2019 · 10 comments

Comments

@hythm7
Copy link
Collaborator

hythm7 commented Nov 4, 2019

I'm getting CALLING-METHOD error when adding many children to a container, If I lowered down the number of children ( to may be "150" child ) the error goes away.

I reduced the problem to the below code:

#!/usr/bin/env perl6

use GTK::Application;
use GTK::FlowBox;
use GTK::Label;

GTK::Application.new;

my $str = q:to/END/;        # Reducing number of children by removing one line from $str fix the issue
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
abcdefghijklmnopqrstuvwxyz
END

my $flowbox = GTK::FlowBox.new;

for $str.words.join.comb -> $sym {
  $flowbox.add: GTK::Label.new: $sym;
}

### OUTPUT
# Unable to call postcircumfix $bt[ (Any) ] with a type object
# Indexing requires a defined object
#  in method CALLING-METHOD at /home/hythm/dev/GTK/p6-GtkPlus/lib/GTK/Roles/Protection.pm6 (GTK::Roles::Protection) line 17
#  in method IS-PROTECTED at /home/hythm/dev/GTK/p6-GtkPlus/lib/GTK/Roles/Protection.pm6 (GTK::Roles::Protection) line 54
#  in method add at /home/hythm/dev/GTK/p6-GtkPlus/lib/GTK/FlowBox.pm6 (GTK::FlowBox) line 219
#  in block <unit> at tmp/sym.p6 line 1

@Xliff
Copy link
Owner

Xliff commented Nov 4, 2019 via email

@Xliff
Copy link
Owner

Xliff commented Nov 6, 2019

Ah! This is related to the deprecated GTK::Roles::Types. I just haven't had a chance to circle back and fix it all (as it's a LOT of code).

Thanks for finding this. I hope to have a fix in git, shortly.

@Xliff
Copy link
Owner

Xliff commented Nov 6, 2019

@hythm7 - Actually, this looks to go deeper than that. For one thing, the IS-PROTECTED method is not called directly by GTK::FlowBox at all. I've gone through and added the missing code you pointed out at #41, so the only thing I can think of is that it is related to the number of items... but it should not be.

This may require more of a think.

@Xliff
Copy link
Owner

Xliff commented Nov 6, 2019

@hythm7 - I've managed to get it to work if I run it through at least 3 times. Can you confirm this behavior?

Also, what version of rakudo are you using? I'm using Rakudo version 2019.07.1-443-gcfc0f46c0 built on MoarVM version 2019.07.1-298-g67b6acf71. You may want to upgrade to latest moar-blead if you can.

@hythm7
Copy link
Collaborator Author

hythm7 commented Nov 6, 2019

@Xliff Thanks for looking into that.

I upgraded to latest moar-blead ( and removed GTK top directory and cloned the repos again to GTK top directory ). here is my Raku version:

bash-4.2$ perl6 --version
This is Rakudo version 2019.07.1-463-g1d84c64 built on MoarVM version 2019.07.1-313-g836396c
implementing Perl 6.d.

I ran the script few times, here is the output:

0 means exited successfully
1 means threw the mentioned error:

0 
1
1
1
1
0
1
1
1
0
0
1
1
0
1

@hythm7
Copy link
Collaborator Author

hythm7 commented Nov 6, 2019

Just to clarify, the script I ran was t/0392-issue_40.t

@Xliff
Copy link
Owner

Xliff commented Nov 6, 2019

Thanks for that. It looks to be an issue with rakudo, especially when dealing with NativeCall. I've been dealing with flappers like this all throughout the project, and they are inexplicable. I am wondering if it has something to do with memory management as, outside of Widgets, no attempt at proper reference counting (read: freeing resources) is even made.

It's a bit disturbing, though. If the same code can work, why does it not work consistently? The fact that the code is not changed and has this degree of variance bothers me. It would be nice if I could golf the situation down to a specific case, but so far I have had no luck.

Caveat emptor, though. Until I can figure out the cause, p6-GtkPlus will remain unusable for medium to large size projects.

I will leave this bug open until I can figure out why.

@hythm7
Copy link
Collaborator Author

hythm7 commented Nov 7, 2019

@Xliff : I saw your conversation with timotimo on #raku and I went ahead and tested with:

export MVM_SPESH_DISABLE=1 MVM_JIT_DISABLE=1 MVM_SPESH_INLINE_DISABLE=1 SPESH_OSR_DISABLE=1 SPESH_PEA_DISABLE=1 SPESH_OSR_DISABLE=1 SPESH_PEA_DISABLE=1

ran the script 42 times (even with many more children), It succeeded every time. no errors anymore. it also fixed #41

@Xliff
Copy link
Owner

Xliff commented Nov 7, 2019

@hythm7 - Ah! Good to know. Now to see the minimal number of those we need to make it work.

Thanks!

@Xliff
Copy link
Owner

Xliff commented Nov 7, 2019

MVM_SPESH_DISABLE=1 works
MVM_SPESH_INLINE_DISABLE also works
SPESH_OSR_DISABLE and SPESH_PEA_DISABLE have no effect.

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

2 participants