From 747974f4ae9f9a9416134b20029688a1e090e27f Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 8 Feb 2010 08:16:56 +1300 Subject: [PATCH] vm: nuke unused (string>float) primitive --- basis/stack-checker/known-words/known-words.factor | 3 --- core/bootstrap/primitives.factor | 1 - vm/math.cpp | 14 -------------- vm/primitives.cpp | 1 - vm/primitives.hpp | 1 - vm/vm.hpp | 1 - 6 files changed, 21 deletions(-) diff --git a/basis/stack-checker/known-words/known-words.factor b/basis/stack-checker/known-words/known-words.factor index 4aecd1376e..4bf7dfe0fd 100644 --- a/basis/stack-checker/known-words/known-words.factor +++ b/basis/stack-checker/known-words/known-words.factor @@ -327,9 +327,6 @@ M: bad-executable summary \ bignum>float { bignum } { float } define-primitive \ bignum>float make-foldable -\ (string>float) { byte-array } { float } define-primitive -\ (string>float) make-foldable - \ (float>string) { float } { byte-array } define-primitive \ (float>string) make-foldable diff --git a/core/bootstrap/primitives.factor b/core/bootstrap/primitives.factor index 57035860d8..367dc4d942 100644 --- a/core/bootstrap/primitives.factor +++ b/core/bootstrap/primitives.factor @@ -463,7 +463,6 @@ tuple { "double>bits" "math" "primitive_double_bits" (( x -- n )) } { "float>bits" "math" "primitive_float_bits" (( x -- n )) } { "(float>string)" "math.parser.private" "primitive_float_to_str" (( n -- str )) } - { "(string>float)" "math.parser.private" "primitive_str_to_float" (( str -- n/f )) } { "bignum*" "math.private" "primitive_bignum_multiply" (( x y -- z )) } { "bignum+" "math.private" "primitive_bignum_add" (( x y -- z )) } { "bignum-" "math.private" "primitive_bignum_subtract" (( x y -- z )) } diff --git a/vm/math.cpp b/vm/math.cpp index 2ff6f28d2a..bb5d9c13c4 100755 --- a/vm/math.cpp +++ b/vm/math.cpp @@ -260,20 +260,6 @@ void factor_vm::primitive_bignum_to_float() ctx->replace(allot_float(bignum_to_float(ctx->peek()))); } -void factor_vm::primitive_str_to_float() -{ - byte_array *bytes = untag_check(ctx->peek()); - cell capacity = array_capacity(bytes); - - char *c_str = (char *)(bytes + 1); - char *end = c_str; - double f = strtod(c_str,&end); - if(end == c_str + capacity - 1) - ctx->replace(allot_float(f)); - else - ctx->replace(false_object); -} - void factor_vm::primitive_float_to_str() { byte_array *array = allot_byte_array(33); diff --git a/vm/primitives.cpp b/vm/primitives.cpp index 1eedab85b8..be9d5c6ff6 100644 --- a/vm/primitives.cpp +++ b/vm/primitives.cpp @@ -121,7 +121,6 @@ PRIMITIVE(set_string_nth_slow) PRIMITIVE(size) PRIMITIVE(sleep) PRIMITIVE(special_object) -PRIMITIVE(str_to_float) PRIMITIVE(string) PRIMITIVE(string_nth) PRIMITIVE(strip_stack_traces) diff --git a/vm/primitives.hpp b/vm/primitives.hpp index 049b44d389..520df423a1 100644 --- a/vm/primitives.hpp +++ b/vm/primitives.hpp @@ -117,7 +117,6 @@ DECLARE_PRIMITIVE(set_string_nth_slow) DECLARE_PRIMITIVE(size) DECLARE_PRIMITIVE(sleep) DECLARE_PRIMITIVE(special_object) -DECLARE_PRIMITIVE(str_to_float) DECLARE_PRIMITIVE(string) DECLARE_PRIMITIVE(string_nth) DECLARE_PRIMITIVE(strip_stack_traces) diff --git a/vm/vm.hpp b/vm/vm.hpp index 20a837a58a..714794aa32 100755 --- a/vm/vm.hpp +++ b/vm/vm.hpp @@ -441,7 +441,6 @@ struct factor_vm cell unbox_array_size_slow(); void primitive_fixnum_to_float(); void primitive_bignum_to_float(); - void primitive_str_to_float(); void primitive_float_to_str(); void primitive_float_eq(); void primitive_float_add();