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

replace / to . on fun_literal_name #6058

Closed
wants to merge 2 commits into from

Conversation

S-YOU
Copy link

@S-YOU S-YOU commented May 4, 2018

LLVM's opt tool generate .dot files on each function like following

opt hello.ll -dot-cfg > /dev/null

Writing 'cfg.~procProc(Nil)@src/dpdk/patches.cr:99.dot'...  error opening file for writing!
Writing 'cfg.~proc2Proc(Nil)@src/dpdk/patches.cr:99.dot'...  error opening file for writing!

but on linux you will get an error with slash in filename.

This PR should fixes that to following

Writing 'cfg.~procProc(Nil)@src.dpdk.patches.cr:99.dot'...
Writing 'cfg.~proc2Proc(Nil)@src.dpdk.patches.cr:99.dot'...

@wooster0
Copy link
Contributor

wooster0 commented May 4, 2018

I think just name.gsub('/', '.') is better. This does the same but probably more efficient and shorter.

@S-YOU
Copy link
Author

S-YOU commented May 4, 2018

I don't know, It is used to be with gsub on 0.24.2 on previous if block.

https://github.com/crystal-lang/crystal/blob/0.24.2/src/compiler/crystal/codegen/codegen.cr#L2045

but somehow on master, if block is using with String.build and .each_char, so, I am following it.

@S-YOU
Copy link
Author

S-YOU commented May 4, 2018

Looks like gsub do more memory allocations but it is indeed faster, so I will update this.

@Sija
Copy link
Contributor

Sija commented May 4, 2018

I'm very much against this change. This is a path, and as such it needs to have slashes in it. I'm actively using it in raven.cr for instance.

@S-YOU
Copy link
Author

S-YOU commented May 4, 2018

OK, closing because I don't care. But this is NOT the path by the point of view on LLVM. You're just using side effect, which already not working on Windows.

@S-YOU S-YOU closed this May 4, 2018
@S-YOU S-YOU deleted the safe_mangling_slash branch May 4, 2018 14:06
@RX14
Copy link
Contributor

RX14 commented May 4, 2018

This is mangling the symbol name, not mangling the debug info. I really don't have an opinion on this patch but it won't (shouldn't) affect backtraces unless you use --no-debug.

@S-YOU
Copy link
Author

S-YOU commented May 4, 2018

He is extracting backtrace messages with regexes, thats why he don't like.

@RX14
Copy link
Contributor

RX14 commented May 4, 2018

Well breaking someone's brittle backtrace parsing isn't a good enough reason to reject the PR.

@Sija
Copy link
Contributor

Sija commented May 4, 2018

@RX14 perhaps not, but I'd like to see other way for extracting such information from a backtrace which doesn't provide it otherwise, like in case of Procs. Also, I'm not sure what's so brittle about it...

@RX14
Copy link
Contributor

RX14 commented May 4, 2018

What's not brittle about parsing backtraces with regexes? We make no guarantees about backtraces, and their syntax may well change well after 1.0.

@Sija
Copy link
Contributor

Sija commented May 4, 2018

@RX14 well, 100% parsing reliability doesn't seem brittle at all to me.

@asterite
Copy link
Member

asterite commented May 4, 2018

This is mangling specific to a Proc. I included the line because it was cute and at that time we didn't have accurate backraces (well, now we don't, either, but we are close). The mangling for Proc should be changed, and it should not include the path/line/column in it.

@Sija
Copy link
Contributor

Sija commented May 4, 2018

In any case having accurate backtraces (including path/line/column information) I'd say is pretty important, especially for tools like sentry/raven.

@asterite
Copy link
Member

asterite commented May 4, 2018

Yes, but that has nothing to do with the mangling used for a Proc.

Basically, if you have:

->{ 1 + 2 }

that will generate an LLVM function whose name has the location in it, which is totally useless, as that location is also recorded if you compile with debug info.

@Sija
Copy link
Contributor

Sija commented May 4, 2018

@asterite IMO that's alright as long as that location is going to be presented within the backtrace.

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