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

World: r3wp

[rebcode] Rebcode discussion

BrianH
6-Nov-2005
[1206x3]
An optimizer does just the opposite: It converts the literal offset 
to a kind of virtual label statement (the difference being that the 
virtual one takes no space in the code); then after code insertions 
or deletes have happened, it changes the offsets to their new values, 
just like rerunning the fixup phase of the assembler. Of course optimizations 
like this can get a little more complicated when you have branch 
targets calculated at runtime - this was probably why they added 
BRAB and removed BRAW in the recent release, replacing general branch 
calculations with a simple lookup table.
As for whether the relative offsets are more efficient than absolute, 
that is only true of actual machine code, and then maybe only on 
older processors without an instruction cache. What we are calling 
an absolute offset here isn't a memory address like it is in machine 
code, it is really just an offset relative to the beginning of the 
code block, rather than the location of the branch statement. I think 
that the reason Carl chose offsets relative to the location of the 
branch statement is that he decided to only implement one branch 
method in the VM, and this method is more friendly to generated code 
(or maybe that was just luck).
Offsets relative to a fixed location are the (currently theoretical) 
"special case" of the BRAB statement. See RAMBO 3953 for details.
Gabriele
8-Nov-2005
[1209x2]
that case is no more theoretical, see new build. however, i don't 
think it has been tested much so far.
so, the first argument of brab can now be either a literal block 
(with labels or integers), or a label. the second arg can only be 
a word referring to an integer.
Rebolek
8-Nov-2005
[1211]
Is there some changelog for 1.3.52 ?
Pekr
8-Nov-2005
[1212]
yes, source, diff :-)
BrianH
8-Nov-2005
[1213]
The great rename is here! Woohoo!
Rebolek
8-Nov-2005
[1214x2]
ah, the dots
so it's good to cheat in surveys...
BrianH
8-Nov-2005
[1216]
I didn't cheat.
Rebolek
8-Nov-2005
[1217]
I don't know who did, but opinions here were different from the survey
BrianH
8-Nov-2005
[1218]
The dots were one of my favorite choices.
Rebolek
8-Nov-2005
[1219]
OK I know it's a dialect, not REBOL, but there is not a single word 
in REBOL that uses dot. Decimals and tupples use them, but not words.
BrianH
8-Nov-2005
[1220x2]
You can use dots in words.
Most don't.
Rebolek
8-Nov-2005
[1222]
I can live with dots but I don't like it, looks really un-REBOLish
BrianH
8-Nov-2005
[1223x3]
Quick to type though, at least compared to - on my keyboard.
So, why hasn't the syntax signiature of brab changed to match the 
new behavior? In theory, we can now specify a literal integer at 
the first position, as that is what the label fixup changes brab 
to in the special case. The syntax check doesn't allow it though, 
because it still looks for word! or block! only.
; BRAB should be like this
brab: ["Branch block table" block! | word! | integer! word!]
Rebolek
8-Nov-2005
[1226]
Hm this is not directly related to ".",  but now I realize I've got 
some 1000 lines of rebcode to rewrite :)
BrianH
8-Nov-2005
[1227]
Search and replace :)
Rebolek
8-Nov-2005
[1228]
:)
Pekr
8-Nov-2005
[1229x2]
Brian - it was not about "qick to type" ;-) If so, we should replace 
path char with dots too ...
I agree with Kru that once again probably the poll was only informative 
and the voice of most - ignored ...
BrianH
8-Nov-2005
[1231x4]
Well, the dot and dash versions were really arbitrary between them. 
We couldn't do paths and the no-change and no-seperator choices had 
significant negatives.
At least the dot being unlikely in normal rebol code makes these 
opcodes more useful in rewrite rules, since you will know what to 
not look for.
I suggested the dash, but the dot is just as good to me.
And anyway, REBOL syntax is designed to be quick to type. That is 
why we use - instead of _ and [ ] instead of { } like other languages.
Pekr
8-Nov-2005
[1235]
but why not -
Rebolek
8-Nov-2005
[1236]
As Cyphre said: because dot looks more like assembler ;)
Pekr
8-Nov-2005
[1237]
never mind, I will probably never write rebcode leve code anyway 
:-)
BrianH
8-Nov-2005
[1238x4]
It is a good visual reminder of the different semantic model, this 
is true...
Well, I don't write View code. We all have our strengths :)
And on that note, where's the Core version of the new build?
Testing: The new brab works. The eq.i opcode still works on logic 
and datatype values as well.
Gregg
8-Nov-2005
[1242x2]
For those with a lot of rebcode already, there will probably be a 
conversion tool to update your scripts available shortly.
I can live with dots but I don't like it, looks really un-REBOLish

 -- That's by design. The opcode names are not human friendly either; 
 also by design. The idea being that rebcode is *not* REBOL, and having 
 it look more like ASM makes you more aware of that. There will probably 
 also be a separate style guide for rebcode at some point.
Gabriele
9-Nov-2005
[1244x2]
Kru: we have a script that does the conversion automatically. Ask 
Ladislav.
(ah, i see Gregg told you already ;)
Rebolek
9-Nov-2005
[1246]
Gabriele: thanks but I've already rewrote most of my code yesterday. 
I don't know your conversion script but I've had different scripts 
using 1.30.50, .51, .52 and even old 1.4 alphas so does your script 
cover all different syntaxes or just the latest one?
Gabriele
9-Nov-2005
[1247]
only   mul -> mul.i, muld -> mul.d and so on. i.e. latest.
Rebolek
9-Nov-2005
[1248]
And rewriting scripts manually was great opportunity to otimize them 
to (and sometimes by factor of two, so it was for good :))
Gabriele
9-Nov-2005
[1249]
:-)
Rebolek
9-Nov-2005
[1250]
otimize-optimize
Oldes
9-Nov-2005
[1251]
What's the problem with dot? I was not voting, but must say I like 
dot. At least it looks differently from variable names, where I use 
- and _ chars.
Pekr
10-Nov-2005
[1252x2]
guys, rgba to integer conversion link is dead ...
should I rambo-it? :-)
Rebolek
10-Nov-2005
[1254x2]
this looks like a bug to me:
>> o1: context [a: 0 rc: rebcode [x][set a x]]
>> o1/rc 3
>> ? o1
O1 is an object of value:
   a               integer!  3
   rc              rebcode!  [x]

>> o2: make o1 []
>> o2/rc 5
>> ? o2
O2 is an object of value:
   a               integer!  3
   rc              rebcode!  [x]

>> ? o1
O1 is an object of value:
   a               integer!  5
   rc              rebcode!  [x]