265 }
266 bool res = CommandLineFlags::intxAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
267 if (! res) {
268 out->print_cr("setting flag %s failed", name);
269 }
270
271 return res? JNI_OK : JNI_ERR;
272 }
273
274 // set a uintx global flag using value from AttachOperation
275 static jint set_uintx_flag(const char* name, AttachOperation* op, outputStream* out) {
276 uintx value;
277 const char* arg1;
278 if ((arg1 = op->arg(1)) != NULL) {
279 int n = sscanf(arg1, UINTX_FORMAT, &value);
280 if (n != 1) {
281 out->print_cr("flag value must be an unsigned integer");
282 return JNI_ERR;
283 }
284 }
285 bool res = CommandLineFlags::uintxAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
286 if (! res) {
287 out->print_cr("setting flag %s failed", name);
288 }
289
290 return res? JNI_OK : JNI_ERR;
291 }
292
293 // set a uint64_t global flag using value from AttachOperation
294 static jint set_uint64_t_flag(const char* name, AttachOperation* op, outputStream* out) {
295 uint64_t value;
296 const char* arg1;
297 if ((arg1 = op->arg(1)) != NULL) {
298 int n = sscanf(arg1, UINT64_FORMAT, &value);
299 if (n != 1) {
300 out->print_cr("flag value must be an unsigned 64-bit integer");
301 return JNI_ERR;
302 }
303 }
304 bool res = CommandLineFlags::uint64_tAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
|
265 }
266 bool res = CommandLineFlags::intxAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
267 if (! res) {
268 out->print_cr("setting flag %s failed", name);
269 }
270
271 return res? JNI_OK : JNI_ERR;
272 }
273
274 // set a uintx global flag using value from AttachOperation
275 static jint set_uintx_flag(const char* name, AttachOperation* op, outputStream* out) {
276 uintx value;
277 const char* arg1;
278 if ((arg1 = op->arg(1)) != NULL) {
279 int n = sscanf(arg1, UINTX_FORMAT, &value);
280 if (n != 1) {
281 out->print_cr("flag value must be an unsigned integer");
282 return JNI_ERR;
283 }
284 }
285
286 if (strncmp(name, "MaxHeapFreeRatio", 17) == 0) {
287 FormatBuffer<80> err_msg("");
288 if (!Arguments::verify_MaxHeapFreeRatio(err_msg, value)) {
289 out->print_cr(err_msg.buffer());
290 return JNI_ERR;
291 }
292 } else if (strncmp(name, "MinHeapFreeRatio", 17) == 0) {
293 FormatBuffer<80> err_msg("");
294 if (!Arguments::verify_MinHeapFreeRatio(err_msg, value)) {
295 out->print_cr(err_msg.buffer());
296 return JNI_ERR;
297 }
298 }
299 bool res = CommandLineFlags::uintxAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
300 if (! res) {
301 out->print_cr("setting flag %s failed", name);
302 }
303
304 return res? JNI_OK : JNI_ERR;
305 }
306
307 // set a uint64_t global flag using value from AttachOperation
308 static jint set_uint64_t_flag(const char* name, AttachOperation* op, outputStream* out) {
309 uint64_t value;
310 const char* arg1;
311 if ((arg1 = op->arg(1)) != NULL) {
312 int n = sscanf(arg1, UINT64_FORMAT, &value);
313 if (n != 1) {
314 out->print_cr("flag value must be an unsigned 64-bit integer");
315 return JNI_ERR;
316 }
317 }
318 bool res = CommandLineFlags::uint64_tAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
|