зеркало из https://github.com/mozilla/pluotsorbet.git
TSify vm.js and rename to interpreter.
This commit is contained in:
Родитель
e2cedafd6e
Коммит
017608e78c
|
@ -1,6 +1,5 @@
|
|||
module J2ME.Bytecode {
|
||||
import assert = Debug.assert;
|
||||
import Operator = C4.IR.Operator;
|
||||
|
||||
export class Bytes {
|
||||
/**
|
||||
|
@ -112,18 +111,6 @@ module J2ME.Bytecode {
|
|||
NOF
|
||||
}
|
||||
|
||||
export function conditionToOperator(condition: Condition): Operator {
|
||||
switch (condition) {
|
||||
case Condition.EQ: return Operator.EQ;
|
||||
case Condition.NE: return Operator.NE;
|
||||
case Condition.LT: return Operator.LT;
|
||||
case Condition.LE: return Operator.LE;
|
||||
case Condition.GT: return Operator.GT;
|
||||
case Condition.GE: return Operator.GE;
|
||||
default: throw "TODO"
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The definitions of the bytecodes that are valid input to the compiler and
|
||||
* related utility methods. This comprises two groups: the standard Java
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -51,6 +51,18 @@ module J2ME {
|
|||
declare var Long: any;
|
||||
declare var VM: any;
|
||||
|
||||
function conditionToOperator(condition: Condition): Operator {
|
||||
switch (condition) {
|
||||
case Condition.EQ: return Operator.EQ;
|
||||
case Condition.NE: return Operator.NE;
|
||||
case Condition.LT: return Operator.LT;
|
||||
case Condition.LE: return Operator.LE;
|
||||
case Condition.GT: return Operator.GT;
|
||||
case Condition.GE: return Operator.GE;
|
||||
default: throw "TODO"
|
||||
}
|
||||
}
|
||||
|
||||
export function isTwoSlot(kind: Kind) {
|
||||
return kind === Kind.Long || kind === Kind.Double;
|
||||
}
|
||||
|
@ -1028,20 +1040,20 @@ module J2ME {
|
|||
this.state.apush(Null);
|
||||
var y = this.state.apop();
|
||||
var x = this.state.apop();
|
||||
this.genIf(stream, new IR.Binary(Bytecode.conditionToOperator(condition), x, y));
|
||||
this.genIf(stream, new IR.Binary(conditionToOperator(condition), x, y));
|
||||
}
|
||||
|
||||
genIfSame(stream: BytecodeStream, kind: Kind, condition: Condition) {
|
||||
var y = this.state.pop(kind);
|
||||
var x = this.state.pop(kind);
|
||||
this.genIf(stream, new IR.Binary(Bytecode.conditionToOperator(condition), x, y));
|
||||
this.genIf(stream, new IR.Binary(conditionToOperator(condition), x, y));
|
||||
}
|
||||
|
||||
genIfZero(stream: BytecodeStream, condition: Condition) {
|
||||
this.state.ipush(genConstant(0, Kind.Int));
|
||||
var y = this.state.ipop();
|
||||
var x = this.state.ipop();
|
||||
this.genIf(stream, new IR.Binary(Bytecode.conditionToOperator(condition), x, y));
|
||||
this.genIf(stream, new IR.Binary(conditionToOperator(condition), x, y));
|
||||
}
|
||||
|
||||
genCompareOp(kind: Kind, isLessThan: boolean) {
|
||||
|
|
2
jsc.ts
2
jsc.ts
|
@ -70,7 +70,7 @@ module J2ME {
|
|||
loadFiles("libs/zipfile.js", "build/j2me.js", "classfile/classfile.js",
|
||||
"classfile/reader.js", "classfile/tags.js", "classfile/attributetypes.js",
|
||||
"libs/encoding.js", "util.js", "frame.js",
|
||||
"classfile/accessflags.js", "instrument.js", "vm.js", "signature.js", "opcodes.js",
|
||||
"classfile/accessflags.js", "instrument.js", "signature.js", "opcodes.js",
|
||||
"override.js", "native.js", "string.js", "libs/console.js", "midp/midp.js",
|
||||
"libs/long.js", "midp/crypto.js", "libs/forge/md5.js", "libs/forge/util.js");
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ try {
|
|||
load("libs/zipfile.js", "build/j2me.js", "classfile/classfile.js",
|
||||
"classfile/reader.js", "classfile/tags.js", "classfile/attributetypes.js",
|
||||
"libs/encoding.js", "util.js", "frame.js",
|
||||
"classfile/accessflags.js", "instrument.js", "vm.js", "signature.js", "opcodes.js",
|
||||
"classfile/accessflags.js", "instrument.js", "signature.js", "opcodes.js",
|
||||
"override.js", "native.js", "string.js", "libs/console.js", "midp/midp.js",
|
||||
"libs/long.js", "midp/crypto.js", "libs/forge/md5.js", "libs/forge/util.js", "build/compiled.js");
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
<script type="text/javascript" src="native.js" defer></script>
|
||||
<script type="text/javascript" src="string.js" defer></script>
|
||||
<script type="text/javascript" src="frame.js" defer></script>
|
||||
<script type="text/javascript" src="vm.js" defer></script>
|
||||
<script type="text/javascript" src="instrument.js" defer></script>
|
||||
<script type="text/javascript" src="libs/zipfile.js" defer></script>
|
||||
<script type="text/javascript" src="libs/long.js" defer></script>
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
///<reference path='utilities.ts' />
|
||||
///<reference path='options.ts' />
|
||||
///<reference path='metrics.ts' />
|
||||
///<reference path='bytecodes.ts' />
|
||||
///<reference path='types.ts' />
|
||||
///<reference path='classRegistry.ts' />
|
||||
///<reference path='jvm.ts' />
|
||||
///<reference path='interpreter.ts' />
|
||||
///<reference path='actors.ts' />
|
||||
///<reference path='runtime.ts' />
|
||||
///<reference path='context.ts' />
|
||||
|
@ -18,7 +20,6 @@
|
|||
///<reference path='jit/c4/ast.ts' />
|
||||
///<reference path='jit/c4/looper.ts' />
|
||||
///<reference path='jit/c4/backend.ts' />
|
||||
///<reference path='jit/bytecodes.ts' />
|
||||
///<reference path='jit/jvm.ir.ts' />
|
||||
///<reference path='jit/blockMap.ts' />
|
||||
///<reference path='jit/builder.ts' />
|
||||
|
|
21
runtime.ts
21
runtime.ts
|
@ -2,6 +2,10 @@ var $: J2ME.Runtime; // The currently-executing runtime.
|
|||
|
||||
var runtimeTemplate = {};
|
||||
|
||||
interface Math {
|
||||
fround(value: number): number;
|
||||
}
|
||||
|
||||
module J2ME {
|
||||
declare var Native, Override;
|
||||
declare var VM;
|
||||
|
@ -565,23 +569,6 @@ module J2ME {
|
|||
return value;
|
||||
};
|
||||
}
|
||||
|
||||
consoleWriter.outdent();
|
||||
//if (typeof CC !== "undefined") {
|
||||
// var compiledMethod = null;
|
||||
// var classMangledName = J2ME.C4.Backend.mangleClass(this.classInfo);
|
||||
// var compiledClass = CC[classMangledName];
|
||||
// if (compiledClass) {
|
||||
// var methodMangledName = J2ME.C4.Backend.mangleMethod(this);
|
||||
// compiledMethod = compiledClass.methods[methodMangledName];
|
||||
// if (this.isStatic) {
|
||||
// jsGlobal[methodMangledName] = compiledMethod;
|
||||
// }
|
||||
// console.log("HERE: " + compiledMethod + " : ");
|
||||
//
|
||||
// }
|
||||
// this.fn = compiledMethod;
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
1099
vm.js
1099
vm.js
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче