Skip to content
Snippets Groups Projects
  1. Jan 22, 2014
  2. Jan 20, 2014
  3. Jan 16, 2014
  4. Jan 15, 2014
  5. Jan 10, 2014
  6. Oct 15, 2013
    • Tomasz Grabiec's avatar
      RunJava: system class loader should contain application resources · c0a8e41a
      Tomasz Grabiec authored
      
      The system classloader should have classes which were
      specified in the command line using -cp/-classpath/-jar.
      Before this change only runjava.jar was included.
      
      System class loader is queried explicitly by
      java.util.logging framework to lookup classes
      configred in logging properties file.
      
      To solve this problem a custom system classloader
      is set when starting JVM. It delegates to the application
      classloader created when java program was started.
      
      It also handles the case when a new java application
      is started within the same JVM. Such application
      should have its own view of system classes. However
      we are able to install only one system classloader
      per JVm. To solve this we start each java application
      in a separate thread and use InheritableThreadLocal
      to hold the application class loader which should be
      used as system class loader view for the thread family.
      
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      c0a8e41a
  7. Oct 14, 2013
    • Nadav Har'El's avatar
      Rework elf::program's API · ba3e3efa
      Nadav Har'El authored
      
      This is patch v2, incorporating most of the comments from the previous round.
      
      Solves issue #47:
      
      elf::program's API - add_object() and remove_object() was problematic in
      two respects:
      
      1. It did not do reference-counting on the loaded object, so if add_object()
         was done 5 times, a single remove_object() would unmap the object and
        its 4 other users will crash.
      
      2. It is un-C++-like.
      
      This patch replaces these two functions by a single function get_library():
      
        std::shared_ptr<elf::object>
         get_library(std::string lib, std::vector<std::string> extra_path = {});
      
      get_library() returns a shared_ptr, which is reference counting and does
      proper C++-style RAII. For example in the code:
      
      	auto lib = elf::get_program()->get_library(path);
      	auto main = lib->lookup<int (int, char**)>("main");
      	int rc = main(argc, argv);
      
      once lib out of scope, the reference count of the elf::object automatically
      goes down, and if nobody else holds another shared-pointer to the same
      library, the object is destroyed (causing the shared library to be unloaded).
      
      This patch also documents, with Doxygen, all the functions it touches.
      
      IMPORTANT NOTE: This reference count is completely unrelated to the issue
      of concurrent use of dlopen()/dlclose()/dl_iterate_phdr(), which is still
      buggy and we need to fix (I have a patch for that, but it's too long to fit
      in the margin).
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      ba3e3efa
    • Tomasz Grabiec's avatar
      java.cc: return on error rather than abort · e0b8739c
      Tomasz Grabiec authored
      
      Currently we call abort() if something is wrong whith
      java.so command. Now that we allow to run processes from
      the command line this may not be the best behavior because
      a problem with starting a less import program will abort
      the system:
      
        [/]% run java.so -cp java Hello
        run_elf(): running main() in the context of thread 0xffffc0000c30b010
        java.so: Can't create VM.
        Aborted
      
      Instead of that we could just return and the system can
      be still usable:
      
        [/]% run java.so -cp java Hello
        run_elf(): running main() in the context of thread 0xffffc0000c30b010
        java.so: Can't create VM.
        run: finished with exitcode 1
      
        [/]%
      
      Signed-off-by: default avatarTomasz Grabiec <tgrabiec@cloudius-systems.com>
      e0b8739c
  8. Oct 07, 2013
  9. Oct 06, 2013
    • Nadav Har'El's avatar
      Put RunJava.class in a jar, runjava.jar · a8af5dde
      Nadav Har'El authored
      
      We use the RunJava Java class to run Java applications (both java.so
      and the "java" CLI command use it). We used to have RunJava.class
      uncompressed, in the /java directory, but this caused two problems:
      
      1. Or noticed that having a directory (/java) on the classpath causes
         thousands of stat() calls when Java tries to look for all classes
         in this directory. With a jar, its contents are read only once.
      
      2. The "java" CLI command (java.groovy) didn't work because apparently
         Groovy cannot deal with classes being in the top-level package.
      
         So this patch moves RunJava into the io.osv package, and put it into a jar
         /java/runjava.jar.
      
         Note that java.groovy is changed in a separate patch (because it's in
         a different sub-repository....)
      
      Signed-off-by: default avatarNadav Har'El <nyh@cloudius-systems.com>
      a8af5dde
  10. Sep 24, 2013
  11. Sep 15, 2013
  12. Sep 11, 2013
  13. Sep 03, 2013
  14. Aug 05, 2013
  15. Jun 04, 2013
    • Nadav Har'El's avatar
      Fix argv handling in RunJava · b4d67a4a
      Nadav Har'El authored
      The recent change, to add the program name as argv[0] for C code's
      main(), make sense for C code, but less for Java code, where main()
      normally expects args[0] to be the first argument, not the program name.
      
      So the change to RunJava.java was un-Java-like; It also broke the "java"
      CLI command which didn't put "java" in argv[0] for the arguments to
      RunJava.main(), so the "java" command no longer worked after the previous
      patch.
      
      Instead, we change java.cc (which compiles to java.so). This is what
      calls RunJava.class, and it should remove the new argv[0] before calling its
      main() - instead of expecting that RunJava.class to do this.
      b4d67a4a
  16. Jun 03, 2013
    • Nadav Har'El's avatar
      java.so: wait for other threads to finish · 5384f24f
      Nadav Har'El authored
      java.cc would exit right after the main() method finished. But in Java,
      this is not the correct behavior. Rather, even if main() returns, we
      need to wait for all other threads to end (or more accurately, wait
      for all threads not marked with setDaemon(true)).
      
      Calling jvm->DestroyJavaVM() does this for us, and it's probably the
      Right Thing(TM) to do anyway.
      
      Before this patch, the Jetty benchmark exited immediately after
      startup.  After this patch, its worker threads keep the whole VM running.
      5384f24f
  17. May 28, 2013
    • Nadav Har'El's avatar
      Overhaul java.so command line · 31681180
      Nadav Har'El authored
      Java.so used to correctly support the "-jar" option, but did not fully
      allow the other "mode" of running Java: specifying a class name which is
      supposed to be searched in the class path. The biggest problem was that
      it only know to find class files, but not a class inside a jar in the class
      path - even if the classpath was correctly set.
      
      Unfortunately, fixing this C code was impossible, as JNI's FindClass()
      simply doesn't know to look in Jars.
      
      So this patch overhauls java.so: Java.so now only runs a fixed class,
      /java/RunJava.class. This class, in turn, is the one that parses the
      command line arguments, sets the class path, finds the jar or class to
      run, etc.. The code is now much easier to understand, and actually works
      as expected :-) It also fixes the bug we had with SpecJVM2008's "compiler.*"
      benchmarks, which forced us to tweak the class path manually.
      
      The new code supports running a class from the classpath, and also the
      "-classpath" option to set the class path. Like the "java" command line
      tool in Linux, this one also recognizes wildcard classpaths. For example,
      to run Jetty, whose code is in a dozen jars in /jetty, one can do:
      
              run.py -e "java.so -classpath /jetty/* org.eclipse.jetty.xml.XmlConfiguration jetty.xml"
      31681180
  18. May 09, 2013
  19. Apr 17, 2013
  20. Apr 11, 2013
  21. Apr 03, 2013
  22. Feb 11, 2013
  23. Jan 28, 2013
  24. Jan 27, 2013
  25. Jan 24, 2013
Loading