From 650941cdf590b4290a3c8c4cb5ecb4c7f74bea02 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 16 Sep 2016 13:55:09 -0600 Subject: [PATCH] print informative message if lambda encountered with no host VM Per a recent bug report in the hello-ios project, we found that bootimage-generator would abort with no explanation if it encountered a lambda invocation and the `-hostvm` option was unspecified. This commit ensures that a helpful message is printed before exiting. --- src/compile.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/compile.cpp b/src/compile.cpp index 08444e2644..97240fbb89 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -5140,6 +5140,14 @@ loop: PROTECT(t, bootstrapArray); if (isLambda(t, c->loader(), bootstrapArray, invocation)) { + if (bc->hostVM == 0) { + throwNew(t, + GcVirtualMachineError::Type, + "lambda expression encountered, but host VM is not " + "available; use -hostvm option to bootimage-generator to " + "fix this"); + } + JNIEnv* e; if (bc->hostVM->vtable->AttachCurrentThread(bc->hostVM, &e, 0) == 0) { e->vtable->PushLocalFrame(e, 256);