CRuby can detect and de-optimize itself when methods such as Array#max are monkey patched. This involves maintaining a method table and setting flags in a global variable when important methods are redefined, ensuring optimized paths are avoided. This mechanism helps maintain performance and correctness in the presence of monkey patches.
Sort: