Mercurial > hg > Members > kono > jpf-core
comparison src/main/gov/nasa/jpf/jvm/bytecode/NEW.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 |
comparison
equal
deleted
inserted
replaced
22:cd7880ab73c7 | 23:db918c531e6d |
---|---|
55 ci = ti.resolveReferencedClass(cname); | 55 ci = ti.resolveReferencedClass(cname); |
56 } catch(LoadOnJPFRequired lre) { | 56 } catch(LoadOnJPFRequired lre) { |
57 return ti.getPC(); | 57 return ti.getPC(); |
58 } | 58 } |
59 | 59 |
60 if (!ci.isRegistered()){ | 60 if (ci.initializeClass(ti)){ |
61 ci.registerClass(ti); | 61 // continue with the topframe and re-exec this insn once the clinits are done |
62 return ti.getPC(); | |
62 } | 63 } |
63 | |
64 // we might have to execute clinits | |
65 if (ci.initializeClass(ti)) { | |
66 // continue with the topframe and re-exec this insn once the clinits are done | |
67 return ti.getPC(); | |
68 } | |
69 | 64 |
70 if (heap.isOutOfMemory()) { // simulate OutOfMemoryError | 65 if (heap.isOutOfMemory()) { // simulate OutOfMemoryError |
71 return ti.createAndThrowException("java.lang.OutOfMemoryError", | 66 return ti.createAndThrowException("java.lang.OutOfMemoryError", |
72 "trying to allocate new " + cname); | 67 "trying to allocate new " + cname); |
73 } | 68 } |