--- /dev/null 2016-10-25 08:46:44.038854975 +0200
+++ new/src/share/classes/sun/evtracing/parser/metadata/JavaStack.java 2016-10-25 10:40:41.993799247 +0200
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2014, 2015, Dynatrace and/or its affiliates. All rights reserved.
+ *
+ * This file is part of the Lock Contention Tracing Subsystem for the HotSpot
+ * Virtual Machine, which is developed at Christian Doppler Laboratory on
+ * Monitoring and Evolution of Very-Large-Scale Software Systems. Please
+ * contact us at if you need additional information
+ * or have any questions.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work. If not, see .
+ *
+ */
+package sun.evtracing.parser.metadata;
+
+import java.util.ListIterator;
+
+import sun.evtracing.processing.MetadataStore;
+
+public class JavaStack implements Iterable {
+
+ public static final JavaStack UNKNOWN = new JavaStack(JavaStackData.UNKNOWN);
+ public static final JavaStack READERS = new JavaStack(JavaStackData.UNKNOWN);
+ public static final JavaStack UNCONTENDED = new JavaStack(JavaStackData.UNKNOWN);
+ public static final JavaStack HIDDEN = new JavaStack(JavaStackData.UNKNOWN);
+
+ private JavaStack assigned;
+ private JavaStackData data;
+
+ public JavaStack() {
+ }
+
+ private JavaStack(JavaStackData data) {
+ this.data = data;
+ }
+
+ private JavaStackData data() {
+ if (data == null && assigned != null && assigned.isSet()) {
+ // transfer reference
+ data = assigned.data();
+ assigned = null;
+ }
+ return data;
+ }
+
+ public boolean isSet() {
+ return (data() != null);
+ }
+
+ public boolean isUnknown() {
+ assert isSet();
+ return (data() == JavaStackData.UNKNOWN);
+ }
+
+ public void fill(long[] methods, int[] bcis, MetadataStore metadataStore) {
+ assert (data == null && assigned == null) : "only one set/assign allowed";
+ data = new JavaStackData(methods, bcis, metadataStore);
+ }
+
+ public void assign(JavaStack other) {
+ assert (data == null && assigned == null) : "only one set/assign allowed";
+ assigned = other;
+ }
+
+ public int frameCount() {
+ return data().frameCount();
+ }
+
+ public boolean hasMethodFromClassLoader(long classLoader) {
+ return data().hasMethodFromClassLoader(classLoader);
+ }
+
+ @Override
+ public ListIterator iterator() {
+ return data().iterator();
+ }
+
+ public ListIterator lastIterator() {
+ return data().lastIterator();
+ }
+
+ @Override
+ public String toString() {
+ return data().toString();
+ }
+
+}