Fix bytecode generator following Buffer api change.
This commit is contained in:
60
README.html
60
README.html
@@ -67,6 +67,7 @@ at improving on the 1.0 vm in the following aspects.
|
|||||||
<li>Improved class and package naming conventions.
|
<li>Improved class and package naming conventions.
|
||||||
<li>Improved unit tests of core classes.
|
<li>Improved unit tests of core classes.
|
||||||
<li>Improved quality due to major redesign and rewrite of core elements.
|
<li>Improved quality due to major redesign and rewrite of core elements.
|
||||||
|
<li>Improved weak table support, including weak keys.
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h1>2 - <a name="2">Simple Examples</a></h1>
|
<h1>2 - <a name="2">Simple Examples</a></h1>
|
||||||
@@ -193,6 +194,31 @@ An ant script to build and run the midlet is in
|
|||||||
<p>
|
<p>
|
||||||
You must install the wireless toolkit and define <em>WTK_HOME</em> for this script to work.
|
You must install the wireless toolkit and define <em>WTK_HOME</em> for this script to work.
|
||||||
|
|
||||||
|
<h2>Run a script using JSR-233 Dynamic Scripting</h2>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
The standard use of JSR-233 scripting engines may be used:
|
||||||
|
|
||||||
|
<pre>
|
||||||
|
ScriptEngineManager mgr = new ScriptEngineManager();
|
||||||
|
ScriptEngine e = mgr.getEngineByExtension(".lua");
|
||||||
|
e.put("x", 25);
|
||||||
|
e.eval("y = math.sqrt(x)");
|
||||||
|
System.out.println( "y="+e.get("y") );
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
All standard aspects of script engines including compiled statements should be supported.
|
||||||
|
|
||||||
|
<p>
|
||||||
|
You must include the library <b>lib/luaj-jse-2.0.jar</b> in your class path.
|
||||||
|
|
||||||
|
<p>
|
||||||
|
A working example may be found in
|
||||||
|
<pre>
|
||||||
|
examples/jse/ScriptEngineSample.java
|
||||||
|
</pre>
|
||||||
|
|
||||||
<h2>Excluding the lua bytecode compiler</h2>
|
<h2>Excluding the lua bytecode compiler</h2>
|
||||||
|
|
||||||
By default, the compiler is included whenever <em>standardGlobals()</em> or <em>debugGlobals()</em> are called.
|
By default, the compiler is included whenever <em>standardGlobals()</em> or <em>debugGlobals()</em> are called.
|
||||||
@@ -239,31 +265,6 @@ lua source or lua binary files.
|
|||||||
<p>
|
<p>
|
||||||
The <em>bcel</em> library must be on the class path for this to work.
|
The <em>bcel</em> library must be on the class path for this to work.
|
||||||
|
|
||||||
<h2>Run a script using JSR-233 Dynamic Scripting</h2>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
The standard use of JSR-233 scripting engines may be used:
|
|
||||||
|
|
||||||
<pre>
|
|
||||||
ScriptEngineManager mgr = new ScriptEngineManager();
|
|
||||||
ScriptEngine e = mgr.getEngineByExtension(".lua");
|
|
||||||
e.put("x", 25);
|
|
||||||
e.eval("y = math.sqrt(x)");
|
|
||||||
System.out.println( "y="+e.get("y") );
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
All standard aspects of script engines including compiled statements should be supported.
|
|
||||||
|
|
||||||
<p>
|
|
||||||
You must include the library <b>lib/luaj-jse-2.0.jar</b> in your class path.
|
|
||||||
|
|
||||||
<p>
|
|
||||||
A working example may be found in
|
|
||||||
<pre>
|
|
||||||
examples/jse/ScriptEngineSample.java
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<h1>3 - <a name="3">Concepts</a></h1>
|
<h1>3 - <a name="3">Concepts</a></h1>
|
||||||
|
|
||||||
<h2>Globals</h2>
|
<h2>Globals</h2>
|
||||||
@@ -446,9 +447,7 @@ and LuaForge:
|
|||||||
<h2>Main Changes by Version</h2>
|
<h2>Main Changes by Version</h2>
|
||||||
<table cellspacing="10"><tr><td><table cellspacing="4">
|
<table cellspacing="10"><tr><td><table cellspacing="4">
|
||||||
<tr valign="top"><td> <b>2.0</b></td><td><ul>
|
<tr valign="top"><td> <b>2.0</b></td><td><ul>
|
||||||
<li>Core vm and core libraries completed.
|
<li>Initial release of 2.0 version
|
||||||
<li>lua2java source-to-source compiler produces working files for all unit tests.
|
|
||||||
<li>luajc bytecode-to-bytecode compiler produces working files for all unit tests.
|
|
||||||
</ul></td></tr>
|
</ul></td></tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
@@ -456,8 +455,9 @@ and LuaForge:
|
|||||||
<ul>
|
<ul>
|
||||||
<li>debug code may not be completely removed by some obfuscators
|
<li>debug code may not be completely removed by some obfuscators
|
||||||
<li>tail calls are not tracked in debug information
|
<li>tail calls are not tracked in debug information
|
||||||
<li>using both version 1 and 2 libraries together in the same java vm has not been tested.
|
<li>using both version 1 and 2 libraries together in the same java vm has not been tested
|
||||||
<li>module() and setfenv() only partially supported for lau2java or luajc compiled lua
|
<li>module() and setfenv() only partially supported for lau2java or luajc compiled lua
|
||||||
<li>luajc may infer incorrect upvalue boundaries
|
<li>luajc can produce invalid class files in some cases
|
||||||
|
<li>values associated with weak keys may linger longer than expected
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
|||||||
@@ -729,6 +729,6 @@ public class JavaBuilder {
|
|||||||
|
|
||||||
public void appendBuffer() {
|
public void appendBuffer() {
|
||||||
append(factory.createInvoke(STR_LUAVALUE, "checkstring", TYPE_LUASTRING, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
|
append(factory.createInvoke(STR_LUAVALUE, "checkstring", TYPE_LUASTRING, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
|
||||||
append(factory.createInvoke(STR_BUFFER, "append", Type.VOID, new Type[] { TYPE_LUASTRING }, Constants.INVOKEVIRTUAL));
|
append(factory.createInvoke(STR_BUFFER, "append", TYPE_BUFFER, new Type[] { TYPE_LUASTRING }, Constants.INVOKEVIRTUAL));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,7 +161,6 @@ public class JavaGen {
|
|||||||
case Lua.OP_CONCAT: /* A B C R(A):= R(B).. ... ..R(C) */
|
case Lua.OP_CONCAT: /* A B C R(A):= R(B).. ... ..R(C) */
|
||||||
builder.newBuffer();
|
builder.newBuffer();
|
||||||
while ( b<=c ) {
|
while ( b<=c ) {
|
||||||
builder.dup();
|
|
||||||
builder.loadLocal(pc, b++);
|
builder.loadLocal(pc, b++);
|
||||||
builder.appendBuffer();
|
builder.appendBuffer();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,8 +63,8 @@ public class CompatibiltyTest {
|
|||||||
TestSuite suite = new TestSuite("Compatibility Tests");
|
TestSuite suite = new TestSuite("Compatibility Tests");
|
||||||
suite.addTest( new TestSuite( JseCompatibilityTest.class, "JSE Tests" ) );
|
suite.addTest( new TestSuite( JseCompatibilityTest.class, "JSE Tests" ) );
|
||||||
suite.addTest( new TestSuite( JmeCompatibilityTest.class, "JME Tests" ) );
|
suite.addTest( new TestSuite( JmeCompatibilityTest.class, "JME Tests" ) );
|
||||||
suite.addTest( new TestSuite( Lua2JavaTest.class, "Lua2Java Tests" ) );
|
|
||||||
suite.addTest( new TestSuite( JseBytecodeTest.class, "JSE Bytecode Tests" ) );
|
suite.addTest( new TestSuite( JseBytecodeTest.class, "JSE Bytecode Tests" ) );
|
||||||
|
suite.addTest( new TestSuite( Lua2JavaTest.class, "Lua2Java Tests" ) );
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user