Hi,
in the below commit Geir has added several dozens files
under
drlvm/trunk/src/test
Since we have two directories on the top-level, build with build
system, and vm with everything else (sources, tests, documentation),
it seems very confusing to have 'src' directory at the top level.
Some time ago DRLVM team had very hot debates on directory structure,
and we ended up with following structure:
drlvm/trunk
+ vm
+ vmcore
+ jitrino
+ ... (other components)
+ doc (documentation)
+ tests (tests)
+ include (header files)
+ build (build system)
The tests that are now checked into src/test look like they are put to a
wrong place.
More correct place would be something like
vm/tests/verifier
Pavel, could you suggest a convenient place for your verifier tests?
--
Salikh Zakirov, Intel Middleware Products Division
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 02, 2006 8:31 PM
To: [EMAIL PROTECTED]
Subject: svn commit: r428043 - in
/incubator/harmony/enhanced/drlvm/trunk: src/test/verifier_aastore/
src/test/verifier_aastore/src/ src/test/verifier_empty_init/
src/test/verifier_empty_init/src/ vm/vmcore/src/verifier/
Author: geirm
Date: Wed Aug 2 09:30:51 2006
New Revision: 428043
URL: http://svn.apache.org/viewvc?rev=428043&view=rev
Log:
HARMONY-973
Add check for empty init method
Also added both test sets included in JIRA to
src/test for further integration
Added:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/HowTo.t
xt (with props)
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
t.java (with props)
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tAastore.java (with props)
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tAastore2.j
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tInterface.java (with props)
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/HowT
o.txt (with props)
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/src/
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/src/
Test.java (with props)
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/src/
TestEmptyInit.j
Modified:
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_datafl
ow.cpp
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.
cpp
Added:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/HowTo.t
xt
URL:
http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/src/
test/verifier_aastore/HowTo.txt?rev=428043&view=auto
========================================================================
======
---
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/HowTo.t
xt (added)
+++
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/HowTo.t
xt Wed Aug 2 09:30:51 2006
@@ -0,0 +1,14 @@
+How to compile and run test:
+
+1) To compile you need to have a Jasmin version 1.1.
+This can be downloaded from http://jasmin.sourceforge.net
+
+2) The Jasmin distribution contains a jasmin.jar file holding the
Jasmin assembler.
+To compile sources execute the following commands:
+
+$ java -jar <path to Jasmin 1.1>/jasmin.jar src/*.j
+$ javac -d . src/*.java
+
+3) To run test execute the following command:
+
+$ java Test
Propchange:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/HowTo.t
xt
------------------------------------------------------------------------
------
svn:eol-style = native
Added:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
t.java
URL:
http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/src/
test/verifier_aastore/src/Test.java?rev=428043&view=auto
========================================================================
======
---
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
t.java (added)
+++
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
t.java Wed Aug 2 09:30:51 2006
@@ -0,0 +1,14 @@
+public class Test {
+ public static void main(String[] args) {
+ // verify aastore instruction
+ try {
+ new TestAastore().test();
+ System.out.println("TestAastore: failed");
+ } catch (LinkageError e) {
+ System.out.println("TestAastore: passed: " + e);
+ } catch (Throwable e) {
+ System.out.println("TestAastore: failed: unexpected error "
+ e);
+ e.printStackTrace();
+ }
+ }
+}
\ No newline at end of file
Propchange:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
t.java
------------------------------------------------------------------------
------
svn:eol-style = native
Added:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tAastore.java
URL:
http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/src/
test/verifier_aastore/src/TestAastore.java?rev=428043&view=auto
========================================================================
======
---
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tAastore.java (added)
+++
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tAastore.java Wed Aug 2 09:30:51 2006
@@ -0,0 +1,11 @@
+public class TestAastore implements TestInterface {
+ public void test() {
+ TestAastore2 inst = new TestAastore2();
+ TestAastore[] array = new TestAastore[1];
+ inst.testField = array;
+ inst.test();
+ }
+ public void InterfaceMethod() {
+ return;
+ }
+}
\ No newline at end of file
Propchange:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tAastore.java
------------------------------------------------------------------------
------
svn:eol-style = native
Added:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tAastore2.j
URL:
http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/src/
test/verifier_aastore/src/TestAastore2.j?rev=428043&view=auto
========================================================================
======
---
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tAastore2.j (added)
+++
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tAastore2.j Wed Aug 2 09:30:51 2006
@@ -0,0 +1,30 @@
+.class public TestAastore2
+.super java/lang/Object
+.field public testField [LTestInterface;
+
+.method public <init>()V
+ aload_0
+ invokespecial java/lang/Object/<init>()V
+ return
+.end method
+
+.method public test()V
+ .limit stack 3
+ .limit locals 2
+
+ aload_0
+ getfield TestAastore2/testField [LTestInterface;
+ astore_1
+
+ sipush 1
+ sipush 1
+ multianewarray [[LTestAastore; 2
+ sipush 0
+
+ ; target of a aastore instruction not assignment compatible
+ ; with the class type specified in the instruction
+ aload_1
+ aastore
+
+ return
+.end method
Added:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tInterface.java
URL:
http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/src/
test/verifier_aastore/src/TestInterface.java?rev=428043&view=auto
========================================================================
======
---
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tInterface.java (added)
+++
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tInterface.java Wed Aug 2 09:30:51 2006
@@ -0,0 +1,3 @@
+public interface TestInterface {
+ public void InterfaceMethod();
+}
\ No newline at end of file
Propchange:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_aastore/src/Tes
tInterface.java
------------------------------------------------------------------------
------
svn:eol-style = native
Added:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/HowT
o.txt
URL:
http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/src/
test/verifier_empty_init/HowTo.txt?rev=428043&view=auto
========================================================================
======
---
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/HowT
o.txt (added)
+++
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/HowT
o.txt Wed Aug 2 09:30:51 2006
@@ -0,0 +1,14 @@
+How to compile and run test:
+
+1) To compile you need to have a Jasmin version 1.1.
+This can be downloaded from http://jasmin.sourceforge.net
+
+2) The Jasmin distribution contains a jasmin.jar file holding the
Jasmin assembler.
+To compile sources execute the following commands:
+
+$ java -jar <path to Jasmin 1.1>/jasmin.jar src/*.j
+$ javac -d . src/Test.java
+
+3) To run test execute the following command:
+
+$ java Test
Propchange:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/HowT
o.txt
------------------------------------------------------------------------
------
svn:eol-style = native
Added:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/src/
Test.java
URL:
http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/src/
test/verifier_empty_init/src/Test.java?rev=428043&view=auto
========================================================================
======
---
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/src/
Test.java (added)
+++
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/src/
Test.java Wed Aug 2 09:30:51 2006
@@ -0,0 +1,14 @@
+public class Test {
+ public static void main(String [] argv) {
+ // check empty init method
+ try {
+ Class cl = Class.forName("TestEmptyInit");
+ System.out.println("TestEmptyInit: Fails");
+ } catch (LinkageError e) {
+ System.out.println("TestEmptyInit: Passes: " + e);
+ } catch (Throwable e) {
+ System.out.println("TestEmptyInit: Failed, caught
unexpected exception");
+ e.printStackTrace(System.out);
+ }
+ }
+}
Propchange:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/src/
Test.java
------------------------------------------------------------------------
------
svn:eol-style = native
Added:
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/src/
TestEmptyInit.j
URL:
http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/src/
test/verifier_empty_init/src/TestEmptyInit.j?rev=428043&view=auto
========================================================================
======
---
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/src/
TestEmptyInit.j (added)
+++
incubator/harmony/enhanced/drlvm/trunk/src/test/verifier_empty_init/src/
TestEmptyInit.j Wed Aug 2 09:30:51 2006
@@ -0,0 +1,7 @@
+.class public TestEmptyInit
+.super java/lang/Object
+
+.method public <init>()V
+ ; empty init method w/o invokation to othe init method
+ return
+.end method
Modified:
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_datafl
ow.cpp
URL:
http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/v
mcore/src/verifier/ver_dataflow.cpp?rev=428043&r1=428042&r2=428043&view=
diff
========================================================================
======
---
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_datafl
ow.cpp (original)
+++
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_datafl
ow.cpp Wed Aug 2 09:30:51 2006
@@ -1115,6 +1115,19 @@
return VER_OK;
}
+ // check <init> method
+ if( !memcmp( method_get_name( ctex->m_method ), "<init>", 7 )
+ && ctex->m_vtype.m_class != ctex->m_vtype.m_object )
+ {
+ if( invector->m_local->m_type == SM_UNINITIALIZED ) {
+ VERIFY_REPORT( ctex, "(class: " << class_get_name(
ctex->m_class )
+ << ", method: " << method_get_name( ctex->m_method )
+ << method_get_descriptor( ctex->m_method )
+ << ") Constructor must be invoked" );
+ return VER_ErrorDataFlow;
+ }
+ }
+
// get first instruction
vf_Code_t *instr = &ctex->m_code[ctex->m_graph->GetNodeFirstInstr(
node_num )];
@@ -1336,7 +1349,7 @@
// fill "this" entry
const char *name = class_get_name( ctex->m_class );
vf_ValidType_t *type = vf_create_class_valid_type( name, ctex
);
- if( !strcmp( method_get_name( ctex->m_method ), "<init>" ) ) {
+ if( !memcmp( method_get_name( ctex->m_method ), "<init>", 7 ) )
{
vector->m_local->m_type = SM_UNINITIALIZED;
} else {
vector->m_local->m_type = SM_REF;
Modified:
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.
cpp
URL:
http://svn.apache.org/viewvc/incubator/harmony/enhanced/drlvm/trunk/vm/v
mcore/src/verifier/ver_utils.cpp?rev=428043&r1=428042&r2=428043&view=dif
f
========================================================================
======
---
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.
cpp (original)
+++
incubator/harmony/enhanced/drlvm/trunk/vm/vmcore/src/verifier/ver_utils.
cpp Wed Aug 2 09:30:51 2006
@@ -344,6 +344,7 @@
{
*out << "CONSTRAINT: have \""
<< constraint->source << "\" need \"" << constraint->target
<< "\" for method "
+ << class_get_name( method_get_class( m_method ) ) << "."
<< method_get_name( m_method ) << method_get_descriptor(
m_method ) << endl;
}
return;
@@ -411,10 +412,12 @@
VERIFY_TRACE( "constraint", "CONSTRAINT: for class \""
<< class_get_name( method_get_class( m_method ) ) << "\" CP
index #" << index
<< " check access: have \"" << source << "\" need \"" <<
target << "\" for method "
+ << class_get_name( method_get_class( m_method ) ) << "."
<< method_get_name( m_method ) << method_get_descriptor(
m_method ) );
} else {
VERIFY_TRACE( "constraint", "CONSTRAINT: have \""
<< source << "\" need \"" << target << "\" for method "
+ << class_get_name( method_get_class( m_method ) ) << "."
<< method_get_name( m_method ) << method_get_descriptor(
m_method ) );
}
return;
@@ -1222,7 +1225,7 @@
VERIFY_DEBUG( "verifying class " << class_get_name(
ctex->m_class )
<< " (method " << method_get_name( ctex->m_method )
<< method_get_descriptor( ctex->m_method )
- << ") couldn't resolve field by constant pool index #"
<< index );
+ << ") couldn't resolve field with constant pool index
#" << index );
return VER_OK;
}
if( field_is_protected( field ) ) {
@@ -1235,7 +1238,7 @@
VERIFY_DEBUG( "verifying class " << class_get_name(
ctex->m_class )
<< " (method " << method_get_name( ctex->m_method )
<< method_get_descriptor( ctex->m_method )
- << ") couldn't resolve method by constant pool index #"
<< index );
+ << ") couldn't resolve method with constant pool index
#" << index );
return VER_OK;
}
if( method_is_protected( method ) ) {
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]