art: Refactor RuntimeOptions/ParsedOptions

Refactor the RuntimeOptions to be a
type-safe map (VariantMap, see runtime_options.h) and the ParsedOptions
to delegate the parsing to CmdlineParser (see cmdline/cmdline_parser.h).

This is the start of a command line parsing refactor, and may include
more in the future (dex2oat, patchoat, etc).

For more details of the command line parsing generator usage see cmdline/README.md

Change-Id: Ic67c6bca5e1f33bf2ec60e2e3ff8c366bab91563
diff --git a/runtime/java_vm_ext.cc b/runtime/java_vm_ext.cc
index 40417d8..ea7c192 100644
--- a/runtime/java_vm_ext.cc
+++ b/runtime/java_vm_ext.cc
@@ -32,6 +32,7 @@
 #include "java_vm_ext.h"
 #include "parsed_options.h"
 #include "runtime-inl.h"
+#include "runtime_options.h"
 #include "ScopedLocalRef.h"
 #include "scoped_thread_state_change.h"
 #include "thread-inl.h"
@@ -357,14 +358,15 @@
   JII::AttachCurrentThreadAsDaemon
 };
 
-JavaVMExt::JavaVMExt(Runtime* runtime, ParsedOptions* options)
+JavaVMExt::JavaVMExt(Runtime* runtime, const RuntimeArgumentMap& runtime_options)
     : runtime_(runtime),
       check_jni_abort_hook_(nullptr),
       check_jni_abort_hook_data_(nullptr),
       check_jni_(false),  // Initialized properly in the constructor body below.
-      force_copy_(options->force_copy_),
-      tracing_enabled_(!options->jni_trace_.empty() || VLOG_IS_ON(third_party_jni)),
-      trace_(options->jni_trace_),
+      force_copy_(runtime_options.Exists(RuntimeArgumentMap::JniOptsForceCopy)),
+      tracing_enabled_(runtime_options.Exists(RuntimeArgumentMap::JniTrace)
+                       || VLOG_IS_ON(third_party_jni)),
+      trace_(runtime_options.GetOrDefault(RuntimeArgumentMap::JniTrace)),
       globals_lock_("JNI global reference table lock"),
       globals_(gGlobalsInitial, gGlobalsMax, kGlobal),
       libraries_(new Libraries),
@@ -374,9 +376,7 @@
       allow_new_weak_globals_(true),
       weak_globals_add_condition_("weak globals add condition", weak_globals_lock_) {
   functions = unchecked_functions_;
-  if (options->check_jni_) {
-    SetCheckJniEnabled(true);
-  }
+  SetCheckJniEnabled(runtime_options.Exists(RuntimeArgumentMap::CheckJni));
 }
 
 JavaVMExt::~JavaVMExt() {