Rename nstack to narena, change it and pstack to count bytes.

PiperOrigin-RevId: 561066311
Change-Id: I4d0e645e6c254dd906bfc42159e0e99149a7c6c8
This commit is contained in:
Saran Tunyasuvunakool
2023-08-29 10:12:46 -07:00
committed by Copybara-Service
parent b979a26b10
commit daa2ac7f8b
22 changed files with 162 additions and 117 deletions
+1 -1
View File
@@ -946,7 +946,7 @@ Euler integrator, semi-implicit in velocity.
mujoco.mjtDisableBit.mjDSBL_CONTACT)
def test_can_raise_error(self):
self.data.pstack = self.data.nstack
self.data.pstack = self.data.narena
with self.assertRaisesRegex(mujoco.FatalError,
r'\Amj_stackAllocByte: stack overflow'):
mujoco.mj_forward(self.model, self.data)
+1 -1
View File
@@ -1341,7 +1341,7 @@ PYBIND11_MODULE(_functions, pymodule) {
#ifdef ADDRESS_SANITIZER
ASAN_POISON_MEMORY_REGION(
static_cast<char*>(data->arena),
(data->nstack - data->pstack) * sizeof(mjtNum));
data->narena - data->pstack);
#endif
data->ncon = 0;
data->nefc = 0;
+1 -1
View File
@@ -88,7 +88,7 @@ struct MjDataMetadata {
is_dual(mj_isDual(m)) {
}
#define X(var) int var;
#define X(var) decltype(raw::MjModel::var) var;
MJMODEL_INTS
#undef X
#define X(type, var, n) std::shared_ptr<type[]> var;
+2 -2
View File
@@ -78,7 +78,7 @@ constexpr auto XArrayShapeImpl(const std::string_view dim1_str) {
}
inline std::size_t NConMax(const mjData* d) {
return d->nstack * sizeof(mjtNum) / sizeof(mjContact);
return d->narena / sizeof(mjContact);
}
} // namespace
@@ -459,7 +459,7 @@ MjModelWrapper MjModelWrapper::Deserialize(std::istream& input) {
throw py::value_error("Incompatible serialization version.");
}
int model_size = ReadInt(input);
std::size_t model_size = ReadInt(input);
CheckInput(input, "mjModel");
if (model_size < 0) {
throw py::value_error("Invalid serialized mjModel.");