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

World: r3wp

[Red] Red language group

Steeve
7-Jan-2012
[4298]
The simple current compiler technique used by Red (variable pushed/poped 
 on the stack ) is already easly beaten by any c compiler.
Andreas
7-Jan-2012
[4299]
Any C compiler with a register allocator, that is :)
Steeve
7-Jan-2012
[4300]
obviously ;-)
Andreas
7-Jan-2012
[4301x2]
Yes, there are C compilers that don't care :)
TCC for example, if I'm not mistaken.
Steeve
7-Jan-2012
[4303]
TCC is for science not for business :)
Andreas
7-Jan-2012
[4304]
Don't say that :) TCC has many obscure uses :)
Dockimbel
7-Jan-2012
[4305x2]
Steeve: certainly, but as you might have noticed, Red/System current 
implementation is a bootstrap for the Red/System future version written 
in Red. So all the current Red/System code written in REBOL, will 
be trashed once Red will be mature enough. Adding heavy optimizations 
at this point would be just a waste of time and energy that would 
serve no purpose.
For example, supporting fastcall calling convention and having a 
good register allocator are part of the optimizations that will be 
added when Red/System will be rewritten. Also, the internal compiler 
architecture, especially the code emitter will be quite different 
from the current one. I plan to introduce an intermediary representation 
and an internal event-based API. The various optimizations should 
be added as plugins/modules to the compiler, allowing to "hook" at 
various different stages of the compilation process. Also, this "API" 
should be partially (or fully) exposed at Red level, allowing to 
"easily" write Red & Red/System compiler extensions if needed.
Andreas
8-Jan-2012
[4307]
Public service announcement: it's "Red", not "RED". Thanks for listening 
:)
Henrik
8-Jan-2012
[4308x2]
I think RED is a registered trademark.
(anyway)
Dockimbel
8-Jan-2012
[4310]
Thanks. :-)
Pekr
8-Jan-2012
[4311]
Doc, would you be interested in getting BeagleBone for the kind of 
experiments? See links group for more info. IMO embedded & mobile 
should be Red's target ...
Dockimbel
8-Jan-2012
[4312x2]
I'm interested in a board that would require 500mV for running as 
it seems to be the limit for the small solar panel + battery, I've 
ordered for powering my Arduino.
Also, I will get my hands on the Raspberry first, we'll see for others 
after that. (I admit that the BeagleBone boars specs are seducing 
too)
Pekr
8-Jan-2012
[4314]
Arduion can't run full operating system imo. I found it underpowered, 
but maybe enough for home automation.
Dockimbel
8-Jan-2012
[4315x4]
Arduino with AVR 32-bit MCU can, there are Linux versions running 
on it.
Can't find the links about that anymore, I wonder if I haven't confuse 
that with another board?
Found one at least: http://www.indefia.com/products/hardware/emblinux/
The main link leads to an almost empty page: http://avr32linux.org
(looks like they are recovering from a crash)
Pekr
8-Jan-2012
[4319]
As for ARM CPU support, I will have to rescan this group, about what's 
supported. We have one dev board with Cortex-M3
Dockimbel
8-Jan-2012
[4320x3]
In order for Red to appear on the Tiobe Index, one requirement is 
to have an entry on (english) Wikipedia, clearly describing it as 
a programming language, as explained here: http://www.tiobe.com/index.php/content/paperinfo/tpci/tpci_definition.htm


I have contacted Tiobe and they are ok for including Red when this 
requirement will be fulfilled. If someone here is willing to do it, 
that would really help boost Red's visibility. That is typicaly something 
that I cannot do myself, it would go against Wikipedia's rules.
Cortex-M3: Andreas mentioned that it requires the Thumb2 instruction 
set, so, it won't work with the current Red ARM backend.
If there's is a corresponding instruction in Thumb2 for each one 
we currently use in the ARM backend, a new port could be quickly 
made (but don't expect me working on this one in the next months, 
it's too low priority).
Pekr
8-Jan-2012
[4323]
that's ok ....
Andreas
8-Jan-2012
[4324]
We support ARMv5+ at the moment. So that means ARM9E, ARM10E, XScale, 
ARM11, Cortex-A based cores should work fine. Most notably, Cortex-M 
won't (as those cores only support the Thumb instruction set). Neither 
will StrongARM (which is ARMv4).
Pekr
8-Jan-2012
[4325]
thanks ...
Andreas
8-Jan-2012
[4326]
I have a rather nice Cortex-M3 based board lying around as well. 
So maybe I'll get around to tackle the Thumb profile some day :)
Pekr
8-Jan-2012
[4327]
Doc - what layer will be e.g. events implemented in? Red/System, 
or Red? I mean - will you use your own implementation, or will you 
adopt some libraries for concurrency, events, e.g. libevent, liboop, 
etc.?
Dockimbel
8-Jan-2012
[4328x6]
We'll start simple, so implement our own internal event loop which 
will have a Red/System backend and a frontend at Red level, probably 
following the R3 port model.
I don't see the necessity for an external lib for concurrency or 
events management, when the OS are already providing everything we 
need (I guess that pthread lib is standard part of Linux now?).
Float support so far:

---
Red/System [ ]

#import [
	LIBC-file cdecl [
		cos: "cos" [
			x 		[float!]
			return: [float!]
		]
	]
]

pi: 3.14159265358979
printf ["%.14f" cos pi]
---

outputs: -1.00000000000000
The only drawback for now is that 64-bit values break the typed/variadic 
stack layout (meant for 32-bit values only). I need to find a workaround 
for that.
So, currently PRINT and PRINT-WIDE can't be used with floats.
(I haven't pushed the float branch yet, I still need to improve this 
first version)
Kaj
8-Jan-2012
[4334]
PThreads are the native Linux threads implementation for a number 
of years
Dockimbel
8-Jan-2012
[4335]
Pushed first version of float preliminary support in `float-partial` 
branch, please read the commit logs for more info: 


https://github.com/dockimbel/Red/commit/bea1aa7fc4b6f7b6acf57d304d90235300734580
Kaj
8-Jan-2012
[4336x9]
I've got my binding with the C math library to work, so all the ANSI 
C math functions are available now
It works on Linux and should also work on Windows
On Mac, the math library path may have to be adjusted
On Syllable, I get:
*** Runtime Error 101: no value matched in SWITCH
*** at: h
This looks like an error in the runtime to me, quite possibly not 
even float related
It could be an unknown signal group in POSIX.reds
The default error definition on a signal doesn't work anymore since 
the last SWITCH change
The at: report is also odd
Dockimbel
9-Jan-2012
[4345x3]
The x87 FPU init code wasn't stable when I pushed the commit yesterday 
night, and I forgot to launch the test suite. It should be ok now.
Hmm, your error report looks odd indeed, I'll fire up my Syllable 
image and try to reproduce it.
The latest hello script and my float test script above are both working 
ok on my Syllable image.