|
2 | 2 |
|
3 | 3 | use crate::runtime::vm::VMGcRef; |
4 | 4 | use crate::store::StoreId; |
5 | | -use crate::vm::{VMArrayRef, VMGcHeader}; |
| 5 | +use crate::vm::{self, VMArrayRef, VMGcHeader}; |
6 | 6 | use crate::{AnyRef, FieldType}; |
7 | 7 | use crate::{ |
8 | 8 | ArrayType, AsContext, AsContextMut, EqRef, GcHeapOutOfMemory, GcRefImpl, GcRootIndex, HeapType, |
@@ -297,18 +297,9 @@ impl ArrayRef { |
297 | 297 | elem: &Val, |
298 | 298 | len: u32, |
299 | 299 | ) -> Result<Rooted<ArrayRef>> { |
300 | | - Self::_new(store.as_context_mut().0, allocator, elem, len) |
301 | | - } |
302 | | - |
303 | | - pub(crate) fn _new( |
304 | | - store: &mut StoreOpaque, |
305 | | - allocator: &ArrayRefPre, |
306 | | - elem: &Val, |
307 | | - len: u32, |
308 | | - ) -> Result<Rooted<ArrayRef>> { |
309 | | - store.retry_after_gc((), |store, ()| { |
310 | | - Self::new_from_iter(store, allocator, RepeatN(elem, len)) |
311 | | - }) |
| 300 | + let store = store.as_context_mut().0; |
| 301 | + assert!(!store.async_support()); |
| 302 | + vm::assert_ready(Self::_new_async(store, allocator, elem, len)) |
312 | 303 | } |
313 | 304 |
|
314 | 305 | /// Asynchronously allocate a new `array` of the given length, with every |
@@ -454,17 +445,9 @@ impl ArrayRef { |
454 | 445 | allocator: &ArrayRefPre, |
455 | 446 | elems: &[Val], |
456 | 447 | ) -> Result<Rooted<ArrayRef>> { |
457 | | - Self::_new_fixed(store.as_context_mut().0, allocator, elems) |
458 | | - } |
459 | | - |
460 | | - pub(crate) fn _new_fixed( |
461 | | - store: &mut StoreOpaque, |
462 | | - allocator: &ArrayRefPre, |
463 | | - elems: &[Val], |
464 | | - ) -> Result<Rooted<ArrayRef>> { |
465 | | - store.retry_after_gc((), |store, ()| { |
466 | | - Self::new_from_iter(store, allocator, elems.iter()) |
467 | | - }) |
| 448 | + let store = store.as_context_mut().0; |
| 449 | + assert!(!store.async_support()); |
| 450 | + vm::assert_ready(Self::_new_fixed_async(store, allocator, elems)) |
468 | 451 | } |
469 | 452 |
|
470 | 453 | /// Asynchronously allocate a new `array` containing the given elements. |
|
0 commit comments