Skip to content

Commit

Permalink
Apply todo, and solve a few compilation issues
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Marr <git@stefan-marr.de>
  • Loading branch information
smarr committed Sep 4, 2018
1 parent b9596fd commit 75b3595
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 13 deletions.
1 change: 0 additions & 1 deletion src/som/primitives/SizeAndLengthPrim.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.instrumentation.Tag;
import com.oracle.truffle.api.profiles.ValueProfile;

import bd.primitives.Primitive;
import som.interpreter.nodes.nary.UnaryBasicOperation;
Expand Down
6 changes: 1 addition & 5 deletions src/som/vmobjects/SArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import com.oracle.truffle.api.CompilerAsserts;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.profiles.ValueProfile;

import som.vm.NotYetImplementedException;
import som.vm.constants.Nil;
Expand All @@ -17,7 +16,6 @@
*/
public abstract class SArray extends SAbstractObject {
public static final int FIRST_IDX = 0;
public static final ValueProfile OBJECT_ARRAY_PROFILE = ValueProfile.createClassProfile();

protected Object storage;
protected final SClass clazz;
Expand Down Expand Up @@ -56,9 +54,7 @@ public PartiallyEmptyArray getPartiallyEmptyStorage() {

public Object[] getObjectStorage() {
assert isObjectType();
// TODO: `CompilerDirectives.castExact(storage, Object[].class);` can be
// used here instead of a ValueProfile (see issue #256).
return (Object[]) OBJECT_ARRAY_PROFILE.profile(storage);
return CompilerDirectives.castExact(storage, Object[].class);
}

public long[] getLongStorage() {
Expand Down
7 changes: 2 additions & 5 deletions src/som/vmobjects/SFileDescriptor.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.profiles.BranchProfile;
import com.oracle.truffle.api.profiles.ValueProfile;

import som.interpreter.nodes.ExceptionSignalingNode;
import som.interpreter.nodes.dispatch.BlockDispatchNode;
Expand All @@ -18,8 +17,6 @@


public class SFileDescriptor extends SObjectWithClass {
/** Data buffers in this file descriptor are expected to contain only integers. */
private static final ValueProfile longStorageType = ValueProfile.createClassProfile();

@CompilationFinal public static SClass fileDescriptorClass;

Expand Down Expand Up @@ -86,7 +83,7 @@ public int read(final long position, final SBlock fail,
return 0;
}

long[] storage = buffer.getLongStorage(longStorageType);
long[] storage = buffer.getLongStorage();
byte[] buff = new byte[bufferSize];
int bytes = 0;

Expand Down Expand Up @@ -124,7 +121,7 @@ public void write(final int nBytes, final long position, final SBlock fail,
return;
}

long[] storage = buffer.getLongStorage(longStorageType);
long[] storage = buffer.getLongStorage();
byte[] buff = new byte[bufferSize];

for (int i = 0; i < bufferSize; i++) {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/concurrency/TracingBackend.java
Original file line number Diff line number Diff line change
Expand Up @@ -362,14 +362,14 @@ private void writeArray(final TwoDArrayWrapper aw, final FileOutputStream edfos)
throws IOException {
SImmutableArray sia = aw.immArray;

Object[] outer = sia.getObjectStorage(SArray.ObjectStorageType);
Object[] outer = sia.getObjectStorage();
byte[][][] bouter = new byte[outer.length][][];
byte[] endRow = {ENDROW};
int numBytes = 0;
for (int i = 0; i < outer.length; i++) {
Object o = outer[i];
SImmutableArray ia = (SImmutableArray) o;
Object[] inner = ia.getObjectStorage(SArray.ObjectStorageType);
Object[] inner = ia.getObjectStorage();
byte[][] binner = new byte[inner.length + 1][];
for (int j = 0; j < inner.length; j++) {
Object oo = inner[j];
Expand Down

0 comments on commit 75b3595

Please sign in to comment.