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

[Truffle] Adding Unique IDs to neverDesignedForCompilation to trace #2656

Closed
wants to merge 1 commit into from

Conversation

bjfish
Copy link
Contributor

@bjfish bjfish commented Mar 6, 2015

This is just an idea in case you like it @chrisseaton

Add this method to RubyNode -

    public static void notDesignedForCompilation(String message) {
        CompilerAsserts.neverPartOfCompilation(message);
    }

Add Unique ID to notDesignedForCompilation method in All Methods -

    @Specialization(guards = {"!isRubyModule", "!isRubyBignum"})
    public Object alias(RubyBasicObject object) {
        notDesignedForCompilation("5c0619014d0a4e0f9880499ff32473e1");

Graal Output includes Unique IDs to trace which method caused the optfail

[truffle] opt fail         parse_string:json_test.rb:1068                              |Reason com.oracle.graal.nodes.util.GraphUtil$2: This code path should never be part of a compilation. [14342|Const(50ccd29854f84c51ab8b57d2c17deb1e)] 
[truffle] opt fail         parse_object:json_test.rb:1168                              |Reason com.oracle.graal.nodes.util.GraphUtil$2: This code path should never be part of a compilation. [29103|Const(f5e9acd064e245d5b35a193003490752)]

@chrisseaton
Copy link
Contributor

I think having a reason is a good idea, and I can see the advantage if they were descriptive, but if it's just an identifier can't you get that information anyway from -G:+TruffleExceptionsAreFatal and -G:+DumpOnError?

What do @nirvdrum and @eregon think?

@bjfish
Copy link
Contributor Author

bjfish commented Mar 6, 2015

@chrisseaton I think with these options I could only trace the first optfail that occurs.

@eregon
Copy link
Member

eregon commented Mar 6, 2015

👍 for adding the reason, but I think a descriptive comment is quite more helpful and less cryptic.
I do see the point of having immediately a unique identifier to find the source though, Graal/Truffle should really provide that if possible.
A good description of the reason would be quite nice as a documentation to why that method is not designed for compilation since it is not always trivial.

@bjfish
Copy link
Contributor Author

bjfish commented Mar 6, 2015

@eregon I agree something descriptive would be more useful (still should be a unique message though).
I only used a UUID right now because it would take significant amount of time to write a description for the 500+ places notDesignedForCompilation is used.

@eregon
Copy link
Member

eregon commented Mar 6, 2015

Maybe we could just derive some description from the node class name or the particular specialization node? Or use the backtrace if the Truffle description with -G:+DumpOnError is not precise enough.

@bjfish
Copy link
Contributor Author

bjfish commented Mar 6, 2015

@eregon also 👍 , I wish this was provided: "Graal/Truffle should really provide that if possible."

@nirvdrum
Copy link
Contributor

nirvdrum commented Mar 6, 2015

Maybe I'm missing something, but if Truffle auto-generated the ID, how would you grep through the source for it?

@bjfish
Copy link
Contributor Author

bjfish commented Mar 6, 2015

@eregon I tried using the node to get a backtrace but for some reason this was causing Graal to just hang when run

@nirvdrum I think he's thinking something like a backtrace line number

This is the script I used to update these

require 'securerandom'
files =  Dir.glob("truffle/**/*.java")
puts files.size
puts files.to_s
files.each do |filepath|
   text = File.read(filepath)
   replace = text.gsub(/notDesignedForCompilation\(\);/)  { |num| "notDesignedForCompilation(\"#{SecureRandom.uuid.gsub('-','')}\");" }
   File.open(filepath, "w") {|file| file.puts replace}
end

@eregon
Copy link
Member

eregon commented Mar 6, 2015

@bjfish do you have a particular example at hand so we can compare the alternatives?

@nirvdrum
Copy link
Contributor

nirvdrum commented Mar 6, 2015

@bjfish That's us generating the ID, which I'm actually okay with.

@bjfish
Copy link
Contributor Author

bjfish commented Mar 6, 2015

@eregon Sorry, I don't think I have anything to compare.

The dynamic stuff I've tried just causes Graal to hang / be really slow.

@chrisseaton
Copy link
Contributor

@bjfish we really appreciate this PR but we don't think it's right for the project. I think the unique identifiers in the source code look really out of place and really the emphasis should be on removing these notDesignedForCompilations rather than finding ways to making working with them easier.

We do understand your use case though, and we'll look at adding an option to Graal that prints the backtrace that you get with TruffleCompilationExceptionsAreFatal but doesn't actually exit.

Since you have your script, you can actually keep running that locally and then just not commit the results if you want to.

@chrisseaton chrisseaton closed this Mar 6, 2015
@chrisseaton chrisseaton added this to the truffle-dev milestone Mar 6, 2015
@enebo enebo added this to the Non-Release milestone Dec 7, 2017
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

Successfully merging this pull request may close these issues.

None yet

5 participants