From 877e3a12e19fb77e35e9370784015d291c94a093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Lindqvist?= Date: Thu, 29 May 2014 19:22:43 +0200 Subject: [PATCH] VM: allot_array_1, allot_array_2 are unused and primitive_array should use allot_array --- vm/arrays.cpp | 23 ++--------------------- vm/vm.hpp | 2 -- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/vm/arrays.cpp b/vm/arrays.cpp index 45c5196158..9e97221d81 100644 --- a/vm/arrays.cpp +++ b/vm/arrays.cpp @@ -12,31 +12,12 @@ array* factor_vm::allot_array(cell capacity, cell fill_) { /* Allocates memory */ void factor_vm::primitive_array() { - data_root fill(ctx->pop(), this); + cell fill = ctx->pop(); cell capacity = unbox_array_size(); - array* new_array = allot_uninitialized_array(capacity); - memset_cell(new_array->data(), fill.value(), capacity * sizeof(cell)); + array* new_array = allot_array(capacity, fill); ctx->push(tag(new_array)); } -/* Allocates memory */ -cell factor_vm::allot_array_1(cell obj_) { - data_root obj(obj_, this); - data_root a(allot_uninitialized_array(1), this); - set_array_nth(a.untagged(), 0, obj.value()); - return a.value(); -} - -/* Allocates memory */ -cell factor_vm::allot_array_2(cell v1_, cell v2_) { - data_root v1(v1_, this); - data_root v2(v2_, this); - data_root a(allot_uninitialized_array(2), this); - set_array_nth(a.untagged(), 0, v1.value()); - set_array_nth(a.untagged(), 1, v2.value()); - return a.value(); -} - /* Allocates memory */ cell factor_vm::allot_array_4(cell v1_, cell v2_, cell v3_, cell v4_) { data_root v1(v1_, this); diff --git a/vm/vm.hpp b/vm/vm.hpp index 49d0eefc4e..73241a2c94 100644 --- a/vm/vm.hpp +++ b/vm/vm.hpp @@ -429,8 +429,6 @@ struct factor_vm { inline void set_array_nth(array* array, cell slot, cell value); array* allot_array(cell capacity, cell fill_); void primitive_array(); - cell allot_array_1(cell obj_); - cell allot_array_2(cell v1_, cell v2_); cell allot_array_4(cell v1_, cell v2_, cell v3_, cell v4_); void primitive_resize_array(); cell std_vector_to_array(std::vector& elements);