October 1 2003
jtools/js/tinyvm/CodeUtilities
:
(search for OP_LDC:
)
If this patch is missing, compile error can raise
up with a message, that there are too many constants.
case OP_LDC: // Bug reported by Jochen Hiller, fixed by Lawrie Griffiths // convert aCode[i] not to an int, mask it to an unsigned byte instead // pOutCode[i] = (byte) processConstantIndex ((int) aCode[i]); pOutCode[i] = (byte) processConstantIndex (aCode[i] & 0xFF); i++; break;
lejosunit.rcxui.TestRunner
,
which enables
leJOS to start tests using the RCX buttons, and display useful
output on the very simple text display.
StringBuffer
uses the
Math
library, which will
increase the size of the linked program for some kBytes.
Implicitely, Java will use the class StringBuffer
for
String
operations like String s = "abc" + "def" + "123";
.String
concatenations.
The class lesjosunit.util.Util
implements some simple String
concatenations for 2 and 3 arguments based on arraycopy
.build.xml
file
Assert
: Does not support assertEquals
methods for argument types double
,
Double
and Long
.
Assert
: Does not support
assertEquals(String, String)
and assertEquals(String, String, String)
,
as they print out a specialiced format in JUnit.
This cannot be supported within the limited text display.
Therefore, class ComparisonFailure
has not been implemented.
Assert
has been designed, to avoid dependencies to
class StringBuffer
, as this would require the Math
class,
and would increase the required footprint.
assertEquals(float, float, float)
and
assertEquals(String, float, float, float)
are implemented by the class FloatAssert
.
FloatAssert
uses the class StringBuffer
,
which requires the Math
libary.
TestSuite
does not support a name.
TestResult
does support only ONE TestListener, to avoid
Vector
handling.
TestSuite
.
TestSuite
.
TestCase
does not implement any deprecated methods.
leJOSUnit includes some tests
(see package lejosunit.tests.size
),
to compare the required
executable without leJOSUnit and including leJOSUnit.
In leJOS 2.1, there is less footprint, due to the enhanced optimized linker, which removes also not used methods.
Test-Program | without leJOSUnit |
with leJOSUnit |
Footprint |
Simple | 930 | 8.581 | 7.651 |
FreeMemory | 2.456 | 8.636 | 6.180 |
HelloWorld | 2.767 | 8.657 | 5.890 |
This is based on leJOS 2.0, which includes an optimized linker, removing not required classes.
Test-Program | without leJOSUnit |
with leJOSUnit |
Footprint |
Simple | 1.434 | 8.321 | 6.887 |
FreeMemory | 6.484 | 13.015 | 6.531 |
HelloWorld | 3.478 | 10.016 | 6.538 |
Util.arraycopy(char[], int, char[], int, int)
should be provided by the core leJOS environment
in System.arraycopy(char[], int, char[], int, int)
,
as this can be a general useful function.
At the moment (leJOS 2.0), it is in package scope and cannot be used outside of
java.lang
.
This would decrease the required code size.
Question: class Vector
also implements
a method arraycopy(Object[], int, Object[], int, int)
.
Can this be consolidated ?
Proposal: Make System.arraycopy(char[], int, char[], int, int)
a public method ! Consolidate with
Vector.arraycopy(Object[], int, Object[], int, int)
,
to use Object[]
instead of char[]
argument type.
Does it make sense, to implement this as a native method ?
int i = 1; StringBuffer sbuf = new StringBuffer(); sbuf.append (i); // this code fails sbuf.append (new Integer (i)); // this code works
RemoteTestRunner
, running at PC side, and a
TestRunnerServer
running at RCX.
RemoteTestRunner
.
byte
, instead of String
.
Will decrease footprint.