Skip to content

Commit 7a4eb8a

Browse files
committed
Move other Base members to rust
1 parent 638117e commit 7a4eb8a

File tree

2 files changed

+52
-26
lines changed

2 files changed

+52
-26
lines changed

claripy/ast/base.py

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -100,29 +100,7 @@ class Base(clarirs.Base, metaclass=type):
100100
:ivar args: The arguments that are being used
101101
"""
102102

103-
__slots__ = [
104-
# "op",
105-
# "args",
106-
# "variables",
107-
# "symbolic",
108-
"_hash",
109-
"_simplified",
110-
"_cached_encoded_name",
111-
"_cache_key",
112-
"_errored",
113-
"_eager_backends",
114-
# "length",
115-
"_excavated",
116-
"_burrowed",
117-
"_uninitialized",
118-
"_uc_alloc_depth",
119-
# "annotations",
120-
"simplifiable",
121-
"_uneliminatable_annotations",
122-
"_relocatable_annotations",
123-
"depth",
124-
"__weakref__",
125-
]
103+
__slots__ = ()
126104
_hash_cache = weakref.WeakValueDictionary()
127105
_leaf_cache = weakref.WeakValueDictionary()
128106

src/lib.rs

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
use std::collections::HashSet;
2-
31
use pyo3::{prelude::*, types::PyTuple};
42

5-
#[pyclass(subclass)]
3+
#[pyclass(subclass, weakref)]
64
struct Base {
5+
// Hashcons
76
#[pyo3(get, set)]
87
op: String,
98
#[pyo3(get, set)]
@@ -16,13 +15,46 @@ struct Base {
1615
symbolic: bool,
1716
#[pyo3(get, set)]
1817
annotations: Py<PyTuple>,
18+
19+
// Not Hashcons
20+
#[pyo3(get, set)]
21+
simplifiable: Option<PyObject>,
22+
#[pyo3(get, set)]
23+
depth: Option<PyObject>,
24+
25+
#[pyo3(get, set)]
26+
_hash: Option<PyObject>,
27+
#[pyo3(get, set)]
28+
_simplified: Option<PyObject>,
29+
#[pyo3(get, set)]
30+
_cache_key: Option<PyObject>,
31+
#[pyo3(get, set)]
32+
_cached_encoded_name: Option<PyObject>,
33+
#[pyo3(get, set)]
34+
_errored: Option<PyObject>,
35+
#[pyo3(get, set)]
36+
_eager_backends: Option<PyObject>,
37+
#[pyo3(get, set)]
38+
_excavated: Option<PyObject>,
39+
#[pyo3(get, set)]
40+
_burrowed: Option<PyObject>,
41+
#[pyo3(get, set)]
42+
_uninitialized: Option<PyObject>,
43+
#[pyo3(get, set)]
44+
_uc_alloc_depth: Option<PyObject>,
45+
#[pyo3(get, set)]
46+
_uneliminatable_annotations: Option<PyObject>,
47+
#[pyo3(get, set)]
48+
_relocatable_annotations: Option<PyObject>,
49+
1950
}
2051

2152
#[pymethods]
2253
impl Base {
2354
#[new]
2455
#[pyo3(signature = (op, args, length, variables, symbolic, annotations))]
2556
fn new(
57+
py: Python,
2658
op: String,
2759
args: Py<PyTuple>,
2860
length: PyObject,
@@ -37,6 +69,22 @@ impl Base {
3769
variables,
3870
symbolic,
3971
annotations,
72+
73+
simplifiable: None,
74+
depth: None,
75+
76+
_hash: None,
77+
_simplified: None,
78+
_cache_key: None,
79+
_cached_encoded_name: None,
80+
_errored: None,
81+
_eager_backends: None,
82+
_excavated: None,
83+
_burrowed: None,
84+
_uninitialized: None,
85+
_uc_alloc_depth: None,
86+
_uneliminatable_annotations: None,
87+
_relocatable_annotations: None,
4088
})
4189
}
4290
}

0 commit comments

Comments
 (0)