/* * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * 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, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions.
*/ package org.openjdk.bench.loom.ring;
public T receiveImpl() { boolean interrupted = false;
T e; while (true) { try {
e = q.take(); break;
} catch (InterruptedException x) {
interrupted = true;
}
} if (interrupted) Thread.currentThread().interrupt(); return e;
}
}
publicstaticclass ChannelFixedStackI1<T> extends AbstractStackChannel<T> { privatefinalint depth; private T sendMsg; // store data in heap, not on stack private T receiveMsg;
public ChannelFixedStackI1(BlockingQueue<T> q, int depth) { super(q); this.depth = depth;
}
publicstaticclass ChannelFixedStackI2<T> extends AbstractStackChannel<T> { privatefinalint depth; privateint x2 = 42; private T sendMsg; // store data in heap, not on stack private T receiveMsg;
public ChannelFixedStackI2(BlockingQueue<T> q, int depth) { super(q); this.depth = depth;
}
publicstaticclass ChannelFixedStackI4<T> extends AbstractStackChannel<T> { privatefinalint depth; privateint x2 = 42; privateint x3 = 43; privateint x4 = 44; private T sendMsg; // store data in heap, not on stack private T receiveMsg;
public ChannelFixedStackI4(BlockingQueue<T> q, int depth) { super(q); this.depth = depth;
}
@Override public String toString() { return"Ref{" + "v=" + v + '}';
}
public Ref inc() { return of(v + 1);
}
}
// static class Ref { // private final int v; // // Ref(int v) { // this.v = v; // } // // public static Ref of(int v) { // return getRef(new Ref(v)); // } // // @CompilerControl(CompilerControl.Mode.DONT_INLINE) // private static Ref getRef(Ref x) { // Ref y = cache.get(x); // return y == null ? x : y; // } // // private static final int CACHE_MAX = 1024*2; // // private static final Map<Ref, Ref> cache = IntStream.range(0, CACHE_MAX).mapToObj(Ref::new).collect(Collectors.toMap( k -> k, v-> v)); // // @Override // public boolean equals(Object o) { // if (this == o) return true; // if (!(o instanceof Ref)) return false; // Ref ref = (Ref) o; // return v == ref.v; // } // // @Override // public int hashCode() { // return Objects.hash(v); // } // // @Override // public String toString() { // return "Ref{" + // "v=" + v + // '}'; // } // // public Ref inc() { // return of(v + 1); // } // }
}
Messung V0.5 in Prozent
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.30Bemerkung:
(vorverarbeitet am 2026-06-06)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.