--- nono/lib/mainapp.h 2026/04/29 17:05:39 1.1.1.17 +++ nono/lib/mainapp.h 2026/04/29 17:05:52 1.1.1.19 @@ -15,6 +15,8 @@ class Config; class Logger; class MonitorManager; +class ThreadManager; +class UIMessage; class VM; // VM 種別 @@ -51,11 +53,15 @@ class MainApp // Init() の戻り値 static const int PASS = -1; // 実行を継続 - enum class CPUAffinity { - None, // 指定なし - Low, // 低電力コアを列挙 - High, // 高性能コアを列挙 - Perf, // 高性能コアを列挙 (パフォーマンス測定用) + // CPU のバインド方法。 + // o Neutral は何もしない。 + // o Binding は、Heavy スレッドを高性能コアにバインドする。 + // Light スレッドは + // 高性能コアが 3個以上あれば、バインドしない (OS に任せる)。 + // 高性能コアが 2個以下なら、低性能コアにバインドする + enum class AffinityPolicy { + Neutral, + Binding, }; public: @@ -65,7 +71,7 @@ class MainApp void Dispose(); // 初期化 (ステージ1) - int Init1(bool is_cli_, int ac, char *av[]); + int Init1(int ac, char *av[], std::string (*conv)(const std::string&)); // 初期化 (ステージ2) bool Init2(); @@ -139,17 +145,32 @@ class MainApp // ログ名の一覧を表示する static std::vector GetLogNames(); + // list を一覧表示をする + static void ShowHelpList(FILE*, const std::vector& list); + // Logger を返す Logger *GetLogger() const { return logger.get(); } + // ThreadManager を返す + ThreadManager *GetThreadManager() const { return threadmanager.get(); } + + // UIMessage を返す + UIMessage *GetUIMessage() const { return uimessage.get(); } + public: // CLI/GUI 区別 bool IsCLI() const { return is_cli; } bool IsGUI() const { return !is_cli; } - // -b: ブレークポイント "[,][,]" + // -b(--b): ブレークポイント "[,][,]" std::vector debug_breakaddr {}; + // --bi: 命令ブレークポイント "[,][:][,]" + std::vector debug_breakinst {}; + + // --bv: ベクタブレークポイント "[,][-][,]" + std::vector debug_breakvec {}; + // --bi-exg (とりあえず) bool debug_breakinst_exg {}; @@ -184,18 +205,18 @@ class MainApp // NEON をホストがサポートしているかどうか。(こっちは情報表示用) bool detect_neon {}; - // CPU コアのアフィニティ。 - CPUAffinity cpu_affinity {}; + // CPU のバインド方法。 + AffinityPolicy affinity_policy {}; - // 要素数がコア数。true のところが cpu_affinity で指定した性質のコアを示す。 - std::vector cpu_list {}; + // 要素数がコア数。高性能コアのところが true。 + std::vector fastcore {}; // ログ表示用 std::unique_ptr hostcpu /*{}*/; private: // 初期化ステージ1 の下請け。 - int Init1a(int, char *[]); + int Init1a(int, char *[], std::string (*conv)(const std::string&)); int Init1b(); // path を絶対パスにして返す。 @@ -219,21 +240,23 @@ class MainApp // CPU の機能をチェックする。 bool CheckCPU(); + // CPU のアフィニティを調べる。 + bool CheckCPUAffinity(); + // CPU 番号リスト文字列を処理する。 - std::string ParseCPUList(std::vector& dst, const std::string& input); + std::string ParseCPUList(const std::string& input); // opt を logopt に追加する (-L オプション用) void AddLogopt(const char *opt); // -L オプションを処理する bool ParseLogopt(); + // 早期版 + void ParseLogoptEarly(); // ログレベル1つを設定する。 static bool SetLogopt1(const std::string&, std::string *errmsg); - // 初回起動時用に SRAM.DAT を作成する。 - int CreateSRAM(); - // コンパイルされている host netdriver の一覧を表示 void ShowHostnet() const; @@ -243,6 +266,9 @@ class MainApp // ログ std::unique_ptr logger /*{}*/; + // UIMessage + std::unique_ptr uimessage /*{}*/; + // 全オブジェクトへのポインタのリスト (所有はしていない) std::vector objects {}; @@ -256,6 +282,9 @@ class MainApp VMType vmtype {}; std::string vmstr {}; + // スレッドマネージャ + std::unique_ptr threadmanager /*{}*/; + // モニタマネージャ std::unique_ptr pMonitorManager /*{}*/; @@ -274,9 +303,6 @@ class MainApp // -V: パラメータ指定 std::vector> config_options {}; - - // --create-sram オプション - bool create_sram {}; }; // グローバルインスタンス