World: r3wp
[rebcode] Rebcode discussion
older newer | first last |
BrianH 20-Feb-2007 [1639] | I think true/false will work - it might need true/none. |
Maxim 20-Feb-2007 [1640] | its probably true/none |
BrianH 20-Feb-2007 [1641] | It's probably both. |
Maxim 20-Feb-2007 [1642] | hum... in any case, thanks for remining me about APPLY IN :-) you've revived my interest in rebcode (even if I might now rely on some features of 2.7) |
Steeve 20-Feb-2007 [1643] | here am i ^^^ |
BrianH 20-Feb-2007 [1644x2] | It is really the best way to work with objects in efficient code, so much so that I requested an IN opcode. |
Hi Steeve! | |
Maxim 20-Feb-2007 [1646] | glad you did :-) |
BrianH 20-Feb-2007 [1647] | IN doesn't work with structs though, so I requested a set of struct opcodes to work with them (SET.S, GET.S, ...). |
Maxim 20-Feb-2007 [1648x3] | that would probably be even faster. |
since its a simple shift | |
I meant offset | |
BrianH 20-Feb-2007 [1651x4] | For structs, yes. For objects, IN and GETW/SETW would be faster since you can cache the looked-up word. |
It's not that bad a technique in REBOL code either. | |
Path evaluation has a lot of overhead. | |
Any questions, Steeve? | |
Steeve 20-Feb-2007 [1655] | BrianH, what is the most rapid, to use a do [my-func var] or an apply ? |
BrianH 20-Feb-2007 [1656] | Apply. |
Steeve 20-Feb-2007 [1657] | hum, and if i have severall apply to do (in sequence) ? |
BrianH 20-Feb-2007 [1658] | APPLY in a LOOP block or something. Even then, it is much more efficient to translate to rebcode and inline when you can - APPLY overhead is significant, and DO overhead much more so. |
Steeve 20-Feb-2007 [1659x8] | ok |
have another question on system/internal/assembly* | |
can i disactivate the label parsing/replacecing to gain speed when i build rebcode functions | |
? | |
i d'ont use labels | |
but i build many many rebcode functions in real time, i need speed | |
i use a parser to convert Z80 opcodes into rebol opcodes | |
i attempt to do a Z80 emulator | |
BrianH 20-Feb-2007 [1667x2] | It really doesn't gain you much speed. The label fixups are done once, at rebcode function creation time. After that it just calls the offsets - the label statement is a noop. I only do straight offsets when generating code (like you are). Be careful though, as the offsets are calculated from the end of the branch statement, not the beginning. |
This only matters when writing your own offsets. I only noticed when I started using the BRAB opcode, and its predecessor BRAW. | |
Steeve 20-Feb-2007 [1669] | anyway, can i replace assembly* by a dummy function ? |
BrianH 20-Feb-2007 [1670] | You can replace assembly* with a Z80 assembler even. |
Steeve 20-Feb-2007 [1671x2] | ok |
i noticed that i can join the code of 2 rebcode function without re-assemble them | |
BrianH 20-Feb-2007 [1673x2] | Remember that the current assembler* doesn't do much, and even that is done at rebcode function creation time. It has no effect on execution time. |
If you join these function blocks after the rebcode function is created, you may have context issues. It is better to join them before assembly. | |
Steeve 20-Feb-2007 [1675x3] | yes but i try to do emulation + a debugger , so Z80 opcodes are converts step by step |
i have no context issues, cause all words i use have the same context | |
there is no local words in my rebcode functions | |
BrianH 20-Feb-2007 [1678] | You can do code snippets for your emulation/debugger, and concatenation for direct execution. |
Steeve 20-Feb-2007 [1679] | it's what i do |
BrianH 20-Feb-2007 [1680x2] | As long as you are careful the semantics shouldn't change. |
Remember that these branch statements group statements together into basic blocks, so you should break up your code into snippets on boundaries between these blocks. | |
Steeve 20-Feb-2007 [1682x2] | that why i don't use branch statements |
branchements are controled outside rebcodes functions | |
BrianH 20-Feb-2007 [1684x2] | For non-generated code, the only useful branch statement in rebcode is BRAB. All others have better structured equivalents. |
BTW, the English word for branchements is branches. | |
Steeve 20-Feb-2007 [1686x2] | i have a main loop wich do the branchements and call the rebcode routines |
sorry | |
BrianH 20-Feb-2007 [1688] | Just trying to help :) |
older newer | first last |