Page 2 of 2

Posted: Tue Mar 18, 2003 3:51 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.

@Fred

If you haven't received anything in your mailbox please notify me here!

Posted: Wed May 07, 2003 4:47 pm
by Tranquil
whats going on with this thread? some news on it fred? Or is it getting lost?

Posted: Wed May 07, 2003 9:17 pm
by Fred
All has been dicussed with Pupil, no I need to implement it.

Alternative view

Posted: Sun Jun 01, 2003 4:25 am
by HarryO
Fred,

First, keep up the great work!!!! Love this stuff!!

Second, I know this is late but, what if each thread had it's own copy of the string handler and a local buffer?

When a new thread is created, a copy of the string handleing is created with using it's own string buffer by default (local thread string handling only).

If the string var that is called is declared global then the buffer for the parent process is used.

Would this be easier to implement since you already have the string handler code. Could you re-use the code, just point it to a different buffer?

I know this doesn't solve the problem of handling the global string variables to be thread-safe, but it could be the basis for it.

What does everybody think?

HarryO

Posted: Tue Jun 03, 2003 10:24 pm
by SlowByte
Hi,

You can make the string buffers thread safe by using TLS (Thread Local Storage) that allocates memory that is unique for every thread (so you don't have to implement your own system).
See the function TlsAlloc, TlsSetValue, TlsGetValue and TlsFree in the Win32 API documentation.

By the way PureBasic looks nice, I'm coding my own language, maybe we'll compete some day (or maybe not, my language going to be a bit more advanced, using type inference and polymorphic functions, if I ever decide to code it) ;)

The PureBasic compiler is not the best I've seen, but it is better than the average, at least it generates native code. You could use some more optimization, look into Single Static Assignment form, Code Flow Graphs and Data Flow Graphs, Three Address Code, and register allocation (Linear Scan Register Allocation, Second-chance binpacking, Graph-coloring and coalescing register allocators).
Get the "Dragon Book" aka "Compilers: Principles, Techniques, and Tools" if you don't have it already.
PureBasic outputted some silly code like "add ebx, 0" and "mov eax, [stuff] mov eax, [morestuff]", use a peephole optimizer :) (of course, an optimizer is not the most important part of the language but it isn't *that* hard to write one if you have spare time))

-Jaen Saul