Embedding GI inside the JVM Benoit Baudry Kwaku Yeboah-Antwi 1 - - PowerPoint PPT Presentation

embedding gi inside the jvm
SMART_READER_LITE
LIVE PREVIEW

Embedding GI inside the JVM Benoit Baudry Kwaku Yeboah-Antwi 1 - - PowerPoint PPT Presentation

Embedding GI inside the JVM Benoit Baudry Kwaku Yeboah-Antwi 1 Specialize to environment .. or not 2 Open-ended evolution 3 Continuously evolve 4 In software Code specialization API are large and generic exact usage (e.g., surface really


slide-1
SLIDE 1

Embedding GI inside the JVM

Benoit Baudry Kwaku Yeboah-Antwi

1

slide-2
SLIDE 2

Specialize to environment .. or not

2

slide-3
SLIDE 3

3

Open-ended evolution

slide-4
SLIDE 4

Continuously evolve

4

slide-5
SLIDE 5

In software

  • Code specialization
  • API are large and generic
  • exact usage (e.g., surface really needed) is known only

at runtime

  • Spontaneous diversification
  • Instantiation creates large quantities of clones
  • diversification at instantiation can increase resilience

5

slide-6
SLIDE 6

Let’s do it in Java

  • JVM hardly supports runtime modifications of

the bytecode

  • E.g., add, delete or rename fields, methods
  • No built-in support
  • to edit the bytecode
  • to steer the search for new code

6

slide-7
SLIDE 7

Our Contribution

ECSELR

  • ECologically Inspired Software EvoLution @

Runtime

  • A patch in the JVM + evolutionnary capacities

for Java programs

7

slide-8
SLIDE 8
slide-9
SLIDE 9

Initialization Selection Variation Evaluation

Object A Object B Object C Object D Object B Object C Object B’ Object C’

EvoAgent getAllObjects()

Action FN

EvoDaemon

selectObjects()

Evo Strategy

EvoDaemon mutateObject()

Genetic Oper

EvoAgent testObjects()

Action FN

Object B’

EvoDaemon

discardUnfit() Fitness

EvoAgent redefObjects()

Action FN

Installation

Object C’ Object B’

records of

The evo loop

slide-10
SLIDE 10

The and steps

  • Analyze all live objects on the heap
  • Select a subset according to some function
  • random
  • by size
  • by frequency of usage
  • Copy the bytecode of selected objects

10

Selection Initialization

slide-11
SLIDE 11

The step

  • ECSELR embeds default evo operations
  • Method Addition
  • Merge Methods
  • Method Deletion
  • Field Addition Operator
  • Transplantation Operator
  • Random Instruction Operator
  • Passthrough Operator Return

11

Variation

slide-12
SLIDE 12

The step

  • Static check
  • ensure syntactic validity
  • check consistency after evolution: ECSLER embeds

checks about the well-formedness of bytecode

  • peratinos
  • Dynamic check
  • parallel execution of original and evolved
  • fitness evaluation

12

Evaluation

slide-13
SLIDE 13

Static check

13

public int greaterThan(int intOne, intTwo) { if (intOne > intTwo) { return 0; } else { return 1; } } greaterThan(10,20);

0: iload_1 1: iload_2 2: nop 3: if_icmple 8 6: iconst_0 7: ireturn 8: iconst_1 9: ireturn Bytecode ✔

slide-14
SLIDE 14

Static check

14

public int greaterThan(int intOne, intTwo) { if (intOne > intTwo) { return 0; } else { return 1; } } greaterThan(10,20);

0: iload_1 1: iload_2 2: if_icmple 7 5: iconst_0 6: ireturn 7: iconst_1 8: ireturn Bytecode ✗

ECSELR detects the mistake: it knows that if_icmple requires two operands

slide-15
SLIDE 15

Dynamic checks

  • Run both versions in parallel
  • for a given period
  • This requires our patched

JVM

15

  • riginal

mutated inputs

  • ut_o
  • ut_m

eval fitness if ok if not ok discard mutated keep mutated

slide-16
SLIDE 16

Diversification example

16

int hash(final Object key) { int h = key.hashCode(); h += ~(h << 9); h ^= h >>> 14; h += h << 4; h ^= h >>> 10; return h; }

slide-17
SLIDE 17

17

slide-18
SLIDE 18

public long hash() { long h = this.hashCode(); h = this.initCapacity * h; h += ~(h << 9); h ^= h >>> 14; h += h << 4; h ^= h >>> 10; return h; }

18

Diversification example

public long hash() { long h = this.hashCode(); h = this.initCapacity * h; h += ~(h << 9); h ^= h >>> 14; h += h << 4; h ^= h >>> 10; return h + h; } public long hash() { long h = this.hashCode(); h = this.initCapacity * h; h += ~(h << 9); h ^= h >>> 14; h += h << (4+6); h ^= h >>> 10; h = h * 100; return h; } public long hash() { long h = this.hashCode(); h = this.initCapacity * h; h += ~(h << 9); h ^= h >>> 14; h += h << (4+6); h ^= h >>> 10; return h; }

slide-19
SLIDE 19

Conclusion

  • We now have a machine to evolve Java

programs at runtime

  • Next step: use it for runtime GI
  • https://bitbucket.org/Kwaku/agentd/src

19