mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2025-01-09 08:24:10 -08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
02f140ef30
|
@ -508,6 +508,9 @@ public class TString extends TObject implements TSerializable, TComparable<TStri
|
||||||
if (this == other) {
|
if (this == other) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
if (other == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (length() != other.length()) {
|
if (length() != other.length()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,10 +56,9 @@ public final class TSystem extends TObject {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static TString getProperty(@SuppressWarnings("unused") TString key,
|
public static TString getProperty(TString key, TString def) {
|
||||||
@SuppressWarnings("unused") TString def) {
|
TString value = getProperty(key);
|
||||||
// TODO: make implementation
|
return value != null ? value : def;
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GeneratedBy(SystemNativeGenerator.class)
|
@GeneratedBy(SystemNativeGenerator.class)
|
||||||
|
|
|
@ -21,7 +21,7 @@ package org.teavm.classlib.java.nio;
|
||||||
*/
|
*/
|
||||||
public final class TByteOrder {
|
public final class TByteOrder {
|
||||||
public static final TByteOrder BIG_ENDIAN = new TByteOrder("BIG_ENDIAN");
|
public static final TByteOrder BIG_ENDIAN = new TByteOrder("BIG_ENDIAN");
|
||||||
public static final TByteOrder LITTLE_ENDIAN = new TByteOrder("BIG_ENDIAN");
|
public static final TByteOrder LITTLE_ENDIAN = new TByteOrder("LITTLE_ENDIAN");
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
private TByteOrder(String name) {
|
private TByteOrder(String name) {
|
||||||
|
|
|
@ -244,28 +244,29 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
||||||
writer.ws().append("});").newLine().outdent();
|
writer.ws().append("});").newLine().outdent();
|
||||||
List<MethodNode> nonInitMethods = new ArrayList<>();
|
List<MethodNode> nonInitMethods = new ArrayList<>();
|
||||||
List<MethodNode> virtualMethods = new ArrayList<>();
|
List<MethodNode> virtualMethods = new ArrayList<>();
|
||||||
|
|
||||||
|
writer.append("function ").appendClass(cls.getName()).append("_$clinit()").ws()
|
||||||
|
.append("{").softNewLine().indent();
|
||||||
|
writer.appendClass(cls.getName()).append("_$clinit").ws().append("=").ws()
|
||||||
|
.append("function(){};").newLine();
|
||||||
|
List<String> stubNames = new ArrayList<>();
|
||||||
|
for (MethodNode method : cls.getMethods()) {
|
||||||
|
if (!method.getModifiers().contains(NodeModifier.STATIC) &&
|
||||||
|
!method.getReference().getName().equals("<init>")) {
|
||||||
|
nonInitMethods.add(method);
|
||||||
|
} else {
|
||||||
|
renderBody(method, true);
|
||||||
|
stubNames.add(naming.getFullNameFor(method.getReference()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
MethodHolder methodHolder = classSource.get(cls.getName()).getMethod(
|
||||||
|
new MethodDescriptor("<clinit>", ValueType.VOID));
|
||||||
|
if (methodHolder != null) {
|
||||||
|
writer.appendMethodBody(new MethodReference(cls.getName(), methodHolder.getDescriptor()))
|
||||||
|
.append("();").softNewLine();
|
||||||
|
}
|
||||||
|
writer.outdent().append("}").newLine();
|
||||||
if (!cls.getModifiers().contains(NodeModifier.INTERFACE)) {
|
if (!cls.getModifiers().contains(NodeModifier.INTERFACE)) {
|
||||||
writer.append("function ").appendClass(cls.getName()).append("_$clinit()").ws()
|
|
||||||
.append("{").softNewLine().indent();
|
|
||||||
writer.appendClass(cls.getName()).append("_$clinit").ws().append("=").ws()
|
|
||||||
.append("function(){};").newLine();
|
|
||||||
List<String> stubNames = new ArrayList<>();
|
|
||||||
for (MethodNode method : cls.getMethods()) {
|
|
||||||
if (!method.getModifiers().contains(NodeModifier.STATIC) &&
|
|
||||||
!method.getReference().getName().equals("<init>")) {
|
|
||||||
nonInitMethods.add(method);
|
|
||||||
} else {
|
|
||||||
renderBody(method, true);
|
|
||||||
stubNames.add(naming.getFullNameFor(method.getReference()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
MethodHolder methodHolder = classSource.get(cls.getName()).getMethod(
|
|
||||||
new MethodDescriptor("<clinit>", ValueType.VOID));
|
|
||||||
if (methodHolder != null) {
|
|
||||||
writer.appendMethodBody(new MethodReference(cls.getName(), methodHolder.getDescriptor()))
|
|
||||||
.append("();").softNewLine();
|
|
||||||
}
|
|
||||||
writer.outdent().append("}").newLine();
|
|
||||||
for (MethodNode method : cls.getMethods()) {
|
for (MethodNode method : cls.getMethods()) {
|
||||||
cls.getMethods();
|
cls.getMethods();
|
||||||
if (!method.getModifiers().contains(NodeModifier.STATIC)) {
|
if (!method.getModifiers().contains(NodeModifier.STATIC)) {
|
||||||
|
@ -286,6 +287,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
||||||
writer.append("]);").newLine();
|
writer.append("]);").newLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (MethodNode method : nonInitMethods) {
|
for (MethodNode method : nonInitMethods) {
|
||||||
renderBody(method, false);
|
renderBody(method, false);
|
||||||
}
|
}
|
||||||
|
@ -880,14 +882,14 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
||||||
writer.append(')');
|
writer.append(')');
|
||||||
break;
|
break;
|
||||||
case BYTE_TO_INT:
|
case BYTE_TO_INT:
|
||||||
writer.append("$rt_byteToInt(");
|
writer.append("((");
|
||||||
expr.getOperand().acceptVisitor(this);
|
expr.getOperand().acceptVisitor(this);
|
||||||
writer.append(')');
|
writer.ws().append("<<").ws().append("24)").ws().append(">>").ws().append("24)");
|
||||||
break;
|
break;
|
||||||
case SHORT_TO_INT:
|
case SHORT_TO_INT:
|
||||||
writer.append("$rt_shortToInt(");
|
writer.append("((");
|
||||||
expr.getOperand().acceptVisitor(this);
|
expr.getOperand().acceptVisitor(this);
|
||||||
writer.append(')');
|
writer.ws().append("<<").ws().append("16)").ws().append(">>").ws().append("16)");
|
||||||
break;
|
break;
|
||||||
case NULL_CHECK:
|
case NULL_CHECK:
|
||||||
writer.append("$rt_nullCheck(");
|
writer.append("$rt_nullCheck(");
|
||||||
|
|
|
@ -201,19 +201,6 @@ $rt_voidcls = function() {
|
||||||
}
|
}
|
||||||
return $rt_voidclsCache;
|
return $rt_voidclsCache;
|
||||||
}
|
}
|
||||||
$rt_equals = function(a, b) {
|
|
||||||
if (a === b) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (a === null || b === null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (typeof(a) == 'object') {
|
|
||||||
return a.equals(b);
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$rt_clinit = function(cls) {
|
$rt_clinit = function(cls) {
|
||||||
if (cls.$clinit) {
|
if (cls.$clinit) {
|
||||||
var f = cls.$clinit;
|
var f = cls.$clinit;
|
||||||
|
@ -236,12 +223,6 @@ $rt_throw = function(ex) {
|
||||||
}
|
}
|
||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
$rt_byteToInt = function(value) {
|
|
||||||
return value > 0xFF ? value | 0xFFFFFF00 : value;
|
|
||||||
}
|
|
||||||
$rt_shortToInt = function(value) {
|
|
||||||
return value > 0xFFFF ? value | 0xFFFF0000 : value;
|
|
||||||
}
|
|
||||||
$rt_createMultiArray = function(cls, dimensions) {
|
$rt_createMultiArray = function(cls, dimensions) {
|
||||||
var arrays = new Array($rt_primitiveArrayCount(dimensions));
|
var arrays = new Array($rt_primitiveArrayCount(dimensions));
|
||||||
var firstDim = dimensions[0] | 0;
|
var firstDim = dimensions[0] | 0;
|
||||||
|
@ -546,6 +527,7 @@ Long_xor = function(a, b) {
|
||||||
return new Long(a.lo ^ b.lo, a.hi ^ b.hi);
|
return new Long(a.lo ^ b.lo, a.hi ^ b.hi);
|
||||||
}
|
}
|
||||||
Long_shl = function(a, b) {
|
Long_shl = function(a, b) {
|
||||||
|
b &= 63;
|
||||||
if (b < 32) {
|
if (b < 32) {
|
||||||
return new Long(a.lo << b, (a.lo >>> (32 - b)) | (a.hi << b));
|
return new Long(a.lo << b, (a.lo >>> (32 - b)) | (a.hi << b));
|
||||||
} else {
|
} else {
|
||||||
|
@ -553,10 +535,11 @@ Long_shl = function(a, b) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Long_shr = function(a, b) {
|
Long_shr = function(a, b) {
|
||||||
|
b &= 63;
|
||||||
if (b < 32) {
|
if (b < 32) {
|
||||||
return new Long((a.lo >>> b) | (a.hi << (32 - b)), a.hi >> b);
|
return new Long((a.lo >>> b) | (a.hi << (32 - b)), a.hi >> b);
|
||||||
} else {
|
} else {
|
||||||
return new Long((a.hi >> (b - 32)), -1);
|
return new Long((a.hi >> (b - 32)), a.hi >> 31);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Long_shru = function(a, b) {
|
Long_shru = function(a, b) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user