This is the mail archive of the
mauve-patches@sourceware.org
mailing list for the Mauve project.
[verify] FYI: new tests for lazy verification
- From: Robert Schuster <theBohemian at gmx dot net>
- To: mauve-patches at sources dot redhat dot com
- Date: Mon, 14 Nov 2005 19:11:33 +0100
- Subject: [verify] FYI: new tests for lazy verification
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
these are some tests I wrote while making gcj's verifier more lazy.
2005-11-14 Robert Schuster <robertschuster@fsfe.org>
* newarray/pass/newarray1.j: New test.
* putstatic/fail/putstatic1.j: Dito.
* putstatic/pass/putstatic2.j: Dito.
* invoke/pass/invokestatic.j: Dito.
* invoke/pass/invokespecial.j: Dito.
* invoke/pass/invokevirtual.j: Dito.
* invoke/pass/invokenonvirtual.j: Dito.
The putstatic tests use the .field syntax as the sablevm version of jasmin needs
it. I dont know whether we want to keep them this way or not.
cu
Robert
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFDeNNVG9cfwmwwEtoRAgzpAJ45aOBF4sb7BukxnNqnt9EO5hp7LACglzIq
RstHPs5giz8PP7x3LnOH/LQ=
=mNkh
-----END PGP SIGNATURE-----
Index: invoke/pass/invokenonvirtual.j
===================================================================
RCS file: invoke/pass/invokenonvirtual.j
diff -N invoke/pass/invokenonvirtual.j
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ invoke/pass/invokenonvirtual.j 14 Nov 2005 18:04:01 -0000
@@ -0,0 +1,34 @@
+; invokenonvirtual.j - Invoke method nonvirtually.
+;
+; Copyright (C) 2002, 2005 Free Software Foundation
+; Written by Tom Tromey <tromey@redhat.com>
+; Written by Robert Schuster <robertschuster@fsfe.org>
+
+; Should pass the verifier
+
+.class invoke/pass/invokenonvirtual
+.super java/lang/Object
+
+.method public static doit()V
+.limit locals 2
+.limit stack 2
+
+ aconst_null
+
+ invokenonvirtual does/not/exist/Really/someFunkyMethod()V
+
+ return
+
+.end method
+
+; Boilerplate follows.
+
+.method public <init>()V
+ aload_0
+ invokenonvirtual java/lang/Object/<init>()V
+ return
+.end method
+
+.method public static main([Ljava/lang/String;)V
+ return
+.end method
Index: invoke/pass/invokespecial.j
===================================================================
RCS file: invoke/pass/invokespecial.j
diff -N invoke/pass/invokespecial.j
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ invoke/pass/invokespecial.j 14 Nov 2005 18:04:01 -0000
@@ -0,0 +1,34 @@
+; invokespecial.j - Invoke constructor.
+;
+; Copyright (C) 2002, 2005 Free Software Foundation
+; Written by Tom Tromey <tromey@redhat.com>
+; Written by Robert Schuster <robertschuster@fsfe.org>
+
+; Should pass the verifier
+
+.class invoke/pass/invokespecial
+.super java/lang/Object
+
+.method public static doit()V
+.limit locals 2
+.limit stack 2
+
+ new does/not/exist/Really
+ dup
+ invokespecial does/not/exist/Really/<init>()V
+
+ return
+
+.end method
+
+; Boilerplate follows.
+
+.method public <init>()V
+ aload_0
+ invokenonvirtual java/lang/Object/<init>()V
+ return
+.end method
+
+.method public static main([Ljava/lang/String;)V
+ return
+.end method
Index: invoke/pass/invokestatic.j
===================================================================
RCS file: invoke/pass/invokestatic.j
diff -N invoke/pass/invokestatic.j
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ invoke/pass/invokestatic.j 14 Nov 2005 18:04:01 -0000
@@ -0,0 +1,32 @@
+; invokestatic.j - Invoke static method.
+;
+; Copyright (C) 2002, 2005 Free Software Foundation
+; Written by Tom Tromey <tromey@redhat.com>
+; Written by Robert Schuster <robertschuster@fsfe.org>
+
+; Should pass the verifier
+
+.class invoke/pass/invokestatic
+.super java/lang/Object
+
+.method public static doit()V
+.limit locals 2
+.limit stack 2
+
+ invokestatic does/not/exist/Really/someFunkyMethod()V
+
+ return
+
+.end method
+
+; Boilerplate follows.
+
+.method public <init>()V
+ aload_0
+ invokenonvirtual java/lang/Object/<init>()V
+ return
+.end method
+
+.method public static main([Ljava/lang/String;)V
+ return
+.end method
Index: invoke/pass/invokevirtual.j
===================================================================
RCS file: invoke/pass/invokevirtual.j
diff -N invoke/pass/invokevirtual.j
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ invoke/pass/invokevirtual.j 14 Nov 2005 18:04:01 -0000
@@ -0,0 +1,34 @@
+; invokevirtual.j - Invoke method.
+;
+; Copyright (C) 2002, 2005 Free Software Foundation
+; Written by Tom Tromey <tromey@redhat.com>
+; Written by Robert Schuster <robertschuster@fsfe.org>
+
+; Should pass the verifier
+
+.class invoke/pass/invokevirtual
+.super java/lang/Object
+
+.method public static doit()V
+.limit locals 2
+.limit stack 2
+
+ aconst_null
+
+ invokevirtual does/not/exist/Really/someFunkyMethod()V
+
+ return
+
+.end method
+
+; Boilerplate follows.
+
+.method public <init>()V
+ aload_0
+ invokenonvirtual java/lang/Object/<init>()V
+ return
+.end method
+
+.method public static main([Ljava/lang/String;)V
+ return
+.end method
Index: putstatic/fail/putstatic1.j
===================================================================
RCS file: putstatic/fail/putstatic1.j
diff -N putstatic/fail/putstatic1.j
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ putstatic/fail/putstatic1.j 14 Nov 2005 18:04:01 -0000
@@ -0,0 +1,39 @@
+; putstatic2.j - Assignment to non-Object fields
+;
+; Copyright (C) 2002, 2005 Free Software Foundation
+; Written by Tom Tromey <tromey@redhat.com>
+; Written by Robert Schuster <robertschuster@fsfe.org>
+
+; Should not pass the verifier
+; NoClassDefFoundError for does.not.exist.Really
+
+.class putstatic/fail/putstatic1
+.super java/lang/Object
+
+.field private static "testfield" Ljava/lang/Thread;
+
+.method public static doit()V
+.limit locals 2
+.limit stack 2
+
+ new does/not/exist/Really
+ dup
+ invokespecial does/not/exist/Really/<init>()V
+
+ putstatic putstatic/fail/putstatic1/testfield Ljava/lang/Thread;
+
+ return
+
+.end method
+
+; Boilerplate follows.
+
+.method public <init>()V
+ aload_0
+ invokenonvirtual java/lang/Object/<init>()V
+ return
+.end method
+
+.method public static main([Ljava/lang/String;)V
+ return
+.end method
Index: putstatic/pass/putstatic2.j
===================================================================
RCS file: putstatic/pass/putstatic2.j
diff -N putstatic/pass/putstatic2.j
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ putstatic/pass/putstatic2.j 14 Nov 2005 18:04:01 -0000
@@ -0,0 +1,38 @@
+; putstatic1.j - Assignment to Object fields
+;
+; Copyright (C) 2002, 2005 Free Software Foundation
+; Written by Tom Tromey <tromey@redhat.com>
+; Written by Robert Schuster <robertschuster@fsfe.org>
+
+; Should pass the verifier
+
+.class putstatic/pass/putstatic2
+.super java/lang/Object
+
+.field private static "testfield" Ljava/lang/Object;
+
+.method public static doit()V
+.limit locals 2
+.limit stack 2
+
+ new does/not/exist/Really
+ dup
+ invokespecial does/not/exist/Really/<init>()V
+
+ putstatic putstatic/pass/putstatic2/testfield Ljava/lang/Object;
+
+ return
+
+.end method
+
+; Boilerplate follows.
+
+.method public <init>()V
+ aload_0
+ invokenonvirtual java/lang/Object/<init>()V
+ return
+.end method
+
+.method public static main([Ljava/lang/String;)V
+ return
+.end method
Index: newarray/pass/anewarray.j
===================================================================
RCS file: newarray/pass/anewarray.j
diff -N newarray/pass/anewarray.j
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ newarray/pass/anewarray.j 14 Nov 2005 18:04:01 -0000
@@ -0,0 +1,34 @@
+; Copyright (C) 2003 Jeroen Frijters
+; Copyright (C) 2005 Robert Schuster
+; Licensed under the GNU GPL
+
+; Should simply pass the verifier.
+
+.class public newarray/pass/anewarray
+.super java/lang/Object
+
+.method public <init>()V
+ .limit stack 8
+
+ aload_0
+ invokenonvirtual java/lang/Object/<init>()V
+ return
+.end method
+
+; A method that would create an array of a non-existing
+; class.
+.method public static notCalled([Ljava/lang/String;)V
+ .limit stack 5
+
+ sipush 200
+ anewarray definitely/not/exists/TrustMe
+
+ return
+.end method
+
+.method public static main([Ljava/lang/String;)V
+ .limit stack 5
+ .limit locals 4
+
+ return
+.end method