mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
4701250154
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 Alexey Andreev.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.teavm.classlib.java.lang;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||||
|
*/
|
||||||
|
public class TIncompatibleClassChangeError extends TLinkageError {
|
||||||
|
private static final long serialVersionUID = 366119408566298082L;
|
||||||
|
|
||||||
|
public TIncompatibleClassChangeError() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TIncompatibleClassChangeError(TString message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 Alexey Andreev.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.teavm.classlib.java.lang;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||||
|
*/
|
||||||
|
public class TNoSuchFieldError extends TIncompatibleClassChangeError {
|
||||||
|
private static final long serialVersionUID = 7907885242472547035L;
|
||||||
|
|
||||||
|
public TNoSuchFieldError() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TNoSuchFieldError(TString message) {
|
||||||
|
super(message);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 Alexey Andreev.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.teavm.classlib.java.util;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import org.teavm.codegen.SourceWriter;
|
||||||
|
import org.teavm.javascript.ni.Generator;
|
||||||
|
import org.teavm.javascript.ni.GeneratorContext;
|
||||||
|
import org.teavm.model.MethodReference;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||||
|
*/
|
||||||
|
public class RandomNativeGenerator implements Generator {
|
||||||
|
@Override
|
||||||
|
public void generate(GeneratorContext context, SourceWriter writer, MethodReference methodRef) throws IOException {
|
||||||
|
writer.append("return Math.random();").softNewLine();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
/*
|
||||||
|
* Copyright 2014 Alexey Andreev.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
package org.teavm.classlib.java.util;
|
||||||
|
|
||||||
|
import org.teavm.classlib.java.io.TSerializable;
|
||||||
|
import org.teavm.classlib.java.lang.TMath;
|
||||||
|
import org.teavm.classlib.java.lang.TObject;
|
||||||
|
import org.teavm.javascript.ni.GeneratedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Alexey Andreev <konsoletyper@gmail.com>
|
||||||
|
*/
|
||||||
|
public class TRandom extends TObject implements TSerializable {
|
||||||
|
public TRandom() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public TRandom(@SuppressWarnings("unused") long seed) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSeed(@SuppressWarnings("unused") long seed) {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected int next(int bits) {
|
||||||
|
return (int)(random() * (1 << TMath.min(32, bits)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void nextBytes(byte[] bytes) {
|
||||||
|
for (int i = 0; i < bytes.length; ) {
|
||||||
|
bytes[i] = (byte)next(8);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public int nextInt() {
|
||||||
|
return next(32);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int nextInt(int n) {
|
||||||
|
return (int)(random() * n);
|
||||||
|
}
|
||||||
|
|
||||||
|
public long nextLong() {
|
||||||
|
return ((long)nextInt() << 32) | nextInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean nextBoolean() {
|
||||||
|
return nextInt() % 2 == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float nextFloat() {
|
||||||
|
return (float)random();
|
||||||
|
}
|
||||||
|
|
||||||
|
public double nextDouble() {
|
||||||
|
return random();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GeneratedBy(RandomNativeGenerator.class)
|
||||||
|
private static native double random();
|
||||||
|
}
|
|
@ -86,7 +86,6 @@ public class LoopGraph implements Graph {
|
||||||
LoopFrame rootFrame = new LoopFrame();
|
LoopFrame rootFrame = new LoopFrame();
|
||||||
stack[stackSize++] = rootFrame;
|
stack[stackSize++] = rootFrame;
|
||||||
int walkIndex = 0;
|
int walkIndex = 0;
|
||||||
int[] targetEdges = new int[sz];
|
|
||||||
int lastSortIndex = sz - 1;
|
int lastSortIndex = sz - 1;
|
||||||
int loopSetSize = 0;
|
int loopSetSize = 0;
|
||||||
while (stackSize > 0) {
|
while (stackSize > 0) {
|
||||||
|
@ -95,8 +94,8 @@ public class LoopGraph implements Graph {
|
||||||
frames[frame.index] = frame;
|
frames[frame.index] = frame;
|
||||||
frame.walkIndex = walkIndex++;
|
frame.walkIndex = walkIndex++;
|
||||||
stack[stackSize++] = frame;
|
stack[stackSize++] = frame;
|
||||||
int targetEdgesCount = graph.copyOutgoingEdges(frame.index, targetEdges);
|
int[] targetEdges = graph.outgoingEdges(frame.index);
|
||||||
for (int i = 0; i < targetEdgesCount; ++i) {
|
for (int i = 0; i < targetEdges.length; ++i) {
|
||||||
int next = targetEdges[i];
|
int next = targetEdges[i];
|
||||||
LoopFrame nextFrame = frames[next];
|
LoopFrame nextFrame = frames[next];
|
||||||
if (nextFrame == null) {
|
if (nextFrame == null) {
|
||||||
|
@ -109,8 +108,8 @@ public class LoopGraph implements Graph {
|
||||||
frame.sortIndex = lastSortIndex--;
|
frame.sortIndex = lastSortIndex--;
|
||||||
frame.done = true;
|
frame.done = true;
|
||||||
LoopImpl bestLoop = null;
|
LoopImpl bestLoop = null;
|
||||||
int targetEdgesCount = graph.copyOutgoingEdges(frame.index, targetEdges);
|
int[] targetEdges = graph.outgoingEdges(frame.index);
|
||||||
for (int i = 0; i < targetEdgesCount; ++i) {
|
for (int i = 0; i < targetEdges.length; ++i) {
|
||||||
int next = targetEdges[i];
|
int next = targetEdges[i];
|
||||||
LoopFrame nextFrame = frames[next];
|
LoopFrame nextFrame = frames[next];
|
||||||
LoopImpl loop = nextFrame.loop;
|
LoopImpl loop = nextFrame.loop;
|
||||||
|
|
|
@ -38,6 +38,12 @@
|
||||||
<groupId>org.netbeans.html</groupId>
|
<groupId>org.netbeans.html</groupId>
|
||||||
<artifactId>net.java.html.boot</artifactId>
|
<artifactId>net.java.html.boot</artifactId>
|
||||||
<version>0.8-SNAPSHOT</version>
|
<version>0.8-SNAPSHOT</version>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>org.ow2.asm</groupId>
|
||||||
|
<artifactId>asm</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.netbeans.html</groupId>
|
<groupId>org.netbeans.html</groupId>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user