Skip to content

Commit

Permalink
Enable inliner for Scala 2
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed Oct 3, 2023
1 parent 0943563 commit 17c659e
Show file tree
Hide file tree
Showing 36 changed files with 778 additions and 474 deletions.
34 changes: 0 additions & 34 deletions actor/src/main/java/org/apache/pekko/actor/AbstractActorRef.java

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

package org.apache.pekko.dispatch;

import org.apache.pekko.util.Unsafe;
import org.apache.pekko.util.Unsafe$;

/**
* Lock-free bounded non-blocking multiple-producer single-consumer queue based on the works of:
Expand Down Expand Up @@ -45,29 +45,29 @@ protected AbstractBoundedNodeQueue(final int capacity) {
}

private void setEnq(Node<T> n) {
Unsafe.instance.putObjectVolatile(this, enqOffset, n);
Unsafe$.MODULE$.instance().putObjectVolatile(this, enqOffset, n);
}

@SuppressWarnings("unchecked")
private Node<T> getEnq() {
return (Node<T>)Unsafe.instance.getObjectVolatile(this, enqOffset);
return (Node<T>)Unsafe$.MODULE$.instance().getObjectVolatile(this, enqOffset);
}

private boolean casEnq(Node<T> old, Node<T> nju) {
return Unsafe.instance.compareAndSwapObject(this, enqOffset, old, nju);
return Unsafe$.MODULE$.instance().compareAndSwapObject(this, enqOffset, old, nju);
}

private void setDeq(Node<T> n) {
Unsafe.instance.putObjectVolatile(this, deqOffset, n);
Unsafe$.MODULE$.instance().putObjectVolatile(this, deqOffset, n);
}

@SuppressWarnings("unchecked")
private Node<T> getDeq() {
return (Node<T>)Unsafe.instance.getObjectVolatile(this, deqOffset);
return (Node<T>)Unsafe$.MODULE$.instance().getObjectVolatile(this, deqOffset);
}

private boolean casDeq(Node<T> old, Node<T> nju) {
return Unsafe.instance.compareAndSwapObject(this, deqOffset, old, nju);
return Unsafe$.MODULE$.instance().compareAndSwapObject(this, deqOffset, old, nju);
}

protected final Node<T> peekNode() {
Expand Down Expand Up @@ -187,8 +187,8 @@ public final Node<T> pollNode() {

static {
try {
enqOffset = Unsafe.instance.objectFieldOffset(AbstractBoundedNodeQueue.class.getDeclaredField("_enqDoNotCallMeDirectly"));
deqOffset = Unsafe.instance.objectFieldOffset(AbstractBoundedNodeQueue.class.getDeclaredField("_deqDoNotCallMeDirectly"));
enqOffset = Unsafe$.MODULE$.instance().objectFieldOffset(AbstractBoundedNodeQueue.class.getDeclaredField("_enqDoNotCallMeDirectly"));
deqOffset = Unsafe$.MODULE$.instance().objectFieldOffset(AbstractBoundedNodeQueue.class.getDeclaredField("_deqDoNotCallMeDirectly"));
} catch(Throwable t){
throw new ExceptionInInitializerError(t);
}
Expand All @@ -202,18 +202,18 @@ public static class Node<T> {

@SuppressWarnings("unchecked")
public final Node<T> next() {
return (Node<T>)Unsafe.instance.getObjectVolatile(this, nextOffset);
return (Node<T>)Unsafe$.MODULE$.instance().getObjectVolatile(this, nextOffset);
}

protected final void setNext(final Node<T> newNext) {
Unsafe.instance.putOrderedObject(this, nextOffset, newNext);
Unsafe$.MODULE$.instance().putOrderedObject(this, nextOffset, newNext);
}

private final static long nextOffset;

static {
try {
nextOffset = Unsafe.instance.objectFieldOffset(Node.class.getDeclaredField("_nextDoNotCallMeDirectly"));
nextOffset = Unsafe$.MODULE$.instance().objectFieldOffset(Node.class.getDeclaredField("_nextDoNotCallMeDirectly"));
} catch(Throwable t){
throw new ExceptionInInitializerError(t);
}
Expand Down
30 changes: 0 additions & 30 deletions actor/src/main/java/org/apache/pekko/dispatch/AbstractMailbox.java

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@

package org.apache.pekko.dispatch;

import org.apache.pekko.util.Unsafe;
import org.apache.pekko.util.Unsafe$;

abstract class AbstractMessageDispatcher {
final static long shutdownScheduleOffset;
final static long inhabitantsOffset;

static {
try {
shutdownScheduleOffset = Unsafe.instance.objectFieldOffset(MessageDispatcher.class.getDeclaredField("_shutdownScheduleDoNotCallMeDirectly"));
inhabitantsOffset = Unsafe.instance.objectFieldOffset(MessageDispatcher.class.getDeclaredField("_inhabitantsDoNotCallMeDirectly"));
shutdownScheduleOffset = Unsafe$.MODULE$.instance().objectFieldOffset(MessageDispatcher.class.getDeclaredField("_shutdownScheduleDoNotCallMeDirectly"));
inhabitantsOffset = Unsafe$.MODULE$.instance().objectFieldOffset(MessageDispatcher.class.getDeclaredField("_inhabitantsDoNotCallMeDirectly"));
} catch(Throwable t){
throw new ExceptionInInitializerError(t);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

package org.apache.pekko.dispatch;

import org.apache.pekko.util.Unsafe;
import org.apache.pekko.util.Unsafe$;

import java.util.concurrent.atomic.AtomicReference;

Expand Down Expand Up @@ -54,7 +54,7 @@ protected AbstractNodeQueue() {
*/
@SuppressWarnings("unchecked")
protected final Node<T> peekNode() {
final Node<T> tail = ((Node<T>)Unsafe.instance.getObjectVolatile(this, tailOffset));
final Node<T> tail = ((Node<T>)Unsafe$.MODULE$.instance().getObjectVolatile(this, tailOffset));
Node<T> next = tail.next();
if (next == null && get() != tail) {
// if tail != head this is not going to change until producer makes progress
Expand Down Expand Up @@ -110,7 +110,7 @@ public final void addNode(final Node<T> n) {
* @return true if queue was empty at some point in the past
*/
public final boolean isEmpty() {
return Unsafe.instance.getObjectVolatile(this, tailOffset) == get();
return Unsafe$.MODULE$.instance().getObjectVolatile(this, tailOffset) == get();
}

/**
Expand All @@ -126,7 +126,7 @@ public final boolean isEmpty() {
public final int count() {
int count = 0;
final Node<T> head = get();
for(Node<T> n = ((Node<T>) Unsafe.instance.getObjectVolatile(this, tailOffset)).next();
for(Node<T> n = ((Node<T>) Unsafe$.MODULE$.instance().getObjectVolatile(this, tailOffset)).next();
n != null && count < Integer.MAX_VALUE;
n = n.next()) {
++count;
Expand Down Expand Up @@ -162,7 +162,7 @@ public final T poll() {
*/
@SuppressWarnings("unchecked")
public final Node<T> pollNode() {
final Node<T> tail = (Node<T>) Unsafe.instance.getObjectVolatile(this, tailOffset);
final Node<T> tail = (Node<T>) Unsafe$.MODULE$.instance().getObjectVolatile(this, tailOffset);
Node<T> next = tail.next();
if (next == null && get() != tail) {
// if tail != head this is not going to change until producer makes progress
Expand All @@ -175,7 +175,7 @@ public final Node<T> pollNode() {
else {
tail.value = next.value;
next.value = null;
Unsafe.instance.putOrderedObject(this, tailOffset, next);
Unsafe$.MODULE$.instance().putOrderedObject(this, tailOffset, next);
tail.setNext(null);
return tail;
}
Expand All @@ -185,7 +185,7 @@ public final Node<T> pollNode() {

static {
try {
tailOffset = Unsafe.instance.objectFieldOffset(AbstractNodeQueue.class.getDeclaredField("_tailDoNotCallMeDirectly"));
tailOffset = Unsafe$.MODULE$.instance().objectFieldOffset(AbstractNodeQueue.class.getDeclaredField("_tailDoNotCallMeDirectly"));
} catch(Throwable t){
throw new ExceptionInInitializerError(t);
}
Expand All @@ -206,18 +206,18 @@ public Node(final T value) {

@SuppressWarnings("unchecked")
public final Node<T> next() {
return (Node<T>)Unsafe.instance.getObjectVolatile(this, nextOffset);
return (Node<T>)Unsafe$.MODULE$.instance().getObjectVolatile(this, nextOffset);
}

protected final void setNext(final Node<T> newNext) {
Unsafe.instance.putOrderedObject(this, nextOffset, newNext);
Unsafe$.MODULE$.instance().putOrderedObject(this, nextOffset, newNext);
}

private final static long nextOffset;

static {
try {
nextOffset = Unsafe.instance.objectFieldOffset(Node.class.getDeclaredField("_nextDoNotCallMeDirectly"));
nextOffset = Unsafe$.MODULE$.instance().objectFieldOffset(Node.class.getDeclaredField("_nextDoNotCallMeDirectly"));
} catch(Throwable t){
throw new ExceptionInInitializerError(t);
}
Expand Down

This file was deleted.

This file was deleted.

Loading

0 comments on commit 17c659e

Please sign in to comment.