Shopify / seafoam

A tool for working with compiler graphs dumped by the GraalVM compiler
MIT License
126 stars 22 forks source link

Mermaid renderer can't handle some nodes #87

Closed nirvdrum closed 5 months ago

nirvdrum commented 5 months ago

While generating Mermaid graphs with TruffleRuby 24.0.0 I ran into an instance where the output is not valid Mermaid syntax. I've extracted the problematic snippet from a larger graph:

flowchart TD
  node3("3 @{:declaring_class=>\"com.oracle.truffle.runtime.OptimizedCallTarget\", :method_name=>\"profiledPERoot\", :signature=>{:args=>[\"[Ljava/lang/Object;\"], :ret=>\"Ljava/lang/Object;\"}, :modifiers=>20}:0")
nirvdrum commented 5 months ago

It's the nested double-quotes. It looks like Mermaid doesn't always honor the escape character. The solution appears to be replacing " with #quot; in the node labels.