Signed-off-by: Tomek Grabiec <tgrab...@gmail.com> --- arch/x86/insn-selector.brg | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/arch/x86/insn-selector.brg b/arch/x86/insn-selector.brg index d6b608a..724abc6 100644 --- a/arch/x86/insn-selector.brg +++ b/arch/x86/insn-selector.brg @@ -914,8 +914,9 @@ reg: EXPR_CLASS_FIELD 1 struct var_info *out; struct insn *mov_insn; - struct vm_field *vmf; + struct vm_field *vmf; struct vm_class *vmc; + enum vm_class_state vmc_state; expr = to_expr(tree); @@ -925,8 +926,11 @@ reg: EXPR_CLASS_FIELD 1 vmf = expr->class_field; vmc = vmf->class; - /* XXX: Lock class */ - if (vmc->state >= VM_CLASS_INITIALIZING) { + vm_monitor_lock(&vmc->monitor); + vmc_state = vmc->state; + vm_monitor_unlock(&vmc->monitor); + + if (vmc_state >= VM_CLASS_INITIALIZING) { /* Class is already initialized; no need for fix-up. We also * don't want the fixup if we're already inside the * initializer. */ @@ -1510,8 +1514,9 @@ stmt: STMT_STORE(EXPR_CLASS_FIELD, reg) struct var_info *src; struct insn *mov_insn; - struct vm_field *vmf; + struct vm_field *vmf; struct vm_class *vmc; + enum vm_class_state vmc_state; stmt = to_stmt(tree); store_dest = to_expr(stmt->store_dest); @@ -1522,8 +1527,11 @@ stmt: STMT_STORE(EXPR_CLASS_FIELD, reg) vmf = store_dest->class_field; vmc = vmf->class; - /* XXX: Lock class */ - if (vmc->state >= VM_CLASS_INITIALIZING) { + vm_monitor_lock(&vmc->monitor); + vmc_state = vmc->state; + vm_monitor_unlock(&vmc->monitor); + + if (vmc_state >= VM_CLASS_INITIALIZING) { /* Class is already initialized; no need for fix-up. We also * don't want the fixup if we're already inside the * initializer. */ -- 1.6.0.6 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jatovm-devel mailing list Jatovm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jatovm-devel