r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3]

BrianH
6-May-2010
[2829]
Came up with a proposal for the binary conversions - take a look: 
http://www.rebol.net/cgi-bin/r3blog.r?view=0317#comments
Graham
6-May-2010
[2830]
Let me guess .. none of the network protocols have been added ...
BrianH
6-May-2010
[2831x2]
Almost none of the mezzanine fixes either - this was a release with 
native focus.
And by that I mean the *already posted* mezzanine fixes.
Pekr
6-May-2010
[2833]
yes, Hostkit is a priority right now, absolutly. Other fixes might 
wait. I even think, that we should "finish" the low-level route .... 
hence add Extension support for devices, add tasking, a utypes ... 
then we can state the Core is almost finished for beta ...
BrianH
6-May-2010
[2834]
Already posted a fix to the new HELP bug #1604.
Graham
6-May-2010
[2835x2]
If we can build our own cores .. I guess we can add our own protocols
or not ..
BrianH
6-May-2010
[2837]
Did you submit your changes to DevBase? I'm verifying the submissions 
there now - it looks like *some* of the mezzanine fixes were included 
in a98.
Graham
6-May-2010
[2838x2]
We should do a poll of what OS everyone is using.  Seems to me odd 
to release two OSX builds and no Linux
Aggh... no polls here.  I was thinking of IOS
BrianH
6-May-2010
[2840]
Is it odd, or just nighttime? Let Carl sleep - it's almost 2am there. 
We'll see if they are still not built tomorrow.
Graham
6-May-2010
[2841x2]
even then
only 9 pm here ...
Pekr
6-May-2010
[2843]
Graham - it is all because Apple is being popular in US ....
Graham
6-May-2010
[2844x3]
Nah ... It's because Carl uses an apple as his primary pc ...
Has anyone done this?


If your embedded module consists entirely of REBOL code (no native 
commands), it's not required that you embed it in the way described 
here. Instead, you can add it to the host bundled source code which 
initialized in the host in the line:

Reb_Do_Binary(Reb_Init_Code, REB_INIT_SIZE, 0, 0);

More on this is described in the host-kit documentation.
which is in http://www.rebol.com/r3/docs/concepts/extensions-embedded.html
but the host-kit page references this document  ...
BrianH
6-May-2010
[2847]
That's for the new host kit, which isn't out yet.
Pekr
6-May-2010
[2848x2]
It is nice we have embedded Extensions. That way we can "internalise" 
external components, and kind of pack-it-in into one exe, as Encap 
did, no?
Will we get delayed init, or was it just a proposal?
BrianH
6-May-2010
[2850]
Carl says we have it, but it's currently handled by native code and 
doesn't affect the LOAD mezzanine code yet.
Steeve
6-May-2010
[2851]
Weird....

>> dp [loop 10000 [change #{00} [2]]]
== make object! [
    timer: 0:00:00.003776
    evals: 30011
    eval-natives: 10004
    eval-functions: 1
    series-made: 1
    series-freed: 0
    series-expanded: 0
    series-bytes: 432
    series-recycled: 0
    made-blocks: 1
    made-objects: 0
    recycles: 0
]

>> dp [loop 10000 [change #{00} 2]]
== make object! [
    timer: 0:00:00.00457
    evals: 30011
    eval-natives: 10004
    eval-functions: 1
    series-made: 10001
    series-freed: 0
    series-expanded: 0
    series-bytes: 40432
    series-recycled: 0
    made-blocks: 1
    made-objects: 0
    recycles: 0
]

(same using 'append, for A98 only)
BrianH
7-May-2010
[2852x2]
The baseline:
>> dp []
== make object! [
    timer: 0:00:00.000011
    evals: 8
    eval-natives: 3
    eval-functions: 1
    series-made: 1
    series-freed: 0
    series-expanded: 0
    series-bytes: 432
    series-recycled: 0
    made-blocks: 1
    made-objects: 0
    recycles: 0
]

Example code:
>> dp [change #{00} #{02}]
== make object! [
    timer: 0:00:00.00001
    evals: 11
    eval-natives: 4
    eval-functions: 1
    series-made: 1
    series-freed: 0
    series-expanded: 0
    series-bytes: 432
    series-recycled: 0
    made-blocks: 1
    made-objects: 0
    recycles: 0
]
>> dp [change #{00} 2]
== make object! [
    timer: 0:00:00.00001
    evals: 11
    eval-natives: 4
    eval-functions: 1
    series-made: 2
    series-freed: 0
    series-expanded: 0
    series-bytes: 436
    series-recycled: 0
    made-blocks: 1
    made-objects: 0
    recycles: 0
]
>> dp [change #{00} [2]]
== make object! [
    timer: 0:00:00.000009
    evals: 11
    eval-natives: 4
    eval-functions: 1
    series-made: 1
    series-freed: 0
    series-expanded: 0
    series-bytes: 432
    series-recycled: 0
    made-blocks: 1
    made-objects: 0
    recycles: 0
]


Clearly APPEND, INSERT and CHANGE convert regular values to binary! 
first now (creating a series), then do their inserts. And they don't 
convert first if you use the new block mode. Good to know :)
Sorry, I could have been less verbose with that.
Steeve
7-May-2010
[2854x2]
Seems more obfuscated than a simple binary conversion...

>> abs -432 + get in dp [to binary! 2] 'series-bytes
== 10
>> abs -432 + get in dp [change #{00} 2] 'series-bytes
== 4
>> abs -432 + get in dp [make binary! 3] 'series-bytes
== 4
(abs... wtf)
BrianH
7-May-2010
[2856]
They have to convert to binary anyways before they can insert it. 
I think that the real bug is that CHANGE binary! block! is *not reporting 
the series it has to create internally*, while CHANGE binary! value! 
*is*. It seems to be a bug in reporting the stats, not a bug in the 
behavior.
Pekr
7-May-2010
[2857]
hmm, what a bug ... type 'help two times, and R3 goes under :-)
BrianH
7-May-2010
[2858]
That's #1603. R3 doesn't go under, but the console output stops before 
it's done.
Pekr
7-May-2010
[2859x2]
no, it crashes, why don't you try it yourself? ;-)
I get r3-a98.exe stopped to work dialog box ... and am offered either 
the debug or program termination ...
Steeve
7-May-2010
[2861x3]
what are you saying BrianH ? we don't need to do a conversion to 
add a 8-bit integer at first.

>> x: #{00}
== #{00}

>> x/1: 2 x
== #{02}

or 
pick x 1 2

I just think that 'change block uses that neater way in a loop
(you can see with dp, that there is no binary conversion)
(not pick, but poke)
BrianH
7-May-2010
[2864x2]
I did try it myself; I was the one who reported #1603. I've used 
a98 for many hours now with no crashes. What platform are you running 
on, on which OS?
Steeve, for a native operation the only way that the stats can be 
recorded is if the native reports them; it's not like with REBOL 
code. So if DP doesn't report something, it's either because it didn't 
happen or because the code didn't say it happened. I wouldn't be 
surprised if the allocator has stats collection hooks, but who knows 
how CHANGE binary! block! is allocating its stuff. But it would *have* 
to do a binary conversion in order to insert a non-binary value, 
so there is no question that there is some kind of binary conversion 
going on.
Pekr
7-May-2010
[2866]
BrianH: Windows Vista, 32 bit ...
Steeve
7-May-2010
[2867]
I just proved that you can do it whithout the need to create an intermediate 
binary serie, are you tired ?
Pekr
7-May-2010
[2868]
I really just start it, type help, get a bit wrong output, then I 
type help again, press enter,and R3 goes under ...
Steeve
7-May-2010
[2869]
do you want I write the code in clear  ?
Pekr
7-May-2010
[2870]
A99 almost ready (reported by Carl on R3 Chat)
BrianH
7-May-2010
[2871]
PICK and POKE may also do their own conversions using their own buffer 
(it's just a byte). Apparently since CHANGE binary! value has to 
support full TO binary! support, the easiest way would be to actually 
call TO binary!, which would allocate something. Since CHANGE binary! 
block! doesn't need to support full TO binary! support, maybe it 
has its own internal conversion routines that don't call TO binary!, 
and thus don't *report* any temporary series it creates.
Steeve
7-May-2010
[2872]
poke #{00} 1 2 --> no binary conversion of 2 here, I can bet my life 
on that line :)
BrianH
7-May-2010
[2873x3]
Pekr, I have not had a single crash on Win7 x64 with a98. So it may 
either be a Vista thing or a 32bit thing. Either way, don't be surprised 
if the problem goes away with the fix to #1603. Still, report the 
behavior you have seen in a comment there.
Steeve, POKE converts to a binary value, but not a *newly allocated* 
binary value. Instead, it converts directly into place or it converts 
to a buffer (likely a stack-local byte variable or a register) and 
is then put into place. But is *has* to convert to binary, because 
that is what the result is. For CHANGE, APPEND and INSERT, you can't 
use a fixed buffer because you have to be able to support general 
conversions, so you have to allocate a temporary. However, when inserting 
a block you *don't* have to support general conversions, just a few 
specific conversions, so it might in some cases (like integers) be 
able to use the POKE method, or some other preallocated buffer. But 
in some cases, it does allocate a new buffer for the conversion:

>> select dp [change #{00} ["a"]] 'series-made
== 1  ; uses an internal buffer
>> select dp [change #{00} ["abcdefghijklmnop"]] 'series-made
== 2  ; allocates a new buffer
The baseline being:
>> select dp [] 'series-made
== 1
Steeve
7-May-2010
[2876x3]
maybe for string to binary conversion a buffer is requested but i 
can bet that it's not neccessary for integers. It can be poked in 
place.

It's like I would do in asm or in C. casting of the 64 bits integer 
into a char (take the low byte) and poke it inside the binary serie, 
that's all I have to do.
that's why i think CHANGE #{00} 2, should not have to allocate a 
new buffer
but it's just optimization :)