Package jdk.graal.compiler.graphio
Interface GraphLocations<M,P,L>
- Type Parameters:
M
- type representing methodsP
- type representing source code locationL
- represetingstack element
location
public interface GraphLocations<M,P,L>
Provides source location information about compiled code. This interface is an extension of
GraphElements
- by default the elements work with classical StackTraceElement
.
Should the default behavior not be sufficient, feel free to implement the additional operations
available in this interface and register your implementation when building
the GraphOutput
instance.- Since:
- 0.33 part of GraalVM 0.33
-
Method Summary
Modifier and TypeMethodDescriptionlocationLanguage
(L location) Identification of the language.int
locationLineNumber
(L location) Line number of a location.int
locationOffsetEnd
(L location) Offset of the location.int
locationOffsetStart
(L location) Offset of the location.locationURI
(L location) The universal resource identification that contains the location.If the location can be found in an assummably accessible resource, then use such resource identification.methodLocation
(M method, int bci, P pos) Stack trace element for a method, index and position.
-
Method Details
-
methodLocation
Stack trace element for a method, index and position. Returns all applicable source locations for given code position. Each provided location is expected to represent location in a differentlanguage
.- Parameters:
method
- the methodbci
- the indexpos
- the position- Returns:
- elements representing location for all language strata
-
locationLanguage
Identification of the language. Each location can point to a source in a different language - e.g. each location can have multiple strata.- Parameters:
location
- the location- Returns:
- id of the language/strata
-
locationURI
The universal resource identification that contains the location.If the location can be found in an assummably accessible resource, then use such resource identification. It is up to the side processing the URI to load the content from the location. Protocols schemefile
,http
, orhttps
are assumed to be accessible.If the location is inside of a virtual source, or source which is unlikely to be accessible outside of running program, then it may be better to encode the whole source into the resource identifier. This can be done by using data URIs like:
data:text/javascript,alert('Vivat graphs!')
- Parameters:
location
- the location- Returns:
- the file name for the given location or
null
if it is not known - Throws:
URISyntaxException
- yielding this exception aborts the graph dumping
-
locationLineNumber
Line number of a location. The first line in the source file is one. Negative value means the line location isn't available. In such situation one can provide an offset driven location co-ordinates vialocationOffsetStart(java.lang.Object)
andlocationOffsetEnd(java.lang.Object)
methods.- Parameters:
location
- the location- Returns:
- the line number for given location, negative value means no line
-
locationOffsetStart
Offset of the location. In certain situations it is preferrable to specify offset rather thanline number
of a location in source. In such case return the start offset from this method and end offset vialocationOffsetEnd(java.lang.Object)
method. Offsets are counted from0
.- Parameters:
location
- the location- Returns:
- the starting offset of the location, negative value means no offset
-
locationOffsetEnd
Offset of the location. In certain situations it is preferrable to specify offset rather thanline number
of a location in source. In such case return the start offset vialocationOffsetStart(java.lang.Object)
method and end from this method. Offsets are counted from0
.- Parameters:
location
- the location- Returns:
- the end offset (exclusive) of the location, negative value means no offset
-