Fix bug in phi updater. Fix tests

This commit is contained in:
Alexey Andreev 2016-07-19 21:22:34 +03:00 committed by Alexey Andreev
parent e82518b88f
commit 6196dc80ed
11 changed files with 19 additions and 32 deletions

View File

@ -13,7 +13,7 @@
<option name="MAIN_CLASS_NAME" value="" /> <option name="MAIN_CLASS_NAME" value="" />
<option name="METHOD_NAME" value="" /> <option name="METHOD_NAME" value="" />
<option name="TEST_OBJECT" value="package" /> <option name="TEST_OBJECT" value="package" />
<option name="VM_PARAMETERS" value="-ea -Dteavm.junit.target=out -Dteavm.junit.js.runner=htmlunit -Dteavm.junit.js.threads=2" /> <option name="VM_PARAMETERS" value="-ea -Dteavm.junit.target=target/js-tests -Dteavm.junit.js.runner=htmlunit -Dteavm.junit.js.threads=2" />
<option name="PARAMETERS" value="" /> <option name="PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="file://$MODULE_DIR$" /> <option name="WORKING_DIRECTORY" value="file://$MODULE_DIR$" />
<option name="ENV_VARIABLES" /> <option name="ENV_VARIABLES" />

View File

@ -305,6 +305,9 @@ public class PhiUpdater {
for (int frontier : frontiers) { for (int frontier : frontiers) {
BasicBlock frontierBlock = program.basicBlockAt(frontier); BasicBlock frontierBlock = program.basicBlockAt(frontier);
if (frontierBlock.getExceptionVariable() == var) {
continue;
}
boolean exists = frontierBlock.getPhis().stream() boolean exists = frontierBlock.getPhis().stream()
.flatMap(phi -> phi.getIncomings().stream()) .flatMap(phi -> phi.getIncomings().stream())

View File

@ -598,7 +598,7 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
if (wasCancelled()) { if (wasCancelled()) {
return; return;
} }
final Devirtualization devirtualization = new Devirtualization(dependency, classes); Devirtualization devirtualization = new Devirtualization(dependency, classes);
int index = 0; int index = 0;
for (String className : classes.getClassNames()) { for (String className : classes.getClassNames()) {
ClassHolder cls = classes.get(className); ClassHolder cls = classes.get(className);
@ -613,7 +613,7 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
} }
} }
final Inlining inlining = new Inlining(); Inlining inlining = new Inlining();
for (String className : classes.getClassNames()) { for (String className : classes.getClassNames()) {
ClassHolder cls = classes.get(className); ClassHolder cls = classes.get(className);
for (final MethodHolder method : cls.getMethods()) { for (final MethodHolder method : cls.getMethods()) {

View File

@ -81,25 +81,25 @@ if (typeof 'ArrayBuffer' !== 'undefined') {
return new ($rt_arraycls(cls))(nativeArray); return new ($rt_arraycls(cls))(nativeArray);
}; };
$rt_createCharArray = function(sz) { $rt_createCharArray = function(sz) {
return $rt_createNumericArray($rt_charcls(), new Uint16Array(new ArrayBuffer(sz << 1)), 0); return $rt_createNumericArray($rt_charcls(), new Uint16Array(sz));
}; };
$rt_createByteArray = function(sz) { $rt_createByteArray = function(sz) {
return $rt_createNumericArray($rt_bytecls(), new Int8Array(new ArrayBuffer(sz)), 0); return $rt_createNumericArray($rt_bytecls(), new Int8Array(sz));
}; };
$rt_createShortArray = function(sz) { $rt_createShortArray = function(sz) {
return $rt_createNumericArray($rt_shortcls(), new Int16Array(new ArrayBuffer(sz << 1)), 0); return $rt_createNumericArray($rt_shortcls(), new Int16Array(sz));
}; };
$rt_createIntArray = function(sz) { $rt_createIntArray = function(sz) {
return $rt_createNumericArray($rt_intcls(), new Int32Array(new ArrayBuffer(sz << 2)), 0); return $rt_createNumericArray($rt_intcls(), new Int32Array(sz));
}; };
$rt_createBooleanArray = function(sz) { $rt_createBooleanArray = function(sz) {
return $rt_createNumericArray($rt_booleancls(), new Int8Array(new ArrayBuffer(sz)), 0); return $rt_createNumericArray($rt_booleancls(), new Int8Array(sz));
}; };
$rt_createFloatArray = function(sz) { $rt_createFloatArray = function(sz) {
return $rt_createNumericArray($rt_floatcls(), new Float32Array(new ArrayBuffer(sz << 2)), 0); return $rt_createNumericArray($rt_floatcls(), new Float32Array(sz));
}; };
$rt_createDoubleArray = function(sz) { $rt_createDoubleArray = function(sz) {
return $rt_createNumericArray($rt_doublecls(), new Float64Array(new ArrayBuffer(sz << 3)), 0); return $rt_createNumericArray($rt_doublecls(), new Float64Array(sz));
}; };
} else { } else {
$rt_createNumericArray = function(cls, sz) { $rt_createNumericArray = function(cls, sz) {

View File

@ -1,2 +0,0 @@
*.js
run-test.html

View File

@ -23,10 +23,6 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner; import org.teavm.junit.TeaVMTestRunner;
/**
*
* @author Alexey Andreev
*/
@RunWith(TeaVMTestRunner.class) @RunWith(TeaVMTestRunner.class)
public class BufferedReaderTest { public class BufferedReaderTest {
@Test @Test

View File

@ -19,11 +19,10 @@ import static org.junit.Assert.*;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner;
/** @RunWith(TeaVMTestRunner.class)
*
* @author Alexey Andreev
*/
public class ThreadTest { public class ThreadTest {
@Test @Test
public void sleeps() throws InterruptedException { public void sleeps() throws InterruptedException {

View File

@ -27,10 +27,6 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner; import org.teavm.junit.TeaVMTestRunner;
/**
*
* @author Alexey Andreev
*/
@RunWith(TeaVMTestRunner.class) @RunWith(TeaVMTestRunner.class)
public class TimeZoneTest { public class TimeZoneTest {
private static final int ONE_HOUR = 3600000; private static final int ONE_HOUR = 3600000;

View File

@ -23,10 +23,6 @@ import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.teavm.junit.TeaVMTestRunner; import org.teavm.junit.TeaVMTestRunner;
/**
*
* @author Alexey Andreev
*/
@RunWith(TeaVMTestRunner.class) @RunWith(TeaVMTestRunner.class)
public class GZIPInputStreamTest { public class GZIPInputStreamTest {
@Test @Test

View File

@ -21,10 +21,6 @@ import org.junit.runner.RunWith;
import org.teavm.junit.SkipJVM; import org.teavm.junit.SkipJVM;
import org.teavm.junit.TeaVMTestRunner; import org.teavm.junit.TeaVMTestRunner;
/**
*
* @author Alexey Andreev
*/
@RunWith(TeaVMTestRunner.class) @RunWith(TeaVMTestRunner.class)
@SkipJVM @SkipJVM
public class MetadataGeneratorTest { public class MetadataGeneratorTest {

View File

@ -19,8 +19,11 @@ import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import java.util.List; import java.util.List;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith;
import org.teavm.diagnostics.Problem; import org.teavm.diagnostics.Problem;
import org.teavm.jso.JSBody; import org.teavm.jso.JSBody;
import org.teavm.junit.SkipJVM;
import org.teavm.junit.TeaVMTestRunner;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.model.ValueType; import org.teavm.model.ValueType;
import org.teavm.vm.TeaVM; import org.teavm.vm.TeaVM;