Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to get actor mailbox information #324

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions src/som/interpreter/actors/EventualSendNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ protected void sendDirectMessage(final Object[] args, final Actor owner,

if (VmSettings.KOMPOS_TRACING) {
KomposTrace.sendOperation(SendOp.ACTOR_MSG, msg.getMessageId(),
target.getId());
target.getId(), msg.getSelector(), msg.getTarget().getId(), msg.getTargetSourceSection());
}

target.send(msg, actorPool);
Expand All @@ -227,9 +227,15 @@ protected void sendPromiseMessage(final Object[] args, final SPromise rcvr,
messageReceiverBreakpoint.executeShouldHalt(),
promiseResolverBreakpoint.executeShouldHalt());

Actor target = null;
if (isFarRefRcvr(args)) {
SFarReference farReference = (SFarReference) args[0];
target = farReference.getActor();
}

if (VmSettings.KOMPOS_TRACING) {
KomposTrace.sendOperation(SendOp.PROMISE_MSG, msg.getMessageId(),
rcvr.getPromiseId());
rcvr.getPromiseId(), msg.getSelector(), target != null ? target.getId() : -1, msg.getTargetSourceSection());
}

registerNode.register(rcvr, msg, rcvr.getOwner());
Expand Down Expand Up @@ -286,7 +292,7 @@ public final SPromise toNearRefWithResultPromise(final Object[] args) {

if (VmSettings.KOMPOS_TRACING) {
KomposTrace.sendOperation(SendOp.ACTOR_MSG, msg.getMessageId(),
current.getId());
current.getId(), msg.getSelector(), msg.getTarget().getId(), msg.getTargetSourceSection());
}

current.send(msg, actorPool);
Expand Down Expand Up @@ -322,7 +328,7 @@ public final Object toNearRefWithoutResultPromise(final Object[] args) {

if (VmSettings.KOMPOS_TRACING) {
KomposTrace.sendOperation(SendOp.ACTOR_MSG, msg.getMessageId(),
current.getId());
current.getId(), msg.getSelector(), msg.getTarget().getId(), msg.getTargetSourceSection());
}

current.send(msg, actorPool);
Expand Down
8 changes: 4 additions & 4 deletions src/som/primitives/actors/PromisePrims.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ protected final SPromise registerWhenResolved(final SPromise rcvr,

if (VmSettings.KOMPOS_TRACING) {
KomposTrace.sendOperation(SendOp.PROMISE_MSG, pcm.getMessageId(),
rcvr.getPromiseId());
rcvr.getPromiseId(), pcm.getSelector(), rcvr.getOwner().getId(), pcm.getTargetSourceSection());
}
registerNode.register(rcvr, pcm, current);

Expand Down Expand Up @@ -242,7 +242,7 @@ protected final SPromise registerOnError(final SPromise rcvr,

if (VmSettings.KOMPOS_TRACING) {
KomposTrace.sendOperation(SendOp.PROMISE_MSG, msg.getMessageId(),
rcvr.getPromiseId());
rcvr.getPromiseId(), msg.getSelector(), rcvr.getOwner().getId(), msg.getTargetSourceSection());
}
registerNode.register(rcvr, msg, current);

Expand Down Expand Up @@ -321,9 +321,9 @@ protected final SPromise registerWhenResolvedOrError(final SPromise rcvr,

if (VmSettings.KOMPOS_TRACING) {
KomposTrace.sendOperation(SendOp.PROMISE_MSG, onResolved.getMessageId(),
rcvr.getPromiseId());
rcvr.getPromiseId(), onResolved.getSelector(), onResolved.getTarget().getId(), onResolved.getTargetSourceSection());
KomposTrace.sendOperation(SendOp.PROMISE_MSG, onError.getMessageId(),
rcvr.getPromiseId());
rcvr.getPromiseId(), onError.getSelector(), onError.getTarget().getId(), onResolved.getTargetSourceSection());
}

synchronized (rcvr) {
Expand Down
24 changes: 15 additions & 9 deletions src/tools/concurrency/KomposTrace.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public static void recordMainActor(final Actor mainActor,
KomposTraceBuffer buffer = KomposTraceBuffer.create(0);
buffer.recordCurrentActivity(mainActor);
buffer.recordMainActor(mainActor, objectSystem);
buffer.recordSendOperation(SendOp.ACTOR_MSG, 0, mainActor.getId(), mainActor);
buffer.recordSendOperation(SendOp.ACTOR_MSG, 0, mainActor.getId(), mainActor, (short) 0, 0, null);
buffer.returnBuffer(null);
}

Expand Down Expand Up @@ -84,7 +84,7 @@ public static void promiseResolution(final long promiseId, final Object value) {

((KomposTraceBuffer) t.getBuffer()).recordSendOperation(SendOp.PROMISE_RESOLUTION, 0,
promiseId,
t.getActivity());
t.getActivity(), (short) 0, 0, null);
t.resolvedPromises++;
}

Expand All @@ -94,7 +94,7 @@ public static void promiseError(final long promiseId, final Object value) {
TracingActivityThread t = (TracingActivityThread) current;
((KomposTraceBuffer) t.getBuffer()).recordSendOperation(SendOp.PROMISE_RESOLUTION, 0,
promiseId,
t.getActivity());
t.getActivity(), (short) 0, 0, null);
t.erroredPromises++;
}

Expand All @@ -107,15 +107,15 @@ public static void promiseError(final long promiseId, final Object value) {
public static void promiseChained(final long promiseValueId, final long promiseId) {
TracingActivityThread t = getThread();
((KomposTraceBuffer) t.getBuffer()).recordSendOperation(
SendOp.PROMISE_RESOLUTION, promiseValueId, promiseId, t.getActivity());
SendOp.PROMISE_RESOLUTION, promiseValueId, promiseId, t.getActivity(), (short) 0, 0, null);
t.resolvedPromises++;
}

public static void sendOperation(final SendOp op, final long entityId,
final long targetId) {
final long targetId, final SSymbol selector, long targetActorId, SourceSection msgSourceCoordinate) {
TracingActivityThread t = getThread();
((KomposTraceBuffer) t.getBuffer()).recordSendOperation(op, entityId, targetId,
t.getActivity());
t.getActivity(), selector.getSymbolId(), targetActorId, msgSourceCoordinate);
}

public static void receiveOperation(final ReceiveOp op, final long sourceId) {
Expand Down Expand Up @@ -334,14 +334,20 @@ public void recordReceiveOperation(final ReceiveOp op, final long sourceId,
}

public void recordSendOperation(final SendOp op, final long entityId,
final long targetId, final Activity current) {
final long targetId, final Activity current, final short symbolId, long targetActorId, SourceSection msgSourceCoordinate) {
int requiredSpace = op.getSize();
ensureSufficientSpace(requiredSpace, current);

final int start = position;
put(op.getId());
putLong(entityId);
putLong(targetId);
putLong(targetActorId);
putShort(symbolId);

if (VmSettings.KOMPOS_TRACING) {
writeSourceSection(msgSourceCoordinate);
}

assert position == start + requiredSpace;
}
Expand Down Expand Up @@ -391,8 +397,8 @@ public synchronized void recordReceiveOperation(final ReceiveOp op,

@Override
public synchronized void recordSendOperation(final SendOp op,
final long entityId, final long targetId, final Activity current) {
super.recordSendOperation(op, entityId, targetId, current);
final long entityId, final long targetId, final Activity current, final short symbol, final long targetActorId, final SourceSection section) {
super.recordSendOperation(op, entityId, targetId, current, symbol, targetActorId, section);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/concurrency/TracingChannel.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void write(final Object value, final RecordTwoEvent traceWrite)
super.write(value, traceWrite);
} finally {
KomposTrace.sendOperation(
SendOp.CHANNEL_SEND, current.messageId, current.channelId);
SendOp.CHANNEL_SEND, current.messageId, current.channelId, null, 0, null);
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/tools/debugger/entities/SendOp.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package tools.debugger.entities;

import tools.TraceData;

public enum SendOp {
ACTOR_MSG(Marker.ACTOR_MSG_SEND, EntityType.ACT_MSG, EntityType.ACTOR),
PROMISE_MSG(Marker.PROMISE_MSG_SEND, EntityType.ACT_MSG, EntityType.PROMISE),
Expand All @@ -10,6 +12,9 @@ public enum SendOp {
private final EntityType entity;
private final EntityType target;

private static final int SYMBOL_ID_SIZE = 2;
private static final int RECEIVER_ACTOR_ID_SIZE = 8;

SendOp(final byte id, final EntityType entity, final EntityType target) {
this.id = id;
this.entity = entity;
Expand All @@ -29,6 +34,6 @@ public EntityType getTarget() {
}

public int getSize() {
return 17;
return 17 + RECEIVER_ACTOR_ID_SIZE + SYMBOL_ID_SIZE + TraceData.SOURCE_SECTION_SIZE;
}
}