Skip to content

Commit

Permalink
Update sigtest file, fix style.
Browse files Browse the repository at this point in the history
  • Loading branch information
axel22 committed Feb 6, 2023
1 parent 811be9d commit a230fa5
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
Expand Down
52 changes: 49 additions & 3 deletions sdk/src/org.graalvm.collections/snapshot.sigtest
Original file line number Diff line number Diff line change
Expand Up @@ -152,25 +152,71 @@ meth public abstract boolean equals(java.lang.Object,java.lang.Object)
meth public abstract int hashCode(java.lang.Object)
supr java.lang.Object

CLSS public org.graalvm.collections.LockFreePrefixTree
CLSS public org.graalvm.collections.LockFreePool<%0 extends java.lang.Object>
cons public init()
meth public void add({org.graalvm.collections.LockFreePool%0})
meth public {org.graalvm.collections.LockFreePool%0} get()
supr java.lang.Object
hfds head
hcls Node

CLSS public org.graalvm.collections.LockFreePrefixTree
cons public init(org.graalvm.collections.LockFreePrefixTree$Allocator)
innr public abstract static Allocator
innr public static HeapAllocator
innr public static Node
innr public static ObjectPoolingAllocator
meth public <%0 extends java.lang.Object> void topDown({%%0},java.util.function.BiFunction<{%%0},java.lang.Long,{%%0}>,java.util.function.BiConsumer<{%%0},java.lang.Long>)
meth public org.graalvm.collections.LockFreePrefixTree$Allocator allocator()
meth public org.graalvm.collections.LockFreePrefixTree$Node root()
supr java.lang.Object
hfds root
hfds allocator,root
hcls FailedAllocationException

CLSS public abstract static org.graalvm.collections.LockFreePrefixTree$Allocator
outer org.graalvm.collections.LockFreePrefixTree
cons public init()
meth public abstract java.util.concurrent.atomic.AtomicReferenceArray newHashChildren(int)
meth public abstract java.util.concurrent.atomic.AtomicReferenceArray newLinearChildren(int)
meth public abstract org.graalvm.collections.LockFreePrefixTree$Node newNode(long)
meth public abstract void shutdown()
supr java.lang.Object
hfds FAILED_ALLOCATION_EXCEPTION

CLSS public static org.graalvm.collections.LockFreePrefixTree$HeapAllocator
outer org.graalvm.collections.LockFreePrefixTree
cons public init()
meth public java.util.concurrent.atomic.AtomicReferenceArray newHashChildren(int)
meth public java.util.concurrent.atomic.AtomicReferenceArray newLinearChildren(int)
meth public org.graalvm.collections.LockFreePrefixTree$Node newNode(long)
meth public void shutdown()
supr org.graalvm.collections.LockFreePrefixTree$Allocator

CLSS public static org.graalvm.collections.LockFreePrefixTree$Node
outer org.graalvm.collections.LockFreePrefixTree
meth public java.lang.String toString()
meth public long bitwiseOrValue(long)
meth public long incValue()
meth public long value()
meth public org.graalvm.collections.LockFreePrefixTree$Node at(long)
meth public org.graalvm.collections.LockFreePrefixTree$Node at(org.graalvm.collections.LockFreePrefixTree$Allocator,long)
meth public void setValue(long)
supr java.util.concurrent.atomic.AtomicLong
hfds CHILDREN_UPDATER,FROZEN_NODE,INITIAL_HASH_NODE_SIZE,INITIAL_LINEAR_NODE_SIZE,MAX_HASH_SKIPS,MAX_LINEAR_NODE_SIZE,children,key,serialVersionUID
hcls FrozenNode,HashChildren,LinearChildren

CLSS public static org.graalvm.collections.LockFreePrefixTree$ObjectPoolingAllocator
outer org.graalvm.collections.LockFreePrefixTree
cons public init()
cons public init(int)
meth public java.lang.String status()
meth public java.util.concurrent.atomic.AtomicReferenceArray newHashChildren(int)
meth public java.util.concurrent.atomic.AtomicReferenceArray newLinearChildren(int)
meth public org.graalvm.collections.LockFreePrefixTree$Node newNode(long)
meth public void shutdown()
supr org.graalvm.collections.LockFreePrefixTree$Allocator
hfds DEFAULT_HOUSEKEEPING_PERIOD_MILLIS,EXPECTED_MAX_HASH_NODE_SIZE,INITIAL_HASH_CHILDREN_PREALLOCATION_COUNT,INITIAL_LINEAR_CHILDREN_PREALLOCATION_COUNT,INITIAL_NODE_PREALLOCATION_COUNT,LOGGING,MAX_CHILDREN_PREALLOCATION_COUNT,MAX_NODE_PREALLOCATION_COUNT,MIN_HOUSEKEEPING_PERIOD_MILLIS,SIZE_CLASS_COUNT,hashChildrenPool,housekeepingThread,linearChildrenPool,missedHashChildrenRequestCounts,missedLinearChildrenRequestCounts,missedNodePoolRequestCount,nodePool
hcls HousekeepingThread

CLSS public abstract interface org.graalvm.collections.MapCursor<%0 extends java.lang.Object, %1 extends java.lang.Object>
intf org.graalvm.collections.UnmodifiableMapCursor<{org.graalvm.collections.MapCursor%0},{org.graalvm.collections.MapCursor%1}>
meth public abstract void remove()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
Expand Down Expand Up @@ -57,6 +57,8 @@
* The internal implementation is a simple Treiber stack.
*
* @param <T> Type of the elements in this pool.
*
* @since 23.0
*/
public class LockFreePool<T> {
private final AtomicReference<Node> head;
Expand All @@ -76,6 +78,8 @@ public LockFreePool() {
*
* @return A previously added element, or {@code null} if there are no previously added elements
* that have not been already returned.
*
* @since 23.0
*/
public T get() {
while (true) {
Expand All @@ -99,6 +103,8 @@ public T get() {
* This method internally allocates objects on the heap.
*
* @param element An element to add to the pool.
*
* @since 23.0
*/
public void add(T element) {
while (true) {
Expand All @@ -110,7 +116,7 @@ public void add(T element) {
}
}

private class Node {
private final class Node {
final T element;
final Node tail;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* The Universal Permissive License (UPL), Version 1.0
Expand Down Expand Up @@ -188,6 +188,8 @@ public long incValue() {
*
* @param pattern a bit pattern to do bitwise-or with
* @return the value immediately after the bitwise-or operation
*
* @since 23.0
*/
public long bitwiseOrValue(long pattern) {
while (true) {
Expand Down Expand Up @@ -452,8 +454,10 @@ public <C> void topDown(C initialContext, BiFunction<C, Long, C> createContext,

/**
* Exception that denotes that an allocation failed.
*
* @since 23.0
*/
public static class FailedAllocationException extends RuntimeException {
private static class FailedAllocationException extends RuntimeException {
private static final long serialVersionUID = -1L;

@Override
Expand All @@ -464,30 +468,46 @@ public synchronized Throwable fillInStackTrace() {

/**
* Policy for allocating objects of the lock-free prefix tree.
*
* @since 23.0
*/
public static abstract class Allocator {
public abstract static class Allocator {
private static final FailedAllocationException FAILED_ALLOCATION_EXCEPTION = new FailedAllocationException();

/**
* Allocates a new Node object.
*
* @since 23.0
*/
public abstract Node newNode(long key);

/**
* Allocates a new reference array of child nodes stored linearly.
*
* @since 23.0
*/
public abstract Node.LinearChildren newLinearChildren(int length);

/**
* Allocates a new reference array of child nodes stored as a hash table.
*
* @since 23.0
*/
public abstract Node.HashChildren newHashChildren(int length);

/**
* Releases the allocator's resources. Allocator should not be used after calling this
* method.
*
* @since 23.0
*/
public abstract void shutdown();
}

/**
* Allocator that allocates objects directly on the managed heap.
*
* @since 23.0
*/
public static class HeapAllocator extends Allocator {
@Override
Expand Down Expand Up @@ -523,9 +543,11 @@ public void shutdown() {
* additional objects whose allocation request previously failed, and it will allocate at least
* as many objects as there were previous failed allocation requests).
*
* This implementation only allows allocating {@link Node.LinearChildren} and
* {@link Node.HashChildren} arrays whose size is a power of 2 (because
* This implementation only allows allocating {@code Node.LinearChildren} and
* {@code Node.HashChildren} arrays whose size is a power of 2 (because
* {@link LockFreePrefixTree} only ever allocates arrays that are a power of 2).
*
* @since 23.0
*/
public static class ObjectPoolingAllocator extends Allocator {
private static final int MIN_HOUSEKEEPING_PERIOD_MILLIS = 4;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2023, 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
Expand Down Expand Up @@ -38,7 +38,7 @@
import com.oracle.svm.core.thread.ThreadingSupportImpl;

public class SafepointProfilingSampler implements ProfilingSampler, ThreadListener {
private final static int DEFAULT_STACK_SIZE = 8 * 1024;
private static final int DEFAULT_STACK_SIZE = 8 * 1024;

private final SamplingStackVisitor samplingStackVisitor = new SamplingStackVisitor();
private final LockFreePrefixTree prefixTree = new LockFreePrefixTree(new LockFreePrefixTree.ObjectPoolingAllocator());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2021, 2023, 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
Expand Down Expand Up @@ -50,12 +50,12 @@ protected boolean unknownFrame(Pointer sp, CodePointer ip, DeoptimizedFrame deop
return false;
}

public static class StackTrace {
static class StackTrace {
final long[] buffer;
int num;
boolean overflow;

public StackTrace(long stackSizeInBytes) {
StackTrace(long stackSizeInBytes) {
this.buffer = new long[((int) stackSizeInBytes) / 4];
this.num = 0;
this.overflow = false;
Expand Down

0 comments on commit a230fa5

Please sign in to comment.