[M3devel] [M3commit] CVS Update: cm3
Coleburn, Randy
rcolebur at SCIRES.COM
Thu Jun 7 23:44:56 CEST 2012
Daniel:
I'm impressed by your ability to provide so many different research links in your posts.
But, after looking at the link you gave in response to my post, I don't see the immediate relevance to my question regarding Modula-3 threading on Windows.
Also, I'm sorry, but I have a very difficult time trying to understand what you are saying in your posts. I suppose it must have something to do with the translation between our different languages. Forgive me, but I don't understand your reply.
--Randy Coleburn
From: Daniel Alejandro Benavides D. [mailto:dabenavidesd at yahoo.es]
Sent: Thursday, June 07, 2012 3:43 PM
To: m3devel at elegosoft.com; Coleburn, Randy
Subject: Re: [M3devel] [M3commit] CVS Update: cm3
Hi all:
Yes, it is, but the same conditioning over System Pthreads, is that you can't always link the threads against themselves, so you need re-implement it correctly.
Good style DEC-SRC threads might be along the verification project for the Alpha with Vector extensions:
http://barroso.org/publications/piranha_asilomar.pdf
Thanks in advance
--- El jue, 7/6/12, Coleburn, Randy <rcolebur at SCIRES.COM<mailto:rcolebur at SCIRES.COM>> escribió:
De: Coleburn, Randy <rcolebur at SCIRES.COM<mailto:rcolebur at SCIRES.COM>>
Asunto: Re: [M3devel] [M3commit] CVS Update: cm3
Para: "m3devel at elegosoft.com<mailto:m3devel at elegosoft.com>" <m3devel at elegosoft.com<mailto:m3devel at elegosoft.com>>
Fecha: jueves, 7 de junio, 2012 11:52
Mika:
I concur with what you are saying about needing a way to retain the good ideas in CM3 without sacrificing so much on performance.
As far as the thread test program goes, it still shows the implementation is broken somehow on Windows (2000, XP, & 7).
What can I do to help debug and solve this problem?
Am I correct that on Windows, Modula-3 threads are supposed to map to OS (Windows) threads?
Regards,
Randy Coleburn
-----Original Message-----
From: Mika Nystrom [mailto:mika at async.caltech.edu</mc/compose?to=mika at async.caltech.edu>]
Sent: Thursday, June 07, 2012 12:37 PM
To: Jay K
Cc: m3devel at elegosoft.com</mc/compose?to=m3devel at elegosoft.com>
Subject: Re: [M3devel] [M3commit] CVS Update: cm3
Hi Jay,
TYPECASE is limited to "reference" types, which effectively means heap-allocated. Unless you can get alloca in there, I suppose... what I mean is that in Green Book Modula-3 the only way to get a reference type is either through a heap allocation or an UNSAFE operation.
TYPECASE is sometimes the only way to do things. In the Green Book there are examples of using subtyping to have multiple generations of objects in the same pickles, for example. In my program, it was inside an interpreter that's figuring things out without any prior type information, using ISTYPE or TYPECASE.
The issue with TYPECASE that I brought up is actually that the implementation of TYPECASE and ISTYPE is far slower in the CM3 m3core than in PM3's (= SRC M3 as far as I know). The reason (which you allude to) is that Critical Mass did a lot of work on supporting dynamic loading of Modula-3 code (loading in types not known at compile time) and as with many of the other projects they carried out, the code quality was so-so. Because of the restrictions of SRC and P M3, types are statically allocated at compile time and all their subtyping relationships are known at that time. There is simply a static array of the types. CM3, on the other hand, has some more complicated dynamic data structure that makes all the TYPECASE and ISTYPE operations much more cumbersome. It's all in RT0 somewhere. In short, CM3 does "more" than SRC M3 did but at a heavy performance cost. And of course no one uses the "more" bit now.
Kind of like what they did to TEXTs... good ideas for some users, but somewhat half-baked implementation. Given that dynamic loading is used so little, if at all, and it in any case only happens infrequently itself, it seems there ought to be a way to achieve what the CM3 guys were trying to do while retaining the performance of the older implementation, but not if your code is a "rush job". I think it would have been sensible to vet Critical Mass's code a bit better before switching from PM3 to
CM3 for the "official" distribution of Modula-3.
I still use PM3 quite a bit. I can no longer blame the TEXTs, nor can I blame the pthreads implementation's being broken since I use CM3 with user threads. Now it's mainly because m3gdb works great on FreeBSD-5.5 with PM3-generated code. I've tried so many times to get things working on other machines with CM3 and newer m3gdb and there's always something annoyingly wrong. Life's too short...
Mika
P.S. how are the pthreads coming along? I saw some checkins (Dragisa), does the thread tester run without hanging or crashing now? I'd love to use pthreads but it's not been high on my list to debug as long as I can live with user threads...
Jay K writes:
>
>Daniel=2C I can't find the email now=2C as usual=2C you are probably wrong.
>
>
>We don't have an older runtime=2C we have a newer one=2C I think.
>With more allowance for dynamic loading.
>
>
>Mika=2C
>Maybe a TYPECASE-intense design is generally poor?
>dynamic_cast is slow in some C++ implementations.
>And I've never seen it used much. Some=2C but not much.
>The "type matching" that C++ exception handling has to do isn't
>particularly fast=2C though there are other costs there.
>Other than the stack walk=2C there is "finding the base of the
>object"=2C and strcmp to do the actual type match --
>name-based-type-equality and all that=2C with a hope that it suffices
>and no runtime checking of type hashes like Modula-3 does..
>
>
>Maybe you should switch on your own type tag?
>=A0 But I guess Modula-3 doesn't have unions.
>Or use OBJECT and method calls?
>
>
>Which reminds me...it bothers me that OBJECT requires heap allocation
>and garbage collection. It shouldn't require either.
>I know we have function pointers available to simulate it=2C without
>heap allocation=2C but what I don't know=2C is if the "implicit dow=
>ncast"
>in a virtual function/method call is doable in safe code or not.
>I'll have to look into it..but I'm busy now..
>
>
>Maybe there is an optimization whereby the compiler can figure out that
>there is a small set of likely types that it could check first?
>
>
>Or maybe the full feature could be implemented more efficiently?
>
>
>Maybe it can be optimized based on the fact that the types known to the
>system are read-mostly=2C rarely written/appended?
>
>
>I don't know.
>I'd really have to look into what the language supports and how it is
>implemented. I'm not certain of either.
>
>
>In C++=2C typeid() is fast=2C and requires there be virtual functions
>(OBJECT). Is TYPECASE limited to OBJECTs?
>Or heap allocated data?
>
>
>Later..
>=A0- Jay
>
>
>
>
>
>
>----------------------------------------
>> To: jay.krell at cornell.edu</mc/compose?to=jay.krell at cornell.edu>
>> CC: m3devel at elegosoft.com</mc/compose?to=m3devel at elegosoft.com>
>> Subject: Re: [M3devel] [M3commit] CVS Update: cm3
>> Date: Wed=2C 6 Jun 2012 09:18:08 -0700
>> From: mika at async.caltech.edu</mc/compose?to=mika at async.caltech.edu>
>>
>> Jay K writes:
>> >
>> ...
>> >7) Do folks out there really use the Modula-3/gcc optimizer=3D2C and
>> >not=
>ice i=3D
>> >t produces code that runs much faster?
>>
>> If we are talking about turning on optimizations in the m3makefile=2C
>> the=
>n the
>> answer is:
>>
>> Yes! At least with CM3 it makes a huge difference in runtime. Without
>> the optimizer CM3-produced code runs far slower than PM3-produced
>> code (I've seen 3X I think.) With it=2C CM3 can sometimes keep up.
>> Unless you use a lot of TYPECASE or other constructs that have a much
>> less efficient implementation in the CM3 libraries than in the PM3 libraries.
>>
>> Mika
> =
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20120607/ff987390/attachment-0002.html>
More information about the M3devel
mailing list