Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/NodeUtil.java @ 16779:e52ad0d3b7d6
put some security sensitive actions into a privileged action
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Tue, 12 Aug 2014 00:08:19 +0200 |
parents | 70f47dbbcabd |
children | 846c059e3ecf |
comparison
equal
deleted
inserted
replaced
16778:8a05a498ab76 | 16779:e52ad0d3b7d6 |
---|---|
25 package com.oracle.truffle.api.nodes; | 25 package com.oracle.truffle.api.nodes; |
26 | 26 |
27 import java.io.*; | 27 import java.io.*; |
28 import java.lang.annotation.*; | 28 import java.lang.annotation.*; |
29 import java.lang.reflect.*; | 29 import java.lang.reflect.*; |
30 import java.security.*; | |
30 import java.util.*; | 31 import java.util.*; |
31 | 32 |
32 import sun.misc.*; | 33 import sun.misc.*; |
33 | 34 |
34 import com.oracle.truffle.api.*; | 35 import com.oracle.truffle.api.*; |
158 */ | 159 */ |
159 public static final class NodeClass { | 160 public static final class NodeClass { |
160 private static final ClassValue<NodeClass> nodeClasses = new ClassValue<NodeClass>() { | 161 private static final ClassValue<NodeClass> nodeClasses = new ClassValue<NodeClass>() { |
161 @SuppressWarnings("unchecked") | 162 @SuppressWarnings("unchecked") |
162 @Override | 163 @Override |
163 protected NodeClass computeValue(Class<?> clazz) { | 164 protected NodeClass computeValue(final Class<?> clazz) { |
164 assert Node.class.isAssignableFrom(clazz); | 165 assert Node.class.isAssignableFrom(clazz); |
165 return new NodeClass((Class<? extends Node>) clazz, unsafeFieldOffsetProvider); | 166 return AccessController.doPrivileged(new PrivilegedAction<NodeClass>() { |
167 public NodeClass run() { | |
168 return new NodeClass((Class<? extends Node>) clazz, unsafeFieldOffsetProvider); | |
169 } | |
170 }); | |
166 } | 171 } |
167 }; | 172 }; |
168 | 173 |
169 // The comprehensive list of all fields. | 174 // The comprehensive list of all fields. |
170 private final NodeField[] fields; | 175 private final NodeField[] fields; |