Skip to content

Commit

Permalink
Merge pull request #123 from rjharmon/main
Browse files Browse the repository at this point in the history
removed try/catch
  • Loading branch information
christianschmitz authored Sep 25, 2024
2 parents 6f0c61e + 0586d68 commit df03211
Showing 1 changed file with 24 additions and 30 deletions.
54 changes: 24 additions & 30 deletions src/program/Program.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,40 +314,34 @@ export class Program {
optimize: optimize
})

try {
const alt = withAlt ? this.compile({ optimize: false }) : undefined
// todo: re-use the IR from alt version to shorten the IR compilation for optimized version (~0.5 seconds in one sample)
// todo: or can we re-use some intermediate result within the IR-compilation process, to reduce overhead even further?

const uplc = compileIR(ir, {
optimize: optimize,
alt: alt,
parseOptions: IR_PARSE_OPTIONS,
optimizeOptions:
options.optimize && typeof options.optimize != "boolean"
? options.optimize
: undefined
})

// userfuncs might depend on own hash, which is easer to inject after compilation of main program
if (options.onCompileUserFunc) {
if (options.optimize) {
hashDependencies[this.name] = bytesToHex(uplc.hash())
}
const alt = withAlt ? this.compile({ optimize: false }) : undefined
// todo: re-use the IR from alt version to shorten the IR compilation for optimized version (~0.5 seconds in one sample)
// todo: or can we re-use some intermediate result within the IR-compilation process, to reduce overhead even further?

const uplc = compileIR(ir, {
optimize: optimize,
alt: alt,
parseOptions: IR_PARSE_OPTIONS,
optimizeOptions:
options.optimize && typeof options.optimize != "boolean"
? options.optimize
: undefined
})

this.compileUserFuncs(options.onCompileUserFunc, {
excludeUserFuncs: options.excludeUserFuncs ?? new Set(),
hashDependencies: hashDependencies,
validatorIndices: options.validatorIndices
})
// userfuncs might depend on own hash, which is easer to inject after compilation of main program
if (options.onCompileUserFunc) {
if (options.optimize) {
hashDependencies[this.name] = bytesToHex(uplc.hash())
}

return uplc
} catch (e) {
debugger
console.error("Error compiling program", e)
throw e
this.compileUserFuncs(options.onCompileUserFunc, {
excludeUserFuncs: options.excludeUserFuncs ?? new Set(),
hashDependencies: hashDependencies,
validatorIndices: options.validatorIndices
})
}

return uplc
}

/**
Expand Down

0 comments on commit df03211

Please sign in to comment.