use of edu.columbia.cs.psl.phosphor.struct.LazyByteArrayObjTags in project phosphor by gmu-swe.
the class UninstArrayReflectionMasker method setByte$$PHOSPHORTAGGED.
public static void setByte$$PHOSPHORTAGGED(Object obj, Taint idxTaint, int idx, Taint taint, byte val) {
if (obj instanceof LazyByteArrayObjTags) {
LazyByteArrayObjTags a = (LazyByteArrayObjTags) obj;
a.set(a.val, idx, taint, val);
} else
throw new ArrayStoreException("Called setX, but don't have tainted X array!, got " + obj.getClass());
}
use of edu.columbia.cs.psl.phosphor.struct.LazyByteArrayObjTags in project phosphor by gmu-swe.
the class MultiDTaintedArrayWithObjTag method unboxVal.
public static final Object unboxVal(final Object _in, final int componentType, final int dims) {
if (dims == 0) {
switch(componentType) {
case Type.BOOLEAN:
case Type.BYTE:
case Type.CHAR:
case Type.DOUBLE:
case Type.FLOAT:
case Type.INT:
case Type.LONG:
case Type.SHORT:
return ((LazyArrayObjTags) _in).getVal();
default:
throw new IllegalArgumentException();
}
} else if (dims == 1) {
final Object[] in = (Object[]) _in;
switch(componentType) {
case Type.BOOLEAN:
boolean[][] retz = new boolean[in.length][];
for (int i = 0; i < in.length; i++) if (in[i] != null)
retz[i] = ((LazyBooleanArrayObjTags) in[i]).val;
return retz;
case Type.BYTE:
byte[][] retb = new byte[in.length][];
for (int i = 0; i < in.length; i++) if (in[i] != null)
retb[i] = ((LazyByteArrayObjTags) in[i]).val;
return retb;
case Type.CHAR:
char[][] retc = new char[in.length][];
for (int i = 0; i < in.length; i++) if (in[i] != null)
retc[i] = ((LazyCharArrayObjTags) in[i]).val;
return retc;
case Type.DOUBLE:
double[][] retd = new double[in.length][];
for (int i = 0; i < in.length; i++) if (in[i] != null)
retd[i] = ((LazyDoubleArrayObjTags) in[i]).val;
return retd;
case Type.FLOAT:
float[][] retf = new float[in.length][];
for (int i = 0; i < in.length; i++) if (in[i] != null)
retf[i] = ((LazyFloatArrayObjTags) in[i]).val;
return retf;
case Type.INT:
int[][] reti = new int[in.length][];
for (int i = 0; i < in.length; i++) if (in[i] != null)
reti[i] = ((LazyIntArrayObjTags) in[i]).val;
return reti;
case Type.LONG:
long[][] retl = new long[in.length][];
for (int i = 0; i < in.length; i++) if (in[i] != null)
retl[i] = ((LazyLongArrayObjTags) in[i]).val;
return retl;
case Type.SHORT:
short[][] rets = new short[in.length][];
for (int i = 0; i < in.length; i++) if (in[i] != null)
rets[i] = ((LazyShortArrayObjTags) in[i]).val;
return rets;
}
} else if (dims == 2) {
final Object[][] ina = (Object[][]) _in;
final Object[] in = (Object[]) _in;
switch(componentType) {
case Type.BOOLEAN:
boolean[][][] retz = new boolean[in.length][][];
for (int i = 0; i < in.length; i++) {
retz[i] = new boolean[ina[i].length][];
for (int j = 0; j < ina[i].length; j++) retz[i][j] = ((LazyBooleanArrayObjTags) ina[i][j]).val;
}
return retz;
case Type.BYTE:
byte[][][] retb = new byte[in.length][][];
for (int i = 0; i < in.length; i++) {
retb[i] = new byte[ina[i].length][];
for (int j = 0; j < ina[i].length; j++) retb[i][j] = ((LazyByteArrayObjTags) ina[i][j]).val;
}
return retb;
case Type.CHAR:
char[][][] retc = new char[in.length][][];
for (int i = 0; i < in.length; i++) {
retc[i] = new char[ina[i].length][];
for (int j = 0; j < ina[i].length; j++) retc[i][j] = ((LazyCharArrayObjTags) ina[i][j]).val;
}
return retc;
case Type.DOUBLE:
double[][][] retd = new double[in.length][][];
for (int i = 0; i < in.length; i++) {
retd[i] = new double[ina[i].length][];
for (int j = 0; j < ina[i].length; j++) retd[i][j] = ((LazyDoubleArrayObjTags) ina[i][j]).val;
}
return retd;
case Type.FLOAT:
float[][][] retf = new float[in.length][][];
for (int i = 0; i < in.length; i++) {
retf[i] = new float[ina[i].length][];
for (int j = 0; j < ina[i].length; j++) retf[i][j] = ((LazyFloatArrayObjTags) ina[i][j]).val;
}
return retf;
case Type.INT:
int[][][] reti = new int[in.length][][];
for (int i = 0; i < in.length; i++) {
reti[i] = new int[ina[i].length][];
for (int j = 0; j < ina[i].length; j++) reti[i][j] = ((LazyIntArrayObjTags) ina[i][j]).val;
}
return reti;
case Type.LONG:
long[][][] retl = new long[in.length][][];
for (int i = 0; i < in.length; i++) {
retl[i] = new long[ina[i].length][];
for (int j = 0; j < ina[i].length; j++) retl[i][j] = ((LazyLongArrayObjTags) ina[i][j]).val;
}
return retl;
case Type.SHORT:
short[][][] rets = new short[in.length][][];
for (int i = 0; i < in.length; i++) {
rets[i] = new short[ina[i].length][];
for (int j = 0; j < ina[i].length; j++) rets[i][j] = ((LazyShortArrayObjTags) ina[i][j]).val;
}
return rets;
}
}
throw new IllegalArgumentException();
}
Aggregations