LaunchAPPLServer: Think about memory usage and code size

This commit is contained in:
Wolfgang Thaller 2018-05-01 21:17:39 +02:00
parent 2474387f74
commit 1871a9cbad
5 changed files with 39 additions and 4 deletions

View File

@ -10,3 +10,7 @@ target_include_directories(LaunchAPPLCommon PUBLIC .)
add_executable(TestLaunchAPPLCommon Test.cc)
target_link_libraries(TestLaunchAPPLCommon LaunchAPPLCommon)
if(CMAKE_SYSTEM_NAME MATCHES Retro68)
#target_compile_options(LaunchAPPLCommon PRIVATE -ffunction-sections -fno-exceptions -Os)
endif()

View File

@ -9,5 +9,14 @@ add_application(LaunchAPPLServer
target_link_libraries(LaunchAPPLServer LaunchAPPLCommon)
set_target_properties(LaunchAPPLServer PROPERTIES
CXX_STANDARD 17
LINK_FLAGS "-Wl,-gc-sections"
)
target_compile_options(LaunchAPPLServer PRIVATE -ffunction-sections -fno-exceptions -Os)
if(CMAKE_SYSTEM_NAME MATCHES Retro68)
set_target_properties(LaunchAPPLServer PROPERTIES
LINK_FLAGS "-Wl,-gc-sections -Wl,--mac-segments -Wl,${CMAKE_CURRENT_SOURCE_DIR}/LaunchAPPLServer.segmap"
)
else()
set_target_properties(LaunchAPPLServer PROPERTIES
LINK_FLAGS "-Wl,-gc-sections"
)
endif()

View File

@ -218,6 +218,13 @@ void DoUpdate(WindowRef w)
PaintRect(&r);
}
Str255 str;
NumToString(FreeMem(), str);
MoveTo(10,80);
DrawString(str); DrawString("\p / ");
NumToString(ApplicationZone()->bkLim - (Ptr)ApplicationZone(), str);
DrawString(str); DrawString("\p bytes free");
EndUpdate(w);
}
@ -379,6 +386,12 @@ void WritePrefs()
int main()
{
// default stack size is 8KB on B&W macs
// and 24 KB on Color macs.
// 8KB seems to be not quite enough,
// so increase stack size by 8KB.
SetApplLimit(GetApplLimit() - 8192);
MaxApplZone();
#if !TARGET_API_MAC_CARBON
InitGraf(&qd.thePort);
InitFonts();
@ -387,7 +400,7 @@ int main()
TEInit();
InitDialogs(NULL);
#endif
SetMenuBar(GetNewMBar(128));
AppendResMenu(GetMenu(128), 'DRVR');
DrawMenuBar();

View File

@ -123,6 +123,6 @@ resource 'SIZE' (-1) {
reserved,
reserved,
reserved,
256 * 1024,
256 * 1024
136 * 1024,
136 * 1024
};

View File

@ -0,0 +1,9 @@
SEGMENT Serial
*/libLaunchAPPLCommon.a:ReliableStream.*
*/MacSerialStream.*
SEGMENT Launcher
*/AppLauncher.*
SEGMENT libstdc++
*/libstdc++.a:*