Incorrect result of compareTo between empty and non-empty strings
Current implementation of the Strings.compareTo() handles the case when
empty string compares to non-empty string in the wrong way.
This patch adds handler for such cases.
Change-Id: I35cc2cfd5141551d6da65748c44b59e64a3f8117
Signed-off-by: Alexei Zavjalov <alexei.zavjalov@intel.com>
diff --git a/runtime/arch/x86/quick_entrypoints_x86.S b/runtime/arch/x86/quick_entrypoints_x86.S
index b1f2275..8683a56 100644
--- a/runtime/arch/x86/quick_entrypoints_x86.S
+++ b/runtime/arch/x86/quick_entrypoints_x86.S
@@ -1307,8 +1307,10 @@
* esi: pointer to this string data
* edi: pointer to comp string data
*/
+ jecxz .Lkeep_length
repe cmpsw // find nonmatching chars in [%esi] and [%edi], up to length %ecx
jne .Lnot_equal
+.Lkeep_length:
POP edi // pop callee save reg
POP esi // pop callee save reg
ret