[svn:parrot] r43175 - in trunk: . compilers/imcc config/auto config/gen/makefiles include/parrot lib/Parrot/OpTrans lib/Parrot/Ops2c lib/Parrot/Pmc2c src src/call src/interp src/pmc src/runcore t/native_pbc t/op t/pmc tools/build
bacek at svn.parrot.org
bacek at svn.parrot.org
Sun Dec 20 12:30:42 UTC 2009
Author: bacek
Date: Sun Dec 20 12:30:38 2009
New Revision: 43175
URL: https://trac.parrot.org/parrot/changeset/43175
Log:
Merge context_unify3_simple branch back to trunk.
Added:
trunk/src/pmc/callcontext.pmc
- copied, changed from r43174, trunk/src/pmc/callsignature.pmc
trunk/t/pmc/callcontext.t
- copied, changed from r43174, trunk/t/pmc/callsignature.t
Deleted:
trunk/src/pmc/callsignature.pmc
trunk/src/pmc/context.pmc
trunk/t/pmc/callsignature.t
Modified:
trunk/MANIFEST
trunk/MANIFEST.generated
trunk/PBC_COMPAT
trunk/compilers/imcc/imcc.y
trunk/compilers/imcc/imcparser.c
trunk/compilers/imcc/imcparser.h
trunk/compilers/imcc/instructions.c
trunk/compilers/imcc/main.c
trunk/compilers/imcc/optimizer.c
trunk/compilers/imcc/parser_util.c
trunk/compilers/imcc/pbc.c
trunk/config/auto/pmc.pm
trunk/config/gen/makefiles/root.in
trunk/include/parrot/call.h
trunk/include/parrot/context.h
trunk/lib/Parrot/OpTrans/C.pm
trunk/lib/Parrot/Ops2c/Utils.pm
trunk/lib/Parrot/Pmc2c/PMCEmitter.pm
trunk/src/call/args.c
trunk/src/call/context.c
trunk/src/call/context_accessors.c
trunk/src/call/pcc.c
trunk/src/debug.c
trunk/src/dynext.c
trunk/src/embed.c
trunk/src/exceptions.c
trunk/src/extend.c
trunk/src/global.c
trunk/src/global_setup.c
trunk/src/hll.c
trunk/src/interp/inter_create.c
trunk/src/interp/inter_misc.c
trunk/src/key.c
trunk/src/multidispatch.c
trunk/src/oo.c
trunk/src/packfile.c
trunk/src/pmc.c
trunk/src/pmc/class.pmc
trunk/src/pmc/coroutine.pmc
trunk/src/pmc/multisub.pmc
trunk/src/pmc/sub.pmc
trunk/src/pmc_freeze.c
trunk/src/runcore/cores.c
trunk/src/runcore/main.c
trunk/src/runcore/profiling.c
trunk/src/runcore/trace.c
trunk/src/scheduler.c
trunk/src/sub.c
trunk/src/warnings.c
trunk/t/native_pbc/annotations.pbc
trunk/t/native_pbc/integer_1.pbc
trunk/t/native_pbc/number_1.pbc
trunk/t/native_pbc/string_1.pbc
trunk/t/op/cc_params.t
trunk/t/pmc/context.t
trunk/t/pmc/parrotinterpreter.t
trunk/tools/build/nativecall.pl
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/MANIFEST Sun Dec 20 12:30:38 2009 (r43175)
@@ -1402,12 +1402,11 @@
src/pmc/bigint.pmc [devel]src
src/pmc/bignum.pmc [devel]src
src/pmc/boolean.pmc [devel]src
-src/pmc/callsignature.pmc [devel]src
+src/pmc/callcontext.pmc [devel]src
src/pmc/capture.pmc [devel]src
src/pmc/class.pmc [devel]src
src/pmc/codestring.pmc [devel]src
src/pmc/complex.pmc [devel]src
-src/pmc/context.pmc [devel]src
src/pmc/continuation.pmc [devel]src
src/pmc/coroutine.pmc [devel]src
src/pmc/cpointer.pmc [devel]src
@@ -1865,7 +1864,7 @@
t/pmc/bigint.t [test]
t/pmc/bignum.t [test]
t/pmc/boolean.t [test]
-t/pmc/callsignature.t [test]
+t/pmc/callcontext.t [test]
t/pmc/capture.t [test]
t/pmc/class.t [test]
t/pmc/codestring.t [test]
Modified: trunk/MANIFEST.generated
==============================================================================
--- trunk/MANIFEST.generated Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/MANIFEST.generated Sun Dec 20 12:30:38 2009 (r43175)
@@ -236,7 +236,7 @@
src/pmc/object.dump [devel]src
include/pmc/pmc_boolean.h [devel]include
include/pmc/pmc_class.h [devel]include
-include/pmc/pmc_callsignature.h [devel]include
+include/pmc/pmc_callcontext.h [devel]include
include/pmc/pmc_continuation.h [devel]include
include/pmc/pmc_context.h [devel]include
include/pmc/pmc_default.h [devel]include
Modified: trunk/PBC_COMPAT
==============================================================================
--- trunk/PBC_COMPAT Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/PBC_COMPAT Sun Dec 20 12:30:38 2009 (r43175)
@@ -27,6 +27,7 @@
# please insert tab separated entries at the top of the list
+5.6 2009.12.12 bacek merge CallSignature and Context
5.4 2009.12.02 bacek remove CallSignatureReturns
5.3 2009.10.23 bacek add CallSignatureReturns
5.2 2009.09.16 darbelo remove pic.ops
Modified: trunk/compilers/imcc/imcc.y
==============================================================================
--- trunk/compilers/imcc/imcc.y Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/compilers/imcc/imcc.y Sun Dec 20 12:30:38 2009 (r43175)
@@ -21,7 +21,7 @@
#define PARSER_MAIN
#include "imc.h"
#include "parrot/dynext.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "pbc.h"
#include "parser.h"
#include "optimizer.h"
Modified: trunk/compilers/imcc/imcparser.c
==============================================================================
--- trunk/compilers/imcc/imcparser.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/compilers/imcc/imcparser.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -9,27 +9,26 @@
*/
/* HEADERIZER HFILE: none */
/* HEADERIZER STOP */
-/* A Bison parser, made by GNU Bison 2.3. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1. */
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton implementation for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
+
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -40,7 +39,7 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
@@ -58,7 +57,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.4.1"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -66,263 +65,20 @@
/* Pure parsers. */
#define YYPURE 1
-/* Using locations. */
-#define YYLSP_NEEDED 0
-
+/* Push parsers. */
+#define YYPUSH 0
+/* Pull parsers. */
+#define YYPULL 1
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- LOW_PREC = 258,
- PARAM = 259,
- HLL = 260,
- TK_LINE = 261,
- TK_FILE = 262,
- GOTO = 263,
- ARG = 264,
- IF = 265,
- UNLESS = 266,
- PNULL = 267,
- SET_RETURN = 268,
- SET_YIELD = 269,
- ADV_FLAT = 270,
- ADV_SLURPY = 271,
- ADV_OPTIONAL = 272,
- ADV_OPT_FLAG = 273,
- ADV_NAMED = 274,
- ADV_ARROW = 275,
- NEW = 276,
- ADV_INVOCANT = 277,
- ADV_CALL_SIG = 278,
- NAMESPACE = 279,
- DOT_METHOD = 280,
- SUB = 281,
- SYM = 282,
- LOCAL = 283,
- LEXICAL = 284,
- CONST = 285,
- ANNOTATE = 286,
- INC = 287,
- DEC = 288,
- GLOBAL_CONST = 289,
- PLUS_ASSIGN = 290,
- MINUS_ASSIGN = 291,
- MUL_ASSIGN = 292,
- DIV_ASSIGN = 293,
- CONCAT_ASSIGN = 294,
- BAND_ASSIGN = 295,
- BOR_ASSIGN = 296,
- BXOR_ASSIGN = 297,
- FDIV = 298,
- FDIV_ASSIGN = 299,
- MOD_ASSIGN = 300,
- SHR_ASSIGN = 301,
- SHL_ASSIGN = 302,
- SHR_U_ASSIGN = 303,
- SHIFT_LEFT = 304,
- SHIFT_RIGHT = 305,
- INTV = 306,
- FLOATV = 307,
- STRINGV = 308,
- PMCV = 309,
- LOG_XOR = 310,
- RELOP_EQ = 311,
- RELOP_NE = 312,
- RELOP_GT = 313,
- RELOP_GTE = 314,
- RELOP_LT = 315,
- RELOP_LTE = 316,
- RESULT = 317,
- RETURN = 318,
- TAILCALL = 319,
- YIELDT = 320,
- GET_RESULTS = 321,
- POW = 322,
- SHIFT_RIGHT_U = 323,
- LOG_AND = 324,
- LOG_OR = 325,
- COMMA = 326,
- ESUB = 327,
- DOTDOT = 328,
- PCC_BEGIN = 329,
- PCC_END = 330,
- PCC_CALL = 331,
- PCC_SUB = 332,
- PCC_BEGIN_RETURN = 333,
- PCC_END_RETURN = 334,
- PCC_BEGIN_YIELD = 335,
- PCC_END_YIELD = 336,
- NCI_CALL = 337,
- METH_CALL = 338,
- INVOCANT = 339,
- MAIN = 340,
- LOAD = 341,
- INIT = 342,
- IMMEDIATE = 343,
- POSTCOMP = 344,
- METHOD = 345,
- ANON = 346,
- OUTER = 347,
- NEED_LEX = 348,
- MULTI = 349,
- VTABLE_METHOD = 350,
- LOADLIB = 351,
- SUB_INSTANCE_OF = 352,
- SUBID = 353,
- NS_ENTRY = 354,
- UNIQUE_REG = 355,
- LABEL = 356,
- EMIT = 357,
- EOM = 358,
- IREG = 359,
- NREG = 360,
- SREG = 361,
- PREG = 362,
- IDENTIFIER = 363,
- REG = 364,
- MACRO = 365,
- ENDM = 366,
- STRINGC = 367,
- INTC = 368,
- FLOATC = 369,
- USTRINGC = 370,
- PARROT_OP = 371,
- VAR = 372,
- LINECOMMENT = 373,
- FILECOMMENT = 374,
- DOT = 375,
- CONCAT = 376
- };
-#endif
-/* Tokens. */
-#define LOW_PREC 258
-#define PARAM 259
-#define HLL 260
-#define TK_LINE 261
-#define TK_FILE 262
-#define GOTO 263
-#define ARG 264
-#define IF 265
-#define UNLESS 266
-#define PNULL 267
-#define SET_RETURN 268
-#define SET_YIELD 269
-#define ADV_FLAT 270
-#define ADV_SLURPY 271
-#define ADV_OPTIONAL 272
-#define ADV_OPT_FLAG 273
-#define ADV_NAMED 274
-#define ADV_ARROW 275
-#define NEW 276
-#define ADV_INVOCANT 277
-#define ADV_CALL_SIG 278
-#define NAMESPACE 279
-#define DOT_METHOD 280
-#define SUB 281
-#define SYM 282
-#define LOCAL 283
-#define LEXICAL 284
-#define CONST 285
-#define ANNOTATE 286
-#define INC 287
-#define DEC 288
-#define GLOBAL_CONST 289
-#define PLUS_ASSIGN 290
-#define MINUS_ASSIGN 291
-#define MUL_ASSIGN 292
-#define DIV_ASSIGN 293
-#define CONCAT_ASSIGN 294
-#define BAND_ASSIGN 295
-#define BOR_ASSIGN 296
-#define BXOR_ASSIGN 297
-#define FDIV 298
-#define FDIV_ASSIGN 299
-#define MOD_ASSIGN 300
-#define SHR_ASSIGN 301
-#define SHL_ASSIGN 302
-#define SHR_U_ASSIGN 303
-#define SHIFT_LEFT 304
-#define SHIFT_RIGHT 305
-#define INTV 306
-#define FLOATV 307
-#define STRINGV 308
-#define PMCV 309
-#define LOG_XOR 310
-#define RELOP_EQ 311
-#define RELOP_NE 312
-#define RELOP_GT 313
-#define RELOP_GTE 314
-#define RELOP_LT 315
-#define RELOP_LTE 316
-#define RESULT 317
-#define RETURN 318
-#define TAILCALL 319
-#define YIELDT 320
-#define GET_RESULTS 321
-#define POW 322
-#define SHIFT_RIGHT_U 323
-#define LOG_AND 324
-#define LOG_OR 325
-#define COMMA 326
-#define ESUB 327
-#define DOTDOT 328
-#define PCC_BEGIN 329
-#define PCC_END 330
-#define PCC_CALL 331
-#define PCC_SUB 332
-#define PCC_BEGIN_RETURN 333
-#define PCC_END_RETURN 334
-#define PCC_BEGIN_YIELD 335
-#define PCC_END_YIELD 336
-#define NCI_CALL 337
-#define METH_CALL 338
-#define INVOCANT 339
-#define MAIN 340
-#define LOAD 341
-#define INIT 342
-#define IMMEDIATE 343
-#define POSTCOMP 344
-#define METHOD 345
-#define ANON 346
-#define OUTER 347
-#define NEED_LEX 348
-#define MULTI 349
-#define VTABLE_METHOD 350
-#define LOADLIB 351
-#define SUB_INSTANCE_OF 352
-#define SUBID 353
-#define NS_ENTRY 354
-#define UNIQUE_REG 355
-#define LABEL 356
-#define EMIT 357
-#define EOM 358
-#define IREG 359
-#define NREG 360
-#define SREG 361
-#define PREG 362
-#define IDENTIFIER 363
-#define REG 364
-#define MACRO 365
-#define ENDM 366
-#define STRINGC 367
-#define INTC 368
-#define FLOATC 369
-#define USTRINGC 370
-#define PARROT_OP 371
-#define VAR 372
-#define LINECOMMENT 373
-#define FILECOMMENT 374
-#define DOT 375
-#define CONCAT 376
-
+/* Using locations. */
+#define YYLSP_NEEDED 0
/* Copy the first part of user declarations. */
+
+/* Line 189 of yacc.c */
#line 1 "compilers/imcc/imcc.y"
/*
@@ -347,7 +103,7 @@
#define PARSER_MAIN
#include "imc.h"
#include "parrot/dynext.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "pbc.h"
#include "parser.h"
#include "optimizer.h"
@@ -778,18 +534,18 @@
}
switch (type_enum) {
- case enum_class_Sub:
- case enum_class_Coroutine:
- rhs = mk_const(interp, name, 'p');
-
- if (!ascii)
- rhs->type |= VT_ENCODED;
-
- rhs->usage |= U_FIXUP | U_SUBID_LOOKUP;
- break;
- default:
- rhs = mk_const(interp, name, 'P');
- break;
+ case enum_class_Sub:
+ case enum_class_Coroutine:
+ rhs = mk_const(interp, name, 'p');
+
+ if (!ascii)
+ rhs->type |= VT_ENCODED;
+
+ rhs->usage |= U_FIXUP | U_SUBID_LOOKUP;
+ break;
+ default:
+ rhs = mk_const(interp, name, 'P');
+ break;
}
r[1] = rhs;
@@ -1382,49 +1138,308 @@
+/* Line 189 of yacc.c */
+#line 1132 "compilers/imcc/imcparser.c"
+
/* Enabling traces. */
#ifndef YYDEBUG
# define YYDEBUG 0
#endif
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
+/* Enabling verbose error messages. */
+#ifdef YYERROR_VERBOSE
+# undef YYERROR_VERBOSE
+# define YYERROR_VERBOSE 1
+#else
+# define YYERROR_VERBOSE 0
+#endif
+
+/* Enabling the token table. */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
+#endif
+
+
+/* Tokens. */
+#ifndef YYTOKENTYPE
+# define YYTOKENTYPE
+ /* Put the tokens into the symbol table, so that GDB and other debuggers
+ know about them. */
+ enum yytokentype {
+ LOW_PREC = 258,
+ PARAM = 259,
+ HLL = 260,
+ TK_LINE = 261,
+ TK_FILE = 262,
+ GOTO = 263,
+ ARG = 264,
+ IF = 265,
+ UNLESS = 266,
+ PNULL = 267,
+ SET_RETURN = 268,
+ SET_YIELD = 269,
+ ADV_FLAT = 270,
+ ADV_SLURPY = 271,
+ ADV_OPTIONAL = 272,
+ ADV_OPT_FLAG = 273,
+ ADV_NAMED = 274,
+ ADV_ARROW = 275,
+ NEW = 276,
+ ADV_INVOCANT = 277,
+ ADV_CALL_SIG = 278,
+ NAMESPACE = 279,
+ DOT_METHOD = 280,
+ SUB = 281,
+ SYM = 282,
+ LOCAL = 283,
+ LEXICAL = 284,
+ CONST = 285,
+ ANNOTATE = 286,
+ INC = 287,
+ DEC = 288,
+ GLOBAL_CONST = 289,
+ PLUS_ASSIGN = 290,
+ MINUS_ASSIGN = 291,
+ MUL_ASSIGN = 292,
+ DIV_ASSIGN = 293,
+ CONCAT_ASSIGN = 294,
+ BAND_ASSIGN = 295,
+ BOR_ASSIGN = 296,
+ BXOR_ASSIGN = 297,
+ FDIV = 298,
+ FDIV_ASSIGN = 299,
+ MOD_ASSIGN = 300,
+ SHR_ASSIGN = 301,
+ SHL_ASSIGN = 302,
+ SHR_U_ASSIGN = 303,
+ SHIFT_LEFT = 304,
+ SHIFT_RIGHT = 305,
+ INTV = 306,
+ FLOATV = 307,
+ STRINGV = 308,
+ PMCV = 309,
+ LOG_XOR = 310,
+ RELOP_EQ = 311,
+ RELOP_NE = 312,
+ RELOP_GT = 313,
+ RELOP_GTE = 314,
+ RELOP_LT = 315,
+ RELOP_LTE = 316,
+ RESULT = 317,
+ RETURN = 318,
+ TAILCALL = 319,
+ YIELDT = 320,
+ GET_RESULTS = 321,
+ POW = 322,
+ SHIFT_RIGHT_U = 323,
+ LOG_AND = 324,
+ LOG_OR = 325,
+ COMMA = 326,
+ ESUB = 327,
+ DOTDOT = 328,
+ PCC_BEGIN = 329,
+ PCC_END = 330,
+ PCC_CALL = 331,
+ PCC_SUB = 332,
+ PCC_BEGIN_RETURN = 333,
+ PCC_END_RETURN = 334,
+ PCC_BEGIN_YIELD = 335,
+ PCC_END_YIELD = 336,
+ NCI_CALL = 337,
+ METH_CALL = 338,
+ INVOCANT = 339,
+ MAIN = 340,
+ LOAD = 341,
+ INIT = 342,
+ IMMEDIATE = 343,
+ POSTCOMP = 344,
+ METHOD = 345,
+ ANON = 346,
+ OUTER = 347,
+ NEED_LEX = 348,
+ MULTI = 349,
+ VTABLE_METHOD = 350,
+ LOADLIB = 351,
+ SUB_INSTANCE_OF = 352,
+ SUBID = 353,
+ NS_ENTRY = 354,
+ UNIQUE_REG = 355,
+ LABEL = 356,
+ EMIT = 357,
+ EOM = 358,
+ IREG = 359,
+ NREG = 360,
+ SREG = 361,
+ PREG = 362,
+ IDENTIFIER = 363,
+ REG = 364,
+ MACRO = 365,
+ ENDM = 366,
+ STRINGC = 367,
+ INTC = 368,
+ FLOATC = 369,
+ USTRINGC = 370,
+ PARROT_OP = 371,
+ VAR = 372,
+ LINECOMMENT = 373,
+ FILECOMMENT = 374,
+ DOT = 375,
+ CONCAT = 376
+ };
+#endif
+/* Tokens. */
+#define LOW_PREC 258
+#define PARAM 259
+#define HLL 260
+#define TK_LINE 261
+#define TK_FILE 262
+#define GOTO 263
+#define ARG 264
+#define IF 265
+#define UNLESS 266
+#define PNULL 267
+#define SET_RETURN 268
+#define SET_YIELD 269
+#define ADV_FLAT 270
+#define ADV_SLURPY 271
+#define ADV_OPTIONAL 272
+#define ADV_OPT_FLAG 273
+#define ADV_NAMED 274
+#define ADV_ARROW 275
+#define NEW 276
+#define ADV_INVOCANT 277
+#define ADV_CALL_SIG 278
+#define NAMESPACE 279
+#define DOT_METHOD 280
+#define SUB 281
+#define SYM 282
+#define LOCAL 283
+#define LEXICAL 284
+#define CONST 285
+#define ANNOTATE 286
+#define INC 287
+#define DEC 288
+#define GLOBAL_CONST 289
+#define PLUS_ASSIGN 290
+#define MINUS_ASSIGN 291
+#define MUL_ASSIGN 292
+#define DIV_ASSIGN 293
+#define CONCAT_ASSIGN 294
+#define BAND_ASSIGN 295
+#define BOR_ASSIGN 296
+#define BXOR_ASSIGN 297
+#define FDIV 298
+#define FDIV_ASSIGN 299
+#define MOD_ASSIGN 300
+#define SHR_ASSIGN 301
+#define SHL_ASSIGN 302
+#define SHR_U_ASSIGN 303
+#define SHIFT_LEFT 304
+#define SHIFT_RIGHT 305
+#define INTV 306
+#define FLOATV 307
+#define STRINGV 308
+#define PMCV 309
+#define LOG_XOR 310
+#define RELOP_EQ 311
+#define RELOP_NE 312
+#define RELOP_GT 313
+#define RELOP_GTE 314
+#define RELOP_LT 315
+#define RELOP_LTE 316
+#define RESULT 317
+#define RETURN 318
+#define TAILCALL 319
+#define YIELDT 320
+#define GET_RESULTS 321
+#define POW 322
+#define SHIFT_RIGHT_U 323
+#define LOG_AND 324
+#define LOG_OR 325
+#define COMMA 326
+#define ESUB 327
+#define DOTDOT 328
+#define PCC_BEGIN 329
+#define PCC_END 330
+#define PCC_CALL 331
+#define PCC_SUB 332
+#define PCC_BEGIN_RETURN 333
+#define PCC_END_RETURN 334
+#define PCC_BEGIN_YIELD 335
+#define PCC_END_YIELD 336
+#define NCI_CALL 337
+#define METH_CALL 338
+#define INVOCANT 339
+#define MAIN 340
+#define LOAD 341
+#define INIT 342
+#define IMMEDIATE 343
+#define POSTCOMP 344
+#define METHOD 345
+#define ANON 346
+#define OUTER 347
+#define NEED_LEX 348
+#define MULTI 349
+#define VTABLE_METHOD 350
+#define LOADLIB 351
+#define SUB_INSTANCE_OF 352
+#define SUBID 353
+#define NS_ENTRY 354
+#define UNIQUE_REG 355
+#define LABEL 356
+#define EMIT 357
+#define EOM 358
+#define IREG 359
+#define NREG 360
+#define SREG 361
+#define PREG 362
+#define IDENTIFIER 363
+#define REG 364
+#define MACRO 365
+#define ENDM 366
+#define STRINGC 367
+#define INTC 368
+#define FLOATC 369
+#define USTRINGC 370
+#define PARROT_OP 371
+#define VAR 372
+#define LINECOMMENT 373
+#define FILECOMMENT 374
+#define DOT 375
+#define CONCAT 376
+
+
-/* Enabling the token table. */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 1059 "compilers/imcc/imcc.y"
{
+
+/* Line 214 of yacc.c */
+#line 1059 "compilers/imcc/imcc.y"
+
IdList * idlist;
int t;
char * s;
SymReg * sr;
Instruction *i;
-}
-/* Line 187 of yacc.c. */
-#line 1404 "compilers/imcc/imcparser.c"
- YYSTYPE;
+
+
+
+/* Line 214 of yacc.c */
+#line 1420 "compilers/imcc/imcparser.c"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
#endif
-
/* Copy the second part of user declarations. */
-/* Line 216 of yacc.c. */
-#line 1417 "compilers/imcc/imcparser.c"
+/* Line 264 of yacc.c */
+#line 1432 "compilers/imcc/imcparser.c"
#ifdef short
# undef short
@@ -1499,14 +1514,14 @@
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static int
-YYID (int i)
+YYID (int yyi)
#else
static int
-YYID (i)
- int i;
+YYID (yyi)
+ int yyi;
#endif
{
- return i;
+ return yyi;
}
#endif
@@ -1587,9 +1602,9 @@
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- yytype_int16 yyss;
- YYSTYPE yyvs;
- };
+ yytype_int16 yyss_alloc;
+ YYSTYPE yyvs_alloc;
+};
/* The size of the maximum gap between one aligned stack and the next. */
# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
@@ -1623,12 +1638,12 @@
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack) \
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
do \
{ \
YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
yyptr += yynewbytes / sizeof (*yyptr); \
} \
@@ -1908,30 +1923,31 @@
"EMIT", "EOM", "IREG", "NREG", "SREG", "PREG", "IDENTIFIER", "REG",
"MACRO", "ENDM", "STRINGC", "INTC", "FLOATC", "USTRINGC", "PARROT_OP",
"VAR", "LINECOMMENT", "FILECOMMENT", "DOT", "CONCAT", "'='", "'['",
- "']'", "'('", "')'", "'new'", "'!'", "'~'", "'-'", "'+'", "'*'", "'/'",
+ "']'", "'('", "')'", "'n'", "'!'", "'~'", "'-'", "'+'", "'*'", "'/'",
"'%'", "'&'", "'|'", "';'", "$accept", "program", "compilation_units",
"compilation_unit", "pragma", "location_directive", "annotate_directive",
- "hll_def", "constdef", "@1", "pmc_const", "@2", "@3", "any_string",
- "pasmcode", "pasmline", "pasm_inst", "@4", "@5", "pasm_args", "emit",
- "@6", "opt_pasmcode", "class_namespace", "maybe_ns", "sub", "@7", "@8",
- "@9", "sub_params", "sub_param", "@10", "sub_param_type_def", "multi",
- "outer", "vtable", "method", "ns_entry_name", "instanceof", "subid",
- "multi_types", "multi_type", "sub_body", "pcc_sub_call", "@11",
+ "hll_def", "constdef", "$@1", "pmc_const", "$@2", "$@3", "any_string",
+ "pasmcode", "pasmline", "pasm_inst", "$@4", "$@5", "pasm_args", "emit",
+ "$@6", "opt_pasmcode", "class_namespace", "maybe_ns", "sub", "$@7",
+ "$@8", "$@9", "sub_params", "sub_param", "$@10", "sub_param_type_def",
+ "multi", "outer", "vtable", "method", "ns_entry_name", "instanceof",
+ "subid", "multi_types", "multi_type", "sub_body", "pcc_sub_call", "@11",
"opt_label", "opt_invocant", "sub_proto", "sub_proto_list", "proto",
- "pcc_call", "pcc_args", "pcc_arg", "pcc_results", "pcc_result", "@12",
- "paramtype_list", "paramtype", "pcc_ret", "@13", "pcc_yield", "@14",
+ "pcc_call", "pcc_args", "pcc_arg", "pcc_results", "pcc_result", "$@12",
+ "paramtype_list", "paramtype", "pcc_ret", "$@13", "pcc_yield", "$@14",
"pcc_returns", "pcc_yields", "pcc_return", "pcc_set_yield",
- "pcc_return_many", "@15", "return_or_yield", "var_returns", "statements",
- "helper_clear_state", "statement", "labels", "_labels", "label",
- "instruction", "id_list", "id_list_id", "opt_unique_reg", "labeled_inst",
- "@16", "@17", "@18", "type", "classname", "assignment", "@19", "un_op",
- "bin_op", "get_results", "@20", "op_assign", "assign_op", "func_assign",
- "the_sub", "sub_call", "@21", "arglist", "arg", "argtype_list",
- "argtype", "result", "targetlist", "conditional_statement",
- "unless_statement", "if_statement", "comma_or_goto", "relop", "target",
- "vars", "_vars", "_var_or_i", "sub_label_op_c", "sub_label_op",
- "label_op", "var_or_i", "var", "keylist", "@22", "keylist_force", "@23",
- "_keylist", "key", "reg", "const", 0
+ "pcc_return_many", "$@15", "return_or_yield", "var_returns",
+ "statements", "helper_clear_state", "statement", "labels", "_labels",
+ "label", "instruction", "id_list", "id_list_id", "opt_unique_reg",
+ "labeled_inst", "$@16", "$@17", "$@18", "type", "classname",
+ "assignment", "@19", "un_op", "bin_op", "get_results", "@20",
+ "op_assign", "assign_op", "func_assign", "the_sub", "sub_call", "@21",
+ "arglist", "arg", "argtype_list", "argtype", "result", "targetlist",
+ "conditional_statement", "unless_statement", "if_statement",
+ "comma_or_goto", "relop", "target", "vars", "_vars", "_var_or_i",
+ "sub_label_op_c", "sub_label_op", "label_op", "var_or_i", "var",
+ "keylist", "$@22", "keylist_force", "$@23", "_keylist", "key", "reg",
+ "const", 0
};
#endif
@@ -2589,17 +2605,20 @@
#if (defined __STDC__ || defined __C99__FUNC__ \
|| defined __cplusplus || defined _MSC_VER)
static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
+yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
#else
static void
-yy_stack_print (bottom, top)
- yytype_int16 *bottom;
- yytype_int16 *top;
+yy_stack_print (yybottom, yytop)
+ yytype_int16 *yybottom;
+ yytype_int16 *yytop;
#endif
{
YYFPRINTF (stderr, "Stack now");
- for (; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
YYFPRINTF (stderr, "\n");
}
@@ -2635,11 +2654,11 @@
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
- fprintf (stderr, " $%d = ", yyi + 1);
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
&(yyvsp[(yyi + 1) - (yynrhs)])
, yyscanner, interp);
- fprintf (stderr, "\n");
+ YYFPRINTF (stderr, "\n");
}
}
@@ -2923,10 +2942,8 @@
break;
}
}
-
/* Prevent warnings from -Wmissing-prototypes. */
-
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
@@ -2945,10 +2962,9 @@
-
-/*----------.
-| yyparse. |
-`----------*/
+/*-------------------------.
+| yyparse or yypush_parse. |
+`-------------------------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -2973,22 +2989,46 @@
#endif
#endif
{
- /* The look-ahead symbol. */
+/* The lookahead symbol. */
int yychar;
-/* The semantic value of the look-ahead symbol. */
+/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
-/* Number of syntax errors so far. */
-int yynerrs;
+ /* Number of syntax errors so far. */
+ int yynerrs;
+
+ int yystate;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+
+ /* The stacks and their tools:
+ `yyss': related to states.
+ `yyvs': related to semantic values.
+
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ yytype_int16 yyssa[YYINITDEPTH];
+ yytype_int16 *yyss;
+ yytype_int16 *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs;
+ YYSTYPE *yyvsp;
+
+ YYSIZE_T yystacksize;
- int yystate;
int yyn;
int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Look-ahead token as an internal (translated) token number. */
- int yytoken = 0;
+ /* Lookahead token as an internal (translated) token number. */
+ int yytoken;
+ /* The variables used to return semantic value and location from the
+ action routines. */
+ YYSTYPE yyval;
+
#if YYERROR_VERBOSE
/* Buffer for error messages, and its allocated size. */
char yymsgbuf[128];
@@ -2996,51 +3036,28 @@
YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
#endif
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
-
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss = yyssa;
- yytype_int16 *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- YYSTYPE *yyvsp;
-
-
-
#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
- YYSIZE_T yystacksize = YYINITDEPTH;
-
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
-
-
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
+ yytoken = 0;
+ yyss = yyssa;
+ yyvs = yyvsa;
+ yystacksize = YYINITDEPTH;
+
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
+ yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack.
The wasted elements are never initialized. */
-
yyssp = yyss;
yyvsp = yyvs;
@@ -3070,7 +3087,6 @@
YYSTYPE *yyvs1 = yyvs;
yytype_int16 *yyss1 = yyss;
-
/* Each stack pointer address is followed by the size of the
data in use in that stack, in bytes. This used to be a
conditional around just the two extra args, but that might
@@ -3078,7 +3094,6 @@
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
-
&yystacksize);
yyss = yyss1;
@@ -3101,9 +3116,8 @@
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
@@ -3114,7 +3128,6 @@
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
-
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
@@ -3124,6 +3137,9 @@
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
goto yybackup;
/*-----------.
@@ -3132,16 +3148,16 @@
yybackup:
/* Do appropriate processing given the current state. Read a
- look-ahead token if we need one and don't already have one. */
+ lookahead token if we need one and don't already have one. */
- /* First try to decide what to do without reference to look-ahead token. */
+ /* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYPACT_NINF)
goto yydefault;
- /* Not known => get a look-ahead token if don't already have one. */
+ /* Not known => get a lookahead token if don't already have one. */
- /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
+ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
@@ -3173,20 +3189,16 @@
goto yyreduce;
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
- /* Shift the look-ahead token. */
+ /* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
- /* Discard the shifted token unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
yystate = yyn;
*++yyvsp = yylval;
@@ -3226,21 +3238,29 @@
switch (yyn)
{
case 2:
+
+/* Line 1455 of yacc.c */
#line 1154 "compilers/imcc/imcc.y"
{ if (yynerrs) YYABORT; (yyval.i) = 0; }
break;
case 5:
+
+/* Line 1455 of yacc.c */
#line 1163 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 6:
+
+/* Line 1455 of yacc.c */
#line 1164 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 7:
+
+/* Line 1455 of yacc.c */
#line 1166 "compilers/imcc/imcc.y"
{
(yyval.i) = (yyvsp[(1) - (1)].i);
@@ -3250,6 +3270,8 @@
break;
case 8:
+
+/* Line 1455 of yacc.c */
#line 1172 "compilers/imcc/imcc.y"
{
(yyval.i) = (yyvsp[(1) - (1)].i);
@@ -3259,31 +3281,43 @@
break;
case 9:
+
+/* Line 1455 of yacc.c */
#line 1177 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 10:
+
+/* Line 1455 of yacc.c */
#line 1178 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 11:
+
+/* Line 1455 of yacc.c */
#line 1179 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 12:
+
+/* Line 1455 of yacc.c */
#line 1180 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 13:
+
+/* Line 1455 of yacc.c */
#line 1184 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 14:
+
+/* Line 1455 of yacc.c */
#line 1186 "compilers/imcc/imcc.y"
{
(yyval.i) = 0;
@@ -3293,6 +3327,8 @@
break;
case 15:
+
+/* Line 1455 of yacc.c */
#line 1195 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->line = atoi((yyvsp[(2) - (5)].s));
@@ -3302,6 +3338,8 @@
break;
case 16:
+
+/* Line 1455 of yacc.c */
#line 1201 "compilers/imcc/imcc.y"
{
/* set_filename() frees the STRINGC */
@@ -3310,6 +3348,8 @@
break;
case 17:
+
+/* Line 1455 of yacc.c */
#line 1209 "compilers/imcc/imcc.y"
{
/* We'll want to store an entry while emitting instructions, so just
@@ -3321,6 +3361,8 @@
break;
case 18:
+
+/* Line 1455 of yacc.c */
#line 1221 "compilers/imcc/imcc.y"
{
STRING * const hll_name = Parrot_str_unescape(interp, (yyvsp[(2) - (2)].s) + 1, '"', NULL);
@@ -3334,11 +3376,15 @@
break;
case 19:
+
+/* Line 1455 of yacc.c */
#line 1233 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 20:
+
+/* Line 1455 of yacc.c */
#line 1234 "compilers/imcc/imcc.y"
{
mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 1);
@@ -3348,11 +3394,15 @@
break;
case 21:
+
+/* Line 1455 of yacc.c */
#line 1242 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 22:
+
+/* Line 1455 of yacc.c */
#line 1243 "compilers/imcc/imcc.y"
{
(yyval.i) = mk_pmc_const(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (6)].s), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].s));
@@ -3362,11 +3412,15 @@
break;
case 23:
+
+/* Line 1455 of yacc.c */
#line 1249 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 24:
+
+/* Line 1455 of yacc.c */
#line 1250 "compilers/imcc/imcc.y"
{
(yyval.i) = mk_pmc_const_named(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (6)].s), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].s));
@@ -3377,36 +3431,50 @@
break;
case 29:
+
+/* Line 1455 of yacc.c */
#line 1268 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 30:
+
+/* Line 1455 of yacc.c */
#line 1269 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 31:
+
+/* Line 1455 of yacc.c */
#line 1270 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 32:
+
+/* Line 1455 of yacc.c */
#line 1271 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 33:
+
+/* Line 1455 of yacc.c */
#line 1272 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 36:
+
+/* Line 1455 of yacc.c */
#line 1277 "compilers/imcc/imcc.y"
{ clear_state(interp); }
break;
case 37:
+
+/* Line 1455 of yacc.c */
#line 1279 "compilers/imcc/imcc.y"
{
(yyval.i) = INS(interp, IMCC_INFO(interp)->cur_unit,
@@ -3417,6 +3485,8 @@
break;
case 38:
+
+/* Line 1455 of yacc.c */
#line 1286 "compilers/imcc/imcc.y"
{
imc_close_unit(interp, IMCC_INFO(interp)->cur_unit);
@@ -3425,6 +3495,8 @@
break;
case 39:
+
+/* Line 1455 of yacc.c */
#line 1291 "compilers/imcc/imcc.y"
{
(yyval.i) = iSUBROUTINE(interp,
@@ -3436,6 +3508,8 @@
break;
case 40:
+
+/* Line 1455 of yacc.c */
#line 1299 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(2) - (2)].sr));
@@ -3443,6 +3517,8 @@
break;
case 41:
+
+/* Line 1455 of yacc.c */
#line 1303 "compilers/imcc/imcc.y"
{
char *name = mem_sys_strdup((yyvsp[(2) - (4)].s) + 1);
@@ -3459,16 +3535,22 @@
break;
case 42:
+
+/* Line 1455 of yacc.c */
#line 1315 "compilers/imcc/imcc.y"
{ (yyval.i) = 0;}
break;
case 44:
+
+/* Line 1455 of yacc.c */
#line 1323 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PASM); }
break;
case 45:
+
+/* Line 1455 of yacc.c */
#line 1326 "compilers/imcc/imcc.y"
{
/* if (optimizer_level & OPT_PASM)
@@ -3480,6 +3562,8 @@
break;
case 48:
+
+/* Line 1455 of yacc.c */
#line 1342 "compilers/imcc/imcc.y"
{
int re_open = 0;
@@ -3495,6 +3579,8 @@
break;
case 49:
+
+/* Line 1455 of yacc.c */
#line 1357 "compilers/imcc/imcc.y"
{
(yyval.sr) = (yyvsp[(2) - (3)].sr);
@@ -3502,11 +3588,15 @@
break;
case 50:
+
+/* Line 1455 of yacc.c */
#line 1360 "compilers/imcc/imcc.y"
{ (yyval.sr) = NULL; }
break;
case 51:
+
+/* Line 1455 of yacc.c */
#line 1365 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PCCSUB);
@@ -3514,6 +3604,8 @@
break;
case 52:
+
+/* Line 1455 of yacc.c */
#line 1369 "compilers/imcc/imcc.y"
{
iSUBROUTINE(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (3)].sr));
@@ -3521,6 +3613,8 @@
break;
case 53:
+
+/* Line 1455 of yacc.c */
#line 1373 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->cur_call->pcc_sub->pragma = (yyvsp[(5) - (6)].t);
@@ -3532,21 +3626,29 @@
break;
case 54:
+
+/* Line 1455 of yacc.c */
#line 1381 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; }
break;
case 55:
+
+/* Line 1455 of yacc.c */
#line 1385 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 56:
+
+/* Line 1455 of yacc.c */
#line 1386 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 57:
+
+/* Line 1455 of yacc.c */
#line 1388 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->adv_named_id) {
@@ -3560,16 +3662,22 @@
break;
case 58:
+
+/* Line 1455 of yacc.c */
#line 1400 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 59:
+
+/* Line 1455 of yacc.c */
#line 1400 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(3) - (3)].sr); IMCC_INFO(interp)->is_def = 0; }
break;
case 60:
+
+/* Line 1455 of yacc.c */
#line 1405 "compilers/imcc/imcc.y"
{
if ((yyvsp[(3) - (3)].t) & VT_UNIQUE_REG)
@@ -3594,11 +3702,15 @@
break;
case 61:
+
+/* Line 1455 of yacc.c */
#line 1430 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 62:
+
+/* Line 1455 of yacc.c */
#line 1435 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3608,6 +3720,8 @@
break;
case 63:
+
+/* Line 1455 of yacc.c */
#line 1441 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3617,6 +3731,8 @@
break;
case 64:
+
+/* Line 1455 of yacc.c */
#line 1450 "compilers/imcc/imcc.y"
{
(yyval.t) = P_VTABLE;
@@ -3626,6 +3742,8 @@
break;
case 65:
+
+/* Line 1455 of yacc.c */
#line 1456 "compilers/imcc/imcc.y"
{
(yyval.t) = P_VTABLE;
@@ -3635,6 +3753,8 @@
break;
case 66:
+
+/* Line 1455 of yacc.c */
#line 1465 "compilers/imcc/imcc.y"
{
(yyval.t) = P_METHOD;
@@ -3644,6 +3764,8 @@
break;
case 67:
+
+/* Line 1455 of yacc.c */
#line 1471 "compilers/imcc/imcc.y"
{
(yyval.t) = P_METHOD;
@@ -3653,6 +3775,8 @@
break;
case 68:
+
+/* Line 1455 of yacc.c */
#line 1480 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3662,6 +3786,8 @@
break;
case 69:
+
+/* Line 1455 of yacc.c */
#line 1486 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3671,6 +3797,8 @@
break;
case 70:
+
+/* Line 1455 of yacc.c */
#line 1495 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3679,6 +3807,8 @@
break;
case 71:
+
+/* Line 1455 of yacc.c */
#line 1503 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3687,6 +3817,8 @@
break;
case 72:
+
+/* Line 1455 of yacc.c */
#line 1508 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3697,6 +3829,8 @@
break;
case 73:
+
+/* Line 1455 of yacc.c */
#line 1518 "compilers/imcc/imcc.y"
{
add_pcc_multi(IMCC_INFO(interp)->cur_call, NULL);
@@ -3704,6 +3838,8 @@
break;
case 74:
+
+/* Line 1455 of yacc.c */
#line 1522 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3712,6 +3848,8 @@
break;
case 75:
+
+/* Line 1455 of yacc.c */
#line 1527 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3720,26 +3858,36 @@
break;
case 76:
+
+/* Line 1455 of yacc.c */
#line 1534 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, "INTVAL", 'S'); }
break;
case 77:
+
+/* Line 1455 of yacc.c */
#line 1535 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, "FLOATVAL", 'S'); }
break;
case 78:
+
+/* Line 1455 of yacc.c */
#line 1536 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, "PMC", 'S'); }
break;
case 79:
+
+/* Line 1455 of yacc.c */
#line 1537 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, "STRING", 'S'); }
break;
case 80:
+
+/* Line 1455 of yacc.c */
#line 1539 "compilers/imcc/imcc.y"
{
SymReg *r;
@@ -3754,6 +3902,8 @@
break;
case 81:
+
+/* Line 1455 of yacc.c */
#line 1550 "compilers/imcc/imcc.y"
{
SymReg *r;
@@ -3768,11 +3918,15 @@
break;
case 82:
+
+/* Line 1455 of yacc.c */
#line 1560 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (3)].sr); }
break;
case 85:
+
+/* Line 1455 of yacc.c */
#line 1570 "compilers/imcc/imcc.y"
{
char name[128];
@@ -3800,81 +3954,113 @@
break;
case 86:
+
+/* Line 1455 of yacc.c */
#line 1598 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; }
break;
case 87:
+
+/* Line 1455 of yacc.c */
#line 1602 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 0; }
break;
case 88:
+
+/* Line 1455 of yacc.c */
#line 1603 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 1; }
break;
case 89:
+
+/* Line 1455 of yacc.c */
#line 1607 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; }
break;
case 90:
+
+/* Line 1455 of yacc.c */
#line 1608 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->object = (yyvsp[(2) - (3)].sr); }
break;
case 91:
+
+/* Line 1455 of yacc.c */
#line 1612 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 93:
+
+/* Line 1455 of yacc.c */
#line 1617 "compilers/imcc/imcc.y"
{ (yyval.t) = (yyvsp[(1) - (1)].t); }
break;
case 94:
+
+/* Line 1455 of yacc.c */
#line 1618 "compilers/imcc/imcc.y"
{ (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); }
break;
case 95:
+
+/* Line 1455 of yacc.c */
#line 1622 "compilers/imcc/imcc.y"
{ (yyval.t) = P_LOAD; }
break;
case 96:
+
+/* Line 1455 of yacc.c */
#line 1623 "compilers/imcc/imcc.y"
{ (yyval.t) = P_INIT; }
break;
case 97:
+
+/* Line 1455 of yacc.c */
#line 1624 "compilers/imcc/imcc.y"
{ (yyval.t) = P_MAIN; }
break;
case 98:
+
+/* Line 1455 of yacc.c */
#line 1625 "compilers/imcc/imcc.y"
{ (yyval.t) = P_IMMEDIATE; }
break;
case 99:
+
+/* Line 1455 of yacc.c */
#line 1626 "compilers/imcc/imcc.y"
{ (yyval.t) = P_POSTCOMP; }
break;
case 100:
+
+/* Line 1455 of yacc.c */
#line 1627 "compilers/imcc/imcc.y"
{ (yyval.t) = P_ANON; }
break;
case 101:
+
+/* Line 1455 of yacc.c */
#line 1628 "compilers/imcc/imcc.y"
{ (yyval.t) = P_NEED_LEX; }
break;
case 109:
+
+/* Line 1455 of yacc.c */
#line 1640 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (5)].sr));
@@ -3883,6 +4069,8 @@
break;
case 110:
+
+/* Line 1455 of yacc.c */
#line 1645 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
@@ -3890,6 +4078,8 @@
break;
case 111:
+
+/* Line 1455 of yacc.c */
#line 1649 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
@@ -3898,6 +4088,8 @@
break;
case 112:
+
+/* Line 1455 of yacc.c */
#line 1654 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
@@ -3905,6 +4097,8 @@
break;
case 113:
+
+/* Line 1455 of yacc.c */
#line 1658 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(2) - (3)].s), 'S'));
@@ -3912,6 +4106,8 @@
break;
case 114:
+
+/* Line 1455 of yacc.c */
#line 1662 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (5)].sr));
@@ -3920,6 +4116,8 @@
break;
case 115:
+
+/* Line 1455 of yacc.c */
#line 1667 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(2) - (5)].s), 'S'));
@@ -3928,26 +4126,36 @@
break;
case 116:
+
+/* Line 1455 of yacc.c */
#line 1675 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 117:
+
+/* Line 1455 of yacc.c */
#line 1676 "compilers/imcc/imcc.y"
{ add_pcc_arg(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr)); }
break;
case 118:
+
+/* Line 1455 of yacc.c */
#line 1680 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (2)].sr); }
break;
case 119:
+
+/* Line 1455 of yacc.c */
#line 1685 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 120:
+
+/* Line 1455 of yacc.c */
#line 1687 "compilers/imcc/imcc.y"
{
if ((yyvsp[(2) - (3)].sr))
@@ -3956,16 +4164,22 @@
break;
case 121:
+
+/* Line 1455 of yacc.c */
#line 1694 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); }
break;
case 122:
+
+/* Line 1455 of yacc.c */
#line 1695 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 123:
+
+/* Line 1455 of yacc.c */
#line 1696 "compilers/imcc/imcc.y"
{
IdList * const l = (yyvsp[(4) - (4)].idlist);
@@ -3981,66 +4195,92 @@
break;
case 124:
+
+/* Line 1455 of yacc.c */
#line 1710 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 125:
+
+/* Line 1455 of yacc.c */
#line 1711 "compilers/imcc/imcc.y"
{ (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); }
break;
case 126:
+
+/* Line 1455 of yacc.c */
#line 1715 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_FLAT; }
break;
case 127:
+
+/* Line 1455 of yacc.c */
#line 1716 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_OPTIONAL; }
break;
case 128:
+
+/* Line 1455 of yacc.c */
#line 1717 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_OPT_FLAG; }
break;
case 129:
+
+/* Line 1455 of yacc.c */
#line 1718 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_NAMED; }
break;
case 130:
+
+/* Line 1455 of yacc.c */
#line 1719 "compilers/imcc/imcc.y"
{ adv_named_set(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; mem_sys_free((yyvsp[(3) - (4)].s)); }
break;
case 131:
+
+/* Line 1455 of yacc.c */
#line 1720 "compilers/imcc/imcc.y"
{ adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; mem_sys_free((yyvsp[(3) - (4)].s)); }
break;
case 132:
+
+/* Line 1455 of yacc.c */
#line 1721 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_UNIQUE_REG; }
break;
case 133:
+
+/* Line 1455 of yacc.c */
#line 1722 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_CALL_SIG; }
break;
case 134:
+
+/* Line 1455 of yacc.c */
#line 1727 "compilers/imcc/imcc.y"
{ begin_return_or_yield(interp, 0); }
break;
case 135:
+
+/* Line 1455 of yacc.c */
#line 1729 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; }
break;
case 136:
+
+/* Line 1455 of yacc.c */
#line 1731 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->asm_state = AsmDefault;
@@ -4049,21 +4289,29 @@
break;
case 137:
+
+/* Line 1455 of yacc.c */
#line 1738 "compilers/imcc/imcc.y"
{ begin_return_or_yield(interp, 1); }
break;
case 138:
+
+/* Line 1455 of yacc.c */
#line 1740 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; }
break;
case 139:
+
+/* Line 1455 of yacc.c */
#line 1744 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 140:
+
+/* Line 1455 of yacc.c */
#line 1746 "compilers/imcc/imcc.y"
{
if ((yyvsp[(1) - (2)].sr))
@@ -4072,6 +4320,8 @@
break;
case 141:
+
+/* Line 1455 of yacc.c */
#line 1751 "compilers/imcc/imcc.y"
{
if ((yyvsp[(2) - (3)].sr))
@@ -4080,11 +4330,15 @@
break;
case 142:
+
+/* Line 1455 of yacc.c */
#line 1758 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 143:
+
+/* Line 1455 of yacc.c */
#line 1760 "compilers/imcc/imcc.y"
{
if ((yyvsp[(1) - (2)].sr))
@@ -4093,6 +4347,8 @@
break;
case 144:
+
+/* Line 1455 of yacc.c */
#line 1765 "compilers/imcc/imcc.y"
{
if ((yyvsp[(2) - (3)].sr))
@@ -4101,16 +4357,22 @@
break;
case 145:
+
+/* Line 1455 of yacc.c */
#line 1772 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); }
break;
case 146:
+
+/* Line 1455 of yacc.c */
#line 1776 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); }
break;
case 147:
+
+/* Line 1455 of yacc.c */
#line 1781 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->asm_state == AsmDefault)
@@ -4119,6 +4381,8 @@
break;
case 148:
+
+/* Line 1455 of yacc.c */
#line 1786 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->asm_state = AsmDefault;
@@ -4127,21 +4391,29 @@
break;
case 149:
+
+/* Line 1455 of yacc.c */
#line 1793 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 150:
+
+/* Line 1455 of yacc.c */
#line 1794 "compilers/imcc/imcc.y"
{ (yyval.t) = 1; }
break;
case 151:
+
+/* Line 1455 of yacc.c */
#line 1798 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 152:
+
+/* Line 1455 of yacc.c */
#line 1800 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->adv_named_id) {
@@ -4155,6 +4427,8 @@
break;
case 153:
+
+/* Line 1455 of yacc.c */
#line 1810 "compilers/imcc/imcc.y"
{
SymReg * const name = mk_const(interp, (yyvsp[(1) - (3)].s), 'S');
@@ -4163,6 +4437,8 @@
break;
case 154:
+
+/* Line 1455 of yacc.c */
#line 1815 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->adv_named_id) {
@@ -4176,6 +4452,8 @@
break;
case 155:
+
+/* Line 1455 of yacc.c */
#line 1825 "compilers/imcc/imcc.y"
{
SymReg * const name = mk_const(interp, (yyvsp[(3) - (5)].s), 'S');
@@ -4184,46 +4462,64 @@
break;
case 158:
+
+/* Line 1455 of yacc.c */
#line 1846 "compilers/imcc/imcc.y"
{ clear_state(interp); }
break;
case 159:
+
+/* Line 1455 of yacc.c */
#line 1851 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(2) - (2)].i); }
break;
case 160:
+
+/* Line 1455 of yacc.c */
#line 1852 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 161:
+
+/* Line 1455 of yacc.c */
#line 1853 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 162:
+
+/* Line 1455 of yacc.c */
#line 1854 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 163:
+
+/* Line 1455 of yacc.c */
#line 1855 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 164:
+
+/* Line 1455 of yacc.c */
#line 1856 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 165:
+
+/* Line 1455 of yacc.c */
#line 1860 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; }
break;
case 169:
+
+/* Line 1455 of yacc.c */
#line 1871 "compilers/imcc/imcc.y"
{
Instruction * const i = iLABEL(interp, IMCC_INFO(interp)->cur_unit, mk_local_label(interp, (yyvsp[(1) - (1)].s)));
@@ -4233,11 +4529,15 @@
break;
case 170:
+
+/* Line 1455 of yacc.c */
#line 1881 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(2) - (3)].i); }
break;
case 171:
+
+/* Line 1455 of yacc.c */
#line 1883 "compilers/imcc/imcc.y"
{
if (yynerrs >= PARROT_MAX_RECOVER_ERRORS) {
@@ -4249,6 +4549,8 @@
break;
case 172:
+
+/* Line 1455 of yacc.c */
#line 1894 "compilers/imcc/imcc.y"
{
IdList* const l = (yyvsp[(1) - (1)].idlist);
@@ -4258,6 +4560,8 @@
break;
case 173:
+
+/* Line 1455 of yacc.c */
#line 1901 "compilers/imcc/imcc.y"
{
IdList* const l = (yyvsp[(3) - (3)].idlist);
@@ -4267,6 +4571,8 @@
break;
case 174:
+
+/* Line 1455 of yacc.c */
#line 1910 "compilers/imcc/imcc.y"
{
IdList* const l = mem_allocate_n_zeroed_typed(1, IdList);
@@ -4277,21 +4583,29 @@
break;
case 175:
+
+/* Line 1455 of yacc.c */
#line 1919 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 176:
+
+/* Line 1455 of yacc.c */
#line 1920 "compilers/imcc/imcc.y"
{ (yyval.t) = 1; }
break;
case 179:
+
+/* Line 1455 of yacc.c */
#line 1927 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 180:
+
+/* Line 1455 of yacc.c */
#line 1928 "compilers/imcc/imcc.y"
{
IdList *l = (yyvsp[(4) - (4)].idlist);
@@ -4311,6 +4625,8 @@
break;
case 181:
+
+/* Line 1455 of yacc.c */
#line 1944 "compilers/imcc/imcc.y"
{
SymReg *n;
@@ -4324,6 +4640,8 @@
break;
case 182:
+
+/* Line 1455 of yacc.c */
#line 1954 "compilers/imcc/imcc.y"
{
SymReg *n = mk_const(interp, (yyvsp[(2) - (4)].s), 'U');
@@ -4333,11 +4651,15 @@
break;
case 183:
+
+/* Line 1455 of yacc.c */
#line 1959 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 184:
+
+/* Line 1455 of yacc.c */
#line 1960 "compilers/imcc/imcc.y"
{
mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 0);
@@ -4347,11 +4669,15 @@
break;
case 186:
+
+/* Line 1455 of yacc.c */
#line 1967 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 187:
+
+/* Line 1455 of yacc.c */
#line 1968 "compilers/imcc/imcc.y"
{
mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 1);
@@ -4361,6 +4687,8 @@
break;
case 188:
+
+/* Line 1455 of yacc.c */
#line 1974 "compilers/imcc/imcc.y"
{
(yyval.i) = NULL;
@@ -4370,6 +4698,8 @@
break;
case 189:
+
+/* Line 1455 of yacc.c */
#line 1980 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "branch", 1, (yyvsp[(2) - (2)].sr));
@@ -4377,6 +4707,8 @@
break;
case 190:
+
+/* Line 1455 of yacc.c */
#line 1984 "compilers/imcc/imcc.y"
{
(yyval.i) = INS(interp,
@@ -4392,46 +4724,64 @@
break;
case 191:
+
+/* Line 1455 of yacc.c */
#line 1995 "compilers/imcc/imcc.y"
{ (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(2) - (2)].sr)); }
break;
case 192:
+
+/* Line 1455 of yacc.c */
#line 1996 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; }
break;
case 193:
+
+/* Line 1455 of yacc.c */
#line 1997 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 196:
+
+/* Line 1455 of yacc.c */
#line 2000 "compilers/imcc/imcc.y"
{ (yyval.i) = 0;}
break;
case 197:
+
+/* Line 1455 of yacc.c */
#line 2004 "compilers/imcc/imcc.y"
{ (yyval.t) = 'I'; }
break;
case 198:
+
+/* Line 1455 of yacc.c */
#line 2005 "compilers/imcc/imcc.y"
{ (yyval.t) = 'N'; }
break;
case 199:
+
+/* Line 1455 of yacc.c */
#line 2006 "compilers/imcc/imcc.y"
{ (yyval.t) = 'S'; }
break;
case 200:
+
+/* Line 1455 of yacc.c */
#line 2007 "compilers/imcc/imcc.y"
{ (yyval.t) = 'P'; }
break;
case 201:
+
+/* Line 1455 of yacc.c */
#line 2012 "compilers/imcc/imcc.y"
{
/* there'd normally be a mem_sys_strdup() here, but the lexer already
@@ -4445,36 +4795,50 @@
break;
case 202:
+
+/* Line 1455 of yacc.c */
#line 2025 "compilers/imcc/imcc.y"
{ (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "set", 2, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr)); }
break;
case 203:
+
+/* Line 1455 of yacc.c */
#line 2027 "compilers/imcc/imcc.y"
{ (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (4)].s), 2, (yyvsp[(1) - (4)].sr), (yyvsp[(4) - (4)].sr)); }
break;
case 204:
+
+/* Line 1455 of yacc.c */
#line 2029 "compilers/imcc/imcc.y"
{ (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(4) - (5)].s), 3, (yyvsp[(1) - (5)].sr), (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr)); }
break;
case 205:
+
+/* Line 1455 of yacc.c */
#line 2031 "compilers/imcc/imcc.y"
{ (yyval.i) = iINDEXFETCH(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (6)].sr), (yyvsp[(3) - (6)].sr), (yyvsp[(5) - (6)].sr)); }
break;
case 206:
+
+/* Line 1455 of yacc.c */
#line 2033 "compilers/imcc/imcc.y"
{ (yyval.i) = iINDEXSET(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (6)].sr), (yyvsp[(3) - (6)].sr), (yyvsp[(6) - (6)].sr)); }
break;
case 207:
+
+/* Line 1455 of yacc.c */
#line 2038 "compilers/imcc/imcc.y"
{ (yyval.i) = iNEW(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (7)].sr), (yyvsp[(4) - (7)].s), (yyvsp[(6) - (7)].sr), 1); }
break;
case 208:
+
+/* Line 1455 of yacc.c */
#line 2041 "compilers/imcc/imcc.y"
{
add_pcc_result((yyvsp[(3) - (3)].i)->symregs[0], (yyvsp[(1) - (3)].sr));
@@ -4484,6 +4848,8 @@
break;
case 209:
+
+/* Line 1455 of yacc.c */
#line 2047 "compilers/imcc/imcc.y"
{
(yyval.i) = IMCC_create_itcall_label(interp);
@@ -4491,6 +4857,8 @@
break;
case 210:
+
+/* Line 1455 of yacc.c */
#line 2051 "compilers/imcc/imcc.y"
{
IMCC_itcall_sub(interp, (yyvsp[(6) - (9)].sr));
@@ -4499,6 +4867,8 @@
break;
case 214:
+
+/* Line 1455 of yacc.c */
#line 2059 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(1) - (3)].sr));
@@ -4506,136 +4876,190 @@
break;
case 215:
+
+/* Line 1455 of yacc.c */
#line 2066 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"not"; }
break;
case 216:
+
+/* Line 1455 of yacc.c */
#line 2067 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bnot"; }
break;
case 217:
+
+/* Line 1455 of yacc.c */
#line 2068 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"neg"; }
break;
case 218:
+
+/* Line 1455 of yacc.c */
#line 2072 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"sub"; }
break;
case 219:
+
+/* Line 1455 of yacc.c */
#line 2073 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"add"; }
break;
case 220:
+
+/* Line 1455 of yacc.c */
#line 2074 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"mul"; }
break;
case 221:
+
+/* Line 1455 of yacc.c */
#line 2075 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"div"; }
break;
case 222:
+
+/* Line 1455 of yacc.c */
#line 2076 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"mod"; }
break;
case 223:
+
+/* Line 1455 of yacc.c */
#line 2077 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"fdiv"; }
break;
case 224:
+
+/* Line 1455 of yacc.c */
#line 2078 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"pow"; }
break;
case 225:
+
+/* Line 1455 of yacc.c */
#line 2079 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"concat"; }
break;
case 226:
+
+/* Line 1455 of yacc.c */
#line 2080 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"iseq"; }
break;
case 227:
+
+/* Line 1455 of yacc.c */
#line 2081 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"isne"; }
break;
case 228:
+
+/* Line 1455 of yacc.c */
#line 2082 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"isgt"; }
break;
case 229:
+
+/* Line 1455 of yacc.c */
#line 2083 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"isge"; }
break;
case 230:
+
+/* Line 1455 of yacc.c */
#line 2084 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"islt"; }
break;
case 231:
+
+/* Line 1455 of yacc.c */
#line 2085 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"isle"; }
break;
case 232:
+
+/* Line 1455 of yacc.c */
#line 2086 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"shl"; }
break;
case 233:
+
+/* Line 1455 of yacc.c */
#line 2087 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"shr"; }
break;
case 234:
+
+/* Line 1455 of yacc.c */
#line 2088 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"lsr"; }
break;
case 235:
+
+/* Line 1455 of yacc.c */
#line 2089 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"and"; }
break;
case 236:
+
+/* Line 1455 of yacc.c */
#line 2090 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"or"; }
break;
case 237:
+
+/* Line 1455 of yacc.c */
#line 2091 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"xor"; }
break;
case 238:
+
+/* Line 1455 of yacc.c */
#line 2092 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"band"; }
break;
case 239:
+
+/* Line 1455 of yacc.c */
#line 2093 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bor"; }
break;
case 240:
+
+/* Line 1455 of yacc.c */
#line 2094 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bxor"; }
break;
case 241:
+
+/* Line 1455 of yacc.c */
#line 2100 "compilers/imcc/imcc.y"
{
(yyval.i) = IMCC_create_itcall_label(interp);
@@ -4645,81 +5069,113 @@
break;
case 242:
+
+/* Line 1455 of yacc.c */
#line 2105 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 243:
+
+/* Line 1455 of yacc.c */
#line 2112 "compilers/imcc/imcc.y"
{ (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(2) - (3)].s), 2, (yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].sr)); }
break;
case 244:
+
+/* Line 1455 of yacc.c */
#line 2116 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"add"; }
break;
case 245:
+
+/* Line 1455 of yacc.c */
#line 2117 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"sub"; }
break;
case 246:
+
+/* Line 1455 of yacc.c */
#line 2118 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"mul"; }
break;
case 247:
+
+/* Line 1455 of yacc.c */
#line 2119 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"div"; }
break;
case 248:
+
+/* Line 1455 of yacc.c */
#line 2120 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"mod"; }
break;
case 249:
+
+/* Line 1455 of yacc.c */
#line 2121 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"fdiv"; }
break;
case 250:
+
+/* Line 1455 of yacc.c */
#line 2122 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"concat"; }
break;
case 251:
+
+/* Line 1455 of yacc.c */
#line 2123 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"band"; }
break;
case 252:
+
+/* Line 1455 of yacc.c */
#line 2124 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bor"; }
break;
case 253:
+
+/* Line 1455 of yacc.c */
#line 2125 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bxor"; }
break;
case 254:
+
+/* Line 1455 of yacc.c */
#line 2126 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"shr"; }
break;
case 255:
+
+/* Line 1455 of yacc.c */
#line 2127 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"shl"; }
break;
case 256:
+
+/* Line 1455 of yacc.c */
#line 2128 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"lsr"; }
break;
case 257:
+
+/* Line 1455 of yacc.c */
#line 2134 "compilers/imcc/imcc.y"
{
(yyval.i) = func_ins(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (4)].sr), (yyvsp[(3) - (4)].s),
@@ -4731,21 +5187,29 @@
break;
case 258:
+
+/* Line 1455 of yacc.c */
#line 2144 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 259:
+
+/* Line 1455 of yacc.c */
#line 2145 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address_fromc(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 260:
+
+/* Line 1455 of yacc.c */
#line 2146 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address_u(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 261:
+
+/* Line 1455 of yacc.c */
#line 2148 "compilers/imcc/imcc.y"
{
(yyval.sr) = (yyvsp[(1) - (1)].sr);
@@ -4755,6 +5219,8 @@
break;
case 262:
+
+/* Line 1455 of yacc.c */
#line 2154 "compilers/imcc/imcc.y"
{
/* disallow bareword method names; SREG name constants are fine */
@@ -4772,6 +5238,8 @@
break;
case 263:
+
+/* Line 1455 of yacc.c */
#line 2168 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr);
@@ -4781,6 +5249,8 @@
break;
case 264:
+
+/* Line 1455 of yacc.c */
#line 2174 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr);
@@ -4790,11 +5260,15 @@
break;
case 265:
+
+/* Line 1455 of yacc.c */
#line 2179 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr); (yyval.sr) = (yyvsp[(3) - (3)].sr); }
break;
case 266:
+
+/* Line 1455 of yacc.c */
#line 2185 "compilers/imcc/imcc.y"
{
(yyval.i) = IMCC_create_itcall_label(interp);
@@ -4803,16 +5277,22 @@
break;
case 267:
+
+/* Line 1455 of yacc.c */
#line 2189 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(2) - (5)].i); }
break;
case 268:
+
+/* Line 1455 of yacc.c */
#line 2193 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 269:
+
+/* Line 1455 of yacc.c */
#line 2195 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4826,6 +5306,8 @@
break;
case 270:
+
+/* Line 1455 of yacc.c */
#line 2205 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4839,6 +5321,8 @@
break;
case 271:
+
+/* Line 1455 of yacc.c */
#line 2215 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4849,6 +5333,8 @@
break;
case 272:
+
+/* Line 1455 of yacc.c */
#line 2222 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4857,6 +5343,8 @@
break;
case 273:
+
+/* Line 1455 of yacc.c */
#line 2227 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4867,51 +5355,71 @@
break;
case 274:
+
+/* Line 1455 of yacc.c */
#line 2236 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); }
break;
case 275:
+
+/* Line 1455 of yacc.c */
#line 2240 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 276:
+
+/* Line 1455 of yacc.c */
#line 2241 "compilers/imcc/imcc.y"
{ (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); }
break;
case 277:
+
+/* Line 1455 of yacc.c */
#line 2245 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_FLAT; }
break;
case 278:
+
+/* Line 1455 of yacc.c */
#line 2246 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_NAMED; }
break;
case 279:
+
+/* Line 1455 of yacc.c */
#line 2247 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_CALL_SIG; }
break;
case 280:
+
+/* Line 1455 of yacc.c */
#line 2250 "compilers/imcc/imcc.y"
{ adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; }
break;
case 281:
+
+/* Line 1455 of yacc.c */
#line 2251 "compilers/imcc/imcc.y"
{ adv_named_set(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = 0; }
break;
case 282:
+
+/* Line 1455 of yacc.c */
#line 2255 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); }
break;
case 283:
+
+/* Line 1455 of yacc.c */
#line 2260 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4925,6 +5433,8 @@
break;
case 284:
+
+/* Line 1455 of yacc.c */
#line 2270 "compilers/imcc/imcc.y"
{
add_pcc_named_result(IMCC_INFO(interp)->cur_call,
@@ -4934,6 +5444,8 @@
break;
case 285:
+
+/* Line 1455 of yacc.c */
#line 2276 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4947,6 +5459,8 @@
break;
case 286:
+
+/* Line 1455 of yacc.c */
#line 2286 "compilers/imcc/imcc.y"
{
add_pcc_named_result(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(1) - (3)].s), 'S'), (yyvsp[(3) - (3)].sr));
@@ -4955,21 +5469,29 @@
break;
case 287:
+
+/* Line 1455 of yacc.c */
#line 2290 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 288:
+
+/* Line 1455 of yacc.c */
#line 2294 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 289:
+
+/* Line 1455 of yacc.c */
#line 2295 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 290:
+
+/* Line 1455 of yacc.c */
#line 2300 "compilers/imcc/imcc.y"
{
(yyval.i) =MK_I(interp, IMCC_INFO(interp)->cur_unit, inv_op((yyvsp[(3) - (6)].s)), 3, (yyvsp[(2) - (6)].sr), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].sr));
@@ -4977,6 +5499,8 @@
break;
case 291:
+
+/* Line 1455 of yacc.c */
#line 2304 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "unless_null", 2, (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr));
@@ -4984,6 +5508,8 @@
break;
case 292:
+
+/* Line 1455 of yacc.c */
#line 2308 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "unless", 2, (yyvsp[(2) - (4)].sr), (yyvsp[(4) - (4)].sr));
@@ -4991,6 +5517,8 @@
break;
case 293:
+
+/* Line 1455 of yacc.c */
#line 2315 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "if", 2, (yyvsp[(2) - (4)].sr), (yyvsp[(4) - (4)].sr));
@@ -4998,6 +5526,8 @@
break;
case 294:
+
+/* Line 1455 of yacc.c */
#line 2319 "compilers/imcc/imcc.y"
{
(yyval.i) =MK_I(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (6)].s), 3, (yyvsp[(2) - (6)].sr), (yyvsp[(4) - (6)].sr), (yyvsp[(6) - (6)].sr));
@@ -5005,6 +5535,8 @@
break;
case 295:
+
+/* Line 1455 of yacc.c */
#line 2323 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "if_null", 2, (yyvsp[(3) - (5)].sr), (yyvsp[(5) - (5)].sr));
@@ -5012,66 +5544,92 @@
break;
case 296:
+
+/* Line 1455 of yacc.c */
#line 2329 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 297:
+
+/* Line 1455 of yacc.c */
#line 2330 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 298:
+
+/* Line 1455 of yacc.c */
#line 2334 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"eq"; }
break;
case 299:
+
+/* Line 1455 of yacc.c */
#line 2335 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"ne"; }
break;
case 300:
+
+/* Line 1455 of yacc.c */
#line 2336 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"gt"; }
break;
case 301:
+
+/* Line 1455 of yacc.c */
#line 2337 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"ge"; }
break;
case 302:
+
+/* Line 1455 of yacc.c */
#line 2338 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"lt"; }
break;
case 303:
+
+/* Line 1455 of yacc.c */
#line 2339 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"le"; }
break;
case 306:
+
+/* Line 1455 of yacc.c */
#line 2348 "compilers/imcc/imcc.y"
{ (yyval.sr) = NULL; }
break;
case 307:
+
+/* Line 1455 of yacc.c */
#line 2349 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(1) - (1)].sr); }
break;
case 308:
+
+/* Line 1455 of yacc.c */
#line 2353 "compilers/imcc/imcc.y"
{ (yyval.sr) = IMCC_INFO(interp)->regs[0]; }
break;
case 310:
+
+/* Line 1455 of yacc.c */
#line 2358 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(1) - (1)].sr); }
break;
case 311:
+
+/* Line 1455 of yacc.c */
#line 2360 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp) -> regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(1) - (4)].sr);
@@ -5082,6 +5640,8 @@
break;
case 312:
+
+/* Line 1455 of yacc.c */
#line 2367 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp) -> regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(2) - (3)].sr);
@@ -5090,36 +5650,50 @@
break;
case 314:
+
+/* Line 1455 of yacc.c */
#line 2374 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address_fromc(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 315:
+
+/* Line 1455 of yacc.c */
#line 2375 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address_u(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 316:
+
+/* Line 1455 of yacc.c */
#line 2379 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 317:
+
+/* Line 1455 of yacc.c */
#line 2380 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_sub_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 318:
+
+/* Line 1455 of yacc.c */
#line 2384 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_label_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 319:
+
+/* Line 1455 of yacc.c */
#line 2385 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_label_address(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 324:
+
+/* Line 1455 of yacc.c */
#line 2399 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->nkeys = 0;
@@ -5127,6 +5701,8 @@
break;
case 325:
+
+/* Line 1455 of yacc.c */
#line 2403 "compilers/imcc/imcc.y"
{
(yyval.sr) = link_keys(interp,
@@ -5136,6 +5712,8 @@
break;
case 326:
+
+/* Line 1455 of yacc.c */
#line 2411 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->nkeys = 0;
@@ -5143,6 +5721,8 @@
break;
case 327:
+
+/* Line 1455 of yacc.c */
#line 2415 "compilers/imcc/imcc.y"
{
(yyval.sr) = link_keys(interp,
@@ -5152,11 +5732,15 @@
break;
case 328:
+
+/* Line 1455 of yacc.c */
#line 2423 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(1) - (1)].sr); }
break;
case 329:
+
+/* Line 1455 of yacc.c */
#line 2425 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(3) - (3)].sr);
@@ -5165,6 +5749,8 @@
break;
case 330:
+
+/* Line 1455 of yacc.c */
#line 2433 "compilers/imcc/imcc.y"
{
(yyval.sr) = (yyvsp[(1) - (1)].sr);
@@ -5172,53 +5758,72 @@
break;
case 331:
+
+/* Line 1455 of yacc.c */
#line 2439 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'I'); }
break;
case 332:
+
+/* Line 1455 of yacc.c */
#line 2440 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'N'); }
break;
case 333:
+
+/* Line 1455 of yacc.c */
#line 2441 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'S'); }
break;
case 334:
+
+/* Line 1455 of yacc.c */
#line 2442 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'P'); }
break;
case 335:
+
+/* Line 1455 of yacc.c */
#line 2443 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_pasm_reg(interp, (yyvsp[(1) - (1)].s)); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 336:
+
+/* Line 1455 of yacc.c */
#line 2447 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'I'); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 337:
+
+/* Line 1455 of yacc.c */
#line 2448 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'N'); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 338:
+
+/* Line 1455 of yacc.c */
#line 2449 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'S'); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 339:
+
+/* Line 1455 of yacc.c */
#line 2450 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'U'); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
-/* Line 1267 of yacc.c. */
-#line 5211 "compilers/imcc/imcparser.c"
+
+/* Line 1455 of yacc.c */
+#line 5816 "compilers/imcc/imcparser.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -5229,7 +5834,6 @@
*++yyvsp = yyval;
-
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
@@ -5294,7 +5898,7 @@
if (yyerrstatus == 3)
{
- /* If just tried and failed to reuse look-ahead token after an
+ /* If just tried and failed to reuse lookahead token after an
error, discard it. */
if (yychar <= YYEOF)
@@ -5311,7 +5915,7 @@
}
}
- /* Else will try to reuse look-ahead token after shifting the error
+ /* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
@@ -5368,9 +5972,6 @@
YY_STACK_PRINT (yyss, yyssp);
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
*++yyvsp = yylval;
@@ -5395,7 +5996,7 @@
yyresult = 1;
goto yyreturn;
-#ifndef yyoverflow
+#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
@@ -5406,7 +6007,7 @@
#endif
yyreturn:
- if (yychar != YYEOF && yychar != YYEMPTY)
+ if (yychar != YYEMPTY)
yydestruct ("Cleanup: discarding lookahead",
yytoken, &yylval, yyscanner, interp);
/* Do not reclaim the symbols of the rule which action triggered
@@ -5432,6 +6033,8 @@
}
+
+/* Line 1675 of yacc.c */
#line 2456 "compilers/imcc/imcc.y"
Modified: trunk/compilers/imcc/imcparser.h
==============================================================================
--- trunk/compilers/imcc/imcparser.h Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/compilers/imcc/imcparser.h Sun Dec 20 12:30:38 2009 (r43175)
@@ -9,27 +9,26 @@
*/
/* HEADERIZER HFILE: none */
/* HEADERIZER STOP */
-/* A Bison parser, made by GNU Bison 2.3. */
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* A Bison parser, made by GNU Bison 2.4.1. */
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+/* Skeleton interface for Bison's Yacc-like parsers in C
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
Free Software Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
+
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
-
+
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -40,10 +39,11 @@
special exception, which will cause the skeleton and the resulting
Bison output files to be licensed under the GNU General Public
License without this special exception.
-
+
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
+
/* Tokens. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
@@ -297,21 +297,27 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 1059 "compilers/imcc/imcc.y"
{
+
+/* Line 1676 of yacc.c */
+#line 1059 "compilers/imcc/imcc.y"
+
IdList * idlist;
int t;
char * s;
SymReg * sr;
Instruction *i;
-}
-/* Line 1489 of yacc.c. */
-#line 299 "compilers/imcc/imcparser.h"
- YYSTYPE;
+
+
+
+/* Line 1676 of yacc.c */
+#line 304 "compilers/imcc/imcparser.h"
+} YYSTYPE;
+# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
#endif
+
Modified: trunk/compilers/imcc/instructions.c
==============================================================================
--- trunk/compilers/imcc/instructions.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/compilers/imcc/instructions.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -9,7 +9,7 @@
#include "imc.h"
#include "pbc.h"
#include "optimizer.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/*
Modified: trunk/compilers/imcc/main.c
==============================================================================
--- trunk/compilers/imcc/main.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/compilers/imcc/main.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -34,7 +34,7 @@
#include "parrot/longopt.h"
#include "parrot/imcc.h"
#include "parrot/runcore_api.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "pbc.h"
#include "parser.h"
Modified: trunk/compilers/imcc/optimizer.c
==============================================================================
--- trunk/compilers/imcc/optimizer.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/compilers/imcc/optimizer.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -73,7 +73,7 @@
#include "imc.h"
#include "pbc.h"
#include "optimizer.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: compilers/imcc/optimizer.h */
Modified: trunk/compilers/imcc/parser_util.c
==============================================================================
--- trunk/compilers/imcc/parser_util.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/compilers/imcc/parser_util.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -22,7 +22,7 @@
#include "parrot/dynext.h"
#include "parrot/embed.h"
#include "pmc/pmc_sub.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "pbc.h"
#include "parser.h"
#include "optimizer.h"
Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/compilers/imcc/pbc.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -7,7 +7,7 @@
#include "pbc.h"
#include "parrot/packfile.h"
#include "pmc/pmc_sub.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: compilers/imcc/pbc.h */
Modified: trunk/config/auto/pmc.pm
==============================================================================
--- trunk/config/auto/pmc.pm Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/config/auto/pmc.pm Sun Dec 20 12:30:38 2009 (r43175)
@@ -102,7 +102,7 @@
src/pmc/$pmc\$(O): include/pmc/pmc_${pmc}.h src/pmc/$pmc.str \$(NONGEN_HEADERS) \\
$parent_headers $include_headers include/pmc/pmc_continuation.h \\
- include/pmc/pmc_context.h include/pmc/pmc_fixedintegerarray.h
+ include/pmc/pmc_callcontext.h include/pmc/pmc_fixedintegerarray.h
END
}
Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/config/gen/makefiles/root.in Sun Dec 20 12:30:38 2009 (r43175)
@@ -846,7 +846,7 @@
$(INC_DIR)/extend.h : $(INC_DIR)/extend_vtable.h
$(INC_DIR)/parrot.h : $(INC_DIR)/context.h
-$(INC_DIR)/context.h : $(PMC_INC_DIR)/pmc/pmc_context.h
+$(INC_DIR)/context.h : $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(INC_DIR)/pbcversion.h :
$(PERL) $(BUILD_TOOLS_DIR)/pbcversion_h.pl > $(INC_DIR)/pbcversion.h
@@ -875,12 +875,13 @@
$(SRC_DIR)/null_config$(O) : $(INC_DIR)/parrot.h $(SRC_DIR)/null_config.c
-$(SRC_DIR)/oo$(O) : $(INC_DIR)/parrot.h $(PMC_INC_DIR)/pmc/pmc_class.h $(PMC_INC_DIR)/pmc/pmc_object.h $(PMC_INC_DIR)/pmc/pmc_context.h $(INC_DIR)/pbcversion.h $(SRC_DIR)/oo.str
+$(SRC_DIR)/oo$(O) : $(INC_DIR)/parrot.h $(PMC_INC_DIR)/pmc/pmc_class.h $(PMC_INC_DIR)/pmc/pmc_object.h $(PMC_INC_DIR)/pmc/pmc_callcontext.h $(INC_DIR)/pbcversion.h $(SRC_DIR)/oo.str
+
$(SRC_DIR)/scheduler$(O) : $(INC_DIR)/parrot.h \
$(SRC_DIR)/scheduler.str \
$(SRC_DIR)/pmc/scheduler.c \
- $(PMC_INC_DIR)/pmc/pmc_context.h \
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h \
$(PMC_INC_DIR)/pmc/pmc_scheduler.h \
$(PMC_INC_DIR)/pmc/pmc_task.h \
$(PMC_INC_DIR)/pmc/pmc_timer.h \
@@ -1074,16 +1075,16 @@
$(SRC_DIR)/extend_vtable$(O) : $(INC_DIR)/parrot.h
-$(SRC_DIR)/global_setup$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/global_setup.str $(PMC_INC_DIR)/pmc/pmc_context.h
+$(SRC_DIR)/global_setup$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/global_setup.str $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/global$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/global.str \
- $(PMC_INC_DIR)/pmc/pmc_sub.h $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_sub.h $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/pmc$(O) : $(GENERAL_H_FILES) $(PMC_INC_DIR)/pmc/pmc_class.h \
- $(SRC_DIR)/pmc.str $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(SRC_DIR)/pmc.str $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/pmc_freeze$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/pmc_freeze.str \
- $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/hash$(O) : $(GENERAL_H_FILES) $(PMC_INC_DIR)/pmc/pmc_key.h
@@ -1095,7 +1096,7 @@
$(PERL) $(BUILD_TOOLS_DIR)/vtable_extend.pl
$(SRC_DIR)/key$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/key.str \
- $(PMC_INC_DIR)/pmc/pmc_key.h $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_key.h $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/gc/mark_sweep$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/gc/gc_private.h
@@ -1110,7 +1111,7 @@
$(SRC_DIR)/gc/alloc_resources$(O) : $(GENERAL_H_FILES) \
$(SRC_DIR)/gc/gc_private.h
-$(SRC_DIR)/hll$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/hll.str $(PMC_INC_DIR)/pmc/pmc_context.h
+$(SRC_DIR)/hll$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/hll.str $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/platform$(O) : $(GENERAL_H_FILES)
@@ -1119,16 +1120,16 @@
$(SRC_DIR)/core_pmcs$(O) : $(GENERAL_H_FILES)
$(SRC_DIR)/runcore/trace$(O) : $(GENERAL_H_FILES) $(PMC_INC_DIR)/pmc/pmc_sub.h \
- $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/debug$(O) : $(GENERAL_H_FILES) $(INC_DIR)/debugger.h \
$(SRC_DIR)/debug.str $(PMC_INC_DIR)/pmc/pmc_key.h \
$(PMC_INC_DIR)/pmc/pmc_continuation.h \
- $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/sub$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/sub.str \
$(PMC_INC_DIR)/pmc/pmc_sub.h $(PMC_INC_DIR)/pmc/pmc_continuation.h \
- $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/string/api$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/string/api.str \
$(SRC_DIR)/string/private_cstring.h
@@ -1138,11 +1139,11 @@
$(SRC_DIR)/longopt$(O) : $(GENERAL_H_FILES)
$(SRC_DIR)/dynext$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/dynext.str \
- $(PMC_INC_DIR)/pmc/pmc_parrotlibrary.h $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_parrotlibrary.h $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/exceptions$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/exceptions.str \
$(PMC_INC_DIR)/pmc/pmc_continuation.h \
- $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/events$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/events.str
@@ -1150,45 +1151,45 @@
$(PMC_INC_DIR)/pmc/pmc_parrotinterpreter.h
$(SRC_DIR)/extend$(O) : $(GENERAL_H_FILES) $(INC_DIR)/extend.h \
- $(PMC_INC_DIR)/pmc/pmc_sub.h $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_sub.h $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/runcore/main$(O) : $(SRC_DIR)/runcore/main.c \
$(SRC_DIR)/runcore/main.str $(GENERAL_H_FILES) \
$(PMC_INC_DIR)/pmc/pmc_parrotlibrary.h \
- $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/runcore/profiling$(O) : $(SRC_DIR)/runcore/profiling.str $(GENERAL_H_FILES) \
$(PMC_INC_DIR)/pmc/pmc_sub.h \
- $(PMC_INC_DIR)/pmc/pmc_context.h \
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h \
$(PMC_INC_DIR)/pmc/pmc_namespace.h
$(SRC_DIR)/call/args$(O) : $(SRC_DIR)/call/args.c $(GENERAL_H_FILES) \
$(SRC_DIR)/call/args.str \
- $(PMC_INC_DIR)/pmc/pmc_key.h $(PMC_INC_DIR)/pmc/pmc_callsignature.h \
- $(PMC_INC_DIR)/pmc/pmc_fixedintegerarray.h $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_key.h $(PMC_INC_DIR)/pmc/pmc_callcontext.h \
+ $(PMC_INC_DIR)/pmc/pmc_fixedintegerarray.h $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/call/context_accessors$(O): $(GENERAL_H_FILES) \
- $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/call/pcc$(O) : $(SRC_DIR)/call/pcc.c $(GENERAL_H_FILES) \
$(SRC_DIR)/call/pcc.str $(PMC_INC_DIR)/pmc/pmc_fixedintegerarray.h \
$(PMC_INC_DIR)/pmc/pmc_key.h $(PMC_INC_DIR)/pmc/pmc_continuation.h \
- $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/call/context$(O) : $(SRC_DIR)/call/context.c $(GENERAL_H_FILES) \
- $(PMC_INC_DIR)/pmc/pmc_sub.h $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_sub.h $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/interp/inter_cb$(O) : $(SRC_DIR)/interp/inter_cb.c \
$(GENERAL_H_FILES) $(SRC_DIR)/interp/inter_cb.str
$(SRC_DIR)/interp/inter_misc$(O) : $(SRC_DIR)/interp/inter_misc.c \
$(GENERAL_H_FILES) $(SRC_DIR)/interp/inter_misc.str \
- $(PMC_INC_DIR)/pmc/pmc_context.h \
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h \
compilers/imcc/imc.h
$(SRC_DIR)/interp/inter_create$(O) : $(SRC_DIR)/interp/inter_create.c \
$(GENERAL_H_FILES) $(SRC_DIR)/interp/inter_create.str \
- $(PMC_INC_DIR)/pmc/pmc_context.h \
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h \
compilers/imcc/imc.h
$(SRC_DIR)/call/ops$(O) : $(SRC_DIR)/call/ops.c $(GENERAL_H_FILES) \
@@ -1212,11 +1213,11 @@
$(SRC_DIR)/multidispatch$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/multidispatch.str \
$(PMC_INC_DIR)/pmc/pmc_nci.h $(PMC_INC_DIR)/pmc/pmc_sub.h \
- $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/packfile$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/packfile.str \
$(PMC_INC_DIR)/pmc/pmc_sub.h $(PMC_INC_DIR)/pmc/pmc_key.h \
- $(PMC_INC_DIR)/pmc/pmc_context.h compilers/imcc/imc.h
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h compilers/imcc/imc.h
$(PF_DIR)/pf_items$(O) : $(GENERAL_H_FILES)
@@ -1225,12 +1226,12 @@
$(SRC_DIR)/parrot$(O) : $(GENERAL_H_FILES)
$(SRC_DIR)/runcore/cores$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/runcore/cores.str \
- $(PMC_INC_DIR)/pmc/pmc_sub.h $(PMC_INC_DIR)/pmc/pmc_context.h
+ $(PMC_INC_DIR)/pmc/pmc_sub.h $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/tsq$(O) : $(GENERAL_H_FILES)
$(SRC_DIR)/embed$(O) : $(GENERAL_H_FILES) $(INC_DIR)/debugger.h \
- $(PMC_INC_DIR)/pmc/pmc_sub.h $(PMC_INC_DIR)/pmc/pmc_context.h \
+ $(PMC_INC_DIR)/pmc/pmc_sub.h $(PMC_INC_DIR)/pmc/pmc_callcontext.h \
compilers/imcc/imc.h
$(SRC_DIR)/dataypes$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/dataypes.c
@@ -1239,7 +1240,7 @@
$(SRC_DIR)/nci$(O) : $(GENERAL_H_FILES) $(SRC_DIR)/nci.c $(SRC_DIR)/nci.str \
$(SRC_DIR)/frame_builder.h \
- $(PMC_INC_DIR)/pmc/pmc_context.h \
+ $(PMC_INC_DIR)/pmc/pmc_callcontext.h \
$(PMC_INC_DIR)/pmc/pmc_unmanagedstruct.h \
$(PMC_INC_DIR)/pmc/pmc_managedstruct.h \
$(PMC_INC_DIR)/pmc/pmc_nci.h \
@@ -1260,7 +1261,7 @@
$(PMC_INC_DIR)/pmc/pmc_nci.h
$(PERL) $(BUILD_TOOLS_DIR)/nativecall.pl $(SRC_DIR)/call_list.txt
-$(SRC_DIR)/warnings$(O) : $(GENERAL_H_FILES) $(PMC_INC_DIR)/pmc/pmc_context.h
+$(SRC_DIR)/warnings$(O) : $(GENERAL_H_FILES) $(PMC_INC_DIR)/pmc/pmc_callcontext.h
$(SRC_DIR)/misc$(O) : $(GENERAL_H_FILES)
Modified: trunk/include/parrot/call.h
==============================================================================
--- trunk/include/parrot/call.h Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/include/parrot/call.h Sun Dec 20 12:30:38 2009 (r43175)
@@ -464,6 +464,12 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
+PARROT_CANNOT_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
+PMC * Parrot_pcc_allocate_empty_context(PARROT_INTERP,
+ ARGIN_NULLOK(PMC *old))
+ __attribute__nonnull__(1);
+
void Parrot_pcc_allocate_registers(PARROT_INTERP,
ARGIN(PMC *pmcctx),
ARGIN(const INTVAL *number_regs_used))
@@ -477,6 +483,14 @@
PARROT_CANNOT_RETURN_NULL
PARROT_WARN_UNUSED_RESULT
+PMC * Parrot_pcc_init_context(PARROT_INTERP,
+ ARGIN(PMC *ctx),
+ ARGIN_NULLOK(PMC *old))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_CANNOT_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
PMC * Parrot_set_new_context(PARROT_INTERP,
ARGIN(const INTVAL *number_regs_used))
__attribute__nonnull__(1)
@@ -538,6 +552,9 @@
#define ASSERT_ARGS_Parrot_alloc_context __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(number_regs_used))
+#define ASSERT_ARGS_Parrot_pcc_allocate_empty_context \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_pcc_allocate_registers __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pmcctx) \
@@ -545,6 +562,9 @@
#define ASSERT_ARGS_Parrot_pcc_free_registers __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pmcctx))
+#define ASSERT_ARGS_Parrot_pcc_init_context __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_set_new_context __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(number_regs_used))
Modified: trunk/include/parrot/context.h
==============================================================================
--- trunk/include/parrot/context.h Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/include/parrot/context.h Sun Dec 20 12:30:38 2009 (r43175)
@@ -24,8 +24,8 @@
INTVAL *regs_i;
} Regs_ni;
-#include <pmc/pmc_context.h>
-typedef struct Parrot_Context_attributes Parrot_Context;
+#include <pmc/pmc_callcontext.h>
+typedef struct Parrot_CallContext_attributes Parrot_Context;
/*
* Macros to make accessing registers more convenient/readable.
Modified: trunk/lib/Parrot/OpTrans/C.pm
==============================================================================
--- trunk/lib/Parrot/OpTrans/C.pm Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/lib/Parrot/OpTrans/C.pm Sun Dec 20 12:30:38 2009 (r43175)
@@ -52,7 +52,7 @@
sub defines {
my $type = __PACKAGE__;
return <<END;
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* defines - $0 -> $type */
#undef CONST
Modified: trunk/lib/Parrot/Ops2c/Utils.pm
==============================================================================
--- trunk/lib/Parrot/Ops2c/Utils.pm Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/lib/Parrot/Ops2c/Utils.pm Sun Dec 20 12:30:38 2009 (r43175)
@@ -551,7 +551,7 @@
print $fh <<END_C;
#include "$self->{include}"
#include "pmc/pmc_parrotlibrary.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
$self->{defines}
Modified: trunk/lib/Parrot/Pmc2c/PMCEmitter.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/PMCEmitter.pm Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/lib/Parrot/Pmc2c/PMCEmitter.pm Sun Dec 20 12:30:38 2009 (r43175)
@@ -77,7 +77,7 @@
# The PCC code needs Continuation-related macros from these headers.
$c->emit("#include \"pmc/pmc_continuation.h\"\n");
- $c->emit("#include \"pmc/pmc_context.h\"\n");
+ $c->emit("#include \"pmc/pmc_callcontext.h\"\n");
$c->emit( $self->preamble );
Modified: trunk/src/call/args.c
==============================================================================
--- trunk/src/call/args.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/call/args.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -24,9 +24,9 @@
#include "parrot/runcore_api.h"
#include "args.str"
#include "pmc/pmc_key.h"
-#include "pmc/pmc_callsignature.h"
+#include "pmc/pmc_callcontext.h"
#include "pmc/pmc_fixedintegerarray.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/call.h */
@@ -555,7 +555,7 @@
PMC * const raw_sig, opcode_t * const raw_args)>
Take a raw signature and argument list from a set_args opcode and
-convert it to a CallSignature PMC.
+convert it to a CallContext PMC.
=cut
@@ -576,12 +576,12 @@
INTVAL arg_index;
if (PMC_IS_NULL(signature))
- call_object = pmc_new(interp, enum_class_CallSignature);
+ call_object = pmc_new(interp, enum_class_CallContext);
else
call_object = signature;
/* this macro is much, much faster than the VTABLE STRING comparisons */
- SETATTR_CallSignature_arg_flags(interp, call_object, raw_sig);
+ SETATTR_CallContext_arg_flags(interp, call_object, raw_sig);
GETATTR_FixedIntegerArray_size(interp, raw_sig, arg_count);
GETATTR_FixedIntegerArray_int_array(interp, raw_sig, int_array);
@@ -667,7 +667,7 @@
STRING *name, PMC * const raw_sig, opcode_t * const raw_args, INTVAL arg_index)>
Pulls in the next argument from a set_args opcode, and sets it as the
-value of a named argument in the CallSignature PMC.
+value of a named argument in the CallContext PMC.
=cut
@@ -731,7 +731,7 @@
*aggregate)>
Takes an aggregate PMC and splits it up into individual arguments,
-adding each one to the CallSignature PMC. If the aggregate is an array,
+adding each one to the CallContext PMC. If the aggregate is an array,
its elements are added as positional arguments. If the aggregate is a
hash, its key/value pairs are added as named arguments.
@@ -782,7 +782,7 @@
*signature, PMC *raw_sig, opcode_t *raw_args)>
Take a raw signature and argument list from a set_results opcode and
-convert it to a CallSignature PMC. Uses an existing CallSignature PMC if
+convert it to a CallContext PMC. Uses an existing CallContext PMC if
one was already created for set_args. Otherwise, creates a new one.
=cut
@@ -805,7 +805,7 @@
INTVAL arg_count;
if (PMC_IS_NULL(signature))
- call_object = pmc_new(interp, enum_class_CallSignature);
+ call_object = pmc_new(interp, enum_class_CallContext);
/* A hack to support 'get_results' as the way of fetching the
* exception object inside an exception handler. The first argument
* in the call object is the exception, stick it directly into the
@@ -820,7 +820,7 @@
call_object = signature;
/* a little encapsulation violation for great speed */
- SETATTR_CallSignature_return_flags(interp, call_object, raw_sig);
+ SETATTR_CallContext_return_flags(interp, call_object, raw_sig);
GETATTR_FixedIntegerArray_size(interp, raw_sig, arg_count);
GETATTR_FixedIntegerArray_int_array(interp, raw_sig, int_array);
@@ -871,7 +871,7 @@
=item C<PMC* Parrot_pcc_build_sig_object_from_varargs(PARROT_INTERP, PMC *obj,
const char *sig, va_list args)>
-Converts a varargs list into a CallSignature PMC. The CallSignature stores the
+Converts a varargs list into a CallContext PMC. The CallContext stores the
original short signature string and an array of integer types to pass on to the
multiple dispatch search.
@@ -890,7 +890,7 @@
PMC *type_tuple = PMCNULL;
PMC *arg_flags = PMCNULL;
PMC *return_flags = PMCNULL;
- PMC * const call_object = pmc_new(interp, enum_class_CallSignature);
+ PMC * const call_object = pmc_new(interp, enum_class_CallContext);
const INTVAL sig_len = strlen(sig);
INTVAL in_return_sig = 0;
INTVAL i;
@@ -1237,7 +1237,7 @@
if (arg_index < positional_args) {
PMC *arg_sig;
- GETATTR_CallSignature_arg_flags(interp, call_object, arg_sig);
+ GETATTR_CallContext_arg_flags(interp, call_object, arg_sig);
/* We've used up all the positional parameters, but have extra
* positional args left over. */
@@ -1378,7 +1378,7 @@
PMC *named_arg_list;
Hash *h;
/* Early exit to avoid vtable call */
- GETATTR_CallSignature_hash(interp, call_object, h);
+ GETATTR_CallContext_hash(interp, call_object, h);
if (!h || !h->entries)
return;
@@ -1632,7 +1632,7 @@
return;
}
- GETATTR_CallSignature_return_flags(interp, call_object, result_sig);
+ GETATTR_CallContext_return_flags(interp, call_object, result_sig);
result_count = csr_returns_count(interp, call_object);
PARROT_ASSERT((result_count == 0) || !PMC_IS_NULL(result_sig));
@@ -2422,14 +2422,14 @@
if (PMC_IS_NULL(parent) || PMC_IS_NULL(tailcall) || (parent == tailcall))
return;
else {
- /* Broke encapuslation. Direct poking into CallSignature is much faster */
+ /* Broke encapuslation. Direct poking into CallContext is much faster */
void ** returns_values;
void ** tailcall_returns_values;
INTVAL returns_size;
PMC * return_flags;
- GETATTR_CallSignature_returns_size(interp, parent, returns_size);
- GETATTR_CallSignature_returns_values(interp, parent, returns_values);
+ GETATTR_CallContext_returns_size(interp, parent, returns_size);
+ GETATTR_CallContext_returns_values(interp, parent, returns_values);
/* Resize tailcall.returns_values to new size */
tailcall_returns_values = csr_reallocate_return_values(interp, tailcall, returns_size);
@@ -2438,8 +2438,8 @@
mem_copy_n_typed(tailcall_returns_values, returns_values, returns_size, void**);
/* Store raw signature */
- GETATTR_CallSignature_return_flags(interp, parent, return_flags);
- SETATTR_CallSignature_return_flags(interp, tailcall, return_flags);
+ GETATTR_CallContext_return_flags(interp, parent, return_flags);
+ SETATTR_CallContext_return_flags(interp, tailcall, return_flags);
}
}
@@ -2828,7 +2828,7 @@
/*
-VTABLE functions from CallSignatureReturns. TODO Rename them appropriately.
+VTABLE functions from CallContextReturns. TODO Rename them appropriately.
*/
@@ -2856,8 +2856,8 @@
void **values = NULL;
INTVAL resize_threshold;
- GETATTR_CallSignature_returns_values(interp, self, values);
- GETATTR_CallSignature_returns_resize_threshold(interp, self, resize_threshold);
+ GETATTR_CallContext_returns_values(interp, self, values);
+ GETATTR_CallContext_returns_resize_threshold(interp, self, resize_threshold);
/* Empty. Allocate 8 elements (arbitary number) */
if (!values) {
@@ -2868,12 +2868,12 @@
values = (void **)Parrot_gc_allocate_fixed_size_storage(interp,
8 * sizeof (void *));
- SETATTR_CallSignature_returns_values(interp, self, values);
- SETATTR_CallSignature_returns_size(interp, self, size);
- SETATTR_CallSignature_returns_resize_threshold(interp, self, 8);
+ SETATTR_CallContext_returns_values(interp, self, values);
+ SETATTR_CallContext_returns_size(interp, self, size);
+ SETATTR_CallContext_returns_resize_threshold(interp, self, 8);
}
else if (size <= resize_threshold) {
- SETATTR_CallSignature_returns_size(interp, self, size);
+ SETATTR_CallContext_returns_size(interp, self, size);
}
else {
void *old_values;
@@ -2898,9 +2898,9 @@
mem_realloc_n_typed(values, cur, void *);
- SETATTR_CallSignature_returns_values(interp, self, values);
- SETATTR_CallSignature_returns_size(interp, self, size);
- SETATTR_CallSignature_returns_resize_threshold(interp, self, cur);
+ SETATTR_CallContext_returns_values(interp, self, values);
+ SETATTR_CallContext_returns_size(interp, self, size);
+ SETATTR_CallContext_returns_resize_threshold(interp, self, cur);
}
return values;
@@ -2921,7 +2921,7 @@
{
ASSERT_ARGS(csr_returns_count)
INTVAL size;
- GETATTR_CallSignature_returns_size(interp, self, size);
+ GETATTR_CallContext_returns_size(interp, self, size);
return size;
}
@@ -2949,7 +2949,7 @@
PARROT_ASSERT((type >= 0 && type < 4) || !"Wrong pointer type");
- GETATTR_CallSignature_returns_size(interp, self, size);
+ GETATTR_CallContext_returns_size(interp, self, size);
values = csr_reallocate_return_values(interp, self, size + 1);
/* Tag pointer */
@@ -3121,10 +3121,10 @@
void **values;
INTVAL size;
- GETATTR_CallSignature_returns_size(interp, self, size);
+ GETATTR_CallContext_returns_size(interp, self, size);
PARROT_ASSERT((key < size) || !"Wrong index");
- GETATTR_CallSignature_returns_values(interp, self, values);
+ GETATTR_CallContext_returns_values(interp, self, values);
return values[key];
}
Modified: trunk/src/call/context.c
==============================================================================
--- trunk/src/call/context.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/call/context.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -17,7 +17,7 @@
#include "parrot/parrot.h"
#include "parrot/call.h"
#include "pmc/pmc_sub.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/*
@@ -306,6 +306,15 @@
? NULL
: get_context_struct_fast(interp, pmcold);
+ PARROT_ASSERT(!PMC_IS_NULL(pmcctx) || !"Can't initialise Null CallContext");
+
+ /*
+ * FIXME Invoking corotine shouldn't initialise context. So just
+ * check ctx->current_sub. If it's not null return from here
+ */
+ if (!PMC_IS_NULL(ctx->current_sub))
+ return;
+
ctx->current_results = NULL;
ctx->results_signature = NULL;
ctx->lex_pad = PMCNULL;
@@ -454,7 +463,7 @@
allocate_registers(PARROT_INTERP, ARGIN(PMC *pmcctx), ARGIN(const INTVAL *number_regs_used))
{
ASSERT_ARGS(allocate_registers)
- Parrot_Context_attributes *ctx = PARROT_CONTEXT(pmcctx);
+ Parrot_CallContext_attributes *ctx = PARROT_CALLCONTEXT(pmcctx);
const size_t size_i = sizeof (INTVAL) * number_regs_used[REGNO_INT];
const size_t size_n = sizeof (FLOATVAL) * number_regs_used[REGNO_NUM];
@@ -480,6 +489,8 @@
/* ctx.bp_ps points to S0, which has Px on the left */
ctx->bp_ps.regs_s = (STRING **)((char *)ctx->registers + size_nip);
+
+ clear_regs(interp, pmcctx);
}
@@ -517,7 +528,7 @@
Parrot_pcc_free_registers(PARROT_INTERP, ARGIN(PMC *pmcctx))
{
ASSERT_ARGS(Parrot_pcc_free_registers)
- Parrot_Context_attributes * const ctx = PARROT_CONTEXT(pmcctx);
+ Parrot_CallContext_attributes * const ctx = PARROT_CALLCONTEXT(pmcctx);
size_t reg_size;
if (!ctx)
@@ -543,6 +554,8 @@
the init flag to indicate whether you want to initialize the new context
(setting its default values and clearing its registers).
+TODO: Remove this function!
+
=cut
*/
@@ -554,7 +567,7 @@
ARGIN_NULLOK(PMC *old))
{
ASSERT_ARGS(Parrot_alloc_context)
- PMC *pmcctx = pmc_new(interp, enum_class_Context);
+ PMC *pmcctx = pmc_new(interp, enum_class_CallContext);
allocate_registers(interp, pmcctx, number_regs_used);
init_context(interp, pmcctx, old);
@@ -565,6 +578,51 @@
/*
+=item C<PMC * Parrot_pcc_allocate_empty_context(PARROT_INTERP, PMC *old)>
+
+Allocates and returns a new context. Does not set this new context as the
+current context.
+
+=cut
+
+*/
+
+PARROT_CANNOT_RETURN_NULL
+PARROT_WARN_UNUSED_RESULT
+PMC *
+Parrot_pcc_allocate_empty_context(PARROT_INTERP, ARGIN_NULLOK(PMC *old))
+{
+ ASSERT_ARGS(Parrot_pcc_allocate_empty_context)
+ PMC *pmcctx = pmc_new(interp, enum_class_CallContext);
+
+ init_context(interp, pmcctx, old);
+
+ return pmcctx;
+}
+
+/*
+
+=item C<PMC * Parrot_pcc_init_context(PARROT_INTERP, PMC *ctx, PMC *old)>
+
+Initialise new context from old.
+
+=cut
+
+*/
+
+PARROT_CANNOT_RETURN_NULL
+PMC *
+Parrot_pcc_init_context(PARROT_INTERP, ARGIN(PMC *ctx), ARGIN_NULLOK(PMC *old))
+{
+ ASSERT_ARGS(Parrot_pcc_init_context)
+
+ init_context(interp, ctx, old);
+
+ return ctx;
+}
+
+/*
+
=item C<PMC * Parrot_set_new_context(PARROT_INTERP, const INTVAL
*number_regs_used)>
Modified: trunk/src/call/context_accessors.c
==============================================================================
--- trunk/src/call/context_accessors.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/call/context_accessors.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -16,7 +16,7 @@
#include "parrot/parrot.h"
#include "parrot/call.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/context.h */
Modified: trunk/src/call/pcc.c
==============================================================================
--- trunk/src/call/pcc.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/call/pcc.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -25,7 +25,7 @@
#include "pcc.str"
#include "pmc/pmc_key.h"
#include "pmc/pmc_continuation.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/call.h */
Modified: trunk/src/debug.c
==============================================================================
--- trunk/src/debug.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/debug.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -32,7 +32,7 @@
#include "parrot/runcore_trace.h"
#include "debug.str"
#include "pmc/pmc_continuation.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* Hand switched debugger tracing
* Set to 1 to enable tracing to stderr
Modified: trunk/src/dynext.c
==============================================================================
--- trunk/src/dynext.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/dynext.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -22,7 +22,7 @@
#include "parrot/dynext.h"
#include "dynext.str"
#include "pmc/pmc_parrotlibrary.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/dynext.h */
Modified: trunk/src/embed.c
==============================================================================
--- trunk/src/embed.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/embed.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -22,7 +22,7 @@
#include "parrot/embed.h"
#include "parrot/oplib/ops.h"
#include "pmc/pmc_sub.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "parrot/runcore_api.h"
#include "../compilers/imcc/imc.h"
Modified: trunk/src/exceptions.c
==============================================================================
--- trunk/src/exceptions.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/exceptions.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -23,7 +23,7 @@
#include "parrot/exceptions.h"
#include "exceptions.str"
#include "pmc/pmc_continuation.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/exceptions.h */
Modified: trunk/src/extend.c
==============================================================================
--- trunk/src/extend.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/extend.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -61,7 +61,7 @@
#include "parrot/parrot.h"
#include "parrot/extend.h"
#include "pmc/pmc_sub.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/extend.h */
Modified: trunk/src/global.c
==============================================================================
--- trunk/src/global.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/global.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -21,7 +21,7 @@
#include "parrot/parrot.h"
#include "global.str"
#include "pmc/pmc_sub.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/global.h */
/* HEADERIZER BEGIN: static */
Modified: trunk/src/global_setup.c
==============================================================================
--- trunk/src/global_setup.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/global_setup.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -23,7 +23,7 @@
#define INSIDE_GLOBAL_SETUP
#include "parrot/parrot.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "global_setup.str"
/* These functions are defined in the auto-generated file core_pmcs.c */
Modified: trunk/src/hll.c
==============================================================================
--- trunk/src/hll.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/hll.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -31,7 +31,7 @@
#include "parrot/parrot.h"
#include "parrot/dynext.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "hll.str"
/* HEADERIZER HFILE: include/parrot/hll.h */
Modified: trunk/src/interp/inter_create.c
==============================================================================
--- trunk/src/interp/inter_create.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/interp/inter_create.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -23,7 +23,7 @@
#include "parrot/runcore_api.h"
#include "parrot/oplib/core_ops.h"
#include "../compilers/imcc/imc.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "inter_create.str"
/* HEADERIZER HFILE: include/parrot/interpreter.h */
Modified: trunk/src/interp/inter_misc.c
==============================================================================
--- trunk/src/interp/inter_misc.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/interp/inter_misc.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -23,7 +23,7 @@
#include "inter_misc.str"
#include "../compilers/imcc/imc.h"
#include "parrot/runcore_api.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "parrot/has_header.h"
Modified: trunk/src/key.c
==============================================================================
--- trunk/src/key.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/key.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -22,7 +22,7 @@
#include "parrot/key.h"
#include "key.str"
#include "pmc/pmc_key.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/key.h */
Modified: trunk/src/multidispatch.c
==============================================================================
--- trunk/src/multidispatch.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/multidispatch.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -44,7 +44,7 @@
#include "multidispatch.str"
#include "pmc/pmc_nci.h"
#include "pmc/pmc_sub.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/multidispatch.h */
Modified: trunk/src/oo.c
==============================================================================
--- trunk/src/oo.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/oo.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -24,7 +24,7 @@
#include "parrot/oo_private.h"
#include "pmc/pmc_class.h"
#include "pmc/pmc_object.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "oo.str"
Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/packfile.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -33,7 +33,7 @@
#include "packfile.str"
#include "pmc/pmc_sub.h"
#include "pmc/pmc_key.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/packfile.h */
Modified: trunk/src/pmc.c
==============================================================================
--- trunk/src/pmc.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/pmc.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -21,7 +21,7 @@
#include "parrot/parrot.h"
#include "pmc.str"
#include "pmc/pmc_class.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/pmc.h */
Copied and modified: trunk/src/pmc/callcontext.pmc (from r43174, trunk/src/pmc/callsignature.pmc)
==============================================================================
--- trunk/src/pmc/callsignature.pmc Sun Dec 20 09:49:36 2009 (r43174, copy source)
+++ trunk/src/pmc/callcontext.pmc Sun Dec 20 12:30:38 2009 (r43175)
@@ -4,11 +4,11 @@
=head1 NAME
-src/pmc/callsignature.pmc - CallSignature PMC
+src/pmc/callcontext.pmc - CallContext PMC
=head1 DESCRIPTION
-The CallSignature PMC is used to store the argument list and argument meta
+The CallContext PMC is used to store the argument list and argument meta
information for a multiple dispatch call.
=head2 Functions
@@ -81,9 +81,9 @@
do { \
INTVAL num_positionals; \
Pcc_cell *positionals; \
- GETATTR_CallSignature_num_positionals((i), (obj), num_positionals); \
- GETATTR_CallSignature_positionals((i), (obj), positionals); \
- SETATTR_CallSignature_num_positionals((i), (obj), num_positionals+1); \
+ GETATTR_CallContext_num_positionals((i), (obj), num_positionals); \
+ GETATTR_CallContext_positionals((i), (obj), positionals); \
+ SETATTR_CallContext_num_positionals((i), (obj), num_positionals+1); \
NEXT_CELL(cell) = NULL; \
if (positionals) { \
while (NEXT_CELL(positionals)) { \
@@ -92,18 +92,18 @@
NEXT_CELL(positionals) = (cell); \
} \
else \
- SETATTR_CallSignature_positionals((i), (obj), (cell)); \
+ SETATTR_CallContext_positionals((i), (obj), (cell)); \
} while (0)
#define PREPEND_CELL(i, obj, cell) \
do { \
INTVAL num_positionals; \
Pcc_cell *positionals; \
- GETATTR_CallSignature_num_positionals((i), (obj), num_positionals); \
- GETATTR_CallSignature_positionals((i), (obj), positionals); \
- SETATTR_CallSignature_num_positionals((i), (obj), num_positionals+1); \
+ GETATTR_CallContext_num_positionals((i), (obj), num_positionals); \
+ GETATTR_CallContext_positionals((i), (obj), positionals); \
+ SETATTR_CallContext_num_positionals((i), (obj), num_positionals+1); \
NEXT_CELL(cell) = positionals; \
- SETATTR_CallSignature_positionals((i), (obj), (cell)); \
+ SETATTR_CallContext_positionals((i), (obj), (cell)); \
} while (0)
#define HLL_TYPE(i) Parrot_get_ctx_HLL_type(interp, (i))
@@ -116,18 +116,18 @@
Pcc_cell *cell;
Pcc_cell *prev = NULL;
- GETATTR_CallSignature_positionals(interp, SELF, cell);
+ GETATTR_CallContext_positionals(interp, SELF, cell);
/* no cells */
if (!cell)
return NULL;
- GETATTR_CallSignature_num_positionals(interp, SELF, num_positionals);
- SETATTR_CallSignature_num_positionals(interp, SELF, num_positionals-1);
+ GETATTR_CallContext_num_positionals(interp, SELF, num_positionals);
+ SETATTR_CallContext_num_positionals(interp, SELF, num_positionals-1);
/* one cell */
if (!NEXT_CELL(cell)) {
- SETATTR_CallSignature_positionals(interp, SELF, NULL);
+ SETATTR_CallContext_positionals(interp, SELF, NULL);
return cell;
}
@@ -142,7 +142,7 @@
}
/* should abort here */
- SETATTR_CallSignature_num_positionals(interp, SELF, num_positionals+1);
+ SETATTR_CallContext_num_positionals(interp, SELF, num_positionals+1);
return NULL;
}
@@ -152,20 +152,20 @@
INTVAL num_positionals;
Pcc_cell *cell;
- GETATTR_CallSignature_positionals(interp, SELF, cell);
+ GETATTR_CallContext_positionals(interp, SELF, cell);
/* no cells */
if (!cell)
return NULL;
- GETATTR_CallSignature_num_positionals(interp, SELF, num_positionals);
- SETATTR_CallSignature_num_positionals(interp, SELF, num_positionals-1);
+ GETATTR_CallContext_num_positionals(interp, SELF, num_positionals);
+ SETATTR_CallContext_num_positionals(interp, SELF, num_positionals-1);
/* one cell */
if (!NEXT_CELL(cell))
- SETATTR_CallSignature_positionals(interp, SELF, NULL);
+ SETATTR_CallContext_positionals(interp, SELF, NULL);
else
- SETATTR_CallSignature_positionals(interp, SELF, NEXT_CELL(cell));
+ SETATTR_CallContext_positionals(interp, SELF, NEXT_CELL(cell));
return cell;
}
@@ -176,12 +176,12 @@
INTVAL i, num_positionals;
Pcc_cell *cell;
- GETATTR_CallSignature_num_positionals(interp, SELF, num_positionals);
+ GETATTR_CallContext_num_positionals(interp, SELF, num_positionals);
if (key > num_positionals)
return NULL;
- GETATTR_CallSignature_positionals(interp, SELF, cell);
+ GETATTR_CallContext_positionals(interp, SELF, cell);
while (key) {
/* XXX: shouldn't happen */
@@ -295,7 +295,7 @@
{
Hash *hash;
- GETATTR_CallSignature_hash(interp, SELF, hash);
+ GETATTR_CallContext_hash(interp, SELF, hash);
if (!hash) {
hash = parrot_create_hash(interp,
@@ -304,7 +304,7 @@
STRING_compare,
(hash_hash_key_fn)key_hash_STRING);
- SETATTR_CallSignature_hash(interp, SELF, hash);
+ SETATTR_CallContext_hash(interp, SELF, hash);
}
return hash;
@@ -358,7 +358,7 @@
Hash *hash;
PMC *result = PMCNULL;
- GETATTR_CallSignature_hash(interp, SELF, hash);
+ GETATTR_CallContext_hash(interp, SELF, hash);
/* yes, this *looks* risky, but it's a Parrot STRING hash internally */
if (hash && hash->entries) {
@@ -380,7 +380,50 @@
return result;
}
-pmclass CallSignature provides array provides hash auto_attrs {
+#include "parrot/packfile.h"
+#include "pmc/pmc_sub.h"
+
+pmclass CallContext provides array provides hash auto_attrs {
+ /* Context attributes */
+ ATTR PMC *caller_ctx; /* caller context */
+
+ ATTR void *registers; /* pointer to allocated registers */
+ ATTR Regs_ni bp; /* pointers to FLOATVAL & INTVAL */
+ ATTR Regs_ps bp_ps; /* pointers to PMC & STR */
+
+ ATTR UINTVAL n_regs_used[4]; /* INSP in PBC points to Sub */
+ ATTR PMC *lex_pad; /* LexPad PMC */
+ ATTR PMC *outer_ctx; /* outer context, if a closure */
+
+ /* new call scheme and introspective variables */
+ ATTR PMC *current_sub; /* the Sub we are executing */
+
+ /* for now use a return continuation PMC */
+ ATTR PMC *handlers; /* local handlers for the context */
+ ATTR PMC *current_cont; /* the return continuation PMC */
+ ATTR PMC *current_object; /* current object if a method call */
+ ATTR PMC *current_namespace; /* The namespace we're currently in */
+ ATTR PMC *results_signature; /* non-const results signature PMC */
+ ATTR opcode_t *current_pc; /* program counter of Sub invocation */
+ ATTR opcode_t *current_results; /* ptr into code with get_results opcode */
+ ATTR PMC *current_sig; /* temporary CallContext PMC for active call */
+
+ /* deref the constants - we need it all the time */
+ ATTR struct PackFile_Constant **constants;
+
+ ATTR INTVAL current_HLL; /* see also src/hll.c */
+
+ ATTR UINTVAL warns; /* Keeps track of what warnings
+ * have been activated */
+ ATTR UINTVAL errors; /* fatals that can be turned off */
+ ATTR UINTVAL trace_flags;
+ ATTR UINTVAL recursion_depth; /* Sub call recursion depth */
+
+ /* code->prederefed.code - code->base.data in opcodes
+ * to simplify conversion between code ptrs in e.g. invoke */
+ ATTR size_t pred_offset;
+
+ /* Storage for arguments */
ATTR struct Pcc_cell *positionals; /* linked list of positionals */
ATTR PMC *type_tuple; /* Cached argument types for MDD */
ATTR STRING *short_sig; /* Simple string sig args & returns */
@@ -397,7 +440,7 @@
=item C<void init()>
-Initializes a newly created CallSignature object.
+Initializes a newly created CallContext object.
=cut
@@ -430,7 +473,10 @@
STRING *short_sig;
Pcc_cell *positionals;
INTVAL num_positionals;
- PMC *arg_flags, *type_tuple, *return_flags;
+ PMC *arg_flags, *type_tuple, *return_flags, *tmp;
+ UINTVAL i;
+ UINTVAL *n_regs_used;
+ Regs_ps bp_ps;
if (!PMC_data(SELF))
return;
@@ -453,6 +499,55 @@
if (hash)
mark_hash(INTERP, hash);
+
+ GET_ATTR_caller_ctx(INTERP, SELF, tmp);
+ Parrot_gc_mark_PMC_alive(INTERP, tmp);
+
+ GET_ATTR_lex_pad(INTERP, SELF, tmp);
+ Parrot_gc_mark_PMC_alive(INTERP, tmp);
+
+ GET_ATTR_outer_ctx(INTERP, SELF, tmp);
+ Parrot_gc_mark_PMC_alive(INTERP, tmp);
+
+ GET_ATTR_current_sub(INTERP, SELF, tmp);
+ Parrot_gc_mark_PMC_alive(INTERP, tmp);
+
+ GET_ATTR_handlers(INTERP, SELF, tmp);
+ Parrot_gc_mark_PMC_alive(INTERP, tmp);
+
+ GET_ATTR_current_cont(INTERP, SELF, tmp);
+ Parrot_gc_mark_PMC_alive(INTERP, tmp);
+
+ GET_ATTR_current_object(INTERP, SELF, tmp);
+ Parrot_gc_mark_PMC_alive(INTERP, tmp);
+
+ GET_ATTR_current_namespace(INTERP, SELF, tmp);
+ Parrot_gc_mark_PMC_alive(INTERP, tmp);
+
+ GET_ATTR_results_signature(INTERP, SELF, tmp);
+ Parrot_gc_mark_PMC_alive(INTERP, tmp);
+
+ GET_ATTR_current_sig(INTERP, SELF, tmp);
+ Parrot_gc_mark_PMC_alive(INTERP, tmp);
+
+ GET_ATTR_n_regs_used(INTERP, SELF, n_regs_used);
+ if (!n_regs_used)
+ return;
+
+ GET_ATTR_bp_ps(INTERP, SELF, bp_ps);
+ for (i = 0; i < n_regs_used[REGNO_PMC]; ++i) {
+ PMC *p = bp_ps.regs_p[-1L-(i)];
+ /* Original code from CTX_REG_PMC */
+ if (p)
+ Parrot_gc_mark_PMC_alive(interp, p);
+ }
+
+ for (i = 0; i < n_regs_used[REGNO_STR]; ++i) {
+ STRING *s = bp_ps.regs_s[i];
+ if (s)
+ Parrot_gc_mark_STRING_alive(interp, s);
+ }
+
}
VTABLE void destroy() {
@@ -503,13 +598,15 @@
else
mem_sys_free(returns_values);
}
+
+ Parrot_pcc_free_registers(INTERP, SELF);
}
/*
=item C<void set_string_native(STRING *value)>
-Sets the short signature for the CallSignature.
+Sets the short signature for the CallContext.
=cut
@@ -523,7 +620,7 @@
=item C<STRING *get_string()>
-Returns the short signature for the CallSignature.
+Returns the short signature for the CallContext.
=cut
@@ -576,7 +673,7 @@
=item C<void set_pmc(PMC *value)>
-Sets a fixed-size array of integer types (a type tuple) for the CallSignature.
+Sets a fixed-size array of integer types (a type tuple) for the CallContext.
=cut
@@ -591,7 +688,7 @@
=item C<PMC *get_pmc()>
Returns a fixed-size array of integer types (a type tuple) for the
-CallSignature.
+CallContext.
=cut
@@ -680,6 +777,38 @@
Retrieves the hash of named arguments.
+=item caller_ctx
+
+return Caller Context
+
+=item lex_pad
+
+return LexPad
+
+=item outer_ctx
+
+return Outer Context
+
+=item current_sub
+
+return current Sub
+
+=item handlers
+
+return list of ExceptioHandlers
+
+=item current_cont
+
+return current Continuation
+
+=item current_object
+
+return current Object (if in method call)
+
+=item current_namespace
+
+return current Namespace
+
=back
=cut
@@ -687,16 +816,42 @@
*/
VTABLE PMC *get_attr_str(STRING *key) {
- PMC *value = PMCNULL;
+ PMC *value = PMCNULL;
+ INTVAL hll;
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "named"))) {
+ if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "named")))
value = get_named_names(INTERP, SELF);
- }
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags"))) {
+ else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags")))
GET_ATTR_arg_flags(INTERP, SELF, value);
- }
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "return_flags"))) {
+ else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "return_flags")))
GET_ATTR_return_flags(INTERP, SELF, value);
+ else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "caller_ctx")))
+ GET_ATTR_caller_ctx(INTERP, SELF, value);
+ else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "lex_pad")))
+ GET_ATTR_lex_pad(INTERP, SELF, value);
+ else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "outer_ctx")))
+ GET_ATTR_outer_ctx(INTERP, SELF, value);
+ else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_sub")))
+ GET_ATTR_current_sub(INTERP, SELF, value);
+ else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_cont")))
+ GET_ATTR_current_cont(INTERP, SELF, value);
+ else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_object")))
+ GET_ATTR_current_object(INTERP, SELF, value);
+ else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_namespace")))
+ GET_ATTR_current_namespace(INTERP, SELF, value);
+ else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "handlers")))
+ GET_ATTR_handlers(INTERP, SELF, value);
+ else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "results_signature")))
+ GET_ATTR_results_signature(INTERP, SELF, value);
+ else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_HLL"))) {
+ /* This function from src/hash.c. */
+ /* We probably have to move it to more suitable place */
+ GET_ATTR_current_HLL(INTERP, SELF, hll);
+ value = get_integer_pmc(INTERP, hll);
+ }
+ else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_hll"))) {
+ GET_ATTR_current_HLL(INTERP, SELF, hll);
+ value = get_string_pmc(INTERP, Parrot_get_HLL_name(INTERP, hll));
}
else {
/* If unknown attribute name, throw an exception. */
@@ -1318,6 +1473,69 @@
return dest;
}
+
+/*
+
+=item C<PMC *backtrace>
+
+Gets a representation of the backtrace starting from this Context.
+Returns an array of hashes. Each array element represents a caller in
+the backtrace, the most recent caller first. The hash has two keys: C<sub>,
+which holds the PMC representing the sub, and C<annotations> which is a hash
+of the annotations at the point where the exception was thrown for the current
+sub, or for the point of the call a level deeper for the rest.
+
+=cut
+
+*/
+
+ METHOD backtrace(PMC *resume :optional, INTVAL has_resume :opt_flag) {
+ PMC *result = pmc_new(interp, enum_class_ResizablePMCArray);
+ PMC *cur_ctx = SELF;
+ Parrot_Continuation_attributes *cont = has_resume ? PMC_cont(resume) : NULL;
+
+ /* Get starting context, then loop over them. */
+ while (cur_ctx) {
+ PMC *frame = pmc_new(interp, enum_class_Hash);
+ PMC *annotations = NULL;
+ Parrot_Sub_attributes *sub;
+
+ /* Get sub and put it in the hash. */
+ PMC *sub_pmc = Parrot_pcc_get_sub(interp, cur_ctx);
+
+ if (!sub_pmc)
+ sub_pmc = PMCNULL;
+
+ VTABLE_set_pmc_keyed_str(interp, frame, CONST_STRING(interp, "sub"), sub_pmc);
+
+ /* Look up any annotations and put them in the hash. */
+ if (!PMC_IS_NULL(sub_pmc)) {
+ PMC_get_sub(interp, sub_pmc, sub);
+
+ if (sub->seg->annotations) {
+ PackFile_ByteCode *seg = sub->seg;
+ opcode_t *pc = cont && cur_ctx == cont->to_ctx
+ ? cont->address
+ : Parrot_pcc_get_pc(interp, cur_ctx);
+
+ annotations = PackFile_Annotations_lookup(interp,
+ seg->annotations, pc - seg->base.data,
+ NULL);
+ }
+ }
+
+ if (!annotations)
+ annotations = pmc_new(interp, enum_class_Hash);
+
+ VTABLE_set_pmc_keyed_str(interp, frame, CONST_STRING(interp, "annotations"), annotations);
+
+ /* Push frame and go to next caller. */
+ VTABLE_push_pmc(interp, result, frame);
+ cur_ctx = Parrot_pcc_get_caller_ctx(interp, cur_ctx);
+ }
+
+ RETURN(PMC *result);
+ }
/*
=back
Deleted: trunk/src/pmc/callsignature.pmc
==============================================================================
--- trunk/src/pmc/callsignature.pmc Sun Dec 20 12:30:38 2009 (r43174)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,1336 +0,0 @@
-/*
-Copyright (C) 2008-2009, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/callsignature.pmc - CallSignature PMC
-
-=head1 DESCRIPTION
-
-The CallSignature PMC is used to store the argument list and argument meta
-information for a multiple dispatch call.
-
-=head2 Functions
-
-=over 4
-
-=cut
-
-*/
-
-typedef struct Pcc_cell
-{
- union u {
- PMC *p;
- STRING *s;
- INTVAL i;
- FLOATVAL n;
- } u;
- struct Pcc_cell *next;
-} Pcc_cell;
-
-/* mask off lower two bits (1 + 2 = 3) for pointer tags */
-#define TAG_BITS 3
-#define UNTAG_CELL(c) INTVAL2PTR(Pcc_cell *, (PTR2INTVAL(c)) & ~TAG_BITS)
-
-#define CELL_INT(c) UNTAG_CELL(c)->u.i
-#define CELL_FLOAT(c) UNTAG_CELL(c)->u.n
-#define CELL_STRING(c) UNTAG_CELL(c)->u.s
-#define CELL_PMC(c) UNTAG_CELL(c)->u.p
-
-#define NEXT_CELL(c) UNTAG_CELL(c)->next
-#define FREE_CELL(i, c) \
- Parrot_gc_free_fixed_size_storage((i), sizeof (Pcc_cell), (UNTAG_CELL(c)))
-
-#define CELL_TYPE_MASK(c) (PTR2INTVAL(c)) & 3
-#define INTCELL 0
-#define FLOATCELL 1
-#define STRINGCELL 2
-#define PMCCELL 3
-
-#define SET_CELL_INT(c) \
- INTVAL2PTR(Pcc_cell *, PTR2INTVAL(UNTAG_CELL(c)) | INTCELL)
-
-#define SET_CELL_FLOAT(c) \
- INTVAL2PTR(Pcc_cell *, PTR2INTVAL(UNTAG_CELL(c)) | FLOATCELL)
-
-#define SET_CELL_STRING(c) \
- INTVAL2PTR(Pcc_cell *, PTR2INTVAL(UNTAG_CELL(c)) | STRINGCELL)
-
-#define SET_CELL_PMC(c) \
- INTVAL2PTR(Pcc_cell *, PTR2INTVAL(UNTAG_CELL(c)) | PMCCELL)
-
-#define ALLOC_CELL(i) \
- (Pcc_cell *)Parrot_gc_allocate_fixed_size_storage((i), sizeof (Pcc_cell))
-
-#define INIT_CELL_INT(c) INTVAL2PTR(Pcc_cell *, PTR2INTVAL(c) | INTCELL)
-#define INIT_CELL_FLOAT(c) INTVAL2PTR(Pcc_cell *, PTR2INTVAL(c) | FLOATCELL)
-#define INIT_CELL_STRING(c) INTVAL2PTR(Pcc_cell *, PTR2INTVAL(c) | STRINGCELL)
-#define INIT_CELL_PMC(c) INTVAL2PTR(Pcc_cell *, PTR2INTVAL(c) | PMCCELL)
-
-#define CREATE_INTVAL_CELL(i) INIT_CELL_INT(ALLOC_CELL(i))
-
-#define CREATE_FLOATVAL_CELL(i) INIT_CELL_FLOAT(ALLOC_CELL(i))
-
-#define CREATE_STRING_CELL(i) INIT_CELL_STRING(ALLOC_CELL(i))
-
-#define CREATE_PMC_CELL(i) INIT_CELL_PMC(ALLOC_CELL(i))
-
-#define APPEND_CELL(i, obj, cell) \
- do { \
- INTVAL num_positionals; \
- Pcc_cell *positionals; \
- GETATTR_CallSignature_num_positionals((i), (obj), num_positionals); \
- GETATTR_CallSignature_positionals((i), (obj), positionals); \
- SETATTR_CallSignature_num_positionals((i), (obj), num_positionals+1); \
- NEXT_CELL(cell) = NULL; \
- if (positionals) { \
- while (NEXT_CELL(positionals)) { \
- positionals = NEXT_CELL(positionals); \
- } \
- NEXT_CELL(positionals) = (cell); \
- } \
- else \
- SETATTR_CallSignature_positionals((i), (obj), (cell)); \
- } while (0)
-
-#define PREPEND_CELL(i, obj, cell) \
- do { \
- INTVAL num_positionals; \
- Pcc_cell *positionals; \
- GETATTR_CallSignature_num_positionals((i), (obj), num_positionals); \
- GETATTR_CallSignature_positionals((i), (obj), positionals); \
- SETATTR_CallSignature_num_positionals((i), (obj), num_positionals+1); \
- NEXT_CELL(cell) = positionals; \
- SETATTR_CallSignature_positionals((i), (obj), (cell)); \
- } while (0)
-
-#define HLL_TYPE(i) Parrot_get_ctx_HLL_type(interp, (i))
-
-/* TODO: could use get_cell_at */
-static Pcc_cell *
-pop_cell(PARROT_INTERP, ARGIN(PMC *SELF))
-{
- INTVAL num_positionals;
- Pcc_cell *cell;
- Pcc_cell *prev = NULL;
-
- GETATTR_CallSignature_positionals(interp, SELF, cell);
-
- /* no cells */
- if (!cell)
- return NULL;
-
- GETATTR_CallSignature_num_positionals(interp, SELF, num_positionals);
- SETATTR_CallSignature_num_positionals(interp, SELF, num_positionals-1);
-
- /* one cell */
- if (!NEXT_CELL(cell)) {
- SETATTR_CallSignature_positionals(interp, SELF, NULL);
- return cell;
- }
-
- while (cell) {
- if (!NEXT_CELL(cell)) {
- NEXT_CELL(prev) = NULL;
- return cell;
- }
-
- prev = cell;
- cell = NEXT_CELL(cell);
- }
-
- /* should abort here */
- SETATTR_CallSignature_num_positionals(interp, SELF, num_positionals+1);
- return NULL;
-}
-
-static Pcc_cell *
-shift_cell(PARROT_INTERP, ARGIN(PMC *SELF))
-{
- INTVAL num_positionals;
- Pcc_cell *cell;
-
- GETATTR_CallSignature_positionals(interp, SELF, cell);
-
- /* no cells */
- if (!cell)
- return NULL;
-
- GETATTR_CallSignature_num_positionals(interp, SELF, num_positionals);
- SETATTR_CallSignature_num_positionals(interp, SELF, num_positionals-1);
-
- /* one cell */
- if (!NEXT_CELL(cell))
- SETATTR_CallSignature_positionals(interp, SELF, NULL);
- else
- SETATTR_CallSignature_positionals(interp, SELF, NEXT_CELL(cell));
-
- return cell;
-}
-
-static Pcc_cell *
-get_cell_at(PARROT_INTERP, ARGIN(PMC *SELF), INTVAL key)
-{
- INTVAL i, num_positionals;
- Pcc_cell *cell;
-
- GETATTR_CallSignature_num_positionals(interp, SELF, num_positionals);
-
- if (key > num_positionals)
- return NULL;
-
- GETATTR_CallSignature_positionals(interp, SELF, cell);
-
- while (key) {
- /* XXX: shouldn't happen */
- if (!NEXT_CELL(cell))
- return NULL;
-
- cell = NEXT_CELL(cell);
- key--;
- }
-
- return cell;
-
-}
-
-static INTVAL
-autobox_intval(PARROT_INTERP, Pcc_cell *cell)
-{
- switch (CELL_TYPE_MASK(cell)) {
- case INTCELL:
- return CELL_INT(cell);
- case FLOATCELL:
- return (INTVAL)CELL_FLOAT(cell);
- case STRINGCELL:
- return CELL_STRING(cell) ? Parrot_str_to_int(interp, CELL_STRING(cell)) : 0;
- case PMCCELL:
- return PMC_IS_NULL(CELL_PMC(cell))
- ? 0
- : VTABLE_get_integer(interp, CELL_PMC(cell));
- default:
- break;
- }
-
- /* exception */
- return 0;
-}
-
-static FLOATVAL
-autobox_floatval(PARROT_INTERP, Pcc_cell *cell)
-{
- switch (CELL_TYPE_MASK(cell)) {
- case INTCELL:
- return (FLOATVAL)CELL_INT(cell);
- case FLOATCELL:
- return CELL_FLOAT(cell);
- case STRINGCELL:
- return CELL_STRING(cell) ? Parrot_str_to_num(interp, CELL_STRING(cell)) : 0.0;
- case PMCCELL:
- return PMC_IS_NULL(CELL_PMC(cell))
- ? 0.0
- : VTABLE_get_number(interp, CELL_PMC(cell));
- default:
- break;
- }
-
- /* exception */
- return 0.0;
-}
-
-static STRING *
-autobox_string(PARROT_INTERP, Pcc_cell *cell)
-{
- switch (CELL_TYPE_MASK(cell)) {
- case INTCELL:
- return Parrot_str_from_int(interp, CELL_INT(cell));
- case FLOATCELL:
- return Parrot_str_from_num(interp, CELL_FLOAT(cell));
- case STRINGCELL:
- return CELL_STRING(cell);
- case PMCCELL:
- return PMC_IS_NULL(CELL_PMC(cell))
- ? NULL
- : VTABLE_get_string(interp, CELL_PMC(cell));
- default:
- break;
- }
-
- /* exception */
- return NULL;
-}
-
-static PMC *
-autobox_pmc(PARROT_INTERP, Pcc_cell *cell)
-{
- PMC *result = PMCNULL;
-
- switch (CELL_TYPE_MASK(cell)) {
- case INTCELL:
- result = pmc_new(interp, HLL_TYPE(enum_class_Integer));
- VTABLE_set_integer_native(interp, result, CELL_INT(cell));
- break;
- case FLOATCELL:
- result = pmc_new(interp, HLL_TYPE(enum_class_Float));
- VTABLE_set_number_native(interp, result, CELL_FLOAT(cell));
- break;
- case STRINGCELL:
- result = pmc_new(interp, HLL_TYPE(enum_class_String));
- VTABLE_set_string_native(interp, result, CELL_STRING(cell));
- break;
- case PMCCELL:
- return CELL_PMC(cell);
- default:
- /* exception */
- break;
- }
-
- return result;
-}
-
-static Hash *
-get_hash(PARROT_INTERP, ARGIN(PMC *SELF))
-{
- Hash *hash;
-
- GETATTR_CallSignature_hash(interp, SELF, hash);
-
- if (!hash) {
- hash = parrot_create_hash(interp,
- enum_type_ptr,
- Hash_key_type_STRING,
- STRING_compare,
- (hash_hash_key_fn)key_hash_STRING);
-
- SETATTR_CallSignature_hash(interp, SELF, hash);
- }
-
- return hash;
-}
-
-static void
-mark_positionals(PARROT_INTERP, ARGIN(Pcc_cell *c))
-{
- while (c) {
- switch (CELL_TYPE_MASK(c)) {
- case STRINGCELL:
- if (CELL_STRING(c))
- Parrot_gc_mark_STRING_alive(interp, CELL_STRING(c));
- break;
- case PMCCELL:
- if (!PMC_IS_NULL(CELL_PMC(c)))
- Parrot_gc_mark_PMC_alive(interp, CELL_PMC(c));
- break;
- case INTCELL:
- case FLOATCELL:
- default:
- break;
- }
-
- c = NEXT_CELL(c);
- }
-}
-
-/* don't look now, but here goes encapsulation.... */
-static void
-mark_hash(PARROT_INTERP, ARGIN(Hash *h))
-{
- UINTVAL entries = h->entries;
- INTVAL i;
-
- for (i = h->mask; i >= 0; --i) {
- HashBucket *b = h->bi[i];
-
- while (b) {
- Parrot_gc_mark_STRING_alive(interp, (STRING *)b->key);
- mark_positionals(interp, (Pcc_cell *)b->value);
- b = b->next;
- }
-
- }
-}
-
-static PMC *
-get_named_names(PARROT_INTERP, ARGIN(PMC *SELF))
-{
- Hash *hash;
- PMC *result = PMCNULL;
-
- GETATTR_CallSignature_hash(interp, SELF, hash);
-
- /* yes, this *looks* risky, but it's a Parrot STRING hash internally */
- if (hash && hash->entries) {
- UINTVAL i, j = 0;
- result = pmc_new(interp, enum_class_FixedStringArray);
- VTABLE_set_integer_native(interp, result, hash->entries);
-
- for (i = 0; i <= hash->mask; i++) {
- HashBucket *b = hash->bi[i];
-
- while (b) {
- VTABLE_set_string_keyed_int(interp, result,
- j++, (STRING *)b->key);
- b = b->next;
- }
- }
- }
-
- return result;
-}
-
-pmclass CallSignature provides array provides hash auto_attrs {
- ATTR struct Pcc_cell *positionals; /* linked list of positionals */
- ATTR PMC *type_tuple; /* Cached argument types for MDD */
- ATTR STRING *short_sig; /* Simple string sig args & returns */
- ATTR PMC *arg_flags; /* Integer array of argument flags */
- ATTR PMC *return_flags; /* Integer array of return flags */
- ATTR Hash *hash; /* Hash of named arguments */
- ATTR INTVAL num_positionals; /* count of positionals */
-
- /* Storage for returns */
- ATTR void **returns_values; /* stored pointers */
- ATTR INTVAL returns_size; /* number of stored elements */
- ATTR INTVAL returns_resize_threshold; /* max size before resizing array */
-/*
-
-=item C<void init()>
-
-Initializes a newly created CallSignature object.
-
-=cut
-
-*/
-
- VTABLE void init() {
- SET_ATTR_type_tuple(INTERP, SELF, PMCNULL);
-
- SET_ATTR_positionals(INTERP, SELF, NULL);
- SET_ATTR_returns_values(INTERP, SELF, NULL);
-
- SET_ATTR_returns_size(INTERP, SELF, 0);
- SET_ATTR_num_positionals(INTERP, SELF, 0);
- SET_ATTR_returns_resize_threshold(INTERP, SELF, 0);
-
- PObj_custom_mark_destroy_SETALL(SELF);
- }
-
-/*
-
-=item C<void mark()>
-
-Mark any referenced strings and PMCs.
-
-=cut
-
-*/
- VTABLE void mark() {
- Hash *hash;
- STRING *short_sig;
- Pcc_cell *positionals;
- INTVAL num_positionals;
- PMC *arg_flags, *type_tuple, *return_flags;
-
- if (!PMC_data(SELF))
- return;
-
- GET_ATTR_type_tuple(INTERP, SELF, type_tuple);
- GET_ATTR_short_sig(INTERP, SELF, short_sig);
- GET_ATTR_arg_flags(INTERP, SELF, arg_flags);
- GET_ATTR_return_flags(INTERP, SELF, return_flags);
- GET_ATTR_num_positionals(INTERP, SELF, num_positionals);
- GET_ATTR_positionals(INTERP, SELF, positionals);
- GET_ATTR_hash(INTERP, SELF, hash);
-
- Parrot_gc_mark_PMC_alive(INTERP, type_tuple);
- Parrot_gc_mark_STRING_alive(INTERP, short_sig);
- Parrot_gc_mark_PMC_alive(INTERP, arg_flags);
- Parrot_gc_mark_PMC_alive(INTERP, return_flags);
-
- if (num_positionals)
- mark_positionals(INTERP, positionals);
-
- if (hash)
- mark_hash(INTERP, hash);
- }
-
- VTABLE void destroy() {
- INTVAL num_positionals, returns_resize_threshold;
- Hash *hash;
- void **returns_values;
-
- if (!PMC_data(SELF))
- return;
-
- GET_ATTR_hash(INTERP, SELF, hash);
- GET_ATTR_num_positionals(INTERP, SELF, num_positionals);
- GET_ATTR_returns_values(INTERP, SELF, returns_values);
- GET_ATTR_returns_resize_threshold(INTERP, SELF, returns_resize_threshold);
-
- if (num_positionals) {
- Pcc_cell *c;
-
- GET_ATTR_positionals(INTERP, SELF, c);
-
- while (c) {
- Pcc_cell *to_free = c;
- c = NEXT_CELL(c);
- FREE_CELL(INTERP, to_free);
- }
- }
-
- if (hash) {
- UINTVAL i;
-
- for (i = 0; i <= hash->mask; i++) {
- HashBucket *b = hash->bi[i];
-
- while (b) {
- FREE_CELL(INTERP, (Pcc_cell *)b->value);
- b = b->next;
- }
- }
-
- parrot_hash_destroy(INTERP, hash);
- }
-
- /* Destroy returns storage */
- if (returns_values) {
- if (returns_resize_threshold == 8)
- Parrot_gc_free_fixed_size_storage(INTERP,
- 8 * sizeof (void *), returns_values);
- else
- mem_sys_free(returns_values);
- }
- }
-
-/*
-
-=item C<void set_string_native(STRING *value)>
-
-Sets the short signature for the CallSignature.
-
-=cut
-
-*/
-
- VTABLE void set_string_native(STRING *value) {
- SET_ATTR_short_sig(INTERP, SELF, value);
- }
-
-/*
-
-=item C<STRING *get_string()>
-
-Returns the short signature for the CallSignature.
-
-=cut
-
-*/
-
- VTABLE STRING *get_string() {
- INTVAL num_positionals;
- STRING *res;
- Pcc_cell *c;
-
- GET_ATTR_short_sig(INTERP, SELF, res);
-
- if (res)
- return res;
-
- GET_ATTR_positionals(INTERP, SELF, c);
- GET_ATTR_num_positionals(INTERP, SELF, num_positionals);
-
- res = Parrot_str_new(INTERP, NULL, num_positionals);
-
- while (c) {
- switch (CELL_TYPE_MASK(c)) {
- case INTCELL:
- res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, "I"));
- break;
- case FLOATCELL:
- res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, "N"));
- break;
- case STRINGCELL:
- res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, "S"));
- break;
- case PMCCELL:
- res = Parrot_str_append(INTERP, res, CONST_STRING(INTERP, "P"));
- break;
- default:
- PARROT_ASSERT(!"Impossible flag");
- break;
- }
- c = NEXT_CELL(c);
- }
- /* TODO Add named args to signature */
- /* After fixind build_MMD_type_tuple to use raw arguments instead of signature */
-
- SET_ATTR_short_sig(INTERP, SELF, res);
-
- return res;
- }
-
-/*
-
-=item C<void set_pmc(PMC *value)>
-
-Sets a fixed-size array of integer types (a type tuple) for the CallSignature.
-
-=cut
-
-*/
-
- VTABLE void set_pmc(PMC *value) {
- SET_ATTR_type_tuple(INTERP, SELF, value);
- }
-
-/*
-
-=item C<PMC *get_pmc()>
-
-Returns a fixed-size array of integer types (a type tuple) for the
-CallSignature.
-
-=cut
-
-*/
-
- VTABLE PMC *get_pmc() {
- PMC *type_tuple;
-
- GET_ATTR_type_tuple(INTERP, SELF, type_tuple);
-
- if (PMC_IS_NULL(type_tuple)) {
- type_tuple = Parrot_mmd_build_type_tuple_from_sig_obj(INTERP, SELF);
- SET_ATTR_type_tuple(INTERP, SELF, type_tuple);
- }
-
- return type_tuple;
-
- }
-
-/*
-
-=item C<void set_attr_str(STRING *key, PMC *value)>
-
-Set a PMC value for an attribute by string name.
-
-=over
-
-=item results
-
-Stores the return signature, an array of PMCs.
-
-=item arg_flags
-
-Stores a set of flags for the call signature arguments, an array of
-integers.
-
-=item return_flags
-
-Stores a set of flags for the call signature return arguments, an array
-of integers.
-
-=back
-
-=cut
-
-*/
-
- VTABLE void set_attr_str(STRING *key, PMC *value) {
-
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags"))) {
- SET_ATTR_arg_flags(INTERP, SELF, value);
- }
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "return_flags"))) {
- SET_ATTR_return_flags(INTERP, SELF, value);
- }
- else {
- /* If unknown attribute name, throw an exception. */
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ATTRIB_NOT_FOUND,
- "No such attribute '%S'", key);
- }
- }
-
-/*
-
-=item C<PMC *get_attr_str(STRING *key)>
-
-Get a PMC value for an attribute by string name.
-
-=over
-
-=item results
-
-Retrieves the return signature, an array of PMCs.
-
-=item arg_flags
-
-Retrieves the flags for the call signature arguments, an array of
-integers.
-
-=item return_flags
-
-Retrieves the flags for the call signature return arguments, an array of
-integers.
-
-=item named
-
-Retrieves the hash of named arguments.
-
-=back
-
-=cut
-
-*/
-
- VTABLE PMC *get_attr_str(STRING *key) {
- PMC *value = PMCNULL;
-
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "named"))) {
- value = get_named_names(INTERP, SELF);
- }
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "arg_flags"))) {
- GET_ATTR_arg_flags(INTERP, SELF, value);
- }
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "return_flags"))) {
- GET_ATTR_return_flags(INTERP, SELF, value);
- }
- else {
- /* If unknown attribute name, throw an exception. */
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_ATTRIB_NOT_FOUND,
- "No such attribute '%S'", key);
- }
-
- return value;
- }
-
- VTABLE INTVAL elements() {
- INTVAL num_positionals;
-
- if (!PMC_data(SELF))
- return 0;
-
- GET_ATTR_num_positionals(INTERP, SELF, num_positionals);
-
- return num_positionals;
- }
-
- VTABLE void push_integer(INTVAL value) {
- Pcc_cell *cell = CREATE_INTVAL_CELL(INTERP);
- APPEND_CELL(INTERP, SELF, cell);
- CELL_INT(cell) = value;
- }
-
- VTABLE void push_float(FLOATVAL value) {
- Pcc_cell *cell = CREATE_FLOATVAL_CELL(INTERP);
- APPEND_CELL(INTERP, SELF, cell);
- CELL_FLOAT(cell) = value;
- }
-
- VTABLE void push_string(STRING *value) {
- Pcc_cell *cell = CREATE_STRING_CELL(INTERP);
- APPEND_CELL(INTERP, SELF, cell);
- CELL_STRING(cell) = value;
- }
-
- VTABLE void push_pmc(PMC *value) {
- Pcc_cell *cell = CREATE_PMC_CELL(INTERP);
- APPEND_CELL(INTERP, SELF, cell);
- CELL_PMC(cell) = value;
- }
-
- VTABLE INTVAL pop_integer() {
- Pcc_cell *cell = pop_cell(INTERP, SELF);
-
- if (cell) {
- INTVAL result = autobox_intval(INTERP, cell);
- FREE_CELL(INTERP, cell);
- return result;
- }
-
- return 0;
- }
-
- VTABLE FLOATVAL pop_float() {
- Pcc_cell *cell = pop_cell(INTERP, SELF);
-
- if (cell) {
- FLOATVAL result = autobox_floatval(INTERP, cell);
- FREE_CELL(INTERP, cell);
- return result;
- }
-
- return 0.0;
- }
-
- VTABLE PMC * pop_pmc() {
- Pcc_cell *cell = pop_cell(INTERP, SELF);
-
- if (cell) {
- PMC *result = autobox_pmc(INTERP, cell);
- FREE_CELL(INTERP, cell);
- return result;
- }
-
- return PMCNULL;
- }
-
- VTABLE STRING * pop_string() {
- Pcc_cell *cell = pop_cell(INTERP, SELF);
-
- if (cell) {
- STRING *result = autobox_string(INTERP, cell);
- FREE_CELL(INTERP, cell);
- return result;
- }
-
- return NULL;
- }
-
- VTABLE INTVAL get_integer_keyed_int(INTVAL key) {
- Pcc_cell *cell = get_cell_at(INTERP, SELF, key);
-
- if (!cell)
- return 0;
-
- return autobox_intval(INTERP, cell);
- }
-
- VTABLE FLOATVAL get_number_keyed_int(INTVAL key) {
- Pcc_cell *cell = get_cell_at(INTERP, SELF, key);
-
- if (!cell)
- return 0.0;
-
- return autobox_floatval(INTERP, cell);
- }
-
- VTABLE STRING * get_string_keyed_int(INTVAL key) {
- Pcc_cell *cell = get_cell_at(INTERP, SELF, key);
-
- if (!cell)
- return NULL;
-
- return autobox_string(INTERP, cell);
- }
-
- VTABLE PMC * get_pmc_keyed_int(INTVAL key) {
- Pcc_cell *cell = get_cell_at(INTERP, SELF, key);
-
- if (!cell)
- return PMCNULL;
-
- return autobox_pmc(INTERP, cell);
- }
-
- VTABLE void unshift_integer(INTVAL value) {
- Pcc_cell *cell = CREATE_INTVAL_CELL(INTERP);
- PREPEND_CELL(INTERP, SELF, cell);
- CELL_INT(cell) = value;
- }
-
- VTABLE void unshift_float(FLOATVAL value) {
- Pcc_cell *cell = CREATE_FLOATVAL_CELL(INTERP);
- PREPEND_CELL(INTERP, SELF, cell);
- CELL_FLOAT(cell) = value;
- }
-
- VTABLE void unshift_string(STRING *value) {
- Pcc_cell *cell = CREATE_STRING_CELL(INTERP);
- PREPEND_CELL(INTERP, SELF, cell);
- CELL_STRING(cell) = value;
- }
-
- VTABLE void unshift_pmc(PMC *value) {
- Pcc_cell *cell = CREATE_PMC_CELL(INTERP);
- PREPEND_CELL(INTERP, SELF, cell);
- CELL_PMC(cell) = value;
- }
-
- VTABLE INTVAL shift_integer() {
- Pcc_cell *cell = shift_cell(INTERP, SELF);
-
- if (cell) {
- INTVAL result = autobox_intval(INTERP, cell);
- FREE_CELL(INTERP, cell);
- return result;
- }
-
- return 0;
- }
-
- VTABLE FLOATVAL shift_float() {
- Pcc_cell *cell = shift_cell(INTERP, SELF);
-
- if (cell) {
- FLOATVAL result = autobox_floatval(INTERP, cell);
- FREE_CELL(INTERP, cell);
- return result;
- }
-
- return 0.0;
- }
-
- VTABLE STRING * shift_string() {
- Pcc_cell *cell = shift_cell(INTERP, SELF);
-
- if (cell) {
- STRING *result = autobox_string(INTERP, cell);
- FREE_CELL(INTERP, cell);
- return result;
- }
-
- return NULL;
- }
-
- VTABLE PMC * shift_pmc() {
- Pcc_cell *cell = shift_cell(INTERP, SELF);
-
- if (cell) {
- PMC *result = autobox_pmc(INTERP, cell);
- FREE_CELL(INTERP, cell);
- return result;
- }
-
- return PMCNULL;
- }
-
- VTABLE void set_integer_keyed_int(INTVAL key, INTVAL value) {
- Pcc_cell *cell = get_cell_at(INTERP, SELF, key);
-
- if (!cell) {
- INTVAL num_positionals;
-
- GET_ATTR_num_positionals(INTERP, SELF, num_positionals);
-
- if (key == num_positionals)
- VTABLE_push_integer(INTERP, SELF, value);
-
- /* XXX: else throw exception? */
- return;
- }
-
- CELL_INT(cell) = value;
- }
-
- VTABLE void set_number_keyed_int(INTVAL key, FLOATVAL value) {
- Pcc_cell *cell = get_cell_at(INTERP, SELF, key);
-
- if (!cell) {
- INTVAL num_positionals;
-
- GET_ATTR_num_positionals(INTERP, SELF, num_positionals);
-
- if (key == num_positionals)
- VTABLE_push_float(INTERP, SELF, value);
-
- /* XXX: else throw exception? */
- return;
- }
-
- CELL_FLOAT(cell) = value;
- }
-
- VTABLE void set_string_keyed_int(INTVAL key, STRING *value) {
- Pcc_cell *cell = get_cell_at(INTERP, SELF, key);
-
- if (!cell) {
- INTVAL num_positionals;
-
- GET_ATTR_num_positionals(INTERP, SELF, num_positionals);
-
- if (key == num_positionals)
- VTABLE_push_string(INTERP, SELF, value);
-
- /* XXX: else throw exception? */
- return;
- }
-
- CELL_STRING(cell) = value;
- }
-
- VTABLE void set_pmc_keyed_int(INTVAL key, PMC *value) {
- Pcc_cell *cell = get_cell_at(INTERP, SELF, key);
-
- if (!cell) {
- INTVAL num_positionals;
-
- GET_ATTR_num_positionals(INTERP, SELF, num_positionals);
-
- if (key == num_positionals)
- VTABLE_push_pmc(INTERP, SELF, value);
-
- /* XXX: else throw exception? */
- return;
- }
-
- CELL_PMC(cell) = value;
- }
-
- VTABLE void set_integer_keyed_str(STRING *key, INTVAL value) {
- Hash *hash = get_hash(INTERP, SELF);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key);
-
- if (!cell) {
- cell = CREATE_INTVAL_CELL(INTERP);
- parrot_hash_put(INTERP, hash, (void *)key, (void *)cell);
- NEXT_CELL(cell) = NULL;
- }
- else
- SET_CELL_INT(cell);
-
- CELL_INT(cell) = value;
- }
-
- VTABLE void set_number_keyed_str(STRING *key, FLOATVAL value) {
- Hash *hash = get_hash(INTERP, SELF);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key);
-
- if (!cell) {
- cell = CREATE_FLOATVAL_CELL(INTERP);
- parrot_hash_put(INTERP, hash, (void *)key, (void *)cell);
- NEXT_CELL(cell) = NULL;
- }
- else
- SET_CELL_FLOAT(cell);
-
- CELL_FLOAT(cell) = value;
- }
-
- VTABLE void set_string_keyed_str(STRING *key, STRING *value) {
- Hash *hash = get_hash(INTERP, SELF);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key);
-
- if (!cell) {
- cell = CREATE_STRING_CELL(INTERP);
- parrot_hash_put(INTERP, hash, (void *)key, (void *)cell);
- NEXT_CELL(cell) = NULL;
- }
- else
- SET_CELL_STRING(cell);
-
- CELL_STRING(cell) = value;
- }
-
- VTABLE void set_pmc_keyed_str(STRING *key, PMC *value) {
- Hash *hash = get_hash(INTERP, SELF);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, (void *)key);
-
- if (!cell) {
- cell = CREATE_PMC_CELL(INTERP);
- parrot_hash_put(INTERP, hash, (void *)key, (void *)cell);
- NEXT_CELL(cell) = NULL;
- }
- else
- SET_CELL_PMC(cell);
-
- CELL_PMC(cell) = value;
- }
-
- VTABLE void set_integer_keyed(PMC *key, INTVAL value) {
- Hash *hash = get_hash(INTERP, SELF);
- void *k = hash_key_from_pmc(INTERP, hash, key);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);
-
- if (!cell) {
- cell = CREATE_INTVAL_CELL(INTERP);
- parrot_hash_put(INTERP, hash, k, (void *)cell);
- NEXT_CELL(cell) = NULL;
- }
- else
- SET_CELL_INT(cell);
-
- CELL_INT(cell) = value;
- }
-
- VTABLE void set_number_keyed(PMC *key, FLOATVAL value) {
- Hash *hash = get_hash(INTERP, SELF);
- void *k = hash_key_from_pmc(INTERP, hash, key);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);
-
- if (!cell) {
- cell = CREATE_FLOATVAL_CELL(INTERP);
- parrot_hash_put(INTERP, hash, k, (void *)cell);
- NEXT_CELL(cell) = NULL;
- }
- else
- SET_CELL_FLOAT(cell);
-
- CELL_FLOAT(cell) = value;
- }
-
- VTABLE void set_string_keyed(PMC *key, STRING *value) {
- Hash *hash = get_hash(INTERP, SELF);
- void *k = hash_key_from_pmc(INTERP, hash, key);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);
-
- if (!cell) {
- cell = CREATE_STRING_CELL(INTERP);
- parrot_hash_put(INTERP, hash, k, (void *)cell);
- NEXT_CELL(cell) = NULL;
- }
- else
- SET_CELL_STRING(cell);
-
- CELL_STRING(cell) = value;
- }
-
- VTABLE void set_pmc_keyed(PMC *key, PMC *value) {
- Hash *hash = get_hash(INTERP, SELF);
- void *k = hash_key_from_pmc(INTERP, hash, key);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);
-
- if (!cell) {
- cell = CREATE_PMC_CELL(INTERP);
- parrot_hash_put(INTERP, hash, k, (void *)cell);
- NEXT_CELL(cell) = NULL;
- }
- else
- SET_CELL_PMC(cell);
-
- CELL_PMC(cell) = value;
- }
-
- VTABLE INTVAL get_integer_keyed_str(STRING *key) {
- Hash *hash = get_hash(INTERP, SELF);
-
- if (hash) {
- void *k = hash_key_from_string(INTERP, hash, key);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);
-
- if (cell)
- return autobox_intval(INTERP, cell);
- }
-
- return 0;
- }
-
- VTABLE FLOATVAL get_number_keyed_str(STRING *key) {
- Hash *hash = get_hash(INTERP, SELF);
-
- if (hash) {
- void *k = hash_key_from_string(INTERP, hash, key);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);
-
- if (cell)
- return autobox_floatval(INTERP, cell);
- }
-
- return 0.0;
- }
-
-
- VTABLE STRING * get_string_keyed_str(STRING *key) {
- Hash *hash = get_hash(INTERP, SELF);
-
- if (hash) {
- void *k = hash_key_from_string(INTERP, hash, key);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);
-
- if (cell)
- return autobox_string(INTERP, cell);
- }
-
- return NULL;
- }
-
- VTABLE PMC * get_pmc_keyed_str(STRING *key) {
- Hash *hash = get_hash(INTERP, SELF);
-
- if (hash) {
- void *k = hash_key_from_string(INTERP, hash, key);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);
-
- if (cell)
- return autobox_pmc(INTERP, cell);
- }
-
- return PMCNULL;
- }
-
- VTABLE INTVAL get_integer_keyed(PMC *key) {
- Hash *hash = get_hash(INTERP, SELF);
-
- if (hash) {
- void *k = hash_key_from_pmc(INTERP, hash, key);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);
-
- if (cell)
- return autobox_intval(INTERP, cell);
- }
-
- return 0;
- }
-
- VTABLE FLOATVAL get_number_keyed(PMC *key) {
- Hash *hash = get_hash(INTERP, SELF);
-
- if (hash) {
- void *k = hash_key_from_pmc(INTERP, hash, key);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);
-
- if (cell)
- return autobox_floatval(INTERP, cell);
- }
-
- return 0.0;
- }
-
- VTABLE STRING * get_string_keyed(PMC *key) {
- Hash *hash = get_hash(INTERP, SELF);
-
- if (hash) {
- void *k = hash_key_from_pmc(INTERP, hash, key);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);
-
- if (cell)
- return autobox_string(INTERP, cell);
- }
-
- return NULL;
- }
-
- VTABLE PMC * get_pmc_keyed(PMC *key) {
- Hash *hash = get_hash(INTERP, SELF);
-
- if (hash) {
- void *k = hash_key_from_pmc(INTERP, hash, key);
- Pcc_cell *cell = (Pcc_cell *)parrot_hash_get(INTERP, hash, k);
-
- if (cell)
- return autobox_pmc(INTERP, cell);
- }
-
- return PMCNULL;
- }
-
- VTABLE INTVAL exists_keyed(PMC *key) {
- Hash *hash = get_hash(INTERP, SELF);
-
- if (hash) {
- void *k = hash_key_from_pmc(INTERP, hash, key);
- return parrot_hash_exists(INTERP, hash, k);
- }
-
- return 0;
- }
-
- VTABLE INTVAL exists_keyed_str(STRING *key) {
- Hash *hash = get_hash(INTERP, SELF);
-
- if (hash) {
- void *k = hash_key_from_string(INTERP, hash, key);
- return parrot_hash_exists(INTERP, hash, k);
- }
-
- return 0;
- }
-
- VTABLE INTVAL exists_keyed_int(INTVAL key) {
- INTVAL num_positionals;
-
- GET_ATTR_num_positionals(INTERP, SELF, num_positionals);
-
- if (num_positionals)
- return key < num_positionals;
-
- return 0;
- }
-
-/*
-
-=item C<PMC *clone()>
-
-Creates and returns a clone of the signature.
-
-=cut
-
-*/
- VTABLE PMC *clone() {
- Pcc_cell *cell;
- STRING *short_sig;
- PMC *type_tuple, *arg_flags, *return_flags;
- PMC * const dest = pmc_new(INTERP, SELF->vtable->base_type);
-
- GET_ATTR_positionals(INTERP, SELF, cell);
-
- /* Copy all positional cells (thanks to APPEND_CELL, this also
- * sets num_positionals). */
- for (; cell; cell = NEXT_CELL(cell)) {
- Pcc_cell *cloned_cell;
-
- switch (CELL_TYPE_MASK(cell)) {
- case INTCELL:
- cloned_cell = CREATE_INTVAL_CELL(INTERP);
- CELL_INT(cloned_cell) = CELL_INT(cell);
- break;
- case FLOATCELL:
- cloned_cell = CREATE_FLOATVAL_CELL(INTERP);
- CELL_FLOAT(cloned_cell) = CELL_FLOAT(cell);
- break;
- case STRINGCELL:
- cloned_cell = CREATE_STRING_CELL(INTERP);
- CELL_STRING(cloned_cell) = CELL_STRING(cell);
- break;
- case PMCCELL:
- cloned_cell = CREATE_PMC_CELL(INTERP);
- CELL_PMC(cloned_cell) = CELL_PMC(cell);
- break;
- default:
- break;
- }
- APPEND_CELL(INTERP, dest, cloned_cell);
- }
-
-
- GET_ATTR_type_tuple(INTERP, SELF, type_tuple);
- GET_ATTR_short_sig(INTERP, SELF, short_sig);
- GET_ATTR_arg_flags(INTERP, SELF, arg_flags);
- GET_ATTR_return_flags(INTERP, SELF, return_flags);
-
- /* FIXME
- PMC *results;
-
- GET_ATTR_results(INTERP, SELF, results);
-
- if (!PMC_IS_NULL(results))
- SET_ATTR_results(INTERP, dest, VTABLE_clone(INTERP, results));
- */
-
- if (!PMC_IS_NULL(type_tuple))
- SET_ATTR_type_tuple(INTERP, dest, VTABLE_clone(INTERP, type_tuple));
-
- if (short_sig)
- SET_ATTR_short_sig(INTERP, dest, Parrot_str_copy(INTERP, short_sig));
-
- if (!PMC_IS_NULL(arg_flags))
- SET_ATTR_arg_flags(INTERP, dest, VTABLE_clone(INTERP, arg_flags));
-
- if (!PMC_IS_NULL(return_flags))
- SET_ATTR_return_flags(INTERP, dest, VTABLE_clone(INTERP, return_flags));
-
- parrot_hash_clone(INTERP, get_hash(INTERP, SELF),
- get_hash(INTERP, dest));
-
- return dest;
- }
-
-/*
-
-=back
-
-=cut
-
-*/
-
-} /* end pmclass */
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/pmc/class.pmc Sun Dec 20 12:30:38 2009 (r43175)
@@ -344,7 +344,7 @@
if (!PMC_IS_NULL(meth)) {
/* build an empty signature; it has an invocant but no args/retvals */
- PMC * const sig_obj = pmc_new(interp, enum_class_CallSignature);
+ PMC * const sig_obj = pmc_new(interp, enum_class_CallContext);
/* preserve current_object */
PMC * const old_object = interp->current_object;
VTABLE_set_string_native(interp, sig_obj, CONST_STRING(interp, "Pi->"));
Deleted: trunk/src/pmc/context.pmc
==============================================================================
--- trunk/src/pmc/context.pmc Sun Dec 20 12:30:38 2009 (r43174)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,298 +0,0 @@
-/*
-Copyright (C) 2001-2009, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/context.pmc - Interpreter Context.
-
-=head1 DESCRIPTION
-
-Stores context of execution. Currently we store pointer to Parrot_Context_attributes
-structure in PMC_data.
-
-=head2 Vtable Functions
-
-=over 4
-
-=cut
-
-*/
-
-
-#include "parrot/packfile.h"
-#include "pmc/pmc_sub.h"
-
-pmclass Context auto_attrs {
- ATTR PMC *caller_ctx; /* caller context */
-
- ATTR void *registers; /* pointer to allocated registers */
- ATTR Regs_ni bp; /* pointers to FLOATVAL & INTVAL */
- ATTR Regs_ps bp_ps; /* pointers to PMC & STR */
-
- /* end common header */
- ATTR UINTVAL n_regs_used[4]; /* INSP in PBC points to Sub */
- ATTR PMC *lex_pad; /* LexPad PMC */
- ATTR PMC *outer_ctx; /* outer context, if a closure */
-
- /* new call scheme and introspective variables */
- ATTR PMC *current_sub; /* the Sub we are executing */
-
- /* for now use a return continuation PMC */
- ATTR PMC *handlers; /* local handlers for the context */
- ATTR PMC *current_cont; /* the return continuation PMC */
- ATTR PMC *current_object; /* current object if a method call */
- ATTR PMC *current_namespace; /* The namespace we're currently in */
- ATTR PMC *results_signature; /* non-const results signature PMC */
- ATTR opcode_t *current_pc; /* program counter of Sub invocation */
- ATTR opcode_t *current_results; /* ptr into code with get_results opcode */
- ATTR PMC *current_sig; /* temporary CallSignature PMC for active call */
-
- /* deref the constants - we need it all the time */
- ATTR struct PackFile_Constant **constants;
-
- ATTR INTVAL current_HLL; /* see also src/hll.c */
-
- ATTR UINTVAL warns; /* Keeps track of what warnings
- * have been activated */
- ATTR UINTVAL errors; /* fatals that can be turned off */
- ATTR UINTVAL trace_flags;
- ATTR UINTVAL recursion_depth; /* Sub call recursion depth */
-
- /* code->prederefed.code - code->base.data in opcodes
- * to simplify conversion between code ptrs in e.g. invoke */
- ATTR size_t pred_offset;
-
-/*
-
-=item C<void init()>
-
-Initialize new Context. See C<Parrot_alloc_context>.
-
-=cut
-
-*/
-
- VTABLE void init() {
- PObj_custom_mark_destroy_SETALL(SELF);
- }
-
-
-/*
-
-=item C<void mark()>
-
-Mark Context as alive.
-
-=cut
-
-*/
-
- VTABLE void mark()
- {
- Parrot_Context_attributes * const ctx = PARROT_CONTEXT(SELF);
- UINTVAL i;
-
- /* If Context wasn't initialised just return */
- if (!ctx)
- return;
-
- Parrot_gc_mark_PMC_alive(INTERP, ctx->caller_ctx);
- Parrot_gc_mark_PMC_alive(INTERP, ctx->lex_pad);
- Parrot_gc_mark_PMC_alive(INTERP, ctx->outer_ctx);
- Parrot_gc_mark_PMC_alive(INTERP, ctx->current_sub);
- Parrot_gc_mark_PMC_alive(INTERP, ctx->handlers);
- Parrot_gc_mark_PMC_alive(INTERP, ctx->current_cont);
- Parrot_gc_mark_PMC_alive(INTERP, ctx->current_object);
- Parrot_gc_mark_PMC_alive(INTERP, ctx->current_namespace);
- Parrot_gc_mark_PMC_alive(INTERP, ctx->results_signature);
- Parrot_gc_mark_PMC_alive(INTERP, ctx->current_sig);
-
- if (!ctx->n_regs_used)
- return;
-
- for (i = 0; i < ctx->n_regs_used[REGNO_PMC]; ++i) {
- PMC *p = ctx->bp_ps.regs_p[-1L-(i)];
- /* Original code from CTX_REG_PMC */
- if (p)
- Parrot_gc_mark_PMC_alive(interp, p);
- }
-
- for (i = 0; i < ctx->n_regs_used[REGNO_STR]; ++i) {
- STRING *s = ctx->bp_ps.regs_s[i];
- if (s)
- Parrot_gc_mark_STRING_alive(interp, s);
- }
- }
-
-/*
-
-=item C<void destroy()>
-
-Destroy Context and memory allocated by C<Parrot_alloc_context>.
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- Parrot_pcc_free_registers(INTERP, SELF);
- }
-
-/*
-
-=item C<PMC *get_pmc_keyed_str(STRING *key)>
-
-Introspection interface. C<key> can be:
-
- caller_ctx ... return Caller Context
- lex_pad ... return LexPad
- outer_ctx ... return Outer Context
- current_sub ... return current Sub
- handlers ... return list of ExceptioHandlers
- current_cont ... return current Continuation
- current_object ... return current Object (if in method call)
- current_namespace ... return current Namespace
-
-Deprecated. Use attribute accessors.
-=cut
-
-*/
- VTABLE PMC *get_pmc_keyed_str(STRING *key) {
- Parrot_Context_attributes *ctx = PARROT_CONTEXT(SELF);
-
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "caller_ctx")))
- return ctx->caller_ctx;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "lex_pad")))
- return ctx->lex_pad;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "outer_ctx")))
- return ctx->outer_ctx;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_sub")))
- return ctx->current_sub;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_cont")))
- return ctx->current_cont;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_object")))
- return ctx->current_object;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_namespace")))
- return ctx->current_namespace;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "handlers")))
- return ctx->handlers;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "results_signature")))
- return ctx->results_signature;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_HLL")))
- /* This function from src/hash.c. */
- /* We probably have to move it to more suitable place */
- return get_integer_pmc(INTERP, ctx->current_HLL);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_hll")))
- return get_string_pmc(INTERP, Parrot_get_HLL_name(INTERP, ctx->current_HLL));
-
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ATTRIB_NOT_FOUND,
- "No such item %Ss", key);
- }
-
- VTABLE PMC *get_pmc_keyed(PMC *key) {
- return STATICSELF.get_pmc_keyed_str(VTABLE_get_string(INTERP, key));
- }
-
- VTABLE PMC *get_attr_str(STRING *key) {
- Parrot_Context_attributes *ctx = PARROT_CONTEXT(SELF);
-
- if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "caller_ctx")))
- return ctx->caller_ctx;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "lex_pad")))
- return ctx->lex_pad;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "outer_ctx")))
- return ctx->outer_ctx;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_sub")))
- return ctx->current_sub;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_cont")))
- return ctx->current_cont;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_object")))
- return ctx->current_object;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_namespace")))
- return ctx->current_namespace;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "handlers")))
- return ctx->handlers;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "results_signature")))
- return ctx->results_signature;
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_HLL")))
- /* This function from src/hash.c. */
- /* We probably have to move it to more suitable place */
- return get_integer_pmc(INTERP, ctx->current_HLL);
- else if (Parrot_str_equal(INTERP, key, CONST_STRING(INTERP, "current_hll")))
- return get_string_pmc(INTERP, Parrot_get_HLL_name(INTERP, ctx->current_HLL));
-
- Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_ATTRIB_NOT_FOUND,
- "No such item %Ss", key);
- }
-
-/*
-
-=item C<PMC *backtrace>
-
-Gets a representation of the backtrace starting from this Context.
-Returns an array of hashes. Each array element represents a caller in
-the backtrace, the most recent caller first. The hash has two keys: C<sub>,
-which holds the PMC representing the sub, and C<annotations> which is a hash
-of the annotations at the point where the exception was thrown for the current
-sub, or for the point of the call a level deeper for the rest.
-
-=cut
-
-*/
-
- METHOD backtrace(PMC *resume :optional, INTVAL has_resume :opt_flag) {
- PMC *result = pmc_new(interp, enum_class_ResizablePMCArray);
- PMC *cur_ctx = SELF;
- Parrot_Continuation_attributes *cont = has_resume ? PMC_cont(resume) : NULL;
-
- /* Get starting context, then loop over them. */
- while (cur_ctx) {
- PMC *frame = pmc_new(interp, enum_class_Hash);
- PMC *annotations = NULL;
- Parrot_Sub_attributes *sub;
-
- /* Get sub and put it in the hash. */
- PMC *sub_pmc = Parrot_pcc_get_sub(interp, cur_ctx);
-
- if (!sub_pmc)
- sub_pmc = PMCNULL;
-
- VTABLE_set_pmc_keyed_str(interp, frame, CONST_STRING(interp, "sub"), sub_pmc);
-
- /* Look up any annotations and put them in the hash. */
- if (!PMC_IS_NULL(sub_pmc)) {
- PMC_get_sub(interp, sub_pmc, sub);
-
- if (sub->seg->annotations) {
- PackFile_ByteCode *seg = sub->seg;
- opcode_t *pc = cont && cur_ctx == cont->to_ctx
- ? cont->address
- : Parrot_pcc_get_pc(interp, cur_ctx);
-
- annotations = PackFile_Annotations_lookup(interp,
- seg->annotations, pc - seg->base.data,
- NULL);
- }
- }
-
- if (!annotations)
- annotations = pmc_new(interp, enum_class_Hash);
-
- VTABLE_set_pmc_keyed_str(interp, frame, CONST_STRING(interp, "annotations"), annotations);
-
- /* Push frame and go to next caller. */
- VTABLE_push_pmc(interp, result, frame);
- cur_ctx = Parrot_pcc_get_caller_ctx(interp, cur_ctx);
- }
-
- RETURN(PMC *result);
- }
-}
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
Modified: trunk/src/pmc/coroutine.pmc
==============================================================================
--- trunk/src/pmc/coroutine.pmc Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/pmc/coroutine.pmc Sun Dec 20 12:30:38 2009 (r43175)
@@ -155,7 +155,13 @@
"tail call to coro not allowed");
/* first time set current sub, cont, object */
- ctx = Parrot_set_new_context(INTERP, co->n_regs_used);
+ ctx = Parrot_pcc_get_signature(INTERP, caller_ctx);
+ if (PMC_IS_NULL(ctx))
+ ctx = pmc_new(INTERP, enum_class_CallContext);
+ CURRENT_CONTEXT(INTERP) = ctx;
+ Parrot_pcc_allocate_registers(INTERP, ctx, co->n_regs_used);
+ Parrot_pcc_set_caller_ctx(INTERP, ctx, caller_ctx);
+ Parrot_pcc_init_context(INTERP, ctx, caller_ctx);
co->ctx = ctx;
Modified: trunk/src/pmc/multisub.pmc
==============================================================================
--- trunk/src/pmc/multisub.pmc Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/pmc/multisub.pmc Sun Dec 20 12:30:38 2009 (r43175)
@@ -19,7 +19,7 @@
*/
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
pmclass MultiSub extends ResizablePMCArray auto_attrs provides array {
Modified: trunk/src/pmc/sub.pmc
==============================================================================
--- trunk/src/pmc/sub.pmc Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/pmc/sub.pmc Sun Dec 20 12:30:38 2009 (r43175)
@@ -387,7 +387,14 @@
/* plain subroutine call
* create new context, place it in interpreter */
- context = Parrot_set_new_context(INTERP, sub->n_regs_used);
+ context = Parrot_pcc_get_signature(INTERP, caller_ctx);
+ if (PMC_IS_NULL(context))
+ context = pmc_new(INTERP, enum_class_CallContext);
+ CURRENT_CONTEXT(INTERP) = context;
+ Parrot_pcc_set_caller_ctx(INTERP, context, caller_ctx);
+ Parrot_pcc_allocate_registers(INTERP, context, sub->n_regs_used);
+ Parrot_pcc_init_context(INTERP, context, caller_ctx);
+
Parrot_pcc_set_sub(interp, context, SELF);
Parrot_pcc_set_continuation(interp, context, ccont);
Parrot_pcc_set_constants(interp, context, sub->seg->const_table->constants);
Modified: trunk/src/pmc_freeze.c
==============================================================================
--- trunk/src/pmc_freeze.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/pmc_freeze.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -27,7 +27,7 @@
*/
#include "parrot/parrot.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "pmc_freeze.str"
/* HEADERIZER HFILE: include/parrot/pmc_freeze.h */
Modified: trunk/src/runcore/cores.c
==============================================================================
--- trunk/src/runcore/cores.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/runcore/cores.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -253,7 +253,7 @@
#include "parrot/dynext.h"
#include "pmc/pmc_sub.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#ifdef HAVE_COMPUTED_GOTO
# include "parrot/oplib/core_ops_cg.h"
Modified: trunk/src/runcore/main.c
==============================================================================
--- trunk/src/runcore/main.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/runcore/main.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -46,7 +46,7 @@
#endif
#include "parrot/dynext.h"
#include "pmc/pmc_parrotlibrary.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/runcore_api.h */
Modified: trunk/src/runcore/profiling.c
==============================================================================
--- trunk/src/runcore/profiling.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/runcore/profiling.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -26,7 +26,7 @@
#include "profiling.str"
#include "pmc/pmc_sub.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "pmc/pmc_namespace.h"
#ifdef WIN32
Modified: trunk/src/runcore/trace.c
==============================================================================
--- trunk/src/runcore/trace.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/runcore/trace.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -26,7 +26,7 @@
#include "parrot/runcore_trace.h"
#include "parrot/oplib/ops.h"
#include "pmc/pmc_sub.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/runcore_trace.h */
Modified: trunk/src/scheduler.c
==============================================================================
--- trunk/src/scheduler.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/scheduler.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -22,7 +22,7 @@
#include "pmc/pmc_scheduler.h"
#include "pmc/pmc_task.h"
#include "pmc/pmc_timer.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "scheduler.str"
Modified: trunk/src/sub.c
==============================================================================
--- trunk/src/sub.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/sub.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -23,7 +23,7 @@
#include "sub.str"
#include "pmc/pmc_sub.h"
#include "pmc/pmc_continuation.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
/* HEADERIZER HFILE: include/parrot/sub.h */
Modified: trunk/src/warnings.c
==============================================================================
--- trunk/src/warnings.c Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/src/warnings.c Sun Dec 20 12:30:38 2009 (r43175)
@@ -19,7 +19,7 @@
#include "parrot/parrot.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include <stdarg.h>
Modified: trunk/t/native_pbc/annotations.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: trunk/t/native_pbc/integer_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: trunk/t/native_pbc/number_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: trunk/t/native_pbc/string_1.pbc
==============================================================================
Binary file (source and/or target). No diff available.
Modified: trunk/t/op/cc_params.t
==============================================================================
--- trunk/t/op/cc_params.t Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/t/op/cc_params.t Sun Dec 20 12:30:38 2009 (r43175)
@@ -32,7 +32,7 @@
.sub call_sig_with_no_args
.param pmc sig :call_sig
$S0 = typeof sig
- is('CallSignature', $S0)
+ is('CallContext', $S0)
$I0 = elements sig
is(0, $I0)
.end
@@ -40,7 +40,7 @@
.sub call_sig_with_positionals
.param pmc sig :call_sig
$S0 = typeof sig
- is('CallSignature', $S0)
+ is('CallContext', $S0)
$I0 = elements sig
is(3, $I0)
$I1 = sig[0]
@@ -54,7 +54,7 @@
.sub call_sig_with_named
.param pmc sig :call_sig
$S0 = typeof sig
- is('CallSignature', $S0)
+ is('CallContext', $S0)
$I0 = elements sig
is(0, $I0)
$I1 = sig["x"]
@@ -74,7 +74,7 @@
# Have call sig.
$S0 = typeof sig
- is('CallSignature', $S0)
+ is('CallContext', $S0)
# First element is self.
$P0 = sig[0]
@@ -95,7 +95,7 @@
# Have call sig.
$S0 = typeof sig
- is('CallSignature', $S0)
+ is('CallContext', $S0)
# First element is self.
$P0 = sig[0]
Copied and modified: trunk/t/pmc/callcontext.t (from r43174, trunk/t/pmc/callsignature.t)
==============================================================================
--- trunk/t/pmc/callsignature.t Sun Dec 20 09:49:36 2009 (r43174, copy source)
+++ trunk/t/pmc/callcontext.t Sun Dec 20 12:30:38 2009 (r43175)
@@ -4,15 +4,15 @@
=head1 NAME
-t/pmc/callsignature.t - test CallSignature PMC
+t/pmc/callcontext.t - test CallContext PMC
=head1 SYNOPSIS
- % prove t/pmc/callsignature.t
+ % prove t/pmc/callcontext.t
=head1 DESCRIPTION
-Tests the CallSignature PMC.
+Tests the CallContext PMC.
=cut
@@ -33,12 +33,12 @@
.end
.sub 'test_instantiate'
- $P0 = new ['CallSignature']
- ok(1, 'Instantiated CallSignature')
+ $P0 = new ['CallContext']
+ ok(1, 'Instantiated CallContext')
.end
.sub 'test_get_set_attrs'
- $P0 = new ['CallSignature']
+ $P0 = new ['CallContext']
$P5 = new 'String'
$P5 = 'moonbomb'
@@ -55,7 +55,7 @@
.end
.sub 'test_push_pop_indexed_access'
- $P0 = new [ 'CallSignature' ]
+ $P0 = new [ 'CallContext' ]
$P1 = new [ 'Integer' ]
$P1 = 100
@@ -94,7 +94,7 @@
.end
.sub 'test_shift_unshift_indexed_access'
- $P0 = new [ 'CallSignature' ]
+ $P0 = new [ 'CallContext' ]
$P1 = new [ 'Integer' ]
$P1 = 100
@@ -134,7 +134,7 @@
.end
.sub 'test_indexed_access'
- $P0 = new [ 'CallSignature' ]
+ $P0 = new [ 'CallContext' ]
$P0[0] = 100
$I0 = elements $P0
@@ -193,7 +193,7 @@
.end
.sub 'test_indexed_boxing'
- $P0 = new [ 'CallSignature' ]
+ $P0 = new [ 'CallContext' ]
$P0[0] = 100
$P0[1] = 1.11
@@ -234,7 +234,7 @@
.end
.sub 'test_keyed_access'
- $P0 = new [ 'CallSignature' ]
+ $P0 = new [ 'CallContext' ]
$P0['foo'] = 100
$P0['bar'] = 1.11
@@ -262,7 +262,7 @@
.end
.sub 'test_exists'
- $P0 = new [ 'CallSignature' ]
+ $P0 = new [ 'CallContext' ]
$P0[0] = 111
$P0['foo'] = 100
@@ -281,7 +281,7 @@
.end
.sub 'test_clone'
- $P0 = new ['CallSignature']
+ $P0 = new ['CallContext']
$P0[0] = 42
$P0[1] = "Hello Parrot"
$P0['floatval'] = 3.14159
Deleted: trunk/t/pmc/callsignature.t
==============================================================================
--- trunk/t/pmc/callsignature.t Sun Dec 20 12:30:38 2009 (r43174)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,303 +0,0 @@
-#! parrot
-# Copyright (C) 2006-2009, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/callsignature.t - test CallSignature PMC
-
-=head1 SYNOPSIS
-
- % prove t/pmc/callsignature.t
-
-=head1 DESCRIPTION
-
-Tests the CallSignature PMC.
-
-=cut
-
-.sub 'main' :main
- .include 'test_more.pir'
-
- plan(66)
-
- test_instantiate()
- test_get_set_attrs()
- test_push_pop_indexed_access()
- test_shift_unshift_indexed_access()
- test_indexed_access()
- test_indexed_boxing()
- test_keyed_access()
- test_exists()
- test_clone()
-.end
-
-.sub 'test_instantiate'
- $P0 = new ['CallSignature']
- ok(1, 'Instantiated CallSignature')
-.end
-
-.sub 'test_get_set_attrs'
- $P0 = new ['CallSignature']
- $P5 = new 'String'
-
- $P5 = 'moonbomb'
- setattribute $P0, 'return_flags', $P5
- ok(1, 'set return_flags attribute')
- getattribute $P1, $P0, 'return_flags'
- is($P5,'moonbomb', 'got return_flags attribute')
-
- $P5 = 'cheese'
- setattribute $P0, 'arg_flags', $P5
- ok(1, 'set arg_flags attribute')
- getattribute $P1, $P0, 'arg_flags'
- is($P5,'cheese', 'got arg_flags attribute')
-.end
-
-.sub 'test_push_pop_indexed_access'
- $P0 = new [ 'CallSignature' ]
- $P1 = new [ 'Integer' ]
- $P1 = 100
-
- push $P0, $P1
- $I0 = elements $P0
- is( $I0, 1, 'elements after push' )
-
- $P2 = $P0[0]
- is( $P2, 100, 'push_pmc/get_pmc_keyed_int pair' )
- $P2 = pop $P0
- is( $P2, 100, 'push_pmc/pop_pmc pair' )
-
- $I0 = elements $P0
- is( $I0, 0, 'elements after pop' )
-
- push $P0, 200
- $I0 = $P0[0]
- is( $I0, 200, 'push_integer/get_integer_keyed_int pair' )
- $I0 = pop $P0
- is( $I0, 200, 'push_integer/pop_integer pair' )
-
- push $P0, 3.03
- $N0 = $P0[0]
- is( $N0, 3.03, 'push_number/get_number_keyed_int pair' )
- $N0 = pop $P0
- is( $N0, 3.03, 'push_number/pop_number pair' )
-
- push $P0, 'hello'
- $S0 = $P0[0]
- is( $S0, 'hello', 'push_string/get_string_keyed_int pair' )
- $S0 = pop $P0
- is( $S0, 'hello', 'push_string/pop_string pair' )
-
- $I0 = elements $P0
- is( $I0, 0, 'elements after push/pop' )
-.end
-
-.sub 'test_shift_unshift_indexed_access'
- $P0 = new [ 'CallSignature' ]
- $P1 = new [ 'Integer' ]
- $P1 = 100
-
- unshift $P0, $P1
-
- $I0 = elements $P0
- is( $I0, 1, 'elements after unshift' )
-
- $P2 = $P0[0]
- is( $P2, 100, 'unshift_pmc/get_pmc_keyed_int pair' )
- $P2 = shift $P0
- is( $P2, 100, 'unshift_pmc/shift_pmc pair' )
-
- $I0 = elements $P0
- is( $I0, 0, 'elements after unshift/shift' )
-
- unshift $P0, 200
- $I0 = $P0[0]
- is( $I0, 200, 'unshift_integer/get_integer_keyed_int pair' )
- $I0 = shift $P0
- is( $I0, 200, 'unshift_integer/shift_integer pair' )
-
- unshift $P0, 3.03
- $N0 = $P0[0]
- is( $N0, 3.03, 'unshift_number/get_number_keyed_int pair' )
- $N0 = shift $P0
- is( $N0, 3.03, 'unshift_number/shift_number pair' )
-
- unshift $P0, 'hello'
- $S0 = $P0[0]
- is( $S0, 'hello', 'unshift_string/get_string_keyed_int pair' )
- $S0 = shift $P0
- is( $S0, 'hello', 'unshift_string/shift_string pair' )
-
- $I0 = elements $P0
- is( $I0, 0, 'elements after unshift/shift' )
-.end
-
-.sub 'test_indexed_access'
- $P0 = new [ 'CallSignature' ]
- $P0[0] = 100
-
- $I0 = elements $P0
- is( $I0, 1, 'elements after set_*_indexed' )
-
- $P0[1] = 1.11
-
- $I0 = elements $P0
- is( $I0, 2, 'elements after set_*_indexed' )
-
- $S0 = '2.22'
- $P0[2] = $S0
-
- $I0 = elements $P0
- is( $I0, 3, 'elements after set_*_indexed' )
-
- $P1 = new [ 'Float' ]
- $P1 = 3.33
- $P0[3] = $P1
-
- $I0 = elements $P0
- is( $I0, 4, 'elements after set_*_indexed' )
-
- $I1 = $P0[0]
- is( $I1, 100, 'set_integer_keyed_int/get_integer_keyed_int pair' )
-
- $N1 = $P0[1]
- is( $N1, 1.11, 'set_number_keyed_int/get_number_keyed_int pair' )
-
- $S1 = $P0[2]
- is( $S1, '2.22', 'set_string_keyed_int/get_string_keyed_int pair' )
-
- $P1 = $P0[3]
- is( $P1, 3.33, 'set_pmc_keyed_int/get_pmc_keyed_int pair' )
-
- $I1 = shift $P0
- is( $I1, 100, 'set_integer_keyed_int/shift_integer pair' )
-
- $N1 = $P0[0]
- is( $N1, 1.11, 'shift_* should remove elements from array' )
-
- $N1 = shift $P0
- is( $N1, 1.11, 'set_number_keyed_int/shift_number pair' )
-
- $S1 = $P0[0]
- is( $S1, '2.22', 'shift_* should remove elements from array' )
-
- $S1 = shift $P0
- is( $S1, '2.22', 'set_string_keyed_int/shift_string pair' )
-
- $P1 = $P0[0]
- is( $P1, 3.33, 'shift_* should remove elements from array' )
-
- $P1 = shift $P0
- is( $P1, 3.33, 'set_pmc_keyed_int/shift_pmc pair' )
-.end
-
-.sub 'test_indexed_boxing'
- $P0 = new [ 'CallSignature' ]
- $P0[0] = 100
- $P0[1] = 1.11
-
- $S0 = '2.22'
- $P0[2] = $S0
-
- $P1 = new [ 'Float' ]
- $P1 = 3.33
- $P0[3] = $P1
-
- $I0 = $P0[1]
- is( $I0, 1, 'indexed float converted to int on get_integer_keyed_int' )
- $I0 = $P0[2]
- is( $I0, 2, 'indexed string converted to int on get_integer_keyed_int' )
- $I0 = $P0[3]
- is( $I0, 3, 'indexed PMC converted to int on get_integer_keyed_int' )
-
- $N0 = $P0[0]
- is( $N0, 100.0, 'indexed integer converted to num on get_number_keyed_int' )
- $N0 = $P0[2]
- is( $N0, 2.22, 'indexed string converted to num on get_number_keyed_int' )
- $N0 = $P0[3]
- is( $N0, 3.33, 'indexed PMC converted to int num get_number_keyed_int' )
-
- $S0 = $P0[0]
- is( $S0, '100', 'indexed int converted to string on get_string_keyed_int' )
- $S0 = $P0[1]
- is( $S0, '1.11', 'indexed num converted to string on get_string_keyed_int' )
- $S0 = $P0[3]
- is( $S0, '3.33', 'indexed PMC converted to string get_string_keyed_int' )
-
- $P1 = $P0[0]
- is( $P1, 100, 'indexed int converted to PMC on get_pmc_keyed_int' )
- $P1 = $P0[1]
- is( $P1, 1.11, 'indexed float converted to PMC on get_pmc_keyed_int' )
- $P1 = $P0[2]
- is( $P1, 2.22, 'indexed string converted to PMC on get_pmc_keyed_int' )
-.end
-
-.sub 'test_keyed_access'
- $P0 = new [ 'CallSignature' ]
-
- $P0['foo'] = 100
- $P0['bar'] = 1.11
- $P0['baz'] = '2.22'
- $P1 = new [ 'Float' ]
- $P1 = 3.33
-
- $P0['qux'] = $P1
-
- $I0 = $P0['foo']
- is( $I0, 100, 'set/get_intval_keyed_str' )
-
- $N0 = $P0['bar']
- is( $N0, 1.11, 'set/get_number_keyed_str' )
-
- $S0 = $P0['baz']
- is( $S0, '2.22', 'set/get_string_keyed_str' )
-
- $P2 = $P0['qux']
- is( $P2, 3.33, 'set/get_pmc_keyed_str' )
-
- $P1 = getattribute $P0, 'named'
- $I0 = elements $P1
- is( $I0, 4, 'elements after set_*_keyed' )
-.end
-
-.sub 'test_exists'
- $P0 = new [ 'CallSignature' ]
-
- $P0[0] = 111
- $P0['foo'] = 100
-
- $I0 = exists $P0[0]
- ok( $I0, 'exists_keyed_int' )
-
- $I0 = exists $P0['foo']
- ok( $I0, 'exists_keyed_str' )
-
- $I0 = exists $P0[100]
- nok( $I0, 'exists_keyed_int -- non-existant' )
-
- $I0 = exists $P0['bar']
- nok( $I0, 'exists_keyed_str -- non-existant' )
-.end
-
-.sub 'test_clone'
- $P0 = new ['CallSignature']
- $P0[0] = 42
- $P0[1] = "Hello Parrot"
- $P0['floatval'] = 3.14159
-
- $P1 = clone $P0
-
- $I2 = $P1[0]
- is($I2, 42, 'clone - integer positional cloned')
- $S2 = $P1[1]
- is($S2, "Hello Parrot", 'clone - string positional cloned')
- $N2 = $P1['floatval']
- is($N2, 3.14159, 'clone - named number cloned')
-.end
-
-# Local Variables:
-# mode: pir
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
Modified: trunk/t/pmc/context.t
==============================================================================
--- trunk/t/pmc/context.t Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/t/pmc/context.t Sun Dec 20 12:30:38 2009 (r43175)
@@ -4,7 +4,7 @@
=head1 NAME
-t/pmc/context.t - test Context PMC
+t/pmc/context.t - test CallContext PMC
=head1 SYNOPSIS
@@ -12,9 +12,9 @@
=head1 DESCRIPTION
-Tests the Context PMC.
+Tests the CallContext PMC.
-TODO: Implement real tests when Context PMC will be migrated to use ATTRibutes.
+TODO: Implement real tests when CallContext PMC will be migrated to use ATTRibutes.
=cut
@@ -36,9 +36,9 @@
.end
.sub 'test_new'
- $P0 = new ['Context']
+ $P0 = new ['CallContext']
sweep 1
- ok(1, 'Instantiated .Context')
+ ok(1, 'Instantiated .CallContext')
.end
# Put test_inspect into Namespace, as method, with outer, etc.
@@ -59,41 +59,41 @@
$P0 = getinterp
ctx = $P0['context']
$I0 = defined ctx
- ok($I0, "Got Context")
+ ok($I0, "Got CallContext")
# Check current_sub first. Other tests relying on it
$P0 = getattribute ctx, 'current_sub'
- is($P0, 'test_inspect', 'Got Context.current_sub')
+ is($P0, 'test_inspect', 'Got CallContext.current_sub')
$P0 = getattribute ctx, 'caller_ctx'
- $I0 = isa $P0, 'Context'
- ok($I0, 'Got Context.caller_ctx')
+ $I0 = isa $P0, 'CallContext'
+ ok($I0, 'Got CallContext.caller_ctx')
$P0 = getattribute $P0, 'current_sub'
is($P0, 'main', '... from proper Sub')
$P0 = getattribute ctx, 'outer_ctx'
- $I0 = isa $P0, 'Context'
- ok($I0, 'Got Context.outer_ctx')
+ $I0 = isa $P0, 'CallContext'
+ ok($I0, 'Got CallContext.outer_ctx')
$P0 = getattribute $P0, 'current_sub'
is($P0, 'load', '... from proper Sub')
$P0 = getattribute ctx, 'lex_pad'
$I0 = isa $P0, 'LexPad'
- ok($I0, 'Got Context.lex_pad')
+ ok($I0, 'Got CallContext.lex_pad')
$P1 = $P0['foo_ctx']
$I0 = defined $P1
ok($I0, '... with proper content')
$P0 = getattribute ctx, 'current_cont'
$I0 = isa $P0, 'Continuation'
- ok($I0, 'Got Context.current_cont')
+ ok($I0, 'Got CallContext.current_cont')
$P0 = getattribute ctx, 'current_object'
$I0 = isa $P0, 'Foo'
- ok($I0, 'Got Context.current_object')
+ ok($I0, 'Got CallContext.current_object')
$P0 = getattribute ctx, 'current_namespace'
- ok($P0, 'Got Context.current_namespace')
+ ok($P0, 'Got CallContext.current_namespace')
$P1 = $P0['test_inspect']
is($P1, 'test_inspect', '... with proper content')
@@ -107,7 +107,7 @@
$P0 = getattribute ctx, 'handlers'
$I1 = elements $P0
dec $I1
- is($I0, $I1, 'Got Context.handlers')
+ is($I0, $I1, 'Got CallContext.handlers')
# Check absurd fields
$I0 = 1
@@ -115,15 +115,15 @@
$I0 = 0
cought:
pop_eh
- ok($I0, "No world domination in this Context")
+ ok($I0, "No world domination in this CallContext")
# Current HLL shouldn't be zero
$P0 = getattribute ctx, 'current_HLL'
$I0 = $P0
- ok($I0, 'Got Context.current_HLL')
+ ok($I0, 'Got CallContext.current_HLL')
$P0 = getattribute ctx, 'current_hll'
- ok($P0, 'FOO', 'Got Context.current_hll')
+ ok($P0, 'FOO', 'Got CallContext.current_hll')
done:
pop_eh
@@ -136,7 +136,7 @@
.local pmc bt
bt = 'test_bt1'()
$I0 = defined bt
- ok($I0, "Got Context.backtrace()")
+ ok($I0, "Got CallContext.backtrace()")
# We should have more than 3 elements
$I0 = elements bt
Modified: trunk/t/pmc/parrotinterpreter.t
==============================================================================
--- trunk/t/pmc/parrotinterpreter.t Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/t/pmc/parrotinterpreter.t Sun Dec 20 12:30:38 2009 (r43175)
@@ -93,7 +93,7 @@
is($S0, 'bar', 'Got ParrotInterp.annotations')
$P0 = interp['context';0]
- $I0 = isa $P0, 'Context'
+ $I0 = isa $P0, 'CallContext'
ok($I0, 'Got ParrotInterp.context')
# Add more tests for Context. E.g. it is correct Context by inspecting it.
Modified: trunk/tools/build/nativecall.pl
==============================================================================
--- trunk/tools/build/nativecall.pl Sun Dec 20 09:49:36 2009 (r43174)
+++ trunk/tools/build/nativecall.pl Sun Dec 20 12:30:38 2009 (r43175)
@@ -224,7 +224,7 @@
#include "pmc/pmc_managedstruct.h"
#include "pmc/pmc_nci.h"
#include "pmc/pmc_pointer.h"
-#include "pmc/pmc_context.h"
+#include "pmc/pmc_callcontext.h"
#include "nci.str"
/* HEADERIZER HFILE: none */
More information about the parrot-commits
mailing list