Skip to content

Commit

Permalink
deploy: dc6f129
Browse files Browse the repository at this point in the history
  • Loading branch information
github-merge-queue[bot] committed Jul 15, 2024
1 parent c9f95c0 commit 87ce119
Show file tree
Hide file tree
Showing 16 changed files with 87 additions and 67 deletions.
10 changes: 6 additions & 4 deletions cairo_native/cache/aot/struct.AotProgramCache.html

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions cairo_native/cache/enum.ProgramCache.html

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions cairo_native/cache/jit/struct.JitProgramCache.html

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions cairo_native/executor/enum.NativeExecutor.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions cairo_native/executor/struct.AotNativeExecutor.html

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions cairo_native/executor/struct.JitNativeExecutor.html

Large diffs are not rendered by default.

14 changes: 8 additions & 6 deletions cairo_native_stress/struct.NaiveAotCache.html

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions search-index.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions src/cairo_native/cache/aot.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,15 +118,15 @@
collections::HashMap,
fmt::{<span class="self">self</span>, Debug},
hash::Hash,
rc::Rc,
sync::Arc,
};

<span class="kw">pub struct </span>AotProgramCache&lt;<span class="lifetime">'a</span>, K&gt;
<span class="kw">where
</span>K: PartialEq + Eq + Hash,
{
context: <span class="kw-2">&amp;</span><span class="lifetime">'a </span>NativeContext,
cache: HashMap&lt;K, Rc&lt;AotNativeExecutor&gt;&gt;,
cache: HashMap&lt;K, Arc&lt;AotNativeExecutor&gt;&gt;,
}

<span class="kw">impl</span>&lt;<span class="lifetime">'a</span>, K&gt; AotProgramCache&lt;<span class="lifetime">'a</span>, K&gt;
Expand All @@ -140,7 +140,7 @@
}
}

<span class="kw">pub fn </span>get(<span class="kw-2">&amp;</span><span class="self">self</span>, key: <span class="kw-2">&amp;</span>K) -&gt; <span class="prelude-ty">Option</span>&lt;Rc&lt;AotNativeExecutor&gt;&gt; {
<span class="kw">pub fn </span>get(<span class="kw-2">&amp;</span><span class="self">self</span>, key: <span class="kw-2">&amp;</span>K) -&gt; <span class="prelude-ty">Option</span>&lt;Arc&lt;AotNativeExecutor&gt;&gt; {
<span class="self">self</span>.cache.get(key).cloned()
}

Expand All @@ -149,7 +149,7 @@
key: K,
program: <span class="kw-2">&amp;</span>Program,
opt_level: OptLevel,
) -&gt; Rc&lt;AotNativeExecutor&gt; {
) -&gt; Arc&lt;AotNativeExecutor&gt; {
<span class="kw">let </span>NativeModule {
module,
registry,
Expand All @@ -175,7 +175,7 @@
metadata.get::&lt;GasMetadata&gt;().cloned().unwrap(),
);

<span class="kw">let </span>executor = Rc::new(executor);
<span class="kw">let </span>executor = Arc::new(executor);
<span class="self">self</span>.cache.insert(key, executor.clone());

executor
Expand Down
10 changes: 5 additions & 5 deletions src/cairo_native/cache/jit.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
collections::HashMap,
fmt::{<span class="self">self</span>, Debug},
hash::Hash,
rc::Rc,
sync::Arc,
};

<span class="doccomment">/// A Cache for programs with the same context.
Expand All @@ -126,7 +126,7 @@
<span class="comment">// Since we already hold a reference to the Context, it doesn't make sense to use thread-safe
// reference counting. Using a Arc&lt;RwLock&lt;T&gt;&gt; here is useless because NativeExecutor is neither
// Send nor Sync.
</span>cache: HashMap&lt;K, Rc&lt;JitNativeExecutor&lt;<span class="lifetime">'a</span>&gt;&gt;&gt;,
</span>cache: HashMap&lt;K, Arc&lt;JitNativeExecutor&lt;<span class="lifetime">'a</span>&gt;&gt;&gt;,
}

<span class="kw">impl</span>&lt;<span class="lifetime">'a</span>, K&gt; JitProgramCache&lt;<span class="lifetime">'a</span>, K&gt;
Expand All @@ -145,7 +145,7 @@
<span class="self">self</span>.context
}

<span class="kw">pub fn </span>get(<span class="kw-2">&amp;</span><span class="self">self</span>, key: <span class="kw-2">&amp;</span>K) -&gt; <span class="prelude-ty">Option</span>&lt;Rc&lt;JitNativeExecutor&lt;<span class="lifetime">'a</span>&gt;&gt;&gt; {
<span class="kw">pub fn </span>get(<span class="kw-2">&amp;</span><span class="self">self</span>, key: <span class="kw-2">&amp;</span>K) -&gt; <span class="prelude-ty">Option</span>&lt;Arc&lt;JitNativeExecutor&lt;<span class="lifetime">'a</span>&gt;&gt;&gt; {
<span class="self">self</span>.cache.get(key).cloned()
}

Expand All @@ -154,11 +154,11 @@
key: K,
program: <span class="kw-2">&amp;</span>Program,
opt_level: OptLevel,
) -&gt; Rc&lt;JitNativeExecutor&lt;<span class="lifetime">'a</span>&gt;&gt; {
) -&gt; Arc&lt;JitNativeExecutor&lt;<span class="lifetime">'a</span>&gt;&gt; {
<span class="kw">let </span>module = <span class="self">self</span>.context.compile(program, <span class="prelude-val">None</span>).expect(<span class="string">"should compile"</span>);
<span class="kw">let </span>executor = JitNativeExecutor::from_native_module(module, opt_level);

<span class="kw">let </span>executor = Rc::new(executor);
<span class="kw">let </span>executor = Arc::new(executor);
<span class="self">self</span>.cache.insert(key, executor.clone());

executor
Expand Down
10 changes: 5 additions & 5 deletions src/cairo_native/executor.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -1273,7 +1273,7 @@
alloc::Layout,
arch::global_asm,
ptr::{addr_of_mut, null_mut, NonNull},
rc::Rc,
sync::Arc,
};

<span class="kw">mod </span>aot;
Expand Down Expand Up @@ -1301,8 +1301,8 @@
<span class="doccomment">/// The cairo native executor, either AOT or JIT based.
</span><span class="attr">#[derive(Debug, Clone)]
</span><span class="kw">pub enum </span>NativeExecutor&lt;<span class="lifetime">'m</span>&gt; {
Aot(Rc&lt;AotNativeExecutor&gt;),
Jit(Rc&lt;JitNativeExecutor&lt;<span class="lifetime">'m</span>&gt;&gt;),
Aot(Arc&lt;AotNativeExecutor&gt;),
Jit(Arc&lt;JitNativeExecutor&lt;<span class="lifetime">'m</span>&gt;&gt;),
}

<span class="kw">impl</span>&lt;<span class="lifetime">'a</span>&gt; NativeExecutor&lt;<span class="lifetime">'a</span>&gt; {
Expand Down Expand Up @@ -1368,13 +1368,13 @@

<span class="kw">impl</span>&lt;<span class="lifetime">'m</span>&gt; From&lt;AotNativeExecutor&gt; <span class="kw">for </span>NativeExecutor&lt;<span class="lifetime">'m</span>&gt; {
<span class="kw">fn </span>from(value: AotNativeExecutor) -&gt; <span class="self">Self </span>{
<span class="self">Self</span>::Aot(Rc::new(value))
<span class="self">Self</span>::Aot(Arc::new(value))
}
}

<span class="kw">impl</span>&lt;<span class="lifetime">'m</span>&gt; From&lt;JitNativeExecutor&lt;<span class="lifetime">'m</span>&gt;&gt; <span class="kw">for </span>NativeExecutor&lt;<span class="lifetime">'m</span>&gt; {
<span class="kw">fn </span>from(value: JitNativeExecutor&lt;<span class="lifetime">'m</span>&gt;) -&gt; <span class="self">Self </span>{
<span class="self">Self</span>::Jit(Rc::new(value))
<span class="self">Self</span>::Jit(Arc::new(value))
}
}

Expand Down
6 changes: 6 additions & 0 deletions src/cairo_native/executor/aot.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@
<a href="#286" id="286">286</a>
<a href="#287" id="287">287</a>
<a href="#288" id="288">288</a>
<a href="#289" id="289">289</a>
<a href="#290" id="290">290</a>
<a href="#291" id="291">291</a>
</pre></div><pre class="rust"><code><span class="kw">use crate</span>::{
error::Error,
execution_result::{ContractExecutionResult, ExecutionResult},
Expand Down Expand Up @@ -319,6 +322,9 @@
gas_metadata: GasMetadata,
}

<span class="kw">unsafe impl </span>Send <span class="kw">for </span>AotNativeExecutor {}
<span class="kw">unsafe impl </span>Sync <span class="kw">for </span>AotNativeExecutor {}

<span class="kw">impl </span>AotNativeExecutor {
<span class="kw">pub fn </span>new(
library: Library,
Expand Down
6 changes: 6 additions & 0 deletions src/cairo_native/executor/jit.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@
<a href="#154" id="154">154</a>
<a href="#155" id="155">155</a>
<a href="#156" id="156">156</a>
<a href="#157" id="157">157</a>
<a href="#158" id="158">158</a>
<a href="#159" id="159">159</a>
</pre></div><pre class="rust"><code><span class="kw">use crate</span>::{
error::Error,
execution_result::{ContractExecutionResult, ExecutionResult},
Expand Down Expand Up @@ -184,6 +187,9 @@
gas_metadata: GasMetadata,
}

<span class="kw">unsafe impl</span>&lt;<span class="lifetime">'a</span>&gt; Send <span class="kw">for </span>JitNativeExecutor&lt;<span class="lifetime">'a</span>&gt; {}
<span class="kw">unsafe impl</span>&lt;<span class="lifetime">'a</span>&gt; Sync <span class="kw">for </span>JitNativeExecutor&lt;<span class="lifetime">'a</span>&gt; {}

<span class="kw">impl </span>std::fmt::Debug <span class="kw">for </span>JitNativeExecutor&lt;<span class="lifetime">'_</span>&gt; {
<span class="kw">fn </span>fmt(<span class="kw-2">&amp;</span><span class="self">self</span>, f: <span class="kw-2">&amp;mut </span>std::fmt::Formatter&lt;<span class="lifetime">'_</span>&gt;) -&gt; std::fmt::Result {
f.debug_struct(<span class="string">"JitNativeExecutor"</span>)
Expand Down
26 changes: 13 additions & 13 deletions src/cairo_native_stress/main.rs.html
Original file line number Diff line number Diff line change
Expand Up @@ -376,15 +376,7 @@
//!
//! For documentation on the specific cache used, see `NaiveAotCache`.

</span><span class="kw">use </span>std::alloc::System;
<span class="kw">use </span>std::fmt::{Debug, Display};
<span class="kw">use </span>std::fs::{create_dir_all, read_dir, OpenOptions};
<span class="kw">use </span>std::hash::Hash;
<span class="kw">use </span>std::io;
<span class="kw">use </span>std::path::{Path, PathBuf};
<span class="kw">use </span>std::{collections::HashMap, fs, rc::Rc, time::Instant};

<span class="kw">use </span>cairo_lang_sierra::ids::FunctionId;
</span><span class="kw">use </span>cairo_lang_sierra::ids::FunctionId;
<span class="kw">use </span>cairo_lang_sierra::program::{GenericArg, Program};
<span class="kw">use </span>cairo_lang_sierra::program_registry::ProgramRegistry;
<span class="kw">use </span>cairo_lang_starknet::compile::compile_path;
Expand All @@ -399,6 +391,14 @@
<span class="kw">use </span>libloading::Library;
<span class="kw">use </span>num_bigint::BigInt;
<span class="kw">use </span>stats_alloc::{Region, StatsAlloc, INSTRUMENTED_SYSTEM};
<span class="kw">use </span>std::alloc::System;
<span class="kw">use </span>std::fmt::{Debug, Display};
<span class="kw">use </span>std::fs::{create_dir_all, read_dir, OpenOptions};
<span class="kw">use </span>std::hash::Hash;
<span class="kw">use </span>std::io;
<span class="kw">use </span>std::path::{Path, PathBuf};
<span class="kw">use </span>std::sync::Arc;
<span class="kw">use </span>std::{collections::HashMap, fs, time::Instant};
<span class="kw">use </span>tracing::{debug, info, info_span, warn};
<span class="kw">use </span>tracing_subscriber::layer::SubscriberExt;
<span class="kw">use </span>tracing_subscriber::util::SubscriberInitExt;
Expand Down Expand Up @@ -609,7 +609,7 @@
</span>K: PartialEq + Eq + Hash + Display,
{
context: <span class="kw-2">&amp;</span><span class="lifetime">'a </span>NativeContext,
cache: HashMap&lt;K, Rc&lt;AotNativeExecutor&gt;&gt;,
cache: HashMap&lt;K, Arc&lt;AotNativeExecutor&gt;&gt;,
}

<span class="kw">impl</span>&lt;<span class="lifetime">'a</span>, K&gt; NaiveAotCache&lt;<span class="lifetime">'a</span>, K&gt;
Expand All @@ -623,7 +623,7 @@
}
}

<span class="kw">pub fn </span>get(<span class="kw-2">&amp;</span><span class="self">self</span>, key: <span class="kw-2">&amp;</span>K) -&gt; <span class="prelude-ty">Option</span>&lt;Rc&lt;AotNativeExecutor&gt;&gt; {
<span class="kw">pub fn </span>get(<span class="kw-2">&amp;</span><span class="self">self</span>, key: <span class="kw-2">&amp;</span>K) -&gt; <span class="prelude-ty">Option</span>&lt;Arc&lt;AotNativeExecutor&gt;&gt; {
<span class="self">self</span>.cache.get(key).cloned()
}

Expand All @@ -635,7 +635,7 @@
key: K,
program: <span class="kw-2">&amp;</span>Program,
opt_level: OptLevel,
) -&gt; Rc&lt;AotNativeExecutor&gt; {
) -&gt; Arc&lt;AotNativeExecutor&gt; {
<span class="kw">let </span>native_module = <span class="self">self
</span>.context
.compile(program, <span class="prelude-val">None</span>)
Expand Down Expand Up @@ -666,7 +666,7 @@
};

<span class="kw">let </span>executor = AotNativeExecutor::new(shared_library, registry, metadata);
<span class="kw">let </span>executor = Rc::new(executor);
<span class="kw">let </span>executor = Arc::new(executor);

<span class="self">self</span>.cache.insert(key, executor.clone());

Expand Down
4 changes: 2 additions & 2 deletions trait.impl/core/marker/trait.Send.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions trait.impl/core/marker/trait.Sync.js

Large diffs are not rendered by default.

0 comments on commit 87ce119

Please sign in to comment.