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

Added get_callee() which determines the right routine of the return values of get_callees() #2775

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

schreiberx
Copy link
Collaborator

It does what's in the title.

@arporter
Copy link
Member

Thanks @schreiberx, unfortunately, linting is still failing.

In case it helps, I have the following pre-push hook setup:

$ cat PSyclone/.git/hooks/pre-push
#!/usr/bin/sh

# An example hook script to verify what is about to be pushed.  Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed.  If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
#   <local ref> <local oid> <remote ref> <remote oid>
#
# This script ensures that the whole of PSyclone is linted successfully
# before the push is executed.

remote="$1"
url="$2"

if ! command -v flake8; then
    echo "WARNING: source not linted because flake8 unavailable"
    exit 0
fi

flake8=$(flake8 src/psyclone)
if (( flake8 == 1 )); then
    echo "Linting failed"
else
    echo "Linting succeeded"
fi
exit $flake8

@schreiberx
Copy link
Collaborator Author

Hi Andy, Thanks for this script.
I think that all these helper scripts should be part of psyclone to quickly run them over the source code. I added this script in the newest pushed version in bin_git/run_flake8.sh.
Cheers,
Martin

Copy link

codecov bot commented Nov 13, 2024

Codecov Report

Attention: Patch coverage is 95.65217% with 3 lines in your changes missing coverage. Please review.

Project coverage is 99.87%. Comparing base (a33a99b) to head (e4ac880).

Files with missing lines Patch % Lines
src/psyclone/psyir/nodes/call.py 95.38% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2775      +/-   ##
==========================================
- Coverage   99.88%   99.87%   -0.01%     
==========================================
  Files         356      356              
  Lines       49479    49540      +61     
==========================================
+ Hits        49421    49479      +58     
- Misses         58       61       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

@arporter arporter added under review PSyIR Core PSyIR functionality labels Nov 14, 2024
@arporter
Copy link
Member

@schreiberx please could you hold off making further changes until I pass it back to you? It's hard to review if code changes underneath me while I'm doing it :-)

@schreiberx
Copy link
Collaborator Author

These changes are only addressing increasing the coverage to 100% since the codecov bot complained with "Please review."
I'll keep my hands off for now :-)

Copy link
Member

@arporter arporter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks very much for this Martin. I like the new routine making use of the existing functionality, that seems sensible. I did struggle to get my head around it so you'll see I've requested that some comments be tweaked or added.
As I say in the review, I think a little work on the frontend for those situations where we hit OPTIONAL could really help here.
The only thing I'm really not sure of is the passing around of the list of integers. That seems a bit odd so I'd like to understand why you do that.
I've not looked at the test suite yet (but thanks for addressing the missed lines).

README.md Outdated Show resolved Hide resolved
.gitignore Outdated Show resolved Hide resolved
bin_git/run_flake8.sh Outdated Show resolved Hide resolved
bin_git/run_flake8.sh Outdated Show resolved Hide resolved
src/psyclone/psyir/nodes/call.py Outdated Show resolved Hide resolved
src/psyclone/psyir/nodes/call.py Show resolved Hide resolved
src/psyclone/psyir/nodes/call.py Show resolved Hide resolved
src/psyclone/psyir/nodes/call.py Outdated Show resolved Hide resolved
src/psyclone/psyir/nodes/call.py Show resolved Hide resolved
src/psyclone/psyir/nodes/call.py Outdated Show resolved Hide resolved
@arporter
Copy link
Member

Back to @schreiberx :-)

@schreiberx
Copy link
Collaborator Author

Back to @arporter :-)

src/psyclone/psyir/nodes/call.py Show resolved Hide resolved
src/psyclone/psyir/nodes/call.py Outdated Show resolved Hide resolved
src/psyclone/psyir/nodes/call.py Outdated Show resolved Hide resolved
src/psyclone/psyir/nodes/call.py Outdated Show resolved Hide resolved
src/psyclone/psyir/nodes/call.py Outdated Show resolved Hide resolved
Copy link
Collaborator Author

@schreiberx schreiberx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Back to @arporter :-)

Copy link
Member

@arporter arporter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the updates Martin. I think the main thing to agree upon now is how best to return the information on the argument mapping. Apart from that it's a matter of tidying a few things. You also still have a couple of lines missing from coverage (but best to leave that until we've hammered-out the implementation).
I have the one-line fix to improve our OPTIONAL support as #2785 which is just waiting on review. Since it's so simple, you could merge that branch into this one.

doc/developer_guide/system_specific_setup.rst Outdated Show resolved Hide resolved
src/psyclone/psyir/nodes/call.py Show resolved Hide resolved
src/psyclone/psyir/nodes/call.py Show resolved Hide resolved
src/psyclone/tests/psyir/nodes/call_test.py Outdated Show resolved Hide resolved
src/psyclone/tests/psyir/nodes/call_test.py Outdated Show resolved Hide resolved
src/psyclone/tests/psyir/nodes/call_test.py Show resolved Hide resolved
routine_main: Routine = root_node.walk(Routine)[0]
assert routine_main.name == "main"

if 1:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove all these ifs and print statements (but do add comments describing what specific case each part of the test is for).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These if statements are very handy for debugging potential future problems. Setting some of them to '0' allows you to skip this subtest.

Also, the print statements provide helpful output again for debugging.
I don't understand why there should be no output. Is this a convention from PSyclone?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: The indentation with the "if 1" statements also structures such subtests nicely, hence, improving readability :-)

src/psyclone/tests/psyir/nodes/call_test.py Outdated Show resolved Hide resolved
src/psyclone/tests/psyir/nodes/call_test.py Show resolved Hide resolved
src/psyclone/tests/psyir/nodes/call_test.py Outdated Show resolved Hide resolved
@schreiberx
Copy link
Collaborator Author

Back to @arporter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PSyIR Core PSyIR functionality reviewed with actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants