| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
This code predates our adoption of C++14 and can now be removed in favor of
`std::make_unique`, which should be more efficient.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch makes binaryen easier to call from other applications by making more errors recoverable instead of early-exiting.
The main thing it does is change three calls to exit on I/O errors into calls to Fatal(), which is an existing custom abstraction for handling unrecoverable errors. Currently Fatal's destructor calls _Exit(1).
My intent is to make it possible for Fatal to not exit, but to throw, allowing an embedding application to catch the exception.
Because the previous early exits were exiting with error code EXIT_FAILURE, I also changed Fatal to exit with EXIT_FAILURE. The test suite continues to pass so I assume this is ok.
Next I changed Fatal to buffer its error message until the destructor instead of immediately printing it to stderr. This is for ease of patching Fatal to throw instead.
Finally, I also included the patch I need to make Fatal throw when THROW_ON_FATAL is defined at compile time. I can carry this patch out of tree, but it is a small patch, so perhaps you will be willing to take it. I am happy to remove it.
Fixes #4938
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It does not make sense to construct an `Expression` directly because all
expressions must be specific expressions. However, we previously allowed
constructing Expressions, and in particular we allowed them to be copy
constructed. Unrelatedly, `Fatal::operator<<` took its argument by value.
Together, these two facts produced UB when printing Expressions in fatal error
messages because a new Expression would be copy constructed with the original
expression ID but without any of the actual data from the original specific
expression. For example, when trying to print a Block, the printing code would
try to look at the expression list, but the expression list would be junk stack
data because the copied Expression does not contain an expression list.
Fix the problem by making Expression's constructors visible only to its
subclasses and making `Fatal::operator<<` take its argument by forwarding
reference instead of by value.
|
|
|
|
|
|
|
| |
* use [[noreturn]] available since C++11 instead of compiler-specific attributes
* replace deprecated std::is_pod with is_trivial&&is_standard_layout (also available since C++11/14)
* explicitly capture this in [=] lambdas
* extra const functions in FeatureSet, fix implicit cast warning by using the features field directly
* Use CMAKE_CXX_STANDARD to ensure the C++ standard parameter is set on all targets, remove manual compiler flag workaround.
|
|
|
|
|
| |
Use overloads instead of templates where applicable and change function names
from PascalCase to camelCase. Also puts the functions in the Bits namespace to
avoid naming conflicts.
|
|
|
|
|
| |
This works more like llvm's unreachable handler in that is preserves
information even in release builds.
|
|
|
| |
Mass change to apply clang-format to everything. We are applying this in a PR by me so the (git) blame is all mine ;) but @aheejin did all the work to get clang-format set up and all the manual work to tidy up some things to make the output nicer in #2048
|
| |
|
|
|
|
|
| |
This was causing a deadlock while destroying the thread pool.
|
|
|
|
|
|
|
|
| |
* optimize more simple math operations: mul of 0, or of 0, and of 0, mul of 1, mul of a power of 2, urem of a power of 2
* fix asm2wasm callImport parsing: the optimizer may get rid of the added offset to a function table
* update js builds
|
|
|
|
|
|
|
| |
Use Fatal() rather than stdout or report callImport error
Without this the write to stdout can be lost (Since the following line
aborts)
|
|
|
|
|
|
|
| |
Still making things nicer for #370
Pulling wasm-linker into its own file also necessitated pulling asm_v_wasm.h into a cpp file. It goes into a new lib directory, src/asmjs.
No actual code changes in this PR.
|
|
|
|
|
| |
Follow-on from #372. Probably we should do even better for error
handling, and that might mean a cpp file in support, but for now this is
a small improvement.
|
|
|
|
|
| |
This is the first of a couple of refactorings in for #370
No functionality change, and minimal code change to make it work.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Properly align the stack pointer
By default (if no global base is given) the global base is 1, which
seems wrong. In this case the stack pointer gets an address of 1, which
is unaligned and definitely wrong. So, start the global base at 0 instead of
1 by default and align the stack pointer. Also factor allocation of
statics into a function.
* unconditionally allocate stack pointer; explicitly reserve address 0
|
|
|