Mercurial > hg > graal-compiler
comparison src/share/vm/prims/wbtestmethods/parserTests.cpp @ 13102:f9f4503a4ab5
Merge
author | Christos Kotselidis <christos.kotselidis@oracle.com> |
---|---|
date | Thu, 21 Nov 2013 15:04:54 +0100 |
parents | 5b3b75d9eb2f |
children |
comparison
equal
deleted
inserted
replaced
13101:790ebab62d23 | 13102:f9f4503a4ab5 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
115 ResourceMark rm; | 115 ResourceMark rm; |
116 DCmdParser parser; | 116 DCmdParser parser; |
117 | 117 |
118 const char* c_cmdline = java_lang_String::as_utf8_string(JNIHandles::resolve(j_cmdline)); | 118 const char* c_cmdline = java_lang_String::as_utf8_string(JNIHandles::resolve(j_cmdline)); |
119 objArrayOop argumentArray = objArrayOop(JNIHandles::resolve_non_null(arguments)); | 119 objArrayOop argumentArray = objArrayOop(JNIHandles::resolve_non_null(arguments)); |
120 objArrayHandle argumentArray_ah(THREAD, argumentArray); | |
120 | 121 |
121 int length = argumentArray->length(); | 122 int length = argumentArray_ah->length(); |
122 | 123 |
123 for (int i = 0; i < length; i++) { | 124 for (int i = 0; i < length; i++) { |
124 oop argument_oop = argumentArray->obj_at(i); | 125 oop argument_oop = argumentArray_ah->obj_at(i); |
125 fill_in_parser(&parser, argument_oop); | 126 fill_in_parser(&parser, argument_oop); |
126 } | 127 } |
127 | 128 |
128 CmdLine cmdline(c_cmdline, strlen(c_cmdline), true); | 129 CmdLine cmdline(c_cmdline, strlen(c_cmdline), true); |
129 parser.parse(&cmdline,',',CHECK_NULL); | 130 parser.parse(&cmdline,',',CHECK_NULL); |
130 | 131 |
131 Klass* k = SystemDictionary::Object_klass(); | 132 Klass* k = SystemDictionary::Object_klass(); |
132 objArrayOop returnvalue_array = oopFactory::new_objArray(k, parser.num_arguments() * 2, CHECK_NULL); | 133 objArrayOop returnvalue_array = oopFactory::new_objArray(k, parser.num_arguments() * 2, CHECK_NULL); |
134 objArrayHandle returnvalue_array_ah(THREAD, returnvalue_array); | |
133 | 135 |
134 GrowableArray<const char *>*parsedArgNames = parser.argument_name_array(); | 136 GrowableArray<const char *>*parsedArgNames = parser.argument_name_array(); |
135 | 137 |
136 for (int i = 0; i < parser.num_arguments(); i++) { | 138 for (int i = 0; i < parser.num_arguments(); i++) { |
137 oop parsedName = java_lang_String::create_oop_from_str(parsedArgNames->at(i), CHECK_NULL); | 139 oop parsedName = java_lang_String::create_oop_from_str(parsedArgNames->at(i), CHECK_NULL); |
138 returnvalue_array->obj_at_put(i*2, parsedName); | 140 returnvalue_array_ah->obj_at_put(i*2, parsedName); |
139 GenDCmdArgument* arg = parser.lookup_dcmd_option(parsedArgNames->at(i), strlen(parsedArgNames->at(i))); | 141 GenDCmdArgument* arg = parser.lookup_dcmd_option(parsedArgNames->at(i), strlen(parsedArgNames->at(i))); |
140 char buf[VALUE_MAXLEN]; | 142 char buf[VALUE_MAXLEN]; |
141 arg->value_as_str(buf, sizeof(buf)); | 143 arg->value_as_str(buf, sizeof(buf)); |
142 oop parsedValue = java_lang_String::create_oop_from_str(buf, CHECK_NULL); | 144 oop parsedValue = java_lang_String::create_oop_from_str(buf, CHECK_NULL); |
143 returnvalue_array->obj_at_put(i*2+1, parsedValue); | 145 returnvalue_array_ah->obj_at_put(i*2+1, parsedValue); |
144 } | 146 } |
145 | 147 |
146 return (jobjectArray) JNIHandles::make_local(returnvalue_array); | 148 return (jobjectArray) JNIHandles::make_local(returnvalue_array_ah()); |
147 | 149 |
148 WB_END | 150 WB_END |