[Factor-talk] TYPED: Declarations

2016-11-24 Thread Alexander Ilin
Hello! In the docs of the `declare` word it says: The optimizer cannot do anything with the below code: `2 + 10 *` However, if we declare that the top of the stack is a float, then type checks and generic dispatch are eliminated, and the compiler can use unsafe intrinsics: `{ float } declare

Re: [Factor-talk] TYPED: Declarations

2016-11-24 Thread John Benediktsson
You can learn a lot by using ``optimized.`` from ``compiler.tree.debugger``. You can see it does convert the literal ``2`` to a float and then use ``float+``: IN: scratchpad [ { float } declare 2 + 10 * ] optimized. [ 2.0 float+ 10.0 float* ] You can also look at the "typed" variation:

Re: [Factor-talk] Out Of Memory

2016-11-24 Thread Jon Harper
Hi, more precisely, the process is aborted (uses the vm 'fatal_error()' function): $ ./factor -run=listener Factor 0.98 x86.64 (1781, heads/master-d4528c36da, Tue Aug 16 17:00:11 2016) [Clang (GCC 4.2.1 Compatible Ubuntu Clang 3.4 (tags/RELEASE_34/final))] on linux IN: scratchpad 50 2^ 0

Re: [Factor-talk] Out Of Memory

2016-11-24 Thread Alexander Ilin
Hello! Unfortunately, I can't reproduce this in Win8.1 GUI listener: IN: scratchpad 50 2^ 0 Cannot convert to fixnum: 1125899906842624 IN: scratchpad 25 2^ 0 (success) IN: scratchpad 26 2^ 0 Invalid array size: 67108864Maximum: 6710886324.11.2016, 17:06, "Jon Harper"

Re: [Factor-talk] GC - No Bug (Was: Out Of Memory)

2016-11-24 Thread Alexander Ilin
Hello again! Thank you for the replies. I can't reproduce the issue anymore, which is great news! Repeatedly calling `5 [ 25 2^ 0 ] times clear gc` does not crash Factor, even if I do it `30 [ ... ] times`. I love it when these things work, 'cause I hate debugging GCs. 24.11.2016, 19:54, "Jon

[Factor-talk] Parsing Ratios

2016-11-24 Thread Alexander Ilin
Hello! Ideas of some custom parsing words still intrigues me. Could someone tell me where is the code that parses ratios? ---=--- Александр -- ___ Factor-talk

Re: [Factor-talk] GC Bug? (Was: Out Of Memory)

2016-11-24 Thread Alexander Ilin
Hello! OK, opening the console I also see the message "fatal_error: Out of memory in VirtualAlloc". I did it this way: `6 [ 25 2^ 0 ] times` Now I have some further questions. When I do `5 [ 25 2^ 0 ] times` I see the factor.com process eating up ~930 Mb of memory. Why is it that after

Re: [Factor-talk] GC Bug? (Was: Out Of Memory)

2016-11-24 Thread Jon Harper
Found the discussion about 32bit array : https://github.com/factor/factor/issues/1566 Also what's happening in your case is that the heap size grows when the arrays are allocated. If you gc, you will get rid of the arrays, but the heap doesn't shrink. So you can reallocate more arrays, but the

Re: [Factor-talk] Out Of Memory

2016-11-24 Thread Jon Harper
That's because you are running a 32 bit factor. Try allocating many arrays, at some point your OS should return an error to factor at https://github.com/factor/factor/blob/master/vm/os-windows.cpp#L97 Also what you are seeing is expected, the array size is limited to most-positive-fixnum/2, which

Re: [Factor-talk] Parsing Ratios

2016-11-24 Thread Jon Harper
Hi, the code for parsing ratios is in https://github.com/factor/ factor/blob/master/core/math/parser/parser.factor It's called by string>number (or base>) see ->numerator ->denominator ?make-ratio ?add-ratio Cheers, Jon On Thu, Nov 24, 2016 at 6:38 PM, Alexander Ilin wrote: