Skip to content

Commit 5693642

Browse files
committed
cleanup
1 parent 893920f commit 5693642

File tree

15 files changed

+30
-69
lines changed

15 files changed

+30
-69
lines changed

src/som/interpreter/actors/Actor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ public Actor getCurrentActor() {
404404
return currentlyExecutingActor;
405405
}
406406

407-
public void setCurrentActorSnapshot(final Actor current) {
407+
public void setCurrentActorForSnapshot(final Actor current) {
408408
this.currentlyExecutingActor = current;
409409
}
410410
}

src/som/interpreter/actors/ReceivedRootNode.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ public SourceSection getSourceSection() {
145145
return sourceSection;
146146
}
147147

148-
private final long serializeMessageIfNecessary(final EventualMessage msg,
148+
private long serializeMessageIfNecessary(final EventualMessage msg,
149149
final SnapshotBuffer sb) {
150150

151151
if (sb.getRecord().containsObject(msg)) {

src/som/vm/ObjectSystem.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ public ObjectSystem(final SourcecodeCompiler compiler,
102102
this.compiler = compiler;
103103
structuralProbe = probe;
104104
loadedModules = EconomicMap.create();
105-
if (VmSettings.SNAPSHOTS_ENABLED) {
106-
// List is not modified, only used at program termination to know which modules need to
107-
// be loaded in replay
105+
if (VmSettings.SNAPSHOT_REPLAY) {
108106
SnapshotBackend.registerLoadedModules(loadedModules);
109107
}
110108
this.vm = vm;
@@ -172,10 +170,6 @@ public MixinDefinition loadModule(final Source source) throws IOException {
172170
}
173171
}
174172

175-
public EconomicMap<URI, MixinDefinition> getLoadedModulesForSnapshot() {
176-
return loadedModules;
177-
}
178-
179173
private SObjectWithoutFields constructVmMirror() {
180174
EconomicMap<SSymbol, Dispatchable> vmMirrorMethods = primitives.takeVmMirrorPrimitives();
181175
SClass vmMirrorClass = constructPrimitiveClass(vmMirrorMethods);

src/som/vmobjects/SClass.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import com.oracle.truffle.api.frame.MaterializedFrame;
3636
import com.oracle.truffle.api.nodes.ExplodeLoop;
3737

38-
import som.Output;
3938
import som.VM;
4039
import som.compiler.AccessModifier;
4140
import som.compiler.MixinBuilder.MixinDefinitionId;
@@ -156,7 +155,6 @@ public EconomicSet<SlotDefinition> getInstanceSlots() {
156155
public void initializeClass(final SSymbol name, final SClass superclass) {
157156
assert (this.name == null || this.name == name) && (this.superclass == null
158157
|| this.superclass == superclass) : "Should only be initialized once";
159-
160158
this.name = name;
161159
this.superclass = superclass;
162160
}
@@ -387,10 +385,6 @@ public MaterializedFrame getContext() {
387385
}
388386

389387
public void serialize(final Object o, final SnapshotBuffer sb) {
390-
if (instanceClassGroup == null) {
391-
Output.errorPrintln(this.toString());
392-
}
393-
394388
assert instanceClassGroup != null;
395389
if (!sb.getRecord().containsObjectUnsync(o)) {
396390
instanceClassGroup.serialize(o, sb);

src/tools/concurrency/TracingActivityThread.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,6 @@ private void newSnapshot() {
244244
extIndex = 0;
245245
}
246246
}
247-
248247
this.snapshotId = SnapshotBackend.getSnapshotVersion();
249248

250249
// get net snapshotbuffer

src/tools/concurrency/TracingActors.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,8 +432,8 @@ protected void processCurrentMessages(final ActorProcessingThread currentThread,
432432
final WebDebugger dbg) {
433433
assert actor instanceof ReplayActor;
434434
assert size > 0;
435-
final ReplayActor a = (ReplayActor) actor;
436435

436+
final ReplayActor a = (ReplayActor) actor;
437437
Queue<EventualMessage> todo = determineNextMessages(a.leftovers);
438438

439439
for (EventualMessage msg : todo) {

src/tools/snapshot/SnapshotBackend.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public static void writeSnapshot() {
359359
for (SnapshotRecord sr : deferredSerializations.keySet()) {
360360
assert sr.owner != null;
361361
deferredSerializations.remove(sr);
362-
buffer.owner.setCurrentActorSnapshot(sr.owner);
362+
buffer.owner.setCurrentActorForSnapshot(sr.owner);
363363
sr.handleObjectsReferencedFromFarRefs(buffer, classPrim);
364364
}
365365
}
@@ -532,6 +532,9 @@ public static void registerLostResolution(final SResolver resolver,
532532
}
533533

534534
public static void registerClassLocation(final int identity, final long classLocation) {
535+
if (VmSettings.TEST_SNAPSHOTS) {
536+
return;
537+
}
535538
synchronized (classLocations) {
536539
classLocations.put(identity, classLocation);
537540
}

src/tools/snapshot/SnapshotBuffer.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,29 +69,6 @@ public int addObject(final Object o, final SClass clazz, final int payload) {
6969
return oldPos + CLASS_ID_SIZE;
7070
}
7171

72-
public int addObjectWithFields(final Object o, final SClass clazz,
73-
final int fieldCnt) {
74-
assert fieldCnt < MAX_FIELD_CNT;
75-
assert !getRecord().containsObjectUnsync(o) : "Object serialized multiple times";
76-
77-
int oldPos = this.position;
78-
getRecord().addObjectEntry(o, calculateReference(oldPos));
79-
80-
if (clazz.getSOMClass() == Classes.classClass) {
81-
TracingActor owner = clazz.getOwnerOfOuter();
82-
if (owner == null) {
83-
owner = (TracingActor) SomLanguage.getCurrent().getVM().getMainActor();
84-
}
85-
86-
assert owner != null;
87-
owner.getSnapshotRecord().farReference(clazz, null, 0);
88-
}
89-
90-
this.putIntAt(this.position, clazz.getIdentity());
91-
this.position += CLASS_ID_SIZE + (FIELD_SIZE * fieldCnt);
92-
return oldPos + CLASS_ID_SIZE;
93-
}
94-
9572
public int addMessage(final int payload, final EventualMessage msg) {
9673
// we dont put messages into our lookup table as there should be only one reference to it
9774
// (either from a promise or a mailbox)

src/tools/snapshot/SnapshotRecord.java

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,20 +113,6 @@ public void handleObjectsReferencedFromFarRefs(final SnapshotBuffer sb,
113113
*/
114114
public void farReference(final Object o, final SnapshotBuffer other,
115115
final int destination) {
116-
117-
// Have to do this to avoid a memory leak, actors that are inactive for a long time, but
118-
// farReffed by others ended up keeping alive a large number of SnapshotBuffers.
119-
120-
/*
121-
* ConcurrentLinkedQueue<DeferredFarRefSerialization> oldReferences = externalReferences;
122-
* externalReferences = new ConcurrentLinkedQueue<>();
123-
* for (DeferredFarRefSerialization deffered : oldReferences) {
124-
* if (deffered.referer.snapshotVersion == this.snapshotVersion) {
125-
* externalReferences.add(deffered);
126-
* }
127-
* }
128-
*/
129-
130116
Long l = getEntrySynced(o);
131117

132118
if (l != null && other != null) {

src/tools/snapshot/deserialization/DeserializationBuffer.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public Object deserialize(final long current) {
103103
public long readOuterForClass(final long classLocation) {
104104
long previous = this.position();
105105
this.position(classLocation);
106-
this.getInt();// consume the classclass information
106+
this.getInt(); // consume the classclass information
107107
long result = ClassSerializationNode.readOuterLocation(this);
108108
this.position(previous);
109109
return result;
@@ -147,6 +147,7 @@ public Object deserializeWithoutContext(final long current) {
147147

148148
/**
149149
* This causes the lastRef to stay overwritten for fixup purposes!
150+
*
150151
* @return
151152
*/
152153
public Object getReference() {

0 commit comments

Comments
 (0)