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
34e97b73
Verified
Commit
34e97b73
authored
Dec 14, 2020
by
nagayama15
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add optimization targets for compound passes
parent
14fce2f6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
Reordering-inl.hpp
lib/kyut/Reordering-inl.hpp
+9
-1
check_extract.rb
scripts/check_extract.rb
+1
-1
common.rb
scripts/common.rb
+11
-4
No files found.
lib/kyut/Reordering-inl.hpp
View file @
34e97b73
...
...
@@ -104,6 +104,10 @@ namespace kyut {
const
auto
chunk_end
=
std
::
end
(
chunk
);
const
std
::
size_t
count
=
std
::
distance
(
chunk_begin
,
chunk_end
);
if
(
count
<
2
)
{
return
0
;
}
const
std
::
size_t
bit_width
=
factorial_bit_width_table
[
count
];
// Extract watermark.
...
...
@@ -117,7 +121,11 @@ namespace kyut {
return
!
less
(
*
a
,
*
(
begin
+
i
))
&&
!
less
(
*
(
begin
+
i
),
*
a
);
});
assert
(
found
!=
std
::
end
(
chunk
));
// FIXME: sometimes crashing here (maybe count < 2)
// assert(found != std::end(chunk)); // FIXME: sometimes crashing here
if
(
found
==
std
::
end
(
chunk
))
{
base
*=
count
-
i
;
continue
;
}
const
std
::
size_t
pos
=
std
::
distance
(
it
,
found
);
...
...
scripts/check_extract.rb
View file @
34e97b73
...
...
@@ -10,7 +10,7 @@ METHODS.each do |method|
OPT_PASSES
.
each
do
|
pass
|
b
=
a
.
to_s
.
end_with?
(
".wasm.txt"
)
?
a
.
sub
(
".wasm.txt"
,
"-
#{
pass
}
.wasm.txt"
)
:
a
.
sub
(
".txt"
,
"-
#{
pass
}
.txt"
)
puts
"
#{
a
.
basename
}
-
#{
b
.
basename
}
:
#{
method
[
:name
]
}
,
#{
pass
}
,
#{
FileUtils
.
cmp
(
a
,
b
)
}
"
puts
"
#{
a
.
basename
}
-
#{
b
.
basename
}
:
#{
method
[
:name
]
}
,
#{
pass
}
,
#{
FileUtils
.
cmp
(
a
,
b
)
?
"○"
:
"☓"
}
"
end
end
end
scripts/common.rb
View file @
34e97b73
...
...
@@ -51,19 +51,26 @@ OPT_PASSES = [
"optimize-instructions"
,
"optimize-stack-ir"
,
"pick-load-signs"
,
"precompute-propagate"
,
"precompute"
,
"precompute-propagate"
,
"remove-unused-brs"
,
"remove-unused-module-elements"
,
"remove-unused-names"
,
"reorder-locals"
,
"rse"
,
"simplify-globals-optimizing"
,
"simplify-globals"
,
"simplify-
locals-nostructure
"
,
"simplify-
globals-optimizing
"
,
"simplify-locals"
,
"simplify-locals-nostructure"
,
"ssa-nomerge"
,
"vacuum"
,
"O1"
,
"O2"
,
"O3"
,
"O4"
,
"Os"
,
"Oz"
,
]
WATERMARK
=
"N7AStlK2gioIqeRi"
...
...
@@ -79,7 +86,7 @@ def embed(file, out, method, watermark, chunk_size = 20)
end
def
optimize
(
file
,
out
,
pass
)
output
=
IO
.
popen
([
WASM_OPT
,
"-o"
,
out
.
to_s
,
"--
#{
pass
}
"
,
file
.
to_s
]).
read
output
=
IO
.
popen
([
WASM_OPT
,
"-o"
,
out
.
to_s
,
pass
.
start_with?
(
"O"
)
?
"-
#{
pass
}
"
:
"--
#{
pass
}
"
,
file
.
to_s
]).
read
puts
"optimize
#{
file
}
,
#{
out
}
,
#{
pass
}
,
#{
output
}
"
end
...
...
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