Add migration docs

This commit is contained in:
Mark McCaskey
2020-09-24 17:07:25 -07:00
committed by jubianchi
parent 592931dc77
commit 96573e5bfa
3 changed files with 390 additions and 0 deletions

74
docs/deps_dedup.dot Normal file
View File

@@ -0,0 +1,74 @@
digraph dependencies {
newrank=true;
n0 [label="wasmer", color=orange];
n1 [label="wasmer-compiler", color=orange];
n5 [label="wasmer-engine", color=orange];
n6 [label="wasmer-engine-jit", color=orange];
n7 [label="wasmer-engine-native", color=orange];
n8 [label="wasmer-types", color=orange];
n9 [label="wasmer-vm", color=orange];
n10 [label="wasmer-c-api", color=orange];
n11 [label="wasmer-emscripten", color=orange];
n12 [label="wasmer-wasi", color=orange];
n13 [label="wasmer-cache", color=orange];
n14 [label="wasmer-cli", color=orange];
subgraph cluster_compiler {
label="Compilers";
color=brown;
n2 [label="wasmer-compiler-cranelift", color=orange];
n3 [label="wasmer-compiler-llvm", color=orange];
n4 [label="wasmer-compiler-singlepass", color=orange];
}
subgraph cluster_engine {
label="Engines";
color=brown;
n6 [label="wasmer-engine-jit", color=orange];
n7 [label="wasmer-engine-native", color=orange];
}
{
rank=same;
n2;
n3;
n4;
n6;
n7;
}
subgraph cluster_abi {
label="Provided ABIs";
color=brown;
n12 [label="wasmer-wasi", color=orange];
n11 [label="wasmer-emscripten", color=orange];
}
n14 -> n13 [color=orange, style=dashed];
n14 -> n12 [color=orange, style=dashed];
n14 -> n11 [color=orange, style=dashed];
n13 -> n0 [color=orange, style=dashed];
n10 -> n11 [color=orange, style=dashed];
n10 -> n12 [color=orange, style=dashed];
n11 -> n0 [color=orange, style=dashed];
n12 -> n0 [color=orange, style=dashed];
n0 -> n2 [color=orange, style=dashed];
n0 -> n3 [color=orange, style=dashed];
n0 -> n4 [color=orange, style=dashed];
n0 -> n6 [color=orange, style=dashed];
n0 -> n7 [color=orange, style=dashed];
n2 -> n1 [color=orange, style=dashed];
n3 -> n1 [color=orange, style=dashed];
n4 -> n1 [color=orange, style=dashed];
n6 -> n5 [color=orange, style=dashed];
n7 -> n5 [color=orange, style=dashed];
n5 -> n1 [color=orange, style=dashed];
n1 -> n9 [color=orange, style=dashed];
n9 -> n8 [color=orange, style=dashed];
}

244
docs/deps_dedup.svg Normal file
View File

@@ -0,0 +1,244 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 2.44.1 (20200629.0846)
-->
<!-- Title: dependencies Pages: 1 -->
<svg width="1067pt" height="554pt"
viewBox="0.00 0.00 1067.00 554.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 550)">
<title>dependencies</title>
<polygon fill="white" stroke="transparent" points="-4,4 -4,-550 1063,-550 1063,4 -4,4"/>
<g id="clust1" class="cluster">
<title>cluster_compiler</title>
<polygon fill="none" stroke="brown" points="378,-280 378,-355 1051,-355 1051,-280 378,-280"/>
<text text-anchor="middle" x="714.5" y="-339.8" font-family="Times,serif" font-size="14.00">Compilers</text>
</g>
<g id="clust2" class="cluster">
<title>cluster_engine</title>
<polygon fill="none" stroke="brown" points="8,-280 8,-355 370,-355 370,-280 8,-280"/>
<text text-anchor="middle" x="189" y="-339.8" font-family="Times,serif" font-size="14.00">Engines</text>
</g>
<g id="clust4" class="cluster">
<title>cluster_abi</title>
<polygon fill="none" stroke="brown" points="257,-427 257,-502 568,-502 568,-427 257,-427"/>
<text text-anchor="middle" x="412.5" y="-486.8" font-family="Times,serif" font-size="14.00">Provided ABIs</text>
</g>
<!-- n0 -->
<g id="node1" class="node">
<title>n0</title>
<ellipse fill="none" stroke="orange" cx="479" cy="-381" rx="38.19" ry="18"/>
<text text-anchor="middle" x="479" y="-377.3" font-family="Times,serif" font-size="14.00">wasmer</text>
</g>
<!-- n6 -->
<g id="node4" class="node">
<title>n6</title>
<ellipse fill="none" stroke="orange" cx="287" cy="-306" rx="75.29" ry="18"/>
<text text-anchor="middle" x="287" y="-302.3" font-family="Times,serif" font-size="14.00">wasmer&#45;engine&#45;jit</text>
</g>
<!-- n0&#45;&gt;n6 -->
<g id="edge12" class="edge">
<title>n0&#45;&gt;n6</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M443.28,-373.99C422.62,-369.9 396.37,-363.65 374,-355 355.71,-347.93 336.5,-337.67 320.81,-328.45"/>
<polygon fill="orange" stroke="orange" points="322.38,-325.31 312,-323.18 318.78,-331.32 322.38,-325.31"/>
</g>
<!-- n7 -->
<g id="node5" class="node">
<title>n7</title>
<ellipse fill="none" stroke="orange" cx="105" cy="-306" rx="89.08" ry="18"/>
<text text-anchor="middle" x="105" y="-302.3" font-family="Times,serif" font-size="14.00">wasmer&#45;engine&#45;native</text>
</g>
<!-- n0&#45;&gt;n7 -->
<g id="edge13" class="edge">
<title>n0&#45;&gt;n7</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M440.26,-380.88C386.12,-381.13 285.24,-378.02 203,-355 181.25,-348.91 158.5,-338.09 140.41,-328.25"/>
<polygon fill="orange" stroke="orange" points="141.84,-325.04 131.4,-323.23 138.43,-331.16 141.84,-325.04"/>
</g>
<!-- n2 -->
<g id="node13" class="node">
<title>n2</title>
<ellipse fill="none" stroke="orange" cx="938" cy="-306" rx="105.08" ry="18"/>
<text text-anchor="middle" x="938" y="-302.3" font-family="Times,serif" font-size="14.00">wasmer&#45;compiler&#45;cranelift</text>
</g>
<!-- n0&#45;&gt;n2 -->
<g id="edge9" class="edge">
<title>n0&#45;&gt;n2</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M517.13,-378.78C594.16,-376.05 765.84,-368.62 823,-355 848.67,-348.88 875.98,-337.7 897.54,-327.67"/>
<polygon fill="orange" stroke="orange" points="899.18,-330.76 906.71,-323.31 896.18,-324.44 899.18,-330.76"/>
</g>
<!-- n3 -->
<g id="node14" class="node">
<title>n3</title>
<ellipse fill="none" stroke="orange" cx="479" cy="-306" rx="92.88" ry="18"/>
<text text-anchor="middle" x="479" y="-302.3" font-family="Times,serif" font-size="14.00">wasmer&#45;compiler&#45;llvm</text>
</g>
<!-- n0&#45;&gt;n3 -->
<g id="edge10" class="edge">
<title>n0&#45;&gt;n3</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M479,-362.7C479,-354.25 479,-343.87 479,-334.37"/>
<polygon fill="orange" stroke="orange" points="482.5,-334.18 479,-324.18 475.5,-334.18 482.5,-334.18"/>
</g>
<!-- n4 -->
<g id="node15" class="node">
<title>n4</title>
<ellipse fill="none" stroke="orange" cx="702" cy="-306" rx="112.38" ry="18"/>
<text text-anchor="middle" x="702" y="-302.3" font-family="Times,serif" font-size="14.00">wasmer&#45;compiler&#45;singlepass</text>
</g>
<!-- n0&#45;&gt;n4 -->
<g id="edge11" class="edge">
<title>n0&#45;&gt;n4</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M513.33,-372.82C533.27,-368.35 558.77,-362.1 581,-355 606.24,-346.94 633.75,-336.2 656.14,-326.91"/>
<polygon fill="orange" stroke="orange" points="657.53,-330.13 665.41,-323.04 654.83,-323.67 657.53,-330.13"/>
</g>
<!-- n1 -->
<g id="node2" class="node">
<title>n1</title>
<ellipse fill="none" stroke="orange" cx="590" cy="-162" rx="73.39" ry="18"/>
<text text-anchor="middle" x="590" y="-158.3" font-family="Times,serif" font-size="14.00">wasmer&#45;compiler</text>
</g>
<!-- n9 -->
<g id="node7" class="node">
<title>n9</title>
<ellipse fill="none" stroke="orange" cx="590" cy="-90" rx="53.09" ry="18"/>
<text text-anchor="middle" x="590" y="-86.3" font-family="Times,serif" font-size="14.00">wasmer&#45;vm</text>
</g>
<!-- n1&#45;&gt;n9 -->
<g id="edge20" class="edge">
<title>n1&#45;&gt;n9</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M590,-143.7C590,-135.98 590,-126.71 590,-118.11"/>
<polygon fill="orange" stroke="orange" points="593.5,-118.1 590,-108.1 586.5,-118.1 593.5,-118.1"/>
</g>
<!-- n5 -->
<g id="node3" class="node">
<title>n5</title>
<ellipse fill="none" stroke="orange" cx="287" cy="-234" rx="64.99" ry="18"/>
<text text-anchor="middle" x="287" y="-230.3" font-family="Times,serif" font-size="14.00">wasmer&#45;engine</text>
</g>
<!-- n5&#45;&gt;n1 -->
<g id="edge19" class="edge">
<title>n5&#45;&gt;n1</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M335.35,-221.83C387.75,-209.72 471.52,-190.37 528.56,-177.19"/>
<polygon fill="orange" stroke="orange" points="529.58,-180.55 538.53,-174.89 528,-173.73 529.58,-180.55"/>
</g>
<!-- n6&#45;&gt;n5 -->
<g id="edge17" class="edge">
<title>n6&#45;&gt;n5</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M287,-287.7C287,-279.98 287,-270.71 287,-262.11"/>
<polygon fill="orange" stroke="orange" points="290.5,-262.1 287,-252.1 283.5,-262.1 290.5,-262.1"/>
</g>
<!-- n7&#45;&gt;n5 -->
<g id="edge18" class="edge">
<title>n7&#45;&gt;n5</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M144.49,-289.81C172.98,-278.85 211.51,-264.03 241.33,-252.57"/>
<polygon fill="orange" stroke="orange" points="242.6,-255.83 250.68,-248.97 240.09,-249.29 242.6,-255.83"/>
</g>
<!-- n8 -->
<g id="node6" class="node">
<title>n8</title>
<ellipse fill="none" stroke="orange" cx="590" cy="-18" rx="59.59" ry="18"/>
<text text-anchor="middle" x="590" y="-14.3" font-family="Times,serif" font-size="14.00">wasmer&#45;types</text>
</g>
<!-- n9&#45;&gt;n8 -->
<g id="edge21" class="edge">
<title>n9&#45;&gt;n8</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M590,-71.7C590,-63.98 590,-54.71 590,-46.11"/>
<polygon fill="orange" stroke="orange" points="593.5,-46.1 590,-36.1 586.5,-46.1 593.5,-46.1"/>
</g>
<!-- n10 -->
<g id="node8" class="node">
<title>n10</title>
<ellipse fill="none" stroke="orange" cx="338" cy="-528" rx="59.29" ry="18"/>
<text text-anchor="middle" x="338" y="-524.3" font-family="Times,serif" font-size="14.00">wasmer&#45;c&#45;api</text>
</g>
<!-- n11 -->
<g id="node9" class="node">
<title>n11</title>
<ellipse fill="none" stroke="orange" cx="479" cy="-453" rx="80.69" ry="18"/>
<text text-anchor="middle" x="479" y="-449.3" font-family="Times,serif" font-size="14.00">wasmer&#45;emscripten</text>
</g>
<!-- n10&#45;&gt;n11 -->
<g id="edge5" class="edge">
<title>n10&#45;&gt;n11</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M368.64,-512.56C375.69,-509.16 383.13,-505.5 390,-502 407,-493.34 425.6,-483.38 441.39,-474.79"/>
<polygon fill="orange" stroke="orange" points="443.22,-477.77 450.32,-469.91 439.87,-471.63 443.22,-477.77"/>
</g>
<!-- n12 -->
<g id="node10" class="node">
<title>n12</title>
<ellipse fill="none" stroke="orange" cx="323" cy="-453" rx="57.69" ry="18"/>
<text text-anchor="middle" x="323" y="-449.3" font-family="Times,serif" font-size="14.00">wasmer&#45;wasi</text>
</g>
<!-- n10&#45;&gt;n12 -->
<g id="edge6" class="edge">
<title>n10&#45;&gt;n12</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M334.45,-509.7C332.69,-501.15 330.53,-490.65 328.56,-481.07"/>
<polygon fill="orange" stroke="orange" points="331.97,-480.27 326.53,-471.18 325.11,-481.68 331.97,-480.27"/>
</g>
<!-- n11&#45;&gt;n0 -->
<g id="edge7" class="edge">
<title>n11&#45;&gt;n0</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M479,-434.7C479,-426.98 479,-417.71 479,-409.11"/>
<polygon fill="orange" stroke="orange" points="482.5,-409.1 479,-399.1 475.5,-409.1 482.5,-409.1"/>
</g>
<!-- n12&#45;&gt;n0 -->
<g id="edge8" class="edge">
<title>n12&#45;&gt;n0</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M354.57,-437.83C380.1,-426.38 416.07,-410.24 442.77,-398.26"/>
<polygon fill="orange" stroke="orange" points="444.46,-401.33 452.15,-394.05 441.6,-394.95 444.46,-401.33"/>
</g>
<!-- n13 -->
<g id="node11" class="node">
<title>n13</title>
<ellipse fill="none" stroke="orange" cx="639" cy="-453" rx="61.99" ry="18"/>
<text text-anchor="middle" x="639" y="-449.3" font-family="Times,serif" font-size="14.00">wasmer&#45;cache</text>
</g>
<!-- n13&#45;&gt;n0 -->
<g id="edge4" class="edge">
<title>n13&#45;&gt;n0</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M606.24,-437.67C579.82,-426.11 542.7,-409.87 515.37,-397.91"/>
<polygon fill="orange" stroke="orange" points="516.71,-394.68 506.14,-393.87 513.9,-401.09 516.71,-394.68"/>
</g>
<!-- n14 -->
<g id="node12" class="node">
<title>n14</title>
<ellipse fill="none" stroke="orange" cx="479" cy="-528" rx="50.09" ry="18"/>
<text text-anchor="middle" x="479" y="-524.3" font-family="Times,serif" font-size="14.00">wasmer&#45;cli</text>
</g>
<!-- n14&#45;&gt;n11 -->
<g id="edge3" class="edge">
<title>n14&#45;&gt;n11</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M479,-509.7C479,-501.25 479,-490.87 479,-481.37"/>
<polygon fill="orange" stroke="orange" points="482.5,-481.18 479,-471.18 475.5,-481.18 482.5,-481.18"/>
</g>
<!-- n14&#45;&gt;n12 -->
<g id="edge2" class="edge">
<title>n14&#45;&gt;n12</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M436.19,-518.44C420.87,-514.52 403.75,-509.12 389,-502 375.04,-495.26 360.95,-485.51 349.4,-476.55"/>
<polygon fill="orange" stroke="orange" points="351.47,-473.73 341.47,-470.23 347.11,-479.2 351.47,-473.73"/>
</g>
<!-- n14&#45;&gt;n13 -->
<g id="edge1" class="edge">
<title>n14&#45;&gt;n13</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M522.27,-518.78C538.34,-514.85 556.44,-509.37 572,-502 586.15,-495.3 600.45,-485.56 612.18,-476.6"/>
<polygon fill="orange" stroke="orange" points="614.53,-479.2 620.23,-470.26 610.21,-473.7 614.53,-479.2"/>
</g>
<!-- n2&#45;&gt;n1 -->
<g id="edge14" class="edge">
<title>n2&#45;&gt;n1</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M899.09,-289.12C834.21,-262.65 704.27,-209.63 635.35,-181.5"/>
<polygon fill="orange" stroke="orange" points="636.62,-178.24 626.04,-177.71 633.98,-184.72 636.62,-178.24"/>
</g>
<!-- n3&#45;&gt;n1 -->
<g id="edge15" class="edge">
<title>n3&#45;&gt;n1</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M492.17,-288.15C511.61,-263.28 548.12,-216.57 570.62,-187.79"/>
<polygon fill="orange" stroke="orange" points="573.45,-189.86 576.85,-179.82 567.93,-185.55 573.45,-189.86"/>
</g>
<!-- n4&#45;&gt;n1 -->
<g id="edge16" class="edge">
<title>n4&#45;&gt;n1</title>
<path fill="none" stroke="orange" stroke-dasharray="5,2" d="M688.49,-287.87C668.79,-262.9 632.08,-216.35 609.46,-187.68"/>
<polygon fill="orange" stroke="orange" points="612.15,-185.43 603.21,-179.75 606.65,-189.77 612.15,-185.43"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,72 @@
# Migrating from Wasmer 0.x to Wasmer 1.0.0
Wasmer 1.0.0 is currently in alpha and is our primary focus. This document will
describe the differences between 0.x Wasmer and Wasmer 1.0.0 and provide examples
to make migrating to the new API as simple as possible.
Some features are still under development during the alpha of Wasmer 1.0.0. This document
will aim to make clear what these features are.
## Table of Contents
- Rationale for changes in 1.0.0
- How to use Wasmer 1.0.0
- Project structure
- TODO: specific differences
## Rationale for changes in 1.0.0
TODO: explain why 1.0.0 exists
## How to use Wasmer 1.0.0
### Installing Wasmer
See [wasmer.io] for installation instructions.
If you already have wasmer installed, run `wasmer self-update`.
Install the latest versions of wasmer with [wasmer-nightly].
### Using Wasmer 1.0.0
The CLI interface for Wasmer 1.0.0 is the same as it was in Wasmer 0.X.
The top level crates that users will usually interface with are:
- [wasmer] - core API
- [wasmer-wasi] - Wasmer's WASI implementation
- [wasmer-emscripten] - Wasmer's Emscripten implementation
- TODO:
See the [examples] to find out how to do specific things in Wasmer 1.0.0.
## Project Structure
![Wasmer depgraph](./docs/deps_dedup.svg)
The figure above shows the core Wasmer crates and their dependencies with transitive dependencies deduplicated.
Wasmer 1.0.0 has two core architectural abstractions: engines and compilers.
A compiler is a system that translates Wasm into a format that can be understood
more directly by a real computer.
An engine is a system that processes Wasm with a compiler and prepares it to be executed.
TODO: better explain what the engine actually does
For most uses, users will primarily use the [wasmer] crate directly, perhaps with one of our
provided ABIs such as [wasmer-wasi]. However for users that need finer grained control over
the behavior of wasmer, other crates such as [wasmer-compiler] and [wasmer-engine] may be used
to implement custom compilers and engines respectively.
[examples]: https://github.com/wasmerio/wasmer/tree/master/examples
[wasmer]: https://crates.io/crates/wasmer/1.0.0-alpha3
[wasmer-wasi]: https://crates.io/crates/wasmer-wasi/1.0.0-alpha3
[wasmer-emscripten]: https://crates.io/crates/wasmer-emscripten/1.0.0-alpha3
[wasmer-engine]: https://crates.io/crates/wasmer-engine/1.0.0-alpha3
[wasmer-compiler]: https://crates.io/crates/wasmer-compiler/1.0.0-alpha3
[wasmer.io]: https://wasmer.io
[wasmer-nightly]: https://github.com/wasmerio/wasmer-nightly/