Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
wasm-watermarker
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nagayama15
wasm-watermarker
Commits
a4fb66aa
Verified
Commit
a4fb66aa
authored
Oct 03, 2020
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore(ordering): rename embedding function
parent
10ca4db0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
Ordering-inl.hpp
lib/kyut/Ordering-inl.hpp
+2
-0
FunctionOrdering.hpp
lib/kyut/methods/FunctionOrdering.hpp
+6
-4
snpi.cpp
src/snpi.cpp
+4
-4
No files found.
lib/kyut/Ordering-inl.hpp
View file @
a4fb66aa
...
...
@@ -108,6 +108,8 @@ namespace kyut {
}
const
auto
bit_width
=
factorial_bit_width_table
[
count
];
assert
(
watermark
<
(
std
::
uint64_t
{
1
}
<<
bit_width
));
w
.
write
(
watermark
,
bit_width
);
return
bit_width
;
...
...
lib/kyut/methods/FunctionOrdering.hpp
View file @
a4fb66aa
...
...
@@ -9,8 +9,8 @@ namespace kyut {
class
BitStreamWriter
;
}
// namespace kyut
namespace
kyut
::
methods
{
std
::
size_t
embed
_by_function_ordering
(
CircularBitStreamReader
&
r
,
wasm
::
Module
&
module
,
std
::
size_t
chunk_size
)
{
namespace
kyut
::
methods
::
function_ordering
{
std
::
size_t
embed
(
CircularBitStreamReader
&
r
,
wasm
::
Module
&
module
,
std
::
size_t
chunk_size
)
{
const
auto
begin
=
std
::
begin
(
module
.
functions
);
const
auto
end
=
std
::
end
(
module
.
functions
);
...
...
@@ -18,7 +18,7 @@ namespace kyut::methods {
return
f
->
body
==
nullptr
;
});
return
embed_by_ordering
(
const
auto
size_bits
=
embed_by_ordering
(
r
,
chunk_size
,
start
,
...
...
@@ -26,7 +26,9 @@ namespace kyut::methods {
[](
const
auto
&
a
,
const
auto
&
b
)
{
return
a
->
name
<
b
->
name
;
});
return
size_bits
;
}
}
// namespace kyut::methods
}
// namespace kyut::methods
::function_ordering
#endif // INCLUDE_kyut_methods_FunctionOrdering_hpp
src/snpi.cpp
View file @
a4fb66aa
...
...
@@ -57,17 +57,17 @@ int main(int argc, char* argv[]) {
const
auto
output
=
options
.
get
<
std
::
string
>
(
"output"
);
const
auto
method
=
options
.
get
<
std
::
string
>
(
"method"
);
const
auto
watermark
=
options
.
get
<
std
::
string
>
(
"watermark"
);
[[
maybe_unused
]]
const
auto
chunk_size
=
options
.
get
<
std
::
size_t
>
(
"chunk-size"
);
const
auto
chunk_size
=
options
.
get
<
std
::
size_t
>
(
"chunk-size"
);
try
{
kyut
::
CircularBitStreamReader
r
{
watermark
};
wasm
::
Module
module
{};
wasm
::
ModuleReader
{}.
read
(
input
,
module
);
kyut
::
CircularBitStreamReader
r
{
watermark
};
std
::
size_t
size_bits
;
if
(
method
==
"function-ordering"
)
{
size_bits
=
kyut
::
methods
::
embed_by_function_ordering
(
r
,
module
,
chunk_size
);
size_bits
=
kyut
::
methods
::
function_ordering
::
embed
(
r
,
module
,
chunk_size
);
}
else
{
WASM_UNREACHABLE
((
"unknown method: "
+
method
).
c_str
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment