[svn:parrot] r46210 - in trunk: compilers/imcc lib/Parrot/Pmc2c src src/interp src/pmc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Sat May 1 21:39:11 UTC 2010
Author: NotFound
Date: Sat May 1 21:39:10 2010
New Revision: 46210
URL: https://trac.parrot.org/parrot/changeset/46210
Log:
implement Integer vtable init_int and use it in several places where is never HLL mapped
Modified:
trunk/compilers/imcc/pbc.c
trunk/lib/Parrot/Pmc2c/Attribute.pm
trunk/src/hll.c
trunk/src/interp/inter_misc.c
trunk/src/oo.c
trunk/src/packfile.c
trunk/src/pmc/class.pmc
trunk/src/pmc/default.pmc
trunk/src/pmc/exception.pmc
trunk/src/pmc/fixedintegerarray.pmc
trunk/src/pmc/integer.pmc
trunk/src/pmc/object.pmc
trunk/src/pmc/sub.pmc
Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c Sat May 1 21:12:54 2010 (r46209)
+++ trunk/compilers/imcc/pbc.c Sat May 1 21:39:10 2010 (r46210)
@@ -1082,10 +1082,9 @@
sig_pmc = Parrot_pmc_new(interp, enum_class_String);
VTABLE_set_string_native(interp, sig_pmc, type_name);
}
- else {
- sig_pmc = Parrot_pmc_new(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, sig_pmc, type_num);
- }
+ else
+ sig_pmc = Parrot_pmc_new_init_int(interp,
+ enum_class_Integer, type_num);
}
else {
PARROT_ASSERT(r->set == 'K');
Modified: trunk/lib/Parrot/Pmc2c/Attribute.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/Attribute.pm Sat May 1 21:12:54 2010 (r46209)
+++ trunk/lib/Parrot/Pmc2c/Attribute.pm Sat May 1 21:39:10 2010 (r46210)
@@ -208,8 +208,7 @@
}
elsif ($attrtype eq "INTVAL") {
$decl .= <<"EOA";
- PMC * const attr_value = Parrot_pmc_new(interp, enum_class_Integer); \\
- VTABLE_set_integer_native(interp, attr_value, value); \\
+ PMC * const attr_value = Parrot_pmc_new_init_int(interp, enum_class_Integer, value); \\
VTABLE_set_attr_str(interp, pmc, \\
Parrot_str_new_constant(interp, "$attrname"), attr_value); \\
EOA
Modified: trunk/src/hll.c
==============================================================================
--- trunk/src/hll.c Sat May 1 21:12:54 2010 (r46209)
+++ trunk/src/hll.c Sat May 1 21:39:10 2010 (r46210)
@@ -97,8 +97,7 @@
else
VTABLE_push_pmc(interp, hll_info, entry);
- entry_id = Parrot_pmc_new_constant(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, entry_id, id);
+ entry_id = Parrot_pmc_new_constant_init_int(interp, enum_class_Integer, id);
VTABLE_set_pmc_keyed_int(interp, entry, e_HLL_id, entry_id);
return entry;
Modified: trunk/src/interp/inter_misc.c
==============================================================================
--- trunk/src/interp/inter_misc.c Sat May 1 21:12:54 2010 (r46209)
+++ trunk/src/interp/inter_misc.c Sat May 1 21:39:10 2010 (r46210)
@@ -111,10 +111,9 @@
{
ASSERT_ARGS(Parrot_mark_method_writes)
STRING *const str_name = Parrot_str_new_constant(interp, name);
- PMC *const pmc_true = Parrot_pmc_new(interp, enum_class_Integer);
+ PMC *const pmc_true = Parrot_pmc_new_init_int(interp, enum_class_Integer, 1);
PMC *const method = VTABLE_get_pmc_keyed_str(
interp, interp->vtables[type]->_namespace, str_name);
- VTABLE_set_integer_native(interp, pmc_true, 1);
VTABLE_setprop(interp, method, CONST_STRING(interp, "write"), pmc_true);
}
Modified: trunk/src/oo.c
==============================================================================
--- trunk/src/oo.c Sat May 1 21:12:54 2010 (r46209)
+++ trunk/src/oo.c Sat May 1 21:39:10 2010 (r46210)
@@ -648,11 +648,10 @@
}
{
if (!typeid_exists) {
- PMC * const classname_hash = interp->class_hash;
- PMC * const item = Parrot_pmc_new(interp, enum_class_Integer);
/* set entry in name->type hash */
- VTABLE_set_integer_native(interp, item, type);
-
+ PMC * const classname_hash = interp->class_hash;
+ PMC * const item = Parrot_pmc_new_init_int(interp,
+ enum_class_Integer, type);
VTABLE_set_pmc_keyed(interp, classname_hash, name, item);
}
}
Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c Sat May 1 21:12:54 2010 (r46209)
+++ trunk/src/packfile.c Sat May 1 21:39:10 2010 (r46210)
@@ -4525,8 +4525,7 @@
switch (type) {
case PF_ANNOTATION_KEY_TYPE_INT:
- result = Parrot_pmc_new(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, result, value);
+ result = Parrot_pmc_new_init_int(interp, enum_class_Integer, value);
break;
case PF_ANNOTATION_KEY_TYPE_NUM:
result = Parrot_pmc_new(interp, enum_class_Float);
Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc Sat May 1 21:12:54 2010 (r46209)
+++ trunk/src/pmc/class.pmc Sat May 1 21:39:10 2010 (r46210)
@@ -1048,8 +1048,7 @@
VTABLE_set_string_native(INTERP, found, _class->name);
}
else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "id"))) {
- found = Parrot_pmc_new(INTERP, enum_class_Integer);
- VTABLE_set_integer_native(INTERP, found, _class->id);
+ found = Parrot_pmc_new_init_int(INTERP, enum_class_Integer, _class->id);
}
else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "namespace"))) {
/* Should not clone this. */
@@ -1071,8 +1070,7 @@
found = _class->roles;
}
else if (Parrot_str_equal(INTERP, what, CONST_STRING(INTERP, "flags"))) {
- found = Parrot_pmc_new(INTERP, enum_class_Integer);
- VTABLE_set_integer_native(INTERP, found,
+ found = Parrot_pmc_new_init_int(INTERP, enum_class_Integer,
(INTVAL)PObj_get_FLAGS(SELF));
}
else
Modified: trunk/src/pmc/default.pmc
==============================================================================
--- trunk/src/pmc/default.pmc Sat May 1 21:12:54 2010 (r46209)
+++ trunk/src/pmc/default.pmc Sat May 1 21:39:10 2010 (r46210)
@@ -242,8 +242,8 @@
ASSERT_ARGS(propagate_std_props)
if (self->vtable->flags & (VTABLE_IS_CONST_FLAG | VTABLE_IS_READONLY_FLAG)){
- PMC * const pmc_true = Parrot_pmc_new(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, pmc_true, 1);
+ PMC * const pmc_true = Parrot_pmc_new_init_int(interp,
+ enum_class_Integer, 1);
VTABLE_set_pmc_keyed_str(interp, prop_hash, CONST_STRING(interp, "_ro"), pmc_true);
}
}
@@ -290,8 +290,8 @@
if ((self->vtable->flags & (VTABLE_IS_CONST_FLAG | VTABLE_IS_READONLY_FLAG))
&& Parrot_str_equal(interp, key, CONST_STRING(interp, "_ro"))) {
- PMC * const ret_val = Parrot_pmc_new(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, ret_val, 1);
+ PMC * const ret_val = Parrot_pmc_new_init_int(interp,
+ enum_class_Integer, 1);
return ret_val;
}
else
@@ -992,8 +992,7 @@
VTABLE PMC *inspect_str(STRING *name) {
if (Parrot_str_equal(interp, name, CONST_STRING(interp, "flags"))) {
- PMC *found = Parrot_pmc_new(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, found,
+ PMC *found = Parrot_pmc_new_init_int(interp, enum_class_Integer,
(INTVAL)PObj_get_FLAGS(SELF));
return found;
}
Modified: trunk/src/pmc/exception.pmc
==============================================================================
--- trunk/src/pmc/exception.pmc Sat May 1 21:12:54 2010 (r46209)
+++ trunk/src/pmc/exception.pmc Sat May 1 21:39:10 2010 (r46210)
@@ -545,26 +545,22 @@
if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "type"))) {
INTVAL type;
GET_ATTR_type(interp, SELF, type);
- value = Parrot_pmc_new(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, value, type);
+ value = Parrot_pmc_new_init_int(interp, enum_class_Integer, type);
}
else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "severity"))) {
INTVAL severity;
GET_ATTR_severity(interp, SELF, severity);
- value = Parrot_pmc_new(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, value, severity);
+ value = Parrot_pmc_new_init_int(interp, enum_class_Integer, severity);
}
else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "exit_code"))) {
INTVAL exit_code;
GET_ATTR_exit_code(interp, SELF, exit_code);
- value = Parrot_pmc_new(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, value, exit_code);
+ value = Parrot_pmc_new_init_int(interp, enum_class_Integer, exit_code);
}
else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "handled"))) {
INTVAL handled;
GET_ATTR_handled(interp, SELF, handled);
- value = Parrot_pmc_new(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, value, handled);
+ value = Parrot_pmc_new_init_int(interp, enum_class_Integer, handled);
}
else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "message"))) {
STRING *message = SELF.get_string();
Modified: trunk/src/pmc/fixedintegerarray.pmc
==============================================================================
--- trunk/src/pmc/fixedintegerarray.pmc Sat May 1 21:12:54 2010 (r46209)
+++ trunk/src/pmc/fixedintegerarray.pmc Sat May 1 21:39:10 2010 (r46210)
@@ -317,9 +317,8 @@
*/
VTABLE PMC *get_pmc_keyed_int(INTVAL key) {
- PMC * const ret = Parrot_pmc_new(INTERP, enum_class_Integer);
const INTVAL val = SELF.get_integer_keyed_int(key);
- VTABLE_set_integer_native(INTERP, ret, val);
+ PMC * const ret = Parrot_pmc_new_init_int(INTERP, enum_class_Integer, val);
return ret;
}
Modified: trunk/src/pmc/integer.pmc
==============================================================================
--- trunk/src/pmc/integer.pmc Sat May 1 21:12:54 2010 (r46209)
+++ trunk/src/pmc/integer.pmc Sat May 1 21:39:10 2010 (r46210)
@@ -102,6 +102,13 @@
attrs->iv = VTABLE_get_integer(INTERP, init);
}
+ VTABLE void init_int(INTVAL init) {
+ Parrot_Integer_attributes * const attrs =
+ (Parrot_Integer_attributes *)PMC_data(SELF);
+
+ attrs->iv = init;
+ }
+
/*
=item C<PMC *clone()>
Modified: trunk/src/pmc/object.pmc
==============================================================================
--- trunk/src/pmc/object.pmc Sat May 1 21:12:54 2010 (r46209)
+++ trunk/src/pmc/object.pmc Sat May 1 21:39:10 2010 (r46210)
@@ -883,11 +883,10 @@
UNLOCK_INTERPRETER(master);
ret = SELF;
- _true = Parrot_pmc_new(INTERP, enum_class_Integer);
-
/* Setting the '_ro' property switches to the read-only vtable */
- VTABLE_set_integer_native(INTERP, _true, 1);
+ _true = Parrot_pmc_new_init_int(INTERP, enum_class_Integer, 1);
VTABLE_setprop(INTERP, ret, CONST_STRING(interp, "_ro"), _true);
+
SELF->vtable->pmc_class = master->vtables[type_num]->pmc_class;
Parrot_gc_add_pmc_sync(INTERP, ret);
PObj_is_PMC_shared_SET(ret);
Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc Sat May 1 21:12:54 2010 (r46209)
+++ trunk/src/pmc/sub.pmc Sat May 1 21:39:10 2010 (r46210)
@@ -907,8 +907,7 @@
EXCEPTION_INVALID_OPERATION,
"Unknown introspection value '%S'", what);
- retval = Parrot_pmc_new(INTERP, enum_class_Integer);
- VTABLE_set_integer_native(INTERP, retval, count_found);
+ retval = Parrot_pmc_new_init_int(INTERP, enum_class_Integer, count_found);
return retval;
}
More information about the parrot-commits
mailing list