Skip to content

Commit

Permalink
cleaned away some old exception types
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephan Herhut committed Feb 17, 2012
1 parent a13d29d commit c7d6e23
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 18 deletions.
12 changes: 1 addition & 11 deletions jslib/jit/compiler/driver.js
Expand Up @@ -252,7 +252,7 @@ RiverTrail.compiler = (function () {
// numbers are floats
argumentTypes.push({ inferredType: defaultNumberType, dimSize: [] });
} else {
throw new CompilerBug("Type derivation for argument not implemented yet");
throw new Error("Type derivation for argument not implemented yet");
}
}
return argumentTypes;
Expand Down Expand Up @@ -291,16 +291,6 @@ RiverTrail.compiler = (function () {
Array.prototype.every.call(shapeA, function (a,idx) { return a == shapeB[idx];}));
};

// I create three names for Error here so that we can, should we ever wish
// distinguish both or have our own implementation for exceptions
var errorHelper = function errorHelper(e) {
throw (e);
};

var CompilerError = errorHelper;
var CompilerBug = errorHelper; // something went wrong although it should not
var CompilerAbort = errorHelper; // exception thrown to influence control flow, e.g., misspeculation

// end code from parallel array
return {
verboseDebug: false,
Expand Down
14 changes: 7 additions & 7 deletions jslib/jit/compiler/runOCL.js
Expand Up @@ -64,7 +64,7 @@ RiverTrail.compiler.runOCL = function () {
var resSize;
var kernelName = ast.name;
if (!kernelName) {
throw new CompilerBug("Invalid ast: Function expected at top level");
throw new Error("Invalid ast: Function expected at top level");
}
if ((construct === "comprehension") || (construct === "comprehensionScalar")) {
// comprehensions do not have a source, so we derive the required information
Expand Down Expand Up @@ -103,7 +103,7 @@ RiverTrail.compiler.runOCL = function () {
} else {
// We have a regular array as data container. There is no point trying
// to convert it, as the constructor would already have tried.
throw new CompilerError("Cannot transform regular array to OpenCL kernel arguments");
throw new Error("Cannot transform regular array to OpenCL kernel arguments");
}
// Add the offset as an additional integer argument. We do this for
// Parallel Array arguments, only! The kernel will have been created
Expand All @@ -127,7 +127,7 @@ RiverTrail.compiler.runOCL = function () {
// map the typed array
args.push(RiverTrail.compiler.openCLContext.mapData(object));
} else {
throw new CompilerError("only typed arrays and scalars are currently supported as OpenCL kernel arguments");
throw new Error("only typed arrays and scalars are currently supported as OpenCL kernel arguments");
}
return args;
}
Expand All @@ -147,10 +147,10 @@ RiverTrail.compiler.runOCL = function () {
// first we ensure that the shape of what we compute is the shape of what is expected
if (!equalsShape(resShape, paSource.updateInPlaceShape)) {
// throwing this will revert the outer scan to non-destructive mode
throw new CompilerAbort("shape mismatch during update in place!");
throw new Error("shape mismatch during update in place!");
}
if (++paSource.updateInPlaceUses !== 1) {
throw new CompilerAbort("preallocated memory used more than once!");
throw new Error("preallocated memory used more than once!");
}
if (!(paSource.updateInPlacePA.data instanceof Components.interfaces.dpoIData)) {
paSource.updateInPlacePA.data = RiverTrail.compiler.openCLContext.mapData(paSource.updateInPlacePA.data);
Expand All @@ -161,7 +161,7 @@ RiverTrail.compiler.runOCL = function () {
// We allocate whatever the result type says. To ensure portability of
// the extension, we need a template typed array. So lets just create one!
var template = RiverTrail.Helper.elementalTypeToConstructor(resultElemType);
if (template == undefined) throw new CompilerBug("cannot map inferred type to constructor");
if (template == undefined) throw new Error("cannot map inferred type to constructor");
resultMemObj = RiverTrail.compiler.openCLContext.allocateData(new template(1), resSize);
resultOffset = 0;
}
Expand Down Expand Up @@ -220,7 +220,7 @@ RiverTrail.compiler.runOCL = function () {
} else if (arg instanceof Components.interfaces.dpoIData) {
kernel.setArgument(index, arg);
} else {
throw new CompilerBug("unexpected kernel argument type!");
throw new Error("unexpected kernel argument type!");
}
return kernel;
} catch (e) {
Expand Down

0 comments on commit c7d6e23

Please sign in to comment.