x86: Improve check_stack_align() error message

Make the error more readable and add information about number of
arguments passed on the stack:

  [penberg@tux jruby-1.7.3]$ jato -Xdebug:stack -jar lib/jruby.jar  -v
  Error: stack is 8 bytes misaligned when entering function:

    gnu/java/net/loader/JarURLLoader.<init>(Ljava/net/URLClassLoader;Lgnu/java/net/loader/URLStreamHandlerCache;Ljava/net/URLStreamHandlerFactory;Ljava/net/URL;Ljava/net/URL;)V.

  which has 0 arguments passed on the stack.
  Aborted

Signed-off-by: Pekka Enberg <penberg@kernel.org>
diff --git a/arch/x86/debug.c b/arch/x86/debug.c
index e73ab16..5f83f61 100644
--- a/arch/x86/debug.c
+++ b/arch/x86/debug.c
@@ -3,6 +3,7 @@
 #include "arch/stack-frame.h"
 #include "vm/method.h"
 #include "vm/class.h"
+#include "jit/args.h"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -14,10 +15,16 @@
 #else
 	register unsigned long fp __asm__("rbp");
 #endif
+	unsigned long nr_stack_args;
+
+	nr_stack_args = get_stack_args_count(vmm);
 
 	if (fp % X86_STACK_ALIGN != 0) {
-		fprintf(stderr, "Error: stack is %lu bytes misaligned when entering %s.%s%s.\n",
-				fp % X86_STACK_ALIGN, vmm->class->name, vmm->name, vmm->type);
+		fprintf(stderr,
+			"Error: stack is %lu bytes misaligned when entering function:"
+			"\n\n  %s.%s%s.\n\n"
+			"which has %lu arguments passed on the stack.\n",
+			fp % X86_STACK_ALIGN, vmm->class->name, vmm->name, vmm->type, nr_stack_args);
 		abort();
 	}
 }