Mercurial > hg > Members > kono > jpf-core
comparison src/main/gov/nasa/jpf/util/json/JSONObject.java @ 23:db918c531e6d
streamlined class init, which was a mixed case of registerClass()/initializeClass() and pushRequiredClinits(). Now it is a single initializeClass(ti) method which combines the previous initializeClass(), pushRequiredClinits() and pushClinit() methods. The reason for combining these is the forthcoming replacement of separately locked clinits from different DirectCallStackFrames with a single synthetic frame that calls clinits from nested synchronized blocks. This is required to model hotspot, which does cause deadlocks with concurrent init of classes that cause subclass init during their clinit executions.
author | Peter Mehlitz <Peter.C.Mehlitz@nasa.gov> |
---|---|
date | Wed, 15 Apr 2015 22:40:21 -0700 |
parents | 61d41facf527 |
children | 6774e2e08d37 |
comparison
equal
deleted
inserted
replaced
22:cd7880ab73c7 | 23:db918c531e6d |
---|---|
97 * NOTE - this currently does not support concrete field types that are subtypes | 97 * NOTE - this currently does not support concrete field types that are subtypes |
98 * of the respective field types | 98 * of the respective field types |
99 */ | 99 */ |
100 public boolean requiresClinitExecution (ClassInfo ci, ThreadInfo ti){ | 100 public boolean requiresClinitExecution (ClassInfo ci, ThreadInfo ti){ |
101 while (ci != null){ | 101 while (ci != null){ |
102 if (ci.pushRequiredClinits(ti)){ | 102 if (ci.initializeClass(ti)){ |
103 return true; | 103 return true; |
104 } | 104 } |
105 | 105 |
106 for (FieldInfo fi : ci.getDeclaredInstanceFields()) { | 106 for (FieldInfo fi : ci.getDeclaredInstanceFields()) { |
107 ClassInfo ciField = fi.getTypeClassInfo(); | 107 ClassInfo ciField = fi.getTypeClassInfo(); |
181 ei.setReferenceField(fi, newSubObjRef); | 181 ei.setReferenceField(fi, newSubObjRef); |
182 | 182 |
183 } else { | 183 } else { |
184 // Not a special case. Fill it recursively | 184 // Not a special case. Fill it recursively |
185 ClassInfo ciField = fi.getTypeClassInfo(); | 185 ClassInfo ciField = fi.getTypeClassInfo(); |
186 if (ciField.pushRequiredClinits(env.getThreadInfo())){ | 186 if (ciField.initializeClass(env.getThreadInfo())){ |
187 throw new ClinitRequired(ciField); | 187 throw new ClinitRequired(ciField); |
188 } | 188 } |
189 | 189 |
190 JSONObject jsonObj = val.getObject(); | 190 JSONObject jsonObj = val.getObject(); |
191 int fieldRef = MJIEnv.NULL; | 191 int fieldRef = MJIEnv.NULL; |