Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
sxychenjing
engine
提交
a3986497
E
engine
项目概览
sxychenjing
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
a3986497
编写于
11月 22, 2016
作者:
J
John McCutchan
提交者:
GitHub
11月 22, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Bug fixes for `sky_snapshot --compile-all` mode (#3255)
上级
770c9e83
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
62 addition
and
14 deletion
+62
-14
DEPS
DEPS
+1
-1
snapshotter/main.cc
snapshotter/main.cc
+61
-13
未找到文件。
DEPS
浏览文件 @
a3986497
...
...
@@ -27,7 +27,7 @@ vars = {
# Note: When updating the Dart revision, ensure that all entries that are
# dependencies of dart are also updated
'dart_revision': '
deafdbf978d1128dde83b9779bdae6633d484d96
',
'dart_revision': '
ed47486f6003eea8c6012d4ee1ea604c3dcd41f0
',
'dart_boringssl_gen_revision': '62c20247d582444cb2804f9ea4e3abaa6e47f6a5',
'dart_boringssl_revision': '8d343b44bbab829d1a28fdef650ca95f7db4412e',
'dart_observatory_packages_revision': '26aad88f1c1915d39bbcbff3cad589e2402fdcf1',
...
...
snapshotter/main.cc
浏览文件 @
a3986497
...
...
@@ -10,6 +10,7 @@
#include "dart/runtime/include/dart_api.h"
#include "dart/runtime/include/dart_native_api.h"
#include "dart/runtime/include/dart_tools_api.h"
#include "lib/ftl/arraysize.h"
#include "lib/ftl/command_line.h"
#include "lib/ftl/files/directory.h"
...
...
@@ -121,6 +122,49 @@ Dart_Handle HandleLibraryTag(Dart_LibraryTag tag,
return
GetLoader
().
HandleLibraryTag
(
tag
,
library
,
url
);
}
static
const
char
StubNativeFunctionName
[]
=
"StubNativeFunction"
;
void
StubNativeFunction
(
Dart_NativeArguments
arguments
)
{
// This is a stub function for the resolver
Dart_SetReturnValue
(
arguments
,
Dart_NewApiError
(
"<EMBEDDER DID NOT SETUP NATIVE RESOLVER>"
));
}
static
Dart_NativeFunction
StubNativeLookup
(
Dart_Handle
name
,
int
argument_count
,
bool
*
auto_setup_scope
)
{
return
&
StubNativeFunction
;
}
static
const
uint8_t
*
StubNativeSymbol
(
Dart_NativeFunction
nf
)
{
return
reinterpret_cast
<
const
uint8_t
*>
(
StubNativeFunctionName
);
}
// Registers a dummy native symbol resolver on all loaded libraries that do not
// already have a native symbol resolver. This is necessary because
// `--compile-all` will try and resolve all native functions. The function
// returned by the dummy native symbol resolver will never be invoked.
static
void
SetupStubNativeResolvers
()
{
Dart_Handle
library_ids
=
Dart_GetLibraryIds
();
intptr_t
library_ids_length
;
DART_CHECK_VALID
(
Dart_ListLength
(
library_ids
,
&
library_ids_length
));
for
(
intptr_t
i
=
0
;
i
<
library_ids_length
;
i
++
)
{
Dart_Handle
library_id_handle
=
Dart_ListGetAt
(
library_ids
,
i
);
DART_CHECK_VALID
(
library_id_handle
);
int64_t
library_id
;
Dart_IntegerToInt64
(
library_id_handle
,
&
library_id
);
Dart_Handle
library
=
Dart_GetLibraryFromId
(
library_id
);
DART_CHECK_VALID
(
library
);
Dart_NativeEntryResolver
old_resolver
=
NULL
;
DART_CHECK_VALID
(
Dart_GetNativeResolver
(
library
,
&
old_resolver
));
if
(
old_resolver
==
NULL
)
{
Dart_Handle
result
=
Dart_SetNativeResolver
(
library
,
&
StubNativeLookup
,
&
StubNativeSymbol
);
DART_CHECK_VALID
(
result
);
}
}
}
std
::
vector
<
char
>
CreateSnapshot
()
{
uint8_t
*
buffer
=
nullptr
;
intptr_t
size
=
0
;
...
...
@@ -216,19 +260,7 @@ int CreateSnapshot(const ftl::CommandLine& command_line) {
return
1
;
}
const
bool
compile_all_mode
=
command_line
.
HasOption
(
kCompileAll
,
nullptr
);
if
(
compile_all_mode
)
{
// Compile all the code loaded into the isolate. This will eagerly detect
// syntax errors.
Dart_Handle
compile_all_results
=
Dart_CompileAll
();
if
(
Dart_IsError
(
compile_all_results
))
{
std
::
cerr
<<
"error: Compilation errors detected:"
<<
std
::
endl
<<
Dart_GetError
(
compile_all_results
)
<<
std
::
endl
;
return
1
;
}
}
SetupStubNativeResolvers
();
if
(
print_deps_mode
)
{
if
(
Dart_IsError
(
load_result
))
{
...
...
@@ -263,6 +295,22 @@ int CreateSnapshot(const ftl::CommandLine& command_line) {
<<
std
::
endl
;
return
1
;
}
// Run compile-all *after* generating the snapshot to avoid adding
// unnecessary compilation related artifacts to the snapshot.
const
bool
compile_all_mode
=
command_line
.
HasOption
(
kCompileAll
,
nullptr
);
if
(
compile_all_mode
)
{
// Compile all the code loaded into the isolate. This will eagerly detect
// syntax errors.
Dart_Handle
compile_all_results
=
Dart_CompileAll
();
if
(
Dart_IsError
(
compile_all_results
))
{
std
::
cerr
<<
"error: Compilation errors detected:"
<<
std
::
endl
<<
Dart_GetError
(
compile_all_results
)
<<
std
::
endl
;
return
1
;
}
}
}
return
0
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录