Mercurial > hg > truffle
comparison agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaScriptEngine.java @ 6725:da91efe96a93
6964458: Reimplement class meta-data storage to use native memory
Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes
Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland
Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author | coleenp |
---|---|
date | Sat, 01 Sep 2012 13:25:18 -0400 |
parents | c18cbe5936b8 |
children |
comparison
equal
deleted
inserted
replaced
6724:36d1d483d5d6 | 6725:da91efe96a93 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2004, 2007, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2004, 2012, 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. |
147 String name = (String) clazz; | 147 String name = (String) clazz; |
148 if (name.startsWith("0x")) { | 148 if (name.startsWith("0x")) { |
149 // treat it as address | 149 // treat it as address |
150 VM vm = VM.getVM(); | 150 VM vm = VM.getVM(); |
151 Address addr = vm.getDebugger().parseAddress(name); | 151 Address addr = vm.getDebugger().parseAddress(name); |
152 Oop oop = vm.getObjectHeap().newOop(addr.addOffsetToAsOopHandle(0)); | 152 Metadata metadata = Metadata.instantiateWrapperFor(addr.addOffsetTo(0)); |
153 if (oop instanceof InstanceKlass) { | 153 if (metadata instanceof InstanceKlass) { |
154 ik = (InstanceKlass) oop; | 154 ik = (InstanceKlass) metadata; |
155 } else { | 155 } else { |
156 return Boolean.FALSE; | 156 return Boolean.FALSE; |
157 } | 157 } |
158 } else { | 158 } else { |
159 ik = SystemDictionaryHelper.findInstanceKlass((String) clazz); | 159 ik = SystemDictionaryHelper.findInstanceKlass((String) clazz); |
262 if mirror can not be created, return undefined. For other types, | 262 if mirror can not be created, return undefined. For other types, |
263 mirror is undefined. | 263 mirror is undefined. |
264 */ | 264 */ |
265 public Object mirror(Object[] args) { | 265 public Object mirror(Object[] args) { |
266 Object o = args[0]; | 266 Object o = args[0]; |
267 if (o != null && o instanceof JSJavaObject) { | 267 Object res = UNDEFINED; |
268 if (o != null) { | |
269 if (o instanceof JSJavaObject) { | |
268 Oop oop = ((JSJavaObject)o).getOop(); | 270 Oop oop = ((JSJavaObject)o).getOop(); |
269 Object res = null; | |
270 try { | 271 try { |
271 if (oop instanceof InstanceKlass) { | |
272 res = getObjectReader().readClass((InstanceKlass) oop); | |
273 } else { | |
274 res = getObjectReader().readObject(oop); | 272 res = getObjectReader().readObject(oop); |
273 } catch (Exception e) { | |
274 if (debug) e.printStackTrace(getErrorStream()); | |
275 } | |
276 } else if (o instanceof JSMetadata) { | |
277 Metadata metadata = ((JSMetadata)o).getMetadata(); | |
278 try { | |
279 if (metadata instanceof InstanceKlass) { | |
280 res = getObjectReader().readClass((InstanceKlass) metadata); | |
275 } | 281 } |
276 } catch (Exception e) { | 282 } catch (Exception e) { |
277 if (debug) e.printStackTrace(getErrorStream()); | 283 if (debug) e.printStackTrace(getErrorStream()); |
278 } | 284 } |
279 return (res != null)? res : UNDEFINED; | 285 } |
280 } else { | 286 } |
281 return UNDEFINED; | 287 return res; |
282 } | |
283 } | 288 } |
284 | 289 |
285 /** | 290 /** |
286 owner function gets owning thread of given JSJavaObjec, if any, else | 291 owner function gets owning thread of given JSJavaObjec, if any, else |
287 returns null. For other type of objects, the result is undefined. | 292 returns null. For other type of objects, the result is undefined. |