Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
694eed3
commit ef9ef71
Showing
29 changed files
with
1,697 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
src/main/java/org/adoptopenjdk/jitwatch/jarscan/FreqInlineCounter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,61 @@ | |||
package org.adoptopenjdk.jitwatch.jarscan; | |||
|
|||
import static org.adoptopenjdk.jitwatch.core.JITWatchConstants.C_COMMA; | |||
import static org.adoptopenjdk.jitwatch.core.JITWatchConstants.C_DOUBLE_QUOTE; | |||
import static org.adoptopenjdk.jitwatch.core.JITWatchConstants.S_STATIC_INIT; | |||
import static org.adoptopenjdk.jitwatch.core.JITWatchConstants.S_NEWLINE; | |||
|
|||
import java.util.List; | |||
|
|||
import org.adoptopenjdk.jitwatch.model.MemberSignatureParts; | |||
import org.adoptopenjdk.jitwatch.model.bytecode.BytecodeInstruction; | |||
import org.adoptopenjdk.jitwatch.model.bytecode.MemberBytecode; | |||
|
|||
public class FreqInlineCounter implements IJarScanOperation | |||
{ | |||
private int freqInlineSize; | |||
|
|||
private StringBuilder builder = new StringBuilder(); | |||
|
|||
public FreqInlineCounter(int freqInlineSize) | |||
{ | |||
this.freqInlineSize = freqInlineSize; | |||
} | |||
|
|||
public String getReport() | |||
{ | |||
return builder.toString(); | |||
} | |||
|
|||
@Override | |||
public void processInstructions(String className, MemberBytecode memberBytecode) | |||
{ | |||
List<BytecodeInstruction> instructions = memberBytecode.getInstructions(); | |||
|
|||
if (instructions != null && instructions.size() > 0) | |||
{ | |||
BytecodeInstruction lastInstruction = instructions.get(instructions.size() - 1); | |||
|
|||
// final instruction is a return for 1 byte | |||
int bcSize = 1 + lastInstruction.getOffset(); | |||
|
|||
MemberSignatureParts msp = memberBytecode.getMemberSignatureParts(); | |||
|
|||
if (bcSize >= freqInlineSize && !S_STATIC_INIT.equals(msp.getMemberName())) | |||
{ | |||
builder.append(C_DOUBLE_QUOTE); | |||
builder.append(className); | |||
builder.append(C_DOUBLE_QUOTE); | |||
builder.append(C_COMMA); | |||
|
|||
builder.append(C_DOUBLE_QUOTE); | |||
builder.append(msp.getMemberName()); | |||
builder.append(C_DOUBLE_QUOTE); | |||
builder.append(C_COMMA); | |||
|
|||
builder.append(bcSize); | |||
builder.append(S_NEWLINE); | |||
} | |||
} | |||
} | |||
} |
15 changes: 15 additions & 0 deletions
15
src/main/java/org/adoptopenjdk/jitwatch/jarscan/IJarScanOperation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,15 @@ | |||
/* | |||
* Copyright (c) 2013-2016 Chris Newland. | |||
* Licensed under https://github.com/AdoptOpenJDK/jitwatch/blob/master/LICENSE-BSD | |||
* Instructions: https://github.com/AdoptOpenJDK/jitwatch/wiki | |||
*/ | |||
package org.adoptopenjdk.jitwatch.jarscan; | |||
|
|||
import org.adoptopenjdk.jitwatch.model.bytecode.MemberBytecode; | |||
|
|||
public interface IJarScanOperation | |||
{ | |||
void processInstructions(String className, MemberBytecode memberBytecode); | |||
|
|||
String getReport(); | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.