diff options
author | Akira TAGOH <akira@tagoh.org> | 2011-02-24 17:10:59 +0900 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2011-02-24 17:10:59 +0900 |
commit | 2921f281190acaa74069cc14f4c244956bb548e7 (patch) | |
tree | b0991a3aa5f3026863117130e272531d27628fbb | |
parent | cdb57df856a9379aabc6ac687f4cc1c2314528a7 (diff) |
further clean up for hgmem APis
-rw-r--r-- | hieroglyph/hgallocator.c | 65 | ||||
-rw-r--r-- | hieroglyph/hgarray.c | 11 | ||||
-rw-r--r-- | hieroglyph/hgdict.c | 18 | ||||
-rw-r--r-- | hieroglyph/hgmem.c | 14 | ||||
-rw-r--r-- | hieroglyph/hgmessages.h | 34 | ||||
-rw-r--r-- | hieroglyph/hgscanner.l | 2 | ||||
-rw-r--r-- | hieroglyph/hgstack.c | 18 | ||||
-rw-r--r-- | hieroglyph/hgvm.c | 128 | ||||
-rw-r--r-- | tests/Makefile.am | 6 |
9 files changed, 162 insertions, 134 deletions
diff --git a/hieroglyph/hgallocator.c b/hieroglyph/hgallocator.c index 62a9bfb..ed872d4 100644 --- a/hieroglyph/hgallocator.c +++ b/hieroglyph/hgallocator.c @@ -570,6 +570,7 @@ _hg_allocator_alloc(hg_allocator_data_t *data, block = _hg_allocator_get_internal_block(priv, index_, TRUE); block->size = obj_size; + block->ref_count = 0; block->age = priv->snapshot_age; block->gc_marker_id = -1; block->finalizer_id = -1; @@ -817,10 +818,11 @@ _hg_allocator_block_unref(hg_allocator_data_t *data, retry_atomic_decrement: old_val = g_atomic_int_get(&block->ref_count); - if (old_val > 0 && - !g_atomic_int_compare_and_exchange((int *)&block->ref_count, - old_val, old_val - 1)) - goto retry_atomic_decrement; + if (old_val > 0) { + if (!g_atomic_int_compare_and_exchange((int *)&block->ref_count, + old_val, old_val - 1)) + goto retry_atomic_decrement; + } } else { hg_warning("Invalid quark to access: %lx", qdata); } @@ -1064,6 +1066,39 @@ _hg_allocator_gc_init(hg_allocator_data_t *data) } static hg_bool_t +_hg_allocator_run_gc_marker(hg_allocator_private_t *priv, + hg_quark_t index_) +{ + hg_bool_t retval = TRUE; + hg_allocator_block_t *block; + + /* initialize hg_errno to work it properly */ + hg_errno = 0; + + block = _hg_allocator_get_internal_block(priv, index_, FALSE); + if (!block) + hg_error_return (HG_STATUS_FAILED, HG_e_VMerror); + if (block->gc_marker_id >= 0) { + if (block->gc_marker_id >= priv->gc_marker_count) { + hg_warning("GC marker ID is invalid: [%d/%d]", + block->gc_marker_id, priv->gc_marker_count); + hg_error_return (HG_STATUS_FAILED, HG_e_VMerror); + } else if (priv->gc_marker[block->gc_marker_id] == NULL) { + hg_warning("No GC marker registered for %d", + block->gc_marker_id); + hg_error_return (HG_STATUS_FAILED, HG_e_VMerror); + } else { + hg_debug(HG_MSGCAT_GC, "Invoking a GC marker %d for %lx", + block->gc_marker_id, + index_); + retval = priv->gc_marker[block->gc_marker_id](hg_allocator_get_allocated_object(block)); + } + } + + return retval; +} + +static hg_bool_t _hg_allocator_gc_mark(hg_allocator_data_t *data, hg_quark_t index_) { @@ -1076,7 +1111,7 @@ _hg_allocator_gc_mark(hg_allocator_data_t *data, /* this isn't the object in the targeted spool */ if (!priv->slave_bitmap) - hg_error_return (HG_STATUS_SUCCESS, 0); + return _hg_allocator_run_gc_marker(priv, index_); block = _hg_allocator_real_lock_object(data, index_); if (block) { @@ -1089,22 +1124,8 @@ _hg_allocator_gc_mark(hg_allocator_data_t *data, _hg_allocator_bitmap_dump(priv->slave_bitmap, page); #endif priv->slave.used_size += block->size; - if (block->gc_marker_id >= 0) { - if (block->gc_marker_id >= priv->gc_marker_count) { - hg_warning("GC marker ID is invalid: [%d/%d]", - block->gc_marker_id, priv->gc_marker_count); - retval = FALSE; - } else if (priv->gc_marker[block->gc_marker_id] == NULL) { - hg_warning("No GC marker registered for %d", - block->gc_marker_id); - retval = FALSE; - } else { - hg_debug(HG_MSGCAT_GC, "Invoking a GC marker %d for %lx", - block->gc_marker_id, - index_); - retval = priv->gc_marker[block->gc_marker_id](hg_allocator_get_allocated_object(block)); - } - } + + retval = _hg_allocator_run_gc_marker(priv, index_); } else { hg_debug(HG_MSGCAT_GC, "index %ld already marked", index_); } @@ -1169,7 +1190,7 @@ _hg_allocator_gc_finish(hg_allocator_data_t *data) } ref_blocks++; } else { - g_print("%lx will be freed (p: %d, i: %d/%ld)\n", block->size, i, j + 1, priv->bitmap->size[i]); + hg_debug(HG_MSGCAT_GC, "%lx will be freed (p: %d, i: %d/%ld)", block->size, i, j + 1, priv->bitmap->size[i]); used_size -= block->size; if (block->lock_count > 0) { /* evaluate later. there might be a block that is referring the early blocks */ diff --git a/hieroglyph/hgarray.c b/hieroglyph/hgarray.c index c7acb4a..a757201 100644 --- a/hieroglyph/hgarray.c +++ b/hieroglyph/hgarray.c @@ -227,9 +227,12 @@ _hg_object_array_gc_mark(hg_object_t *object) hg_mem_t *m; q = hg_array_get(array, i); - m = hg_mem_spool_get(hg_quark_get_mem_id(q)); - if (!hg_mem_gc_mark(m, q)) - return FALSE; + if (!hg_quark_is_simple_object(q) && + hg_quark_get_type(q) != HG_TYPE_OPER) { + m = hg_mem_spool_get(hg_quark_get_mem_id(q)); + if (!hg_mem_gc_mark(m, q)) + return FALSE; + } } return TRUE; @@ -424,6 +427,8 @@ hg_array_set(hg_array_t *array, array->qcontainer, FALSE); + hg_debug(HG_MSGCAT_ARRAY, "Set 0x%lx into 0x%lx(0x%lx)[%d]", + quark, array->o.self, array->qcontainer, array->offset + index_); container[array->offset + index_] = quark; hg_mem_unlock_object(array->o.mem, array->qcontainer); diff --git a/hieroglyph/hgdict.c b/hieroglyph/hgdict.c index 062b8d5..f8d9dec 100644 --- a/hieroglyph/hgdict.c +++ b/hieroglyph/hgdict.c @@ -326,13 +326,19 @@ _hg_object_dict_node_gc_mark(hg_object_t *object) if (!hg_mem_gc_mark(dnode->o.mem, qnode_nodes[i])) goto qfinalize; hg_debug(HG_MSGCAT_GC, "dictnode: marking key[%ld]", i); - m = hg_mem_spool_get(hg_quark_get_mem_id(qnode_keys[i])); - if (!hg_mem_gc_mark(m, qnode_keys[i])) - goto qfinalize; + if (!hg_quark_is_simple_object(qnode_keys[i]) && + hg_quark_get_type(qnode_keys[i]) != HG_TYPE_OPER) { + m = hg_mem_spool_get(hg_quark_get_mem_id(qnode_keys[i])); + if (!hg_mem_gc_mark(m, qnode_keys[i])) + goto qfinalize; + } hg_debug(HG_MSGCAT_GC, "dictnode: marking value[%ld]", i); - m = hg_mem_spool_get(hg_quark_get_mem_id(qnode_vals[i])); - if (!hg_mem_gc_mark(m, qnode_vals[i])) - goto qfinalize; + if (!hg_quark_is_simple_object(qnode_vals[i]) && + hg_quark_get_type(qnode_vals[i]) != HG_TYPE_OPER) { + m = hg_mem_spool_get(hg_quark_get_mem_id(qnode_vals[i])); + if (!hg_mem_gc_mark(m, qnode_vals[i])) + goto qfinalize; + } } hg_debug(HG_MSGCAT_GC, "dictnode: marking node[%ld]", dnode->n_data); if (!hg_mem_gc_mark(dnode->o.mem, qnode_nodes[dnode->n_data])) diff --git a/hieroglyph/hgmem.c b/hieroglyph/hgmem.c index 6511f6c..b49a4fc 100644 --- a/hieroglyph/hgmem.c +++ b/hieroglyph/hgmem.c @@ -62,7 +62,7 @@ hg_mem_spool_get(hg_int_t id) hg_return_val_if_fail (id < __hg_mem_id, NULL, HG_e_VMerror); hg_return_val_if_fail (id < HG_MAX_MEM, NULL, HG_e_VMerror); - return __hg_mem_spool[id]; + hg_error_return_val (__hg_mem_spool[id], HG_STATUS_SUCCESS, 0); } /** @@ -116,7 +116,7 @@ hg_mem_spool_new_with_allocator(hg_mem_vtable_t *allocator, hg_warning("too many memory spooler being created."); g_free(retval); - return NULL; + hg_error_return_val (NULL, HG_STATUS_FAILED, HG_e_VMerror); } retval->data = allocator->initialize(); if (!retval->data) { @@ -841,9 +841,13 @@ hg_mem_ref(hg_mem_t *mem, hg_return_if_fail (mem->allocator != NULL, HG_e_VMerror); hg_return_if_fail (mem->allocator->block_ref != NULL, HG_e_VMerror); hg_return_if_fail (mem->data != NULL, HG_e_VMerror); - hg_return_if_fail (qdata != Qnil, HG_e_VMerror); hg_return_if_fail (hg_quark_has_mem_id(qdata, mem->id), HG_e_VMerror); + if (qdata == Qnil || + hg_quark_is_simple_object(qdata) || + hg_quark_get_type(qdata) == HG_TYPE_OPER) + return; + mem->allocator->block_ref(mem->data, qdata); } @@ -863,7 +867,9 @@ hg_mem_unref(hg_mem_t *mem, hg_return_if_fail (mem->allocator->block_unref != NULL, HG_e_VMerror); hg_return_if_fail (mem->data != NULL, HG_e_VMerror); - if (qdata == Qnil) + if (qdata == Qnil || + hg_quark_is_simple_object(qdata) || + hg_quark_get_type(qdata) == HG_TYPE_OPER) return; mem->allocator->block_unref(mem->data, qdata); diff --git a/hieroglyph/hgmessages.h b/hieroglyph/hgmessages.h index e578626..388a4ae 100644 --- a/hieroglyph/hgmessages.h +++ b/hieroglyph/hgmessages.h @@ -60,23 +60,23 @@ enum _hg_message_flags_t { }; enum _hg_message_category_t { HG_MSGCAT_0 = 0, - HG_MSGCAT_DEBUG, - HG_MSGCAT_TRACE, - HG_MSGCAT_BITMAP, - HG_MSGCAT_ALLOC, - HG_MSGCAT_GC, - HG_MSGCAT_SNAPSHOT, - HG_MSGCAT_MEM, - HG_MSGCAT_ARRAY, - HG_MSGCAT_DEVICE, - HG_MSGCAT_DICT, - HG_MSGCAT_FILE, - HG_MSGCAT_GSTATE, - HG_MSGCAT_PATH, - HG_MSGCAT_PLUGIN, - HG_MSGCAT_STRING, - HG_MSGCAT_VM, - HG_MSGCAT_SCAN, + HG_MSGCAT_DEBUG, /* 1 */ + HG_MSGCAT_TRACE, /* 2 */ + HG_MSGCAT_BITMAP, /* 4 */ + HG_MSGCAT_ALLOC, /* 8 */ + HG_MSGCAT_GC, /* 16 */ + HG_MSGCAT_SNAPSHOT, /* 32 */ + HG_MSGCAT_MEM, /* 64 */ + HG_MSGCAT_ARRAY, /* 128 */ + HG_MSGCAT_DEVICE, /* 256 */ + HG_MSGCAT_DICT, /* 512 */ + HG_MSGCAT_FILE, /* 1024 */ + HG_MSGCAT_GSTATE, /* 2048 */ + HG_MSGCAT_PATH, /* 4096 */ + HG_MSGCAT_PLUGIN, /* 8192 */ + HG_MSGCAT_STRING, /* 16384 */ + HG_MSGCAT_VM, /* 32768 */ + HG_MSGCAT_SCAN, /* 65536 */ HG_MSGCAT_END }; diff --git a/hieroglyph/hgscanner.l b/hieroglyph/hgscanner.l index 11a5998..478f73c 100644 --- a/hieroglyph/hgscanner.l +++ b/hieroglyph/hgscanner.l @@ -622,6 +622,8 @@ hg_scanner_get_token(hg_scanner_t *scanner) { hg_return_val_if_fail (scanner != NULL, Qnil, HG_e_VMerror); + hg_debug(HG_MSGCAT_SCAN, "Scanned object: 0x%lx", scanner->result); + return scanner->result; } diff --git a/hieroglyph/hgstack.c b/hieroglyph/hgstack.c index f3c0052..02351a2 100644 --- a/hieroglyph/hgstack.c +++ b/hieroglyph/hgstack.c @@ -143,17 +143,21 @@ _hg_object_stack_gc_mark(hg_object_t *object) hg_slist_t *l; hg_mem_t *m; + hg_debug(HG_MSGCAT_GC, "Marking objects in the stack"); for (l = stack->last_stack; l != NULL; l = l->next) { if (!hg_mem_gc_mark(object->mem, l->self)) return FALSE; - m = hg_mem_spool_get(hg_quark_get_mem_id(l->data)); - if (!m) { - hg_warning("Unable to obtain the memory spooler from %lx", - l->data); - hg_error_return (HG_STATUS_FAILED, HG_e_VMerror); + if (!hg_quark_is_simple_object(l->data) && + hg_quark_get_type(l->data) != HG_TYPE_OPER) { + m = hg_mem_spool_get(hg_quark_get_mem_id(l->data)); + if (!m) { + hg_warning("Unable to obtain the memory spooler from %lx", + l->data); + hg_error_return (HG_STATUS_FAILED, HG_e_VMerror); + } + if (!hg_mem_gc_mark(m, l->data)) + return FALSE; } - if (!hg_mem_gc_mark(m, l->data)) - return FALSE; } return _hg_stack_spooler_gc_mark(stack->spool); } diff --git a/hieroglyph/hgvm.c b/hieroglyph/hgvm.c index fc60da5..8e5fc53 100644 --- a/hieroglyph/hgvm.c +++ b/hieroglyph/hgvm.c @@ -314,27 +314,22 @@ hg_vm_stepi_in_exec_array(hg_vm_t *vm, qresult = hg_scanner_get_token(vm->scanner); hg_vm_quark_set_default_acl(vm, &qresult); #if defined (HG_DEBUG) && defined (HG_VM_DEBUG) - G_STMT_START { + HG_STMT_START { hg_quark_t qs; hg_string_t *s; qs = hg_vm_quark_to_string(vm, qresult, TRUE, (hg_pointer_t *)&s); if (qs == Qnil) { - if (!HG_ERROR_IS_SUCCESS0 ()) { - g_print("WW: Unable to look up the scanned object: %lx: %s\n", qresult, err->message); - g_clear_error(&err); - } else { - g_print("WW: Unable to look up the scanned object: %lx\n", qresult); - } + hg_warning("Unable to lookup the scanned object: %lx", qresult); } else { hg_char_t *cstr = hg_string_get_cstr(s); - g_print("I(%d): scanning... %s [%s:%c%c%c]\n", - vm->n_nest_scan, cstr, - hg_quark_get_type_name(qresult), - hg_quark_is_readable(qresult) ? 'r' : '-', - hg_quark_is_writable(qresult) ? 'w' : '-', - hg_quark_is_executable(qresult) ? 'x' : '-'); + hg_debug(HG_MSGCAT_SCAN, "[%d] scanning... %s [%s:%c%c%c]", + vm->n_nest_scan, cstr, + hg_quark_get_type_name(qresult), + hg_quark_is_readable(qresult) ? 'r' : '-', + hg_quark_is_writable(qresult) ? 'w' : '-', + hg_quark_is_executable(qresult) ? 'x' : '-'); g_free(cstr); /* this is an instant object. * surely no reference to the container. @@ -342,7 +337,7 @@ hg_vm_stepi_in_exec_array(hg_vm_t *vm, */ hg_string_free(s, TRUE); } - } G_STMT_END; + } HG_STMT_END; #endif /* exception for processing the executable array */ if (HG_IS_QNAME (qresult) && @@ -352,27 +347,22 @@ hg_vm_stepi_in_exec_array(hg_vm_t *vm, if (qresult == Qnil) return FALSE; #if defined (HG_DEBUG) && defined (HG_VM_DEBUG) - G_STMT_START { + HG_STMT_START { hg_quark_t qs; hg_string_t *s; qs = hg_vm_quark_to_string(vm, qresult, TRUE, (hg_pointer_t *)&s); if (qs == Qnil) { - if (err) { - g_print("WW: Unable to look up the scanned object: %lx: %s\n", qresult, err->message); - g_clear_error(&err); - } else { - g_print("WW: Unable to look up the scanned object: %lx\n", qresult); - } + hg_warning("Unable to look up the scanned object: %lx", qresult); } else { hg_char_t *cstr = hg_string_get_cstr(s); - g_print("I(%d): scanned result %s [%s:%c%c%c]\n", - vm->n_nest_scan, cstr, - hg_quark_get_type_name(qresult), - hg_quark_is_readable(qresult) ? 'r' : '-', - hg_quark_is_writable(qresult) ? 'w' : '-', - hg_quark_is_executable(qresult) ? 'x' : '-'); + hg_debug(HG_MSGCAT_SCAN, "[%d] scanned result %s [%s:%c%c%c]", + vm->n_nest_scan, cstr, + hg_quark_get_type_name(qresult), + hg_quark_is_readable(qresult) ? 'r' : '-', + hg_quark_is_writable(qresult) ? 'w' : '-', + hg_quark_is_executable(qresult) ? 'x' : '-'); g_free(cstr); /* this is an instant object. * surely no reference to the container. @@ -380,7 +370,7 @@ hg_vm_stepi_in_exec_array(hg_vm_t *vm, */ hg_string_free(s, TRUE); } - } G_STMT_END; + } HG_STMT_END; #endif } else if (!strcmp(name, "}")) { hg_size_t i, idx = 0; @@ -426,7 +416,7 @@ hg_vm_stepi_in_exec_array(hg_vm_t *vm, } break; default: - hg_warning("Unknown object type: %d\n", hg_quark_get_type(qexecobj)); + hg_warning("Unknown object type: %d", hg_quark_get_type(qexecobj)); return FALSE; } @@ -1655,27 +1645,23 @@ hg_vm_stepi(hg_vm_t *vm, } evaluate: + hg_debug(HG_MSGCAT_VM, "Executing %lx", qexecobj); #if defined (HG_DEBUG) && defined (HG_VM_DEBUG) - G_STMT_START { + HG_STMT_START { hg_quark_t qs; hg_string_t *s; qs = hg_vm_quark_to_string(vm, qexecobj, TRUE, (hg_pointer_t *)&s); if (qs == Qnil) { - if (err) { - g_print("W: Unable to look up the object being executed: %lx: %s\n", qexecobj, err->message); - g_clear_error(&err); - } else { - g_print("W: Unable to look up the object being executed: %lx\n", qexecobj); - } + hg_warning("Unable to look up the object being executed: %lx", qexecobj); } else { hg_char_t *cstr = hg_string_get_cstr(s); - g_print("I: executing... %s [%s:%c%c%c]\n", - cstr, hg_quark_get_type_name(qexecobj), - hg_quark_is_readable(qexecobj) ? 'r' : '-', - hg_quark_is_writable(qexecobj) ? 'w' : '-', - hg_quark_is_executable(qexecobj) ? 'x' : '-'); + hg_debug(HG_MSGCAT_VM, "executing... %s [%s:%c%c%c]", + cstr, hg_quark_get_type_name(qexecobj), + hg_quark_is_readable(qexecobj) ? 'r' : '-', + hg_quark_is_writable(qexecobj) ? 'w' : '-', + hg_quark_is_executable(qexecobj) ? 'x' : '-'); g_free(cstr); /* this is an instant object. * surely no reference to the container. @@ -1683,7 +1669,7 @@ hg_vm_stepi(hg_vm_t *vm, */ hg_string_free(s, TRUE); } - } G_STMT_END; + } HG_STMT_END; #endif switch (hg_quark_get_type(qexecobj)) { case HG_TYPE_NULL: @@ -1836,6 +1822,11 @@ hg_vm_stepi(hg_vm_t *vm, vm); if (retval) { hg_stack_drop(estack); +#ifdef HG_DEBUG + if (!HG_ERROR_IS_SUCCESS0 ()) { + g_print("hg_errno wasn't cleaned up\n"); + } +#endif } *is_proceeded = TRUE; break; @@ -1852,9 +1843,7 @@ hg_vm_stepi(hg_vm_t *vm, _HG_VM_UNLOCK (vm, qexecobj); if (HG_ERROR_IS_SUCCESS0 () && is_eof) { -#if defined (HG_DEBUG) && defined (HG_VM_DEBUG) - g_print("I: EOF detected\n"); -#endif + hg_debug(HG_MSGCAT_VM, "EOF detected"); hg_stack_drop(estack); *is_proceeded = TRUE; break; @@ -1868,26 +1857,21 @@ hg_vm_stepi(hg_vm_t *vm, qresult = hg_scanner_get_token(vm->scanner); hg_vm_quark_set_default_acl(vm, &qresult); #if defined (HG_DEBUG) && defined (HG_VM_DEBUG) - G_STMT_START { + HG_STMT_START { hg_quark_t qs; hg_string_t *s; qs = hg_vm_quark_to_string(vm, qresult, TRUE, (hg_pointer_t *)&s); if (qs == Qnil) { - if (err) { - g_print("W: Unable to look up the scanned object: %lx: %s\n", qresult, err->message); - g_clear_error(&err); - } else { - g_print("W: Unable to look up the scanned object: %lx\n", qresult); - } + hg_warning("Unable to look up the scanned object: %lx", qresult); } else { hg_char_t *cstr = hg_string_get_cstr(s); - g_print("I: scanning... %s [%s:%c%c%c]\n", - cstr, hg_quark_get_type_name(qresult), - hg_quark_is_readable(qresult) ? 'r' : '-', - hg_quark_is_writable(qresult) ? 'w' : '-', - hg_quark_is_executable(qresult) ? 'x' : '-'); + hg_debug(HG_MSGCAT_SCAN, "scanning... %s [%s:%c%c%c]", + cstr, hg_quark_get_type_name(qresult), + hg_quark_is_readable(qresult) ? 'r' : '-', + hg_quark_is_writable(qresult) ? 'w' : '-', + hg_quark_is_executable(qresult) ? 'x' : '-'); g_free(cstr); /* this is an instant object. * surely no reference to the container. @@ -1895,7 +1879,7 @@ hg_vm_stepi(hg_vm_t *vm, */ hg_string_free(s, TRUE); } - } G_STMT_END; + } HG_STMT_END; #endif /* exception for processing the executable array */ if (HG_IS_QNAME (qresult) && @@ -1905,27 +1889,22 @@ hg_vm_stepi(hg_vm_t *vm, if (qresult == Qnil) break; #if defined (HG_DEBUG) && defined (HG_VM_DEBUG) - G_STMT_START { + HG_STMT_START { hg_quark_t qs; hg_string_t *s; qs = hg_vm_quark_to_string(vm, qresult, TRUE, (hg_pointer_t *)&s); if (qs == Qnil) { - if (err) { - g_print("W: Unable to look up the scanned object: %lx: %s\n", qresult, err->message); - g_clear_error(&err); - } else { - g_print("W: Unable to look up the scanned object: %lx\n", qresult); - } + hg_warning("Unable to look up the scanned object: %lx", qresult); } else { hg_char_t *cstr = hg_string_get_cstr(s); - g_print("I: scanned result %s [%s:%c%c%c]\n", - cstr, - hg_quark_get_type_name(qresult), - hg_quark_is_readable(qresult) ? 'r' : '-', - hg_quark_is_writable(qresult) ? 'w' : '-', - hg_quark_is_executable(qresult) ? 'x' : '-'); + hg_debug(HG_MSGCAT_SCAN, "scanned result %s [%s:%c%c%c]", + cstr, + hg_quark_get_type_name(qresult), + hg_quark_is_readable(qresult) ? 'r' : '-', + hg_quark_is_writable(qresult) ? 'w' : '-', + hg_quark_is_executable(qresult) ? 'x' : '-'); g_free(cstr); /* this is an instant object. * surely no reference to the container. @@ -1933,7 +1912,7 @@ hg_vm_stepi(hg_vm_t *vm, */ hg_string_free(s, TRUE); } - } G_STMT_END; + } HG_STMT_END; #endif if (!hg_stack_push(ostack, qresult)) { hg_vm_set_error(vm, qexecobj, @@ -1949,7 +1928,7 @@ hg_vm_stepi(hg_vm_t *vm, } break; default: - hg_warning("Unknown object type: %d\n", hg_quark_get_type(qexecobj)); + hg_warning("Unknown object type: %d", hg_quark_get_type(qexecobj)); return FALSE; } @@ -2007,7 +1986,7 @@ hg_vm_main_loop(hg_vm_t *vm) if (!hg_vm_step(vm)) { if (!hg_vm_has_error(vm)) { - g_print("[BUG] detected an infinite loop in the exec stack.\n"); + hg_critical("[BUG] detected an infinite loop in the exec stack."); hg_operator_invoke(HG_QOPER (HG_enc_private_abort), vm); } } @@ -3940,7 +3919,6 @@ hg_vm_quark_is_executable(hg_vm_t *vm, !HG_IS_QOPER (*qdata)) { hg_object_t *o = _HG_VM_LOCK (vm, *qdata); hg_quark_acl_t acl = hg_object_get_acl(o); - if (acl != -1) { hg_quark_set_acl(qdata, acl); } diff --git a/tests/Makefile.am b/tests/Makefile.am index 91017f4..d63c626 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -55,6 +55,7 @@ noinst_PROGRAMS += \ test-hgencoding \ test-hgint \ test-hgmark \ + test-hgmem \ test-hgname \ test-hgnull \ test-hgquark \ @@ -99,6 +100,11 @@ test_hgmark_SOURCES = \ $(common_sources) \ $(NULL) # +test_hgmem_SOURCES = \ + hgmem.c \ + $(common_sources) \ + $(NULL) +# test_hgname_SOURCES = \ hgname.c \ $(common_sources) \ |