Skip to content
Snippets Groups Projects
  1. Feb 06, 2014
    • Tomasz Grabiec's avatar
      java: do not pollute isolate classpath with isolator dependencies · 211bb7fb
      Tomasz Grabiec authored
      We don't want cglib classes needed by io.osv.* classes to be
      accessible from application classes. This could cause problems
      if application would want to use its own version of cglib. In this
      case the application provided cglib would be masked by the one
      inside OSv.
      
      To solve this problem we do not set the current class loader
      as application class loader parent, but instead we link it with
      a proxy which combines bootstrap class loader and the original
      system class loader allowing only classes from io.osv.* package
      to be loaded from the system class loader.
      
      Class loader diagram:
      
       +-----------+
       | Bootstrap |<---------------+
       +-----------+                |
            ^                       |
            |                       |
            |                       |
       +----+------+  io.osv.*  +-----------+
       | System    |<-----------| Filtering |
       +-----------+            +-----------+
                                    ^
                                    |
                                    |
                  +-----------+     |
                  | App 1     |-----+
                  +-----------+     |
                                    |
                  +-----------+     |
                  | App 2     |-----+
                  +-----------+
      
      This way the application may still use OSv java APIs, but does
      not see classes from our dependencies and may load its own version
      of these classes.
      211bb7fb
    • Tomasz Grabiec's avatar
      java: isolate system properties between contexts · b174b89c
      Tomasz Grabiec authored
      The solution is using Java reflection API to replace Properties object
      in System.prop with a version which delegates to per-context
      properties.
      
      This allows each application to see different values for the same
      property. This works with properties set via both command line
      parameter (-D) and programatically with System.setProperty().
      b174b89c
    • Tomasz Grabiec's avatar
      af60e6cf
    • Tomasz Grabiec's avatar
      java: fix possible NPE in expandClassPath() · e5cff9cc
      Tomasz Grabiec authored
      File.listFiles() may return null. Spotted by IntelliJ.
      e5cff9cc
    • Tomasz Grabiec's avatar
      java: use varargs for run() arguments · 2f0c9395
      Tomasz Grabiec authored
      This makes API more friendly.
      2f0c9395
    • Tomasz Grabiec's avatar
      java: cleanups · 424e1245
      Tomasz Grabiec authored
      424e1245
    • Tomasz Grabiec's avatar
      java: remove support for -Xclassloader · 868ac399
      Tomasz Grabiec authored
      We don't use it and I can hardly think of a way this could be useful.
      868ac399
    • Tomasz Grabiec's avatar
      java: make ContextIsolator throw exceptions when arguments are invalid · 21f2af70
      Tomasz Grabiec authored
      Currently the error is just printed on the console. Throwing exception
      allows API user to react on this situation in the most appropriate
      way. For example if new application is started using a web interface
      printing on console is useless.
      21f2af70
    • Tomasz Grabiec's avatar
      java: move -version handling to RunJava · c0e2c6e3
      Tomasz Grabiec authored
      It does not belong in the isolate API but to the
      command line java starter.
      c0e2c6e3
    • Tomasz Grabiec's avatar
      java: apply coding style · e8e3f3a3
      Tomasz Grabiec authored
      Auto reformat performed from IntelliJ (alt+ctrl+L)
      e8e3f3a3
    • Tomasz Grabiec's avatar
      java: make runSync interrupt the context on which it waits · f3df4180
      Tomasz Grabiec authored
      Interrupting a thread which is blocked waiting for an isolate to
      complete which was started via runSync() should interrupt the isolate.
      The waiter should return only after isolate terminated.
      
      I think this is what users would expect to happen when interrupting a
      foreground process.
      f3df4180
    • Tomasz Grabiec's avatar
      java: move context creation logic from RunJava to ContextIsolator · 98d95bc2
      Tomasz Grabiec authored
      ContextIsolator is a generic API for starting new applications inside
      a single JVM. RunJava should be just a command-line starter which uses
      that API.
      
      I tried to change as little as possible during the code move so that
      any changes to that logic are clearly visible. The changes which adapt
      the code to a more generic API are in the next patches.
      98d95bc2
    • Tomasz Grabiec's avatar
      java: implement isolation of java.util.logging managers · 901a68d0
      Tomasz Grabiec authored
      The j.u.l framework allows only one log manager to exist. To isolate
      logging configurations we need to install our own log manager which
      delegates to context-local log managers.
      
      See #172.
      
      In order to have a fully isolated logging config system properties
      need to also be isolated. This will come in the following patches.
      901a68d0
    • Tomasz Grabiec's avatar
      java: use maven to build runjava module · ce6cc028
      Tomasz Grabiec authored
      It will allow to use automatic dependency management.
      
      It slows down the build a bit. Incremental build takes 3 seconds
      longer than previously.
      
      First build takes longer due to downloading of maven artifacts.
      This is once per machine.
      ce6cc028
    • Tomasz Grabiec's avatar
      java: create standard java module structure in runjava module · 1db1633a
      Tomasz Grabiec authored
      There is a convention to organize java modules in the following way:
      
      src/main/java - source root for production code
      src/test/java - source root for test code
      1db1633a
    • Tomasz Grabiec's avatar
      java: introduce utilities for lazy initialization · a0be9a34
      Tomasz Grabiec authored
      I need static-initialization-like semantics in several places.
      This abstraction makes it easier.
      a0be9a34
    • Tomasz Grabiec's avatar
      java: extract abstraction of isolated application · c0c1ef63
      Tomasz Grabiec authored
      We aim to support running multiple isolated Java applications in one
      JVM. Some work has already been done to isolate system class
      loaders. There is much more to it than that. Isolated applications
      (aka Contexts) do not map 1-1 to class loaders. One context may have
      many different class loaders.
      
      This change extracts context-specific logic to separate classes as a
      base for further additions.
      c0c1ef63
    • Tomasz Grabiec's avatar
      java: print exception thrown from FindClass · 61e56929
      Tomasz Grabiec authored
      env->FindClass() triggers class initialization which may throw
      exceptions. Instead of printing misleading information that the class
      was not found we should print the exception stack-trace.
      61e56929
    • Tomasz Grabiec's avatar
      java: print errors on stderr rather than debug ring. · 0a21c05b
      Tomasz Grabiec authored
      Currently debug messages are not printed on console by default.
      0a21c05b
    • Glauber Costa's avatar
      jvm_balloon: handle explicit unmapping case · fc469b4d
      Glauber Costa authored
      
      The JVM may unmap certain areas of the heap completely, which was confirmed by
      code inspection by Gleb. In that case, the current balloon code will break.
      
      This is because we were deleting the vma from finish_move(), and recreating the
      old mapping implicitly in the process. With this new patch, the tear down of
      the jvm balloon mapping is done by a separate function. Unmapping or evacuating
      the region won't trigger it.
      
      It still needs to communicate to the balloon code that this address is out of
      the balloons list. We do that by calling the page fault handler with an empty
      frame. jvm_balloon_fault will is patched to interpret an empty frame correctly.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      fc469b4d
  2. Feb 02, 2014
  3. Jan 27, 2014
  4. Jan 24, 2014
    • Glauber Costa's avatar
      balloon: fix the double move problem · 4eb7d9c2
      Glauber Costa authored
      
      As we have recently discovered, some parallel GCs will move an object to two
      different locations at times, and later on decide on which one to use. This
      breaks our implementation if the final object is the second one to be copied,
      because by then the original region is already mapped - so we won't fault, and
      the unmapped region will not be the actual balloon, so we will have a bogus
      fault
      
      The core of this solution is to keep all the regions unmapped. Because they had
      only garbage before, we know Java shouldn't read anything from it before it
      writes something new. And when it does that, we declare that to be no longer a
      balloon.
      
      Movement is then split in two phases: the normal phase, and the finish phase.
      In the finish phase we will remove the old VMA and create the new VMA again,
      with heap characteristics.
      
      Special care needs to be taken when "conciliating" the array: because we use
      the difference between first faulting address and original array address to
      calculate how many bytes we are skipping, we need to store that information
      somewhere. We're using an unordered_map (hash) for that. We'll keep track of
      all in-flight ballooned regions and hold the original address of the array.
      
      When we detect movement *from* that region, we know it is the new location
      and update the balloon object with the new address.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      4eb7d9c2
    • Glauber Costa's avatar
      balloon: introduce a conciliation phase · 2b8ceebc
      Glauber Costa authored
      
      This patch introduces a separate operation, "conciliate", that calculates
      the balloon parameters given an arbitrary address
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      2b8ceebc
    • Glauber Costa's avatar
      balloon: fix stack-like behavior for balloons · 5d83b36d
      Glauber Costa authored
      
      We should always remove the last balloon we've created. There are two main
      reasons for that:
      
      1) The older balloons are likely to be already in more tenured generations,
      and will move less, whereas younger balloons could be in younger generations.
      So by removing them like a stack, we'll avoid needless moves
      
      2) The probe, when inserted, should stay for as long as we can.
      
      That was always the intended behavior but I made the small mistake of inserting
      them in the wrong order. Fix that.
      
      Signed-off-by: default avatarGlauber Costa <glommer@cloudius-systems.com>
      Signed-off-by: default avatarPekka Enberg <penberg@cloudius-systems.com>
      5d83b36d
  5. Jan 22, 2014
  6. Jan 20, 2014
  7. Jan 16, 2014
  8. Jan 15, 2014
Loading