Skip to content

Commit e525636

Browse files
committed
Merge master to release-1.3
2 parents 3109093 + 21d91fa commit e525636

25 files changed

+349
-311
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ junit*
2626
*.iml
2727
.gradle
2828
.idea
29+
!/lib/btrace-asm-*.jar
2930
!/lib/btrace-jctools-core-*.jar
31+
!/lib/btrace-hppcrt-*.jar
3032
CHANGELOG.md
3133
gradle.properties
3234
/.nb-gradle/

LICENSE-3RD-PARTY.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ THE POSSIBILITY OF SUCH DAMAGE.
3131

3232

3333
[lib/btrace-jctools-1.2.jar](https://github.com/JCTools/JCTools)
34+
[lib/btrace-hppcrt-0.7.4.jar](https://github.com/vsonnier/hppcrt)
3435
Apache License
3536
Version 2.0, January 2004
3637
http://www.apache.org/licenses/

build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ task unjar(type: Copy) {
203203

204204
from([
205205
zipTree("lib/btrace-asm-${asmVersion}.jar"),
206-
zipTree("lib/btrace-jctools-core-1.2.jar")
206+
zipTree("lib/btrace-jctools-core-1.2.jar"),
207+
zipTree("lib/btrace-hppcrt-0.7.4.jar")
207208
])
208209
into compileJava.destinationDir
209210
}
@@ -402,6 +403,7 @@ test {
402403
dependencies {
403404
compile files("lib/btrace-asm-${asmVersion}.jar",
404405
"lib/btrace-jctools-core-1.2.jar",
406+
"lib/btrace-hppcrt-0.7.4.jar",
405407
"${javaHome}/lib/tools.jar", // ATTENTION: build.xml uses "${javaHome}/../lib/tools.jar"
406408
files(((URLClassLoader) ToolProvider.getSystemToolClassLoader()).getURLs()),
407409
"/usr/share/lib/java/dtrace.jar")

lib/btrace-hppcrt-0.7.4.jar

78 KB
Binary file not shown.

lib/jarjar.rules

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,23 @@ zap org.jctools.queues.atomic.**
1212
zap org.jctools.queues.Spmc**
1313
zap org.jctools.queues.Spsc**
1414
zap org.jctools.queues.MpscLinkedQueue**
15+
16+
# hpcc subset
17+
rule com.carrotsearch.** com.sun.btrace.@0
18+
keep com.carrotsearch.hppcrt.IntObjectMap
19+
keep com.carrotsearch.hppcrt.ObjectIntMap
20+
keep com.carrotsearch.hppcrt.IntObjectAssociativeContainer
21+
keep com.carrotsearch.hppcrt.IntObjectCursor
22+
keep com.carrotsearch.hppcrt.ObjectIntAssociativeContainer
23+
keep com.carrotsearch.hppcrt.ObjectIntCursor
24+
keep com.carrotsearch.hppcrt.cursors.IntCursor
25+
keep com.carrotsearch.hppcrt.cursors.ObjectCursor
26+
keep com.carrotsearch.hppcrt.maps.IntObjectHashMap
27+
keep com.carrotsearch.hppcrt.predicates.IntObjectPredicate
28+
keep com.carrotsearch.hppcrt.predicates.IntPredicate
29+
keep com.carrotsearch.hppcrt.predicates.ObjectPredicate
30+
keep com.carrotsearch.hppcrt.procedures.IntObjectProcedure
31+
keep com.carrotsearch.hppcrt.procedures.IntProcedure
32+
keep com.carrotsearch.hppcrt.procedures.ObjectProcedure
33+
keep com.carrotsearch.hppcrt.maps.ObjectIntHashMap
34+
keep com.carrotsearch.hppcrt.maps.IntObjectHashMap

src/share/classes/com/sun/btrace/SharedSettings.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,18 +102,19 @@ public void from(Map<String, Object> params) {
102102
}
103103

104104
public void from(SharedSettings other) {
105+
clientName = other.clientName;
105106
debug = other.debug;
106107
dumpDir = other.dumpDir;
107-
trackRetransforms = other.trackRetransforms;
108-
unsafe = other.unsafe;
109-
probeDescPath = other.probeDescPath;
110-
statsdHost = other.statsdHost;
111-
statsdPort = other.statsdPort;
112108
fileRollMilliseconds = other.fileRollMilliseconds;
113109
fileRollMaxRolls = other.fileRollMaxRolls;
114110
outputFile = other.outputFile;
115111
outputDir = other.outputDir;
116-
clientName = other.clientName;
112+
probeDescPath = other.probeDescPath;
113+
retransformStartup = other.retransformStartup;
114+
statsdHost = other.statsdHost;
115+
statsdPort = other.statsdPort;
116+
trackRetransforms = other.trackRetransforms;
117+
unsafe = other.unsafe;
117118
}
118119

119120
public boolean isDebug() {

src/share/classes/com/sun/btrace/agent/Client.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private Client(Instrumentation inst, SharedSettings s, BTraceTransformer t) {
121121

122122
protected final void setupWriter() {
123123
String outputFile = settings.getOutputFile();
124-
if (outputFile == null) return;
124+
if (outputFile == null || outputFile.equals("::null")) return;
125125

126126
if (!outputFile.equals("::stdout")) {
127127
String outputDir = settings.getOutputDir();

src/share/classes/com/sun/btrace/agent/FileClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ private static byte[] readAll(File file) throws IOException {
100100
private static byte[] readAll(InputStream is, int size) throws IOException {
101101
if (is == null) throw new NullPointerException();
102102

103-
byte[] buf = new byte[size != -1 ? size : 1024];
103+
byte[] buf = new byte[size != -1 ? size : 8192];
104104
int bufsize = buf.length;
105105
int off = 0;
106106
int read;

src/share/classes/com/sun/btrace/compiler/VerifierVisitor.java

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@
4040
import com.sun.btrace.annotations.OnExit;
4141
import com.sun.btrace.annotations.OnMethod;
4242
import com.sun.btrace.annotations.Sampled;
43+
import com.sun.btrace.com.carrotsearch.hppcrt.ObjectIntMap;
44+
import com.sun.btrace.com.carrotsearch.hppcrt.maps.ObjectIntHashMap;
4345
import com.sun.btrace.util.Messages;
4446
import com.sun.source.util.TreePath;
4547
import com.sun.tools.javac.tree.JCTree;
4648
import java.util.ArrayList;
4749
import java.util.Collection;
4850
import java.util.EnumSet;
49-
import java.util.HashMap;
50-
import java.util.Map;
5151
import javax.lang.model.element.Element;
5252
import javax.lang.model.element.ElementKind;
5353
import javax.lang.model.element.ExecutableElement;
@@ -284,20 +284,13 @@ public Boolean visitMethod(MethodTree node, Void v) {
284284
}
285285
}
286286

287-
final Map<String, Integer> annotationHisto = new HashMap<>();
287+
final ObjectIntMap<String> annotationHisto = new ObjectIntHashMap<>();
288288
for(VariableTree vt : node.getParameters()) {
289289
vt.accept(new TreeScanner<Void, Void>() {
290290
@Override
291291
public Void visitAnnotation(AnnotationTree at, Void p) {
292292
String annType = at.getAnnotationType().toString();
293-
Integer cnt = annotationHisto.get(annType);
294-
if (cnt == null) {
295-
cnt = 0;
296-
} else {
297-
reportError("multiple.param.annotation", at);
298-
cnt++;
299-
}
300-
annotationHisto.put(annType, cnt);
293+
annotationHisto.putOrAdd(annType, 0, 1);
301294
return super.visitAnnotation(at, p);
302295
}
303296
}, null);

src/share/classes/com/sun/btrace/runtime/Assembler.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,7 @@ public Assembler addLevelCheck(String clsName, Level level, Label jmp) {
532532
}
533533

534534
public Assembler addLevelCheck(String clsName, Interval itv, Label jmp) {
535-
getStatic(clsName, "$btrace$$level", Type.INT_TYPE.getDescriptor());
535+
getStatic(clsName, "$btrace$$level", INT_DESC);
536536
if (itv.getA() <= 0) {
537537
if (itv.getB() != Integer.MAX_VALUE) {
538538
ldc(itv.getB());
@@ -545,7 +545,7 @@ public Assembler addLevelCheck(String clsName, Interval itv, Label jmp) {
545545
} else {
546546
ldc(itv.getA());
547547
jump(Opcodes.IF_ICMPLT, jmp);
548-
getStatic(clsName, "$btrace$$level", Type.INT_TYPE.getDescriptor());
548+
getStatic(clsName, "$btrace$$level", INT_DESC);
549549
ldc(itv.getB());
550550
jump(Opcodes.IF_ICMPGT, jmp);
551551
}
@@ -568,20 +568,20 @@ public Assembler compareLevel(String clsName, Level level) {
568568
if (itv.getA() <= 0) {
569569
if (itv.getB() != Integer.MAX_VALUE) {
570570
ldc(itv.getB());
571-
getStatic(clsName, "$btrace$$level", Type.INT_TYPE.getDescriptor());
571+
getStatic(clsName, BTRACE_LEVEL_FLD, INT_DESC);
572572
sub(Type.INT_TYPE);
573573
}
574574
} else if (itv.getA() < itv.getB()) {
575575
if (itv.getB() == Integer.MAX_VALUE) {
576-
getStatic(clsName, "$btrace$$level", Type.INT_TYPE.getDescriptor());
576+
getStatic(clsName, BTRACE_LEVEL_FLD, INT_DESC);
577577
ldc(itv.getA());
578578
sub(Type.INT_TYPE);
579579
} else {
580580
Label l1 = new Label();
581581
Label l2 = new Label();
582582
ldc(itv.getA());
583583
jump(Opcodes.IF_ICMPLT, l1);
584-
getStatic(clsName, "$btrace$$level", Type.INT_TYPE.getDescriptor());
584+
getStatic(clsName, BTRACE_LEVEL_FLD, INT_DESC);
585585
ldc(itv.getB());
586586
jump(Opcodes.IF_ICMPGT, l1);
587587
ldc(0);

0 commit comments

Comments
 (0)