how to use mksnapshot to make a warm-up snapshot?

43 views
Skip to first unread message

Chris Chen

unread,
Apr 26, 2020, 3:15:31 AM4/26/20
to v8-users
Hi, all,

When using "./clang_x64_v8_arm64/mksnapshot $JS_FILE --startup_blob=$BIN_FILE --turbo_instruction_scheduling",  seemed it only do "Loading script for embedding: xxx", but not include "Loading script for warm up: xxx ".

Is there a  way to generate a warm-up snapshot using mksnapshot? 

Ben Noordhuis

unread,
Apr 26, 2020, 4:05:26 AM4/26/20
to v8-users
Yes, just pass an additional filename. The first one is used for
embedding, the second one for warm-up.

Chris Chen

unread,
Apr 26, 2020, 6:41:46 AM4/26/20
to v8-users
I've tried the command like this:
./mksnapshot native.js native.js --startup_blob=native.js.bin --turbo_instruction_scheduling
but failed:
Loading script for embedding: native.js
Loading script for warm up: native.js

#
# Fatal error in , line 0
# Check failed: blob.data.
#
#
#
#FailureMessage Object: 0x7fff215367a0
==== C stack trace ===============================
    /home/c/v8/depot_tools/v8-code/v8-8.0.426.26/v8/out.gn/test-8/clang_x64_v8_arm64/libv8_libbase.cr.so(v8::base::debug::StackTrace::StackTrace()+0x13) [0x7f2f32f60123]
    /home/c/v8/depot_tools/v8-code/v8-8.0.426.26/v8/out.gn/test-8/clang_x64_v8_arm64/libv8_libplatform.cr.so(+0xd07d) [0x7f2f32f3807d]
    /home/c/v8/depot_tools/v8-code/v8-8.0.426.26/v8/out.gn/test-8/clang_x64_v8_arm64/libv8_libbase.cr.so(V8_Fatal(char const*, ...)+0x150) [0x7f2f32f5a2e0]
    ./mksnapshot(+0x3fecbd) [0x55ebe4d9bcbd]
    /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f2f31c0f830]
    ./mksnapshot(_start+0x2a) [0x55ebe4d993ba]
Illegal instruction (core dumped)


在 2020年4月26日星期日 UTC+8下午4:05:26,Ben Noordhuis写道:

Ben Noordhuis

unread,
Apr 26, 2020, 7:03:09 AM4/26/20
to v8-users
On Sun, Apr 26, 2020 at 12:41 PM Chris Chen <chenqy...@gmail.com> wrote:
>
> I've tried the command like this:
> ./mksnapshot native.js native.js --startup_blob=native.js.bin --turbo_instruction_scheduling
> but failed:
>>
>> Loading script for embedding: native.js
>> Loading script for warm up: native.js
>>
>> #
>> # Fatal error in , line 0
>> # Check failed: blob.data.
>> #
>> #
>> #
>> #FailureMessage Object: 0x7fff215367a0
>> ==== C stack trace ===============================
>> /home/c/v8/depot_tools/v8-code/v8-8.0.426.26/v8/out.gn/test-8/clang_x64_v8_arm64/libv8_libbase.cr.so(v8::base::debug::StackTrace::StackTrace()+0x13) [0x7f2f32f60123]
>> /home/c/v8/depot_tools/v8-code/v8-8.0.426.26/v8/out.gn/test-8/clang_x64_v8_arm64/libv8_libplatform.cr.so(+0xd07d) [0x7f2f32f3807d]
>> /home/c/v8/depot_tools/v8-code/v8-8.0.426.26/v8/out.gn/test-8/clang_x64_v8_arm64/libv8_libbase.cr.so(V8_Fatal(char const*, ...)+0x150) [0x7f2f32f5a2e0]
>> ./mksnapshot(+0x3fecbd) [0x55ebe4d9bcbd]
>> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f2f31c0f830]
>> ./mksnapshot(_start+0x2a) [0x55ebe4d993ba]
>> Illegal instruction (core dumped)

That probably means you have something in your warm-up script that
throws an exception. The snapshot runtime environment is not forgiving
of programming errors.

Chris Chen

unread,
Apr 26, 2020, 7:10:39 AM4/26/20
to v8-users
Umm, I used d8 to run this js file, it worked fine. In this case , how to find out where throws this exception? 

在 2020年4月26日星期日 UTC+8下午7:03:09,Ben Noordhuis写道:

Ben Noordhuis

unread,
Apr 26, 2020, 6:53:38 PM4/26/20
to v8-users
On Sun, Apr 26, 2020 at 1:10 PM Chris Chen <chenqy...@gmail.com> wrote:
>
> Umm, I used d8 to run this js file, it worked fine. In this case , how to find out where throws this exception?

The short answer is "you don't", at least not easily. :-)

mksnapshot won't print JS error messages or stack traces. The one
thing I can tell you is that it's _probably_ not a runtime exception
but a parse error., otherwise the assert would have been different.
The snapshot scripts should be plain JS scripts, not ES modules.

Oh, and keep in mind that d8 runs your script in a JS environment with
a lot of extras. mksnapshot is just a bare bones execution context.

Chris Chen

unread,
Apr 27, 2020, 4:54:57 AM4/27/20
to v8-users
Thanks for the hints, I will try go through that later.

在 2020年4月27日星期一 UTC+8上午6:53:38,Ben Noordhuis写道:
Reply all
Reply to author
Forward
0 new messages