readme.mkd 4.03 KB
Newer Older
1
2
3
4
5
6
7
# Multi-Phasic Applications: SquirrelJME

  * Copyright (C) 2013-2016 Steven Gawroriski
    <steven@multiphasicapps.net>
  * Copyright (C) 2013-2016 Multi-Phasic Applications
    <http://multiphasicapps.net>

8
9
**SquirrelJME** is intended to be a Java ME 8 compatible environment for
strange and many other devices.
10

11
## Licenses
12
13
14

  * [GNU Affero General Public License, Version 3 or later](license.mkd)

15
## Links
16
17
18

  * [Online repository](http://multiphasicapps.net:8080/squirreljme)

19
20
21
22
23
24
25
26
27
28
29
30
31
32
## Goals

 * _To be self-hosting_ - it can build itself while running on itself, provided
   there is a filesystem.
 * _To be small_ - Smaller programs are easier to maintain and are usually
   simpler.
 * _To be fast_ - With the potential of AOT/JIT, systems that do not normally
   have a port of an existing virtual machine will usually only have an
   interpreter.
 * _To be compatible_ - So that existing Java ME 8 applications can run on this
   virtual machine.

## Donations

33
34
35
36
37
38
39
40
41
You may donate to SquirrelJME to help keep the author alive:

  * BitCoin (**BTC/XBT**): [`1HNRD44krsCFUzUvVWaXr5jqvuyZDZy71M`](
    bitcoin:1HNRD44krsCFUzUvVWaXr5jqvuyZDZy71M)
  * LiteCoin (**LTC**): [`LKytAQcbPyox75uYMKo1NH1w2k1SqBaELi`](
    litecoin:LKytAQcbPyox75uYMKo1NH1w2k1SqBaELi)
  * DogeCoin (**DOGE**): [`DPsW21MV8RMuXhA3GoN8VPjkmQEugrEn8h`](
    dogecoin:DPsW21MV8RMuXhA3GoN8VPjkmQEugrEn8h)

42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Supported Operating Systems and Freestanding Hardware

## Hosted

## Freestanding

# Differences Between Java SE and Java ME

Java ME is a much lighter Java platform and here are the things which are
missing along with a reason as to why this may be a good thing:

 * No finalizers (the `finalize()` method).
   * Finalizers are very integrated with how the garbage collector works.
   * It is never known when they will actually be called (if ever).
   * Timing attacks could be performed when finalizers are called between
     garbage collection runs.
 * No serialization.
   * Not all objects are `Serializable`.
   * Serialization uses virtual machine magic to access internal details.
   * The `transient` keyword should never appear.
   * Simplifies implementation.
 * No reflection.
   * There is `Class.forName()` and `Class.newInstance()`, however they are
     trivial to support.
   * More secure because access checks do not have to be performed at run-time
     to determine if it is permissable to access an object.
   * Random object fields (and finals) can be cached because their reference
     or primitive values will never change.
   * More secure because for example changing `Boolean.TRUE` to be `false` may
     cause security exploits with code that relies on it being `true`.
 * No `invokedynamic` instruction.
   * Simplifies virtual machine operation, at the cost of lambdas (which could
     be smartly wrapped in anonymous classes by a compiler).

However, given these differences there are advantages:

 * Faster
   * Due to the lack of reflection, optimization is safer because finals are
     truly final. This means no exceptions are required to allow for this
     change.
 * Lighter
   * The main library is much smaller which means it will load faster and
     use less memory. Less memory means it can run on smaller systems such as
     calculators.

There are also disadvantages however:

 * Without reflection, one cannot include plugins dynamically from the program.
   * However, Java ME 3 (or so) added LIBlets which may be optional and provide
     a slight alternative to plugins. These however are fixed to the JAR/JAD
     which means that the difficulty is increased.
   * Alternatively, Java ME 8 has `ServiceLoader` which enables JARs to
     potentially be merged to provide services. Also using `Class.forName()`
     and `Class.newInstance()`, plugins using a common interface can be
     initialized when they are not directly known.

Stephanie Gawroriski's avatar
Notes.    
Stephanie Gawroriski committed
98
99
100
101
102
103
104
# Programming Considerations

## Do Not Use Static Modifiable/Mutable Globals In Standalone Classes

The garbage collector upon determining that a class (which may contain static
variables treated as globals) is no longer referenced, it may be garbage
collected.
105