Hi,
I am pleased to announce the long awaited (or absolutely surprising)
release of PSEH3.
This complete from scratch rewrite takes reactos exception handling to a
new level. It comprises the following advancements:
- Use of enums instead of const variables for internal trylevel counting
and other mechanisms. enums can be declared in a nested manner as well
and only enums are treated by gcc as full compile time constants, while
const variables are treated as dynamic and are only optimized away by
the compiler later. This generally results in better optimized code.
- No more use of dynamic sized arrays. Those make the compiler emit a
slow call to _chkstk. It could have been prevented in PSEH2, if enums
had been used instead of consts. The new code uses the same registration
frame for the top level and nested levels, which also simplifies the code.
- No more use of nested function stack trampolines. These are small code
chunks that are being dynamically put on the stack, when the address of
a nested function is taken. The address of the nested function then
points to this trampoline, which sets up a pointer for nested variable
access (nested function can access variables in the parent frame). These
were parsed by PSEH2 to calculate the neccessary nested frame pointer.
PSEH3 uses a static scope table instead that contains the address of the
nested function. this is only possible by first declaring the function
and putting the implementation after the address is stored in the static
table. This is because nested functions that do not access any variables
in the parent frame do not need a stack trampoline and their addresses
are thus considered compiler constants. GCC doesn't notice that a nested
function uses variables of the parent frame, before the function is
actually implemented, so with only a prototype, it assumes a constant
address. To get the value of the parent frame pointer, PSEH2 calls the
nested function 2 times: The first time with a bogus frame pointer and a
parameter that tells the function to return the (assumed) address of the
current registration frame. Without a proper parent frame pointer the
nested function will return an offset that we can use together with the
real address of the registration frame (which we know, when calling the
filter of finally functions) to calculate the proper parent frame
pointer. The 2nd call passes a different parameter and allows the
function to do the actual work and access variables in the parent frame.
- Improved performance due to use of "asm goto". This construct allows
to get away with having labels, that are never accessed by any C code.
The compiler doesn't remove them. So we do not need the old hack, of
comparing a "volatile" 0 against 0, just to confuse GCC to not optimize
away a label. Even though there is a bug/defficiency/limitation in asm
goto, that would usually not allow the combination with static C jump
labels, we can still do that due to some tricks that force GCC to do the
right thing. More information:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51840
- Improved performance due to faster registration. The new registration
code is smaller and saves only esp and ebp. Due to some tricks in PSEH3,
GCC is forced to assume all registers are being clobbered when the
__except block is run. Filter function and __finally function don't make
use of registers from the previous code. So all neccessary register save
and restore is now fully done by GCC.
- The trick to make GCC assume all registers are clobbered at the
beginning of the __except block has one additional huge advantage. Now
all variables that are accessed by the __except block will be stored in
memory locations, so that modifications in the __try block will be
available in the __except block, something that doesn't work with PSEH2.
This does not prevent the compiler from doing constant expression
elimination! So when you try to do 2 different, constant assignments to
a variable in the __try block, expect that this will be reduced to only
the later assignment. GCC does not know, that the execution can be
interrupted in the middle of the __try block between those 2
assignments. If you need such stuff, you must use a volatile variable.
- Less stack usage. PSEH3 stores much less data on the stack. No
trampolines, only esp and ebp are saved, registration frames are smaller.
- No more need for _SEH2_YIELD(). This macro was used to make sure the
registration frames are properly unregistered, when leaving the try or
except block using goto or return. This is not neccessary anymore due to
the use of __attribute__((cleanup)). This attribute is attached to the
registration frame and causes the cleanup function to be called
automatically, whenever the variable goes out of scope. This happens
when a goto or return is used in the code.
- Human readable warnings, when special SEH instriniscs, like
_exception_info() or _abnormal_termination() are used outside of their
valid context.
- Cleaner and better readable code, so you won't get braindead, when
trying to figure out what's going on. Header: < 300 lines commented
code, instead of 370 lines uncommented code, lib: < 250 lines of
commented C code + < 70 lines commented asm code, instead of 290 lines
of uncommented C code + 120 lines uncommented asm code)
I also promised Amine to take a look into implementing a version that is
compatible with clang. Initially I planned to include this into this
release, but it turns out that clang massivley lacks features to do so
and a completely different approach will probably be used for that.
The new code is only compatible with GCC 4.7 and later, and it's also
currently disabled (cmake option USE_PSEH3).
Tesbot showed no noticable regressions.
Have fun.
Timo
Hello,
I turned off Bugzilla now in favor of finishing the switch to JIRA.
Once the work is done, I will announce either return to Bugzilla or
introduce JIRA.
Hopefully, it'll be the latter option.
Best regards,
Aleksey.
This commit breaks msvc compilation.
Best regards
----- Original message -----
From: buildbot(a)reactos.org
To: caemyr(a)myopera.com
Subject: buildbot failure in ReactOS on CMake_x86_MSVCWin Debug
Date: Tue, 04 Sep 2012 03:10:09 +0000
The Buildbot has finished a build on builder CMake_x86_MSVCWin Debug
while building ReactOS.
Full details are available at:
http://build.reactos.org/builders/CMake_x86_MSVCWin%20Debug/builds/1908
Buildbot URL: http://build.reactos.org/
Buildslave for this Build: Windows_AMD64_1
Build Reason: scheduler
Build Source Stamp: 57233
Blamelist: cgutman
BUILD FAILED: failed building bootcd
sincerely,
-The Buildbot
--
With best regards
Caemyr
Currently, we experience random crashes in 2nd stage. I was unable to
catch any first exception bar the one with vmware detection code (which
is outdated and should be removed).
After forcing build again, test run failed at Cleanup, due to
previously unresolved issue of repeating whole testrun when crash
occurs in APItests.
On Mon, Sep 3, 2012, at 10:21 AM, buildbot(a)reactos.org wrote:
> The Buildbot has finished a build on builder Windows_AMD64_1 VBox-Test
> while building ReactOS.
> Full details are available at:
> http://build.reactos.org/builders/Windows_AMD64_1%20VBox-Test/builds/6496
>
> Buildbot URL: http://build.reactos.org/
>
> Buildslave for this Build: Windows_AMD64_2
>
> Build Reason: The web-page 'force build' button was pressed by 'osiejka':
>
> Build Source Stamp: 57227
> Blamelist:
>
> BUILD FAILED: failed Cleanup
>
> sincerely,
> -The Buildbot
>
--
With best regards
Caemyr
This one is caused by rev 57225:
Backtrace:
http://www.reactos.org/paste/index.php/10472/
Please fix
----- Original message -----
From: buildbot(a)reactos.org
To: caemyr(a)myopera.com
Subject: buildbot failure in ReactOS on Windows_AMD64_1 VBox-Test
Date: Sun, 02 Sep 2012 22:50:06 +0000
The Buildbot has finished a build on builder Windows_AMD64_1 VBox-Test
while building ReactOS.
Full details are available at:
http://build.reactos.org/builders/Windows_AMD64_1%20VBox-Test/builds/6492
Buildbot URL: http://build.reactos.org/
Buildslave for this Build: Windows_AMD64_2
Build Reason: Triggerable(Windows_AMD64_1 VBox-Test Trigger)
Build Source Stamp: 57225
Blamelist: ion
BUILD FAILED: failed test
sincerely,
-The Buildbot
--
With best regards
Caemyr
Hiya
R3ddr4g0n reported to me that all recent revisions uploaded to
iso.reactos.org are not correct. Instead of given revision, all the
builds are reporting to be rev 57150. After a quick check, i downloaded
bootcd-57221-dbgwin.iso and checked its SHA1: should be
56d2190610e8a1f650faa3c6a6a8348f89d1fa1b but happened to be:
f97ac4aba0e5ceed3b5beae3d7ab2bc2c7600fab - which is indeed the same
checksum as for x86_CMake-57150
The possible clue from the upload script:
bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at
/home/lapo/package/rsync-3.0.8-1/src/rsync-3.0.8/io.c(601)
[sender=3.0.8]
* Done.
* Remotely compressing bootcd-57219-dbgwin...
Now, Colin may recall that i was strongly against using fancy tricks for
sending the revs instead of simply archiving them locally and uploading
afterwards. This way with rsync was supposed to be saving bit of
bandwidth.
Now we have to reupload at least all since 57150, unless you can use the
fancy tricks to spot the same iso files. Great thing we can save a
little bit of bandwidth but waste time to fix it afterwards.
Accoring to the reporter:
[21:45:37] <r3ddr4g0n> for sure from 57115 to 57221
If you still think this methode is saving us anything, please reckon
that a single view of testbot log means downloading a few megabytes of
text at least.
I`m stopping the uploads until the problem is resolved in a way to
prevent it from happening again.
--
With best regards
Caemyr
Hello,
Let me invite you to the monthly status meeting taking place last
Thursday of this month, 30th of August, 19:00 UTC.
The meeting will be at irc://fezile.reactos.org (Port 6667, no SSL) in
the channel #meeting, if the server works. If not, then an alternative
place will be announced here. Note that the IRC service will only be
started shortly before the meeting. Your participation passwords will be
emailed to you shortly before the meeting starts.
If someone still is not getting passwords sent before a meeting - please
email Colin or Pierre before the meeting started to get one.
In order to save time, let's choose who is going to be the minute taker
on the upcoming meeting. As usual, Z98 is welcome to volunteer.
The agenda will be posted shortly before the meeting, suggestions are
welcome (send them to my email as usual).
With the best regards,
Aleksey Bragin.
Hi,
I don't agree with these changes.
If we need a DllEntry in the lib, then we should use the one that is
provided by mingw-w64 (all this code is 100% mingw-w64). It simply
returns true (thats exactly what the one in MS CRT does) and works for
gcc and MSVC.
Also what's the point of DisableThreadLibraryCalls() here? As you wrote
yourself, no DllMain only means "I have nothing more to initialize than
the CRT". But this disables the CRT thread initializion, too.
There is also no need for weak symbols, we can simply call the stub
DllMain, since it doesn't (shouldn't) do anything.
Regards,
Timo
Am 27.08.2012 01:31, schrieb jgardou(a)svn.reactos.org:
> Author: jgardou
> Date: Sun Aug 26 23:31:49 2012
> New Revision: 57171
>
> URL: http://svn.reactos.org/svn/reactos?rev=57171&view=rev
> Log:
> [MINGWEX]
> - mark DllMain as a weak symbol for GCC.
> - supply a stubbed DllMain for MSVC.
> - DllMain is optional, and some DLLs don't implement it. That doesn't mean that they have no entry point, it means "I have nothing more to initialize than the CRT".
>
> Added:
> trunk/reactos/lib/sdk/crt/startup/mscdllmain.c (with props)
> Modified:
> trunk/reactos/lib/sdk/crt/msvcrtex.cmake
> trunk/reactos/lib/sdk/crt/startup/crtdll.c
>
> Modified: trunk/reactos/lib/sdk/crt/msvcrtex.cmake
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/msvcrtex.cmake…
> ==============================================================================
> --- trunk/reactos/lib/sdk/crt/msvcrtex.cmake [iso-8859-1] (original)
> +++ trunk/reactos/lib/sdk/crt/msvcrtex.cmake [iso-8859-1] Sun Aug 26 23:31:49 2012
> @@ -66,7 +66,9 @@
> endif()
>
> if(MSVC)
> - list(APPEND MSVCRTEX_SOURCE startup/mscmain.c)
> + list(APPEND MSVCRTEX_SOURCE
> + startup/mscmain.c
> + startup/mscdllmain.c)
> else()
> list(APPEND MSVCRTEX_SOURCE startup/gccmain.c)
> endif()
>
> Modified: trunk/reactos/lib/sdk/crt/startup/crtdll.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/startup/crtdll…
> ==============================================================================
> --- trunk/reactos/lib/sdk/crt/startup/crtdll.c [iso-8859-1] (original)
> +++ trunk/reactos/lib/sdk/crt/startup/crtdll.c [iso-8859-1] Sun Aug 26 23:31:49 2012
> @@ -50,7 +50,19 @@
>
> extern int mingw_app_type;
>
> +/*
> + * It is possible that a DLL provides no DllMain entry point.
> + * Mark it as a weak symbol for GCC.
> + * Tests show that at link time, MSVC looks for a function first in the object files provided, and then
> + * in the libraries. This means that we must provide a basic implementation in msvcrtex, which will be used
> + * if none is found in the object files provided to link.exe.
> + * This also means that we can't rely on a DllMain function implemented in a static library when linking a DLL.
> + */
> +#ifdef __GNUC__
> +extern WINBOOL WINAPI DllMain (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) __attribute__((weak));
> +#else
> extern WINBOOL WINAPI DllMain (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved);
> +#endif
>
> extern WINBOOL WINAPI DllEntryPoint (HANDLE, DWORD, LPVOID);
>
> @@ -198,10 +210,12 @@
> }
> if (dwReason == DLL_PROCESS_ATTACH)
> __main ();
> - retcode = DllMain(hDllHandle,dwReason,lpreserved);
> + if(DllMain)
> + retcode = DllMain(hDllHandle,dwReason,lpreserved);
> if (dwReason == DLL_PROCESS_ATTACH && ! retcode)
> {
> - DllMain (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
> + if(DllMain)
> + DllMain (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
> DllEntryPoint (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
> _CRT_INIT (hDllHandle, DLL_PROCESS_DETACH, lpreserved);
> }
>
> Added: trunk/reactos/lib/sdk/crt/startup/mscdllmain.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/startup/mscdll…
> ==============================================================================
> --- trunk/reactos/lib/sdk/crt/startup/mscdllmain.c (added)
> +++ trunk/reactos/lib/sdk/crt/startup/mscdllmain.c [iso-8859-1] Sun Aug 26 23:31:49 2012
> @@ -1,0 +1,11 @@
> +#include <oscalls.h>
> +#define _DECL_DLLMAIN
> +#include <process.h>
> +
> +WINBOOL WINAPI DllMain (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved)
> +{
> + /* If the DLL provides no DllMain, then chances are that it doesn't bother with thread initialization */
> + if(dwReason == DLL_PROCESS_ATTACH)
> + DisableThreadLibraryCalls(hDllHandle);
> + return TRUE;
> +}
>
> Propchange: trunk/reactos/lib/sdk/crt/startup/mscdllmain.c
> ------------------------------------------------------------------------------
> svn:eol-style = native
>
>
>
Btw, we are using a lot of hardcoded 512 values here for sector size
even though there is a field in fthe Volume structure for that.
Is that correct?
Am 23.08.2012 14:02, schrieb tkreuzer(a)svn.reactos.org:
> Author: tkreuzer
> Date: Thu Aug 23 12:02:30 2012
> New Revision: 57141
>
> URL: http://svn.reactos.org/svn/reactos?rev=57141&view=rev
> Log:
> [FREELDR]
> Improve readability of sector calculation
>
> Modified:
> trunk/reactos/boot/freeldr/freeldr/fs/fat.c
>
> Modified: trunk/reactos/boot/freeldr/freeldr/fs/fat.c
> URL: http://svn.reactos.org/svn/reactos/trunk/reactos/boot/freeldr/freeldr/fs/fa…
> ==============================================================================
> --- trunk/reactos/boot/freeldr/freeldr/fs/fat.c [iso-8859-1] (original)
> +++ trunk/reactos/boot/freeldr/freeldr/fs/fat.c [iso-8859-1] Thu Aug 23 12:02:30 2012
> @@ -1338,8 +1338,7 @@
> //
> // Seek to right position
> //
> - Position.HighPart = SectorNumber >> 23;
> - Position.LowPart = SectorNumber << 9;
> + Position.QuadPart = (ULONGLONG)SectorNumber * 512;
> ret = ArcSeek(Volume->DeviceId, &Position, SeekAbsolute);
> if (ret != ESUCCESS)
> {
>
>
>