mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Fixes bugs
This commit is contained in:
parent
029e98d4a0
commit
808b0d9468
|
@ -82,7 +82,7 @@ class TAbstractStringBuilder extends TObject implements TSerializable, TCharSequ
|
||||||
}
|
}
|
||||||
buffer[length++] = (char)('0' + value);
|
buffer[length++] = (char)('0' + value);
|
||||||
} else {
|
} else {
|
||||||
int pos = 10;
|
long pos = 10;
|
||||||
int sz = 1;
|
int sz = 1;
|
||||||
while (pos < 1000000000000000000L && pos * 10 <= value) {
|
while (pos < 1000000000000000000L && pos * 10 <= value) {
|
||||||
pos *= 10;
|
pos *= 10;
|
||||||
|
|
|
@ -133,6 +133,7 @@ public class DependencyChecker {
|
||||||
if (e != null) {
|
if (e != null) {
|
||||||
throw exceptionOccured.get();
|
throw exceptionOccured.get();
|
||||||
}
|
}
|
||||||
|
executor.shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
void achieveClass(String className) {
|
void achieveClass(String className) {
|
||||||
|
|
|
@ -701,7 +701,7 @@ public class Renderer implements ExprVisitor, StatementVisitor {
|
||||||
} else if ((int)value == value) {
|
} else if ((int)value == value) {
|
||||||
return "Long_fromInt(" + value + ")";
|
return "Long_fromInt(" + value + ")";
|
||||||
} else {
|
} else {
|
||||||
return "new Long(" + (value & 0xFFFFFFFF) + ", " + (value >>> 32) + ")";
|
return "new Long(" + (value & 0xFFFFFFFFL) + ", " + (value >>> 32) + ")";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return cst.toString();
|
return cst.toString();
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.teavm.model.resource;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.teavm.common.Mapper;
|
import org.teavm.common.Mapper;
|
||||||
|
import org.teavm.javascript.ni.Remove;
|
||||||
import org.teavm.javascript.ni.Rename;
|
import org.teavm.javascript.ni.Rename;
|
||||||
import org.teavm.javascript.ni.Superclass;
|
import org.teavm.javascript.ni.Superclass;
|
||||||
import org.teavm.model.*;
|
import org.teavm.model.*;
|
||||||
|
@ -32,6 +33,9 @@ class ClassRefsRenamer implements InstructionVisitor {
|
||||||
}
|
}
|
||||||
renamedCls.setParent(parent != null ? classNameMapper.map(parent) : null);
|
renamedCls.setParent(parent != null ? classNameMapper.map(parent) : null);
|
||||||
for (MethodHolder method : cls.getMethods()) {
|
for (MethodHolder method : cls.getMethods()) {
|
||||||
|
if (method.getAnnotations().get(Remove.class.getName()) != null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
renamedCls.addMethod(rename(method));
|
renamedCls.addMethod(rename(method));
|
||||||
}
|
}
|
||||||
for (FieldHolder field : cls.getFields().toArray(new FieldHolder[0])) {
|
for (FieldHolder field : cls.getFields().toArray(new FieldHolder[0])) {
|
||||||
|
|
|
@ -69,21 +69,22 @@ public class ProgramParser {
|
||||||
|
|
||||||
private void prepareParameters(MethodNode method) {
|
private void prepareParameters(MethodNode method) {
|
||||||
int var = 0;
|
int var = 0;
|
||||||
|
int offset = 0;
|
||||||
if ((method.access & Opcodes.ACC_STATIC) == 0) {
|
if ((method.access & Opcodes.ACC_STATIC) == 0) {
|
||||||
getVariable(var++);
|
getVariable(var++);
|
||||||
|
++offset;
|
||||||
}
|
}
|
||||||
ValueType[] desc = MethodDescriptor.parse(method.desc).getParameterTypes();
|
ValueType[] desc = MethodDescriptor.parse(method.desc).getParameterTypes();
|
||||||
int mappedLocal = 0;
|
localsMap = new int[desc.length * 2 + 1];
|
||||||
localsMap = new int[desc.length * 2];
|
|
||||||
for (int i = 0; i < desc.length; ++i) {
|
for (int i = 0; i < desc.length; ++i) {
|
||||||
ValueType paramType = desc[i];
|
ValueType paramType = desc[i];
|
||||||
localsMap[mappedLocal++] = i;
|
localsMap[var] = i + offset;
|
||||||
getVariable(var++);
|
getVariable(var++);
|
||||||
if (paramType instanceof ValueType.Primitive) {
|
if (paramType instanceof ValueType.Primitive) {
|
||||||
switch (((ValueType.Primitive)paramType).getKind()) {
|
switch (((ValueType.Primitive)paramType).getKind()) {
|
||||||
case LONG:
|
case LONG:
|
||||||
case DOUBLE:
|
case DOUBLE:
|
||||||
localsMap[mappedLocal++] = i;
|
localsMap[var] = i + offset;
|
||||||
getVariable(var++);
|
getVariable(var++);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -91,7 +92,7 @@ public class ProgramParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
localsMap = Arrays.copyOf(localsMap, mappedLocal);
|
localsMap = Arrays.copyOf(localsMap, var);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepare(MethodNode method) {
|
private void prepare(MethodNode method) {
|
||||||
|
|
|
@ -255,7 +255,7 @@ Long = function(lo, hi) {
|
||||||
}
|
}
|
||||||
Long_ZERO = new Long(0, 0);
|
Long_ZERO = new Long(0, 0);
|
||||||
Long_fromInt = function(val) {
|
Long_fromInt = function(val) {
|
||||||
return new Long(val, 0);
|
return val >= 0 ? new Long(val, 0) : new Long(val, -1);
|
||||||
}
|
}
|
||||||
Long_fromNumber = function(val) {
|
Long_fromNumber = function(val) {
|
||||||
return new Long(val | 0, (val / 0x100000000) | 0);
|
return new Long(val | 0, (val / 0x100000000) | 0);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user