From b0a3b4aef77462f53f418b56aed217ecd9bf123a Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Wed, 26 Apr 2017 16:01:56 +0000 Subject: [PATCH] fixed CompiledMethod>>preambleCode --- moo/kernel/Context.moo | 2 +- moo/kernel/Except.moo | 2 +- moo/lib/exec.c | 18 ++++++++---------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/moo/kernel/Context.moo b/moo/kernel/Context.moo index cc12cbe..5b6796b 100644 --- a/moo/kernel/Context.moo +++ b/moo/kernel/Context.moo @@ -339,7 +339,7 @@ class(#pointer) CompiledMethod(Object) method preambleCode { (* TODO: make this a primtive for performance *) - ^(self.preamble bitAnd: 16rFF) bitShift: -2. + ^(self.preamble bitAnd: 16rFF) bitShift: -3. } method owner diff --git a/moo/kernel/Except.moo b/moo/kernel/Except.moo index cdf15a2..abf8009 100644 --- a/moo/kernel/Except.moo +++ b/moo/kernel/Except.moo @@ -271,7 +271,7 @@ extend MethodContext | excblk retval actpos | - (* position of the temporary variable 'active' in MethodContext>>on:do. + (* position of the temporary variable 'exception_active' in MethodContext>>on:do. * for this code to work, it must be the last temporary variable in the method. *) actpos := (self basicSize) - 1. diff --git a/moo/lib/exec.c b/moo/lib/exec.c index ce8cbaa..2225a52 100644 --- a/moo/lib/exec.c +++ b/moo/lib/exec.c @@ -1466,7 +1466,8 @@ static MOO_INLINE moo_pfrc_t pf_basic_new (moo_t* moo, moo_ooi_t nargs) { /* the receiver is not a class object */ MOO_DEBUG0 (moo, " Receiver is not a class\n"); - goto inval; + moo->errnum = MOO_EMSGRCV; + return MOO_PF_FAILURE; } if (nargs >= 1) @@ -1476,7 +1477,8 @@ static MOO_INLINE moo_pfrc_t pf_basic_new (moo_t* moo, moo_ooi_t nargs) { /* integer out of range or not integer */ MOO_DEBUG0 (moo, " Size out of range or not integer\n"); - goto inval; + moo->errnum = MOO_EINVAL; + return MOO_PF_FAILURE; } } @@ -1492,14 +1494,10 @@ static MOO_INLINE moo_pfrc_t pf_basic_new (moo_t* moo, moo_ooi_t nargs) * moo_instantiate()? */ obj = moo_instantiate (moo, _class, MOO_NULL, size); } - if (!obj) return MOO_PF_HARD_FAILURE; + if (!obj) return MOO_PF_FAILURE; MOO_STACK_SETRET (moo, nargs, obj); return MOO_PF_SUCCESS; - -inval: - moo->errnum = MOO_EINVAL; - return MOO_PF_FAILURE; } static moo_pfrc_t pf_ngc_new (moo_t* moo, moo_ooi_t nargs) @@ -1533,7 +1531,7 @@ static moo_pfrc_t pf_shallow_copy (moo_t* moo, moo_ooi_t nargs) rcv = MOO_STACK_GETRCV (moo, nargs); obj = moo_shallowcopy (moo, rcv); - if (!obj) return MOO_PF_HARD_FAILURE; + if (!obj) return MOO_PF_FAILURE; MOO_STACK_SETRET (moo, nargs, obj); return MOO_PF_SUCCESS; @@ -1556,7 +1554,7 @@ static moo_pfrc_t pf_basic_size (moo_t* moo, moo_ooi_t nargs) else { sz = moo_oowtoint (moo, MOO_OBJ_GET_SIZE(rcv)); - if (!sz) return MOO_PF_HARD_FAILURE; /* hard failure */ + if (!sz) return MOO_PF_FAILURE; } MOO_STACK_SETRET(moo, nargs, sz); @@ -1609,7 +1607,7 @@ static moo_pfrc_t pf_basic_at (moo_t* moo, moo_ooi_t nargs) case MOO_OBJ_TYPE_WORD: v = moo_oowtoint (moo, ((moo_oop_word_t)rcv)->slot[idx]); - if (!v) return MOO_PF_HARD_FAILURE; + if (!v) return MOO_PF_FAILURE; break; case MOO_OBJ_TYPE_OOP: