[svn:parrot] r49367 - in branches/string_macros: . compilers/imcc compilers/opsc/src/Ops compilers/opsc/src/Ops/Trans compilers/pct/src/PAST config/gen/makefiles docs docs/pdds docs/pdds/draft examples/benchmarks include/parrot src src/call src/gc src/interp src/io src/ops src/pmc src/runcore t/compilers/imcc/syn t/compilers/opsc t/op t/pmc t/pmc/testlib t/run t/tools tools/release
nwellnhof at svn.parrot.org
nwellnhof at svn.parrot.org
Tue Sep 28 19:35:35 UTC 2010
Author: nwellnhof
Date: Tue Sep 28 19:35:30 2010
New Revision: 49367
URL: https://trac.parrot.org/parrot/changeset/49367
Log:
Merge trunk
Added:
branches/string_macros/examples/benchmarks/stress_integers.pir
branches/string_macros/include/parrot/list.h
branches/string_macros/src/gc/fixed_allocator.c
branches/string_macros/src/gc/fixed_allocator.h
branches/string_macros/src/gc/gc_ms2.c
branches/string_macros/src/gc/variable_size_pool.c
branches/string_macros/src/gc/variable_size_pool.h
branches/string_macros/src/list.c
branches/string_macros/t/op/gc-non-recursive.t
Deleted:
branches/string_macros/docs/pdds/draft/pdd31_hll_interop.pod
branches/string_macros/src/pmc/packfilefixupentry.pmc
branches/string_macros/src/pmc/packfilefixuptable.pmc
branches/string_macros/t/pmc/packfilefixupentry.t
branches/string_macros/t/pmc/packfilefixuptable.t
Modified:
branches/string_macros/MANIFEST
branches/string_macros/MANIFEST.SKIP
branches/string_macros/NEWS
branches/string_macros/PBC_COMPAT
branches/string_macros/compilers/imcc/imcparser.c
branches/string_macros/compilers/imcc/imcparser.h
branches/string_macros/compilers/imcc/pbc.c
branches/string_macros/compilers/opsc/src/Ops/Emitter.pm
branches/string_macros/compilers/opsc/src/Ops/Trans/C.pm
branches/string_macros/compilers/pct/src/PAST/Compiler.pir
branches/string_macros/config/gen/makefiles/root.in
branches/string_macros/docs/embed.pod
branches/string_macros/docs/pdds/pdd09_gc.pod
branches/string_macros/include/parrot/call.h
branches/string_macros/include/parrot/context.h
branches/string_macros/include/parrot/gc_api.h
branches/string_macros/include/parrot/interpreter.h
branches/string_macros/include/parrot/packfile.h
branches/string_macros/include/parrot/pobj.h
branches/string_macros/include/parrot/settings.h
branches/string_macros/src/call/context.c
branches/string_macros/src/call/context_accessors.c
branches/string_macros/src/debug.c
branches/string_macros/src/embed.c
branches/string_macros/src/gc/api.c
branches/string_macros/src/gc/gc_ms.c
branches/string_macros/src/gc/gc_private.h
branches/string_macros/src/gc/mark_sweep.c
branches/string_macros/src/gc/string_gc.c
branches/string_macros/src/gc/system.c
branches/string_macros/src/interp/inter_create.c
branches/string_macros/src/io/buffer.c
branches/string_macros/src/key.c
branches/string_macros/src/main.c
branches/string_macros/src/ops/cmp.ops
branches/string_macros/src/ops/core_ops.c
branches/string_macros/src/packdump.c
branches/string_macros/src/packfile.c
branches/string_macros/src/packout.c
branches/string_macros/src/pbc_dump.c
branches/string_macros/src/pbc_merge.c
branches/string_macros/src/pmc/callcontext.pmc
branches/string_macros/src/pmc/eval.pmc
branches/string_macros/src/pmc/exceptionhandler.pmc
branches/string_macros/src/pmc/filehandle.pmc
branches/string_macros/src/pmc/imageiofreeze.pmc
branches/string_macros/src/pmc/imageiosize.pmc
branches/string_macros/src/pmc/imageiothaw.pmc
branches/string_macros/src/pmc/key.pmc
branches/string_macros/src/pmc/packfileconstanttable.pmc
branches/string_macros/src/pmc/packfiledirectory.pmc
branches/string_macros/src/pmc/sub.pmc
branches/string_macros/src/runcore/trace.c
branches/string_macros/src/scheduler.c
branches/string_macros/t/compilers/imcc/syn/regressions.t
branches/string_macros/t/compilers/opsc/07-emitter.t
branches/string_macros/t/op/gc-leaky-box.t
branches/string_macros/t/op/gc-leaky-call.t
branches/string_macros/t/op/string_mem.t
branches/string_macros/t/pmc/bytebuffer.t
branches/string_macros/t/pmc/eval.t
branches/string_macros/t/pmc/filehandle.t
branches/string_macros/t/pmc/io.t
branches/string_macros/t/pmc/key.t
branches/string_macros/t/pmc/packfile.t
branches/string_macros/t/pmc/packfileannotations.t
branches/string_macros/t/pmc/packfileconstanttable.t
branches/string_macros/t/pmc/packfiledirectory.t
branches/string_macros/t/pmc/packfilerawsegment.t
branches/string_macros/t/pmc/testlib/packfile_common.pir
branches/string_macros/t/run/options.t
branches/string_macros/t/tools/pbc_dump.t
branches/string_macros/tools/release/release.json
Modified: branches/string_macros/MANIFEST
==============================================================================
--- branches/string_macros/MANIFEST Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/MANIFEST Tue Sep 28 19:35:30 2010 (r49367)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Sat Sep 18 03:19:23 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Sat Sep 25 01:48:30 2010 UT
#
# See below for documentation on the format of this file.
#
@@ -432,7 +432,6 @@
docs/pdds/draft/pdd16_native_call.pod [doc]
docs/pdds/draft/pdd29_compiler_tools.pod [doc]
docs/pdds/draft/pdd31_hll.pod [doc]
-docs/pdds/draft/pdd31_hll_interop.pod [doc]
docs/pdds/pdd00_pdd.pod [doc]
docs/pdds/pdd03_calling_conventions.pod [doc]
docs/pdds/pdd07_codingstd.pod [doc]
@@ -584,6 +583,7 @@
examples/benchmarks/stress2.pl [examples]
examples/benchmarks/stress2.rb [examples]
examples/benchmarks/stress3.pasm [examples]
+examples/benchmarks/stress_integers.pir [examples]
examples/benchmarks/stress_strings.pir [examples]
examples/benchmarks/vpm.pir [examples]
examples/benchmarks/vpm.pl [examples]
@@ -971,6 +971,7 @@
include/parrot/io_win32.h [main]include
include/parrot/key.h [main]include
include/parrot/library.h [main]include
+include/parrot/list.h [main]include
include/parrot/longopt.h [main]include
include/parrot/memory.h [main]include
include/parrot/misc.h [main]include
@@ -1283,14 +1284,19 @@
src/gc/alloc_memory.c []
src/gc/alloc_resources.c []
src/gc/api.c []
+src/gc/fixed_allocator.c []
+src/gc/fixed_allocator.h []
src/gc/gc_inf.c []
src/gc/gc_ms.c []
+src/gc/gc_ms2.c []
src/gc/gc_private.h []
src/gc/malloc.c []
src/gc/malloc_trace.c []
src/gc/mark_sweep.c []
src/gc/string_gc.c []
src/gc/system.c []
+src/gc/variable_size_pool.c []
+src/gc/variable_size_pool.h []
src/global_setup.c []
src/hash.c []
src/hll.c []
@@ -1312,6 +1318,7 @@
src/key.c []
src/libnci_test.def []
src/library.c []
+src/list.c []
src/longopt.c []
src/main.c []
src/misc.c []
@@ -1405,8 +1412,6 @@
src/pmc/packfileconstanttable.pmc []
src/pmc/packfiledebug.pmc []
src/pmc/packfiledirectory.pmc []
-src/pmc/packfilefixupentry.pmc []
-src/pmc/packfilefixuptable.pmc []
src/pmc/packfilerawsegment.pmc []
src/pmc/packfilesegment.pmc []
src/pmc/parrotinterpreter.pmc []
@@ -1798,6 +1803,7 @@
t/op/gc-active-buffers.t [test]
t/op/gc-leaky-box.t [test]
t/op/gc-leaky-call.t [test]
+t/op/gc-non-recursive.t [test]
t/op/gc.t [test]
t/op/globals.t [test]
t/op/ifunless.t [test]
@@ -1907,8 +1913,6 @@
t/pmc/packfileannotations.t [test]
t/pmc/packfileconstanttable.t [test]
t/pmc/packfiledirectory.t [test]
-t/pmc/packfilefixupentry.t [test]
-t/pmc/packfilefixuptable.t [test]
t/pmc/packfilerawsegment.t [test]
t/pmc/packfilesegment.t [test]
t/pmc/parrotclass.t [test]
Modified: branches/string_macros/MANIFEST.SKIP
==============================================================================
--- branches/string_macros/MANIFEST.SKIP Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/MANIFEST.SKIP Tue Sep 28 19:35:30 2010 (r49367)
@@ -1,6 +1,6 @@
# ex: set ro:
# $Id$
-# generated by tools/dev/mk_manifest_and_skip.pl Tue Sep 14 05:49:01 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Thu Sep 23 09:20:45 2010 UT
#
# This file should contain a transcript of the svn:ignore properties
# of the directories in the Parrot subversion repository. (Needed for
Modified: branches/string_macros/NEWS
==============================================================================
--- branches/string_macros/NEWS Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/NEWS Tue Sep 28 19:35:30 2010 (r49367)
@@ -1,5 +1,8 @@
# $Id$
+New in 2.9.0
+ <already adding news for 2.9.0 would be nice>
+
New in 2.8.0
- Core
+ Inlined hashing and comparison functions
Modified: branches/string_macros/PBC_COMPAT
==============================================================================
--- branches/string_macros/PBC_COMPAT Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/PBC_COMPAT Tue Sep 28 19:35:30 2010 (r49367)
@@ -28,6 +28,7 @@
# please insert tab separated entries at the top of the list
+8.5 2010.08.24 plobsing eliminate fixup table
8.4 2010.09.19 cotto add imageiothaw and imageiofreeze PMCs (plobsing)
8.3 2010.09.15 luben removed logical vtables
8.2 2010.08.19 cotto minor version bump for 2.7.0
Modified: branches/string_macros/compilers/imcc/imcparser.c
==============================================================================
--- branches/string_macros/compilers/imcc/imcparser.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/compilers/imcc/imcparser.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -9,27 +9,25 @@
*/
/* HEADERIZER HFILE: none */
/* HEADERIZER STOP */
-/* A Bison parser, made by GNU Bison 2.3. */
+/* A Bison parser, made by GNU Bison 2.4.3. */
/* 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
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2009, 2010 Free Software Foundation, Inc.
+
+ 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 +38,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 +56,7 @@
#define YYBISON 1
/* Bison version. */
-#define YYBISON_VERSION "2.3"
+#define YYBISON_VERSION "2.4.3"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -66,259 +64,20 @@
/* Pure parsers. */
#define YYPURE 1
-/* Using locations. */
-#define YYLSP_NEEDED 0
-
-
+/* Push parsers. */
+#define YYPUSH 0
-/* 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,
- SOL = 260,
- HLL = 261,
- TK_LINE = 262,
- TK_FILE = 263,
- GOTO = 264,
- ARG = 265,
- IF = 266,
- UNLESS = 267,
- PNULL = 268,
- SET_RETURN = 269,
- SET_YIELD = 270,
- ADV_FLAT = 271,
- ADV_SLURPY = 272,
- ADV_OPTIONAL = 273,
- ADV_OPT_FLAG = 274,
- ADV_NAMED = 275,
- ADV_ARROW = 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,
- GLOBAL_CONST = 287,
- PLUS_ASSIGN = 288,
- MINUS_ASSIGN = 289,
- MUL_ASSIGN = 290,
- DIV_ASSIGN = 291,
- CONCAT_ASSIGN = 292,
- BAND_ASSIGN = 293,
- BOR_ASSIGN = 294,
- BXOR_ASSIGN = 295,
- FDIV = 296,
- FDIV_ASSIGN = 297,
- MOD_ASSIGN = 298,
- SHR_ASSIGN = 299,
- SHL_ASSIGN = 300,
- SHR_U_ASSIGN = 301,
- SHIFT_LEFT = 302,
- SHIFT_RIGHT = 303,
- INTV = 304,
- FLOATV = 305,
- STRINGV = 306,
- PMCV = 307,
- LOG_XOR = 308,
- RELOP_EQ = 309,
- RELOP_NE = 310,
- RELOP_GT = 311,
- RELOP_GTE = 312,
- RELOP_LT = 313,
- RELOP_LTE = 314,
- RESULT = 315,
- RETURN = 316,
- TAILCALL = 317,
- YIELDT = 318,
- GET_RESULTS = 319,
- POW = 320,
- SHIFT_RIGHT_U = 321,
- LOG_AND = 322,
- LOG_OR = 323,
- COMMA = 324,
- ESUB = 325,
- DOTDOT = 326,
- PCC_BEGIN = 327,
- PCC_END = 328,
- PCC_CALL = 329,
- PCC_SUB = 330,
- PCC_BEGIN_RETURN = 331,
- PCC_END_RETURN = 332,
- PCC_BEGIN_YIELD = 333,
- PCC_END_YIELD = 334,
- NCI_CALL = 335,
- METH_CALL = 336,
- INVOCANT = 337,
- MAIN = 338,
- LOAD = 339,
- INIT = 340,
- IMMEDIATE = 341,
- POSTCOMP = 342,
- METHOD = 343,
- ANON = 344,
- OUTER = 345,
- NEED_LEX = 346,
- MULTI = 347,
- VTABLE_METHOD = 348,
- LOADLIB = 349,
- SUB_INSTANCE_OF = 350,
- SUBID = 351,
- NS_ENTRY = 352,
- UNIQUE_REG = 353,
- LABEL = 354,
- EMIT = 355,
- EOM = 356,
- IREG = 357,
- NREG = 358,
- SREG = 359,
- PREG = 360,
- IDENTIFIER = 361,
- REG = 362,
- MACRO = 363,
- ENDM = 364,
- STRINGC = 365,
- INTC = 366,
- FLOATC = 367,
- USTRINGC = 368,
- PARROT_OP = 369,
- VAR = 370,
- LINECOMMENT = 371,
- FILECOMMENT = 372,
- DOT = 373,
- CONCAT = 374
- };
-#endif
-/* Tokens. */
-#define LOW_PREC 258
-#define PARAM 259
-#define SOL 260
-#define HLL 261
-#define TK_LINE 262
-#define TK_FILE 263
-#define GOTO 264
-#define ARG 265
-#define IF 266
-#define UNLESS 267
-#define PNULL 268
-#define SET_RETURN 269
-#define SET_YIELD 270
-#define ADV_FLAT 271
-#define ADV_SLURPY 272
-#define ADV_OPTIONAL 273
-#define ADV_OPT_FLAG 274
-#define ADV_NAMED 275
-#define ADV_ARROW 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 GLOBAL_CONST 287
-#define PLUS_ASSIGN 288
-#define MINUS_ASSIGN 289
-#define MUL_ASSIGN 290
-#define DIV_ASSIGN 291
-#define CONCAT_ASSIGN 292
-#define BAND_ASSIGN 293
-#define BOR_ASSIGN 294
-#define BXOR_ASSIGN 295
-#define FDIV 296
-#define FDIV_ASSIGN 297
-#define MOD_ASSIGN 298
-#define SHR_ASSIGN 299
-#define SHL_ASSIGN 300
-#define SHR_U_ASSIGN 301
-#define SHIFT_LEFT 302
-#define SHIFT_RIGHT 303
-#define INTV 304
-#define FLOATV 305
-#define STRINGV 306
-#define PMCV 307
-#define LOG_XOR 308
-#define RELOP_EQ 309
-#define RELOP_NE 310
-#define RELOP_GT 311
-#define RELOP_GTE 312
-#define RELOP_LT 313
-#define RELOP_LTE 314
-#define RESULT 315
-#define RETURN 316
-#define TAILCALL 317
-#define YIELDT 318
-#define GET_RESULTS 319
-#define POW 320
-#define SHIFT_RIGHT_U 321
-#define LOG_AND 322
-#define LOG_OR 323
-#define COMMA 324
-#define ESUB 325
-#define DOTDOT 326
-#define PCC_BEGIN 327
-#define PCC_END 328
-#define PCC_CALL 329
-#define PCC_SUB 330
-#define PCC_BEGIN_RETURN 331
-#define PCC_END_RETURN 332
-#define PCC_BEGIN_YIELD 333
-#define PCC_END_YIELD 334
-#define NCI_CALL 335
-#define METH_CALL 336
-#define INVOCANT 337
-#define MAIN 338
-#define LOAD 339
-#define INIT 340
-#define IMMEDIATE 341
-#define POSTCOMP 342
-#define METHOD 343
-#define ANON 344
-#define OUTER 345
-#define NEED_LEX 346
-#define MULTI 347
-#define VTABLE_METHOD 348
-#define LOADLIB 349
-#define SUB_INSTANCE_OF 350
-#define SUBID 351
-#define NS_ENTRY 352
-#define UNIQUE_REG 353
-#define LABEL 354
-#define EMIT 355
-#define EOM 356
-#define IREG 357
-#define NREG 358
-#define SREG 359
-#define PREG 360
-#define IDENTIFIER 361
-#define REG 362
-#define MACRO 363
-#define ENDM 364
-#define STRINGC 365
-#define INTC 366
-#define FLOATC 367
-#define USTRINGC 368
-#define PARROT_OP 369
-#define VAR 370
-#define LINECOMMENT 371
-#define FILECOMMENT 372
-#define DOT 373
-#define CONCAT 374
+/* Pull parsers. */
+#define YYPULL 1
+/* Using locations. */
+#define YYLSP_NEEDED 0
/* Copy the first part of user declarations. */
+
+/* Line 189 of yacc.c */
#line 1 "compilers/imcc/imcc.y"
/*
@@ -1305,49 +1064,304 @@
+/* Line 189 of yacc.c */
+#line 1058 "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,
+ SOL = 260,
+ HLL = 261,
+ TK_LINE = 262,
+ TK_FILE = 263,
+ GOTO = 264,
+ ARG = 265,
+ IF = 266,
+ UNLESS = 267,
+ PNULL = 268,
+ SET_RETURN = 269,
+ SET_YIELD = 270,
+ ADV_FLAT = 271,
+ ADV_SLURPY = 272,
+ ADV_OPTIONAL = 273,
+ ADV_OPT_FLAG = 274,
+ ADV_NAMED = 275,
+ ADV_ARROW = 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,
+ GLOBAL_CONST = 287,
+ PLUS_ASSIGN = 288,
+ MINUS_ASSIGN = 289,
+ MUL_ASSIGN = 290,
+ DIV_ASSIGN = 291,
+ CONCAT_ASSIGN = 292,
+ BAND_ASSIGN = 293,
+ BOR_ASSIGN = 294,
+ BXOR_ASSIGN = 295,
+ FDIV = 296,
+ FDIV_ASSIGN = 297,
+ MOD_ASSIGN = 298,
+ SHR_ASSIGN = 299,
+ SHL_ASSIGN = 300,
+ SHR_U_ASSIGN = 301,
+ SHIFT_LEFT = 302,
+ SHIFT_RIGHT = 303,
+ INTV = 304,
+ FLOATV = 305,
+ STRINGV = 306,
+ PMCV = 307,
+ LOG_XOR = 308,
+ RELOP_EQ = 309,
+ RELOP_NE = 310,
+ RELOP_GT = 311,
+ RELOP_GTE = 312,
+ RELOP_LT = 313,
+ RELOP_LTE = 314,
+ RESULT = 315,
+ RETURN = 316,
+ TAILCALL = 317,
+ YIELDT = 318,
+ GET_RESULTS = 319,
+ POW = 320,
+ SHIFT_RIGHT_U = 321,
+ LOG_AND = 322,
+ LOG_OR = 323,
+ COMMA = 324,
+ ESUB = 325,
+ DOTDOT = 326,
+ PCC_BEGIN = 327,
+ PCC_END = 328,
+ PCC_CALL = 329,
+ PCC_SUB = 330,
+ PCC_BEGIN_RETURN = 331,
+ PCC_END_RETURN = 332,
+ PCC_BEGIN_YIELD = 333,
+ PCC_END_YIELD = 334,
+ NCI_CALL = 335,
+ METH_CALL = 336,
+ INVOCANT = 337,
+ MAIN = 338,
+ LOAD = 339,
+ INIT = 340,
+ IMMEDIATE = 341,
+ POSTCOMP = 342,
+ METHOD = 343,
+ ANON = 344,
+ OUTER = 345,
+ NEED_LEX = 346,
+ MULTI = 347,
+ VTABLE_METHOD = 348,
+ LOADLIB = 349,
+ SUB_INSTANCE_OF = 350,
+ SUBID = 351,
+ NS_ENTRY = 352,
+ UNIQUE_REG = 353,
+ LABEL = 354,
+ EMIT = 355,
+ EOM = 356,
+ IREG = 357,
+ NREG = 358,
+ SREG = 359,
+ PREG = 360,
+ IDENTIFIER = 361,
+ REG = 362,
+ MACRO = 363,
+ ENDM = 364,
+ STRINGC = 365,
+ INTC = 366,
+ FLOATC = 367,
+ USTRINGC = 368,
+ PARROT_OP = 369,
+ VAR = 370,
+ LINECOMMENT = 371,
+ FILECOMMENT = 372,
+ DOT = 373,
+ CONCAT = 374
+ };
+#endif
+/* Tokens. */
+#define LOW_PREC 258
+#define PARAM 259
+#define SOL 260
+#define HLL 261
+#define TK_LINE 262
+#define TK_FILE 263
+#define GOTO 264
+#define ARG 265
+#define IF 266
+#define UNLESS 267
+#define PNULL 268
+#define SET_RETURN 269
+#define SET_YIELD 270
+#define ADV_FLAT 271
+#define ADV_SLURPY 272
+#define ADV_OPTIONAL 273
+#define ADV_OPT_FLAG 274
+#define ADV_NAMED 275
+#define ADV_ARROW 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 GLOBAL_CONST 287
+#define PLUS_ASSIGN 288
+#define MINUS_ASSIGN 289
+#define MUL_ASSIGN 290
+#define DIV_ASSIGN 291
+#define CONCAT_ASSIGN 292
+#define BAND_ASSIGN 293
+#define BOR_ASSIGN 294
+#define BXOR_ASSIGN 295
+#define FDIV 296
+#define FDIV_ASSIGN 297
+#define MOD_ASSIGN 298
+#define SHR_ASSIGN 299
+#define SHL_ASSIGN 300
+#define SHR_U_ASSIGN 301
+#define SHIFT_LEFT 302
+#define SHIFT_RIGHT 303
+#define INTV 304
+#define FLOATV 305
+#define STRINGV 306
+#define PMCV 307
+#define LOG_XOR 308
+#define RELOP_EQ 309
+#define RELOP_NE 310
+#define RELOP_GT 311
+#define RELOP_GTE 312
+#define RELOP_LT 313
+#define RELOP_LTE 314
+#define RESULT 315
+#define RETURN 316
+#define TAILCALL 317
+#define YIELDT 318
+#define GET_RESULTS 319
+#define POW 320
+#define SHIFT_RIGHT_U 321
+#define LOG_AND 322
+#define LOG_OR 323
+#define COMMA 324
+#define ESUB 325
+#define DOTDOT 326
+#define PCC_BEGIN 327
+#define PCC_END 328
+#define PCC_CALL 329
+#define PCC_SUB 330
+#define PCC_BEGIN_RETURN 331
+#define PCC_END_RETURN 332
+#define PCC_BEGIN_YIELD 333
+#define PCC_END_YIELD 334
+#define NCI_CALL 335
+#define METH_CALL 336
+#define INVOCANT 337
+#define MAIN 338
+#define LOAD 339
+#define INIT 340
+#define IMMEDIATE 341
+#define POSTCOMP 342
+#define METHOD 343
+#define ANON 344
+#define OUTER 345
+#define NEED_LEX 346
+#define MULTI 347
+#define VTABLE_METHOD 348
+#define LOADLIB 349
+#define SUB_INSTANCE_OF 350
+#define SUBID 351
+#define NS_ENTRY 352
+#define UNIQUE_REG 353
+#define LABEL 354
+#define EMIT 355
+#define EOM 356
+#define IREG 357
+#define NREG 358
+#define SREG 359
+#define PREG 360
+#define IDENTIFIER 361
+#define REG 362
+#define MACRO 363
+#define ENDM 364
+#define STRINGC 365
+#define INTC 366
+#define FLOATC 367
+#define USTRINGC 368
+#define PARROT_OP 369
+#define VAR 370
+#define LINECOMMENT 371
+#define FILECOMMENT 372
+#define DOT 373
+#define CONCAT 374
+
+
-/* Enabling the token table. */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 986 "compilers/imcc/imcc.y"
{
+
+/* Line 214 of yacc.c */
+#line 986 "compilers/imcc/imcc.y"
+
IdList * idlist;
int t;
char * s;
SymReg * sr;
Instruction *i;
-}
-/* Line 187 of yacc.c. */
-#line 1327 "compilers/imcc/imcparser.c"
- YYSTYPE;
+
+
+
+/* Line 214 of yacc.c */
+#line 1342 "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 1340 "compilers/imcc/imcparser.c"
+/* Line 264 of yacc.c */
+#line 1354 "compilers/imcc/imcparser.c"
#ifdef short
# undef short
@@ -1397,7 +1411,7 @@
#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
#ifndef YY_
-# if YYENABLE_NLS
+# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
# define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -1422,14 +1436,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
@@ -1510,9 +1524,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)
@@ -1546,12 +1560,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); \
} \
@@ -1835,28 +1849,29 @@
"DOT", "CONCAT", "'='", "'['", "']'", "';'", "'('", "')'", "'!'", "'~'",
"'-'", "'+'", "'*'", "'/'", "'%'", "'&'", "'|'", "$accept", "program",
"compilation_units", "compilation_unit", "pragma", "location_directive",
- "annotate_directive", "hll_def", "constdef", "@1", "pmc_const", "@2",
- "any_string", "pasmcode", "pasmline", "pasm_inst", "@3", "@4",
- "pasm_args", "emit", "@5", "opt_pasmcode", "class_namespace", "maybe_ns",
- "nslist", "@6", "_nslist", "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",
+ "annotate_directive", "hll_def", "constdef", "$@1", "pmc_const", "$@2",
+ "any_string", "pasmcode", "pasmline", "pasm_inst", "$@3", "$@4",
+ "pasm_args", "emit", "$@5", "opt_pasmcode", "class_namespace",
+ "maybe_ns", "nslist", "$@6", "_nslist", "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_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", "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", "stringc", "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", "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",
+ "stringc", "const", 0
};
#endif
@@ -2339,9 +2354,18 @@
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
+ Once GCC version 2 has supplanted version 1, this can go. However,
+ YYFAIL appears to be in use. Nevertheless, it is formally deprecated
+ in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+ discussed. */
#define YYFAIL goto yyerrlab
+#if defined YYFAIL
+ /* This is here to suppress warnings from the GCC cpp's
+ -Wunused-macros. Normally we don't worry about that warning, but
+ some users do, and we want to make it easy for users to remove
+ YYFAIL uses, which will produce warnings from Bison 2.5. */
+#endif
#define YYRECOVERING() (!!yyerrstatus)
@@ -2398,7 +2422,7 @@
we won't break user code: when these are the locations we know. */
#ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
# define YY_LOCATION_PRINT(File, Loc) \
fprintf (File, "%d.%d-%d.%d", \
(Loc).first_line, (Loc).first_column, \
@@ -2515,17 +2539,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");
}
@@ -2561,11 +2588,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");
}
}
@@ -2849,10 +2876,8 @@
break;
}
}
-
/* Prevent warnings from -Wmissing-prototypes. */
-
#ifdef YYPARSE_PARAM
#if defined __STDC__ || defined __cplusplus
int yyparse (void *YYPARSE_PARAM);
@@ -2871,10 +2896,9 @@
-
-/*----------.
-| yyparse. |
-`----------*/
+/*-------------------------.
+| yyparse or yypush_parse. |
+`-------------------------*/
#ifdef YYPARSE_PARAM
#if (defined __STDC__ || defined __C99__FUNC__ \
@@ -2899,22 +2923,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];
@@ -2922,51 +2970,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;
@@ -2996,7 +3021,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
@@ -3004,7 +3028,6 @@
yyoverflow (YY_("memory exhausted"),
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
-
&yystacksize);
yyss = yyss1;
@@ -3027,9 +3050,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);
@@ -3040,7 +3062,6 @@
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
-
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
@@ -3050,6 +3071,9 @@
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ if (yystate == YYFINAL)
+ YYACCEPT;
+
goto yybackup;
/*-----------.
@@ -3058,16 +3082,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: "));
@@ -3099,20 +3123,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;
@@ -3152,21 +3172,29 @@
switch (yyn)
{
case 2:
+
+/* Line 1464 of yacc.c */
#line 1081 "compilers/imcc/imcc.y"
{ if (yynerrs) YYABORT; (yyval.i) = 0; }
break;
case 5:
+
+/* Line 1464 of yacc.c */
#line 1090 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 6:
+
+/* Line 1464 of yacc.c */
#line 1091 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 7:
+
+/* Line 1464 of yacc.c */
#line 1093 "compilers/imcc/imcc.y"
{
(yyval.i) = (yyvsp[(1) - (1)].i);
@@ -3176,6 +3204,8 @@
break;
case 8:
+
+/* Line 1464 of yacc.c */
#line 1099 "compilers/imcc/imcc.y"
{
(yyval.i) = (yyvsp[(1) - (1)].i);
@@ -3185,31 +3215,43 @@
break;
case 9:
+
+/* Line 1464 of yacc.c */
#line 1104 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 10:
+
+/* Line 1464 of yacc.c */
#line 1105 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 11:
+
+/* Line 1464 of yacc.c */
#line 1106 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 12:
+
+/* Line 1464 of yacc.c */
#line 1107 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 13:
+
+/* Line 1464 of yacc.c */
#line 1111 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 14:
+
+/* Line 1464 of yacc.c */
#line 1113 "compilers/imcc/imcc.y"
{
(yyval.i) = 0;
@@ -3219,6 +3261,8 @@
break;
case 15:
+
+/* Line 1464 of yacc.c */
#line 1122 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->line = atoi((yyvsp[(2) - (5)].s));
@@ -3228,6 +3272,8 @@
break;
case 16:
+
+/* Line 1464 of yacc.c */
#line 1128 "compilers/imcc/imcc.y"
{
/* set_filename() frees the STRINGC */
@@ -3236,6 +3282,8 @@
break;
case 17:
+
+/* Line 1464 of yacc.c */
#line 1136 "compilers/imcc/imcc.y"
{
/* We'll want to store an entry while emitting instructions, so just
@@ -3247,6 +3295,8 @@
break;
case 18:
+
+/* Line 1464 of yacc.c */
#line 1148 "compilers/imcc/imcc.y"
{
STRING * const hll_name = Parrot_str_unescape(interp, (yyvsp[(2) - (2)].s) + 1, '"', NULL);
@@ -3260,11 +3310,15 @@
break;
case 19:
+
+/* Line 1464 of yacc.c */
#line 1160 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 20:
+
+/* Line 1464 of yacc.c */
#line 1161 "compilers/imcc/imcc.y"
{
mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 1);
@@ -3274,11 +3328,15 @@
break;
case 21:
+
+/* Line 1464 of yacc.c */
#line 1169 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 22:
+
+/* Line 1464 of yacc.c */
#line 1170 "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));
@@ -3289,36 +3347,50 @@
break;
case 27:
+
+/* Line 1464 of yacc.c */
#line 1188 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 28:
+
+/* Line 1464 of yacc.c */
#line 1189 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 29:
+
+/* Line 1464 of yacc.c */
#line 1190 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 30:
+
+/* Line 1464 of yacc.c */
#line 1191 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 31:
+
+/* Line 1464 of yacc.c */
#line 1192 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 34:
+
+/* Line 1464 of yacc.c */
#line 1197 "compilers/imcc/imcc.y"
{ clear_state(interp); }
break;
case 35:
+
+/* Line 1464 of yacc.c */
#line 1199 "compilers/imcc/imcc.y"
{
(yyval.i) = INS(interp, IMCC_INFO(interp)->cur_unit,
@@ -3329,6 +3401,8 @@
break;
case 36:
+
+/* Line 1464 of yacc.c */
#line 1206 "compilers/imcc/imcc.y"
{
imc_close_unit(interp, IMCC_INFO(interp)->cur_unit);
@@ -3337,6 +3411,8 @@
break;
case 37:
+
+/* Line 1464 of yacc.c */
#line 1211 "compilers/imcc/imcc.y"
{
(yyval.i) = iSUBROUTINE(interp,
@@ -3348,6 +3424,8 @@
break;
case 38:
+
+/* Line 1464 of yacc.c */
#line 1219 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(2) - (2)].sr));
@@ -3355,6 +3433,8 @@
break;
case 39:
+
+/* Line 1464 of yacc.c */
#line 1223 "compilers/imcc/imcc.y"
{
char *name = mem_sys_strdup((yyvsp[(2) - (4)].s) + 1);
@@ -3371,16 +3451,22 @@
break;
case 40:
+
+/* Line 1464 of yacc.c */
#line 1235 "compilers/imcc/imcc.y"
{ (yyval.i) = 0;}
break;
case 42:
+
+/* Line 1464 of yacc.c */
#line 1243 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PASM); }
break;
case 43:
+
+/* Line 1464 of yacc.c */
#line 1246 "compilers/imcc/imcc.y"
{
/* if (optimizer_level & OPT_PASM)
@@ -3392,6 +3478,8 @@
break;
case 46:
+
+/* Line 1464 of yacc.c */
#line 1262 "compilers/imcc/imcc.y"
{
int re_open = 0;
@@ -3407,16 +3495,22 @@
break;
case 47:
+
+/* Line 1464 of yacc.c */
#line 1276 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (3)].sr); }
break;
case 48:
+
+/* Line 1464 of yacc.c */
#line 1277 "compilers/imcc/imcc.y"
{ (yyval.sr) = NULL; }
break;
case 49:
+
+/* Line 1464 of yacc.c */
#line 1281 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->nkeys = 0;
@@ -3424,6 +3518,8 @@
break;
case 50:
+
+/* Line 1464 of yacc.c */
#line 1285 "compilers/imcc/imcc.y"
{
(yyval.sr) = link_keys(interp,
@@ -3433,11 +3529,15 @@
break;
case 51:
+
+/* Line 1464 of yacc.c */
#line 1293 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(1) - (1)].sr); }
break;
case 52:
+
+/* Line 1464 of yacc.c */
#line 1295 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(3) - (3)].sr);
@@ -3446,6 +3546,8 @@
break;
case 53:
+
+/* Line 1464 of yacc.c */
#line 1303 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->cur_unit = imc_open_unit(interp, IMC_PCCSUB);
@@ -3453,6 +3555,8 @@
break;
case 54:
+
+/* Line 1464 of yacc.c */
#line 1307 "compilers/imcc/imcc.y"
{
iSUBROUTINE(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(3) - (3)].sr));
@@ -3460,6 +3564,8 @@
break;
case 55:
+
+/* Line 1464 of yacc.c */
#line 1311 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->cur_call->pcc_sub->pragma = (yyvsp[(5) - (6)].t);
@@ -3471,21 +3577,29 @@
break;
case 56:
+
+/* Line 1464 of yacc.c */
#line 1319 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; }
break;
case 57:
+
+/* Line 1464 of yacc.c */
#line 1323 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 58:
+
+/* Line 1464 of yacc.c */
#line 1324 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 59:
+
+/* Line 1464 of yacc.c */
#line 1326 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->adv_named_id) {
@@ -3499,16 +3613,22 @@
break;
case 60:
+
+/* Line 1464 of yacc.c */
#line 1338 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 61:
+
+/* Line 1464 of yacc.c */
#line 1338 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(3) - (3)].sr); IMCC_INFO(interp)->is_def = 0; }
break;
case 62:
+
+/* Line 1464 of yacc.c */
#line 1343 "compilers/imcc/imcc.y"
{
if ((yyvsp[(3) - (3)].t) & VT_OPT_FLAG && (yyvsp[(1) - (3)].t) != 'I') {
@@ -3532,11 +3652,15 @@
break;
case 63:
+
+/* Line 1464 of yacc.c */
#line 1367 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 64:
+
+/* Line 1464 of yacc.c */
#line 1372 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3546,6 +3670,8 @@
break;
case 65:
+
+/* Line 1464 of yacc.c */
#line 1378 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3555,6 +3681,8 @@
break;
case 66:
+
+/* Line 1464 of yacc.c */
#line 1387 "compilers/imcc/imcc.y"
{
(yyval.t) = P_VTABLE;
@@ -3564,6 +3692,8 @@
break;
case 67:
+
+/* Line 1464 of yacc.c */
#line 1393 "compilers/imcc/imcc.y"
{
(yyval.t) = P_VTABLE;
@@ -3573,6 +3703,8 @@
break;
case 68:
+
+/* Line 1464 of yacc.c */
#line 1402 "compilers/imcc/imcc.y"
{
(yyval.t) = P_METHOD;
@@ -3582,6 +3714,8 @@
break;
case 69:
+
+/* Line 1464 of yacc.c */
#line 1408 "compilers/imcc/imcc.y"
{
(yyval.t) = P_METHOD;
@@ -3591,6 +3725,8 @@
break;
case 70:
+
+/* Line 1464 of yacc.c */
#line 1417 "compilers/imcc/imcc.y"
{
(yyval.t) = P_NSENTRY;
@@ -3600,6 +3736,8 @@
break;
case 71:
+
+/* Line 1464 of yacc.c */
#line 1423 "compilers/imcc/imcc.y"
{
(yyval.t) = P_NSENTRY;
@@ -3609,6 +3747,8 @@
break;
case 72:
+
+/* Line 1464 of yacc.c */
#line 1432 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3617,6 +3757,8 @@
break;
case 73:
+
+/* Line 1464 of yacc.c */
#line 1440 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3625,6 +3767,8 @@
break;
case 74:
+
+/* Line 1464 of yacc.c */
#line 1445 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3635,6 +3779,8 @@
break;
case 75:
+
+/* Line 1464 of yacc.c */
#line 1455 "compilers/imcc/imcc.y"
{
add_pcc_multi(interp, IMCC_INFO(interp)->cur_call, NULL);
@@ -3642,6 +3788,8 @@
break;
case 76:
+
+/* Line 1464 of yacc.c */
#line 1459 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3650,6 +3798,8 @@
break;
case 77:
+
+/* Line 1464 of yacc.c */
#line 1464 "compilers/imcc/imcc.y"
{
(yyval.t) = 0;
@@ -3658,26 +3808,36 @@
break;
case 78:
+
+/* Line 1464 of yacc.c */
#line 1471 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, "INTVAL", 'S'); }
break;
case 79:
+
+/* Line 1464 of yacc.c */
#line 1472 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, "FLOATVAL", 'S'); }
break;
case 80:
+
+/* Line 1464 of yacc.c */
#line 1473 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, "PMC", 'S'); }
break;
case 81:
+
+/* Line 1464 of yacc.c */
#line 1474 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, "STRING", 'S'); }
break;
case 82:
+
+/* Line 1464 of yacc.c */
#line 1476 "compilers/imcc/imcc.y"
{
SymReg *r;
@@ -3692,6 +3852,8 @@
break;
case 83:
+
+/* Line 1464 of yacc.c */
#line 1487 "compilers/imcc/imcc.y"
{
SymReg *r;
@@ -3706,11 +3868,15 @@
break;
case 84:
+
+/* Line 1464 of yacc.c */
#line 1497 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (3)].sr); }
break;
case 87:
+
+/* Line 1464 of yacc.c */
#line 1507 "compilers/imcc/imcc.y"
{
char name[128];
@@ -3736,81 +3902,113 @@
break;
case 88:
+
+/* Line 1464 of yacc.c */
#line 1533 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; }
break;
case 89:
+
+/* Line 1464 of yacc.c */
#line 1537 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 0; }
break;
case 90:
+
+/* Line 1464 of yacc.c */
#line 1538 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->label = 1; }
break;
case 91:
+
+/* Line 1464 of yacc.c */
#line 1542 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; }
break;
case 92:
+
+/* Line 1464 of yacc.c */
#line 1543 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; IMCC_INFO(interp)->cur_call->pcc_sub->object = (yyvsp[(2) - (3)].sr); }
break;
case 93:
+
+/* Line 1464 of yacc.c */
#line 1547 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 95:
+
+/* Line 1464 of yacc.c */
#line 1552 "compilers/imcc/imcc.y"
{ (yyval.t) = (yyvsp[(1) - (1)].t); }
break;
case 96:
+
+/* Line 1464 of yacc.c */
#line 1553 "compilers/imcc/imcc.y"
{ (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); }
break;
case 97:
+
+/* Line 1464 of yacc.c */
#line 1557 "compilers/imcc/imcc.y"
{ (yyval.t) = P_LOAD; }
break;
case 98:
+
+/* Line 1464 of yacc.c */
#line 1558 "compilers/imcc/imcc.y"
{ (yyval.t) = P_INIT; }
break;
case 99:
+
+/* Line 1464 of yacc.c */
#line 1559 "compilers/imcc/imcc.y"
{ (yyval.t) = P_MAIN; }
break;
case 100:
+
+/* Line 1464 of yacc.c */
#line 1560 "compilers/imcc/imcc.y"
{ (yyval.t) = P_IMMEDIATE; }
break;
case 101:
+
+/* Line 1464 of yacc.c */
#line 1561 "compilers/imcc/imcc.y"
{ (yyval.t) = P_POSTCOMP; }
break;
case 102:
+
+/* Line 1464 of yacc.c */
#line 1562 "compilers/imcc/imcc.y"
{ (yyval.t) = P_ANON; }
break;
case 103:
+
+/* Line 1464 of yacc.c */
#line 1563 "compilers/imcc/imcc.y"
{ (yyval.t) = P_NEED_LEX; }
break;
case 111:
+
+/* Line 1464 of yacc.c */
#line 1575 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (5)].sr));
@@ -3819,6 +4017,8 @@
break;
case 112:
+
+/* Line 1464 of yacc.c */
#line 1580 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
@@ -3826,6 +4026,8 @@
break;
case 113:
+
+/* Line 1464 of yacc.c */
#line 1584 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
@@ -3833,6 +4035,8 @@
break;
case 114:
+
+/* Line 1464 of yacc.c */
#line 1588 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (3)].sr));
@@ -3840,6 +4044,8 @@
break;
case 115:
+
+/* Line 1464 of yacc.c */
#line 1592 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(2) - (3)].s), 'S'));
@@ -3847,6 +4053,8 @@
break;
case 116:
+
+/* Line 1464 of yacc.c */
#line 1596 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, (yyvsp[(2) - (5)].sr));
@@ -3855,6 +4063,8 @@
break;
case 117:
+
+/* Line 1464 of yacc.c */
#line 1601 "compilers/imcc/imcc.y"
{
add_pcc_sub(IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(2) - (5)].s), 'S'));
@@ -3863,11 +4073,15 @@
break;
case 118:
+
+/* Line 1464 of yacc.c */
#line 1609 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 119:
+
+/* Line 1464 of yacc.c */
#line 1610 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->adv_named_id) {
@@ -3881,16 +4095,22 @@
break;
case 120:
+
+/* Line 1464 of yacc.c */
#line 1622 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (2)].sr); }
break;
case 121:
+
+/* Line 1464 of yacc.c */
#line 1627 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 122:
+
+/* Line 1464 of yacc.c */
#line 1629 "compilers/imcc/imcc.y"
{
if ((yyvsp[(2) - (3)].sr))
@@ -3899,16 +4119,22 @@
break;
case 123:
+
+/* Line 1464 of yacc.c */
#line 1636 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); }
break;
case 124:
+
+/* Line 1464 of yacc.c */
#line 1637 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 125:
+
+/* Line 1464 of yacc.c */
#line 1638 "compilers/imcc/imcc.y"
{
IdList * const l = (yyvsp[(4) - (4)].idlist);
@@ -3921,66 +4147,92 @@
break;
case 126:
+
+/* Line 1464 of yacc.c */
#line 1649 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 127:
+
+/* Line 1464 of yacc.c */
#line 1650 "compilers/imcc/imcc.y"
{ (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); }
break;
case 128:
+
+/* Line 1464 of yacc.c */
#line 1654 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_FLAT; }
break;
case 129:
+
+/* Line 1464 of yacc.c */
#line 1655 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_OPTIONAL; }
break;
case 130:
+
+/* Line 1464 of yacc.c */
#line 1656 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_OPT_FLAG; }
break;
case 131:
+
+/* Line 1464 of yacc.c */
#line 1657 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_NAMED; }
break;
case 132:
+
+/* Line 1464 of yacc.c */
#line 1658 "compilers/imcc/imcc.y"
{ adv_named_set(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = VT_NAMED; mem_sys_free((yyvsp[(3) - (4)].s)); }
break;
case 133:
+
+/* Line 1464 of yacc.c */
#line 1659 "compilers/imcc/imcc.y"
{ adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); (yyval.t) = VT_NAMED; mem_sys_free((yyvsp[(3) - (4)].s)); }
break;
case 134:
+
+/* Line 1464 of yacc.c */
#line 1660 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 135:
+
+/* Line 1464 of yacc.c */
#line 1661 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_CALL_SIG; }
break;
case 136:
+
+/* Line 1464 of yacc.c */
#line 1666 "compilers/imcc/imcc.y"
{ begin_return_or_yield(interp, 0); }
break;
case 137:
+
+/* Line 1464 of yacc.c */
#line 1668 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; }
break;
case 138:
+
+/* Line 1464 of yacc.c */
#line 1670 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->asm_state = AsmDefault;
@@ -3989,21 +4241,29 @@
break;
case 139:
+
+/* Line 1464 of yacc.c */
#line 1677 "compilers/imcc/imcc.y"
{ begin_return_or_yield(interp, 1); }
break;
case 140:
+
+/* Line 1464 of yacc.c */
#line 1679 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->asm_state = AsmDefault; }
break;
case 141:
+
+/* Line 1464 of yacc.c */
#line 1683 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 142:
+
+/* Line 1464 of yacc.c */
#line 1685 "compilers/imcc/imcc.y"
{
if ((yyvsp[(1) - (2)].sr))
@@ -4012,6 +4272,8 @@
break;
case 143:
+
+/* Line 1464 of yacc.c */
#line 1690 "compilers/imcc/imcc.y"
{
if ((yyvsp[(2) - (3)].sr))
@@ -4020,11 +4282,15 @@
break;
case 144:
+
+/* Line 1464 of yacc.c */
#line 1697 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 145:
+
+/* Line 1464 of yacc.c */
#line 1699 "compilers/imcc/imcc.y"
{
if ((yyvsp[(1) - (2)].sr))
@@ -4033,6 +4299,8 @@
break;
case 146:
+
+/* Line 1464 of yacc.c */
#line 1704 "compilers/imcc/imcc.y"
{
if ((yyvsp[(2) - (3)].sr))
@@ -4041,16 +4309,22 @@
break;
case 147:
+
+/* Line 1464 of yacc.c */
#line 1711 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); }
break;
case 148:
+
+/* Line 1464 of yacc.c */
#line 1715 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(2) - (3)].sr); (yyval.sr)->type |= (yyvsp[(3) - (3)].t); }
break;
case 149:
+
+/* Line 1464 of yacc.c */
#line 1720 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->asm_state == AsmDefault)
@@ -4059,6 +4333,8 @@
break;
case 150:
+
+/* Line 1464 of yacc.c */
#line 1725 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->asm_state = AsmDefault;
@@ -4067,21 +4343,29 @@
break;
case 151:
+
+/* Line 1464 of yacc.c */
#line 1732 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 152:
+
+/* Line 1464 of yacc.c */
#line 1733 "compilers/imcc/imcc.y"
{ (yyval.t) = 1; }
break;
case 153:
+
+/* Line 1464 of yacc.c */
#line 1737 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 154:
+
+/* Line 1464 of yacc.c */
#line 1739 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->adv_named_id) {
@@ -4095,6 +4379,8 @@
break;
case 155:
+
+/* Line 1464 of yacc.c */
#line 1749 "compilers/imcc/imcc.y"
{
SymReg * const name = mk_const(interp, (yyvsp[(1) - (3)].s), 'S');
@@ -4103,6 +4389,8 @@
break;
case 156:
+
+/* Line 1464 of yacc.c */
#line 1754 "compilers/imcc/imcc.y"
{
if (IMCC_INFO(interp)->adv_named_id) {
@@ -4116,6 +4404,8 @@
break;
case 157:
+
+/* Line 1464 of yacc.c */
#line 1764 "compilers/imcc/imcc.y"
{
SymReg * const name = mk_const(interp, (yyvsp[(3) - (5)].s), 'S');
@@ -4124,46 +4414,64 @@
break;
case 160:
+
+/* Line 1464 of yacc.c */
#line 1785 "compilers/imcc/imcc.y"
{ clear_state(interp); }
break;
case 161:
+
+/* Line 1464 of yacc.c */
#line 1790 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(2) - (2)].i); }
break;
case 162:
+
+/* Line 1464 of yacc.c */
#line 1791 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 163:
+
+/* Line 1464 of yacc.c */
#line 1792 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 164:
+
+/* Line 1464 of yacc.c */
#line 1793 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 165:
+
+/* Line 1464 of yacc.c */
#line 1794 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 166:
+
+/* Line 1464 of yacc.c */
#line 1795 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 167:
+
+/* Line 1464 of yacc.c */
#line 1799 "compilers/imcc/imcc.y"
{ (yyval.i) = NULL; }
break;
case 171:
+
+/* Line 1464 of yacc.c */
#line 1810 "compilers/imcc/imcc.y"
{
Instruction * const i = iLABEL(interp, IMCC_INFO(interp)->cur_unit, mk_local_label(interp, (yyvsp[(1) - (1)].s)));
@@ -4173,11 +4481,15 @@
break;
case 172:
+
+/* Line 1464 of yacc.c */
#line 1820 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(2) - (3)].i); }
break;
case 173:
+
+/* Line 1464 of yacc.c */
#line 1822 "compilers/imcc/imcc.y"
{
if (yynerrs >= PARROT_MAX_RECOVER_ERRORS) {
@@ -4189,6 +4501,8 @@
break;
case 174:
+
+/* Line 1464 of yacc.c */
#line 1833 "compilers/imcc/imcc.y"
{
IdList* const l = (yyvsp[(1) - (1)].idlist);
@@ -4198,6 +4512,8 @@
break;
case 175:
+
+/* Line 1464 of yacc.c */
#line 1840 "compilers/imcc/imcc.y"
{
IdList* const l = (yyvsp[(3) - (3)].idlist);
@@ -4207,6 +4523,8 @@
break;
case 176:
+
+/* Line 1464 of yacc.c */
#line 1849 "compilers/imcc/imcc.y"
{
IdList* const l = mem_gc_allocate_n_zeroed_typed(interp, 1, IdList);
@@ -4216,11 +4534,15 @@
break;
case 181:
+
+/* Line 1464 of yacc.c */
#line 1865 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 182:
+
+/* Line 1464 of yacc.c */
#line 1866 "compilers/imcc/imcc.y"
{
IdList *l = (yyvsp[(4) - (4)].idlist);
@@ -4237,6 +4559,8 @@
break;
case 183:
+
+/* Line 1464 of yacc.c */
#line 1879 "compilers/imcc/imcc.y"
{
if ((yyvsp[(4) - (4)].sr)->set != 'P') {
@@ -4257,6 +4581,8 @@
break;
case 184:
+
+/* Line 1464 of yacc.c */
#line 1896 "compilers/imcc/imcc.y"
{
if ((yyvsp[(4) - (4)].sr)->set != 'P') {
@@ -4273,11 +4599,15 @@
break;
case 185:
+
+/* Line 1464 of yacc.c */
#line 1908 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 186:
+
+/* Line 1464 of yacc.c */
#line 1909 "compilers/imcc/imcc.y"
{
mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 0);
@@ -4287,11 +4617,15 @@
break;
case 188:
+
+/* Line 1464 of yacc.c */
#line 1916 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->is_def = 1; }
break;
case 189:
+
+/* Line 1464 of yacc.c */
#line 1917 "compilers/imcc/imcc.y"
{
mk_const_ident(interp, (yyvsp[(4) - (6)].s), (yyvsp[(3) - (6)].t), (yyvsp[(6) - (6)].sr), 1);
@@ -4301,6 +4635,8 @@
break;
case 190:
+
+/* Line 1464 of yacc.c */
#line 1923 "compilers/imcc/imcc.y"
{
(yyval.i) = NULL;
@@ -4310,6 +4646,8 @@
break;
case 191:
+
+/* Line 1464 of yacc.c */
#line 1929 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "branch", 1, (yyvsp[(2) - (2)].sr));
@@ -4317,6 +4655,8 @@
break;
case 192:
+
+/* Line 1464 of yacc.c */
#line 1933 "compilers/imcc/imcc.y"
{
(yyval.i) = INS(interp,
@@ -4332,71 +4672,99 @@
break;
case 193:
+
+/* Line 1464 of yacc.c */
#line 1944 "compilers/imcc/imcc.y"
{ (yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(2) - (2)].sr)); }
break;
case 194:
+
+/* Line 1464 of yacc.c */
#line 1945 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; IMCC_INFO(interp)->cur_call = NULL; }
break;
case 195:
+
+/* Line 1464 of yacc.c */
#line 1946 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 198:
+
+/* Line 1464 of yacc.c */
#line 1949 "compilers/imcc/imcc.y"
{ (yyval.i) = 0;}
break;
case 199:
+
+/* Line 1464 of yacc.c */
#line 1953 "compilers/imcc/imcc.y"
{ (yyval.t) = 'I'; }
break;
case 200:
+
+/* Line 1464 of yacc.c */
#line 1954 "compilers/imcc/imcc.y"
{ (yyval.t) = 'N'; }
break;
case 201:
+
+/* Line 1464 of yacc.c */
#line 1955 "compilers/imcc/imcc.y"
{ (yyval.t) = 'S'; }
break;
case 202:
+
+/* Line 1464 of yacc.c */
#line 1956 "compilers/imcc/imcc.y"
{ (yyval.t) = 'P'; }
break;
case 203:
+
+/* Line 1464 of yacc.c */
#line 1961 "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 204:
+
+/* Line 1464 of yacc.c */
#line 1963 "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 205:
+
+/* Line 1464 of yacc.c */
#line 1965 "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 206:
+
+/* Line 1464 of yacc.c */
#line 1967 "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 207:
+
+/* Line 1464 of yacc.c */
#line 1969 "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 208:
+
+/* Line 1464 of yacc.c */
#line 1972 "compilers/imcc/imcc.y"
{
add_pcc_result(interp, (yyvsp[(3) - (3)].i)->symregs[0], (yyvsp[(1) - (3)].sr));
@@ -4406,6 +4774,8 @@
break;
case 209:
+
+/* Line 1464 of yacc.c */
#line 1978 "compilers/imcc/imcc.y"
{
(yyval.i) = IMCC_create_itcall_label(interp);
@@ -4413,6 +4783,8 @@
break;
case 210:
+
+/* Line 1464 of yacc.c */
#line 1982 "compilers/imcc/imcc.y"
{
IMCC_itcall_sub(interp, (yyvsp[(6) - (9)].sr));
@@ -4421,6 +4793,8 @@
break;
case 214:
+
+/* Line 1464 of yacc.c */
#line 1990 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "null", 1, (yyvsp[(1) - (3)].sr));
@@ -4428,136 +4802,190 @@
break;
case 215:
+
+/* Line 1464 of yacc.c */
#line 1997 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"not"; }
break;
case 216:
+
+/* Line 1464 of yacc.c */
#line 1998 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bnot"; }
break;
case 217:
+
+/* Line 1464 of yacc.c */
#line 1999 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"neg"; }
break;
case 218:
+
+/* Line 1464 of yacc.c */
#line 2003 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"sub"; }
break;
case 219:
+
+/* Line 1464 of yacc.c */
#line 2004 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"add"; }
break;
case 220:
+
+/* Line 1464 of yacc.c */
#line 2005 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"mul"; }
break;
case 221:
+
+/* Line 1464 of yacc.c */
#line 2006 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"div"; }
break;
case 222:
+
+/* Line 1464 of yacc.c */
#line 2007 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"mod"; }
break;
case 223:
+
+/* Line 1464 of yacc.c */
#line 2008 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"fdiv"; }
break;
case 224:
+
+/* Line 1464 of yacc.c */
#line 2009 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"pow"; }
break;
case 225:
+
+/* Line 1464 of yacc.c */
#line 2010 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"concat"; }
break;
case 226:
+
+/* Line 1464 of yacc.c */
#line 2011 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"iseq"; }
break;
case 227:
+
+/* Line 1464 of yacc.c */
#line 2012 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"isne"; }
break;
case 228:
+
+/* Line 1464 of yacc.c */
#line 2013 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"isgt"; }
break;
case 229:
+
+/* Line 1464 of yacc.c */
#line 2014 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"isge"; }
break;
case 230:
+
+/* Line 1464 of yacc.c */
#line 2015 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"islt"; }
break;
case 231:
+
+/* Line 1464 of yacc.c */
#line 2016 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"isle"; }
break;
case 232:
+
+/* Line 1464 of yacc.c */
#line 2017 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"shl"; }
break;
case 233:
+
+/* Line 1464 of yacc.c */
#line 2018 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"shr"; }
break;
case 234:
+
+/* Line 1464 of yacc.c */
#line 2019 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"lsr"; }
break;
case 235:
+
+/* Line 1464 of yacc.c */
#line 2020 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"and"; }
break;
case 236:
+
+/* Line 1464 of yacc.c */
#line 2021 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"or"; }
break;
case 237:
+
+/* Line 1464 of yacc.c */
#line 2022 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"xor"; }
break;
case 238:
+
+/* Line 1464 of yacc.c */
#line 2023 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"band"; }
break;
case 239:
+
+/* Line 1464 of yacc.c */
#line 2024 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bor"; }
break;
case 240:
+
+/* Line 1464 of yacc.c */
#line 2025 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bxor"; }
break;
case 241:
+
+/* Line 1464 of yacc.c */
#line 2031 "compilers/imcc/imcc.y"
{
(yyval.i) = IMCC_create_itcall_label(interp);
@@ -4567,81 +4995,113 @@
break;
case 242:
+
+/* Line 1464 of yacc.c */
#line 2036 "compilers/imcc/imcc.y"
{ (yyval.i) = 0; }
break;
case 243:
+
+/* Line 1464 of yacc.c */
#line 2043 "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 1464 of yacc.c */
#line 2047 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"add"; }
break;
case 245:
+
+/* Line 1464 of yacc.c */
#line 2048 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"sub"; }
break;
case 246:
+
+/* Line 1464 of yacc.c */
#line 2049 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"mul"; }
break;
case 247:
+
+/* Line 1464 of yacc.c */
#line 2050 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"div"; }
break;
case 248:
+
+/* Line 1464 of yacc.c */
#line 2051 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"mod"; }
break;
case 249:
+
+/* Line 1464 of yacc.c */
#line 2052 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"fdiv"; }
break;
case 250:
+
+/* Line 1464 of yacc.c */
#line 2053 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"concat"; }
break;
case 251:
+
+/* Line 1464 of yacc.c */
#line 2054 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"band"; }
break;
case 252:
+
+/* Line 1464 of yacc.c */
#line 2055 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bor"; }
break;
case 253:
+
+/* Line 1464 of yacc.c */
#line 2056 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"bxor"; }
break;
case 254:
+
+/* Line 1464 of yacc.c */
#line 2057 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"shr"; }
break;
case 255:
+
+/* Line 1464 of yacc.c */
#line 2058 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"shl"; }
break;
case 256:
+
+/* Line 1464 of yacc.c */
#line 2059 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"lsr"; }
break;
case 257:
+
+/* Line 1464 of yacc.c */
#line 2065 "compilers/imcc/imcc.y"
{
(yyval.i) = func_ins(interp, IMCC_INFO(interp)->cur_unit, (yyvsp[(1) - (4)].sr), (yyvsp[(3) - (4)].s),
@@ -4653,21 +5113,29 @@
break;
case 258:
+
+/* Line 1464 of yacc.c */
#line 2075 "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 1464 of yacc.c */
#line 2076 "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 1464 of yacc.c */
#line 2077 "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 1464 of yacc.c */
#line 2079 "compilers/imcc/imcc.y"
{
(yyval.sr) = (yyvsp[(1) - (1)].sr);
@@ -4677,6 +5145,8 @@
break;
case 262:
+
+/* Line 1464 of yacc.c */
#line 2085 "compilers/imcc/imcc.y"
{
/* disallow bareword method names; SREG name constants are fine */
@@ -4694,6 +5164,8 @@
break;
case 263:
+
+/* Line 1464 of yacc.c */
#line 2099 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr);
@@ -4703,6 +5175,8 @@
break;
case 264:
+
+/* Line 1464 of yacc.c */
#line 2105 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr);
@@ -4712,11 +5186,15 @@
break;
case 265:
+
+/* Line 1464 of yacc.c */
#line 2110 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->cur_obj = (yyvsp[(1) - (3)].sr); (yyval.sr) = (yyvsp[(3) - (3)].sr); }
break;
case 266:
+
+/* Line 1464 of yacc.c */
#line 2116 "compilers/imcc/imcc.y"
{
(yyval.i) = IMCC_create_itcall_label(interp);
@@ -4725,16 +5203,22 @@
break;
case 267:
+
+/* Line 1464 of yacc.c */
#line 2120 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(2) - (5)].i); }
break;
case 268:
+
+/* Line 1464 of yacc.c */
#line 2124 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 269:
+
+/* Line 1464 of yacc.c */
#line 2126 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4748,6 +5232,8 @@
break;
case 270:
+
+/* Line 1464 of yacc.c */
#line 2136 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4761,6 +5247,8 @@
break;
case 271:
+
+/* Line 1464 of yacc.c */
#line 2146 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4771,6 +5259,8 @@
break;
case 272:
+
+/* Line 1464 of yacc.c */
#line 2153 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4779,6 +5269,8 @@
break;
case 273:
+
+/* Line 1464 of yacc.c */
#line 2158 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4789,51 +5281,71 @@
break;
case 274:
+
+/* Line 1464 of yacc.c */
#line 2167 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); }
break;
case 275:
+
+/* Line 1464 of yacc.c */
#line 2171 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 276:
+
+/* Line 1464 of yacc.c */
#line 2172 "compilers/imcc/imcc.y"
{ (yyval.t) = (yyvsp[(1) - (2)].t) | (yyvsp[(2) - (2)].t); }
break;
case 277:
+
+/* Line 1464 of yacc.c */
#line 2176 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_FLAT; }
break;
case 278:
+
+/* Line 1464 of yacc.c */
#line 2177 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_NAMED; }
break;
case 279:
+
+/* Line 1464 of yacc.c */
#line 2178 "compilers/imcc/imcc.y"
{ (yyval.t) = VT_CALL_SIG; }
break;
case 280:
+
+/* Line 1464 of yacc.c */
#line 2180 "compilers/imcc/imcc.y"
{ adv_named_set_u(interp, (yyvsp[(3) - (4)].s)); mem_sys_free((yyvsp[(3) - (4)].s)); (yyval.t) = 0; }
break;
case 281:
+
+/* Line 1464 of yacc.c */
#line 2181 "compilers/imcc/imcc.y"
{ adv_named_set(interp, (yyvsp[(3) - (4)].s)); mem_sys_free((yyvsp[(3) - (4)].s)); (yyval.t) = 0; }
break;
case 282:
+
+/* Line 1464 of yacc.c */
#line 2185 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(1) - (2)].sr); (yyval.sr)->type |= (yyvsp[(2) - (2)].t); }
break;
case 283:
+
+/* Line 1464 of yacc.c */
#line 2190 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4847,6 +5359,8 @@
break;
case 284:
+
+/* Line 1464 of yacc.c */
#line 2200 "compilers/imcc/imcc.y"
{
add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call,
@@ -4856,6 +5370,8 @@
break;
case 285:
+
+/* Line 1464 of yacc.c */
#line 2206 "compilers/imcc/imcc.y"
{
(yyval.sr) = 0;
@@ -4869,6 +5385,8 @@
break;
case 286:
+
+/* Line 1464 of yacc.c */
#line 2216 "compilers/imcc/imcc.y"
{
add_pcc_named_result(interp, IMCC_INFO(interp)->cur_call, mk_const(interp, (yyvsp[(1) - (3)].s), 'S'), (yyvsp[(3) - (3)].sr));
@@ -4877,21 +5395,29 @@
break;
case 287:
+
+/* Line 1464 of yacc.c */
#line 2220 "compilers/imcc/imcc.y"
{ (yyval.sr) = 0; }
break;
case 288:
+
+/* Line 1464 of yacc.c */
#line 2224 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 289:
+
+/* Line 1464 of yacc.c */
#line 2225 "compilers/imcc/imcc.y"
{ (yyval.i) = (yyvsp[(1) - (1)].i); }
break;
case 290:
+
+/* Line 1464 of yacc.c */
#line 2230 "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));
@@ -4899,6 +5425,8 @@
break;
case 291:
+
+/* Line 1464 of yacc.c */
#line 2234 "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));
@@ -4906,6 +5434,8 @@
break;
case 292:
+
+/* Line 1464 of yacc.c */
#line 2238 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "unless", 2, (yyvsp[(2) - (4)].sr), (yyvsp[(4) - (4)].sr));
@@ -4913,6 +5443,8 @@
break;
case 293:
+
+/* Line 1464 of yacc.c */
#line 2245 "compilers/imcc/imcc.y"
{
(yyval.i) = MK_I(interp, IMCC_INFO(interp)->cur_unit, "if", 2, (yyvsp[(2) - (4)].sr), (yyvsp[(4) - (4)].sr));
@@ -4920,6 +5452,8 @@
break;
case 294:
+
+/* Line 1464 of yacc.c */
#line 2249 "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));
@@ -4927,6 +5461,8 @@
break;
case 295:
+
+/* Line 1464 of yacc.c */
#line 2253 "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));
@@ -4934,66 +5470,92 @@
break;
case 296:
+
+/* Line 1464 of yacc.c */
#line 2259 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 297:
+
+/* Line 1464 of yacc.c */
#line 2260 "compilers/imcc/imcc.y"
{ (yyval.t) = 0; }
break;
case 298:
+
+/* Line 1464 of yacc.c */
#line 2264 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"eq"; }
break;
case 299:
+
+/* Line 1464 of yacc.c */
#line 2265 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"ne"; }
break;
case 300:
+
+/* Line 1464 of yacc.c */
#line 2266 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"gt"; }
break;
case 301:
+
+/* Line 1464 of yacc.c */
#line 2267 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"ge"; }
break;
case 302:
+
+/* Line 1464 of yacc.c */
#line 2268 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"lt"; }
break;
case 303:
+
+/* Line 1464 of yacc.c */
#line 2269 "compilers/imcc/imcc.y"
{ (yyval.s) = (char *)"le"; }
break;
case 306:
+
+/* Line 1464 of yacc.c */
#line 2278 "compilers/imcc/imcc.y"
{ (yyval.sr) = NULL; }
break;
case 307:
+
+/* Line 1464 of yacc.c */
#line 2279 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(1) - (1)].sr); }
break;
case 308:
+
+/* Line 1464 of yacc.c */
#line 2283 "compilers/imcc/imcc.y"
{ (yyval.sr) = IMCC_INFO(interp)->regs[0]; }
break;
case 310:
+
+/* Line 1464 of yacc.c */
#line 2288 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(1) - (1)].sr); }
break;
case 311:
+
+/* Line 1464 of yacc.c */
#line 2290 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp) -> regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(1) - (4)].sr);
@@ -5004,6 +5566,8 @@
break;
case 312:
+
+/* Line 1464 of yacc.c */
#line 2297 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp) -> regs[IMCC_INFO(interp)->nargs++] = (yyvsp[(2) - (3)].sr);
@@ -5012,36 +5576,50 @@
break;
case 314:
+
+/* Line 1464 of yacc.c */
#line 2304 "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 1464 of yacc.c */
#line 2305 "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 1464 of yacc.c */
#line 2309 "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 1464 of yacc.c */
#line 2310 "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 1464 of yacc.c */
#line 2314 "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 1464 of yacc.c */
#line 2315 "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 1464 of yacc.c */
#line 2329 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->nkeys = 0;
@@ -5049,6 +5627,8 @@
break;
case 325:
+
+/* Line 1464 of yacc.c */
#line 2333 "compilers/imcc/imcc.y"
{
(yyval.sr) = link_keys(interp,
@@ -5058,6 +5638,8 @@
break;
case 326:
+
+/* Line 1464 of yacc.c */
#line 2341 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->nkeys = 0;
@@ -5065,6 +5647,8 @@
break;
case 327:
+
+/* Line 1464 of yacc.c */
#line 2345 "compilers/imcc/imcc.y"
{
(yyval.sr) = link_keys(interp,
@@ -5074,11 +5658,15 @@
break;
case 328:
+
+/* Line 1464 of yacc.c */
#line 2353 "compilers/imcc/imcc.y"
{ IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(1) - (1)].sr); }
break;
case 329:
+
+/* Line 1464 of yacc.c */
#line 2355 "compilers/imcc/imcc.y"
{
IMCC_INFO(interp)->keys[IMCC_INFO(interp)->nkeys++] = (yyvsp[(3) - (3)].sr);
@@ -5087,6 +5675,8 @@
break;
case 330:
+
+/* Line 1464 of yacc.c */
#line 2363 "compilers/imcc/imcc.y"
{
(yyval.sr) = (yyvsp[(1) - (1)].sr);
@@ -5094,58 +5684,79 @@
break;
case 331:
+
+/* Line 1464 of yacc.c */
#line 2369 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'I'); }
break;
case 332:
+
+/* Line 1464 of yacc.c */
#line 2370 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'N'); }
break;
case 333:
+
+/* Line 1464 of yacc.c */
#line 2371 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'S'); }
break;
case 334:
+
+/* Line 1464 of yacc.c */
#line 2372 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_symreg(interp, (yyvsp[(1) - (1)].s), 'P'); }
break;
case 335:
+
+/* Line 1464 of yacc.c */
#line 2373 "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 1464 of yacc.c */
#line 2377 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'S'); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 337:
+
+/* Line 1464 of yacc.c */
#line 2378 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'U'); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 338:
+
+/* Line 1464 of yacc.c */
#line 2382 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'I'); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 339:
+
+/* Line 1464 of yacc.c */
#line 2383 "compilers/imcc/imcc.y"
{ (yyval.sr) = mk_const(interp, (yyvsp[(1) - (1)].s), 'N'); mem_sys_free((yyvsp[(1) - (1)].s)); }
break;
case 340:
+
+/* Line 1464 of yacc.c */
#line 2384 "compilers/imcc/imcc.y"
{ (yyval.sr) = (yyvsp[(1) - (1)].sr); }
break;
-/* Line 1267 of yacc.c. */
-#line 5138 "compilers/imcc/imcparser.c"
+
+/* Line 1464 of yacc.c */
+#line 5749 "compilers/imcc/imcparser.c"
default: break;
}
YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -5156,7 +5767,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. */
@@ -5221,7 +5831,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)
@@ -5238,7 +5848,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;
@@ -5295,9 +5905,6 @@
YY_STACK_PRINT (yyss, yyssp);
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
*++yyvsp = yylval;
@@ -5322,7 +5929,7 @@
yyresult = 1;
goto yyreturn;
-#ifndef yyoverflow
+#if !defined(yyoverflow) || YYERROR_VERBOSE
/*-------------------------------------------------.
| yyexhaustedlab -- memory exhaustion comes here. |
`-------------------------------------------------*/
@@ -5333,7 +5940,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
@@ -5359,6 +5966,8 @@
}
+
+/* Line 1684 of yacc.c */
#line 2390 "compilers/imcc/imcc.y"
Modified: branches/string_macros/compilers/imcc/imcparser.h
==============================================================================
--- branches/string_macros/compilers/imcc/imcparser.h Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/compilers/imcc/imcparser.h Tue Sep 28 19:35:30 2010 (r49367)
@@ -9,27 +9,25 @@
*/
/* HEADERIZER HFILE: none */
/* HEADERIZER STOP */
-/* A Bison parser, made by GNU Bison 2.3. */
+/* A Bison parser, made by GNU Bison 2.4.3. */
/* 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
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+ 2009, 2010 Free Software Foundation, Inc.
+
+ 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 +38,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
@@ -293,21 +292,27 @@
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
typedef union YYSTYPE
-#line 986 "compilers/imcc/imcc.y"
{
+
+/* Line 1685 of yacc.c */
+#line 986 "compilers/imcc/imcc.y"
+
IdList * idlist;
int t;
char * s;
SymReg * sr;
Instruction *i;
-}
-/* Line 1489 of yacc.c. */
-#line 295 "compilers/imcc/imcparser.h"
- YYSTYPE;
+
+
+
+/* Line 1685 of yacc.c */
+#line 299 "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: branches/string_macros/compilers/imcc/pbc.c
==============================================================================
--- branches/string_macros/compilers/imcc/pbc.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/compilers/imcc/pbc.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -10,6 +10,7 @@
#include "pmc/pmc_sub.h"
#include "pmc/pmc_callcontext.h"
#include "parrot/oplib/core_ops.h"
+#include "pmc/pmc_key.h"
/* HEADERIZER HFILE: compilers/imcc/pbc.h */
@@ -57,14 +58,6 @@
__attribute__nonnull__(2)
FUNC_MODIFIES(*r);
-static int add_const_key(PARROT_INTERP,
- ARGIN(const opcode_t *key),
- int size,
- ARGIN(const char *s_key))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(4);
-
PARROT_WARN_UNUSED_RESULT
static int add_const_num(PARROT_INTERP, ARGIN_NULLOK(const char *buf))
__attribute__nonnull__(1);
@@ -84,13 +77,6 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-static int add_const_table(PARROT_INTERP)
- __attribute__nonnull__(1);
-
-static int add_const_table_key(PARROT_INTERP, ARGIN(PMC *key))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
static int add_const_table_pmc(PARROT_INTERP, ARGIN(PMC *pmc))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -213,10 +199,6 @@
#define ASSERT_ARGS_add_1_const __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(r))
-#define ASSERT_ARGS_add_const_key __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(key) \
- , PARROT_ASSERT_ARG(s_key))
#define ASSERT_ARGS_add_const_num __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_add_const_pmc_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -225,11 +207,6 @@
#define ASSERT_ARGS_add_const_str __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(s))
-#define ASSERT_ARGS_add_const_table __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_add_const_table_key __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(key))
#define ASSERT_ARGS_add_const_table_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pmc))
@@ -338,44 +315,6 @@
/*
-=item C<static int add_const_table(PARROT_INTERP)>
-
-Adds an empty item to constant table, returning its position.
-
-=cut
-
-*/
-
-static int
-add_const_table(PARROT_INTERP)
-{
- ASSERT_ARGS(add_const_table)
- const size_t oldcount = interp->code->const_table->const_count;
- const size_t newcount = oldcount + 1;
-
- /* Update the constant count and reallocate */
- if (interp->code->const_table->constants) {
- interp->code->const_table->constants =
- mem_gc_realloc_n_typed_zeroed(interp, interp->code->const_table->constants,
- newcount, oldcount, PackFile_Constant);
- }
- else {
- /* initialize rlookup cache */
- interp->code->const_table->string_hash = parrot_create_hash(interp,
- enum_type_INTVAL,
- Hash_key_type_STRING_enc);
- interp->code->const_table->constants =
- mem_gc_allocate_n_zeroed_typed(interp, newcount, PackFile_Constant);
- }
-
- interp->code->const_table->const_count = newcount;
-
- return oldcount;
-}
-
-
-/*
-
=item C<static int add_const_table_pmc(PARROT_INTERP, PMC *pmc)>
Adds a PMC to the const table, returning its position.
@@ -388,37 +327,20 @@
add_const_table_pmc(PARROT_INTERP, ARGIN(PMC *pmc))
{
ASSERT_ARGS(add_const_table_pmc)
- const int newitem = add_const_table(interp);
- PackFile_Constant * const constant = &interp->code->const_table->constants[newitem];
-
- constant->type = PFC_PMC;
- constant->u.key = pmc;
-
- return newitem;
-}
-
-
-/*
-
-=item C<static int add_const_table_key(PARROT_INTERP, PMC *key)>
-
-Adds a key to the const table, returning its position.
-
-=cut
+ PackFile_ConstTable *ct = interp->code->const_table;
-*/
+ if (!ct->pmc.constants)
+ ct->pmc.constants =
+ mem_gc_allocate_n_zeroed_typed(interp, 1, PMC *);
+ else
+ ct->pmc.constants =
+ mem_gc_realloc_n_typed_zeroed(interp, ct->pmc.constants,
+ ct->pmc.const_count + 1, ct->pmc.const_count, PMC *);
-static int
-add_const_table_key(PARROT_INTERP, ARGIN(PMC *key))
-{
- ASSERT_ARGS(add_const_table_key)
- const int newitem = add_const_table(interp);
- PackFile_Constant * const constant = &interp->code->const_table->constants[newitem];
- constant->type = PFC_KEY;
- constant->u.key = key;
+ ct->pmc.constants[ct->pmc.const_count++] = pmc;
- return newitem;
+ return ct->pmc.const_count - 1;
}
@@ -1127,9 +1049,8 @@
{
ASSERT_ARGS(add_const_str)
- PMC *s_pmc = key_new_string(interp, s);
- PackFile_ConstTable *table = interp->code->const_table;
- int i = PackFile_ConstTable_rlookup(interp, table, s_pmc, PFC_STRING);
+ PackFile_ConstTable *ct = interp->code->const_table;
+ int i = PackFile_ConstTable_rlookup_str(interp, ct, s);
if (i >= 0)
return i;
@@ -1137,14 +1058,27 @@
/* otherwise... */
{
- int k = add_const_table(interp);
- PackFile_Constant *constant = &table->constants[k];
- constant->type = PFC_STRING;
- constant->u.string = s;
+ if (!ct->str.constants)
+ ct->str.constants =
+ mem_gc_allocate_n_zeroed_typed(interp, 1, STRING *);
- parrot_hash_put(interp, table->string_hash, s, (void *)k);
+ else
+ ct->str.constants =
+ mem_gc_realloc_n_typed_zeroed(interp, ct->str.constants,
+ ct->str.const_count + 1, ct->str.const_count, STRING *);
- return k;
+ /* initialize rlookup cache */
+ if (!ct->string_hash)
+ ct->string_hash = parrot_create_hash(interp,
+ enum_type_INTVAL,
+ Hash_key_type_STRING_enc);
+
+ ct->str.constants[ct->str.const_count] = s;
+
+ parrot_hash_put(interp, ct->string_hash, s,
+ (void *)ct->str.const_count);
+
+ return ct->str.const_count++;
}
}
@@ -1164,15 +1098,20 @@
add_const_num(PARROT_INTERP, ARGIN_NULLOK(const char *buf))
{
ASSERT_ARGS(add_const_num)
- const int k = add_const_table(interp);
- STRING * const s = Parrot_str_new(interp, buf, 0);
+ PackFile_ConstTable *ct = interp->code->const_table;
+ STRING * const s = Parrot_str_new(interp, buf, 0);
- PackFile_Constant * const constant = &interp->code->const_table->constants[k];
+ if (!ct->num.constants)
+ ct->num.constants =
+ mem_gc_allocate_n_zeroed_typed(interp, 1, FLOATVAL);
+ else
+ ct->num.constants =
+ mem_gc_realloc_n_typed_zeroed(interp, ct->num.constants,
+ ct->num.const_count + 1, ct->num.const_count, FLOATVAL);
- constant->type = PFC_NUMBER;
- constant->u.number = Parrot_str_to_num(interp, s);
+ ct->num.constants[ct->num.const_count] = Parrot_str_to_num(interp, s);
- return k;
+ return ct->num.const_count++;
}
@@ -1212,7 +1151,7 @@
r = pcc_sub->multi[i];
if (r->set == 'S') {
- STRING * const type_name = ct->constants[r->color].u.string;
+ STRING * const type_name = ct->str.constants[r->color];
const INTVAL type_num = Parrot_pmc_get_type_str(interp, type_name);
if (type_num == enum_type_undef) {
@@ -1225,7 +1164,7 @@
}
else {
PARROT_ASSERT(r->set == 'K');
- sig_pmc = ct->constants[r->color].u.key;
+ sig_pmc = ct->pmc.constants[r->color];
}
VTABLE_set_pmc_keyed_int(interp, multi_sig, i, sig_pmc);
@@ -1256,10 +1195,10 @@
int need_lex)
{
ASSERT_ARGS(create_lexinfo)
- PMC *lex_info = NULL;
- SymHash *hsh = &unit->hash;
- PackFile_Constant *constants = interp->code->const_table->constants;
- const INTVAL lex_info_id = Parrot_get_ctx_HLL_type(interp,
+ PMC *lex_info = NULL;
+ SymHash *hsh = &unit->hash;
+ PackFile_ConstTable *ct = interp->code->const_table;
+ const INTVAL lex_info_id = Parrot_get_ctx_HLL_type(interp,
enum_class_LexInfo);
unsigned int i;
@@ -1284,7 +1223,7 @@
Parrot_Sub_attributes *sub;
PARROT_ASSERT(k >= 0);
- lex_name = constants[k].u.string;
+ lex_name = ct->str.constants[k];
PARROT_ASSERT(PObj_is_string_TEST(lex_name));
PMC_get_sub(interp, sub_pmc, sub);
@@ -1411,9 +1350,9 @@
int i;
int ns_const = -1;
+ SymReg * const ns = unit->_namespace ? unit->_namespace->reg : NULL;
if (unit->_namespace) {
- SymReg * const ns = unit->_namespace->reg;
/* strip namespace off from front */
static const char ns_sep[] = "@@@";
@@ -1479,7 +1418,7 @@
Sub_comp_get_FLAGS(sub) |= (r->pcc_sub->pragma & SUB_COMP_FLAG_MASK);
r->color = add_const_str(interp, IMCC_string_from_reg(interp, r));
- sub->name = ct->constants[r->color].u.string;
+ sub->name = ct->str.constants[r->color];
/* If the unit has no subid, set the subid to match the name. */
if (!unit->subid)
@@ -1496,18 +1435,21 @@
IMCC_string_from_reg(interp, unit->subid));
}
- sub->subid = ct->constants[unit->subid->color].u.string;
+ sub->subid = ct->str.constants[unit->subid->color];
ns_pmc = NULL;
- if (ns_const >= 0 && ns_const < ct->const_count) {
- switch (ct->constants[ns_const].type) {
- case PFC_KEY:
- ns_pmc = ct->constants[ns_const].u.key;
+ if (ns) {
+ switch (ns->set) {
+ case 'K':
+ if (ns_const >= 0 && ns_const < ct->pmc.const_count)
+ ns_pmc = ct->pmc.constants[ns_const];
break;
- case PFC_STRING:
- ns_pmc = Parrot_pmc_new_constant(interp, enum_class_String);
- VTABLE_set_string_native(interp, ns_pmc,
- ct->constants[ns_const].u.string);
+ case 'S':
+ if (ns_const >= 0 && ns_const < ct->str.const_count) {
+ ns_pmc = Parrot_pmc_new_constant(interp, enum_class_String);
+ VTABLE_set_string_native(interp, ns_pmc,
+ ct->str.constants[ns_const]);
+ }
break;
default:
break;
@@ -1600,11 +1542,7 @@
/* store the sub */
{
- const int k = add_const_table(interp);
- PackFile_Constant * const pfc = &ct->constants[k];
-
- pfc->type = PFC_PMC;
- pfc->u.key = sub_pmc;
+ const int k = add_const_table_pmc(interp, sub_pmc);
unit->sub_pmc = sub_pmc;
IMCC_INFO(interp)->globals->cs->subs->pmc_const = k;
@@ -1624,12 +1562,6 @@
: Parrot_str_new(interp, "*none*", 0));
}
- /*
- * create entry in our fixup (=symbol) table
- * the offset is the index in the constant table of this Sub
- */
- PackFile_FixupTable_new_entry(interp, r->name, enum_fixup_sub, k);
-
return k;
}
}
@@ -1637,56 +1569,6 @@
/*
-=item C<static int add_const_key(PARROT_INTERP, const opcode_t *key, int size,
-const char *s_key)>
-
-Adds a constant key to constant_table.
-
-=cut
-
-*/
-
-static int
-add_const_key(PARROT_INTERP, ARGIN(const opcode_t *key), int size, ARGIN(const char *s_key))
-{
- ASSERT_ARGS(add_const_key)
- const SymReg * const r =
- _get_sym(&IMCC_INFO(interp)->globals->cs->key_consts, s_key);
- const opcode_t *rc;
- PackFile_Constant *pfc;
- int k;
-
- if (r)
- return r->color;
-
- pfc = mem_gc_allocate_typed(interp, PackFile_Constant);
- rc = PackFile_Constant_unpack_key(interp,
- interp->code->const_table, pfc, key);
-
- if (!rc) {
- mem_sys_free(pfc);
- IMCC_fatal(interp, 1,
- "add_const_key: PackFile_Constant error\n");
- }
-
- k = add_const_table_key(interp, pfc->u.key);
-
- store_key_const(interp, s_key, k);
-
- IMCC_debug(interp, DEBUG_PBC_CONST, "\t=> %s #%d size %d\n",
- s_key, k, size);
-
- IMCC_debug(interp, DEBUG_PBC_CONST, "\t %x /%x %x/ /%x %x/\n",
- key[0], key[1], key[2], key[3], key[4]);
-
- mem_sys_free(pfc);
-
- return k;
-}
-
-
-/*
-
=item C<static opcode_t build_key(PARROT_INTERP, SymReg *key_reg)>
Builds a Key PMC from the given SymReg.
@@ -1703,30 +1585,23 @@
build_key(PARROT_INTERP, ARGIN(SymReg *key_reg))
{
ASSERT_ARGS(build_key)
-#define MAX_KEY_LEN 10
-#define MAX_KEYNAME_LEN 20
- SymReg *reg = key_reg->set == 'K' ? key_reg->nextkey : key_reg;
-
- char s_key[MAX_KEY_LEN * MAX_KEYNAME_LEN];
- opcode_t key[MAX_KEY_LEN * 2 + 1];
- opcode_t size;
- int key_length = 0; /* P0["hi;there"; S0; 2] has length 3 */
- int k;
-
- /* 0 is length */
- opcode_t *pc = key + 1;
-
- /* stringified key */
- char *s = s_key;
- *s = 0;
+ PackFile_ConstTable *ct = interp->code->const_table;
+ SymReg *reg = key_reg->set == 'K' ? key_reg->nextkey : key_reg;
+ PMC *head = NULL;
+ PMC *tail = NULL;
+ opcode_t regno, k;
- for (key_length = 0; reg ; reg = reg->nextkey, key_length++) {
+ for (; reg; reg = reg->nextkey) {
SymReg *r = reg;
- if (key_length >= MAX_KEY_LEN)
- IMCC_fatal(interp, 1, "build_key:"
- "Key too long, increase MAX_KEY_LEN.\n");
+ if (tail) {
+ SETATTR_Key_next_key(interp, tail, Parrot_pmc_new_constant(interp, enum_class_Key));
+ GETATTR_Key_next_key(interp, tail, tail);
+ }
+ else {
+ head = tail = Parrot_pmc_new_constant(interp, enum_class_Key);
+ }
switch (r->type) {
case VTIDENTIFIER: /* P[S0] */
@@ -1737,21 +1612,16 @@
if (r->reg)
r = r->reg;
+ /* don't emit mapped regs in key parts */
+ regno = r->color >= 0 ? r->color : -1 - r->color;
+
if (r->set == 'I')
- *pc++ = PARROT_ARG_I; /* register type */
+ key_set_register(interp, tail, regno, KEY_integer_FLAG);
else if (r->set == 'S')
- *pc++ = PARROT_ARG_S;
+ key_set_register(interp, tail, regno, KEY_string_FLAG);
else
IMCC_fatal(interp, 1, "build_key: wrong register set\n");
- /* don't emit mapped regs in key parts */
- if (r->color < 0)
- *pc++ = -1 - r->color;
- else
- *pc++ = r->color;
-
- sprintf(s+strlen(s), "%c%d", r->set, (int)r->color);
-
IMCC_debug(interp, DEBUG_PBC_CONST,
" keypart reg %s %c%d\n",
r->name, r->set, (int)r->color);
@@ -1764,30 +1634,15 @@
switch (r->set) {
case 'S': /* P["key"] */
/* str constant */
- *pc++ = PARROT_ARG_SC;
-
- /* constant idx */
- *pc++ = r->color;
-
- IMCC_debug(interp, DEBUG_PBC_CONST,
- " keypart SC %s #%d\n",
- r->name, r->color);
+ key_set_string(interp, tail, ct->str.constants[r->color]);
break;
case 'I': /* P[;42;..] */
/* int constant */
- *pc++ = PARROT_ARG_IC;
-
- /* value */
- *pc++ = r->color = atol(r->name);
-
- IMCC_debug(interp, DEBUG_PBC_CONST,
- " keypart IC %s #%d\n",
- r->name, r->color);
+ key_set_integer(interp, tail, atol(r->name));
break;
default:
IMCC_fatal(interp, 1, "build_key: unknown set\n");
}
- sprintf(s+strlen(s), "%cc" INTVAL_FMT, r->set, r->color);
break;
default:
IMCC_fatal(interp, 1, "build_key: "
@@ -1795,13 +1650,21 @@
}
}
- key[0] = key_length;
- size = pc - key;
+ {
+ STRING *name = key_set_to_string(interp, head);
+ const char *cname = Parrot_str_to_cstring(interp, name);
+ SymReg * const r = _get_sym(&IMCC_INFO(interp)->globals->cs->key_consts, cname);
+
+ if (r) {
+ k = r->color;
+ }
+ else {
+ k = add_const_table_pmc(interp, head);
+ store_key_const(interp, cname, k);
+ }
- /* now we have a packed key, which packfile can work on */
- /* XXX endianess? probably no, we pack/unpack on the very
- * same computer */
- k = add_const_key(interp, key, size, s_key);
+ Parrot_str_free_cstring((char *)cname);
+ }
/* single 'S' keys already have their color assigned */
if (key_reg->set == 'K')
@@ -2226,7 +2089,7 @@
{
ASSERT_ARGS(verify_signature)
PMC *changed_sig = NULL;
- PMC * const sig_arr = interp->code->const_table->constants[pc[-1]].u.key;
+ PMC * const sig_arr = interp->code->const_table->pmc.constants[pc[-1]];
op_lib_t *core_ops = PARROT_GET_CORE_OPLIB(interp);
int needed = 0;
int no_consts = (ins->op == &core_ops->op_info_table[PARROT_OP_get_results_pc]
Modified: branches/string_macros/compilers/opsc/src/Ops/Emitter.pm
==============================================================================
--- branches/string_macros/compilers/opsc/src/Ops/Emitter.pm Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/compilers/opsc/src/Ops/Emitter.pm Tue Sep 28 19:35:30 2010 (r49367)
@@ -375,7 +375,7 @@
* .ops files). by {self<script>}.
*
* Any changes made here will be lost! To regenerate this file after making
- * changes to any ops, use the bootstap-ops makefile target.
+ * changes to any ops, use the bootstrap-ops makefile target.
*
*/
|);
Modified: branches/string_macros/compilers/opsc/src/Ops/Trans/C.pm
==============================================================================
--- branches/string_macros/compilers/opsc/src/Ops/Trans/C.pm Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/compilers/opsc/src/Ops/Trans/C.pm Tue Sep 28 19:35:30 2010 (r49367)
@@ -24,12 +24,12 @@
:k("PREG(NUM)"),
:ki("IREG(NUM)"),
- :ic("cur_opcode[NUM]"),
- :nc("CONST(NUM).u.number"),
- :pc("CONST(NUM).u.key"),
- :sc("CONST(NUM).u.string"),
- :kc("CONST(NUM).u.key"),
- :kic("cur_opcode[NUM]")
+ :ic("ICONST(NUM)"),
+ :nc("NCONST(NUM)"),
+ :pc("PCONST(NUM)"),
+ :sc("SCONST(NUM)"),
+ :kc("PCONST(NUM)"),
+ :kic("ICONST(NUM)")
);
self;
@@ -108,14 +108,17 @@
method defines($emitter) {
return qq|
/* defines - Ops::Trans::C */
-#undef CONST
#define REL_PC ((size_t)(cur_opcode - (opcode_t *)interp->code->base.data))
#define CUR_OPCODE cur_opcode
#define IREG(i) (CUR_CTX->bp.regs_i[cur_opcode[i]])
#define NREG(i) (CUR_CTX->bp.regs_n[-1L - cur_opcode[i]])
#define PREG(i) (CUR_CTX->bp_ps.regs_p[-1L - cur_opcode[i]])
#define SREG(i) (CUR_CTX->bp_ps.regs_s[cur_opcode[i]])
-#define CONST(i) Parrot_pcc_get_constants(interp, interp->ctx)[cur_opcode[i]]
+#define ICONST(i) cur_opcode[i]
+#define NCONST(i) Parrot_pcc_get_num_constants(interp, interp->ctx)[cur_opcode[i]]
+#define SCONST(i) Parrot_pcc_get_str_constants(interp, interp->ctx)[cur_opcode[i]]
+#undef PCONST
+#define PCONST(i) Parrot_pcc_get_pmc_constants(interp, interp->ctx)[cur_opcode[i]]
static int get_op(PARROT_INTERP, const char * name, int full);
|;
Modified: branches/string_macros/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- branches/string_macros/compilers/pct/src/PAST/Compiler.pir Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/compilers/pct/src/PAST/Compiler.pir Tue Sep 28 19:35:30 2010 (r49367)
@@ -931,7 +931,7 @@
$S0 = self.'unique'('control_')
ctrllabel = $P0.'new'('result'=>$S0)
$S0 = self.'uniquereg'('P')
- bpost.'push_pirop'('new', $S0, "'ExceptionHandler'", '.CONTROL_RETURN')
+ bpost.'push_pirop'('new', $S0, "['ExceptionHandler']", '.CONTROL_RETURN')
bpost.'push_pirop'('set_addr', $S0, ctrllabel)
bpost.'push_pirop'('push_eh', $S0)
bpost.'add_directive'('.include "except_types.pasm"')
Modified: branches/string_macros/config/gen/makefiles/root.in
==============================================================================
--- branches/string_macros/config/gen/makefiles/root.in Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/config/gen/makefiles/root.in Tue Sep 28 19:35:30 2010 (r49367)
@@ -202,7 +202,6 @@
runtime/parrot/include/dlopenflags.pasm \
runtime/parrot/include/longopt.pasm \
runtime/parrot/include/packfile_segments.pasm \
- runtime/parrot/include/packfile_constants.pasm \
runtime/parrot/include/packfile_annotation_key_type.pasm \
runtime/parrot/include/stat.pasm \
runtime/parrot/include/stringinfo.pasm \
@@ -410,6 +409,7 @@
$(INC_DIR)/core_pmcs.h \
$(INC_DIR)/compiler.h \
$(INC_DIR)/cclass.h \
+ $(INC_DIR)/list.h \
include/pmc/pmc_callcontext.h
# generated list of header files
@@ -463,8 +463,11 @@
src/gc/api$(O) \
src/gc/gc_ms$(O) \
src/gc/gc_inf$(O) \
+ src/gc/gc_ms2$(O) \
src/gc/mark_sweep$(O) \
src/gc/system$(O) \
+ src/gc/fixed_allocator$(O) \
+ src/gc/variable_size_pool$(O) \
src/gc/string_gc$(O) \
src/global_setup$(O) \
src/hash$(O) \
@@ -479,6 +482,7 @@
src/call/context_accessors$(O) \
src/key$(O) \
src/library$(O) \
+ src/list$(O) \
src/longopt$(O) \
src/misc$(O) \
src/multidispatch$(O) \
@@ -920,6 +924,8 @@
src/null_config$(O) : $(PARROT_H_HEADERS) src/null_config.c
+src/list$(O): $(PARROT_H_HEADERS) include/pmc/pmc_callcontext.h src/list.c
+
src/oo$(O) : $(PARROT_H_HEADERS) include/pmc/pmc_class.h src/oo.c \
include/pmc/pmc_object.h src/oo.str $(INC_DIR)/oo_private.h
@@ -1201,8 +1207,6 @@
runtime/parrot/include/packfile_segments.pasm : $(INC_DIR)/packfile.h $(H2INC)
$(PERL) $(H2INC) $(INC_DIR)/packfile.h $@
-runtime/parrot/include/packfile_constants.pasm : $(INC_DIR)/packfile.h $(H2INC)
- $(PERL) $(H2INC) $(INC_DIR)/packfile.h $@
runtime/parrot/include/packfile_annotation_key_type.pasm : $(INC_DIR)/packfile.h $(H2INC)
$(PERL) $(H2INC) $(INC_DIR)/packfile.h $@
@@ -1297,11 +1301,19 @@
src/gc/gc_inf$(O) : $(PARROT_H_HEADERS) src/gc/gc_private.h src/gc/gc_inf.c
+src/gc/gc_ms2$(O) : $(PARROT_H_HEADERS) src/gc/gc_private.h src/gc/fixed_allocator.h src/gc/gc_ms2.c
+
src/gc/api$(O) : $(PARROT_H_HEADERS) src/gc/gc_private.h src/gc/api.c
src/gc/alloc_resources$(O) : $(PARROT_H_HEADERS) \
src/gc/gc_private.h src/gc/alloc_resources.c
+src/gc/fixed_allocator$(O) : $(PARROT_H_HEADERS) \
+ src/gc/fixed_allocator.h src/gc/fixed_allocator.c
+
+src/gc/variable_size_pool$(O) : $(PARROT_H_HEADERS) \
+ src/gc/variable_size_pool.h src/gc/variable_size_pool.c
+
src/gc/string_gc$(O) : $(PARROT_H_HEADERS) \
src/gc/gc_private.h src/gc/string_gc.c
Modified: branches/string_macros/docs/embed.pod
==============================================================================
--- branches/string_macros/docs/embed.pod Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/docs/embed.pod Tue Sep 28 19:35:30 2010 (r49367)
@@ -529,8 +529,6 @@
=item C<PackFile_destroy>
-=item C<PackFile_find_in_const>
-
=item C<PackFile_fixup_subs>
=item C<PackFile_new>
Deleted: branches/string_macros/docs/pdds/draft/pdd31_hll_interop.pod
==============================================================================
--- branches/string_macros/docs/pdds/draft/pdd31_hll_interop.pod Tue Sep 28 19:35:30 2010 (r49366)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,606 +0,0 @@
-# Copyright (C) 2008-2010, Parrot Foundation.
-# $Id$
-
-=head1 [DRAFT] PDD 31: Inter-Language Calling
-
-=head2 Abstract
-
-This PDD describes Parrot's conventions and support for communication between
-high-level languages (HLLs). It is focused mostly on what implementors should
-do in order to provide this capability to their users.
-
-=head2 Version
-
-$Revision$
-
-=head2 Description
-
-The ability to mix different high-level languages at runtime has always been
-an important design goal of Parrot. Another important goal, that of
-supporting all dynamic languages, makes language interoperability especially
-interesting -- where "interesting" means the same as it does in the Chinese
-curse, "May you live in interesting times." It is expected that language
-implementers, package authors, and package users will have to be aware of
-language boundaries when writing their code. It is hoped that this will not
-become too burdensome.
-
-None of what follows is binding on language implementors, who may do whatever
-they please. Nevertheless, we hope they will at least follow the spirit of
-this document so that the code they produce can be used by the rest of the
-Parrot community, and save the fancy footwork for intra-language calling.
-However, this PDD B<is> binding on Parrot implementors, who must provide a
-stable platform for language interoperability to the language implementors.
-
-=head3 Ground rules
-
-In order to avoid N**2 complexity and the resulting coordination headaches,
-each language compiler provides an interface as a target for other languages
-that should be designed to require a minimum of translation. In the general
-case, some translation may be required by both the calling language and the
-called language:
-
-{{ There seems to be an implied basic assumption here that language
-interoperability is the responsibility of the language implementor. It is not.
-We cannot require that language implementors design and implement their
-languages according to some global specification. Any interoperability
-infrastructure must be provide by Parrot, and must work for all languages.
---allison }}
-
- |
- |
- | Calling sub
- | |
- | Language X |
- | V
- | Calling stub
- +================ |
- |
- "plain Parrot" |
- |
- +================ |
- | V
- | Called wrapper
- | |
- | |
- | Language Y V
- | Called sub
- |
-
-Where necessary, a language may need to provide a "wrapper" sub to interface
-external calls to the language's internal calling and data representation
-requirements. Such wrappers are free to do whatever translation is required.
-
-Similarly, the caller may need to emit a stub that converts an internal call
-into something more generic.
-
-{{ Of course, "stub" is really too close to "sub", so we should find a better
-word. Doesn't the C community call these "bounce routines"? Or something?
--- rgr, 31-Jul-08.
-
-The language will never provide a wrapper for its subs. For the most part,
-wrappers will be unnecessary. Where a wrapper is desired to make a library
-from some other language act more like a "native" library, the person who
-desires the native behavior can implement the wrapper and make it publicly
-available. --allison }}
-
-{{ I am discovering that there are five different viewpoints here,
-corresponding to the five layers (including "plain Parrot") of the diagram
-above. I need to make these viewpoints clearer, and describe the
-responsibilities of each of these parties to each other. -- rgr, 31-Jul-08.
-}}
-
-Languages are free to implement the stub and wrapper layers (collectively
-called "glue") as they see fit. In particular, they may be inlined in the
-caller, or integral to the callee.
-
-Ideally, of course, the "plain Parrot" layer will be close enough to the
-semantics of both languages that glue code is unnecessary, and the call can be
-made directly. Language implementors are encouraged to dispense with glue
-whenever possible, even if glue is sometimes required for the general case.
-
-In summary:
-
-=over 4
-
-=item *
-
-Each HLL gets its own namespace subtree, within which C<get_hll_global> and
-C<set_hll_global> operate. In order to make external calls, the HLL must
-provide a means of identifying the language, the function, and enough
-information about the arguments and return values for the calling language to
-generate the call correctly. This is necessarily language-dependent, and is
-beyond the scope of this document.
-
-=item *
-
-When calling across languages, both the caller and the callee should try to
-use "plain Parrot semantics" to the extent possible. This is explained in
-more detail below, but essentially means to use the simplest calling
-conventions and PMC classes possible. Ideally, if an API uses only PMCs that
-are provided by a "bare Parrot" (i.e. one without any HLL runtime code), then
-it should be possible to use this API from any other language.
-
-{{ This is unnecessarily restrictive --allison }}
-
-=item *
-
-It is acceptable for languages to define subs for internal calling that are
-not suitable for external calling. Such subs should be marked as such, and
-other languages should respect those distinctions. (Or, if they choose to
-call intra-language subs, they should be very sure they understand that
-language's calling conventions.
-
-{{ It's not possible to define a sub that can't be called externally
---allison }}
-
-=back
-
-=head2 Half-Baked Ideas
-
-{{ Every draft PDD should have one of these. ;-} -- rgr, 28-Jul-08. }}
-
-=head3 Common syntax for declaring exported functions?
-
-I assume we will need some additional namespace support. Not clear yet
-whether it's better to mark the ones that or OK for external calling, or the
-ones that are not.
-
-(As you can guess, I don't have a strong suggestion for what to call these
-functions yet. Do we call them "external"? Would that get confused with
-intra-language public interfaces?)
-
-Beyond that, we probably need additional metainformation on the external subs
-so that calling compilers will know what code to emit. Putting them on the
-subs means that the calling compiler just needs to load the PBC in order to
-access the module API (though it may need additional hints). Of course, that
-also requires a PIR API for accessing this metainformation . . .
-
-{{ Exporting is very much a Perl idea, not much applicability for exporting
-outside of Perl. --allison}}
-
-Crazy idea: This is more or less the same information (typing) required for
-multimethods. If we encourage the export of multisubs, then the exporting
-language could provide multiple interfaces, and the calling compiler could
-query the set of methods for the one most suitable.
-
-{{ Proposal rejected, because we aren't going with "external" and "internal"
-subroutine variants, so it's not needed. --allison }}
-
-=head3 More namespace complexity?
-
-{{ Proposal rejected, because we aren't going with "external" and "internal"
-subroutine variants, so it's not needed. --allison }}
-
-It might be good to have some way for HLLs to define a separate external
-definition for a given sub (i.e. one that provides the wrapper) that can be
-done without too much namespace hair. I.e.
-
- .sub foo :extern
-
-defines the version that is used by interlanguage calling, and
-
- .sub foo
-
-defines the version that is seen by other code written in that language
-(i.e. via C<get_hll_global>). If there is no plain C<foo>, the C<:extern>
-version is used for internal calls. That way, the compiler can emit both
-wrapper code and internal code without having to do anything special (much),
-even if different calling conventions and/or data conversions are required.
-
-{{ Of course, this wouldn't be necessary if all external subs were multisubs.
--- rgr, 31-Jul-08. }}
-
-=head3 Multiple type hierarchies?
-
-Different languages will have to "dress up" the Parrot type/class hierarchy
-differently. For example, Common Lisp specifies that C<STRING> is a subtype
-of C<VECTOR>, which in turn is a subtype of C<ARRAY>. This is not likely to
-be acceptable to other languages, so Lisp needs its own view of type
-relationships, which must affect multimethod dispatch for Lisp generic
-functions, i.e. a method defined for C<VECTOR> must be considered when passed
-a string as a parameter.
-
-{{ Common Lisp (for example) will have its own set of type relationships,
-because it will have its own set of types. There will be no "remapping" of
-core types --allison }}
-
-The language that owns the multisub gets to define the type hierarchy and
-dispatch rules used when it gets called. In order to handle objects from
-foreign languages, the "owning" language must decide where to graft the
-foreign class inheritance graph into its own graph. {{ It would be nice if
-some Parrot class, e.g. C<Object>, could be defined as the conventional place
-to root language-specific object class hierarchies; that way, a language would
-only have to include C<Object> in order to incorporate objects from all other
-conforming languages. -- rgr, 26-Aug-08. }}
-
-{{ The language that owns the multisub does get to define the dispatch rules
-for the multisub. But, it doesn't get to alter the type hierarchy of objects
-from other languages. --allison }}
-
-Note that common Parrot classes will in general appear in different places in
-different languages' dispatch hierarchies, so it is important to bear in mind
-which language "owns" the dispatch.
-
-{{ Absolutely not true. --allison }}
-
-=head2 Definitions
-
-{{ Collect definitions of new jargon words here, once we figure out what they
-should be. -- rgr, 29-Jul-08. }}
-
-=head2 Implementation
-
-=head3 Plain Parrot Semantics
-
-Fortunately, "plain Parrot" is pretty powerful, so the "common denominator" is
-not in fact the lowest possible. For example, not all Parrot languages
-support named, optional, or repeated arguments. For the called language, this
-is never a problem; calling module can only use the subset API anyway.
-Implementers of subset calling languages are encouraged to provide their users
-with an extended API for the interlanguage call; typically, this is only
-required for named arguments.
-
-{{ This needs more? -- rgr, 28-Jul-08. }}
-
-=head3 Strings
-
- {{ I am probably not competent to write this section. At the very least,
- it requires discussion of languages that expect strings to be mutable
- versus . . . Java. -- rgr, 28-Jul-08. }}
-
-=head3 Other scalar data types
-
-All Parrot language implementations should stick to native Parrot PMC types
-for scalar data, except in case of dire need. To see with this is so, take
-the particular case of integer division, which differs significantly between
-languages.
-
-{{ No, this is completely backwards. Languages are heartily encouraged to
-create their own PMCs for any and all common variable types found in the
-language. --allison }}
-
-In Tcl, "the integer three divided by the integer five" produces the integer
-value 0.
-
-In Perl 5 and Lua, this division produces the floating-point value 0.6. (This
-happens to be Parrot's native behavior as well.)
-
-In Common Lisp, this division produces "3/5", a number of type C<RATIO> with
-numerator 3 and denominator 5 that represents the mathematically-exact result.
-
-Furthermore, no Perl 5 code, when given two integers to divide, will expect a
-Common Lisp ratio as a result. Any Perl 5 implementation that does this has a
-bug, even if both those integers happen to come from Common Lisp. Ditto for a
-floating-point result from Common Lisp code that happens to get two integers
-from Perl or Lua (or both!).
-
-{{ Not a bug, it's the expected result. Divide operations are
-multi-dispatched. If you pass two Common Lisp integers into a divide
-operation in Perl 5, it'll search for the best matching multi, and if it finds
-one for Common Lisp integers (an exact match), it'll run that and return a
-Common Lisp ratio. --allison }}
-
-Even though these languages all use "/" to represent division, they do not all
-mean the same thing by it, and similarly for most (if not all) other built-in
-arithmetic operators. However, they pretty clearly B<do> mean the same thing
-by (e.g.) "the integer with value five," so there is no need to represent the
-inputs to these operations differently; they can all be represented by the
-same C<Integer> PMC class.
-
-{{ The whole point of having sets of PMCs in different languages is to handle
-the case where "it's an integer, but has a different division operation than
-other languages" --allison}}
-
-{{ Must also discuss morphing: If some languages do it and other do not, then
-care must be taken at the boundaries. -- rgr, 31-Jul-08. }}
-
-=head4 Defining new scalar data types
-
-There will be cases where existing Parrot PMC classes cannot represent a
-primitive HLL scalar type, and so a new PMC class is required. In this case,
-interoperability cannot be guaranteed, since it may not be possible to define
-behavior for such objects in other languages. But the choice of a new PMC is
-forced, so we must make the best of it.
-
-{{ Yes, except this is the common case, and interoperability will still work
---allison }}
-
-A good case in point is that of complex rational numbers in Common Lisp. The
-C<Complex> type provided by Parrot assumes that its components are
-floating-point numbers. This is a suitable representation type for C<(COMPLEX
-REAL)>, but CL partitions "COMPLEX" into C<(COMPLEX REAL)> and C<(COMPLEX
-RATIONAL)>, with the latter being further divided into C<(COMPLEX RATIO)>,
-C<(COMPLEX INTEGER)>, etc. The straightforward way to provide this
-functionality is to define a C<ComplexRational> PMC that is built on
-C<Complex> and has real and imaginary PMC components that are constrained to
-be Integer, Bigint, or Ratio PMCs.
-
-So how do we make C<(COMPLEX RATIONAL)> arithmetic work as broadly as
-possible?
-
-The first aspect is defining how the new type actually works within its own
-language. The Lisp arithmetic operators will usually return a ComplexRational
-if given one, but need to return a RATIONAL subtype if the imaginary part is
-zero, and that may not be suitable for other languages, so Lisp needs its own
-set of basic arithmetic operators. We must therefore define methods on these
-multis that specialize ComplexRational (and probably the generic arithmetic to
-redispatch on the type of the real and imaginary parts; you know the drill).
-But, in case we are also passed another operand that is another language's
-exotic type, we should take care to use the most general possible class to
-specialize the other operands, in the hope that other exotics are subclasses
-of these.
-
-{{ It is perfectly fine for a Lisp arithmetic operator to return a RATIONAL
-subtype. Please don't define methods for a pile of operations that already
-have vtable functions --allison }}
-
-The other aspect is extending other languages' arithmetic to do something
-reasonable with our exotic types. If we're lucky, Parrot will provide a basic
-multisub that takes care of most cases, and we just need to add method(s) to
-that. If not, we will have to add specialized methods on the other language's
-multisub, trying to redispatch to the other language's arithmetic ops passing
-the (hopefully more generic) component PMCs. Doing so is still the
-responsibility of the language that defines the exotic class, since it is in
-charge of its internal representation.
-
-{{ The default multi for a common operation like division will call the PMC's
-C<get_number> vtable function, perform a standard division operation, and
-return a standard Integer/Number/BigNum. --allison }}
-
-{{ We can define multimethods on another language without loading it, can't
-we? If not, then making this work may require negotiation between language
-implementors, if it is feasible at all. -- rgr, 31-Jul-08. }}
-
-{{ I'm not sure what you mean by defining multimethods on another language.
-Perhaps you're asking if it's possible to declare a multisub for a type that
-doesn't exist yet? --allison }}
-
-This brings us to a number of guidelines for defining language-specific
-arithmetic so as to maximize interoperability:
-
-=over 4
-
-=item 1.
-
-Define language-specific operations using multimethods (to avoid conflict with
-other languages).
-
-{{ Clarify? How would non-multi's conflict? --allison }}
-
-=item 2.
-
-Define them on the highest (most general) possible PMC classes (in order that
-they continue to work if passed a subclass by a call from a different
-language).
-
-{{ Define them on the class that makes sense. There's no point in targeting
-any particular level of the inheritance hierarchy. --allison }}
-
-=item 3.
-
-Don't define a language-specific PMC class unless there is clear need for a
-different internal representation. (And even then, you might consider
-donating it to become part of the Parrot core.)
-
-{{ This is definitely not true. --allison }}
-
-=back
-
-{{ The fundamental rule is to implement your language in the way that makes
-the most sense for your language. Language implementors don't have to think
-about interoperability. --allison }}
-
-The rest of this section details exceptions and caveats in dealing with scalar
-data types.
-
-=head4 "Fuzzy" scalars
-
-Some languages are willing to coerce strings to numbers and vice versa without
-any special action on the part of the programmer and others are not. The
-problem arises when such "fuzzy" scalars are passed (or returned) to languages
-that do not support "fuzzy" coercion . . .
-
-{{ This section is meant to answer Geoffrey's "What does Lisp do with a Perl 5
-Scalar?" question. I gotta think about this more. -- rgr, 29-Jul-08. }}
-
-{{ The scalar decides when to morph, not the language. All the languages that
-have morphing scalars implement them in such a way that they know how to
-handle, for example, morphing when a string value is assigned to an integer
-scalar, and what to do if that value is later used as an integer again.
---allison }}
-
-=head4 C<Complex> numbers
-
-Not all languages support complex numbers, so if an exported function requires
-a complex argument, it should either throw a suitable error, or coerce an
-acceptable numeric argument. In the latter case, be sure to advertise this in
-the documentation, so that callers without complex numbers can tell their
-compiler that acceptable numeric type.
-
-{{ All documentation for a library should state what argument types it accepts
-and what results it returns, there's nothing unique about complex numbers.
---allison }}
-
-=head4 C<Ratio> numbers
-
-Not all languages support ratios (rather few, actually), so if an exported
-function requires a ratio as an argument, it should either throw a suitable
-error, or convert an acceptable numeric value.
-
-However, since ratios are rare (and it is rather eccentric for a program to
-insist on a ratio as a parameter), it is strongly advised to accept a floating
-point or integer value, and convert it in the wrapper.
-
-{{ All documentation for a library should state what argument types it accepts
-and what results it returns, there's nothing unique about ratios. --allison }}
-
-
- {{ Parrot does not support these yet, so this is not a current issue. --
- rgr, 28-Jul-08. }}
-
-=head3 Aggregate data types
-
-{{ I probably haven't done these issues justice; I don't know enough Java or
-Tcl to grok this part of the list discussion. -- rgr, 28-Jul-08. }}
-
-Aggregates (hashes, arrays, and struct-like thingies) can either be passed
-directly, or mapped by wrapper or caller code into something different. The
-problem with mapping, besides being slow, is that if I<either> the caller or
-the callee does this, the aggregate is effectively read-only. (It is possible
-for the wrapper to stuff the changes back in the original structure by side
-effect, but this has its own set of problems.)
-
-{{ Mapping is generally discouraged, but I don't see any reason it would make
-the aggregate read-only. You can certainly convert a Python dictionary to a
-Perl hash, use it in your Perl code, and then either return it as a Perl hash,
-or convert it back to a Python dictionary. --allison }}
-
-In other words, if the mapping is not straightforward, it may not be possible.
-If the mapping C<is> straightforward it may not be necessary -- and an
-unnecessary mapping may limit use of the called module's API.
-
-Struct-like objects are problematic. They are normally considered as
-low-level and language-specific, and handled by emitting special code for slot
-accessor/setter function, which other language compilers won't necessarily
-know how to do. The choices are therefore to (a) treat them like black boxes
-in the other language, or (b) provide a separate functional or OO API (or
-both) for calling from other languages.
-
-{{ (a) is generally preferred --allison }}
-
-Several questions arise for languages with multiple representations for
-aggregate types. Typically, this is because these types are more restricted
-in some fashion. [finish. -- rgr, 29-Jul-08.]
-
-{{ Not clear where you're going with this --allison }}
-
-=head3 Functional data types
-
-In a sense, functional types (i.e. callable objects) are the easiest things to
-pass across languages, since they require no mapping at all. On the other
-hand, if a language doesn't support functional arguments, then there is no
-hope of using an API written in another language that requires them.
-
-{{ Hmmm? They're just subs, how would they not be callable from another
-language? --allison }}
-
-=head3 Datum vs. object
-
-Some languages present everything to the programmer as an object; in such
-languages, code only exists in methods. A few languages have no methods, only
-functions (and/or subroutines) and "passive" data. The remainder have both,
-and pose no problem calling into the others.
-
-But how does an obligate OO language call a non-OO language, or vice versa?
-An extreme case would be Ruby (which has only objects) and Scheme (which (as
-far as Ruby is concerned) has none). What good is a Ruby object as a datum to
-a Scheme program if Scheme can't access any of the methods? Similarly, what
-could Ruby do with a Scheme list when it can't even get to the Scheme C<car>
-function?
-
-{{ Except that Ruby would never even get a Scheme list in the first place if
-it hadn't loaded a Scheme library of some sort. And, being a list, the Scheme
-list would still support the standard vtable functions for lists. --allison }}
-
-{{ Methinks the right thing would be to define a common introspection API (a
-good thing in its own right). Scheme and Ruby should each define their own
-implementation of the same in "plain Parrot semantics" terms, independently.
-The caller can then use his/her language's binding of the introspection API to
-poke around in the other module, and find the necessary tools to call the
-other. For Scheme, this would mean functions for finding Ruby classes and
-providing functional wrappers around methods. For Ruby, I admit this would
-probably be even weirder. In any case, it is important that the calling user
-not need anything out of the ordinary, from either language or the called
-module author. -- rgr, 29-Jul-08. }}
-
-{{ There is a common introspection API, the 'inspect' vtable function. But
-what you're describing here isn't introspection, it's actually the standard
-vtable functions. --allison }}
-
-=head4 Defining methods across language boundaries
-
-{{ Is the term "unimethod" acceptable here? -- rgr, 29-Jul-08. They're just
-methods or subroutines, and it's just "single dispatch". --allison}}
-
-There will be cases where a module user wants to extend that module by
-defining a new method on an externally-defined class, or add a multimethod to
-an externally-defined multisub. Since a class with unimethod dispatch belongs
-wholly to the external language, the calling language (i.e. the one adding the
-method) must use the semantics of the external language. If the external
-language uses a significantly different metamodel, simply adding the
-C<:method> pragma may not cut it.
-
-{{ No, the C<:method> flag is always all you need to define a method. The
-class object you add the method to determines what it does with that method.
---allison }}
-
-There are two cases: (1) The calling language is adding a new method, which
-cannot therefore interfere with existing usage in the called language; and (2)
-the calling language is attempting to extend an existing interface provided by
-the called language. In the first case, the calling compiler has the option
-of treating the new method as part of the calling language, and dispensing
-with the glue altogether. In the second case, the compiler must treat the new
-method as part of the foreign language, and provide B<both> glue layers (as
-necessary) around it. It is therefore not expected that all compilers will
-provide a way to define methods on all foreign classes for all language pairs.
-
-{{ These should generally be handled by subclassing the parent language class,
-and adding your method to the subclass. Monkeypatching is certainly possible,
-but not encouraged. And, there really isn't any distinction between "treating
-the new method as part of the calling language" and "treat[ing] the new method
-as part of the foreign language". It's a method, you call it on an object, the
-class of the object determines how it's found and invoked. --allison }}
-
-Multimethods are easier; although the multisub does belong conceptually to one
-language (from whose namespace the caller must find the multisub), multis are
-more loosely coupled to their original language.
-
-{{ Well, the semantics of the language that defined the multisub also
-determine how it is found and invoked. --allison }}
-
-The cases for multimethods are similar, though: (1) If the calling language
-method is specialized to classes that appear only in the calling module, then
-other uses of the multisub will never call the new method, and the calling
-language can choose to treat as internal. (2) If the calling method is
-specialized only on Parrot or called-language classes, then the compiler
-should take care to make it generally usable.
-
-{{ Not sure what you mean here. --allison }}
-
-=head4 Subclassing across language boundaries
-
-{{ This is an important feature, but requires compatible metamodels. -- rgr,
-29-Jul-08.
-
-Or Proxy PMCs, which is how we're currently handling inheritance across
-metamodel boundaries. --allison
-}}
-
-=head4 Method vs. multimethod
-
-{{ This is the issue where some languages (e.g. Common Lisp) use only
-multimethods, where others (e.g. Ruby) use only unimethods. (S04 says
-something about MMD "falling back" to unimethods, but so far this is not
-described in Parrot.) Calling is easy; multimethods look like functions, so
-the MM language just has to create a function (or MM) wrapper for the UM
-language, and a UM language can similarly treat a MM call as a normal function
-call. (Which will require the normal "make the function look like a method"
-hack for obligate OO languages like Ruby.) Defining methods across the
-boundary is harder, and may not be worth the trouble. -- rgr, 29-Jul-08. }}
-
-{{ That's "multiple dispatch" and "single dispatch". In general, defining code
-in one language and injecting it into the namespace of another language isn't
-the primary focus of language interoperability. Using libraries from other
-languages is. --allison }}
-
-=head2 References
-
-None.
-
-=cut
-
-__END__
-Local Variables:
- fill-column:78
-End:
-vim: expandtab shiftwidth=4:
Modified: branches/string_macros/docs/pdds/pdd09_gc.pod
==============================================================================
--- branches/string_macros/docs/pdds/pdd09_gc.pod Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/docs/pdds/pdd09_gc.pod Tue Sep 28 19:35:30 2010 (r49367)
@@ -5,7 +5,8 @@
=head2 Abstract
-This PDD specifies Parrot's garbage collection subsystems.
+This PDD specifies Parrot's garbage collection and memory management
+subsystems.
=head2 Version
@@ -19,14 +20,15 @@
the interpreter, by determining which objects will not be referenced again and
can be reclaimed.
-=head3 Simple mark
+=head3 Mark and sweep (MS)
-All reachable objects are marked as alive, first marking a root set, and then
-recursively marking objects reachable from other reachable objects. Objects
-not reached are considered dead. After collection, all objects are reset to
-unmarked, and the process starts again.
+Starting from a known root set, the GC traces all reachable memory objects by
+following pointers. Objects reached in this way, and therefore visible for
+use by the program, are alive. Objects which are not reached in the trace are
+marked dead. In the second stage, sweep, all dead objects are destroyed and
+reclaimed.
-=head3 Tri-color mark
+=head3 Tri-color mark and sweep
Instead of a simple separation of marked (as live) and unmarked (dead), the
object set is divided into three parts: white, gray, and black. The white
@@ -44,30 +46,27 @@
The advantage of a tri-color mark over a simple mark is that it can be broken
into smaller stages.
-=head3 Mark-and-sweep
-
-In this GC scheme, after all reachable objects are marked as live, a sweep
-through the object arenas collects all unmarked objects.
-
=head3 Copying collection
-In this scheme, live objects are copied into a new memory region. The entire
-old memory region can then be reclaimed.
+A copying GC copies objects from one memory region to another during the mark
+phase. At the end of the mark, all memory in the old region is dead and the
+whole region can be reclaimed at once.
=head3 Compacting collection
-In this scheme, live objects are moved closer together, eliminating fragments
-of free space between live objects. This compaction makes later allocation of
-new objects faster, since the allocator doesn't have to scan for fragments of
-free space.
-
-=head3 Reference counting
-
-In this scheme, all objects have a count of how often they are referred to by
-other objects. If that count reaches zero, the object's memory can be
-reclaimed. This scheme doesn't cope well with reference loops--loops of dead
-objects, all referencing one another but not reachable from elsewhere, never
-get collected.
+The compacting GC moves live objects close together in a single region in
+memory. This helps to elimianate fragmented free space and allows the
+allocation of large live objects. Compacting and copying collectors are often
+similar or even identical in implementation.
+
+=head3 Uncooperative
+
+An uncooperative GC is implemented as a separate module, often without
+affecting the remainder of the program. The programmer can write software
+without needing to be aware of the operations or implementation of the GC.
+The alternative is a cooperative GC, which is often implemented as a reference
+counting scheme and requires GC-related logic to be dispersed throughout the
+entire program.
=head3 Stop-the-world
@@ -79,9 +78,10 @@
=head3 Incremental
-Rather than suspending the system for marking and collection, GC is done in
-small increments intermittent with normal program operation. Some
-implementations perform the marking as part of ordinary object access.
+In order to alleviate the arbitrarily long pauses in a stop-the-world GC, the
+incremental GC breaks the mark and sweep process up into smaller, shorter
+phases. Each GC phase may still require the entire program to pause, but the
+pauses are shorter and more frequent.
=head3 Real-time
@@ -91,13 +91,8 @@
The object space is divided between a young generation (short-lived
temporaries) and one or more old generations. Only young generations are reset
-to white (presumed dead). Avoiding scanning the old generations repeatedly can
-considerably speed up GC.
-
-Generational collection does not guarantee that all unreachable objects will
-be reclaimed, so in large systems it is sometimes combined with a
-mark-and-sweep or copying collection scheme, one for light collection runs
-performed frequently, and the other for more complete runs performed rarely.
+to white (presumed dead). The older generations are scanned less often because
+it is assumed that long-lived objects tend to live longer.
=head3 Concurrent
@@ -105,47 +100,47 @@
threads participating in GC. On a multi-processor machine, concurrent GC may
be truly parallel.
+=head3 Conservative
+
+A conservative GC traces through memory looking for pointers to living
+objects. The GC does not necessarily have information about the layout of
+memory, so it cannot differentiate between an actual pointer and an integral
+value which has the characteristics of a pointer. The Conservative GC follows
+a policy of "no false negatives" and traces any value which appears to be a
+pointer.
+
+=head3 Precise
+
+A precise GC has intimate knowledge of the memory layout of the system and
+knows where to find pointers. In this way the precise collector never has
+any false positives.
+
=head2 Synopsis
Not applicable.
=head2 Description
-=over 4
-
-=item - Parrot provides swappable garbage collection schemes. The GC scheme
-can be selected at configure/compile time. The GC scheme cannot be changed
-on-the-fly at runtime, but in the future may be selected with a command-line
-option at execution time.
-
-=item - All live PMCs must be reachable from the root set of objects in the
-interpreter.
-
-=item - Garbage collection must be safe for objects shared across multiple
-interpreters/threads.
-
-=item - The phrase "dead object detection" and abbreviation "DOD" are
-deprecated.
-
-=back
+No GC algorithm is ideal for all workloads. To support multiple workloads,
+Parrot provides support for pluggable uncooperative GC cores. Parrot will
+attempt to provide a default core which has reasonable performance for most
+programs. Parrot provides no built-in support for cooperative GCs.
+
+Parrot uses two separate memory allocation mechanisms: a fixed-size system for
+small objects of fixed size (PMC and STRING headers, etc), and a buffer
+allocator for arbitrary-sized objects, such as string contents. The default
+fixed-size memory allocator uses a SLAB-like algorithm to allocate objects
+from large pre-allocated pools. The default buffer allocator uses a compacting
+algorithm.
=head2 Implementation
-Parrot supports pluggable garbage collection cores, so ultimately any garbage
-collection model devised can run on it. However, different GC models are more
-or less appropriate for different application areas. The current default
-stop-the-world mark-and-sweep model is not well suited for concurrent/parallel
-execution. We will keep the simple mark-and-sweep implementation, but it will
-no longer be primary.
+Parrot supports pluggable garbage collection cores, so ultimately any
+uncooperative garbage collection model devised can run on it.
Parrot really has two independent GC models, one used for objects (PMCs) and
the other used for buffers (including strings). The core difference is that
buffers cannot contain other buffers, so incremental marking is unnecessary.
-Currently, PMCs are not allowed to move after creation, so the GC model used
-there is not copying nor compacting.
-
-The primary GC model for PMCs, at least for the 1.0 release, will use a
-tri-color incremental marking scheme, combined with a concurrent sweep scheme.
=head3 Terminology
@@ -153,134 +148,228 @@
dead (the "trace" or "mark" phase) and freeing dead objects for later reuse
(the "sweep" phase). The sweep phase is also known as the collection phase.
The trace phase is less frequently known as the "dead object detection" phase.
-The use of the term "dead object detection" and its acronym DOD has been
-deprecated.
-=head3 Initial Marking
+=head3 Marking
+
+Each PMC and STRING has a C<flags> member which is a bitfield of various
+flags. Three flags in particular are important for GC operation.
+C<PObj_live_FLAG> is set if the object is currently alive and active.
+C<PObj_on_free_list_FLAG> is set if the object is currently on the free list
+and is available for reallocation. A third flag, C<PObj_grey_FLAG> can be used
+to support tricolor mark. Despite the given names of these flags, they can be
+used by the active GC core for almost any purpose, or they can be ignored
+entirely if the GC provides another mechanism for marking the various life
+stages of the object. These flags are typically not used outside the GC
+subsystem.
+
+=head4 Special PMCs
+
+=head4 Root Set
+
+The root set for the GC mark is the interpreter object and, if necessary,
+the C system stack. If the C system stack is traced, the GC is conservative.
+
+=head4 Initiating a mark and sweep
+
+Depending on the core in use, the mark and sweep phases may be initiated in
+different ways. A concurrent core would always be running in the background.
+The most common mechanism for a non-concurrent core is to initiate a run of
+the GC system when an attempt is made to allocate
+
+=head4 Object marking
+
+To mark a PMC, the C<Parrot_gc_mark_pmc_alive> function is called. To mark a
+STRING, the C<Parrot_gc_mark_string_alive> function is called. These functions
+mark the object alive, typically by setting the C<PObj_live_FLAG> flag.
+
+If the PMC contains references to other PMCs and STRINGS, it must have the
+C<PObj_custom_mark_FLAG> flag set. If this flag is set, the C<mark> VTABLE
+for that PMC is called to mark the pointers in that PMC. The custom_mark flag
+is ignored in STRINGs.
+
+=head4 Buffer Marking
+
+Buffers are always attached to a fixed-size header, or several headers. During
+the mark phase of the fixed-size objects, owned buffers are flagged as alive.
+At somet time after the fixed-size objects are marked, the buffer pool is
+compacted by moving all alive buffers to a new pool and then freeing the old
+pool back to the operating system.
+
+=head3 Collection
+
+When all objects have been marked, the collection phase begins.
+
+=head4 Collecting objects
+
+During the sweep phase, objects which had previously been alive but were not
+traced in the most recent mark phase are dead and are collected. If the
+C<PObj_custom_destroy_FLAG> is set on a PMC, the GC will call the C<destroy>
+VTABLE on that PMC to do custom cleanup. This flag is ignored in STRINGs.
+
+The GC does not collect dead PMCs in any particular order and does not
+guarantee any ordering of collection between dependant PMCs. Some GC cores may
+enforce some ordering or dependency recognition, but this is not guaranteed.
-Each PMC has a C<flags> member which, among other things, facilitates garbage
-collection. At the beginning of the mark phase, the C<PObj_is_live_FLAG> and
-C<PObj_is_fully_marked_FLAG> are both unset, which flags the PMC as presumed
-dead (white). The initial mark phase of the collection cycle goes through each
-PMC in the root set and sets the C<PObj_is_live_FLAG> bit in the C<flags>
-member (the PMC is gray). It does not set the C<PObj_is_fully_marked_FLAG>
-bit (changing the PMC to black), because in the initial mark, the PMCs or
-buffers contained by a PMC are not marked. It also appends the PMC to the end
-of a list used for further marking. However, if the PMC has already been
-marked as black, the current end of list is returned (instead of appending the
-already processed PMC) to prevent endless looping.
-
-The fourth combination of the two flags, where C<PObj_is_live_FLAG> is unset
-and C<PObj_is_fully_marked_FLAG> is set, is reserved for PMCs of an older
-generation not actively participating in the GC run.
+=head3 Finalization
-The root set for the initial marking phase includes the following core storage
-locations:
+When the interpreter object is destroyed, the GC system is finalized. During
+finalization, all living PMCs in the system are destroyed unconditionally and
+all memory owned by the interpreter is freed back to the operating system.
+
+=head3 Internal Structures
+
+A GC core is defined in memory by a structure of function pointers to various
+routines that perform the primitive operations of the GC. A GC core must
+define most of the pointers in the C<< interp->gc_sys >> structure, which is
+a C<GC_Subsystem> structure.
+
+C<GC_Subsystem> has the following fields:
=over 4
-=item Global stash
+=item C<void (*finalize_gc_system) (PARROT_INTERP)>
-=item System stack and processor registers
+Function to finalize the GC system, by freeing all PMCs and returning all
+allocated memory to the operating system.
-=item Current PMC register set
+=item C<void (*destroy_child_interp)(Interp *dest_interp,
+Interp *child_interp)>
-=item Stashes
+=item C<void (*do_gc_mark)(PARROT_INTERP, UINTVAL flags)>
-=item PMC register stack
+Perform a GC mark and sweep run, or at least run a single increment of it.
-=back
+=item C<void (*compact_string_pool)(PARROT_INTERP)>
-=head3 Incremental Marking
+Compact the string pool and destroy all unused buffers.
-After the root set of PMCs have been marked, a series of incremental mark runs
-are performed. These may be performed frequently, between other operations.
-The incremental mark runs work to move gray PMCs to black. They take a PMC
-from the list for further marking, mark any PMCs or buffers it contains as
-gray (the C<PObj_is_live_FLAG> is set and the C<PObj_is_fully_marked_FLAG> is
-left unset), and add the contained PMCs or buffers to the list for further
-marking. If the PMC has a custom mark function in its vtable, it is called at
-this point.
-
-After all contained PMCs or buffers have been marked, the PMC itself is marked
-as black (the C<PObj_is_live_FLAG> and C<PObj_is_fully_marked_FLAG> are both
-set). A limit may be placed on the number of PMCs handled in each incremental
-mark run.
-
-=head3 Buffer Marking
-
-The initial marking phase also marks the root set of buffers. Because buffers
-cannot contain other buffers, they are immediately marked as black and not
-added to the list for further marking. Because PMCs may contain buffers, the
-buffer collection phase can't run until the incremental marking of PMCs is
-completed.
+=item C<void (*mark_special)(PARROT_INTERP, PMC *)>
-The root set for buffers includes the following locations:
+Mark a special PMC. A PMC is special if it has the C<PObj_is_special_FLAG>
+flag set.
-=over 4
+=item C<void (*pmc_needs_early_collection)(PARROT_INTERP, PMC *)>
-=item Current String register set
+Flag a PMC as needing early collection.
-=item String register set stack
+=item C<void (*init_pool)(PARROT_INTERP, struct Fixed_Size_Pool *)>
-=item Control stack
+Initialize a new memory pool.
-=back
+=item C<PMC* (*allocate_pmc_header)(PARROT_INTERP, UINTVAL flags)>
-Once a buffer is found to be live, the C<flags> member of the buffer structure
-has the C<PObj_live_FLAG> and C<PObj_is_fully_marked_FLAG> bits set.
+Allocate a new PMC object from the system.
-=head3 Collection
+=item C<void (*free_pmc_header)(PARROT_INTERP, PMC *)>
-When the list for further marking is empty (all gray PMCs have changed to
-black), the collection stage is started. First, PMCs are collected, followed
-by buffers. In both cases (PMC and buffer), the "live" and "fully_marked"
-flags are reset after examination for reclamation.
-
-=head4 Collecting PMCs
-
-To collect PMCs, each PMC arena is examined from the most recently created
-backwards. Each PMC is examined to see if it is live, already on the free
-list, or constant. If it is not, then it is added to the free list and marked
-as being on the free list with the C<PObj_on_free_list_FLAG>.
-
-=for question
-Are the PMCs in the arena examined back-to-front as well? How about Buffers?
-Order of destruction can be important.
-
-=head4 Collecting buffers
-
-To collect buffers, each Buffer arena is examined from the most recently
-created backwards. If the buffer is not live, not already on the free list
-and it is not a constant or copy on write, then it is added to the free pool
-for reuse and marked with the C<PObj_on_free_list_FLAG>.
-
-=head4 Concurrent collection
-
-For the most part, the variable sets between concurrent tasks don't interact.
-They have independent root sets and don't require information on memory usage
-from other tasks before performing a collection phase. In Parrot, tasks tend
-to be short-lived, and their variables can be considered young generations
-from a generational GC perspective. Because of this, a full heavyweight task
-will maintain its own small memory pools, quickly born and quickly dying.
-
-Shared variables, on the other hand, do require information from multiple
-concurrent tasks before they can be collected. Because of this, they live in
-the parent interpreter's global pools, and can only be collected after all
-concurrent tasks have completed a full mark phase without marking the shared
-variable as live. Because GC in the concurrent tasks happens incrementally
-between operations, a full collection of the shared variables can happen
-lazily, and does not require a stop-the-world sweep through all concurrent
-tasks simultaneously.
+Free a PMC object back to the system.
-=head3 Internal Structures
+=item C<STRING* (*allocate_string_header)(PARROT_INTERP, UINTVAL flags)>
+
+Allocate a new STRING header from the system.
+
+=item C<void (*free_string_header)(PARROT_INTERP, STRING*)>
+
+Free a STRING object back to the system.
+
+=item C<Buffer* (*allocate_bufferlike_header)(PARROT_INTERP, size_t size)>
+
+=item C<void (*free_bufferlike_header)(PARROT_INTERP, Buffer*, size_t size)>
+
+=item C<int (*is_pmc_ptr)(PARROT_INTERP, void*)>
+
+Determine if the given pointer is or resembles a valid PMC pointer.
+
+=item C<int (*is_string_ptr)(PARROT_INTERP, void*)>
+
+Determine if the given pointer is or resembles a valid STRING pointer.
+
+=item C<void (*mark_pobj_header)(PARROT_INTERP, PObj*)>
-The different GC cores are independent, but they share some code and
-resources. The arena structures and arena creation routines are common across
-most GC cores, and some GC cores also share mark routines.
+=item C<void (*mark_pmc_header)(PARROT_INTERP, PMC *)>
-The main interpreter structure has an mem_pools member, which is a pointer to
-an Memory_Pools struct.
+Mark a PMC alive.
+
+=item C<void* (*allocate_pmc_attributes)(PARROT_INTERP, PMC *)>
+
+Allocate attribute storage for a PMC. The size of the attributes structure is
+determined from the PMCs VTABLE.
+
+=item C<void (*free_pmc_attributes)(PARROT_INTERP, PMC *)>
+
+Free an attribute structure back to the system.
+
+=item C<void (*allocate_string_storage)
+(PARROT_INTERP, STRING *str, size_t size)>
+
+Allocate buffer storage for a string.
+
+=item C<void (*reallocate_string_storage)
+(PARROT_INTERP, STRING *str, size_t size)>
+
+Resize existing string storage to fit data of the new size.
+
+=item C<void (*allocate_buffer_storage)
+(PARROT_INTERP, ARGMOD(Buffer *buffer), size_t nsize)>
+
+Allocate buffer storage for any purpose.
+
+=item C<void (*reallocate_buffer_storage)
+(PARROT_INTERP, ARGMOD(Buffer *buffer), size_t newsize)>
+
+Reallocate or resize existing buffer storage.
+
+=item C<void* (*allocate_fixed_size_storage)(PARROT_INTERP, size_t size)>
+
+Allocate storage for a fixed-size header which is not a PMC or a STRING. The
+contents of this structure are not marked automatically by GC.
+
+=item C<void (*free_fixed_size_storage)(PARROT_INTERP, size_t size, void *)>
+
+Free a fixed-size structure back to the system.
+
+=item C<void* (*allocate_memory_chunk)(PARROT_INTERP, size_t size)>
+
+=item C<void* (*reallocate_memory_chunk)(PARROT_INTERP, void *data,
+size_t newsize)>
+
+=item C<void* (*allocate_memory_chunk_with_interior_pointers)(PARROT_INTERP,
+size_t size)>
+
+=item C<void* (*reallocate_memory_chunk_with_interior_pointers)(PARROT_INTERP,
+void *data, size_t oldsize, size_t newsize)>
+
+=item C<void (*free_memory_chunk)(PARROT_INTERP, void *data)>
+
+=item C<void (*block_mark)(PARROT_INTERP)>
+
+Block the GC mark from occuring.
+
+=item C<void (*unblock_mark)(PARROT_INTERP)>
+
+Unblock the GC mark.
+
+=item C<unsigned int (*is_blocked_mark)(PARROT_INTERP)>
+
+Query the blocked state of the GC mark.
+
+=item C<void (*block_sweep)(PARROT_INTERP)>
+
+Block the GC sweep phase.
+
+=item C<void (*unblock_sweep)(PARROT_INTERP)>
+
+Unblock the GC sweep phase.
+
+=item C<unsigned int (*is_blocked_sweep)(PARROT_INTERP)>
+
+Query the blocked state of the GC sweep.
+
+=item C<size_t (*get_gc_info)(PARROT_INTERP, Interpinfo_enum)>
+
+Query information about the GC core.
+
+=back
=head4 The Memory_Pools structure
@@ -320,14 +409,6 @@
=head3 Internal API
-Currently only one GC system is active at a time, selected at configure or
-compile time. Future versions will support switching GC systems at
-execution-time to accommodate different work loads.
-
-=for question
-Does "execution-time" mean "before starting a runcore" or "at some point after
-starting a runcore"?
-
Each GC core provides a standard interface for interaction with the core.
=head4 Initialization
Added: branches/string_macros/examples/benchmarks/stress_integers.pir
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/string_macros/examples/benchmarks/stress_integers.pir Tue Sep 28 19:35:30 2010 (r49367)
@@ -0,0 +1,45 @@
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+examples/benchmarks/stress_strings.pir - GC strings stress-testing
+
+=head1 SYNOPSIS
+
+ % time ./parrot examples/benchmarks/stress_strings.pir
+
+=head1 DESCRIPTION
+
+Create a lots of strings. Some of them are long-lived, most of them are short lived.
+
+Main purpose - test compact_pool performance.
+
+=cut
+
+.sub 'main' :main
+ .local pmc rsa # array of long lived strings.
+
+ .local int i
+
+ rsa = new ['ResizablePMCArray']
+ i = 0
+ loop:
+ $I0 = i % 10 # every 10th string is longlived
+ if $I0 goto inc_i
+ push rsa, i
+ $I0 = i % 1000
+ if $I0 goto inc_i
+ sweep 1
+ inc_i:
+ inc i
+ if i < 100000 goto loop
+
+.end
+
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
Modified: branches/string_macros/include/parrot/call.h
==============================================================================
--- branches/string_macros/include/parrot/call.h Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/include/parrot/call.h Tue Sep 28 19:35:30 2010 (r49367)
@@ -308,7 +308,7 @@
|| OPCODE_IS((interp), (seg), *(pc), _core_ops, PARROT_OP_get_results_pc) \
|| OPCODE_IS((interp), (seg), *(pc), _core_ops, PARROT_OP_get_params_pc) \
|| OPCODE_IS((interp), (seg), *(pc), _core_ops, PARROT_OP_set_returns_pc)) { \
- PMC * const sig = (seg)->const_table->constants[(pc)[1]].u.key; \
+ PMC * const sig = (seg)->const_table->pmc.constants[(pc)[1]]; \
(n) += VTABLE_elements((interp), sig); \
} \
} while (0)
Modified: branches/string_macros/include/parrot/context.h
==============================================================================
--- branches/string_macros/include/parrot/context.h Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/include/parrot/context.h Tue Sep 28 19:35:30 2010 (r49367)
@@ -12,7 +12,7 @@
#include "parrot/string.h"
#include "parrot/compiler.h"
-struct PackFile_Constant;
+struct PackFile_ConstTable;
typedef union {
PMC **regs_p;
@@ -103,13 +103,6 @@
__attribute__nonnull__(2);
PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_PURE_FUNCTION
-struct PackFile_Constant * Parrot_pcc_get_constants_func(SHIM_INTERP,
- ARGIN(PMC *ctx))
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
PARROT_CAN_RETURN_NULL
PARROT_PURE_FUNCTION
Parrot_Context* Parrot_pcc_get_context_struct_func(SHIM_INTERP,
@@ -153,6 +146,12 @@
__attribute__nonnull__(2);
PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+PARROT_PURE_FUNCTION
+FLOATVAL * Parrot_pcc_get_num_constants_func(SHIM_INTERP, ARGIN(PMC *ctx))
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CAN_RETURN_NULL
PMC* Parrot_pcc_get_object_func(SHIM_INTERP, ARGIN(PMC *ctx))
@@ -179,6 +178,12 @@
__attribute__nonnull__(2);
PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+PARROT_PURE_FUNCTION
+PMC ** Parrot_pcc_get_pmc_constants_func(SHIM_INTERP, ARGIN(PMC *ctx))
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
PARROT_PURE_FUNCTION
UINTVAL Parrot_pcc_get_recursion_depth_func(SHIM_INTERP, ARGIN(PMC *ctx))
__attribute__nonnull__(2);
@@ -190,6 +195,12 @@
__attribute__nonnull__(2);
PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+PARROT_PURE_FUNCTION
+STRING ** Parrot_pcc_get_str_constants_func(SHIM_INTERP, ARGIN(PMC *ctx))
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
PARROT_PURE_FUNCTION
PARROT_CAN_RETURN_NULL
STRING* Parrot_pcc_get_string_constant_func(SHIM_INTERP,
@@ -212,8 +223,9 @@
PARROT_CAN_RETURN_NULL
void Parrot_pcc_set_constants_func(SHIM_INTERP,
ARGIN(PMC *ctx),
- ARGIN_NULLOK(struct PackFile_Constant *constants))
- __attribute__nonnull__(2);
+ ARGIN(struct PackFile_ConstTable *ct))
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
PARROT_EXPORT
void Parrot_pcc_set_continuation_func(SHIM_INTERP,
@@ -320,8 +332,6 @@
#define ASSERT_ARGS_Parrot_pcc_get_caller_ctx_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
-#define ASSERT_ARGS_Parrot_pcc_get_constants_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_context_struct_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_Parrot_pcc_get_continuation_func \
@@ -338,6 +348,9 @@
#define ASSERT_ARGS_Parrot_pcc_get_num_constant_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
+#define ASSERT_ARGS_Parrot_pcc_get_num_constants_func \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_object_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_outer_ctx_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -347,11 +360,17 @@
#define ASSERT_ARGS_Parrot_pcc_get_pmc_constant_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
+#define ASSERT_ARGS_Parrot_pcc_get_pmc_constants_func \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_recursion_depth_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_signature_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
+#define ASSERT_ARGS_Parrot_pcc_get_str_constants_func \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(ctx))
#define ASSERT_ARGS_Parrot_pcc_get_string_constant_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
@@ -363,7 +382,8 @@
PARROT_ASSERT_ARG(ctx) \
, PARROT_ASSERT_ARG(caller_ctx))
#define ASSERT_ARGS_Parrot_pcc_set_constants_func __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(ctx))
+ PARROT_ASSERT_ARG(ctx) \
+ , PARROT_ASSERT_ARG(ct))
#define ASSERT_ARGS_Parrot_pcc_set_continuation_func \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(ctx))
@@ -408,8 +428,14 @@
#ifdef NDEBUG
# define Parrot_pcc_get_context_struct(i, c) CONTEXT_STRUCT(c)
-# define Parrot_pcc_get_constants(i, c) (CONTEXT_STRUCT(c)->constants)
-# define Parrot_pcc_set_constants(i, c, value) (CONTEXT_STRUCT(c)->constants = (value))
+# define Parrot_pcc_get_num_constants(i, c) (CONTEXT_STRUCT(c)->num_constants)
+# define Parrot_pcc_get_str_constants(i, c) (CONTEXT_STRUCT(c)->str_constants)
+# define Parrot_pcc_get_pmc_constants(i, c) (CONTEXT_STRUCT(c)->pmc_constants)
+# define Parrot_pcc_set_constants(i, c, ct) do { \
+ CONTEXT_STRUCT(c)->num_constants = (ct)->num.constants; \
+ CONTEXT_STRUCT(c)->str_constants = (ct)->str.constants; \
+ CONTEXT_STRUCT(c)->pmc_constants = (ct)->pmc.constants; \
+} while (0)
# define Parrot_pcc_get_continuation(i, c) (CONTEXT_STRUCT(c)->current_cont)
# define Parrot_pcc_set_continuation(i, c, value) (CONTEXT_STRUCT(c)->current_cont = (value))
@@ -441,9 +467,9 @@
# define Parrot_pcc_get_signature(i, c) (CONTEXT_STRUCT(c)->current_sig)
# define Parrot_pcc_set_signature(i, c, value) (CONTEXT_STRUCT(c)->current_sig = (value))
-# define Parrot_pcc_get_num_constant(i, c, idx) (CONTEXT_STRUCT(c)->constants[(idx)].u.number)
-# define Parrot_pcc_get_string_constant(i, c, idx) (CONTEXT_STRUCT(c)->constants[(idx)].u.string)
-# define Parrot_pcc_get_pmc_constant(i, c, idx) (CONTEXT_STRUCT(c)->constants[(idx)].u.key)
+# define Parrot_pcc_get_num_constant(i, c, idx) (CONTEXT_STRUCT(c)->num_constants[(idx)])
+# define Parrot_pcc_get_string_constant(i, c, idx) (CONTEXT_STRUCT(c)->str_constants[(idx)])
+# define Parrot_pcc_get_pmc_constant(i, c, idx) (CONTEXT_STRUCT(c)->pmc_constants[(idx)])
# define Parrot_pcc_get_recursion_depth(i, c) (CONTEXT_STRUCT(c)->recursion_depth)
# define Parrot_pcc_dec_recursion_depth(i, c) (--CONTEXT_STRUCT(c)->recursion_depth)
@@ -465,7 +491,9 @@
# define Parrot_pcc_get_context_struct(i, c) Parrot_pcc_get_context_struct_func((i), (c))
-# define Parrot_pcc_get_constants(i, c) Parrot_pcc_get_constants_func((i), (c))
+# define Parrot_pcc_get_num_constants(i, c) Parrot_pcc_get_num_constants_func((i), (c))
+# define Parrot_pcc_get_str_constants(i, c) Parrot_pcc_get_str_constants_func((i), (c))
+# define Parrot_pcc_get_pmc_constants(i, c) Parrot_pcc_get_pmc_constants_func((i), (c))
# define Parrot_pcc_set_constants(i, c, value) Parrot_pcc_set_constants_func((i), (c), (value))
# define Parrot_pcc_get_continuation(i, c) Parrot_pcc_get_continuation_func((i), (c))
Modified: branches/string_macros/include/parrot/gc_api.h
==============================================================================
--- branches/string_macros/include/parrot/gc_api.h Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/include/parrot/gc_api.h Tue Sep 28 19:35:30 2010 (r49367)
@@ -99,6 +99,7 @@
#define GC_trace_normal_FLAG (UINTVAL)(1 << 1) /* the same */
#define GC_lazy_FLAG (UINTVAL)(1 << 2) /* timely destruction run */
#define GC_finish_FLAG (UINTVAL)(1 << 3) /* on Parrot exit: mark (almost) all PMCs dead and */
+#define GC_strings_cb_FLAG (UINTVAL)(1 << 4) /* Invoked from String GC during mem_alloc to sweep dead strings */
/* garbage collect. */
/* HEADERIZER BEGIN: src/gc/api.c */
@@ -140,8 +141,9 @@
FUNC_MODIFIES(*obj);
PARROT_EXPORT
-void Parrot_gc_mark_STRING_alive_fun(SHIM_INTERP,
+void Parrot_gc_mark_STRING_alive_fun(PARROT_INTERP,
ARGMOD_NULLOK(STRING *obj))
+ __attribute__nonnull__(1)
FUNC_MODIFIES(*obj);
PARROT_EXPORT
@@ -343,7 +345,8 @@
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(obj))
#define ASSERT_ARGS_Parrot_gc_mark_STRING_alive_fun \
- __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_gc_reallocate_memory_chunk \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
Modified: branches/string_macros/include/parrot/interpreter.h
==============================================================================
--- branches/string_macros/include/parrot/interpreter.h Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/include/parrot/interpreter.h Tue Sep 28 19:35:30 2010 (r49367)
@@ -301,9 +301,6 @@
} iglobals_enum;
/* &end_gen */
-#define PCONST(i) PF_CONST(interp->code, (i))
-#define PNCONST PF_NCONST(interp->code)
-
/* TODO - Make this a config option */
#ifndef PARROT_CATCH_NULL
# ifdef S_SPLINT_S
Added: branches/string_macros/include/parrot/list.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/string_macros/include/parrot/list.h Tue Sep 28 19:35:30 2010 (r49367)
@@ -0,0 +1,169 @@
+/*
+Copyright (C) 2010, Parrot Foundation.
+$Id$
+
+=head1 NAME
+
+src/gc/list.h - Linked lists of allocated objects.
+
+=head1 DESCRIPTION
+
+Implementation of double linked lists used by various GC implementations.
+
+*/
+
+#ifndef PARROT_GC_LIST_H_GUARD
+#define PARROT_GC_LIST_H_GUARD
+
+/* Allocatable objects has headers to use in linked lists */
+typedef struct List_Item_Header {
+ struct List_Item_Header *prev;
+ struct List_Item_Header *next;
+
+#ifndef NDEBUG
+ struct Linked_List *owner;
+#endif
+} List_Item_Header;
+
+/* Double-linked list. */
+/* N.B. List doesn't _own_ items */
+typedef struct Linked_List {
+ struct List_Item_Header *first;
+ struct List_Item_Header *last;
+
+ /* Cache object count in list. We use it very often */
+ size_t count;
+} Linked_List;
+
+/* Such headers allocated in front of real objects. */
+/* There is helper macros to convert to/from real objects */
+#define Obj2LLH(p) ((List_Item_Header *)((char*)(p) - sizeof (List_Item_Header)))
+#define LLH2Obj_typed(p, type) ((type*)((char*)(p) + sizeof (List_Item_Header)))
+#define LLH2Obj(p) LLH2Obj_typed(p, void)
+
+#ifdef NDEBUG
+# define SET_LIST_OWNER(l, i)
+#else
+# define SET_LIST_OWNER(l, i) (i)->owner = (l);
+#endif
+
+#define LIST_APPEND(l, i) \
+do { \
+ List_Item_Header *_item = (i); \
+ Linked_List *_list = (l); \
+ \
+ if (_list->last) { \
+ _item->prev = _list->last; \
+ _list->last->next = _item; \
+ } \
+ else if (!_list->first) { \
+ _item->prev = NULL; \
+ _list->first = _item; \
+ } \
+ \
+ _list->last = _item; \
+ _item->next = NULL; \
+ \
+ SET_LIST_OWNER(_list, _item) \
+ _list->count++; \
+} while (0);
+
+#define LIST_REMOVE(l, i) \
+do { \
+ List_Item_Header *_item = (i); \
+ Linked_List *_list = (l); \
+ List_Item_Header *next = _item->next; \
+ List_Item_Header *prev = _item->prev; \
+ \
+ PARROT_ASSERT(_list == _item->owner); \
+ \
+ /* First _item */ \
+ if (_list->first == _item) \
+ _list->first = next; \
+ \
+ if (_list->last == _item) \
+ _list->last = prev; \
+ \
+ if (prev) \
+ prev->next = next; \
+ if (next) \
+ next->prev = prev; \
+ \
+ _list->count--; \
+} while (0)
+
+
+/* HEADERIZER BEGIN: src/list.c */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+PARROT_EXPORT
+void Parrot_list_append(SHIM_INTERP,
+ ARGMOD(Linked_List *list),
+ ARGMOD(List_Item_Header *item))
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*list)
+ FUNC_MODIFIES(*item);
+
+PARROT_EXPORT
+INTVAL Parrot_list_check(SHIM_INTERP, ARGIN(Linked_List *list))
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+INTVAL Parrot_list_contains(SHIM_INTERP,
+ ARGIN(Linked_List *list),
+ ARGIN(List_Item_Header *item))
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_EXPORT
+void Parrot_list_destroy(SHIM_INTERP, ARGMOD(Linked_List* list))
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(* list);
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+struct Linked_List* Parrot_list_new(SHIM_INTERP);
+
+PARROT_EXPORT
+List_Item_Header* Parrot_list_pop(PARROT_INTERP, ARGIN(Linked_List *list))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+List_Item_Header* Parrot_list_remove(SHIM_INTERP,
+ ARGMOD(Linked_List *list),
+ ARGMOD(List_Item_Header *item))
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*list)
+ FUNC_MODIFIES(*item);
+
+#define ASSERT_ARGS_Parrot_list_append __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(list) \
+ , PARROT_ASSERT_ARG(item))
+#define ASSERT_ARGS_Parrot_list_check __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(list))
+#define ASSERT_ARGS_Parrot_list_contains __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(list) \
+ , PARROT_ASSERT_ARG(item))
+#define ASSERT_ARGS_Parrot_list_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(list))
+#define ASSERT_ARGS_Parrot_list_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_Parrot_list_pop __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(list))
+#define ASSERT_ARGS_Parrot_list_remove __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(list) \
+ , PARROT_ASSERT_ARG(item))
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: src/list.c */
+
+#endif /* PARROT_GC_LIST_H_GUARD */
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: branches/string_macros/include/parrot/packfile.h
==============================================================================
--- branches/string_macros/include/parrot/packfile.h Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/include/parrot/packfile.h Tue Sep 28 19:35:30 2010 (r49367)
@@ -16,9 +16,6 @@
#include "parrot/parrot.h"
-#define PF_NCONST(pf) ((pf)->const_table->const_count)
-#define PF_CONST(pf, i) ((pf)->const_table->constants[(i)])
-
#define DIRECTORY_SEGMENT_NAME Parrot_str_new_constant(interp, "DIRECTORY")
#define FIXUP_TABLE_SEGMENT_NAME Parrot_str_new_constant(interp, "FIXUP")
#define CONSTANT_SEGMENT_NAME Parrot_str_new_constant(interp, "CONSTANT")
@@ -104,13 +101,12 @@
typedef enum {
PF_DIR_SEG = 0,
PF_UNKNOWN_SEG = 1,
- PF_FIXUP_SEG = 2,
- PF_CONST_SEG = 3,
- PF_BYTEC_SEG = 4,
- PF_DEBUG_SEG = 5,
- PF_ANNOTATIONS_SEG = 6,
+ PF_CONST_SEG = 2,
+ PF_BYTEC_SEG = 3,
+ PF_DEBUG_SEG = 4,
+ PF_ANNOTATIONS_SEG = 5,
- PF_MAX_SEG = 7
+ PF_MAX_SEG = 6
} pack_file_types;
/* &end_gen */
@@ -167,15 +163,6 @@
opcode_t dir_format;
} PackFile_Header;
-typedef struct PackFile_Constant {
- opcode_t type;
- union {
- FLOATVAL number;
- STRING *string;
- PMC *key;
- } u;
-} PackFile_Constant;
-
/*
** PackFile Segment:
* The base type of every section
@@ -228,41 +215,22 @@
typedef INTVAL (*PackFile_map_segments_func_t)(PARROT_INTERP, PackFile_Segment *seg, void *user_data);
-/*
-** PackFile_FixupTable:
-*/
-typedef struct PackFile_FixupEntry {
- opcode_t type; /* who knows what fixups we need? */
- char *name; /* name of the label */
- opcode_t offset; /* location of the item */
-} PackFile_FixupEntry;
-
-typedef struct PackFile_FixupTable {
- PackFile_Segment base;
- opcode_t fixup_count;
- PackFile_FixupEntry *fixups;
- PackFile_ByteCode *code; /* where this segment belongs to */
-} PackFile_FixupTable;
-
-
-
-/* &gen_from_def(packfile_constants.pasm) */
-
-/* no ascii chars use numbers: for n, s, k, p */
-#define PFC_NONE 0x0
-#define PFC_NUMBER 0x6E
-#define PFC_STRING 0x73
-#define PFC_PMC 0x70
-#define PFC_KEY 0x6B
-
-/* &end_gen */
-
typedef struct PackFile_ConstTable {
PackFile_Segment base;
- opcode_t const_count;
- PackFile_Constant *constants;
- PackFile_ByteCode *code; /* where this segment belongs to */
- Hash *string_hash; /* Hash for lookup strings and numbers */
+ struct {
+ opcode_t const_count;
+ FLOATVAL *constants;
+ } num;
+ struct {
+ opcode_t const_count;
+ STRING **constants;
+ } str;
+ struct {
+ opcode_t const_count;
+ PMC **constants;
+ } pmc;
+ PackFile_ByteCode *code; /* where this segment belongs to */
+ Hash *string_hash; /* Hash for lookup strings and numbers */
} PackFile_ConstTable;
typedef struct PackFile_ByteCode_OpMappingEntry {
@@ -281,7 +249,6 @@
PackFile_Segment base;
struct PackFile_Debug *debugs;
PackFile_ConstTable *const_table;
- PackFile_FixupTable *fixups;
struct PackFile_Annotations *annotations;
PackFile_ByteCode_OpMapping op_mapping; /* opcode mapping information */
size_t op_count; /* number of ops in the func table */
@@ -387,19 +354,6 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-opcode_t * PackFile_Constant_pack(PARROT_INTERP,
- ARGIN(const PackFile_ConstTable *const_table),
- ARGIN(const PackFile_Constant *self),
- ARGOUT(opcode_t *cursor))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*cursor);
-
-PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
opcode_t * PackFile_ConstTable_pack(PARROT_INTERP,
@@ -417,19 +371,16 @@
__attribute__nonnull__(2);
PARROT_EXPORT
-int PackFile_ConstTable_rlookup(PARROT_INTERP,
+int PackFile_ConstTable_rlookup_num(PARROT_INTERP,
ARGIN(const PackFile_ConstTable *ct),
- ARGIN(PMC *key),
- int type)
+ FLOATVAL n)
__attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
+ __attribute__nonnull__(2);
PARROT_EXPORT
-int PackFile_find_in_const(PARROT_INTERP,
+int PackFile_ConstTable_rlookup_str(PARROT_INTERP,
ARGIN(const PackFile_ConstTable *ct),
- ARGIN(PMC *key),
- int type)
+ ARGIN(STRING *s))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);
@@ -450,11 +401,6 @@
__attribute__nonnull__(2)
FUNC_MODIFIES(*self);
-#define ASSERT_ARGS_PackFile_Constant_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(const_table) \
- , PARROT_ASSERT_ARG(self) \
- , PARROT_ASSERT_ARG(cursor))
#define ASSERT_ARGS_PackFile_ConstTable_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(seg) \
@@ -462,14 +408,15 @@
#define ASSERT_ARGS_PackFile_ConstTable_pack_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(seg))
-#define ASSERT_ARGS_PackFile_ConstTable_rlookup __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+#define ASSERT_ARGS_PackFile_ConstTable_rlookup_num \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(ct) \
- , PARROT_ASSERT_ARG(key))
-#define ASSERT_ARGS_PackFile_find_in_const __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ , PARROT_ASSERT_ARG(ct))
+#define ASSERT_ARGS_PackFile_ConstTable_rlookup_str \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ct) \
- , PARROT_ASSERT_ARG(key))
+ , PARROT_ASSERT_ARG(s))
#define ASSERT_ARGS_PackFile_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(self) \
@@ -529,54 +476,6 @@
__attribute__nonnull__(1);
PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-size_t PackFile_Constant_pack_size(PARROT_INTERP,
- ARGIN(const PackFile_Constant *self),
- ARGIN(const PackFile_ConstTable *ct))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-const opcode_t * PackFile_Constant_unpack(PARROT_INTERP,
- ARGIN(PackFile_ConstTable *constt),
- ARGOUT(PackFile_Constant *self),
- ARGIN(const opcode_t *cursor))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*self);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-const opcode_t * PackFile_Constant_unpack_key(PARROT_INTERP,
- ARGIN(PackFile_ConstTable *constt),
- ARGMOD(PackFile_Constant *self),
- ARGIN(const opcode_t *cursor))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*self);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-const opcode_t * PackFile_Constant_unpack_pmc(PARROT_INTERP,
- ARGIN(PackFile_ConstTable *constt),
- ARGMOD(PackFile_Constant *self),
- ARGIN(const opcode_t *cursor))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*self);
-
-PARROT_EXPORT
void PackFile_ConstTable_clear(PARROT_INTERP,
ARGMOD(PackFile_ConstTable *self))
__attribute__nonnull__(1)
@@ -602,15 +501,6 @@
PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
-PackFile_FixupEntry * PackFile_find_fixup_entry(PARROT_INTERP,
- INTVAL type,
- ARGIN(char *name))
- __attribute__nonnull__(1)
- __attribute__nonnull__(3);
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
PackFile_Segment * PackFile_find_segment(PARROT_INTERP,
ARGIN_NULLOK(PackFile_Directory *dir),
ARGIN(const STRING *name),
@@ -625,21 +515,6 @@
__attribute__nonnull__(1);
PARROT_EXPORT
-void PackFile_FixupTable_clear(PARROT_INTERP,
- ARGMOD(PackFile_FixupTable *self))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*self);
-
-PARROT_EXPORT
-void PackFile_FixupTable_new_entry(PARROT_INTERP,
- ARGIN(const char *label),
- INTVAL type,
- opcode_t offs)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
-PARROT_EXPORT
void PackFile_funcs_register(SHIM_INTERP,
ARGOUT(PackFile *pf),
UINTVAL type,
@@ -883,25 +758,6 @@
, PARROT_ASSERT_ARG(self))
#define ASSERT_ARGS_PackFile_Annotations_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_PackFile_Constant_pack_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(self) \
- , PARROT_ASSERT_ARG(ct))
-#define ASSERT_ARGS_PackFile_Constant_unpack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(constt) \
- , PARROT_ASSERT_ARG(self) \
- , PARROT_ASSERT_ARG(cursor))
-#define ASSERT_ARGS_PackFile_Constant_unpack_key __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(constt) \
- , PARROT_ASSERT_ARG(self) \
- , PARROT_ASSERT_ARG(cursor))
-#define ASSERT_ARGS_PackFile_Constant_unpack_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(constt) \
- , PARROT_ASSERT_ARG(self) \
- , PARROT_ASSERT_ARG(cursor))
#define ASSERT_ARGS_PackFile_ConstTable_clear __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(self))
@@ -912,20 +768,11 @@
#define ASSERT_ARGS_PackFile_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pf))
-#define ASSERT_ARGS_PackFile_find_fixup_entry __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(name))
#define ASSERT_ARGS_PackFile_find_segment __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(name))
#define ASSERT_ARGS_PackFile_fixup_subs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_PackFile_FixupTable_clear __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_PackFile_FixupTable_new_entry __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(label))
#define ASSERT_ARGS_PackFile_funcs_register __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(pf))
#define ASSERT_ARGS_PackFile_map_segments __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -1031,18 +878,9 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-PARROT_EXPORT
-void PackFile_Fixup_dump(PARROT_INTERP,
- ARGIN(const PackFile_FixupTable *ft))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
#define ASSERT_ARGS_PackFile_ConstTable_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_PackFile_Fixup_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(ft))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/packdump.c */
Modified: branches/string_macros/include/parrot/pobj.h
==============================================================================
--- branches/string_macros/include/parrot/pobj.h Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/include/parrot/pobj.h Tue Sep 28 19:35:30 2010 (r49367)
@@ -153,6 +153,9 @@
PObj_sysmem_FLAG = POBJ_FLAG(15),
/* PObj usage FLAGs, COW & GC */
+ /* Used during tri-color mark&sweep */
+ PObj_grey_FLAG = POBJ_FLAG(16),
+
/* The Buffer allows COW copies, and may have some. */
PObj_is_COWable_FLAG = POBJ_FLAG(17),
/* Private flag for the GC system. Set if the PObj's in use as
@@ -235,6 +238,9 @@
#define PObj_report_SET(o) PObj_flag_SET(report, o)
#define PObj_report_CLEAR(o) PObj_flag_CLEAR(report, o)
+#define PObj_grey_TEST(o) gc_flag_TEST(grey, o)
+#define PObj_grey_SET(o) gc_flag_SET(grey, o)
+#define PObj_grey_CLEAR(o) gc_flag_CLEAR(grey, o)
#define PObj_on_free_list_TEST(o) gc_flag_TEST(on_free_list, o)
#define PObj_on_free_list_SET(o) gc_flag_SET(on_free_list, o)
Modified: branches/string_macros/include/parrot/settings.h
==============================================================================
--- branches/string_macros/include/parrot/settings.h Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/include/parrot/settings.h Tue Sep 28 19:35:30 2010 (r49367)
@@ -37,8 +37,10 @@
* GC_DEFAULT_TYPE selection
* MS -- stop-the-world mark & sweep
* INF -- infinite memory "collector"
+ * TMS -- TriColor Mark & Sweep
+ * MS2 -- new style mark & sweep
*/
-#define PARROT_GC_DEFAULT_TYPE MS
+#define PARROT_GC_DEFAULT_TYPE MS2
/*
* JIT/i386 can use the CGP run core for external functions instead
Modified: branches/string_macros/src/call/context.c
==============================================================================
--- branches/string_macros/src/call/context.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/call/context.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -260,6 +260,8 @@
PARROT_ASSERT_MSG(!PMC_IS_NULL(pmcctx), "Can't initialise Null CallContext");
+ PARROT_ASSERT(PMC_IS_NULL(pmcold) || pmcold->vtable->base_type == enum_class_CallContext);
+
/*
* FIXME Invoking corotine shouldn't initialise context. So just
* check ctx->current_sub. If it's not null return from here
@@ -277,7 +279,9 @@
ctx->current_sub = PMCNULL;
if (PMC_IS_NULL(pmcold)) {
- ctx->constants = NULL;
+ ctx->num_constants = NULL;
+ ctx->str_constants = NULL;
+ ctx->pmc_constants = NULL;
ctx->warns = 0;
ctx->errors = 0;
ctx->trace_flags = 0;
@@ -288,7 +292,9 @@
else {
Parrot_Context *old = CONTEXT_STRUCT(pmcold);
/* some items should better be COW copied */
- ctx->constants = old->constants;
+ ctx->num_constants = old->num_constants;
+ ctx->str_constants = old->str_constants;
+ ctx->pmc_constants = old->pmc_constants;
ctx->warns = old->warns;
ctx->errors = old->errors;
ctx->trace_flags = old->trace_flags;
Modified: branches/string_macros/src/call/context_accessors.c
==============================================================================
--- branches/string_macros/src/call/context_accessors.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/call/context_accessors.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -49,11 +49,14 @@
/*
-=item C<struct PackFile_Constant * Parrot_pcc_get_constants_func(PARROT_INTERP,
-PMC *ctx)>
+=item C<FLOATVAL * Parrot_pcc_get_num_constants_func(PARROT_INTERP, PMC *ctx)>
+
+=item C<STRING ** Parrot_pcc_get_str_constants_func(PARROT_INTERP, PMC *ctx)>
+
+=item C<PMC ** Parrot_pcc_get_pmc_constants_func(PARROT_INTERP, PMC *ctx)>
=item C<void Parrot_pcc_set_constants_func(PARROT_INTERP, PMC *ctx, struct
-PackFile_Constant *constants)>
+PackFile_ConstTable *ct)>
Get/set constants from context.
@@ -64,22 +67,46 @@
PARROT_EXPORT
PARROT_CANNOT_RETURN_NULL
PARROT_PURE_FUNCTION
-struct PackFile_Constant *
-Parrot_pcc_get_constants_func(SHIM_INTERP, ARGIN(PMC *ctx))
+FLOATVAL *
+Parrot_pcc_get_num_constants_func(SHIM_INTERP, ARGIN(PMC *ctx))
+{
+ ASSERT_ARGS(Parrot_pcc_get_num_constants_func)
+ return CONTEXT_STRUCT(ctx)->num_constants;
+}
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+PARROT_PURE_FUNCTION
+STRING **
+Parrot_pcc_get_str_constants_func(SHIM_INTERP, ARGIN(PMC *ctx))
+{
+ ASSERT_ARGS(Parrot_pcc_get_str_constants_func)
+ return CONTEXT_STRUCT(ctx)->str_constants;
+}
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+PARROT_PURE_FUNCTION
+PMC **
+Parrot_pcc_get_pmc_constants_func(SHIM_INTERP, ARGIN(PMC *ctx))
{
- ASSERT_ARGS(Parrot_pcc_get_constants_func)
- return CONTEXT_STRUCT(ctx)->constants;
+ ASSERT_ARGS(Parrot_pcc_get_pmc_constants_func)
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
+ return CONTEXT_STRUCT(ctx)->pmc_constants;
}
PARROT_EXPORT
PARROT_CAN_RETURN_NULL
void
Parrot_pcc_set_constants_func(SHIM_INTERP, ARGIN(PMC *ctx),
- ARGIN_NULLOK(struct PackFile_Constant *constants))
+ ARGIN(struct PackFile_ConstTable *ct))
{
ASSERT_ARGS(Parrot_pcc_set_constants_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
- c->constants = constants;
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
+ c->num_constants = ct->num.constants;
+ c->str_constants = ct->str.constants;
+ c->pmc_constants = ct->pmc.constants;
}
/*
@@ -99,6 +126,7 @@
{
ASSERT_ARGS(Parrot_pcc_get_recursion_depth_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->recursion_depth;
}
@@ -118,6 +146,7 @@
{
ASSERT_ARGS(Parrot_pcc_inc_recursion_depth_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->recursion_depth++;
}
@@ -137,6 +166,7 @@
{
ASSERT_ARGS(Parrot_pcc_dec_recursion_depth_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return --c->recursion_depth;
}
@@ -161,6 +191,7 @@
{
ASSERT_ARGS(Parrot_pcc_get_caller_ctx_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->caller_ctx;
}
@@ -170,6 +201,8 @@
{
ASSERT_ARGS(Parrot_pcc_set_caller_ctx_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
+ PARROT_ASSERT(caller_ctx->vtable->base_type == enum_class_CallContext);
c->caller_ctx = caller_ctx;
}
@@ -194,6 +227,7 @@
{
ASSERT_ARGS(Parrot_pcc_get_outer_ctx_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->outer_ctx;
}
@@ -203,6 +237,7 @@
{
ASSERT_ARGS(Parrot_pcc_set_outer_ctx_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->outer_ctx = outer_ctx;
}
@@ -226,6 +261,7 @@
{
ASSERT_ARGS(Parrot_pcc_get_lex_pad_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->lex_pad;
}
@@ -235,6 +271,7 @@
{
ASSERT_ARGS(Parrot_pcc_set_lex_pad_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->lex_pad = lex_pad;
}
@@ -259,6 +296,7 @@
{
ASSERT_ARGS(Parrot_pcc_get_namespace_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->current_namespace;
}
@@ -268,6 +306,7 @@
{
ASSERT_ARGS(Parrot_pcc_set_namespace_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->current_namespace = _namespace;
}
@@ -290,6 +329,7 @@
{
ASSERT_ARGS(Parrot_pcc_get_HLL_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->current_HLL;
}
@@ -299,6 +339,7 @@
{
ASSERT_ARGS(Parrot_pcc_set_HLL_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->current_HLL = hll;
}
@@ -323,6 +364,7 @@
{
ASSERT_ARGS(Parrot_pcc_get_handlers_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->handlers;
}
@@ -333,6 +375,7 @@
{
ASSERT_ARGS(Parrot_pcc_set_handlers_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->handlers = handlers;
}
@@ -357,6 +400,7 @@
{
ASSERT_ARGS(Parrot_pcc_get_continuation_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->current_cont;
}
@@ -366,6 +410,7 @@
{
ASSERT_ARGS(Parrot_pcc_set_continuation_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->current_cont = _continuation;
}
@@ -390,6 +435,7 @@
{
ASSERT_ARGS(Parrot_pcc_get_signature_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->current_sig;
}
@@ -399,6 +445,7 @@
{
ASSERT_ARGS(Parrot_pcc_set_signature_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->current_sig = sig_object;
}
@@ -422,6 +469,7 @@
{
ASSERT_ARGS(Parrot_pcc_get_object_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->current_object;
}
@@ -431,6 +479,7 @@
{
ASSERT_ARGS(Parrot_pcc_set_object_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->current_object = object;
}
@@ -454,6 +503,7 @@
{
ASSERT_ARGS(Parrot_pcc_get_pc_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->current_pc;
}
@@ -463,6 +513,7 @@
{
ASSERT_ARGS(Parrot_pcc_set_pc_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->current_pc = pc;
}
@@ -483,6 +534,7 @@
{
ASSERT_ARGS(Parrot_pcc_warnings_on_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->warns |= flags;
return c->warns;
}
@@ -505,6 +557,7 @@
{
ASSERT_ARGS(Parrot_pcc_warnings_off_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->warns &= ~flags;
}
@@ -527,6 +580,7 @@
{
ASSERT_ARGS(Parrot_pcc_warnings_test_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->warns & flags;
}
@@ -546,6 +600,7 @@
{
ASSERT_ARGS(Parrot_pcc_errors_on_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->errors |= flags;
}
@@ -566,6 +621,7 @@
{
ASSERT_ARGS(Parrot_pcc_errors_off_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->errors &= ~flags;
}
@@ -587,6 +643,7 @@
{
ASSERT_ARGS(Parrot_pcc_errors_test_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->errors & flags;
}
@@ -607,6 +664,7 @@
{
ASSERT_ARGS(Parrot_pcc_trace_flags_on_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->trace_flags |= flags;
}
@@ -628,6 +686,7 @@
{
ASSERT_ARGS(Parrot_pcc_trace_flags_off_func)
Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
c->trace_flags &= ~flags;
}
@@ -649,6 +708,7 @@
{
ASSERT_ARGS(Parrot_pcc_trace_flags_test_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
return c->trace_flags & flags;
}
@@ -678,8 +738,8 @@
{
ASSERT_ARGS(Parrot_pcc_get_num_constant_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
- PARROT_ASSERT(c->constants[idx].type == 'n');
- return c->constants[idx].u.number;
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
+ return c->num_constants[idx];
}
PARROT_EXPORT
@@ -690,8 +750,8 @@
{
ASSERT_ARGS(Parrot_pcc_get_string_constant_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
- PARROT_ASSERT(c->constants[idx].type == 's');
- return c->constants[idx].u.string;
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
+ return c->str_constants[idx];
}
PARROT_EXPORT
@@ -702,9 +762,8 @@
{
ASSERT_ARGS(Parrot_pcc_get_pmc_constant_func)
const Parrot_Context * const c = CONTEXT_STRUCT(ctx);
- PARROT_ASSERT((c->constants[idx].type == 'k')
- || (c->constants[idx].type == 'p'));
- return c->constants[idx].u.key;
+ PARROT_ASSERT(ctx->vtable->base_type == enum_class_CallContext);
+ return c->pmc_constants[idx];
}
/*
Modified: branches/string_macros/src/debug.c
==============================================================================
--- branches/string_macros/src/debug.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/debug.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -2344,29 +2344,30 @@
case PARROT_ARG_NC:
{
/* Convert the float to a string */
- const FLOATVAL f = interp->code->const_table->constants[op[j]].u.number;
+ const FLOATVAL f = interp->code->const_table->num.constants[op[j]];
Parrot_snprintf(interp, buf, sizeof (buf), FLOATVAL_FMT, f);
strcpy(&dest[size], buf);
size += strlen(buf);
}
break;
case PARROT_ARG_SC:
- dest[size++] = '"';
- if (interp->code->const_table->constants[op[j]].u.string->strlen) {
- char * const unescaped =
- Parrot_str_to_cstring(interp, interp->code->
- const_table->constants[op[j]].u.string);
- char * const escaped =
- PDB_escape(interp, unescaped, interp->code->const_table->
- constants[op[j]].u.string->strlen);
- if (escaped) {
- strcpy(&dest[size], escaped);
- size += strlen(escaped);
- mem_gc_free(interp, escaped);
+ {
+ const STRING *s = interp->code->const_table->str.constants[op[j]];
+ dest[size++] = '"';
+ if (s->strlen) {
+ char * const unescaped =
+ Parrot_str_to_cstring(interp, s);
+ char * const escaped =
+ PDB_escape(interp, unescaped, s->strlen);
+ if (escaped) {
+ strcpy(&dest[size], escaped);
+ size += strlen(escaped);
+ mem_gc_free(interp, escaped);
+ }
+ Parrot_str_free_cstring(unescaped);
}
- Parrot_str_free_cstring(unescaped);
+ dest[size++] = '"';
}
- dest[size++] = '"';
break;
case PARROT_ARG_PC:
Parrot_snprintf(interp, buf, sizeof (buf), "PMC_CONST(%d)", op[j]);
@@ -2382,7 +2383,7 @@
break;
case PARROT_ARG_KC:
{
- PMC * k = interp->code->const_table->constants[op[j]].u.key;
+ PMC * k = interp->code->const_table->pmc.constants[op[j]];
dest[size - 1] = '[';
while (k) {
switch (PObj_get_FLAGS(k)) {
@@ -2486,7 +2487,7 @@
if (specialop > 0) {
char buf[1000];
- PMC * const sig = interp->code->const_table->constants[op[1]].u.key;
+ PMC * const sig = interp->code->const_table->pmc.constants[op[1]];
const int n_values = VTABLE_elements(interp, sig);
/* The flag_names strings come from Call_bits_enum_t (with which it
should probably be colocated); they name the bits from LSB to MSB.
Modified: branches/string_macros/src/embed.c
==============================================================================
--- branches/string_macros/src/embed.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/embed.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -717,8 +717,8 @@
PMC *new_sub_pmc;
PackFile_ByteCode * const cur_cs = interp->code;
- PackFile_FixupTable * const ft = cur_cs->fixups;
PackFile_ConstTable * const ct = cur_cs->const_table;
+ STRING * const SUB = CONST_STRING(interp, "Sub");
opcode_t i;
@@ -727,10 +727,9 @@
* entry point with the address at our resume_offset.
*/
- for (i = 0; i < ft->fixup_count; ++i) {
- if (ft->fixups[i].type == enum_fixup_sub) {
- const opcode_t ci = ft->fixups[i].offset;
- PMC * const sub_pmc = ct->constants[ci].u.key;
+ for (i = 0; i < ct->pmc.const_count; i++) {
+ PMC *sub_pmc = ct->pmc.constants[i];
+ if (VTABLE_isa(interp, sub_pmc, SUB)) {
Parrot_Sub_attributes *sub;
PMC_get_sub(interp, sub_pmc, sub);
@@ -807,7 +806,7 @@
main_sub = set_current_sub(interp);
Parrot_pcc_set_sub(interp, CURRENT_CONTEXT(interp), NULL);
- Parrot_pcc_set_constants(interp, interp->ctx, interp->code->const_table->constants);
+ Parrot_pcc_set_constants(interp, interp->ctx, interp->code->const_table);
Parrot_ext_call(interp, main_sub, "P->", userargv);
}
@@ -870,83 +869,64 @@
print_constant_table(PARROT_INTERP, ARGIN(PMC *output))
{
ASSERT_ARGS(print_constant_table)
- const INTVAL numconstants = interp->code->const_table->const_count;
+ const PackFile_ConstTable *ct = interp->code->const_table;
INTVAL i;
/* TODO: would be nice to print the name of the file as well */
Parrot_io_fprintf(interp, output, "=head1 Constant-table\n\n");
- for (i = 0; i < numconstants; ++i) {
- const PackFile_Constant * const c = &interp->code->const_table->constants[i];
+ for (i = 0; i < ct->num.const_count; i++)
+ Parrot_io_fprintf(interp, output, "NUM_CONST(%d): %f\n", i, ct->num.constants[i]);
- switch (c->type) {
- case PFC_NUMBER:
- Parrot_io_fprintf(interp, output, "PMC_CONST(%d): %f\n", i, c->u.number);
- break;
- case PFC_STRING:
- Parrot_io_fprintf(interp, output, "PMC_CONST(%d): %S\n", i, c->u.string);
- break;
- case PFC_KEY:
- Parrot_io_fprintf(interp, output, "PMC_CONST(%d): ", i);
- /* XXX */
- /* Parrot_print_p(interp, c->u.key); */
- Parrot_io_fprintf(interp, output, "(PMC constant)");
- Parrot_io_fprintf(interp, output, "\n");
- break;
- case PFC_PMC:
- {
- Parrot_io_fprintf(interp, output, "PMC_CONST(%d): ", i);
-
- switch (c->u.key->vtable->base_type) {
- /* each PBC file has a ParrotInterpreter, but it can't
- * stringify by itself */
- case enum_class_ParrotInterpreter:
- Parrot_io_fprintf(interp, output, "'ParrotInterpreter'");
- break;
+ for (i = 0; i < ct->str.const_count; i++)
+ Parrot_io_fprintf(interp, output, "STR_CONST(%d): %S\n", i, ct->str.constants[i]);
- /* FixedIntegerArrays used for signatures, handy to print */
- case enum_class_FixedIntegerArray:
- {
- const INTVAL n = VTABLE_elements(interp, c->u.key);
- INTVAL j;
- Parrot_io_fprintf(interp, output, "[");
-
- for (j = 0; j < n; ++j) {
- const INTVAL val = VTABLE_get_integer_keyed_int(interp, c->u.key, j);
- Parrot_io_fprintf(interp, output, "%d", val);
- if (j < n - 1)
- Parrot_io_fprintf(interp, output, ",");
- }
- Parrot_io_fprintf(interp, output, "]");
- break;
- }
- case enum_class_NameSpace:
- case enum_class_String:
- case enum_class_Key:
- case enum_class_ResizableStringArray:
- {
- /*Parrot_print_p(interp, c->u.key);*/
- STRING * const s = VTABLE_get_string(interp, c->u.key);
- if (s)
- Parrot_io_fprintf(interp, output, "%Ss", s);
- break;
+ for (i = 0; i < ct->pmc.const_count; i++) {
+ PMC *c = ct->pmc.constants[i];
+ Parrot_io_fprintf(interp, output, "PMC_CONST(%d): ", i);
+
+ switch (c->vtable->base_type) {
+ /* each PBC file has a ParrotInterpreter, but it can't
+ * stringify by itself */
+ case enum_class_ParrotInterpreter:
+ Parrot_io_fprintf(interp, output, "'ParrotInterpreter'");
+ break;
+
+ /* FixedIntegerArrays used for signatures, handy to print */
+ case enum_class_FixedIntegerArray:
+ {
+ const INTVAL n = VTABLE_elements(interp, c);
+ INTVAL j;
+ Parrot_io_fprintf(interp, output, "[");
+
+ for (j = 0; j < n; ++j) {
+ const INTVAL val = VTABLE_get_integer_keyed_int(interp, c, j);
+ Parrot_io_fprintf(interp, output, "%d", val);
+ if (j < n - 1)
+ Parrot_io_fprintf(interp, output, ",");
}
- case enum_class_Sub:
- Parrot_io_fprintf(interp, output, "%S", VTABLE_get_string(interp, c->u.key));
+ Parrot_io_fprintf(interp, output, "]");
break;
- default:
- Parrot_io_fprintf(interp, output, "(PMC constant)");
+ }
+ case enum_class_NameSpace:
+ case enum_class_String:
+ case enum_class_Key:
+ case enum_class_ResizableStringArray:
+ {
+ STRING * const s = VTABLE_get_string(interp, c);
+ if (s)
+ Parrot_io_fprintf(interp, output, "%Ss", s);
break;
}
-
- Parrot_io_fprintf(interp, output, "\n");
+ case enum_class_Sub:
+ Parrot_io_fprintf(interp, output, "%S", VTABLE_get_string(interp, c));
+ break;
+ default:
+ Parrot_io_fprintf(interp, output, "(PMC constant)");
break;
- }
- default:
- Parrot_io_fprintf(interp, output, "wrong constant type in constant table!\n");
- /* XXX throw an exception? Is it worth the trouble? */
- break;
}
+
+ Parrot_io_fprintf(interp, output, "\n");
}
Parrot_io_fprintf(interp, output, "\n=cut\n\n");
@@ -1024,7 +1004,7 @@
const int filename_const_offset =
interp->code->debugs->mappings[curr_mapping].filename;
Parrot_io_fprintf(interp, output, "# Current Source Filename '%Ss'\n",
- interp->code->const_table->constants[filename_const_offset].u.string);
+ interp->code->const_table->str.constants[filename_const_offset]);
++curr_mapping;
}
}
@@ -1103,7 +1083,7 @@
run_native = func;
if (interp->code && interp->code->const_table)
- Parrot_pcc_set_constants(interp, interp->ctx, interp->code->const_table->constants);
+ Parrot_pcc_set_constants(interp, interp->ctx, interp->code->const_table);
runops(interp, interp->resume_offset);
}
Modified: branches/string_macros/src/gc/api.c
==============================================================================
--- branches/string_macros/src/gc/api.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/gc/api.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -126,27 +126,16 @@
Parrot_gc_mark_PObj_alive(PARROT_INTERP, ARGMOD(PObj *obj))
{
ASSERT_ARGS(Parrot_gc_mark_PObj_alive)
- /* TODO: Have each core register a ->pobject_lives function pointer in the
- Memory_Pools struct, and call that pointer directly instead of having a messy
- set of #if preparser conditions. */
/* if object is live or on free list return */
if (PObj_is_live_or_free_TESTALL(obj))
return;
- /* mark it live */
- PObj_live_SET(obj);
-
- /* if object is a PMC and contains buffers or PMCs, then attach the PMC
- * to the chained mark list. */
if (PObj_is_PMC_TEST(obj)) {
- PMC * const p = (PMC *)obj;
-
- if (PObj_is_special_PMC_TEST(obj))
- interp->gc_sys->mark_special(interp, p);
-
- else if (PMC_metadata(p))
- Parrot_gc_mark_PMC_alive(interp, PMC_metadata(p));
+ interp->gc_sys->mark_pmc_header(interp, (PMC*) obj);
+ }
+ else {
+ interp->gc_sys->mark_pobj_header(interp, obj);
}
}
@@ -165,25 +154,7 @@
Parrot_gc_mark_PMC_alive_fun(PARROT_INTERP, ARGMOD_NULLOK(PMC *obj))
{
ASSERT_ARGS(Parrot_gc_mark_PMC_alive_fun)
- if (!PMC_IS_NULL(obj)) {
- PARROT_ASSERT(PObj_is_PMC_TEST(obj));
-
- if (PObj_is_live_or_free_TESTALL(obj))
- return;
-
- /* mark it live */
- PObj_live_SET(obj);
-
- /* if object is a PMC and contains buffers or PMCs, then attach the PMC
- * to the chained mark list. */
- if (PObj_is_special_PMC_TEST(obj)) {
- if (PObj_custom_mark_TEST(obj))
- VTABLE_mark(interp, obj);
- }
-
- if (PMC_metadata(obj))
- Parrot_gc_mark_PMC_alive(interp, PMC_metadata(obj));
- }
+ interp->gc_sys->mark_pmc_header(interp, obj);
}
/*
@@ -198,15 +169,10 @@
PARROT_EXPORT
void
-Parrot_gc_mark_STRING_alive_fun(SHIM_INTERP, ARGMOD_NULLOK(STRING *obj))
+Parrot_gc_mark_STRING_alive_fun(PARROT_INTERP, ARGMOD_NULLOK(STRING *obj))
{
ASSERT_ARGS(Parrot_gc_mark_STRING_alive_fun)
- if (!STRING_IS_NULL(obj)) {
- PARROT_ASSERT(PObj_is_string_TEST(obj));
-
- /* mark it live */
- PObj_live_SET(obj);
- }
+ interp->gc_sys->mark_pobj_header(interp, (PObj*)obj);
}
/*
@@ -239,6 +205,9 @@
case INF:
Parrot_gc_inf_init(interp);
break;
+ case MS2:
+ Parrot_gc_ms2_init(interp);
+ break;
default:
/*die horribly because of invalid GC core specified*/
break;
@@ -974,7 +943,7 @@
{
ASSERT_ARGS(Parrot_is_blocked_GC_sweep)
if (interp->gc_sys->is_blocked_sweep)
- return interp->gc_sys->is_blocked_mark(interp);
+ return interp->gc_sys->is_blocked_sweep(interp);
else
return 0;
}
@@ -1030,6 +999,9 @@
case INF:
name = Parrot_str_new(interp, "inf", 3);
break;
+ case MS2:
+ name = Parrot_str_new(interp, "ms2", 3);
+ break;
default:
name = Parrot_str_new(interp, "unknown", 7);
break;
Added: branches/string_macros/src/gc/fixed_allocator.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/string_macros/src/gc/fixed_allocator.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -0,0 +1,486 @@
+/*
+Copyright (C) 2010, Parrot Foundation.
+$Id$
+
+=head1 NAME
+
+src/gc/fixed_allocator.c - Implementation of allocator for small objects.
+
+=head1 DESCRIPTION
+
+C<FixedAllocator> used to allocate small chunks of fixed size memory.
+
+C<PoolAllocator> used to allocate memory of particular size.
+
+=cut
+
+*/
+
+#include "parrot/parrot.h"
+#include "fixed_allocator.h"
+
+/* HEADERIZER HFILE: src/gc/fixed_allocator.h */
+
+/* HEADERIZER BEGIN: static */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+static void allocate_new_pool_arena(ARGMOD(Pool_Allocator *pool))
+ __attribute__nonnull__(1)
+ FUNC_MODIFIES(*pool);
+
+static size_t arena_size(ARGIN(const Pool_Allocator *self))
+ __attribute__nonnull__(1);
+
+PARROT_CANNOT_RETURN_NULL
+static void * get_free_list_item(ARGMOD(Pool_Allocator *pool))
+ __attribute__nonnull__(1)
+ FUNC_MODIFIES(*pool);
+
+PARROT_CANNOT_RETURN_NULL
+static void * get_newfree_list_item(ARGMOD(Pool_Allocator *pool))
+ __attribute__nonnull__(1)
+ FUNC_MODIFIES(*pool);
+
+PARROT_CANNOT_RETURN_NULL
+static void * pool_allocate(ARGMOD(Pool_Allocator *pool))
+ __attribute__nonnull__(1)
+ FUNC_MODIFIES(*pool);
+
+static void pool_free(ARGMOD(Pool_Allocator *pool), ARGFREE(void *data))
+ __attribute__nonnull__(1)
+ FUNC_MODIFIES(*pool);
+
+static int pool_is_owned(ARGMOD(Pool_Allocator *pool), ARGIN(void *ptr))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*pool);
+
+#define ASSERT_ARGS_allocate_new_pool_arena __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(pool))
+#define ASSERT_ARGS_arena_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(self))
+#define ASSERT_ARGS_get_free_list_item __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(pool))
+#define ASSERT_ARGS_get_newfree_list_item __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(pool))
+#define ASSERT_ARGS_pool_allocate __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(pool))
+#define ASSERT_ARGS_pool_free __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(pool))
+#define ASSERT_ARGS_pool_is_owned __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(pool) \
+ , PARROT_ASSERT_ARG(ptr))
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: static */
+
+/*
+
+=head1 FixedAllocator METHODS
+
+=over 4
+
+=item C<struct Fixed_Allocator* Parrot_gc_fixed_allocator_new(PARROT_INTERP)>
+
+Create new Fixed_Allocator.
+
+=item C<void Parrot_gc_fixed_allocator_destroy(PARROT_INTERP, Fixed_Allocator
+*allocator)>
+
+Destroy Fixed_Allocator.
+
+=item C<void* Parrot_gc_fixed_allocator_allocate(PARROT_INTERP, Fixed_Allocator
+*allocator, size_t size)>
+
+Allocate fixed size memory from Fixed_Allocator.
+
+=item C<void Parrot_gc_fixed_allocator_free(PARROT_INTERP, Fixed_Allocator
+*allocator, void *data, size_t size)>
+
+Free fixed size memory from Fixed_Allocator.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_CAN_RETURN_NULL
+struct Fixed_Allocator*
+Parrot_gc_fixed_allocator_new(PARROT_INTERP)
+{
+ ASSERT_ARGS(Parrot_gc_fixed_allocator_new)
+
+ return mem_internal_allocate_zeroed_typed(Fixed_Allocator);
+}
+
+PARROT_EXPORT
+void
+Parrot_gc_fixed_allocator_destroy(PARROT_INTERP, ARGFREE_NOTNULL(Fixed_Allocator *allocator))
+{
+ ASSERT_ARGS(Parrot_gc_fixed_allocator_destroy)
+ size_t i;
+ for (i = 0; i < allocator->num_pools; ++i) {
+ if (allocator->pools[i]) {
+ Parrot_gc_pool_destroy(interp, allocator->pools[i]);
+ }
+ }
+}
+
+PARROT_EXPORT
+PARROT_CAN_RETURN_NULL
+void*
+Parrot_gc_fixed_allocator_allocate(PARROT_INTERP,
+ ARGIN(Fixed_Allocator *allocator),
+ size_t size)
+{
+ ASSERT_ARGS(Parrot_gc_fixed_allocator_allocate)
+
+ /* We always align size to 4/8 bytes. */
+ const size_t index = (size - 1) / sizeof (void *);
+ void *ret;
+ PARROT_ASSERT(size);
+
+ if (index >= allocator->num_pools) {
+ size_t new_size = index + 1;
+ /* (re)allocate pools */
+ if (allocator->num_pools)
+ allocator->pools = mem_internal_realloc_n_zeroed_typed(
+ allocator->pools, new_size,
+ allocator->num_pools, Pool_Allocator *);
+ else
+ allocator->pools = mem_internal_allocate_n_zeroed_typed(new_size,
+ Pool_Allocator *);
+
+ allocator->num_pools = new_size;
+ }
+
+ if (! allocator->pools[index]) {
+ const size_t alloc_size = (index + 1) * sizeof (void *);
+ allocator->pools[index] = Parrot_gc_pool_new(interp, alloc_size);
+ }
+
+ ret = pool_allocate(allocator->pools[index]);
+
+ /* memset ret to 0 here? */
+ return ret;
+}
+
+
+PARROT_EXPORT
+void
+Parrot_gc_fixed_allocator_free(PARROT_INTERP,
+ ARGIN(Fixed_Allocator *allocator),
+ ARGFREE_NOTNULL(void *data), size_t size)
+{
+ ASSERT_ARGS(Parrot_gc_fixed_allocator_free)
+
+ /* We always align size to 4/8 bytes. */
+ size_t index = (size - 1) / sizeof (void*);
+
+ PARROT_ASSERT(allocator->pools[index]);
+
+ pool_free(allocator->pools[index], data);
+}
+
+/*
+
+=back
+
+=head1 PoolAllocator METHODS
+
+=over 4
+
+=item C<Pool_Allocator * Parrot_gc_pool_new(PARROT_INTERP, size_t object_size)>
+
+Create Pool Allocator
+
+=item C<void Parrot_gc_pool_destroy(PARROT_INTERP, Pool_Allocator *pool)>
+
+Destroy allocated Pool - free memory for all areanas in the alocated pool
+
+=item C<void * Parrot_gc_pool_allocate(PARROT_INTERP, Pool_Allocator * pool)>
+
+Allocate from Pool
+
+=item C<void Parrot_gc_pool_free(PARROT_INTERP, Pool_Allocator *pool, void
+*data)>
+
+Frees a fixed-size data item back to the Pool for later reallocation
+
+=item C<int Parrot_gc_pool_is_owned(PARROT_INTERP, Pool_Allocator *pool, void
+*ptr)>
+
+check for pool validity
+
+=back
+
+=cut
+
+*/
+
+PARROT_CANNOT_RETURN_NULL
+PARROT_MALLOC
+Pool_Allocator *
+Parrot_gc_pool_new(SHIM_INTERP, size_t object_size)
+{
+ ASSERT_ARGS(Parrot_gc_pool_new)
+ const size_t attrib_size = object_size < sizeof (void *) ? sizeof (void*) : object_size;
+ const size_t num_objs_raw =
+ (GC_FIXED_SIZE_POOL_SIZE - sizeof (Pool_Allocator_Arena)) / attrib_size;
+ const size_t num_objs = (num_objs_raw == 0)?(1):(num_objs_raw);
+ Pool_Allocator * const newpool = mem_internal_allocate_typed(Pool_Allocator);
+
+ newpool->object_size = attrib_size;
+ newpool->total_objects = 0;
+ newpool->objects_per_alloc = num_objs;
+ newpool->num_free_objects = 0;
+ newpool->free_list = NULL;
+ newpool->top_arena = NULL;
+ newpool->lo_arena_ptr = (void *)((size_t)-1);
+ newpool->hi_arena_ptr = 0;
+ newpool->newfree = 0;
+ newpool->newlast = 0;
+
+ return newpool;
+}
+
+PARROT_EXPORT
+void
+Parrot_gc_pool_destroy(SHIM_INTERP, ARGMOD(Pool_Allocator *pool))
+{
+ ASSERT_ARGS(Parrot_gc_pool_destroy)
+
+ Pool_Allocator_Arena *arena = pool->top_arena;
+
+ while (arena) {
+ Pool_Allocator_Arena *next = arena->next;
+ mem_internal_free(arena);
+ arena = next;
+ }
+
+ mem_internal_free(pool);
+}
+
+PARROT_CANNOT_RETURN_NULL
+PARROT_EXPORT
+void *
+Parrot_gc_pool_allocate(PARROT_INTERP, ARGMOD(Pool_Allocator * pool))
+{
+ ASSERT_ARGS(Parrot_gc_pool_allocate)
+ return pool_allocate(pool);
+}
+
+PARROT_EXPORT
+void
+Parrot_gc_pool_free(SHIM_INTERP, ARGMOD(Pool_Allocator *pool), ARGFREE(void *data))
+{
+ ASSERT_ARGS(Parrot_gc_pool_free)
+ pool_free(pool, data);
+}
+
+PARROT_EXPORT
+int
+Parrot_gc_pool_is_owned(SHIM_INTERP, ARGMOD(Pool_Allocator *pool), ARGMOD(void *ptr))
+{
+ ASSERT_ARGS(Parrot_gc_pool_is_owned)
+ return pool_is_owned(pool, ptr);
+}
+
+
+/*
+
+=head1 PoolAllocator helper functions
+
+=over 4
+
+=item C<static void * pool_allocate(Pool_Allocator *pool)>
+
+=item C<static void * get_free_list_item(Pool_Allocator *pool)>
+
+=item C<static void * get_newfree_list_item(Pool_Allocator *pool)>
+
+=item C<static void pool_free(Pool_Allocator *pool, void *data)>
+
+=item C<static int pool_is_owned(Pool_Allocator *pool, void *ptr)>
+
+Static implementation of public methods.
+
+=cut
+
+*/
+
+PARROT_CANNOT_RETURN_NULL
+static void *
+get_free_list_item(ARGMOD(Pool_Allocator *pool))
+{
+ ASSERT_ARGS(get_free_list_item)
+
+ Pool_Allocator_Free_List * const item = pool->free_list;
+ pool->free_list = item->next;
+ return item;
+}
+
+PARROT_CANNOT_RETURN_NULL
+static void *
+get_newfree_list_item(ARGMOD(Pool_Allocator *pool))
+{
+ ASSERT_ARGS(get_newfree_list_item)
+
+ Pool_Allocator_Free_List * const item = pool->newfree;
+ pool->newfree = (Pool_Allocator_Free_List *)
+ ((char *)(pool->newfree) + pool->object_size);
+
+ if (pool->newfree >= pool->newlast)
+ pool->newfree = NULL;
+
+ return item;
+}
+
+PARROT_CANNOT_RETURN_NULL
+static void *
+pool_allocate(ARGMOD(Pool_Allocator *pool))
+{
+ ASSERT_ARGS(pool_allocate)
+ Pool_Allocator_Free_List *item;
+
+ if (pool->free_list)
+ item = (Pool_Allocator_Free_List*)get_free_list_item(pool);
+
+ else if (pool->newfree)
+ item = (Pool_Allocator_Free_List*)get_newfree_list_item(pool);
+
+ else {
+ allocate_new_pool_arena(pool);
+ item = (Pool_Allocator_Free_List*)get_newfree_list_item(pool);
+ }
+
+ --pool->num_free_objects;
+ return (void *)item;
+}
+
+static void
+pool_free(ARGMOD(Pool_Allocator *pool), ARGFREE(void *data))
+{
+ ASSERT_ARGS(pool_free)
+ Pool_Allocator_Free_List * const item = (Pool_Allocator_Free_List *)data;
+
+ /* It's too expensive.
+ PARROT_ASSERT(Parrot_gc_pool_is_owned(pool, data));
+ */
+
+ item->next = pool->free_list;
+ pool->free_list = item;
+
+ ++pool->num_free_objects;
+}
+
+
+static int
+pool_is_owned(ARGMOD(Pool_Allocator *pool), ARGIN(void *ptr))
+{
+ ASSERT_ARGS(pool_is_owned)
+ Pool_Allocator_Arena *arena = pool->top_arena;
+ size_t a_size;
+
+ if (ptr < pool->lo_arena_ptr || ptr > pool->hi_arena_ptr)
+ return 0;
+
+ /* We can cache this value. All arenas are same size */
+ a_size = arena_size(pool);
+ while (arena) {
+ const ptrdiff_t ptr_diff =
+ (ptrdiff_t)ptr - (ptrdiff_t)(arena + 1);
+
+ if (0 <= ptr_diff
+ && ptr_diff < a_size
+ && ptr_diff % pool->object_size == 0)
+ return 1;
+
+ arena = arena->next;
+ }
+
+ return 0;
+}
+
+/*
+
+=item C<static void allocate_new_pool_arena(Pool_Allocator *pool)>
+
+Allocate a new pool arena
+
+=cut
+
+*/
+
+static void
+allocate_new_pool_arena(ARGMOD(Pool_Allocator *pool))
+{
+ ASSERT_ARGS(allocate_new_pool_arena)
+ Pool_Allocator_Free_List *next;
+
+ const size_t num_items = pool->objects_per_alloc;
+ const size_t item_size = pool->object_size;
+ const size_t item_space = item_size * num_items;
+
+ /* Round up to 4kb */
+ Pool_Allocator_Arena * const new_arena = (Pool_Allocator_Arena *)mem_internal_allocate(
+ arena_size(pool));
+
+ new_arena->prev = NULL;
+ new_arena->next = pool->top_arena;
+ pool->top_arena = new_arena;
+ next = (Pool_Allocator_Free_List *)(new_arena + 1);
+
+ pool->newfree = next;
+ pool->newlast = (Pool_Allocator_Free_List *)((char *)next + item_space);
+
+ pool->num_free_objects += num_items;
+ pool->total_objects += num_items;
+
+ if (pool->lo_arena_ptr > new_arena)
+ pool->lo_arena_ptr = new_arena;
+
+ if (pool->hi_arena_ptr < (char*)new_arena + GC_FIXED_SIZE_POOL_SIZE)
+ pool->hi_arena_ptr = new_arena + GC_FIXED_SIZE_POOL_SIZE;
+}
+
+/*
+
+=item C<static size_t arena_size(const Pool_Allocator *self)>
+
+Calculate size of Arena.
+
+=cut
+
+*/
+
+static size_t
+arena_size(ARGIN(const Pool_Allocator *self))
+{
+ ASSERT_ARGS(arena_size)
+
+ const size_t num_items = self->objects_per_alloc;
+ const size_t item_size = self->object_size;
+ const size_t item_space = item_size * num_items;
+ const size_t total_size = sizeof (Pool_Allocator_Arena) + item_space;
+
+ /* Round up to 4kb */
+ return total_size < GC_FIXED_SIZE_POOL_SIZE
+ ? GC_FIXED_SIZE_POOL_SIZE
+ : total_size;
+}
+
+
+/*
+
+=back
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Added: branches/string_macros/src/gc/fixed_allocator.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/string_macros/src/gc/fixed_allocator.h Tue Sep 28 19:35:30 2010 (r49367)
@@ -0,0 +1,158 @@
+/*
+Copyright (C) 2001-2010, Parrot Foundation.
+$Id$
+
+=head1 NAME
+
+src/gc/fixed_allocator.h - implementation of allocator for small-size objects.
+
+=head1 DESCRIPTION
+
+*/
+
+#ifndef PARROT_GC_FIXED_ALLOCATOR_H_GUARD
+#define PARROT_GC_FIXED_ALLOCATOR_H_GUARD
+
+#include "parrot/settings.h"
+
+/* these values are used for the attribute allocator */
+#define GC_ATTRIB_POOLS_HEADROOM 8
+#define GC_FIXED_SIZE_POOL_SIZE 4096
+
+/* Use the lazy allocator. Since it amortizes arena allocation costs, turn
+ this on at the same time that you increase the size of allocated arenas.
+ increase *_HEADERS_PER_ALLOC and GC_FIXED_SIZE_POOL_SIZE to be large
+ enough to satisfy most startup costs. */
+
+typedef struct Pool_Allocator_Free_List {
+ struct Pool_Allocator_Free_List * next;
+} Pool_Allocator_Free_List;
+
+typedef struct Pool_Allocator_Arena {
+ struct Pool_Allocator_Arena * next;
+ struct Pool_Allocator_Arena * prev;
+} Pool_Allocator_Arena;
+
+typedef struct Pool_Allocator {
+ size_t object_size;
+ size_t total_objects;
+ size_t objects_per_alloc;
+ size_t num_free_objects;
+ Pool_Allocator_Free_List * free_list;
+ Pool_Allocator_Arena * top_arena;
+ Pool_Allocator_Free_List * newfree;
+ Pool_Allocator_Free_List * newlast;
+
+ /* Pointers of arena bounds. Used in .is_owned check */
+ void *lo_arena_ptr;
+ void *hi_arena_ptr;
+} Pool_Allocator;
+
+typedef struct Fixed_Allocator
+{
+ Pool_Allocator **pools;
+ size_t num_pools;
+} Fixed_Allocator;
+
+
+/* HEADERIZER BEGIN: src/gc/fixed_allocator.c */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+PARROT_EXPORT
+PARROT_CAN_RETURN_NULL
+void* Parrot_gc_fixed_allocator_allocate(PARROT_INTERP,
+ ARGIN(Fixed_Allocator *allocator),
+ size_t size)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+void Parrot_gc_fixed_allocator_destroy(PARROT_INTERP,
+ ARGFREE_NOTNULL(Fixed_Allocator *allocator))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_EXPORT
+void Parrot_gc_fixed_allocator_free(PARROT_INTERP,
+ ARGIN(Fixed_Allocator *allocator),
+ ARGFREE_NOTNULL(void *data),
+ size_t size)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+PARROT_EXPORT
+PARROT_CAN_RETURN_NULL
+struct Fixed_Allocator* Parrot_gc_fixed_allocator_new(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+PARROT_CANNOT_RETURN_NULL
+PARROT_EXPORT
+void * Parrot_gc_pool_allocate(PARROT_INTERP, ARGMOD(Pool_Allocator * pool))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(* pool);
+
+PARROT_EXPORT
+void Parrot_gc_pool_destroy(SHIM_INTERP, ARGMOD(Pool_Allocator *pool))
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*pool);
+
+PARROT_EXPORT
+void Parrot_gc_pool_free(SHIM_INTERP,
+ ARGMOD(Pool_Allocator *pool),
+ ARGFREE(void *data))
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*pool);
+
+PARROT_EXPORT
+int Parrot_gc_pool_is_owned(SHIM_INTERP,
+ ARGMOD(Pool_Allocator *pool),
+ ARGMOD(void *ptr))
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*pool)
+ FUNC_MODIFIES(*ptr);
+
+PARROT_CANNOT_RETURN_NULL
+PARROT_MALLOC
+Pool_Allocator * Parrot_gc_pool_new(SHIM_INTERP, size_t object_size);
+
+#define ASSERT_ARGS_Parrot_gc_fixed_allocator_allocate \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(allocator))
+#define ASSERT_ARGS_Parrot_gc_fixed_allocator_destroy \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(allocator))
+#define ASSERT_ARGS_Parrot_gc_fixed_allocator_free \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(allocator) \
+ , PARROT_ASSERT_ARG(data))
+#define ASSERT_ARGS_Parrot_gc_fixed_allocator_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_Parrot_gc_pool_allocate __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pool))
+#define ASSERT_ARGS_Parrot_gc_pool_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(pool))
+#define ASSERT_ARGS_Parrot_gc_pool_free __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(pool))
+#define ASSERT_ARGS_Parrot_gc_pool_is_owned __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(pool) \
+ , PARROT_ASSERT_ARG(ptr))
+#define ASSERT_ARGS_Parrot_gc_pool_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: src/gc/fixed_allocator.c */
+
+
+#endif /* PARROT_GC_FIXED_ALLOCATOR_H_GUARD */
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: branches/string_macros/src/gc/gc_ms.c
==============================================================================
--- branches/string_macros/src/gc/gc_ms.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/gc/gc_ms.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -16,6 +16,7 @@
#include "parrot/parrot.h"
#include "gc_private.h"
+#include "parrot/list.h"
#define DEBUG_FREE_LIST 0
@@ -43,10 +44,11 @@
static int gc_ms_active_sized_buffers(ARGIN(const Memory_Pools *mem_pools))
__attribute__nonnull__(1);
-static void gc_ms_add_free_object(SHIM_INTERP,
+static void gc_ms_add_free_object(PARROT_INTERP,
ARGMOD(Memory_Pools *mem_pools),
ARGMOD(Fixed_Size_Pool *pool),
ARGIN(void *to_add))
+ __attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
__attribute__nonnull__(4)
@@ -155,6 +157,12 @@
static unsigned int gc_ms_is_blocked_GC_sweep(PARROT_INTERP)
__attribute__nonnull__(1);
+static int gc_ms_is_pmc_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
+ __attribute__nonnull__(1);
+
+static int gc_ms_is_string_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
+ __attribute__nonnull__(1);
+
static void gc_ms_iterate_live_strings(PARROT_INTERP,
string_iterator_callback callback,
ARGIN_NULLOK(void *data))
@@ -163,6 +171,10 @@
static void gc_ms_mark_and_sweep(PARROT_INTERP, UINTVAL flags)
__attribute__nonnull__(1);
+static void gc_ms_mark_pobj_header(PARROT_INTERP, ARGMOD_NULLOK(PObj *obj))
+ __attribute__nonnull__(1)
+ FUNC_MODIFIES(*obj);
+
static void gc_ms_mark_special(PARROT_INTERP, ARGIN(PMC *pmc))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
@@ -252,7 +264,8 @@
#define ASSERT_ARGS_gc_ms_active_sized_buffers __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(mem_pools))
#define ASSERT_ARGS_gc_ms_add_free_object __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools) \
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(mem_pools) \
, PARROT_ASSERT_ARG(pool) \
, PARROT_ASSERT_ARG(to_add))
#define ASSERT_ARGS_gc_ms_alloc_objects __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -308,10 +321,16 @@
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_gc_ms_is_blocked_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms_is_pmc_ptr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms_is_string_ptr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_gc_ms_iterate_live_strings __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_gc_ms_mark_and_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms_mark_pobj_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_gc_ms_mark_special __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pmc))
@@ -400,6 +419,11 @@
interp->gc_sys->allocate_bufferlike_header = gc_ms_allocate_bufferlike_header;
interp->gc_sys->free_bufferlike_header = gc_ms_free_bufferlike_header;
+ interp->gc_sys->is_pmc_ptr = gc_ms_is_pmc_ptr;
+ interp->gc_sys->is_string_ptr = gc_ms_is_string_ptr;
+ interp->gc_sys->mark_pmc_header = gc_ms_mark_pmc_header;
+ interp->gc_sys->mark_pobj_header = gc_ms_mark_pobj_header;
+
interp->gc_sys->allocate_pmc_attributes = gc_ms_allocate_pmc_attributes;
interp->gc_sys->free_pmc_attributes = gc_ms_free_pmc_attributes;
@@ -433,6 +457,10 @@
interp->gc_sys->iterate_live_strings = gc_ms_iterate_live_strings;
+ /* gc_private is @objects */
+ interp->gc_sys->gc_private = Parrot_list_new(interp);
+
+
Parrot_gc_str_initialize(interp, &interp->mem_pools->string_gc);
initialize_fixed_size_pools(interp, interp->mem_pools);
Parrot_gc_initialize_fixed_size_pools(interp, interp->mem_pools,
@@ -513,8 +541,8 @@
size_t dynamic_threshold;
/* new_mem is the additional amount of memory used since the last GC */
- size_t new_mem = mem_pools->memory_used
- - mem_pools->mem_used_last_collect;
+ size_t new_mem = interp->gc_sys->stats.memory_used
+ - interp->gc_sys->stats.mem_used_last_collect;
/* Never run a GC if new_mem is below static GC_SIZE_THRESHOLD */
if (new_mem <= GC_SIZE_THRESHOLD)
@@ -522,7 +550,7 @@
/* The dynamic threshold is a configurable percentage of the amount of
memory used after the last GC */
- dynamic_threshold = (size_t)(mem_pools->mem_used_last_collect *
+ dynamic_threshold = (size_t)(interp->gc_sys->stats.mem_used_last_collect *
(0.01 * interp->gc_threshold));
return new_mem > dynamic_threshold;
@@ -581,7 +609,7 @@
}
else {
- ++mem_pools->gc_lazy_mark_runs;
+ ++interp->gc_sys->stats.gc_lazy_mark_runs;
Parrot_gc_clear_live_bits(interp, mem_pools->pmc_pool);
}
@@ -592,10 +620,12 @@
pt_gc_stop_mark(interp);
/* Note it */
- ++mem_pools->gc_mark_runs;
+ ++interp->gc_sys->stats.gc_mark_runs;
+ interp->gc_sys->stats.header_allocs_since_last_collect = 0;
+
--mem_pools->gc_mark_block_level;
- mem_pools->header_allocs_since_last_collect = 0;
- mem_pools->mem_used_last_collect = mem_pools->memory_used;
+ interp->gc_sys->stats.header_allocs_since_last_collect = 0;
+ interp->gc_sys->stats.mem_used_last_collect = interp->gc_sys->stats.memory_used;
return;
}
@@ -777,6 +807,83 @@
/*
+=item C<void gc_ms_mark_pmc_header(PARROT_INTERP, PMC *obj)>
+
+Mark the PMC *obj as live and attach PMCs and/or buffers
+
+=cut
+
+*/
+
+void
+gc_ms_mark_pmc_header(PARROT_INTERP, ARGMOD_NULLOK(PMC *obj))
+{
+ ASSERT_ARGS(gc_ms_mark_pmc_header)
+ if (!PMC_IS_NULL(obj)) {
+ PARROT_ASSERT(PObj_is_PMC_TEST(obj));
+
+ if (PObj_is_live_or_free_TESTALL(obj))
+ return;
+
+ /* mark it live */
+ PObj_live_SET(obj);
+
+ /* if object is a PMC and contains buffers or PMCs, then attach the PMC
+ * to the chained mark list. */
+ if (PObj_is_special_PMC_TEST(obj)) {
+ if (PObj_custom_mark_TEST(obj))
+ VTABLE_mark(interp, obj);
+ }
+
+ if (PMC_metadata(obj))
+ Parrot_gc_mark_PMC_alive(interp, PMC_metadata(obj));
+ }
+}
+
+/*
+
+=item C<static int gc_ms_is_pmc_ptr(PARROT_INTERP, void *ptr)>
+
+return True if *ptr is contained in the pool
+
+=cut
+
+*/
+
+static int
+gc_ms_is_pmc_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
+{
+ ASSERT_ARGS(gc_ms_is_pmc_ptr)
+ return contained_in_pool(interp->mem_pools->pmc_pool, ptr);
+}
+
+/*
+
+=item C<static int gc_ms_is_string_ptr(PARROT_INTERP, void *ptr)>
+
+establish if string *ptr is owned
+
+=cut
+
+*/
+
+static int
+gc_ms_is_string_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
+{
+ ASSERT_ARGS(gc_ms_is_string_ptr)
+ UINTVAL i;
+
+ for (i = 0; i < interp->mem_pools->num_sized; ++i) {
+ if (interp->mem_pools->sized_header_pools[i]
+ && contained_in_pool(interp->mem_pools->sized_header_pools[i], ptr))
+ return 1;
+ }
+
+ return 0;
+}
+
+/*
+
=item C<static STRING* gc_ms_allocate_string_header(PARROT_INTERP, UINTVAL
flags)>
@@ -824,6 +931,26 @@
/*
+=item C<static void gc_ms_mark_pobj_header(PARROT_INTERP, PObj *obj)>
+
+mark *obj as live
+
+=cut
+
+*/
+
+static void
+gc_ms_mark_pobj_header(PARROT_INTERP, ARGMOD_NULLOK(PObj *obj))
+{
+ ASSERT_ARGS(gc_ms_mark_pobj_header)
+ if (obj) {
+ /* mark it live */
+ PObj_live_SET(obj);
+ }
+}
+
+/*
+
=item C<static Buffer * gc_ms_allocate_bufferlike_header(PARROT_INTERP, size_t
size)>
@@ -1415,7 +1542,7 @@
*/
static void
-gc_ms_add_free_object(SHIM_INTERP,
+gc_ms_add_free_object(PARROT_INTERP,
ARGMOD(Memory_Pools *mem_pools),
ARGMOD(Fixed_Size_Pool *pool),
ARGIN(void *to_add))
@@ -1431,7 +1558,7 @@
object->next_ptr = pool->free_list;
pool->free_list = object;
- mem_pools->memory_used -= pool->object_size;
+ interp->gc_sys->stats.memory_used -= pool->object_size;
}
/*
@@ -1482,7 +1609,7 @@
}
--pool->num_free_objects;
- mem_pools->memory_used += pool->object_size;
+ interp->gc_sys->stats.memory_used += pool->object_size;
return ptr;
}
@@ -1632,12 +1759,6 @@
Memory_Pools * const mem_pools = interp->mem_pools;
switch (which) {
- case TOTAL_MEM_ALLOC:
- return mem_pools->memory_allocated;
- case GC_MARK_RUNS:
- return mem_pools->gc_mark_runs;
- case GC_COLLECT_RUNS:
- return mem_pools->gc_collect_runs;
case ACTIVE_PMCS:
return mem_pools->pmc_pool->total_objects -
mem_pools->pmc_pool->num_free_objects;
@@ -1647,17 +1768,50 @@
return mem_pools->pmc_pool->total_objects;
case TOTAL_BUFFERS:
return gc_ms_total_sized_buffers(mem_pools);
+ case IMPATIENT_PMCS:
+ return mem_pools->num_early_gc_PMCs;
+ default:
+ return Parrot_gc_get_info(interp, which, &interp->gc_sys->stats);
+ break;
+ }
+ return 0;
+}
+
+/*
+TODO Move it somewhere.
+*/
+
+/*
+
+=item C<size_t Parrot_gc_get_info(PARROT_INTERP, Interpinfo_enum which,
+GC_Statistics *stats)>
+
+returns stats as required by enum which
+
+=cut
+
+*/
+
+size_t
+Parrot_gc_get_info(PARROT_INTERP, Interpinfo_enum which, ARGIN(GC_Statistics *stats))
+{
+ ASSERT_ARGS(Parrot_gc_get_info)
+
+ switch (which) {
+ case TOTAL_MEM_ALLOC:
+ return stats->memory_allocated;
+ case GC_MARK_RUNS:
+ return stats->gc_mark_runs;
+ case GC_COLLECT_RUNS:
+ return stats->gc_collect_runs;
case HEADER_ALLOCS_SINCE_COLLECT:
- return mem_pools->header_allocs_since_last_collect;
+ return stats->header_allocs_since_last_collect;
case MEM_ALLOCS_SINCE_COLLECT:
- return mem_pools->mem_allocs_since_last_collect;
+ return stats->mem_allocs_since_last_collect;
case TOTAL_COPIED:
- return mem_pools->memory_collected;
- case IMPATIENT_PMCS:
- return mem_pools->num_early_gc_PMCs;
+ return stats->memory_collected;
case GC_LAZY_MARK_RUNS:
- return mem_pools->gc_lazy_mark_runs;
- case EXTENDED_PMCS:
+ return stats->gc_lazy_mark_runs;
default:
break;
}
Added: branches/string_macros/src/gc/gc_ms2.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/string_macros/src/gc/gc_ms2.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -0,0 +1,1460 @@
+/*
+Copyright (C) 2001-2010, Parrot Foundation.
+$Id$
+
+=head1 NAME
+
+src/gc/gc_ms2.c - Non-recursive M&S
+
+=head1 DESCRIPTION
+
+=cut
+
+*/
+
+#include "parrot/parrot.h"
+#include "parrot/gc_api.h"
+#include "parrot/list.h"
+#include "gc_private.h"
+#include "fixed_allocator.h"
+
+#define PANIC_OUT_OF_MEM(size) failed_allocation(__LINE__, (size))
+
+/* Private information */
+typedef struct MarkSweep_GC {
+ /* Allocator for PMC headers */
+ struct Pool_Allocator *pmc_allocator;
+ /* Currently allocate objects */
+ struct Linked_List *objects;
+ /* During M&S gather new live objects in this list */
+ struct Linked_List *new_objects;
+
+ /* Allocator for strings */
+ struct Pool_Allocator *string_allocator;
+ struct Linked_List *strings;
+
+ /* Fixed-size allocator */
+ struct Fixed_Allocator *fixed_size_allocator;
+
+ /* String GC */
+ struct String_GC string_gc;
+
+ /* Number of allocated objects before trigger gc */
+ size_t gc_threshold;
+
+ /* GC blocking */
+ UINTVAL gc_mark_block_level; /* How many outstanding GC block
+ requests are there? */
+ UINTVAL gc_sweep_block_level; /* How many outstanding GC block
+ requests are there? */
+
+ UINTVAL num_early_gc_PMCs; /* how many PMCs want immediate destruction */
+
+} MarkSweep_GC;
+
+/* Callback to destroy PMC or free string storage */
+typedef void (*sweep_cb)(PARROT_INTERP, PObj *obj);
+
+/* HEADERIZER HFILE: src/gc/gc_private.h */
+
+/* HEADERIZER BEGIN: static */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+PARROT_DOES_NOT_RETURN
+static void failed_allocation(unsigned int line, unsigned long size);
+
+PARROT_MALLOC
+PARROT_CAN_RETURN_NULL
+static Buffer* gc_ms2_allocate_buffer_header(PARROT_INTERP,
+ SHIM(size_t size))
+ __attribute__nonnull__(1);
+
+static void gc_ms2_allocate_buffer_storage(PARROT_INTERP,
+ ARGIN(Buffer *str),
+ size_t size)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_CAN_RETURN_NULL
+static void* gc_ms2_allocate_fixed_size_storage(PARROT_INTERP, size_t size)
+ __attribute__nonnull__(1);
+
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+static void * gc_ms2_allocate_memory_chunk(SHIM_INTERP, size_t size);
+
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+static void * gc_ms2_allocate_memory_chunk_zeroed(SHIM_INTERP, size_t size);
+
+PARROT_MALLOC
+PARROT_CAN_RETURN_NULL
+static void* gc_ms2_allocate_pmc_attributes(PARROT_INTERP, ARGMOD(PMC *pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*pmc);
+
+PARROT_MALLOC
+PARROT_CAN_RETURN_NULL
+static PMC* gc_ms2_allocate_pmc_header(PARROT_INTERP, UINTVAL flags)
+ __attribute__nonnull__(1);
+
+PARROT_MALLOC
+PARROT_CAN_RETURN_NULL
+static STRING* gc_ms2_allocate_string_header(PARROT_INTERP,
+ SHIM(UINTVAL flags))
+ __attribute__nonnull__(1);
+
+static void gc_ms2_allocate_string_storage(PARROT_INTERP,
+ ARGIN(STRING *str),
+ size_t size)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+static void gc_ms2_block_GC_mark(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+static void gc_ms2_block_GC_sweep(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+static void gc_ms2_compact_memory_pool(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+static size_t gc_ms2_count_used_pmc_memory(PARROT_INTERP,
+ ARGIN(Linked_List *list))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+static size_t gc_ms2_count_used_string_memory(PARROT_INTERP,
+ ARGIN(Linked_List *list))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+static void gc_ms2_finalize(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+static void gc_ms2_free_buffer_header(PARROT_INTERP,
+ ARGFREE(Buffer *s),
+ SHIM(size_t size))
+ __attribute__nonnull__(1);
+
+static void gc_ms2_free_fixed_size_storage(PARROT_INTERP,
+ size_t size,
+ ARGMOD(void *data))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(3)
+ FUNC_MODIFIES(*data);
+
+static void gc_ms2_free_memory_chunk(SHIM_INTERP, ARGFREE(void *data));
+static void gc_ms2_free_pmc_attributes(PARROT_INTERP, ARGMOD(PMC *pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*pmc);
+
+static void gc_ms2_free_pmc_header(PARROT_INTERP, ARGFREE(PMC *pmc))
+ __attribute__nonnull__(1);
+
+static void gc_ms2_free_string_header(PARROT_INTERP, ARGFREE(STRING *s))
+ __attribute__nonnull__(1);
+
+static size_t gc_ms2_get_gc_info(PARROT_INTERP, Interpinfo_enum which)
+ __attribute__nonnull__(1);
+
+static unsigned int gc_ms2_is_blocked_GC_mark(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+static unsigned int gc_ms2_is_blocked_GC_sweep(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+static int gc_ms2_is_pmc_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
+ __attribute__nonnull__(1);
+
+static int gc_ms2_is_ptr_owned(PARROT_INTERP,
+ ARGIN_NULLOK(void *ptr),
+ ARGIN(Pool_Allocator *pool),
+ ARGIN(Linked_List *list))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4);
+
+static int gc_ms2_is_string_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
+ __attribute__nonnull__(1);
+
+static void gc_ms2_iterate_live_strings(PARROT_INTERP,
+ string_iterator_callback callback,
+ ARGIN_NULLOK(void *data))
+ __attribute__nonnull__(1);
+
+static void gc_ms2_mark_and_sweep(PARROT_INTERP, UINTVAL flags)
+ __attribute__nonnull__(1);
+
+static void gc_ms2_mark_pmc_header(PARROT_INTERP, ARGIN(PMC *pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+static void gc_ms2_mark_pobj_header(PARROT_INTERP, ARGIN_NULLOK(PObj * obj))
+ __attribute__nonnull__(1);
+
+static void gc_ms2_maybe_mark_and_sweep(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+static void gc_ms2_pmc_needs_early_collection(PARROT_INTERP,
+ ARGMOD(PMC *pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*pmc);
+
+static void gc_ms2_reallocate_buffer_storage(PARROT_INTERP,
+ ARGIN(Buffer *str),
+ size_t size)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+static void * gc_ms2_reallocate_memory_chunk(SHIM_INTERP,
+ ARGFREE(void *from),
+ size_t size);
+
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+static void * gc_ms2_reallocate_memory_chunk_zeroed(SHIM_INTERP,
+ ARGFREE(void *data),
+ size_t newsize,
+ size_t oldsize);
+
+static void gc_ms2_reallocate_string_storage(PARROT_INTERP,
+ ARGIN(STRING *str),
+ size_t size)
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+static void gc_ms2_sweep_pmc_cb(PARROT_INTERP, ARGIN(PObj *obj))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+static void gc_ms2_sweep_pool(PARROT_INTERP,
+ ARGIN(Pool_Allocator *pool),
+ ARGIN(Linked_List *list),
+ ARGIN(sweep_cb callback))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3)
+ __attribute__nonnull__(4);
+
+static void gc_ms2_sweep_string_cb(PARROT_INTERP, ARGIN(PObj *obj))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2);
+
+static void gc_ms2_unblock_GC_mark(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+static void gc_ms2_unblock_GC_sweep(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+#define ASSERT_ARGS_failed_allocation __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_gc_ms2_allocate_buffer_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_allocate_buffer_storage \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(str))
+#define ASSERT_ARGS_gc_ms2_allocate_fixed_size_storage \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_allocate_memory_chunk __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_gc_ms2_allocate_memory_chunk_zeroed \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_gc_ms2_allocate_pmc_attributes \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pmc))
+#define ASSERT_ARGS_gc_ms2_allocate_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_allocate_string_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_allocate_string_storage \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(str))
+#define ASSERT_ARGS_gc_ms2_block_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_block_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_compact_memory_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_count_used_pmc_memory __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(list))
+#define ASSERT_ARGS_gc_ms2_count_used_string_memory \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(list))
+#define ASSERT_ARGS_gc_ms2_finalize __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_free_buffer_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_free_fixed_size_storage \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(data))
+#define ASSERT_ARGS_gc_ms2_free_memory_chunk __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_gc_ms2_free_pmc_attributes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pmc))
+#define ASSERT_ARGS_gc_ms2_free_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_free_string_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_get_gc_info __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_is_blocked_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_is_blocked_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_is_pmc_ptr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_is_ptr_owned __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pool) \
+ , PARROT_ASSERT_ARG(list))
+#define ASSERT_ARGS_gc_ms2_is_string_ptr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_iterate_live_strings __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_mark_and_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_mark_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pmc))
+#define ASSERT_ARGS_gc_ms2_mark_pobj_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_maybe_mark_and_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_pmc_needs_early_collection \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pmc))
+#define ASSERT_ARGS_gc_ms2_reallocate_buffer_storage \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(str))
+#define ASSERT_ARGS_gc_ms2_reallocate_memory_chunk \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_gc_ms2_reallocate_memory_chunk_zeroed \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_gc_ms2_reallocate_string_storage \
+ __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(str))
+#define ASSERT_ARGS_gc_ms2_sweep_pmc_cb __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(obj))
+#define ASSERT_ARGS_gc_ms2_sweep_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(pool) \
+ , PARROT_ASSERT_ARG(list) \
+ , PARROT_ASSERT_ARG(callback))
+#define ASSERT_ARGS_gc_ms2_sweep_string_cb __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(obj))
+#define ASSERT_ARGS_gc_ms2_unblock_GC_mark __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_gc_ms2_unblock_GC_sweep __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: static */
+
+/*
+
+=head1 Functions
+
+=over 4
+
+=item C<static void gc_ms2_mark_and_sweep(PARROT_INTERP, UINTVAL flags)>
+
+This function would perform a GC run, if we needed to. Luckily we have
+infinite memory!
+
+This function is called from the GC API function C<Parrot_gc_mark_and_sweep>.
+
+Flags can be a combination of these values:
+
+ GC_finish_FLAG
+ GC_lazy_FLAG
+ GC_trace_stack_FLAG
+
+=cut
+
+*/
+
+/*
+
+=item C<static void gc_ms2_compact_memory_pool(PARROT_INTERP)>
+
+Stub for compacting memory pools.
+
+=cut
+
+*/
+static void
+gc_ms2_compact_memory_pool(PARROT_INTERP)
+{
+ ASSERT_ARGS(gc_ms2_compact_memory_pool)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ Parrot_gc_str_compact_pool(interp, &self->string_gc);
+}
+
+/*
+
+=item C<static PMC* gc_ms2_allocate_pmc_header(PARROT_INTERP, UINTVAL flags)>
+
+=item C<static void gc_ms2_free_pmc_header(PARROT_INTERP, PMC *pmc)>
+
+=item C<static STRING* gc_ms2_allocate_string_header(PARROT_INTERP, UINTVAL
+flags)>
+
+=item C<static void gc_ms2_free_string_header(PARROT_INTERP, STRING *s)>
+
+=item C<static void* gc_ms2_allocate_pmc_attributes(PARROT_INTERP, PMC *pmc)>
+
+=item C<static void gc_ms2_free_pmc_attributes(PARROT_INTERP, PMC *pmc)>
+
+=item C<static void gc_ms2_allocate_string_storage(PARROT_INTERP, STRING *str,
+size_t size)>
+
+=item C<static void gc_ms2_reallocate_string_storage(PARROT_INTERP, STRING *str,
+size_t size)>
+
+=item C<static void gc_ms2_allocate_buffer_storage(PARROT_INTERP, Buffer *str,
+size_t size)>
+
+=item C<static void gc_ms2_reallocate_buffer_storage(PARROT_INTERP, Buffer *str,
+size_t size)>
+
+=item C<static void* gc_ms2_allocate_fixed_size_storage(PARROT_INTERP, size_t
+size)>
+
+=item C<static void gc_ms2_free_fixed_size_storage(PARROT_INTERP, size_t size,
+void *data)>
+
+Functions for allocating/deallocating various objects.
+
+*/
+
+
+PARROT_MALLOC
+PARROT_CAN_RETURN_NULL
+static void*
+gc_ms2_allocate_pmc_attributes(PARROT_INTERP, ARGMOD(PMC *pmc))
+{
+ ASSERT_ARGS(gc_ms2_allocate_pmc_attributes)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ const size_t attr_size = pmc->vtable->attr_size;
+ PMC_data(pmc) = Parrot_gc_fixed_allocator_allocate(interp,
+ self->fixed_size_allocator, attr_size);
+ memset(PMC_data(pmc), 0, attr_size);
+
+ interp->gc_sys->stats.mem_used_last_collect += attr_size;
+
+ return PMC_data(pmc);
+}
+
+static void
+gc_ms2_free_pmc_attributes(PARROT_INTERP, ARGMOD(PMC *pmc))
+{
+ ASSERT_ARGS(gc_ms2_free_pmc_attributes)
+ if (PMC_data(pmc)) {
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ Parrot_gc_fixed_allocator_free(interp, self->fixed_size_allocator,
+ PMC_data(pmc), pmc->vtable->attr_size);
+
+ interp->gc_sys->stats.mem_used_last_collect -= pmc->vtable->attr_size;
+ }
+}
+
+PARROT_CAN_RETURN_NULL
+static void*
+gc_ms2_allocate_fixed_size_storage(PARROT_INTERP, size_t size)
+{
+ ASSERT_ARGS(gc_ms2_allocate_fixed_size_storage)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+
+ interp->gc_sys->stats.memory_allocated += size;
+ interp->gc_sys->stats.mem_used_last_collect += size;
+
+ return Parrot_gc_fixed_allocator_allocate(interp, self->fixed_size_allocator, size);
+}
+
+static void
+gc_ms2_free_fixed_size_storage(PARROT_INTERP, size_t size, ARGMOD(void *data))
+{
+ ASSERT_ARGS(gc_ms2_free_fixed_size_storage)
+ if (data) {
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+
+ interp->gc_sys->stats.memory_allocated -= size;
+ interp->gc_sys->stats.mem_used_last_collect -= size;
+
+ Parrot_gc_fixed_allocator_free(interp, self->fixed_size_allocator, data, size);
+ }
+}
+
+/*
+
+=item C<static size_t gc_ms2_get_gc_info(PARROT_INTERP, Interpinfo_enum which)>
+
+GC introspection function.
+gets stats based on enum which
+
+=cut
+
+*/
+static size_t
+gc_ms2_get_gc_info(PARROT_INTERP, Interpinfo_enum which)
+{
+ ASSERT_ARGS(gc_ms2_get_gc_info)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+
+ if (which == IMPATIENT_PMCS)
+ return self->num_early_gc_PMCs;
+
+ return Parrot_gc_get_info(interp, which, &interp->gc_sys->stats);
+}
+
+
+
+
+/*
+
+=item C<void Parrot_gc_ms2_init(PARROT_INTERP)>
+
+Initializes the infinite memory collector. Installs the necessary function
+pointers into the Memory_Pools structure. The two most important are the
+C<mark_and_sweep> and C<pool_init> functions. C<finalize_gc_system> function
+will be called at Parrot exit and will shut down the GC system if things
+need to be flushed/closed/deactivated/freed/etc. It can be set to NULL if no
+finalization is necessary.
+
+=cut
+
+*/
+
+void
+Parrot_gc_ms2_init(PARROT_INTERP)
+{
+ ASSERT_ARGS(Parrot_gc_ms2_init)
+ struct MarkSweep_GC *self;
+
+ /* We have to transfer ownership of memory to parent interp in threaded parrot */
+ interp->gc_sys->finalize_gc_system = NULL; /* gc_ms2_finalize; */
+
+ interp->gc_sys->do_gc_mark = gc_ms2_mark_and_sweep;
+ interp->gc_sys->compact_string_pool = gc_ms2_compact_memory_pool;
+
+ /*
+ interp->gc_sys->mark_special = gc_ms2_mark_special;
+ */
+ interp->gc_sys->pmc_needs_early_collection = gc_ms2_pmc_needs_early_collection;
+
+ interp->gc_sys->allocate_pmc_header = gc_ms2_allocate_pmc_header;
+ interp->gc_sys->free_pmc_header = gc_ms2_free_pmc_header;
+
+ interp->gc_sys->allocate_string_header = gc_ms2_allocate_string_header;
+ interp->gc_sys->free_string_header = gc_ms2_free_string_header;
+
+ interp->gc_sys->allocate_bufferlike_header = gc_ms2_allocate_buffer_header;
+ interp->gc_sys->free_bufferlike_header = gc_ms2_free_buffer_header;
+
+ interp->gc_sys->allocate_pmc_attributes = gc_ms2_allocate_pmc_attributes;
+ interp->gc_sys->free_pmc_attributes = gc_ms2_free_pmc_attributes;
+
+ interp->gc_sys->is_pmc_ptr = gc_ms2_is_pmc_ptr;
+ interp->gc_sys->is_string_ptr = gc_ms2_is_string_ptr;
+ interp->gc_sys->mark_pmc_header = gc_ms2_mark_pmc_header;
+ interp->gc_sys->mark_pobj_header = gc_ms2_mark_pobj_header;
+
+ interp->gc_sys->block_mark = gc_ms2_block_GC_mark;
+ interp->gc_sys->unblock_mark = gc_ms2_unblock_GC_mark;
+ interp->gc_sys->is_blocked_mark = gc_ms2_is_blocked_GC_mark;
+
+ interp->gc_sys->block_sweep = gc_ms2_block_GC_sweep;
+ interp->gc_sys->unblock_sweep = gc_ms2_unblock_GC_sweep;
+ interp->gc_sys->is_blocked_sweep = gc_ms2_is_blocked_GC_sweep;
+
+ interp->gc_sys->allocate_string_storage = gc_ms2_allocate_string_storage;
+ interp->gc_sys->reallocate_string_storage = gc_ms2_reallocate_string_storage;
+
+ interp->gc_sys->allocate_buffer_storage = gc_ms2_allocate_buffer_storage;
+ interp->gc_sys->reallocate_buffer_storage = gc_ms2_reallocate_buffer_storage;
+
+ interp->gc_sys->allocate_fixed_size_storage = gc_ms2_allocate_fixed_size_storage;
+ interp->gc_sys->free_fixed_size_storage = gc_ms2_free_fixed_size_storage;
+
+ /* We don't distinguish between chunk and chunk_with_pointers */
+ interp->gc_sys->allocate_memory_chunk = gc_ms2_allocate_memory_chunk;
+ interp->gc_sys->reallocate_memory_chunk = gc_ms2_reallocate_memory_chunk;
+ interp->gc_sys->allocate_memory_chunk_with_interior_pointers
+ = gc_ms2_allocate_memory_chunk_zeroed;
+ interp->gc_sys->reallocate_memory_chunk_with_interior_pointers
+ = gc_ms2_reallocate_memory_chunk_zeroed;
+ interp->gc_sys->free_memory_chunk = gc_ms2_free_memory_chunk;
+
+ interp->gc_sys->iterate_live_strings = gc_ms2_iterate_live_strings;
+
+ interp->gc_sys->get_gc_info = gc_ms2_get_gc_info;
+
+ if (interp->parent_interpreter && interp->parent_interpreter->gc_sys) {
+ /* This is a "child" interpreter. Just reuse parent one */
+ self = (MarkSweep_GC*)interp->parent_interpreter->gc_sys->gc_private;
+ }
+ else {
+ self = mem_allocate_zeroed_typed(MarkSweep_GC);
+
+ self->pmc_allocator = Parrot_gc_pool_new(interp,
+ sizeof (List_Item_Header) + sizeof (PMC));
+ self->objects = Parrot_list_new(interp);
+
+ self->string_allocator = Parrot_gc_pool_new(interp,
+ sizeof (List_Item_Header) + sizeof (STRING));
+ self->strings = Parrot_list_new(interp);
+
+ self->fixed_size_allocator = Parrot_gc_fixed_allocator_new(interp);
+
+ /* Collect every 256M allocated. */
+ /* Hardcode for now. Will be configured via CLI */
+ self->gc_threshold = 256 * 1024 * 1024;
+ }
+ interp->gc_sys->gc_private = self;
+
+ Parrot_gc_str_initialize(interp, &self->string_gc);
+}
+
+/*
+=item C<static void gc_ms2_finalize(PARROT_INTERP)>
+
+Finalize GC subsystem.
+
+=cut
+*/
+static void
+gc_ms2_finalize(PARROT_INTERP)
+{
+ ASSERT_ARGS(gc_ms2_finalize)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+
+ Parrot_gc_str_finalize(interp, &self->string_gc);
+
+ Parrot_list_destroy(interp, self->objects);
+ Parrot_list_destroy(interp, self->strings);
+ Parrot_gc_pool_destroy(interp, self->pmc_allocator);
+ Parrot_gc_pool_destroy(interp, self->string_allocator);
+ Parrot_gc_fixed_allocator_destroy(interp, self->fixed_size_allocator);
+}
+
+PARROT_MALLOC
+PARROT_CAN_RETURN_NULL
+static PMC*
+gc_ms2_allocate_pmc_header(PARROT_INTERP, UINTVAL flags)
+{
+ ASSERT_ARGS(gc_ms2_allocate_pmc_header)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ List_Item_Header *ptr;
+ PMC *ret;
+
+ gc_ms2_maybe_mark_and_sweep(interp);
+
+ /* Increase used memory. Not precisely accurate due Pool_Allocator paging */
+ ++interp->gc_sys->stats.header_allocs_since_last_collect;
+ interp->gc_sys->stats.memory_allocated += sizeof (PMC);
+ interp->gc_sys->stats.mem_used_last_collect += sizeof (PMC);
+
+ ptr = (List_Item_Header *)Parrot_gc_pool_allocate(interp,
+ self->pmc_allocator);
+ LIST_APPEND(self->objects, ptr);
+
+ ret = LLH2Obj_typed(ptr, PMC);
+
+ return ret;
+}
+
+static void
+gc_ms2_free_pmc_header(PARROT_INTERP, ARGFREE(PMC *pmc))
+{
+ ASSERT_ARGS(gc_ms2_free_pmc_header)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ if (pmc) {
+ if (PObj_on_free_list_TEST(pmc))
+ return;
+ Parrot_list_remove(interp, self->objects, Obj2LLH(pmc));
+ PObj_on_free_list_SET(pmc);
+
+ Parrot_pmc_destroy(interp, pmc);
+
+ Parrot_gc_pool_free(interp, self->pmc_allocator, Obj2LLH(pmc));
+
+ --interp->gc_sys->stats.header_allocs_since_last_collect;
+ interp->gc_sys->stats.memory_allocated -= sizeof (PMC);
+ interp->gc_sys->stats.mem_used_last_collect -= sizeof (PMC);
+ }
+}
+
+/*
+
+=item C<static void gc_ms2_mark_pmc_header(PARROT_INTERP, PMC *pmc)>
+
+mark as grey
+
+=cut
+
+*/
+
+static void
+gc_ms2_mark_pmc_header(PARROT_INTERP, ARGIN(PMC *pmc))
+{
+ ASSERT_ARGS(gc_ms2_mark_pmc_header)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ List_Item_Header *item = Obj2LLH(pmc);
+
+ /* Object was already marked as grey. Or live. Or dead. Skip it */
+ if (PObj_is_live_or_free_TESTALL(pmc) || PObj_constant_TEST(pmc))
+ return;
+
+ /* mark it live */
+ PObj_live_SET(pmc);
+
+ LIST_REMOVE(self->objects, item);
+ LIST_APPEND(self->new_objects, item);
+
+}
+
+/*
+
+=item C<static int gc_ms2_is_pmc_ptr(PARROT_INTERP, void *ptr)>
+
+establish if *ptr is.owned
+
+=cut
+
+*/
+
+static int
+gc_ms2_is_pmc_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
+{
+ ASSERT_ARGS(gc_ms2_is_pmc_ptr)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ return gc_ms2_is_ptr_owned(interp, ptr, self->pmc_allocator, self->objects);
+}
+
+/*
+
+=item C<static void gc_ms2_sweep_pmc_cb(PARROT_INTERP, PObj *obj)>
+
+destroy pmc *obj
+
+=cut
+
+*/
+
+static void
+gc_ms2_sweep_pmc_cb(PARROT_INTERP, ARGIN(PObj *obj))
+{
+ ASSERT_ARGS(gc_ms2_sweep_pmc_cb)
+ PMC *pmc = (PMC *)obj;
+ Parrot_pmc_destroy(interp, pmc);
+}
+
+/*
+=item C<gc_ms2_allocate_string_header()>
+
+=item C<gc_ms2_free_string_header()>
+
+=item C<static Buffer* gc_ms2_allocate_buffer_header(PARROT_INTERP, size_t
+size)>
+
+=item C<static void gc_ms2_free_buffer_header(PARROT_INTERP, Buffer *s, size_t
+size)>
+
+Allocate/free string/buffer headers.
+
+*/
+
+PARROT_MALLOC
+PARROT_CAN_RETURN_NULL
+static STRING*
+gc_ms2_allocate_string_header(PARROT_INTERP, SHIM(UINTVAL flags))
+{
+ ASSERT_ARGS(gc_ms2_allocate_string_header)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ List_Item_Header *ptr;
+ STRING *ret;
+
+ gc_ms2_maybe_mark_and_sweep(interp);
+
+ /* Increase used memory. Not precisely accurate due Pool_Allocator paging */
+ ++interp->gc_sys->stats.header_allocs_since_last_collect;
+ interp->gc_sys->stats.memory_allocated += sizeof (STRING);
+ interp->gc_sys->stats.mem_used_last_collect += sizeof (STRING);
+
+ ptr = (List_Item_Header *)Parrot_gc_pool_allocate(interp,
+ self->string_allocator);
+ LIST_APPEND(self->strings, ptr);
+
+ ret = LLH2Obj_typed(ptr, STRING);
+ memset(ret, 0, sizeof (STRING));
+ return ret;
+}
+
+static void
+gc_ms2_free_string_header(PARROT_INTERP, ARGFREE(STRING *s))
+{
+ ASSERT_ARGS(gc_ms2_free_string_header)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ if (s) {
+ if (PObj_on_free_list_TEST(s))
+ return;
+ Parrot_list_remove(interp, self->strings, Obj2LLH(s));
+ PObj_on_free_list_SET(s);
+
+ if (Buffer_bufstart(s) && !PObj_external_TEST(s))
+ Parrot_gc_str_free_buffer_storage(interp, &self->string_gc, (Buffer *)s);
+
+ Parrot_gc_pool_free(interp, self->string_allocator, Obj2LLH(s));
+
+ --interp->gc_sys->stats.header_allocs_since_last_collect;
+ interp->gc_sys->stats.memory_allocated -= sizeof (STRING);
+ interp->gc_sys->stats.mem_used_last_collect -= sizeof (STRING);
+ }
+}
+
+PARROT_MALLOC
+PARROT_CAN_RETURN_NULL
+static Buffer*
+gc_ms2_allocate_buffer_header(PARROT_INTERP, SHIM(size_t size))
+{
+ ASSERT_ARGS(gc_ms2_allocate_buffer_header)
+ return (Buffer*)gc_ms2_allocate_string_header(interp, 0);
+}
+
+static void
+gc_ms2_free_buffer_header(PARROT_INTERP, ARGFREE(Buffer *s), SHIM(size_t size))
+{
+ ASSERT_ARGS(gc_ms2_free_buffer_header)
+ gc_ms2_free_string_header(interp, (STRING*)s);
+}
+
+/*
+
+=item C<static int gc_ms2_is_string_ptr(PARROT_INTERP, void *ptr)>
+
+establish if string *ptr is owned
+
+=cut
+
+*/
+
+static int
+gc_ms2_is_string_ptr(PARROT_INTERP, ARGIN_NULLOK(void *ptr))
+{
+ ASSERT_ARGS(gc_ms2_is_string_ptr)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ return gc_ms2_is_ptr_owned(interp, ptr, self->string_allocator, self->strings);
+}
+
+/*
+
+item C<void gc_ms_allocate_string_storage(PARROT_INTERP, STRING *str, size_t
+size)>
+
+=item C<void gc_ms_reallocate_string_storage(PARROT_INTERP, STRING *str, size_t
+size)>
+
+=item C<void gc_ms_allocate_buffer_storage(PARROT_INTERP, Buffer *str, size_t
+size)>
+
+=item C<void gc_ms_reallocate_buffer_storage(PARROT_INTERP, Buffer *str, size_t
+size)>
+
+Functions for allocating strings/buffers storage.
+
+=cut
+*/
+
+static void
+gc_ms2_allocate_string_storage(PARROT_INTERP, ARGIN(STRING *str), size_t size)
+{
+ ASSERT_ARGS(gc_ms2_allocate_string_storage)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ Parrot_gc_str_allocate_string_storage(interp, &self->string_gc, str, size);
+ interp->gc_sys->stats.mem_used_last_collect += size;
+}
+
+static void
+gc_ms2_reallocate_string_storage(PARROT_INTERP, ARGIN(STRING *str), size_t size)
+{
+ ASSERT_ARGS(gc_ms2_reallocate_string_storage)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ Parrot_gc_str_reallocate_string_storage(interp, &self->string_gc, str, size);
+ interp->gc_sys->stats.mem_used_last_collect += size;
+}
+
+static void
+gc_ms2_allocate_buffer_storage(PARROT_INTERP, ARGIN(Buffer *str), size_t size)
+{
+ ASSERT_ARGS(gc_ms2_allocate_buffer_storage)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ Parrot_gc_str_allocate_buffer_storage(interp, &self->string_gc, str, size);
+ interp->gc_sys->stats.mem_used_last_collect += size;
+}
+
+static void
+gc_ms2_reallocate_buffer_storage(PARROT_INTERP, ARGIN(Buffer *str), size_t size)
+{
+ ASSERT_ARGS(gc_ms2_reallocate_buffer_storage)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ Parrot_gc_str_reallocate_buffer_storage(interp, &self->string_gc, str, size);
+ interp->gc_sys->stats.mem_used_last_collect += size;
+}
+
+/*
+
+=item C<static void gc_ms2_mark_pobj_header(PARROT_INTERP, PObj * obj)>
+
+Mark PObj as live.
+
+=cut
+
+*/
+
+static void
+gc_ms2_mark_pobj_header(PARROT_INTERP, ARGIN_NULLOK(PObj * obj))
+{
+ ASSERT_ARGS(gc_ms2_mark_pobj_header)
+ if (obj) {
+ if (PObj_is_PMC_TEST(obj))
+ gc_ms2_mark_pmc_header(interp, (PMC *)obj);
+ else
+ PObj_live_SET(obj);
+ }
+}
+
+/*
+
+=item C<static void gc_ms2_sweep_string_cb(PARROT_INTERP, PObj *obj)>
+
+destroy string *obj
+
+=cut
+
+*/
+
+static void
+gc_ms2_sweep_string_cb(PARROT_INTERP, ARGIN(PObj *obj))
+{
+ ASSERT_ARGS(gc_ms2_sweep_string_cb)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ Buffer *str = (Buffer *)obj;
+ /* Compact string pool here. Or get rid of "shared buffers" and just free storage */
+ if (Buffer_bufstart(str) && !PObj_external_TEST(str))
+ Parrot_gc_str_free_buffer_storage(interp, &self->string_gc, str);
+}
+
+
+/*
+
+=item C<static void gc_ms2_iterate_live_strings(PARROT_INTERP,
+string_iterator_callback callback, void *data)>
+
+Iterate over live string invoking callback for each of them. Used during
+compacting of string pool.
+
+=cut
+*/
+static void
+gc_ms2_iterate_live_strings(PARROT_INTERP,
+ string_iterator_callback callback,
+ ARGIN_NULLOK(void *data))
+{
+ ASSERT_ARGS(gc_ms2_iterate_live_strings)
+
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ List_Item_Header *tmp = self->strings->first;
+
+ while (tmp) {
+ Buffer *b = LLH2Obj_typed(tmp, Buffer);
+ callback(interp, b, data);
+ tmp = tmp->next;
+ }
+}
+
+
+static void
+gc_ms2_mark_and_sweep(PARROT_INTERP, UINTVAL flags)
+{
+ ASSERT_ARGS(gc_ms2_mark_and_sweep)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ List_Item_Header *tmp;
+ Linked_List *list;
+ size_t counter;
+ UNUSED(flags);
+
+ /* GC is blocked */
+ if (self->gc_mark_block_level)
+ return;
+
+ if (flags & GC_finish_FLAG) {
+ /* Ignore it. Will cleanup in gc_ms2_finalize */
+ return;
+ }
+
+ /* Ignore calls from String GC. We know better when to trigger GC */
+ if (flags & GC_strings_cb_FLAG) {
+ return;
+ }
+
+ ++self->gc_mark_block_level;
+
+ /* Allocate list for gray objects */
+ self->new_objects = Parrot_list_new(interp);
+
+ /* Trace "roots" into new_objects */
+ gc_ms2_mark_pmc_header(interp, PMCNULL);
+
+ Parrot_gc_trace_root(interp, NULL, GC_TRACE_FULL);
+ if (interp->pdb && interp->pdb->debugger) {
+ Parrot_gc_trace_root(interp->pdb->debugger, NULL, (Parrot_gc_trace_type)0);
+ }
+
+ /* new_objects are "gray" untill fully marked */
+ /* Additional gray objects will appened to new_objects list */
+ /* So, iterate over them in one go */
+ tmp = self->new_objects->first;
+ while (tmp) {
+ PMC *pmc = LLH2Obj_typed(tmp, PMC);
+ /* if object is a PMC and contains buffers or PMCs, then attach the PMC
+ * to the chained mark list. */
+ if (PObj_is_special_PMC_TEST(pmc)) {
+ if (PObj_custom_mark_TEST(pmc))
+ VTABLE_mark(interp, pmc);
+ }
+
+ if (PMC_metadata(pmc))
+ Parrot_gc_mark_PMC_alive(interp, PMC_metadata(pmc));
+
+ tmp = tmp->next;
+ }
+
+ /* At this point of time new_objects contains only live PMCs */
+ /* objects contains "dead" or "constant" PMCs */
+ /* sweep of new_objects will repaint them white */
+ /* sweep of objects will destroy dead objects leaving only "constant" */
+ gc_ms2_sweep_pool(interp, self->pmc_allocator, self->new_objects, gc_ms2_sweep_pmc_cb);
+ gc_ms2_sweep_pool(interp, self->pmc_allocator, self->objects, gc_ms2_sweep_pmc_cb);
+ gc_ms2_sweep_pool(interp, self->string_allocator, self->strings, gc_ms2_sweep_string_cb);
+
+ /* Replace objects with new_objects. Ignoring "constant" one */
+ list = self->objects;
+ self->objects = self->new_objects;
+ Parrot_list_destroy(interp, list);
+
+ interp->gc_sys->stats.header_allocs_since_last_collect = 0;
+ interp->gc_sys->stats.mem_used_last_collect = 0;
+ interp->gc_sys->stats.gc_mark_runs++;
+ self->gc_mark_block_level--;
+ /* We swept all dead objects */
+ self->num_early_gc_PMCs = 0;
+
+ gc_ms2_compact_memory_pool(interp);
+}
+
+
+
+/*
+=item C<static void gc_ms2_sweep_pool(PARROT_INTERP, Pool_Allocator *pool,
+Linked_List *list, sweep_cb callback)>
+
+Helper function to sweep pool.
+
+=cut
+*/
+static void
+gc_ms2_sweep_pool(PARROT_INTERP,
+ ARGIN(Pool_Allocator *pool),
+ ARGIN(Linked_List *list),
+ ARGIN(sweep_cb callback))
+{
+ ASSERT_ARGS(gc_ms2_sweep_pool)
+ List_Item_Header *tmp = list->first;
+ while (tmp) {
+ List_Item_Header *next = tmp->next;
+ PObj *obj = LLH2Obj_typed(tmp, PObj);
+ if (PObj_live_TEST(obj)) {
+ /* Paint live objects white */
+ PObj_live_CLEAR(obj);
+ }
+ else if (!PObj_constant_TEST(obj)) {
+ PObj_on_free_list_SET(obj);
+ LIST_REMOVE(list, tmp);
+
+ callback(interp, obj);
+
+ Parrot_gc_pool_free(interp, pool, tmp);
+ }
+ tmp = next;
+ }
+}
+
+
+
+/*
+=item C<static int gc_ms2_is_ptr_owned(PARROT_INTERP, void *ptr, Pool_Allocator
+*pool, Linked_List *list)>
+
+Helper function to check that we own PObj
+
+=cut
+*/
+
+static int
+gc_ms2_is_ptr_owned(PARROT_INTERP, ARGIN_NULLOK(void *ptr),
+ ARGIN(Pool_Allocator *pool), ARGIN(Linked_List *list))
+{
+ ASSERT_ARGS(gc_ms2_is_ptr_owned)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ List_Item_Header *item = Obj2LLH(ptr);
+ PObj *obj = (PObj *)ptr;
+
+ if (!obj || !item)
+ return 0;
+
+ if (!Parrot_gc_pool_is_owned(interp, pool, item))
+ return 0;
+
+ /* black or white objects marked already. */
+ if (PObj_is_live_or_free_TESTALL(obj))
+ return 0;
+
+ /* Pool.is_owned isn't precise enough (yet) */
+ if (Parrot_list_contains(interp, list, item))
+ return 1;
+
+ return 0;
+}
+
+
+/*
+
+=item C<static void gc_ms2_block_GC_mark(PARROT_INTERP)>
+
+Blocks the GC from performing its mark phase.
+
+=item C<static void gc_ms2_unblock_GC_mark(PARROT_INTERP)>
+
+Unblocks the GC mark.
+
+=item C<static void gc_ms2_block_GC_sweep(PARROT_INTERP)>
+
+Blocks the GC from performing its sweep phase.
+
+=item C<static void gc_ms2_unblock_GC_sweep(PARROT_INTERP)>
+
+Unblocks GC sweep.
+
+=item C<static unsigned int gc_ms2_is_blocked_GC_mark(PARROT_INTERP)>
+
+Determines if the GC mark is currently blocked.
+
+=item C<static unsigned int gc_ms2_is_blocked_GC_sweep(PARROT_INTERP)>
+
+Determines if the GC sweep is currently blocked.
+
+=cut
+
+*/
+
+static void
+gc_ms2_block_GC_mark(PARROT_INTERP)
+{
+ ASSERT_ARGS(gc_ms2_block_GC_mark)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ ++self->gc_mark_block_level;
+ Parrot_shared_gc_block(interp);
+}
+
+static void
+gc_ms2_unblock_GC_mark(PARROT_INTERP)
+{
+ ASSERT_ARGS(gc_ms2_unblock_GC_mark)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ if (self->gc_mark_block_level) {
+ --self->gc_mark_block_level;
+ Parrot_shared_gc_unblock(interp);
+ }
+}
+
+static void
+gc_ms2_block_GC_sweep(PARROT_INTERP)
+{
+ ASSERT_ARGS(gc_ms2_block_GC_sweep)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ ++self->gc_sweep_block_level;
+}
+
+static void
+gc_ms2_unblock_GC_sweep(PARROT_INTERP)
+{
+ ASSERT_ARGS(gc_ms2_unblock_GC_sweep)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ if (self->gc_sweep_block_level)
+ --self->gc_sweep_block_level;
+}
+
+static unsigned int
+gc_ms2_is_blocked_GC_mark(PARROT_INTERP)
+{
+ ASSERT_ARGS(gc_ms2_is_blocked_GC_mark)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ return self->gc_mark_block_level;
+}
+
+static unsigned int
+gc_ms2_is_blocked_GC_sweep(PARROT_INTERP)
+{
+ ASSERT_ARGS(gc_ms2_is_blocked_GC_sweep)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ return self->gc_sweep_block_level;
+}
+
+
+
+/*
+
+=item C<static void * gc_ms2_allocate_memory_chunk(PARROT_INTERP, size_t size)>
+
+=item C<static void * gc_ms2_reallocate_memory_chunk(PARROT_INTERP, void *from,
+size_t size)>
+
+=item C<static void * gc_ms2_allocate_memory_chunk_zeroed(PARROT_INTERP, size_t
+size)>
+
+=item C<static void * gc_ms2_reallocate_memory_chunk_zeroed(PARROT_INTERP, void
+*data, size_t newsize, size_t oldsize)>
+
+=item C<static void gc_ms2_free_memory_chunk(PARROT_INTERP, void *data)>
+
+=item C<static void failed_allocation(unsigned int line, unsigned long size)>
+
+TODO Write docu.
+
+*/
+
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+static void *
+gc_ms2_allocate_memory_chunk(SHIM_INTERP, size_t size)
+{
+ ASSERT_ARGS(gc_ms2_allocate_memory_chunk)
+ void * const ptr = malloc(size);
+#ifdef DETAIL_MEMORY_DEBUG
+ fprintf(stderr, "Allocated %i at %p\n", size, ptr);
+#endif
+ if (!ptr)
+ PANIC_OUT_OF_MEM(size);
+ return ptr;
+}
+
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+static void *
+gc_ms2_reallocate_memory_chunk(SHIM_INTERP, ARGFREE(void *from), size_t size)
+{
+ ASSERT_ARGS(gc_ms2_reallocate_memory_chunk)
+ void *ptr;
+#ifdef DETAIL_MEMORY_DEBUG
+ fprintf(stderr, "Freed %p (realloc -- %i bytes)\n", from, size);
+#endif
+ if (from)
+ ptr = realloc(from, size);
+ else
+ ptr = calloc(1, size);
+#ifdef DETAIL_MEMORY_DEBUG
+ fprintf(stderr, "Allocated %i at %p\n", size, ptr);
+#endif
+ if (!ptr)
+ PANIC_OUT_OF_MEM(size);
+ return ptr;
+}
+
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+static void *
+gc_ms2_allocate_memory_chunk_zeroed(SHIM_INTERP, size_t size)
+{
+ ASSERT_ARGS(gc_ms2_allocate_memory_chunk_zeroed)
+ void * const ptr = calloc(1, (size_t)size);
+#ifdef DETAIL_MEMORY_DEBUG
+ fprintf(stderr, "Allocated %i at %p\n", size, ptr);
+#endif
+ if (!ptr)
+ PANIC_OUT_OF_MEM(size);
+ return ptr;
+}
+
+PARROT_MALLOC
+PARROT_CANNOT_RETURN_NULL
+static void *
+gc_ms2_reallocate_memory_chunk_zeroed(SHIM_INTERP, ARGFREE(void *data),
+ size_t newsize, size_t oldsize)
+{
+ ASSERT_ARGS(gc_ms2_reallocate_memory_chunk_zeroed)
+ void * const ptr = realloc(data, newsize);
+ if (newsize > oldsize)
+ memset((char*)ptr + oldsize, 0, newsize - oldsize);
+ return ptr;
+}
+
+static void
+gc_ms2_free_memory_chunk(SHIM_INTERP, ARGFREE(void *data))
+{
+ ASSERT_ARGS(gc_ms2_free_memory_chunk)
+#ifdef DETAIL_MEMORY_DEBUG
+ fprintf(stderr, "Freed %p\n", data);
+#endif
+ if (data)
+ free(data);
+}
+
+PARROT_DOES_NOT_RETURN
+static void
+failed_allocation(unsigned int line, unsigned long size)
+{
+ ASSERT_ARGS(failed_allocation)
+ fprintf(stderr, "Failed allocation of %lu bytes\n", size);
+ do_panic(NULL, "Out of mem", __FILE__, line);
+}
+
+
+/*
+
+=item C<static void gc_ms2_pmc_needs_early_collection(PARROT_INTERP, PMC *pmc)>
+
+Mark a PMC as needing timely destruction
+
+=cut
+
+*/
+
+static void
+gc_ms2_pmc_needs_early_collection(PARROT_INTERP, ARGMOD(PMC *pmc))
+{
+ ASSERT_ARGS(gc_ms2_pmc_needs_early_collection)
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+ ++self->num_early_gc_PMCs;
+}
+
+/*
+
+=item C<static void gc_ms2_maybe_mark_and_sweep(PARROT_INTERP)>
+
+Maybe M&S. Depends on total allocated memory, memory allocated since last alloc
+and phase of the Moon.
+
+=cut
+
+*/
+static void
+gc_ms2_maybe_mark_and_sweep(PARROT_INTERP)
+{
+ ASSERT_ARGS(gc_ms2_maybe_mark_and_sweep)
+
+ MarkSweep_GC *self = (MarkSweep_GC *)interp->gc_sys->gc_private;
+
+ /* Collect every 256M. Hardcode for now. Will be configured via CLI */
+ if (interp->gc_sys->stats.mem_used_last_collect > self->gc_threshold) {
+ gc_ms2_mark_and_sweep(interp, 0);
+ }
+}
+
+/*
+
+=item C<static size_t gc_ms2_count_used_string_memory(PARROT_INTERP, Linked_List
+*list)>
+
+find amount of used string memory
+
+=cut
+
+*/
+
+static size_t
+gc_ms2_count_used_string_memory(PARROT_INTERP, ARGIN(Linked_List *list))
+{
+ ASSERT_ARGS(gc_ms2_count_used_string_memory)
+
+ size_t total_amount = 0;
+
+ List_Item_Header *tmp = list->first;
+ while (tmp) {
+ List_Item_Header *next = tmp->next;
+ PObj *obj = LLH2Obj_typed(tmp, PObj);
+ STRING *str = (STRING*)obj;
+
+ /* Header size */
+ total_amount += sizeof (List_Item_Header)
+ + sizeof (STRING*);
+ total_amount += str->bufused;
+
+ tmp = next;
+ }
+
+ return total_amount;
+}
+
+/*
+
+=item C<static size_t gc_ms2_count_used_pmc_memory(PARROT_INTERP, Linked_List
+*list)>
+
+find amount of used pmc memory
+
+=cut
+
+*/
+
+static size_t
+gc_ms2_count_used_pmc_memory(PARROT_INTERP, ARGIN(Linked_List *list))
+{
+ ASSERT_ARGS(gc_ms2_count_used_pmc_memory)
+
+ size_t total_amount = 0;
+
+ List_Item_Header *tmp = list->first;
+ while (tmp) {
+ List_Item_Header *next = tmp->next;
+ PMC *obj = LLH2Obj_typed(tmp, PMC);
+
+ /* Header size */
+ total_amount += sizeof (List_Item_Header)
+ + sizeof (PMC*);
+ total_amount += obj->vtable->attr_size;
+
+ tmp = next;
+ }
+
+ return total_amount;
+}
+
+/*
+
+=back
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: branches/string_macros/src/gc/gc_private.h
==============================================================================
--- branches/string_macros/src/gc/gc_private.h Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/gc/gc_private.h Tue Sep 28 19:35:30 2010 (r49367)
@@ -17,6 +17,7 @@
#define PARROT_GC_PRIVATE_H_GUARD
#include "parrot/settings.h"
+#include "variable_size_pool.h"
#if ! DISABLE_GC_DEBUG
/* Set when walking the system stack. Defined in src/gc/system.c */
@@ -79,8 +80,10 @@
typedef enum _gc_sys_type_enum {
- MS, /*mark and sweep*/
- INF /*infinite memory core*/
+ MS, /* mark and sweep */
+ INF, /* infinite memory core */
+ TMS, /* tricolor mark and sweep */
+ MS2
} gc_sys_type_enum;
/* how often to skip a full GC when this pool has nothing free */
@@ -91,6 +94,38 @@
GC_NEVER_SKIP /* unused */
} gc_skip_type_enum;
+/** statistics for GC **/
+typedef struct GC_Statistics {
+ size_t gc_mark_runs; /* Number of times we've done a mark run */
+ size_t gc_lazy_mark_runs; /* Number of successful lazy mark runs */
+ size_t gc_collect_runs; /* Number of times we've done a memory
+ compaction */
+ size_t mem_allocs_since_last_collect; /* The number of memory
+ * allocations from the
+ * system since the last
+ * compaction run */
+ size_t header_allocs_since_last_collect; /* The size of header
+ * blocks allocated from
+ * the system since the last
+ * GC run */
+ size_t memory_allocated; /* The total amount of memory allocated
+ * in fixed and variable size pools.
+ * Doesn't count memory for internal
+ * structures */
+ size_t memory_used; /* The total amount of memory used
+ * in fixed and variable size
+ * pools. Also includes memory in
+ * variable size pools that has been
+ * freed but can only be reclaimed
+ * by a GC run */
+ size_t mem_used_last_collect; /* The total amount of
+ * memory used after
+ * the last GC run */
+ UINTVAL memory_collected; /* Total amount of memory copied
+ during collection */
+
+} GC_Statistics;
+
/* Callback for live string. Use Buffer for now... */
typedef void (*string_iterator_callback)(PARROT_INTERP, Buffer *str, void *data);
@@ -115,10 +150,15 @@
void (*free_pmc_header)(PARROT_INTERP, PMC *);
STRING* (*allocate_string_header)(PARROT_INTERP, UINTVAL flags);
- void (*free_string_header)(PARROT_INTERP, STRING*);
+ void (*free_string_header)(PARROT_INTERP, STRING*);
Buffer* (*allocate_bufferlike_header)(PARROT_INTERP, size_t size);
- void (*free_bufferlike_header)(PARROT_INTERP, Buffer*, size_t size);
+ void (*free_bufferlike_header)(PARROT_INTERP, Buffer*, size_t size);
+
+ int (*is_pmc_ptr)(PARROT_INTERP, void*);
+ int (*is_string_ptr)(PARROT_INTERP, void*);
+ void (*mark_pobj_header)(PARROT_INTERP, PObj*);
+ void (*mark_pmc_header)(PARROT_INTERP, PMC *);
void* (*allocate_pmc_attributes)(PARROT_INTERP, PMC *);
void (*free_pmc_attributes)(PARROT_INTERP, PMC *);
@@ -154,50 +194,19 @@
/* Iterate over _live_ strings. Used for string pool compacting */
void (*iterate_live_strings)(PARROT_INTERP, string_iterator_callback callback, void *data);
+ /* Statistic for GC */
+ struct GC_Statistics stats;
+
/*Function hooks that GC systems can CHOOSE to provide if they need them
*These will be called via the GC API functions Parrot_gc_func_name
*e.g. read barrier && write barrier hooks can go here later ...*/
- /* Holds system-specific data structures
- * unused right now, but this is where it should go if we need them ...
- union {
- } gc_private;
- */
+ /* Holds system-specific data structures */
+ void * gc_private;
} GC_Subsystem;
-/* This header structure describes a block of memory that is part of a
- variable-size pool. The allocatable memory follows the header. */
-
-typedef struct Memory_Block {
- size_t free; /* Remaining free space. */
- size_t size; /* Size of memory. */
- struct Memory_Block *prev; /* Pointer to previous block. */
- struct Memory_Block *next; /* Pointer to next block. */
- char *start; /* Pointer to start of memory. */
- char *top; /* Pointer to free space in memory. */
- size_t freed; /* Amount of freed memory.
- Used in compact_pool */
-} Memory_Block;
-
-/* This structure describes a variable-size memory pool. Various such pools
- hang off the Memory_Pools root structure. */
-
-typedef struct Variable_Size_Pool {
- Memory_Block *top_block; /* Pointer to most recent memory block. */
- /* Pool compactor, or NULL. */
- void (*compact)(PARROT_INTERP, struct Memory_Pools *,
- struct Variable_Size_Pool *);
- size_t minimum_block_size; /* Minimum allocation size, to
- prevent fragmentation. */
- size_t total_allocated; /* Total bytes allocated to this pool. */
- size_t guaranteed_reclaimable; /* Bytes that can definitely be reclaimed. */
- size_t possibly_reclaimable; /* Bytes that can possibly be reclaimed
- (above plus COW-freed bytes). */
- FLOATVAL reclaim_factor; /* Minimum percentage we will reclaim. */
-} Variable_Size_Pool;
-
/* This header structure describes an arena: a block of memory that is part of a
fixed-sized pool. The arena has enough memory for 'total_objects' objects
of a particular size specified in the pool. */
@@ -296,64 +305,18 @@
compacted */
} String_GC;
-/* This structure acts as the root for all the various memory pools:
- variable-sized, fixed-size, and PMC attributes. It also contains
- various GC-related items. It hangs off the Interp structure. */
-
typedef struct Memory_Pools {
- /* Pointers to pools */
- String_GC string_gc; /* TEMPORARY */
- /* String GC susbsytem pointer */
-
- Fixed_Size_Pool *string_header_pool; /* String header pool. */
- Fixed_Size_Pool *pmc_pool; /* PMC object pool. */
- Fixed_Size_Pool *constant_pmc_pool; /* And one for constant PMCs. */
- Fixed_Size_Pool *constant_string_header_pool; /* And a constant string
- header pool. */
-
- Fixed_Size_Pool **sized_header_pools; /* Vector of pools for other
- fixed-size headers. */
- size_t num_sized; /* Length of that vector. */
-
- PMC_Attribute_Pool **attrib_pools; /* Vector of pools for PMC
- attributes. */
- size_t num_attribs; /* Length of that vector. */
+ String_GC string_gc;
- /* statistics for GC */
- size_t gc_mark_runs; /* Number of times we've done a mark run */
- size_t gc_lazy_mark_runs; /* Number of successful lazy mark runs */
- size_t gc_collect_runs; /* Number of times we've done a memory
- compaction */
- size_t mem_allocs_since_last_collect; /* The number of memory
- * allocations from the
- * system since the last
- * compaction run */
- size_t header_allocs_since_last_collect; /* The size of header
- * blocks allocated from
- * the system since the last
- * GC run */
- size_t memory_allocated; /* The total amount of memory allocated
- * in fixed and variable size pools.
- * Doesn't count memory for internal
- * structures */
- size_t memory_used; /* The total amount of memory used
- * in fixed and variable size
- * pools. Also includes memory in
- * variable size pools that has been
- * freed but can only be reclaimed
- * by a GC run */
- size_t mem_used_last_collect; /* The total amount of
- * memory used after
- * the last GC run */
- UINTVAL memory_collected; /* Total amount of memory copied
- during collection */
- UINTVAL num_early_gc_PMCs; /* how many PMCs want immediate destruction */
- UINTVAL num_early_PMCs_seen; /* how many such PMCs has GC seen */
- PMC *gc_mark_start; /* first PMC marked during a GC run */
- PMC *gc_mark_ptr; /* last PMC marked during a GC run */
- PMC *gc_trace_ptr; /* last PMC trace_children was called on */
- int lazy_gc; /* flag that indicates whether we should stop
- when we've seen all impatient PMCs */
+ Fixed_Size_Pool *string_header_pool;
+ Fixed_Size_Pool *pmc_pool;
+ Fixed_Size_Pool *constant_pmc_pool;
+ Fixed_Size_Pool *constant_string_header_pool;
+ Fixed_Size_Pool **sized_header_pools;
+ size_t num_sized;
+
+ PMC_Attribute_Pool **attrib_pools;
+ size_t num_attribs;
/* GC blocking */
UINTVAL gc_mark_block_level; /* How many outstanding GC block
@@ -361,19 +324,28 @@
UINTVAL gc_sweep_block_level; /* How many outstanding GC block
requests are there? */
+ PMC *gc_mark_start; /* first PMC marked during a GC run */
+ PMC *gc_mark_ptr; /* last PMC marked during a GC run */
+ PMC *gc_trace_ptr; /* last PMC trace_children was called on */
+ int lazy_gc; /* flag that indicates whether we should stop
+ when we've seen all impatient PMCs */
+ UINTVAL num_early_gc_PMCs; /* how many PMCs want immediate destruction */
+ UINTVAL num_early_PMCs_seen; /* how many such PMCs has GC seen */
+
+ /* private data for the GC subsystem */
+ void *gc_private; /* GC subsystem data */
} Memory_Pools;
/* HEADERIZER BEGIN: src/gc/system.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-void trace_system_areas(PARROT_INTERP, ARGIN(const Memory_Pools *mem_pools))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
+void trace_system_areas(PARROT_INTERP,
+ ARGIN_NULLOK(const Memory_Pools *mem_pools))
+ __attribute__nonnull__(1);
#define ASSERT_ARGS_trace_system_areas __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(mem_pools))
+ PARROT_ASSERT_ARG(interp))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/gc/system.c */
@@ -430,11 +402,12 @@
FUNC_MODIFIES(*pool)
FUNC_MODIFIES(*arena);
-void Parrot_append_arena_in_pool(SHIM_INTERP,
+void Parrot_append_arena_in_pool(PARROT_INTERP,
ARGMOD(Memory_Pools *mem_pools),
ARGMOD(Fixed_Size_Pool *pool),
ARGMOD(Fixed_Size_Arena *new_arena),
size_t size)
+ __attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
__attribute__nonnull__(4)
@@ -460,10 +433,9 @@
FUNC_MODIFIES(*pool);
int Parrot_gc_trace_root(PARROT_INTERP,
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD_NULLOK(Memory_Pools *mem_pools),
Parrot_gc_trace_type trace)
__attribute__nonnull__(1)
- __attribute__nonnull__(2)
FUNC_MODIFIES(*mem_pools);
#define ASSERT_ARGS_contained_in_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -487,7 +459,8 @@
PARROT_ASSERT_ARG(pool) \
, PARROT_ASSERT_ARG(arena))
#define ASSERT_ARGS_Parrot_append_arena_in_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools) \
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(mem_pools) \
, PARROT_ASSERT_ARG(pool) \
, PARROT_ASSERT_ARG(new_arena))
#define ASSERT_ARGS_Parrot_gc_clear_live_bits __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -499,8 +472,7 @@
, PARROT_ASSERT_ARG(mem_pools) \
, PARROT_ASSERT_ARG(pool))
#define ASSERT_ARGS_Parrot_gc_trace_root __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(mem_pools))
+ PARROT_ASSERT_ARG(interp))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/gc/mark_sweep.c */
@@ -592,6 +564,10 @@
__attribute__nonnull__(2)
FUNC_MODIFIES(*pmc);
+void gc_ms_mark_pmc_header(PARROT_INTERP, ARGMOD_NULLOK(PMC *obj))
+ __attribute__nonnull__(1)
+ FUNC_MODIFIES(*obj);
+
void gc_ms_pmc_needs_early_collection(PARROT_INTERP, ARGMOD(PMC *pmc))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
@@ -609,6 +585,12 @@
__attribute__nonnull__(1)
__attribute__nonnull__(2);
+size_t Parrot_gc_get_info(PARROT_INTERP,
+ Interpinfo_enum which,
+ ARGIN(GC_Statistics *stats))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(3);
+
void Parrot_gc_ms_init(PARROT_INTERP)
__attribute__nonnull__(1);
@@ -632,6 +614,8 @@
#define ASSERT_ARGS_gc_ms_free_pmc_attributes __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(pmc))
+#define ASSERT_ARGS_gc_ms_mark_pmc_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_gc_ms_pmc_needs_early_collection \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
@@ -644,6 +628,9 @@
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(str))
+#define ASSERT_ARGS_Parrot_gc_get_info __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(stats))
#define ASSERT_ARGS_Parrot_gc_ms_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_Parrot_gc_ms_needed __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -662,6 +649,16 @@
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/gc/gc_inf.c */
+/* HEADERIZER BEGIN: src/gc/gc_ms2.c */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+void Parrot_gc_ms2_init(PARROT_INTERP)
+ __attribute__nonnull__(1);
+
+#define ASSERT_ARGS_Parrot_gc_ms2_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp))
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: src/gc/gc_ms2.c */
/* HEADERIZER BEGIN: src/gc/string_gc.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
Modified: branches/string_macros/src/gc/mark_sweep.c
==============================================================================
--- branches/string_macros/src/gc/mark_sweep.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/gc/mark_sweep.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -155,7 +155,7 @@
int
Parrot_gc_trace_root(PARROT_INTERP,
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD_NULLOK(Memory_Pools *mem_pools),
Parrot_gc_trace_type trace)
{
ASSERT_ARGS(Parrot_gc_trace_root)
@@ -170,7 +170,7 @@
}
/* We have to start somewhere; the interpreter globals is a good place */
- if (!mem_pools->gc_mark_start) {
+ if (mem_pools && !mem_pools->gc_mark_start) {
mem_pools->gc_mark_start
= mem_pools->gc_mark_ptr
= interp->iglobals;
@@ -229,8 +229,9 @@
/* quick check to see if we have already marked all impatient PMCs. If we
have, return 0 and exit here. This will alert other parts of the GC
that if we are in a lazy run we can just stop it. */
- if (mem_pools->lazy_gc
- && mem_pools->num_early_PMCs_seen >= mem_pools->num_early_gc_PMCs)
+ if (mem_pools
+ && mem_pools->lazy_gc
+ && mem_pools->num_early_PMCs_seen >= mem_pools->num_early_gc_PMCs)
return 0;
return 1;
@@ -455,7 +456,7 @@
*/
void
-Parrot_append_arena_in_pool(SHIM_INTERP,
+Parrot_append_arena_in_pool(PARROT_INTERP,
ARGMOD(Memory_Pools *mem_pools),
ARGMOD(Fixed_Size_Pool *pool),
ARGMOD(Fixed_Size_Arena *new_arena), size_t size)
@@ -480,8 +481,8 @@
new_arena->prev->next = new_arena;
pool->last_Arena = new_arena;
- mem_pools->header_allocs_since_last_collect += size;
- mem_pools->memory_allocated += size;
+ interp->gc_sys->stats.header_allocs_since_last_collect += size;
+ interp->gc_sys->stats.memory_allocated += size;
}
/*
Modified: branches/string_macros/src/gc/string_gc.c
==============================================================================
--- branches/string_macros/src/gc/string_gc.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/gc/string_gc.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -21,7 +21,7 @@
#include "parrot/parrot.h"
#include "gc_private.h"
-typedef void (*compact_f) (Interp *, Memory_Pools * const, Variable_Size_Pool *);
+typedef void (*compact_f) (Interp *, GC_Statistics *stats, Variable_Size_Pool *);
#define POOL_SIZE (65536 * 2)
@@ -48,14 +48,14 @@
__attribute__nonnull__(2);
static void alloc_new_block(
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
size_t size,
ARGMOD(Variable_Size_Pool *pool),
ARGIN(const char *why))
__attribute__nonnull__(1)
__attribute__nonnull__(3)
__attribute__nonnull__(4)
- FUNC_MODIFIES(*mem_pools)
+ FUNC_MODIFIES(*stats)
FUNC_MODIFIES(*pool);
PARROT_CANNOT_RETURN_NULL
@@ -65,12 +65,12 @@
__attribute__nonnull__(2);
static void compact_pool(PARROT_INTERP,
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
ARGMOD(Variable_Size_Pool *pool))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- FUNC_MODIFIES(*mem_pools)
+ FUNC_MODIFIES(*stats)
FUNC_MODIFIES(*pool);
static void debug_print_buf(PARROT_INTERP, ARGIN(const Buffer *b))
@@ -79,14 +79,14 @@
static void free_memory_pool(ARGFREE(Variable_Size_Pool *pool));
static void free_old_mem_blocks(
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
ARGMOD(Variable_Size_Pool *pool),
ARGMOD(Memory_Block *new_block),
UINTVAL total_size)
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3)
- FUNC_MODIFIES(*mem_pools)
+ FUNC_MODIFIES(*stats)
FUNC_MODIFIES(*pool)
FUNC_MODIFIES(*new_block);
@@ -96,13 +96,13 @@
PARROT_MALLOC
PARROT_CANNOT_RETURN_NULL
static void * mem_allocate(PARROT_INTERP,
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
size_t size,
ARGMOD(Variable_Size_Pool *pool))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(4)
- FUNC_MODIFIES(*mem_pools)
+ FUNC_MODIFIES(*stats)
FUNC_MODIFIES(*pool);
static void move_buffer_callback(PARROT_INTERP,
@@ -139,7 +139,7 @@
#define ASSERT_ARGS_aligned_mem __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(mem))
#define ASSERT_ARGS_alloc_new_block __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools) \
+ PARROT_ASSERT_ARG(stats) \
, PARROT_ASSERT_ARG(pool) \
, PARROT_ASSERT_ARG(why))
#define ASSERT_ARGS_buffer_location __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -147,21 +147,21 @@
, PARROT_ASSERT_ARG(b))
#define ASSERT_ARGS_compact_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(mem_pools) \
+ , PARROT_ASSERT_ARG(stats) \
, PARROT_ASSERT_ARG(pool))
#define ASSERT_ARGS_debug_print_buf __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(b))
#define ASSERT_ARGS_free_memory_pool __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_free_old_mem_blocks __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools) \
+ PARROT_ASSERT_ARG(stats) \
, PARROT_ASSERT_ARG(pool) \
, PARROT_ASSERT_ARG(new_block))
#define ASSERT_ARGS_is_block_almost_full __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(block))
#define ASSERT_ARGS_mem_allocate __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(mem_pools) \
+ , PARROT_ASSERT_ARG(stats) \
, PARROT_ASSERT_ARG(pool))
#define ASSERT_ARGS_move_buffer_callback __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
@@ -197,11 +197,11 @@
ASSERT_ARGS(Parrot_gc_str_initialize)
gc->memory_pool = new_memory_pool(POOL_SIZE, &compact_pool);
- alloc_new_block(interp->mem_pools, POOL_SIZE, gc->memory_pool, "init");
+ alloc_new_block(&interp->gc_sys->stats, POOL_SIZE, gc->memory_pool, "init");
/* Constant strings - not compacted */
gc->constant_string_pool = new_memory_pool(POOL_SIZE, NULL);
- alloc_new_block(interp->mem_pools, POOL_SIZE, gc->constant_string_pool, "init");
+ alloc_new_block(&interp->gc_sys->stats, POOL_SIZE, gc->constant_string_pool, "init");
}
/*
@@ -249,7 +249,7 @@
Buffer_bufstart(buffer) = (void *)aligned_mem(buffer,
(char *)mem_allocate(interp,
- interp->mem_pools, new_size, gc->memory_pool));
+ &interp->gc_sys->stats, new_size, gc->memory_pool));
/* Save pool used to allocate into buffer header */
*Buffer_poolptr(buffer) = gc->memory_pool->top_block;
@@ -304,14 +304,14 @@
&& (pool->top_block->top == (char *)Buffer_bufstart(buffer) + old_size)) {
pool->top_block->free -= needed;
pool->top_block->top += needed;
- interp->mem_pools->memory_used += needed;
+ interp->gc_sys->stats.memory_used += needed;
Buffer_buflen(buffer) = newsize;
return;
}
copysize = Buffer_buflen(buffer);
- mem = (char *)mem_allocate(interp, interp->mem_pools, new_size, pool);
+ mem = (char *)mem_allocate(interp, &interp->gc_sys->stats, new_size, pool);
mem = aligned_mem(buffer, mem);
/* We shouldn't ever have a 0 from size, but we do. If we can track down
@@ -365,7 +365,7 @@
: gc->memory_pool;
new_size = ALIGNED_STRING_SIZE(size);
- mem = (char *)mem_allocate(interp, interp->mem_pools, new_size, pool);
+ mem = (char *)mem_allocate(interp, &interp->gc_sys->stats, new_size, pool);
mem += sizeof (void *);
Buffer_bufstart(str) = str->strstart = mem;
@@ -421,7 +421,7 @@
&& pool->top_block->top == (char *)Buffer_bufstart(str) + old_size) {
pool->top_block->free -= needed;
pool->top_block->top += needed;
- interp->mem_pools->memory_used += needed;
+ interp->gc_sys->stats.memory_used += needed;
Buffer_buflen(str) = new_size - sizeof (void *);
return;
}
@@ -431,7 +431,7 @@
/* only copy used memory, not total string buffer */
copysize = str->bufused;
- mem = (char *)mem_allocate(interp, interp->mem_pools, new_size, pool);
+ mem = (char *)mem_allocate(interp, &interp->gc_sys->stats, new_size, pool);
mem += sizeof (void *);
/* Update Memory_Block usage */
@@ -471,7 +471,7 @@
Parrot_gc_str_compact_pool(PARROT_INTERP, ARGIN(String_GC *gc))
{
ASSERT_ARGS(Parrot_gc_str_compact_pool)
- compact_pool(interp, interp->mem_pools, gc->memory_pool);
+ compact_pool(interp, &interp->gc_sys->stats, gc->memory_pool);
}
/*
@@ -552,7 +552,7 @@
/*
-=item C<static void alloc_new_block( Memory_Pools *mem_pools, size_t size,
+=item C<static void alloc_new_block( GC_Statistics *stats, size_t size,
Variable_Size_Pool *pool, const char *why)>
Allocate a new memory block. We allocate either the requested size or the
@@ -565,7 +565,7 @@
static void
alloc_new_block(
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
size_t size,
ARGMOD(Variable_Size_Pool *pool),
ARGIN(const char *why))
@@ -600,7 +600,7 @@
new_block->top = new_block->start;
/* Note that we've allocated it */
- mem_pools->memory_allocated += alloc_size;
+ stats->memory_allocated += alloc_size;
/* If this is for a public pool, add it to the list */
new_block->prev = pool->top_block;
@@ -615,8 +615,8 @@
/*
-=item C<static void * mem_allocate(PARROT_INTERP, Memory_Pools *mem_pools,
-size_t size, Variable_Size_Pool *pool)>
+=item C<static void * mem_allocate(PARROT_INTERP, GC_Statistics *stats, size_t
+size, Variable_Size_Pool *pool)>
Allocates memory for headers.
@@ -643,7 +643,7 @@
PARROT_CANNOT_RETURN_NULL
static void *
mem_allocate(PARROT_INTERP,
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
size_t size,
ARGMOD(Variable_Size_Pool *pool))
{
@@ -662,9 +662,9 @@
* TODO pass required allocation size to the GC system,
* so that collection can be skipped if needed
*/
- if (!mem_pools->gc_mark_block_level
+ if (!Parrot_is_blocked_GC_mark(interp)
&& Parrot_gc_ms_needed(interp)) {
- Parrot_gc_mark_and_sweep(interp, GC_trace_stack_FLAG);
+ Parrot_gc_mark_and_sweep(interp, GC_trace_stack_FLAG | GC_strings_cb_FLAG);
if (interp->gc_sys->sys_type != INF) {
/* Compact the pool if allowed and worthwhile */
@@ -672,7 +672,7 @@
/* don't bother reclaiming if it's only a small amount */
if ((pool->possibly_reclaimable * pool->reclaim_factor +
pool->guaranteed_reclaimable) > size) {
- (*pool->compact) (interp, mem_pools, pool);
+ (*pool->compact) (interp, stats, pool);
}
}
}
@@ -686,9 +686,9 @@
* Mark the block as big block (it has just one item)
* And don't set big blocks as the top_block.
*/
- alloc_new_block(mem_pools, size, pool, "compact failed");
+ alloc_new_block(&interp->gc_sys->stats, size, pool, "compact failed");
- ++mem_pools->mem_allocs_since_last_collect;
+ ++interp->gc_sys->stats.mem_allocs_since_last_collect;
if (pool->top_block->free < size) {
fprintf(stderr, "out of mem\n");
@@ -701,7 +701,7 @@
return_val = pool->top_block->top;
pool->top_block->top += size;
pool->top_block->free -= size;
- mem_pools->memory_used += size;
+ interp->gc_sys->stats.memory_used += size;
return return_val;
}
@@ -792,7 +792,7 @@
=over 4
-=item C<static void compact_pool(PARROT_INTERP, Memory_Pools *mem_pools,
+=item C<static void compact_pool(PARROT_INTERP, GC_Statistics *stats,
Variable_Size_Pool *pool)>
Compact the string buffer pool. Does not perform a GC scan, or mark items
@@ -804,7 +804,7 @@
static void
compact_pool(PARROT_INTERP,
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
ARGMOD(Variable_Size_Pool *pool))
{
ASSERT_ARGS(compact_pool)
@@ -818,26 +818,26 @@
/* Bail if we're blocked */
- if (mem_pools->gc_sweep_block_level)
+ if (Parrot_is_blocked_GC_sweep(interp))
return;
- ++mem_pools->gc_sweep_block_level;
+ Parrot_block_GC_sweep(interp);
/* We're collecting */
- mem_pools->mem_allocs_since_last_collect = 0;
- mem_pools->header_allocs_since_last_collect = 0;
- ++mem_pools->gc_collect_runs;
+ stats->mem_allocs_since_last_collect = 0;
+ stats->header_allocs_since_last_collect = 0;
+ ++stats->gc_collect_runs;
/* Snag a block big enough for everything */
total_size = pad_pool_size(pool);
if (total_size == 0) {
- free_old_mem_blocks(mem_pools, pool, pool->top_block, total_size);
- --mem_pools->gc_sweep_block_level;
+ free_old_mem_blocks(stats, pool, pool->top_block, total_size);
+ Parrot_unblock_GC_sweep(interp);
return;
}
- alloc_new_block(mem_pools, total_size, pool, "inside compact");
+ alloc_new_block(stats, total_size, pool, "inside compact");
cb_data.new_block = pool->top_block;
@@ -858,12 +858,12 @@
/* How much is free. That's the total size minus the amount we used */
cb_data.new_block->free = cb_data.new_block->size
- (cb_data.cur_spot - cb_data.new_block->start);
- mem_pools->memory_collected += (cb_data.cur_spot - cb_data.new_block->start);
- mem_pools->memory_used += (cb_data.cur_spot - cb_data.new_block->start);
+ stats->memory_collected += (cb_data.cur_spot - cb_data.new_block->start);
+ stats->memory_used += (cb_data.cur_spot - cb_data.new_block->start);
- free_old_mem_blocks(mem_pools, pool, cb_data.new_block, total_size);
+ free_old_mem_blocks(stats, pool, cb_data.new_block, total_size);
- --mem_pools->gc_sweep_block_level;
+ Parrot_unblock_GC_sweep(interp);
}
/*
@@ -1061,7 +1061,7 @@
/*
-=item C<static void free_old_mem_blocks( Memory_Pools *mem_pools,
+=item C<static void free_old_mem_blocks( GC_Statistics *stats,
Variable_Size_Pool *pool, Memory_Block *new_block, UINTVAL total_size)>
The compact_pool operation collects disjointed blocks of memory allocated on a
@@ -1078,7 +1078,7 @@
static void
free_old_mem_blocks(
- ARGMOD(Memory_Pools *mem_pools),
+ ARGMOD(GC_Statistics *stats),
ARGMOD(Variable_Size_Pool *pool),
ARGMOD(Memory_Block *new_block),
UINTVAL total_size)
@@ -1099,8 +1099,8 @@
}
else {
/* Note that we don't have it any more */
- mem_pools->memory_allocated -= cur_block->size;
- mem_pools->memory_used -= cur_block->size - cur_block->free;
+ stats->memory_allocated -= cur_block->size;
+ stats->memory_used -= cur_block->size - cur_block->free;
/* We know the pool body and pool header are a single chunk, so
* this is enough to get rid of 'em both */
Modified: branches/string_macros/src/gc/system.c
==============================================================================
--- branches/string_macros/src/gc/system.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/gc/system.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -39,26 +39,25 @@
__attribute__nonnull__(1);
PARROT_WARN_UNUSED_RESULT
-static size_t get_max_buffer_address(ARGIN(const Memory_Pools *mem_pools))
- __attribute__nonnull__(1);
+static size_t get_max_buffer_address(
+ ARGIN_NULLOK(const Memory_Pools *mem_pools));
PARROT_WARN_UNUSED_RESULT
-static size_t get_max_pmc_address(ARGIN(const Memory_Pools *mem_pools))
- __attribute__nonnull__(1);
+static size_t get_max_pmc_address(
+ ARGIN_NULLOK(const Memory_Pools *mem_pools));
PARROT_WARN_UNUSED_RESULT
-static size_t get_min_buffer_address(ARGIN(const Memory_Pools *mem_pools))
- __attribute__nonnull__(1);
+static size_t get_min_buffer_address(
+ ARGIN_NULLOK(const Memory_Pools *mem_pools));
PARROT_WARN_UNUSED_RESULT
-static size_t get_min_pmc_address(ARGIN(const Memory_Pools *mem_pools))
- __attribute__nonnull__(1);
+static size_t get_min_pmc_address(
+ ARGIN_NULLOK(const Memory_Pools *mem_pools));
PARROT_WARN_UNUSED_RESULT
static int is_buffer_ptr(
- ARGIN(const Memory_Pools *mem_pools),
+ ARGIN_NULLOK(const Memory_Pools *mem_pools),
ARGIN(const void *ptr))
- __attribute__nonnull__(1)
__attribute__nonnull__(2);
PARROT_WARN_UNUSED_RESULT
@@ -69,40 +68,31 @@
__attribute__nonnull__(2);
static void trace_mem_block(PARROT_INTERP,
- ARGIN(const Memory_Pools *mem_pools),
+ ARGIN_NULLOK(const Memory_Pools *mem_pools),
size_t lo_var_ptr,
size_t hi_var_ptr)
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
+ __attribute__nonnull__(1);
PARROT_NOINLINE
static void trace_system_stack(PARROT_INTERP,
- ARGIN(const Memory_Pools *mem_pools))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
+ ARGIN_NULLOK(const Memory_Pools *mem_pools))
+ __attribute__nonnull__(1);
#define ASSERT_ARGS_find_common_mask __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_get_max_buffer_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools))
-#define ASSERT_ARGS_get_max_pmc_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools))
-#define ASSERT_ARGS_get_min_buffer_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools))
-#define ASSERT_ARGS_get_min_pmc_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools))
+#define ASSERT_ARGS_get_max_buffer_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_get_max_pmc_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_get_min_buffer_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
+#define ASSERT_ARGS_get_min_pmc_address __attribute__unused__ int _ASSERT_ARGS_CHECK = (0)
#define ASSERT_ARGS_is_buffer_ptr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(mem_pools) \
- , PARROT_ASSERT_ARG(ptr))
+ PARROT_ASSERT_ARG(ptr))
#define ASSERT_ARGS_is_pmc_ptr __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(mem_pools) \
, PARROT_ASSERT_ARG(ptr))
#define ASSERT_ARGS_trace_mem_block __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(mem_pools))
+ PARROT_ASSERT_ARG(interp))
#define ASSERT_ARGS_trace_system_stack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(mem_pools))
+ PARROT_ASSERT_ARG(interp))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: static */
@@ -121,7 +111,7 @@
*/
void
-trace_system_areas(PARROT_INTERP, ARGIN(const Memory_Pools *mem_pools))
+trace_system_areas(PARROT_INTERP, ARGIN_NULLOK(const Memory_Pools *mem_pools))
{
ASSERT_ARGS(trace_system_areas)
{
@@ -244,7 +234,7 @@
PARROT_NOINLINE
static void
-trace_system_stack(PARROT_INTERP, ARGIN(const Memory_Pools *mem_pools))
+trace_system_stack(PARROT_INTERP, ARGIN_NULLOK(const Memory_Pools *mem_pools))
{
ASSERT_ARGS(trace_system_stack)
/* Create a local variable on the system stack. This represents the
@@ -274,12 +264,15 @@
PARROT_WARN_UNUSED_RESULT
static size_t
-get_max_buffer_address(ARGIN(const Memory_Pools *mem_pools))
+get_max_buffer_address(ARGIN_NULLOK(const Memory_Pools *mem_pools))
{
ASSERT_ARGS(get_max_buffer_address)
size_t max = 0;
UINTVAL i;
+ if (!mem_pools)
+ return -1;
+
for (i = 0; i < mem_pools->num_sized; ++i) {
if (mem_pools->sized_header_pools[i]) {
if (mem_pools->sized_header_pools[i]->end_arena_memory > max)
@@ -308,12 +301,15 @@
PARROT_WARN_UNUSED_RESULT
static size_t
-get_min_buffer_address(ARGIN(const Memory_Pools *mem_pools))
+get_min_buffer_address(ARGIN_NULLOK(const Memory_Pools *mem_pools))
{
ASSERT_ARGS(get_min_buffer_address)
- size_t min = (size_t) -1;
+ size_t min = (size_t) 0;
UINTVAL i;
+ if (!mem_pools)
+ return 0;
+
for (i = 0; i < mem_pools->num_sized; ++i) {
const Fixed_Size_Pool * const pool = mem_pools->sized_header_pools[i];
if (pool && pool->start_arena_memory) {
@@ -338,10 +334,12 @@
PARROT_WARN_UNUSED_RESULT
static size_t
-get_max_pmc_address(ARGIN(const Memory_Pools *mem_pools))
+get_max_pmc_address(ARGIN_NULLOK(const Memory_Pools *mem_pools))
{
ASSERT_ARGS(get_max_pmc_address)
- return mem_pools->pmc_pool->end_arena_memory;
+ return mem_pools
+ ? mem_pools->pmc_pool->end_arena_memory
+ : -1;
}
@@ -359,10 +357,12 @@
PARROT_WARN_UNUSED_RESULT
static size_t
-get_min_pmc_address(ARGIN(const Memory_Pools *mem_pools))
+get_min_pmc_address(ARGIN_NULLOK(const Memory_Pools *mem_pools))
{
ASSERT_ARGS(get_min_pmc_address)
- return mem_pools->pmc_pool->start_arena_memory;
+ return mem_pools
+ ? mem_pools->pmc_pool->start_arena_memory
+ : 0;
}
@@ -423,7 +423,7 @@
static void
trace_mem_block(PARROT_INTERP,
- ARGIN(const Memory_Pools *mem_pools),
+ ARGIN_NULLOK(const Memory_Pools *mem_pools),
size_t lo_var_ptr, size_t hi_var_ptr)
{
ASSERT_ARGS(trace_mem_block)
@@ -450,13 +450,18 @@
}
/* Get the expected prefix */
- prefix = mask & buffer_min;
+ prefix = mem_pools
+ ? mask & buffer_min
+ : 0;
for (cur_var_ptr = hi_var_ptr;
(ptrdiff_t)cur_var_ptr < (ptrdiff_t)lo_var_ptr;
cur_var_ptr = (size_t)((ptrdiff_t)cur_var_ptr + sizeof (void *))) {
const size_t ptr = *(size_t *)cur_var_ptr;
+ if (!ptr)
+ continue;
+
/* Do a quick approximate range check by bit-masking */
if ((ptr & mask) == prefix || !prefix) {
/* Note that what we find via the stack or registers are not
@@ -464,12 +469,12 @@
* had their bufstart/vtable destroyed due to the linked list of
* free headers... */
if ((pmc_min <= ptr)
- && (ptr < pmc_max)
- && is_pmc_ptr(mem_pools, (void *)ptr)) {
+ && (ptr < pmc_max)
+ && interp->gc_sys->is_pmc_ptr(interp, (void *)ptr)) {
Parrot_gc_mark_PMC_alive(interp, (PMC *)ptr);
}
else if ((buffer_min <= ptr) && (ptr < buffer_max)
- && is_buffer_ptr(mem_pools, (void *)ptr)) {
+ && interp->gc_sys->is_string_ptr(interp, (void *)ptr)) {
if (PObj_is_string_TEST((PObj *)ptr))
Parrot_gc_mark_STRING_alive(interp, (STRING *)ptr);
else
@@ -495,11 +500,14 @@
PARROT_WARN_UNUSED_RESULT
static int
-is_buffer_ptr(ARGIN(const Memory_Pools *mem_pools), ARGIN(const void *ptr))
+is_buffer_ptr(ARGIN_NULLOK(const Memory_Pools *mem_pools), ARGIN(const void *ptr))
{
ASSERT_ARGS(is_buffer_ptr)
UINTVAL i;
+ if (!mem_pools)
+ return 0;
+
for (i = 0; i < mem_pools->num_sized; ++i) {
if (mem_pools->sized_header_pools[i]
&& contained_in_pool(mem_pools->sized_header_pools[i], ptr))
Added: branches/string_macros/src/gc/variable_size_pool.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/string_macros/src/gc/variable_size_pool.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -0,0 +1,36 @@
+/*
+Copyright (C) 2010, Parrot Foundation.
+$Id$
+
+=head1 NAME
+
+src/gc/variable_size_pool.h - implementation of allocator variable size objects.
+E.g. strings.
+
+=head1 DESCRIPTION
+
+TODO Add it.
+
+=cut
+
+*/
+
+#include "parrot/parrot.h"
+#include "variable_size_pool.h"
+
+/* HEADERIZER HFILE: src/gc/variable_size_pool.h */
+
+/* HEADERIZER BEGIN: static */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: static */
+
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
+
Added: branches/string_macros/src/gc/variable_size_pool.h
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/string_macros/src/gc/variable_size_pool.h Tue Sep 28 19:35:30 2010 (r49367)
@@ -0,0 +1,58 @@
+/*
+Copyright (C) 2001-2010, Parrot Foundation.
+$Id$
+
+=head1 NAME
+
+src/gc/variable_size_pool.h - implementation of allocator variable size objects.
+E.g. strings.
+
+=head1 DESCRIPTION
+
+*/
+
+#ifndef PARROT_GC_VARIABLE_SIZE_POOL_H_GUARD
+#define PARROT_GC_VARIABLE_SIZE_POOL_H_GUARD
+
+#include "parrot/settings.h"
+
+struct GC_Statistics;
+
+typedef struct Memory_Block {
+ size_t free;
+ size_t size;
+ struct Memory_Block *prev;
+ struct Memory_Block *next;
+ char *start;
+ char *top;
+
+ /* Amount of freed memory. Used in compact_pool */
+ size_t freed;
+} Memory_Block;
+
+typedef struct Variable_Size_Pool {
+ Memory_Block *top_block;
+ void (*compact)(PARROT_INTERP, struct GC_Statistics *, struct Variable_Size_Pool *);
+ size_t minimum_block_size;
+ size_t total_allocated; /* total bytes allocated to this pool */
+ size_t guaranteed_reclaimable; /* bytes that can definitely be reclaimed*/
+ size_t possibly_reclaimable; /* bytes that can possibly be reclaimed
+ * (above plus COW-freed bytes) */
+ FLOATVAL reclaim_factor; /* minimum percentage we will reclaim */
+} Variable_Size_Pool;
+
+/* HEADERIZER BEGIN: src/gc/variable_size_pool.c */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: src/gc/variable_size_pool.c */
+
+
+#endif /* PARROT_GC_VARIABLE_SIZE_POOL_H_GUARD */
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: branches/string_macros/src/interp/inter_create.c
==============================================================================
--- branches/string_macros/src/interp/inter_create.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/interp/inter_create.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -218,6 +218,10 @@
interp->HLL_info = NULL;
Parrot_initialize_core_vtables(interp);
+
+ /* create the root set registry */
+ interp->gc_registry = Parrot_pmc_new(interp, enum_class_AddrRegistry);
+
init_world_once(interp);
/* context data */
@@ -258,9 +262,6 @@
interp->evc_func_table_size = 0;
interp->code = NULL;
- /* create the root set registry */
- interp->gc_registry = Parrot_pmc_new(interp, enum_class_AddrRegistry);
-
/* And a dynamic environment stack */
/* TODO: We should really consider removing this (TT #876) */
interp->dynamic_env = Parrot_pmc_new(interp, enum_class_ResizablePMCArray);
Modified: branches/string_macros/src/io/buffer.c
==============================================================================
--- branches/string_macros/src/io/buffer.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/io/buffer.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -272,7 +272,7 @@
ARGMOD(STRING **buf))
{
ASSERT_ARGS(Parrot_io_read_buffer)
- unsigned char *out_buf, *buffer_start, *buffer_next, *buffer_end;
+ unsigned char *buffer_start, *buffer_next, *buffer_end;
STRING *s;
size_t len;
size_t current = 0;
@@ -297,14 +297,13 @@
s = *buf;
len = s->bufused;
- out_buf = (unsigned char *)s->strstart;
/* read Data from buffer */
if (buffer_flags & PIO_BF_READBUF) {
const size_t avail = buffer_end - buffer_next;
current = avail < len ? avail : len;
- memcpy(out_buf, buffer_next, current);
+ memcpy(s->strstart, buffer_next, current);
buffer_next += current;
Parrot_io_set_buffer_next(interp, filehandle, buffer_next);
Parrot_io_set_file_position(interp, filehandle, (current +
@@ -327,7 +326,6 @@
}
else {
/* more data needed */
- out_buf += current;
len -= current;
}
}
@@ -337,11 +335,12 @@
size_t got;
if (len >= Parrot_io_get_buffer_size(interp, filehandle)) {
- STRING *sf = Parrot_str_new_init(interp, (char *)out_buf, len,
- Parrot_default_encoding_ptr,
- PObj_external_FLAG);
- got = PIO_READ(interp, filehandle, &sf);
- s->strlen = s->bufused = current + got;
+ STRING *sf;
+
+ s->strlen = s->bufused = current + len;
+ sf = STRING_substr(interp, s, current, len);
+ got = PIO_READ(interp, filehandle, &sf);
+ s->strlen = s->bufused = current + got;
Parrot_io_set_file_position(interp, filehandle,
(got + Parrot_io_get_file_position(interp, filehandle)));
@@ -357,7 +356,7 @@
buffer_next = Parrot_io_get_buffer_next(interp, filehandle);
buffer_end = Parrot_io_get_buffer_end(interp, filehandle);
- memcpy(out_buf, buffer_next, len);
+ memcpy(s->strstart + current, buffer_next, len);
s->strlen = s->bufused = current + len;
buffer_next += len;
Modified: branches/string_macros/src/key.c
==============================================================================
--- branches/string_macros/src/key.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/key.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -590,6 +590,10 @@
ASSERT_ARGS(key_set_to_string)
STRING * const semicolon = CONST_STRING(interp, " ; ");
STRING * const quote = CONST_STRING(interp, "'");
+ STRING * const P = CONST_STRING(interp, "P");
+ STRING * const S = CONST_STRING(interp, "S");
+ STRING * const N = CONST_STRING(interp, "N");
+ STRING * const I = CONST_STRING(interp, "I");
STRING *value = Parrot_str_new(interp, "[ ", 2);
PMC *next_key;
INTVAL int_key;
@@ -619,31 +623,23 @@
break;
case KEY_integer_FLAG | KEY_register_FLAG:
GETATTR_Key_int_key(interp, key, int_key);
- value = Parrot_str_concat(interp, value,
- Parrot_str_from_int(interp,
- REG_INT(interp, int_key)));
+ value = Parrot_str_concat(interp, value, I);
+ value = Parrot_str_concat(interp, value, Parrot_str_from_int(interp, int_key));
break;
case KEY_number_FLAG | KEY_register_FLAG:
GETATTR_Key_int_key(interp, key, int_key);
- value = Parrot_str_concat(interp, value,
- Parrot_str_from_num(interp,
- REG_NUM(interp, int_key)));
+ value = Parrot_str_concat(interp, value, N);
+ value = Parrot_str_concat(interp, value, Parrot_str_from_int(interp, int_key));
break;
case KEY_string_FLAG | KEY_register_FLAG:
- value = Parrot_str_concat(interp, value, quote);
GETATTR_Key_int_key(interp, key, int_key);
- value = Parrot_str_concat(interp, value,
- REG_STR(interp, int_key));
- value = Parrot_str_concat(interp, value, quote);
+ value = Parrot_str_concat(interp, value, S);
+ value = Parrot_str_concat(interp, value, Parrot_str_from_int(interp, int_key));
break;
case KEY_pmc_FLAG | KEY_register_FLAG:
- {
- PMC *reg;
- GETATTR_Key_int_key(interp, key, int_key);
- reg = REG_PMC(interp, int_key);
- value = Parrot_str_concat(interp, value,
- VTABLE_get_string(interp, reg));
- }
+ GETATTR_Key_int_key(interp, key, int_key);
+ value = Parrot_str_concat(interp, value, P);
+ value = Parrot_str_concat(interp, value, Parrot_str_from_int(interp, int_key));
break;
default:
value = Parrot_str_concat(interp, value, CONST_STRING(interp, "Key type unknown"));
Added: branches/string_macros/src/list.c
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/string_macros/src/list.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -0,0 +1,241 @@
+/*
+Copyright (C) 2010, Parrot Foundation.
+$Id$
+
+=head1 NAME
+
+src/list.c - Implementation of double linked lists.
+
+=head1 DESCRIPTION
+
+This code implements double linked list of GCable objects.
+
+=cut
+
+*/
+
+#include "parrot/parrot.h"
+#include "parrot/list.h"
+
+/* HEADERIZER HFILE: include/parrot/list.h */
+
+/* HEADERIZER BEGIN: static */
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+
+/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
+/* HEADERIZER END: static */
+
+/*
+
+=over 4
+
+=item C<struct Linked_List* Parrot_list_new(PARROT_INTERP)>
+
+Allocate a doubly link list
+
+=cut
+
+*/
+
+PARROT_EXPORT
+PARROT_CANNOT_RETURN_NULL
+struct Linked_List*
+Parrot_list_new(SHIM_INTERP)
+{
+ ASSERT_ARGS(Parrot_list_new)
+
+ Linked_List *res = (Linked_List*)mem_sys_allocate_zeroed(sizeof (Linked_List));
+ return res;
+}
+
+/*
+
+=item C<void Parrot_list_destroy(PARROT_INTERP, Linked_List* list)>
+
+Destroy the specified list (free up memory associated with the list)
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_list_destroy(SHIM_INTERP, ARGMOD(Linked_List* list))
+{
+ ASSERT_ARGS(Parrot_list_destroy)
+
+ mem_sys_free(list);
+}
+
+/*
+
+=item C<void Parrot_list_append(PARROT_INTERP, Linked_List *list,
+List_Item_Header *item)>
+
+Append an item to the list
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_list_append(SHIM_INTERP, ARGMOD(Linked_List *list), ARGMOD(List_Item_Header *item))
+{
+ ASSERT_ARGS(Parrot_list_append)
+
+ item->prev = item->next = NULL;
+
+ if (list->last) {
+ item->prev = list->last;
+ list->last->next = item;
+ }
+
+ list->last = item;
+
+ if (!list->first)
+ list->first = item;
+
+ list->count++;
+#ifndef NDEBUG
+ item->owner = list;
+#endif
+}
+
+/*
+
+=item C<List_Item_Header* Parrot_list_remove(PARROT_INTERP, Linked_List *list,
+List_Item_Header *item)>
+
+Remove an item from the list, returning the (pointer to) item
+
+=cut
+
+*/
+
+PARROT_EXPORT
+List_Item_Header*
+Parrot_list_remove(SHIM_INTERP, ARGMOD(Linked_List *list), ARGMOD(List_Item_Header *item))
+{
+ ASSERT_ARGS(Parrot_list_remove)
+
+ List_Item_Header *next = item->next;
+ List_Item_Header *prev = item->prev;
+
+ PARROT_ASSERT(list == item->owner);
+
+ /* First item */
+ if (list->first == item)
+ list->first = next;
+
+ if (list->last == item)
+ list->last = prev;
+
+ if (prev)
+ prev->next = next;
+ if (next)
+ next->prev = prev;
+
+ list->count--;
+ return item;
+}
+
+/*
+
+=item C<List_Item_Header* Parrot_list_pop(PARROT_INTERP, Linked_List *list)>
+
+Pop an item off the list - i.e. get the first item in the list and remove it.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+List_Item_Header*
+Parrot_list_pop(PARROT_INTERP, ARGIN(Linked_List *list))
+{
+ ASSERT_ARGS(Parrot_list_pop)
+
+ List_Item_Header *ret = list->first;
+ if (ret)
+ LIST_REMOVE(list, ret);
+ return ret;
+}
+
+/*
+
+=item C<INTVAL Parrot_list_check(PARROT_INTERP, Linked_List *list)>
+
+Check the validity of the list
+
+=cut
+
+*/
+
+PARROT_EXPORT
+INTVAL
+Parrot_list_check(SHIM_INTERP, ARGIN(Linked_List *list))
+{
+ ASSERT_ARGS(Parrot_list_check)
+
+ List_Item_Header *tmp = list->first;
+ size_t counter = 0;
+
+ while (tmp) {
+ List_Item_Header *next = tmp->next;
+ PARROT_ASSERT(tmp->owner == list);
+ tmp = next;
+ ++counter;
+ PARROT_ASSERT(counter <= list->count);
+ }
+
+ return 1;
+}
+
+/*
+
+=item C<INTVAL Parrot_list_contains(PARROT_INTERP, Linked_List *list,
+List_Item_Header *item)>
+
+Returns True if the is in the list
+
+=cut
+
+*/
+
+PARROT_EXPORT
+INTVAL
+Parrot_list_contains(SHIM_INTERP, ARGIN(Linked_List *list), ARGIN(List_Item_Header *item))
+{
+ ASSERT_ARGS(Parrot_list_contains)
+
+ List_Item_Header *tmp = list->first;
+
+#ifndef NDEBUG
+ if (item->owner != list)
+ return 0;
+#endif
+
+ while (tmp) {
+ if (tmp == item)
+ return 1;
+ tmp = tmp->next;
+ }
+
+ return 0;
+}
+
+/*
+
+=back
+
+=cut
+
+*/
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: branches/string_macros/src/main.c
==============================================================================
--- branches/string_macros/src/main.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/main.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -390,6 +390,8 @@
interp->gc_sys->sys_type = MS;
else if (STREQ(arg, "inf"))
interp->gc_sys->sys_type = INF;
+ else if (STREQ(arg, "ms2"))
+ interp->gc_sys->sys_type = MS2;
else {
fprintf(stderr,
"main: Unrecognized GC '%s' specified."
@@ -398,12 +400,28 @@
}
break;
}
- else if (!strncmp(arg, "--gc-threshold", 14)) {
- if ((arg = strrchr(arg, '=')))
- ++arg;
- else
- arg = argv[++pos];
+ /* arg should start with --gc-threshold *and* contain more chars */
+ else if (strncmp(arg, "--gc-threshold", 14) == 0) {
+
+ /* the next character could be '=' */
+ if (arg[14] == '=') {
+ arg++;
+ }
+
+ /* or the end of the string... */
+ else if (arg[14] == '\0'
+
+ /* and there's another argument */
+ && pos < argc - 1) {
+ arg = argv[++pos];
+ }
+
+ /* ANYTHING ELSE IS WRONG */
+ else {
+ fprintf(stderr, "--gc-threshold needs an argument");
+ exit(EXIT_FAILURE);
+ }
if (is_all_digits(arg)) {
interp->gc_threshold = strtoul(arg, NULL, 10);
Modified: branches/string_macros/src/ops/cmp.ops
==============================================================================
--- branches/string_macros/src/ops/cmp.ops Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/ops/cmp.ops Tue Sep 28 19:35:30 2010 (r49367)
@@ -960,7 +960,7 @@
inline op not(out PMC, invar PMC) :base_core {
const INTVAL a = ! VTABLE_get_bool(interp, $2);
if (PMC_IS_NULL($1))
- $1 = Parrot_pmc_new(interp, VTABLE_type(interp, $2));
+ $1 = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_Boolean));
VTABLE_set_bool(interp, $1, a);
}
Modified: branches/string_macros/src/ops/core_ops.c
==============================================================================
--- branches/string_macros/src/ops/core_ops.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/ops/core_ops.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -16,14 +16,17 @@
/* defines - Ops::Trans::C */
-#undef CONST
#define REL_PC ((size_t)(cur_opcode - (opcode_t *)interp->code->base.data))
#define CUR_OPCODE cur_opcode
#define IREG(i) (CUR_CTX->bp.regs_i[cur_opcode[i]])
#define NREG(i) (CUR_CTX->bp.regs_n[-1L - cur_opcode[i]])
#define PREG(i) (CUR_CTX->bp_ps.regs_p[-1L - cur_opcode[i]])
#define SREG(i) (CUR_CTX->bp_ps.regs_s[cur_opcode[i]])
-#define CONST(i) Parrot_pcc_get_constants(interp, interp->ctx)[cur_opcode[i]]
+#define ICONST(i) cur_opcode[i]
+#define NCONST(i) Parrot_pcc_get_num_constants(interp, interp->ctx)[cur_opcode[i]]
+#define SCONST(i) Parrot_pcc_get_str_constants(interp, interp->ctx)[cur_opcode[i]]
+#undef PCONST
+#define PCONST(i) Parrot_pcc_get_pmc_constants(interp, interp->ctx)[cur_opcode[i]]
static int get_op(PARROT_INTERP, const char * name, int full);
@@ -15297,7 +15300,7 @@
opcode_t *
Parrot_load_bytecode_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- Parrot_load_bytecode(interp, CONST(1).u.string);
+ Parrot_load_bytecode(interp, SCONST(1));
return (opcode_t *)cur_opcode + 2;}
@@ -15311,7 +15314,7 @@
opcode_t *
Parrot_load_language_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- Parrot_load_language(interp, CONST(1).u.string);
+ Parrot_load_language(interp, SCONST(1));
return (opcode_t *)cur_opcode + 2;}
@@ -15322,7 +15325,7 @@
opcode_t *
Parrot_branch_ic(opcode_t *cur_opcode, PARROT_INTERP) {
- const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);return (opcode_t *)cur_opcode + cur_opcode[1];
+ const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);return (opcode_t *)cur_opcode + ICONST(1);
}
opcode_t *
@@ -15354,7 +15357,7 @@
}
return_addr = PTR2INTVAL(dest);
- VTABLE_push_integer(interp, PREG(1), return_addr);return (opcode_t *)cur_opcode + cur_opcode[2];
+ VTABLE_push_integer(interp, PREG(1), return_addr);return (opcode_t *)cur_opcode + ICONST(2);
}
opcode_t *
@@ -15391,7 +15394,7 @@
opcode_t *
Parrot_jump_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- opcode_t * const loc = INTVAL2PTR(opcode_t *, cur_opcode[1]);return (opcode_t *)loc;
+ opcode_t * const loc = INTVAL2PTR(opcode_t *, ICONST(1));return (opcode_t *)loc;
}
opcode_t *
@@ -15404,56 +15407,56 @@
opcode_t *
Parrot_if_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (IREG(1) != 0)return (opcode_t *)cur_opcode + cur_opcode[2];
+ if (IREG(1) != 0)return (opcode_t *)cur_opcode + ICONST(2);
return (opcode_t *)cur_opcode + 3;}
opcode_t *
Parrot_if_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (!FLOAT_IS_ZERO(NREG(1)))return (opcode_t *)cur_opcode + cur_opcode[2];
+ if (!FLOAT_IS_ZERO(NREG(1)))return (opcode_t *)cur_opcode + ICONST(2);
return (opcode_t *)cur_opcode + 3;}
opcode_t *
Parrot_if_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (Parrot_str_boolean(interp, SREG(1)))return (opcode_t *)cur_opcode + cur_opcode[2];
+ if (Parrot_str_boolean(interp, SREG(1)))return (opcode_t *)cur_opcode + ICONST(2);
return (opcode_t *)cur_opcode + 3;}
opcode_t *
Parrot_if_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_get_bool(interp, PREG(1)))return (opcode_t *)cur_opcode + cur_opcode[2];
+ if (VTABLE_get_bool(interp, PREG(1)))return (opcode_t *)cur_opcode + ICONST(2);
return (opcode_t *)cur_opcode + 3;}
opcode_t *
Parrot_unless_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (IREG(1) == 0)return (opcode_t *)cur_opcode + cur_opcode[2];
+ if (IREG(1) == 0)return (opcode_t *)cur_opcode + ICONST(2);
return (opcode_t *)cur_opcode + 3;}
opcode_t *
Parrot_unless_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (FLOAT_IS_ZERO(NREG(1)))return (opcode_t *)cur_opcode + cur_opcode[2];
+ if (FLOAT_IS_ZERO(NREG(1)))return (opcode_t *)cur_opcode + ICONST(2);
return (opcode_t *)cur_opcode + 3;}
opcode_t *
Parrot_unless_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (!Parrot_str_boolean(interp, SREG(1)))return (opcode_t *)cur_opcode + cur_opcode[2];
+ if (!Parrot_str_boolean(interp, SREG(1)))return (opcode_t *)cur_opcode + ICONST(2);
return (opcode_t *)cur_opcode + 3;}
opcode_t *
Parrot_unless_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (!VTABLE_get_bool(interp, PREG(1)))return (opcode_t *)cur_opcode + cur_opcode[2];
+ if (!VTABLE_get_bool(interp, PREG(1)))return (opcode_t *)cur_opcode + ICONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -15542,7 +15545,7 @@
Parrot_set_args_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
opcode_t * const raw_args = CUR_OPCODE;
- PMC * const signature = CONST(1).u.key;
+ PMC * const signature = PCONST(1);
PMC * const call_sig = Parrot_pcc_build_sig_object_from_op(interp,
PMCNULL, signature, raw_args);
const INTVAL argc = VTABLE_elements(interp, signature);
@@ -15553,7 +15556,7 @@
Parrot_get_params_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
opcode_t * const raw_params = CUR_OPCODE;
- PMC * const signature = CONST(1).u.key;
+ PMC * const signature = PCONST(1);
PMC * const ctx = CURRENT_CONTEXT(interp);
PMC * const ccont = Parrot_pcc_get_continuation(interp, ctx);
PMC * const caller_ctx = Parrot_pcc_get_caller_ctx(interp, ctx);
@@ -15576,7 +15579,7 @@
Parrot_set_returns_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
opcode_t * const raw_args = CUR_OPCODE;
- PMC * const signature = CONST(1).u.key;
+ PMC * const signature = PCONST(1);
PMC * const call_sig = Parrot_pcc_build_sig_object_from_op(interp,
Parrot_pcc_get_signature(interp,
Parrot_pcc_get_caller_ctx(interp, CURRENT_CONTEXT(interp))),
@@ -15592,7 +15595,7 @@
Parrot_get_results_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
opcode_t * const raw_params = CUR_OPCODE;
- PMC * const signature = CONST(1).u.key;
+ PMC * const signature = PCONST(1);
PMC *ctx = CURRENT_CONTEXT(interp);
PMC *ccont = Parrot_pcc_get_continuation(interp, ctx);
PMC *call_object = Parrot_pcc_get_signature(interp, ctx);
@@ -15624,7 +15627,7 @@
VTABLE_set_attr_str(interp, ctx,
Parrot_str_new_constant(interp, "return_flags"),
- CONST(1).u.key);
+ PCONST(1));
return (opcode_t *)cur_opcode + 2;}
@@ -15646,14 +15649,14 @@
opcode_t *
Parrot_set_addr_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = PTR2INTVAL(CUR_OPCODE + cur_opcode[2]);
+ IREG(1) = PTR2INTVAL(CUR_OPCODE + ICONST(2));
return (opcode_t *)cur_opcode + 3;}
opcode_t *
Parrot_set_addr_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_pointer(interp, PREG(1), (CUR_OPCODE + cur_opcode[2]));
+ VTABLE_set_pointer(interp, PREG(1), (CUR_OPCODE + ICONST(2)));
return (opcode_t *)cur_opcode + 3;}
@@ -15690,7 +15693,7 @@
Parrot_push_eh_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const eh = Parrot_pmc_new(interp, enum_class_ExceptionHandler);
- VTABLE_set_pointer(interp, eh, CUR_OPCODE + cur_opcode[1]);
+ VTABLE_set_pointer(interp, eh, CUR_OPCODE + ICONST(1));
Parrot_cx_add_handler_local(interp, eh);
return (opcode_t *)cur_opcode + 2;}
@@ -15787,7 +15790,7 @@
opcode_t * const ret = cur_opcode + 2;
PMC * const resume = pmc_new(interp, enum_class_Continuation);
PMC * const exception = Parrot_ex_build_exception(interp, EXCEPT_error,
- CONTROL_ERROR, CONST(1).u.string);
+ CONTROL_ERROR, SCONST(1));
VTABLE_set_pointer(interp, resume, ret);
@@ -15819,7 +15822,7 @@
opcode_t *dest;
opcode_t * const ret = cur_opcode + 2;
PMC * const resume = pmc_new(interp, enum_class_Continuation);
- STRING * const msg = PMC_IS_NULL(CONST(1).u.key) ? NULL : VTABLE_get_string(interp, CONST(1).u.key);
+ STRING * const msg = PMC_IS_NULL(PCONST(1)) ? NULL : VTABLE_get_string(interp, PCONST(1));
PMC * const exception =
Parrot_ex_build_exception(interp, EXCEPT_error, CONTROL_ERROR, msg);
@@ -15845,11 +15848,11 @@
opcode_t *
Parrot_die_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[1] == EXCEPT_doomed)
+ if (ICONST(1) == EXCEPT_doomed)
_exit(IREG(2));
else {
opcode_t * const ret = cur_opcode + 3;
- PMC * const exception = Parrot_ex_build_exception(interp, cur_opcode[1], IREG(2), NULL);
+ PMC * const exception = Parrot_ex_build_exception(interp, ICONST(1), IREG(2), NULL);
opcode_t * const dest = Parrot_ex_throw_from_op(interp, exception, ret);return (opcode_t *)dest;
}
}
@@ -15858,10 +15861,10 @@
Parrot_die_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
if (IREG(1) == EXCEPT_doomed)
- _exit(cur_opcode[2]);
+ _exit(ICONST(2));
else {
opcode_t * const ret = cur_opcode + 3;
- PMC * const exception = Parrot_ex_build_exception(interp, IREG(1), cur_opcode[2], NULL);
+ PMC * const exception = Parrot_ex_build_exception(interp, IREG(1), ICONST(2), NULL);
opcode_t * const dest = Parrot_ex_throw_from_op(interp, exception, ret);return (opcode_t *)dest;
}
}
@@ -15869,11 +15872,11 @@
opcode_t *
Parrot_die_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[1] == EXCEPT_doomed)
- _exit(cur_opcode[2]);
+ if (ICONST(1) == EXCEPT_doomed)
+ _exit(ICONST(2));
else {
opcode_t * const ret = cur_opcode + 3;
- PMC * const exception = Parrot_ex_build_exception(interp, cur_opcode[1], cur_opcode[2], NULL);
+ PMC * const exception = Parrot_ex_build_exception(interp, ICONST(1), ICONST(2), NULL);
opcode_t * const dest = Parrot_ex_throw_from_op(interp, exception, ret);return (opcode_t *)dest;
}
}
@@ -15910,7 +15913,7 @@
VTABLE_set_attr_str(interp, exception,
Parrot_str_new_constant(interp, "resume"), resume);
VTABLE_set_integer_keyed_str(interp, exception,
- Parrot_str_new_constant(interp, "exit_code"), cur_opcode[1]);
+ Parrot_str_new_constant(interp, "exit_code"), ICONST(1));
dest = Parrot_ex_throw_from_op(interp, exception, ret);return (opcode_t *)dest;
}
@@ -15924,7 +15927,7 @@
opcode_t *
Parrot_debug_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[1] != 0) { Interp_debug_SET(interp, cur_opcode[1]); }
+ if (ICONST(1) != 0) { Interp_debug_SET(interp, ICONST(1)); }
else { Interp_debug_CLEAR(interp, PARROT_ALL_DEBUG_FLAGS); }interp->resume_offset = REL_PC + 2; interp->resume_flag = 1;return (opcode_t *)0;
}
@@ -15938,7 +15941,7 @@
opcode_t *
Parrot_bounds_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[1] != 0) { Parrot_set_flag(interp, PARROT_BOUNDS_FLAG); }
+ if (ICONST(1) != 0) { Parrot_set_flag(interp, PARROT_BOUNDS_FLAG); }
else { Interp_flags_CLEAR(interp, PARROT_BOUNDS_FLAG); }interp->resume_offset = REL_PC + 2; interp->resume_flag = 1;return (opcode_t *)0;
}
@@ -15952,7 +15955,7 @@
opcode_t *
Parrot_profile_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[1] != 0) { Parrot_set_flag(interp, PARROT_PROFILE_FLAG); }
+ if (ICONST(1) != 0) { Parrot_set_flag(interp, PARROT_PROFILE_FLAG); }
else { Interp_flags_CLEAR(interp, PARROT_PROFILE_FLAG); }interp->resume_offset = REL_PC + 2; interp->resume_flag = 1;return (opcode_t *)0;
}
@@ -15966,7 +15969,7 @@
opcode_t *
Parrot_trace_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[1] != 0) { Parrot_set_trace(interp, cur_opcode[1]); }
+ if (ICONST(1) != 0) { Parrot_set_trace(interp, ICONST(1)); }
else { Parrot_clear_trace(interp, PARROT_ALL_TRACE_FLAGS); }interp->resume_offset = REL_PC + 2; interp->resume_flag = 1;return (opcode_t *)0;
}
@@ -15981,7 +15984,7 @@
opcode_t *
Parrot_gc_debug_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[1] != 0) { Interp_flags_SET(interp, PARROT_GC_DEBUG_FLAG); }
+ if (ICONST(1) != 0) { Interp_flags_SET(interp, PARROT_GC_DEBUG_FLAG); }
else { Interp_flags_CLEAR(interp, PARROT_GC_DEBUG_FLAG); }
return (opcode_t *)cur_opcode + 2;}
@@ -15996,7 +15999,7 @@
opcode_t *
Parrot_interpinfo_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = interpinfo(interp, cur_opcode[2]);
+ IREG(1) = interpinfo(interp, ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -16010,7 +16013,7 @@
opcode_t *
Parrot_interpinfo_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = interpinfo_p(interp, cur_opcode[2]);
+ PREG(1) = interpinfo_p(interp, ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -16025,7 +16028,7 @@
opcode_t *
Parrot_interpinfo_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const s = interpinfo_s(interp, cur_opcode[2]);
+ STRING * const s = interpinfo_s(interp, ICONST(2));
SREG(1) = s;
return (opcode_t *)cur_opcode + 3;}
@@ -16040,7 +16043,7 @@
opcode_t *
Parrot_warningson_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PARROT_WARNINGS_on(interp, cur_opcode[1]);
+ PARROT_WARNINGS_on(interp, ICONST(1));
return (opcode_t *)cur_opcode + 2;}
@@ -16054,7 +16057,7 @@
opcode_t *
Parrot_warningsoff_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PARROT_WARNINGS_off(interp, cur_opcode[1]);
+ PARROT_WARNINGS_off(interp, ICONST(1));
return (opcode_t *)cur_opcode + 2;}
@@ -16068,7 +16071,7 @@
opcode_t *
Parrot_errorson_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PARROT_ERRORS_on(interp, cur_opcode[1]);
+ PARROT_ERRORS_on(interp, ICONST(1));
return (opcode_t *)cur_opcode + 2;}
@@ -16082,7 +16085,7 @@
opcode_t *
Parrot_errorsoff_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PARROT_ERRORS_off(interp, cur_opcode[1]);
+ PARROT_ERRORS_off(interp, ICONST(1));
return (opcode_t *)cur_opcode + 2;}
@@ -16102,7 +16105,7 @@
Interp * const new_interp = (Interp *)VTABLE_get_pointer(interp, PREG(1));
Interp_flags_SET(new_interp, PARROT_EXTERN_CODE_FLAG);
Parrot_switch_to_cs(new_interp, interp->code, 1);
- runops(new_interp, REL_PC + cur_opcode[2]);
+ runops(new_interp, REL_PC + ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -16117,7 +16120,7 @@
opcode_t *
Parrot_sweep_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[1])
+ if (ICONST(1))
Parrot_gc_mark_and_sweep(interp, GC_trace_normal_FLAG);
else
if (Parrot_gc_impatient_pmcs(interp))
@@ -16177,7 +16180,7 @@
opcode_t *
Parrot_loadlib_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_load_lib(interp, CONST(2).u.string, NULL);
+ PREG(1) = Parrot_load_lib(interp, SCONST(2), NULL);
return (opcode_t *)cur_opcode + 3;}
@@ -16191,21 +16194,21 @@
opcode_t *
Parrot_loadlib_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_load_lib(interp, CONST(2).u.string, PREG(3));
+ PREG(1) = Parrot_load_lib(interp, SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_loadlib_p_s_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_load_lib(interp, SREG(2), CONST(3).u.key);
+ PREG(1) = Parrot_load_lib(interp, SREG(2), PCONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_loadlib_p_sc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_load_lib(interp, CONST(2).u.string, CONST(3).u.key);
+ PREG(1) = Parrot_load_lib(interp, SCONST(2), PCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -16251,13 +16254,13 @@
dl_handle = ((Parrot_ParrotLibrary_attributes*)PMC_data(PREG(2)))->dl_handle;
}
- ptr = Parrot_dlsym_str(interp, dl_handle, CONST(3).u.string);
+ ptr = Parrot_dlsym_str(interp, dl_handle, SCONST(3));
p = D2FPTR(ptr);
if (p == NULLfunc) {
const char * err = Parrot_dlerror();
Parrot_warn(interp, PARROT_WARNINGS_UNDEF_FLAG,
- "Symbol '%Ss' not found: %s\n", CONST(3).u.string, err ? err : "unknown reason");
+ "Symbol '%Ss' not found: %s\n", SCONST(3), err ? err : "unknown reason");
PREG(1) = Parrot_pmc_new(interp, enum_class_Undef);
}
else {
@@ -16291,7 +16294,7 @@
}
else {
PREG(1) = Parrot_pmc_new(interp, enum_class_NCI);
- VTABLE_set_pointer_keyed_str(interp, PREG(1), CONST(4).u.string, F2DPTR(p));
+ VTABLE_set_pointer_keyed_str(interp, PREG(1), SCONST(4), F2DPTR(p));
}
return (opcode_t *)cur_opcode + 5;}
@@ -16309,18 +16312,18 @@
dl_handle = ((Parrot_ParrotLibrary_attributes*)PMC_data(PREG(2)))->dl_handle;
}
- ptr = Parrot_dlsym_str(interp, dl_handle, CONST(3).u.string);
+ ptr = Parrot_dlsym_str(interp, dl_handle, SCONST(3));
p = D2FPTR(ptr);
if (p == NULLfunc) {
const char * err = Parrot_dlerror();
Parrot_warn(interp, PARROT_WARNINGS_UNDEF_FLAG,
- "Symbol '%Ss' not found: %s\n", CONST(3).u.string, err ? err : "unknown reason");
+ "Symbol '%Ss' not found: %s\n", SCONST(3), err ? err : "unknown reason");
PREG(1) = Parrot_pmc_new(interp, enum_class_Undef);
}
else {
PREG(1) = Parrot_pmc_new(interp, enum_class_NCI);
- VTABLE_set_pointer_keyed_str(interp, PREG(1), CONST(4).u.string, F2DPTR(p));
+ VTABLE_set_pointer_keyed_str(interp, PREG(1), SCONST(4), F2DPTR(p));
}
return (opcode_t *)cur_opcode + 5;}
@@ -16366,12 +16369,12 @@
dl_handle = ((Parrot_ParrotLibrary_attributes*)PMC_data(PREG(2)))->dl_handle;
}
- p = Parrot_dlsym_str(interp, dl_handle, CONST(3).u.string);
+ p = Parrot_dlsym_str(interp, dl_handle, SCONST(3));
if (p == NULL) {
const char * const err = Parrot_dlerror();
Parrot_warn(interp, PARROT_WARNINGS_UNDEF_FLAG,
- "Symbol '%Ss' not found: %s\n", CONST(3).u.string, err ? err : "unknown reason");
+ "Symbol '%Ss' not found: %s\n", SCONST(3), err ? err : "unknown reason");
PREG(1) = Parrot_pmc_new(interp, enum_class_Undef);
}
else {
@@ -16397,7 +16400,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const compreg_hash = VTABLE_get_pmc_keyed_int(interp,
interp->iglobals, IGLOBALS_COMPREG_HASH);
- VTABLE_set_pmc_keyed_str(interp, compreg_hash, CONST(1).u.string, PREG(2));
+ VTABLE_set_pmc_keyed_str(interp, compreg_hash, SCONST(1), PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -16415,7 +16418,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const compreg_hash = VTABLE_get_pmc_keyed_int(interp,
interp->iglobals, IGLOBALS_COMPREG_HASH);
- PREG(1) = VTABLE_get_pmc_keyed_str(interp, compreg_hash, CONST(2).u.string);
+ PREG(1) = VTABLE_get_pmc_keyed_str(interp, compreg_hash, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -16429,7 +16432,7 @@
opcode_t *
Parrot_new_callback_p_p_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_make_cb(interp, PREG(2), PREG(3), CONST(4).u.string);
+ PREG(1) = Parrot_make_cb(interp, PREG(2), PREG(3), SCONST(4));
return (opcode_t *)cur_opcode + 5;}
@@ -16467,7 +16470,7 @@
if (interp->code->annotations) {
const opcode_t cur_pos = ( cur_opcode + 3) - interp->code->base.data;
PREG(1) = PackFile_Annotations_lookup(interp, interp->code->annotations,
- cur_pos, CONST(2).u.string);
+ cur_pos, SCONST(2));
}
else {
PREG(1) = PMCNULL;
@@ -16485,7 +16488,7 @@
opcode_t *
Parrot_band_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) &= cur_opcode[2];
+ IREG(1) &= ICONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -16499,14 +16502,14 @@
opcode_t *
Parrot_band_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = cur_opcode[2] & IREG(3);
+ IREG(1) = ICONST(2) & IREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_band_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = IREG(2) & cur_opcode[3];
+ IREG(1) = IREG(2) & ICONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -16520,7 +16523,7 @@
opcode_t *
Parrot_bor_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) |= cur_opcode[2];
+ IREG(1) |= ICONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -16534,14 +16537,14 @@
opcode_t *
Parrot_bor_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = cur_opcode[2] | IREG(3);
+ IREG(1) = ICONST(2) | IREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_bor_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = IREG(2) | cur_opcode[3];
+ IREG(1) = IREG(2) | ICONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -16555,7 +16558,7 @@
opcode_t *
Parrot_shl_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = bit_shift_left(IREG(1), cur_opcode[2]);
+ IREG(1) = bit_shift_left(IREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -16569,14 +16572,14 @@
opcode_t *
Parrot_shl_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = bit_shift_left(cur_opcode[2], IREG(3));
+ IREG(1) = bit_shift_left(ICONST(2), IREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_shl_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = bit_shift_left(IREG(2), cur_opcode[3]);
+ IREG(1) = bit_shift_left(IREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -16591,7 +16594,7 @@
opcode_t *
Parrot_shr_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- const INTVAL signed_shift = -cur_opcode[2];
+ const INTVAL signed_shift = -ICONST(2);
IREG(1) = bit_shift_left(IREG(1), signed_shift);
return (opcode_t *)cur_opcode + 3;}
@@ -16608,14 +16611,14 @@
Parrot_shr_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
const INTVAL signed_shift = -IREG(3);
- IREG(1) = bit_shift_left(cur_opcode[2], signed_shift);
+ IREG(1) = bit_shift_left(ICONST(2), signed_shift);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_shr_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- const INTVAL signed_shift = -cur_opcode[3];
+ const INTVAL signed_shift = -ICONST(3);
IREG(1) = bit_shift_left(IREG(2), signed_shift);
return (opcode_t *)cur_opcode + 4;}
@@ -16633,7 +16636,7 @@
Parrot_lsr_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
const UINTVAL a = (UINTVAL)IREG(1);
- const UINTVAL b = a >> cur_opcode[2];
+ const UINTVAL b = a >> ICONST(2);
IREG(1) = (INTVAL)b;
return (opcode_t *)cur_opcode + 3;}
@@ -16648,14 +16651,14 @@
opcode_t *
Parrot_lsr_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (INTVAL)((UINTVAL)cur_opcode[2] >> IREG(3));
+ IREG(1) = (INTVAL)((UINTVAL)ICONST(2) >> IREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_lsr_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (INTVAL)((UINTVAL)IREG(2) >> cur_opcode[3]);
+ IREG(1) = (INTVAL)((UINTVAL)IREG(2) >> ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -16669,7 +16672,7 @@
opcode_t *
Parrot_bxor_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) ^= cur_opcode[2];
+ IREG(1) ^= ICONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -16683,21 +16686,21 @@
opcode_t *
Parrot_bxor_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = cur_opcode[2] ^ IREG(3);
+ IREG(1) = ICONST(2) ^ IREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_bxor_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = IREG(2) ^ cur_opcode[3];
+ IREG(1) = IREG(2) ^ ICONST(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_eq_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (IREG(1) == IREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (IREG(1) == IREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16705,7 +16708,7 @@
opcode_t *
Parrot_eq_ic_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[1] == IREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (ICONST(1) == IREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16713,7 +16716,7 @@
opcode_t *
Parrot_eq_i_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (IREG(1) == cur_opcode[2]) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (IREG(1) == ICONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16721,7 +16724,7 @@
opcode_t *
Parrot_eq_n_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (NREG(1) == NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (NREG(1) == NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16729,7 +16732,7 @@
opcode_t *
Parrot_eq_nc_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (CONST(1).u.number == NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (NCONST(1) == NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16737,7 +16740,7 @@
opcode_t *
Parrot_eq_n_nc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (NREG(1) == CONST(2).u.number) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (NREG(1) == NCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16745,7 +16748,7 @@
opcode_t *
Parrot_eq_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16753,7 +16756,7 @@
opcode_t *
Parrot_eq_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_equal(interp, CONST(1).u.string, SREG(2))) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16761,7 +16764,7 @@
opcode_t *
Parrot_eq_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_equal(interp, SREG(1), CONST(2).u.string)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16769,7 +16772,7 @@
opcode_t *
Parrot_eq_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_is_equal(interp, PREG(1), PREG(2))) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_is_equal(interp, PREG(1), PREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16781,7 +16784,7 @@
VTABLE_set_integer_native(interp, temp, IREG(2));
if (VTABLE_is_equal(interp, PREG(1), temp)) {
- Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + cur_opcode[3];
+ Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + ICONST(3);
}
Parrot_pmc_free_temporary(interp, temp);
@@ -16792,10 +16795,10 @@
Parrot_eq_p_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const temp = Parrot_pmc_new_temporary(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, temp, cur_opcode[2]);
+ VTABLE_set_integer_native(interp, temp, ICONST(2));
if (VTABLE_is_equal(interp, PREG(1), temp)) {
- Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + cur_opcode[3];
+ Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + ICONST(3);
}
Parrot_pmc_free_temporary(interp, temp);
@@ -16811,7 +16814,7 @@
* overriding the compare multi subs wouldn't
* have any effect with the current code
*/
- if (VTABLE_get_number(interp, PREG(1)) == NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_get_number(interp, PREG(1)) == NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16825,7 +16828,7 @@
* overriding the compare multi subs wouldn't
* have any effect with the current code
*/
- if (VTABLE_get_number(interp, PREG(1)) == CONST(2).u.number) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_get_number(interp, PREG(1)) == NCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16833,7 +16836,7 @@
opcode_t *
Parrot_eq_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16841,7 +16844,7 @@
opcode_t *
Parrot_eq_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), CONST(2).u.string)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16849,7 +16852,7 @@
opcode_t *
Parrot_eq_str_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_is_equal_string(interp, PREG(1), PREG(2))) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_is_equal_string(interp, PREG(1), PREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16857,7 +16860,7 @@
opcode_t *
Parrot_eq_num_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_is_equal_num(interp, PREG(1), PREG(2))) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_is_equal_num(interp, PREG(1), PREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16865,7 +16868,7 @@
opcode_t *
Parrot_eq_addr_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (SREG(1) == SREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (SREG(1) == SREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16873,7 +16876,7 @@
opcode_t *
Parrot_eq_addr_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (CONST(1).u.string == SREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (SCONST(1) == SREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16881,7 +16884,7 @@
opcode_t *
Parrot_eq_addr_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (SREG(1) == CONST(2).u.string) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (SREG(1) == SCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16889,7 +16892,7 @@
opcode_t *
Parrot_eq_addr_sc_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (CONST(1).u.string == CONST(2).u.string) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (SCONST(1) == SCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16897,7 +16900,7 @@
opcode_t *
Parrot_eq_addr_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (PREG(1) == PREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (PREG(1) == PREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16905,7 +16908,7 @@
opcode_t *
Parrot_ne_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (IREG(1) != IREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (IREG(1) != IREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16913,7 +16916,7 @@
opcode_t *
Parrot_ne_ic_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[1] != IREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (ICONST(1) != IREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16921,7 +16924,7 @@
opcode_t *
Parrot_ne_i_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (IREG(1) != cur_opcode[2]) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (IREG(1) != ICONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16929,7 +16932,7 @@
opcode_t *
Parrot_ne_n_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (NREG(1) != NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (NREG(1) != NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16937,7 +16940,7 @@
opcode_t *
Parrot_ne_nc_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (CONST(1).u.number != NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (NCONST(1) != NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16945,7 +16948,7 @@
opcode_t *
Parrot_ne_n_nc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (NREG(1) != CONST(2).u.number) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (NREG(1) != NCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16953,7 +16956,7 @@
opcode_t *
Parrot_ne_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (!STRING_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (!STRING_equal(interp, SREG(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16961,7 +16964,7 @@
opcode_t *
Parrot_ne_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (!STRING_equal(interp, CONST(1).u.string, SREG(2))) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (!STRING_equal(interp, SCONST(1), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16969,7 +16972,7 @@
opcode_t *
Parrot_ne_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (!STRING_equal(interp, SREG(1), CONST(2).u.string)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (!STRING_equal(interp, SREG(1), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16977,7 +16980,7 @@
opcode_t *
Parrot_ne_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (!VTABLE_is_equal(interp, PREG(1), PREG(2))) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (!VTABLE_is_equal(interp, PREG(1), PREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -16989,7 +16992,7 @@
VTABLE_set_integer_native(interp, temp, IREG(2));
if (!VTABLE_is_equal(interp, PREG(1), temp)) {
- Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + cur_opcode[3];
+ Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + ICONST(3);
}
Parrot_pmc_free_temporary(interp, temp);
@@ -17000,10 +17003,10 @@
Parrot_ne_p_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const temp = Parrot_pmc_new_temporary(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, temp, cur_opcode[2]);
+ VTABLE_set_integer_native(interp, temp, ICONST(2));
if (!VTABLE_is_equal(interp, PREG(1), temp)) {
- Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + cur_opcode[3];
+ Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + ICONST(3);
}
Parrot_pmc_free_temporary(interp, temp);
@@ -17013,7 +17016,7 @@
opcode_t *
Parrot_ne_p_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_get_number(interp, PREG(1)) != NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_get_number(interp, PREG(1)) != NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17021,7 +17024,7 @@
opcode_t *
Parrot_ne_p_nc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_get_number(interp, PREG(1)) != CONST(2).u.number) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_get_number(interp, PREG(1)) != NCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17029,7 +17032,7 @@
opcode_t *
Parrot_ne_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (!STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (!STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SREG(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17037,7 +17040,7 @@
opcode_t *
Parrot_ne_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (!STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), CONST(2).u.string)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (!STRING_equal(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2))) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17045,7 +17048,7 @@
opcode_t *
Parrot_ne_str_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp_string(interp, PREG(1), PREG(2)) != 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp_string(interp, PREG(1), PREG(2)) != 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17053,7 +17056,7 @@
opcode_t *
Parrot_ne_num_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp_num(interp, PREG(1), PREG(2)) != 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp_num(interp, PREG(1), PREG(2)) != 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17061,7 +17064,7 @@
opcode_t *
Parrot_ne_addr_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (SREG(1) != SREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (SREG(1) != SREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17069,7 +17072,7 @@
opcode_t *
Parrot_ne_addr_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (CONST(1).u.string != SREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (SCONST(1) != SREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17077,7 +17080,7 @@
opcode_t *
Parrot_ne_addr_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (SREG(1) != CONST(2).u.string) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (SREG(1) != SCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17085,7 +17088,7 @@
opcode_t *
Parrot_ne_addr_sc_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (CONST(1).u.string != CONST(2).u.string) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (SCONST(1) != SCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17093,7 +17096,7 @@
opcode_t *
Parrot_ne_addr_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (PREG(1) != PREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (PREG(1) != PREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17101,7 +17104,7 @@
opcode_t *
Parrot_lt_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (IREG(1) < IREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (IREG(1) < IREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17109,7 +17112,7 @@
opcode_t *
Parrot_lt_ic_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[1] < IREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (ICONST(1) < IREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17117,7 +17120,7 @@
opcode_t *
Parrot_lt_i_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (IREG(1) < cur_opcode[2]) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (IREG(1) < ICONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17125,7 +17128,7 @@
opcode_t *
Parrot_lt_n_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (NREG(1) < NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (NREG(1) < NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17133,7 +17136,7 @@
opcode_t *
Parrot_lt_nc_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (CONST(1).u.number < NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (NCONST(1) < NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17141,7 +17144,7 @@
opcode_t *
Parrot_lt_n_nc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (NREG(1) < CONST(2).u.number) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (NREG(1) < NCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17149,7 +17152,7 @@
opcode_t *
Parrot_lt_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, SREG(1), SREG(2)) < 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, SREG(1), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17157,7 +17160,7 @@
opcode_t *
Parrot_lt_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, CONST(1).u.string, SREG(2)) < 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, SCONST(1), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17165,7 +17168,7 @@
opcode_t *
Parrot_lt_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, SREG(1), CONST(2).u.string) < 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, SREG(1), SCONST(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17173,7 +17176,7 @@
opcode_t *
Parrot_lt_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp(interp, PREG(1), PREG(2)) < 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp(interp, PREG(1), PREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17185,7 +17188,7 @@
VTABLE_set_integer_native(interp, temp, IREG(2));
if (VTABLE_cmp(interp, PREG(1), temp) < 0) {
- Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + cur_opcode[3];
+ Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + ICONST(3);
}
Parrot_pmc_free_temporary(interp, temp);
@@ -17196,10 +17199,10 @@
Parrot_lt_p_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const temp = Parrot_pmc_new_temporary(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, temp, cur_opcode[2]);
+ VTABLE_set_integer_native(interp, temp, ICONST(2));
if (VTABLE_cmp(interp, PREG(1), temp) < 0) {
- Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + cur_opcode[3];
+ Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + ICONST(3);
}
Parrot_pmc_free_temporary(interp, temp);
@@ -17209,7 +17212,7 @@
opcode_t *
Parrot_lt_p_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_get_number(interp, PREG(1)) < NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_get_number(interp, PREG(1)) < NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17217,7 +17220,7 @@
opcode_t *
Parrot_lt_p_nc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_get_number(interp, PREG(1)) < CONST(2).u.number) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_get_number(interp, PREG(1)) < NCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17225,7 +17228,7 @@
opcode_t *
Parrot_lt_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) < 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17233,7 +17236,7 @@
opcode_t *
Parrot_lt_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), CONST(2).u.string) < 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17241,7 +17244,7 @@
opcode_t *
Parrot_lt_str_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp_string(interp, PREG(1), PREG(2)) < 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp_string(interp, PREG(1), PREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17249,7 +17252,7 @@
opcode_t *
Parrot_lt_num_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp_num(interp, PREG(1), PREG(2)) < 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp_num(interp, PREG(1), PREG(2)) < 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17257,7 +17260,7 @@
opcode_t *
Parrot_le_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (IREG(1) <= IREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (IREG(1) <= IREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17265,7 +17268,7 @@
opcode_t *
Parrot_le_ic_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[1] <= IREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (ICONST(1) <= IREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17273,7 +17276,7 @@
opcode_t *
Parrot_le_i_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (IREG(1) <= cur_opcode[2]) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (IREG(1) <= ICONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17281,7 +17284,7 @@
opcode_t *
Parrot_le_n_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (NREG(1) <= NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (NREG(1) <= NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17289,7 +17292,7 @@
opcode_t *
Parrot_le_nc_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (CONST(1).u.number <= NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (NCONST(1) <= NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17297,7 +17300,7 @@
opcode_t *
Parrot_le_n_nc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (NREG(1) <= CONST(2).u.number) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (NREG(1) <= NCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17305,7 +17308,7 @@
opcode_t *
Parrot_le_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, SREG(1), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, SREG(1), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17313,7 +17316,7 @@
opcode_t *
Parrot_le_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, CONST(1).u.string, SREG(2)) <= 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, SCONST(1), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17321,7 +17324,7 @@
opcode_t *
Parrot_le_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, SREG(1), CONST(2).u.string) <= 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, SREG(1), SCONST(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17329,7 +17332,7 @@
opcode_t *
Parrot_le_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp(interp, PREG(1), PREG(2)) <= 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp(interp, PREG(1), PREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17341,7 +17344,7 @@
VTABLE_set_integer_native(interp, temp, IREG(2));
if (VTABLE_cmp(interp, PREG(1), temp) <= 0) {
- Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + cur_opcode[3];
+ Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + ICONST(3);
}
Parrot_pmc_free_temporary(interp, temp);
@@ -17352,10 +17355,10 @@
Parrot_le_p_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const temp = Parrot_pmc_new_temporary(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, temp, cur_opcode[2]);
+ VTABLE_set_integer_native(interp, temp, ICONST(2));
if (VTABLE_cmp(interp, PREG(1), temp) <= 0) {
- Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + cur_opcode[3];
+ Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + ICONST(3);
}
Parrot_pmc_free_temporary(interp, temp);
@@ -17365,7 +17368,7 @@
opcode_t *
Parrot_le_p_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_get_number(interp, PREG(1)) <= NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_get_number(interp, PREG(1)) <= NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17373,7 +17376,7 @@
opcode_t *
Parrot_le_p_nc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_get_number(interp, PREG(1)) <= CONST(2).u.number) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_get_number(interp, PREG(1)) <= NCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17381,7 +17384,7 @@
opcode_t *
Parrot_le_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17389,7 +17392,7 @@
opcode_t *
Parrot_le_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), CONST(2).u.string) <= 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17397,7 +17400,7 @@
opcode_t *
Parrot_le_str_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp_string(interp, PREG(1), PREG(2)) <= 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp_string(interp, PREG(1), PREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17405,7 +17408,7 @@
opcode_t *
Parrot_le_num_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp_num(interp, PREG(1), PREG(2)) <= 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp_num(interp, PREG(1), PREG(2)) <= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17413,7 +17416,7 @@
opcode_t *
Parrot_gt_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp(interp, PREG(1), PREG(2)) > 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp(interp, PREG(1), PREG(2)) > 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17425,7 +17428,7 @@
VTABLE_set_integer_native(interp, temp, IREG(2));
if (VTABLE_cmp(interp, PREG(1), temp) > 0) {
- Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + cur_opcode[3];
+ Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + ICONST(3);
}
Parrot_pmc_free_temporary(interp, temp);
@@ -17436,10 +17439,10 @@
Parrot_gt_p_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const temp = Parrot_pmc_new_temporary(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, temp, cur_opcode[2]);
+ VTABLE_set_integer_native(interp, temp, ICONST(2));
if (VTABLE_cmp(interp, PREG(1), temp) > 0) {
- Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + cur_opcode[3];
+ Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + ICONST(3);
}
Parrot_pmc_free_temporary(interp, temp);
@@ -17449,7 +17452,7 @@
opcode_t *
Parrot_gt_p_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_get_number(interp, PREG(1)) > NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_get_number(interp, PREG(1)) > NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17457,7 +17460,7 @@
opcode_t *
Parrot_gt_p_nc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_get_number(interp, PREG(1)) > CONST(2).u.number) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_get_number(interp, PREG(1)) > NCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17465,7 +17468,7 @@
opcode_t *
Parrot_gt_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) > 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) > 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17473,7 +17476,7 @@
opcode_t *
Parrot_gt_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), CONST(2).u.string) > 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) > 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17481,7 +17484,7 @@
opcode_t *
Parrot_gt_str_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp_string(interp, PREG(1), PREG(2)) > 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp_string(interp, PREG(1), PREG(2)) > 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17489,7 +17492,7 @@
opcode_t *
Parrot_gt_num_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp_num(interp, PREG(1), PREG(2)) > 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp_num(interp, PREG(1), PREG(2)) > 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17497,7 +17500,7 @@
opcode_t *
Parrot_ge_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp(interp, PREG(1), PREG(2)) >= 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp(interp, PREG(1), PREG(2)) >= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17509,7 +17512,7 @@
VTABLE_set_integer_native(interp, temp, IREG(2));
if (VTABLE_cmp(interp, PREG(1), temp) >= 0) {
- Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + cur_opcode[3];
+ Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + ICONST(3);
}
Parrot_pmc_free_temporary(interp, temp);
@@ -17520,10 +17523,10 @@
Parrot_ge_p_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const temp = Parrot_pmc_new_temporary(interp, enum_class_Integer);
- VTABLE_set_integer_native(interp, temp, cur_opcode[2]);
+ VTABLE_set_integer_native(interp, temp, ICONST(2));
if (VTABLE_cmp(interp, PREG(1), temp) >= 0) {
- Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + cur_opcode[3];
+ Parrot_pmc_free_temporary(interp, temp);return (opcode_t *)cur_opcode + ICONST(3);
}
Parrot_pmc_free_temporary(interp, temp);
@@ -17533,7 +17536,7 @@
opcode_t *
Parrot_ge_p_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_get_number(interp, PREG(1)) >= NREG(2)) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_get_number(interp, PREG(1)) >= NREG(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17541,7 +17544,7 @@
opcode_t *
Parrot_ge_p_nc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_get_number(interp, PREG(1)) >= CONST(2).u.number) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_get_number(interp, PREG(1)) >= NCONST(2)) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17549,7 +17552,7 @@
opcode_t *
Parrot_ge_p_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) >= 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SREG(2)) >= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17557,7 +17560,7 @@
opcode_t *
Parrot_ge_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), CONST(2).u.string) >= 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (STRING_compare(interp, VTABLE_get_string(interp, PREG(1)), SCONST(2)) >= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17565,7 +17568,7 @@
opcode_t *
Parrot_ge_str_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp_string(interp, PREG(1), PREG(2)) >= 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp_string(interp, PREG(1), PREG(2)) >= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17573,7 +17576,7 @@
opcode_t *
Parrot_ge_num_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (VTABLE_cmp_num(interp, PREG(1), PREG(2)) >= 0) {return (opcode_t *)cur_opcode + cur_opcode[3];
+ if (VTABLE_cmp_num(interp, PREG(1), PREG(2)) >= 0) {return (opcode_t *)cur_opcode + ICONST(3);
}
return (opcode_t *)cur_opcode + 4;}
@@ -17581,7 +17584,7 @@
opcode_t *
Parrot_if_null_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (PMC_IS_NULL(PREG(1))) {return (opcode_t *)cur_opcode + cur_opcode[2];
+ if (PMC_IS_NULL(PREG(1))) {return (opcode_t *)cur_opcode + ICONST(2);
}
return (opcode_t *)cur_opcode + 3;}
@@ -17589,7 +17592,7 @@
opcode_t *
Parrot_if_null_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (STRING_IS_NULL(SREG(1))) {return (opcode_t *)cur_opcode + cur_opcode[2];
+ if (STRING_IS_NULL(SREG(1))) {return (opcode_t *)cur_opcode + ICONST(2);
}
return (opcode_t *)cur_opcode + 3;}
@@ -17597,7 +17600,7 @@
opcode_t *
Parrot_unless_null_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (!PMC_IS_NULL(PREG(1))) {return (opcode_t *)cur_opcode + cur_opcode[2];
+ if (!PMC_IS_NULL(PREG(1))) {return (opcode_t *)cur_opcode + ICONST(2);
}
return (opcode_t *)cur_opcode + 3;}
@@ -17605,7 +17608,7 @@
opcode_t *
Parrot_unless_null_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (!STRING_IS_NULL(SREG(1))) {return (opcode_t *)cur_opcode + cur_opcode[2];
+ if (!STRING_IS_NULL(SREG(1))) {return (opcode_t *)cur_opcode + ICONST(2);
}
return (opcode_t *)cur_opcode + 3;}
@@ -17622,8 +17625,8 @@
opcode_t *
Parrot_cmp_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = cur_opcode[2] < IREG(3) ? -1 :
- cur_opcode[2] > IREG(3) ? +1 :
+ IREG(1) = ICONST(2) < IREG(3) ? -1 :
+ ICONST(2) > IREG(3) ? +1 :
0;
return (opcode_t *)cur_opcode + 4;}
@@ -17631,8 +17634,8 @@
opcode_t *
Parrot_cmp_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = IREG(2) < cur_opcode[3] ? -1 :
- IREG(2) > cur_opcode[3] ? +1 :
+ IREG(1) = IREG(2) < ICONST(3) ? -1 :
+ IREG(2) > ICONST(3) ? +1 :
0;
return (opcode_t *)cur_opcode + 4;}
@@ -17649,8 +17652,8 @@
opcode_t *
Parrot_cmp_i_nc_n(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = CONST(2).u.number < NREG(3) ? -1 :
- CONST(2).u.number > NREG(3) ? +1 :
+ IREG(1) = NCONST(2) < NREG(3) ? -1 :
+ NCONST(2) > NREG(3) ? +1 :
0;
return (opcode_t *)cur_opcode + 4;}
@@ -17658,8 +17661,8 @@
opcode_t *
Parrot_cmp_i_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = NREG(2) < CONST(3).u.number ? -1 :
- NREG(2) > CONST(3).u.number ? +1 :
+ IREG(1) = NREG(2) < NCONST(3) ? -1 :
+ NREG(2) > NCONST(3) ? +1 :
0;
return (opcode_t *)cur_opcode + 4;}
@@ -17674,14 +17677,14 @@
opcode_t *
Parrot_cmp_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = STRING_compare(interp, CONST(2).u.string, SREG(3));
+ IREG(1) = STRING_compare(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_cmp_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = STRING_compare(interp, SREG(2), CONST(3).u.string);
+ IREG(1) = STRING_compare(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -17706,8 +17709,8 @@
Parrot_cmp_i_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
const INTVAL l = VTABLE_get_integer(interp, PREG(2));
- IREG(1) = l < cur_opcode[3] ? -1 :
- l > cur_opcode[3] ? +1 :
+ IREG(1) = l < ICONST(3) ? -1 :
+ l > ICONST(3) ? +1 :
0;
return (opcode_t *)cur_opcode + 4;}
@@ -17726,8 +17729,8 @@
Parrot_cmp_i_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
const FLOATVAL l = VTABLE_get_number(interp, PREG(2));
- IREG(1) = l < CONST(3).u.number ? -1 :
- l > CONST(3).u.number ? +1 :
+ IREG(1) = l < NCONST(3) ? -1 :
+ l > NCONST(3) ? +1 :
0;
return (opcode_t *)cur_opcode + 4;}
@@ -17744,7 +17747,7 @@
Parrot_cmp_i_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
STRING* const l = VTABLE_get_string(interp, PREG(2));
- IREG(1) = STRING_compare(interp, l, CONST(3).u.string);
+ IREG(1) = STRING_compare(interp, l, SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -17789,21 +17792,21 @@
opcode_t *
Parrot_issame_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = CONST(2).u.string == SREG(3);
+ IREG(1) = SCONST(2) == SREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_issame_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = SREG(2) == CONST(3).u.string;
+ IREG(1) = SREG(2) == SCONST(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_issame_i_sc_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = CONST(2).u.string == CONST(3).u.string;
+ IREG(1) = SCONST(2) == SCONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -17827,21 +17830,21 @@
opcode_t *
Parrot_isntsame_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = CONST(2).u.string != SREG(3);
+ IREG(1) = SCONST(2) != SREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isntsame_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = SREG(2) != CONST(3).u.string;
+ IREG(1) = SREG(2) != SCONST(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isntsame_i_sc_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = CONST(2).u.string != CONST(3).u.string;
+ IREG(1) = SCONST(2) != SCONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -17869,7 +17872,7 @@
opcode_t *
Parrot_isnull_i_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = PMC_IS_NULL(CONST(2).u.key);
+ IREG(1) = PMC_IS_NULL(PCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -17883,7 +17886,7 @@
opcode_t *
Parrot_isnull_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = STRING_IS_NULL(CONST(2).u.string);
+ IREG(1) = STRING_IS_NULL(SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -17911,14 +17914,14 @@
opcode_t *
Parrot_isle_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = cur_opcode[2] <= IREG(3);
+ IREG(1) = ICONST(2) <= IREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isle_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = IREG(2) <= cur_opcode[3];
+ IREG(1) = IREG(2) <= ICONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -17932,14 +17935,14 @@
opcode_t *
Parrot_isle_i_nc_n(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = CONST(2).u.number <= NREG(3);
+ IREG(1) = NCONST(2) <= NREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isle_i_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = NREG(2) <= CONST(3).u.number;
+ IREG(1) = NREG(2) <= NCONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -17953,14 +17956,14 @@
opcode_t *
Parrot_isle_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = STRING_compare(interp, CONST(2).u.string, SREG(3)) <= 0;
+ IREG(1) = STRING_compare(interp, SCONST(2), SREG(3)) <= 0;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isle_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = STRING_compare(interp, SREG(2), CONST(3).u.string) <= 0;
+ IREG(1) = STRING_compare(interp, SREG(2), SCONST(3)) <= 0;
return (opcode_t *)cur_opcode + 4;}
@@ -17981,14 +17984,14 @@
opcode_t *
Parrot_islt_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (cur_opcode[2] < IREG(3)) ? 1 : 0;
+ IREG(1) = (ICONST(2) < IREG(3)) ? 1 : 0;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_islt_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (IREG(2) < cur_opcode[3]) ? 1 : 0;
+ IREG(1) = (IREG(2) < ICONST(3)) ? 1 : 0;
return (opcode_t *)cur_opcode + 4;}
@@ -18002,14 +18005,14 @@
opcode_t *
Parrot_islt_i_nc_n(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = CONST(2).u.number < NREG(3);
+ IREG(1) = NCONST(2) < NREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_islt_i_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = NREG(2) < CONST(3).u.number;
+ IREG(1) = NREG(2) < NCONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -18023,14 +18026,14 @@
opcode_t *
Parrot_islt_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = STRING_compare(interp, CONST(2).u.string, SREG(3)) < 0;
+ IREG(1) = STRING_compare(interp, SCONST(2), SREG(3)) < 0;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_islt_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = STRING_compare(interp, SREG(2), CONST(3).u.string) < 0;
+ IREG(1) = STRING_compare(interp, SREG(2), SCONST(3)) < 0;
return (opcode_t *)cur_opcode + 4;}
@@ -18051,14 +18054,14 @@
opcode_t *
Parrot_iseq_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (cur_opcode[2] == IREG(3)) ? 1 : 0;
+ IREG(1) = (ICONST(2) == IREG(3)) ? 1 : 0;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_iseq_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (IREG(2) == cur_opcode[3]) ? 1 : 0;
+ IREG(1) = (IREG(2) == ICONST(3)) ? 1 : 0;
return (opcode_t *)cur_opcode + 4;}
@@ -18072,14 +18075,14 @@
opcode_t *
Parrot_iseq_i_nc_n(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = CONST(2).u.number == NREG(3);
+ IREG(1) = NCONST(2) == NREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_iseq_i_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = NREG(2) == CONST(3).u.number;
+ IREG(1) = NREG(2) == NCONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -18093,14 +18096,14 @@
opcode_t *
Parrot_iseq_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = STRING_equal(interp, CONST(2).u.string, SREG(3));
+ IREG(1) = STRING_equal(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_iseq_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = STRING_equal(interp, SREG(2), CONST(3).u.string);
+ IREG(1) = STRING_equal(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -18124,14 +18127,14 @@
opcode_t *
Parrot_isne_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (cur_opcode[2] == IREG(3)) ? 0 : 1;
+ IREG(1) = (ICONST(2) == IREG(3)) ? 0 : 1;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isne_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (IREG(2) == cur_opcode[3]) ? 0 : 1;
+ IREG(1) = (IREG(2) == ICONST(3)) ? 0 : 1;
return (opcode_t *)cur_opcode + 4;}
@@ -18145,14 +18148,14 @@
opcode_t *
Parrot_isne_i_nc_n(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = CONST(2).u.number != NREG(3);
+ IREG(1) = NCONST(2) != NREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isne_i_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = NREG(2) != CONST(3).u.number;
+ IREG(1) = NREG(2) != NCONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -18166,14 +18169,14 @@
opcode_t *
Parrot_isne_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = !STRING_equal(interp, CONST(2).u.string, SREG(3));
+ IREG(1) = !STRING_equal(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_isne_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = !STRING_equal(interp, SREG(2), CONST(3).u.string);
+ IREG(1) = !STRING_equal(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -18197,14 +18200,14 @@
opcode_t *
Parrot_and_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = cur_opcode[2] ? IREG(3) : cur_opcode[2];
+ IREG(1) = ICONST(2) ? IREG(3) : ICONST(2);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_and_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = IREG(2) ? cur_opcode[3] : IREG(2);
+ IREG(1) = IREG(2) ? ICONST(3) : IREG(2);
return (opcode_t *)cur_opcode + 4;}
@@ -18241,7 +18244,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
const INTVAL a = ! VTABLE_get_bool(interp, PREG(2));
if (PMC_IS_NULL(PREG(1)))
- PREG(1) = Parrot_pmc_new(interp, VTABLE_type(interp, PREG(2)));
+ PREG(1) = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_Boolean));
VTABLE_set_bool(interp, PREG(1), a);
return (opcode_t *)cur_opcode + 3;}
@@ -18256,14 +18259,14 @@
opcode_t *
Parrot_or_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = cur_opcode[2] ? cur_opcode[2] : IREG(3);
+ IREG(1) = ICONST(2) ? ICONST(2) : IREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_or_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = IREG(2) ? IREG(2) : cur_opcode[3];
+ IREG(1) = IREG(2) ? IREG(2) : ICONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -18284,14 +18287,14 @@
opcode_t *
Parrot_xor_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (cur_opcode[2] && ! IREG(3)) ? cur_opcode[2] : (IREG(3) && ! cur_opcode[2]) ? IREG(3) : 0;
+ IREG(1) = (ICONST(2) && ! IREG(3)) ? ICONST(2) : (IREG(3) && ! ICONST(2)) ? IREG(3) : 0;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_xor_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (IREG(2) && ! cur_opcode[3]) ? IREG(2) : (cur_opcode[3] && ! IREG(2)) ? cur_opcode[3] : 0;
+ IREG(1) = (IREG(2) && ! ICONST(3)) ? IREG(2) : (ICONST(3) && ! IREG(2)) ? ICONST(3) : 0;
return (opcode_t *)cur_opcode + 4;}
@@ -18322,7 +18325,7 @@
opcode_t *
Parrot_print_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- Parrot_io_printf(interp, INTVAL_FMT, (INTVAL)cur_opcode[1]);
+ Parrot_io_printf(interp, INTVAL_FMT, (INTVAL)ICONST(1));
return (opcode_t *)cur_opcode + 2;}
@@ -18347,14 +18350,14 @@
Parrot_print_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
#ifdef PARROT_HAS_NEGATIVE_ZERO
- Parrot_io_printf(interp, FLOATVAL_FMT, CONST(1).u.number);
+ Parrot_io_printf(interp, FLOATVAL_FMT, NCONST(1));
#else
/* Workaround for older msvcrt and openbsd. TT #313 */
- if (Parrot_is_nzero(CONST(1).u.number)) {
+ if (Parrot_is_nzero(NCONST(1))) {
Parrot_io_printf(interp, "-0");
}
else {
- Parrot_io_printf(interp, FLOATVAL_FMT, CONST(1).u.number);
+ Parrot_io_printf(interp, FLOATVAL_FMT, NCONST(1));
}
#endif
@@ -18372,7 +18375,7 @@
opcode_t *
Parrot_print_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const s = CONST(1).u.string;
+ STRING * const s = SCONST(1);
if (s && Parrot_str_byte_length(interp, s))
Parrot_io_putps(interp, _PIO_STDOUT(interp), s);
@@ -18398,7 +18401,7 @@
opcode_t *
Parrot_say_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- Parrot_io_printf(interp, INTVAL_FMT "\n", (INTVAL)cur_opcode[1]);
+ Parrot_io_printf(interp, INTVAL_FMT "\n", (INTVAL)ICONST(1));
return (opcode_t *)cur_opcode + 2;}
@@ -18423,14 +18426,14 @@
Parrot_say_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
#ifdef PARROT_HAS_NEGATIVE_ZERO
- Parrot_io_printf(interp, FLOATVAL_FMT "\n", CONST(1).u.number);
+ Parrot_io_printf(interp, FLOATVAL_FMT "\n", NCONST(1));
#else
/* Workaround for older msvcrt and openbsd. TT #313 */
- if (Parrot_is_nzero(CONST(1).u.number)) {
+ if (Parrot_is_nzero(NCONST(1))) {
Parrot_io_printf(interp, "-0\n");
}
else {
- Parrot_io_printf(interp, FLOATVAL_FMT "\n", CONST(1).u.number);
+ Parrot_io_printf(interp, FLOATVAL_FMT "\n", NCONST(1));
}
#endif
@@ -18449,7 +18452,7 @@
opcode_t *
Parrot_say_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const s = CONST(1).u.string;
+ STRING * const s = SCONST(1);
if (s && Parrot_str_byte_length(interp, s))
Parrot_io_putps(interp, _PIO_STDOUT(interp), s);
Parrot_io_putps(interp, _PIO_STDOUT(interp), Parrot_str_new_constant(interp, "\n"));
@@ -18489,7 +18492,7 @@
Parrot_print_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
if (PREG(1)) {
- STRING * const s = Parrot_str_from_int(interp, cur_opcode[2]);
+ STRING * const s = Parrot_str_from_int(interp, ICONST(2));
Parrot_io_putps(interp, PREG(1), s);
}
@@ -18509,7 +18512,7 @@
Parrot_print_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
if (PREG(1)) {
- STRING * const s = Parrot_sprintf_c(interp, FLOATVAL_FMT, CONST(2).u.number);
+ STRING * const s = Parrot_sprintf_c(interp, FLOATVAL_FMT, NCONST(2));
Parrot_io_putps(interp, PREG(1), s);
}
@@ -18527,8 +18530,8 @@
opcode_t *
Parrot_print_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (CONST(2).u.string && PREG(1)) {
- Parrot_io_putps(interp, PREG(1), CONST(2).u.string);
+ if (SCONST(2) && PREG(1)) {
+ Parrot_io_putps(interp, PREG(1), SCONST(2));
}
return (opcode_t *)cur_opcode + 3;}
@@ -18616,7 +18619,7 @@
opcode_t *
Parrot_add_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) += cur_opcode[2];
+ IREG(1) += ICONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -18630,7 +18633,7 @@
opcode_t *
Parrot_add_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) += CONST(2).u.number;
+ NREG(1) += NCONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -18651,7 +18654,7 @@
opcode_t *
Parrot_add_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_add_int(interp, PREG(1), cur_opcode[2]);
+ VTABLE_i_add_int(interp, PREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -18665,7 +18668,7 @@
opcode_t *
Parrot_add_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_add_float(interp, PREG(1), CONST(2).u.number);
+ VTABLE_i_add_float(interp, PREG(1), NCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -18679,14 +18682,14 @@
opcode_t *
Parrot_add_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = cur_opcode[2] + IREG(3);
+ IREG(1) = ICONST(2) + IREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_add_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = IREG(2) + cur_opcode[3];
+ IREG(1) = IREG(2) + ICONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -18700,14 +18703,14 @@
opcode_t *
Parrot_add_n_nc_n(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = CONST(2).u.number + NREG(3);
+ NREG(1) = NCONST(2) + NREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_add_n_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = NREG(2) + CONST(3).u.number;
+ NREG(1) = NREG(2) + NCONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -18728,7 +18731,7 @@
opcode_t *
Parrot_add_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_add_int(interp, PREG(2), cur_opcode[3], PREG(1));
+ PREG(1) = VTABLE_add_int(interp, PREG(2), ICONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -18742,7 +18745,7 @@
opcode_t *
Parrot_add_p_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_add_float(interp, PREG(2), CONST(3).u.number, PREG(1));
+ PREG(1) = VTABLE_add_float(interp, PREG(2), NCONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -18783,7 +18786,7 @@
opcode_t *
Parrot_div_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- INTVAL den = cur_opcode[2];
+ INTVAL den = ICONST(2);
if (den == 0) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, cur_opcode + 3,
EXCEPTION_DIV_BY_ZERO,
@@ -18809,7 +18812,7 @@
opcode_t *
Parrot_div_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- FLOATVAL den = CONST(2).u.number;
+ FLOATVAL den = NCONST(2);
if (FLOAT_IS_ZERO(den)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, cur_opcode + 3,
EXCEPTION_DIV_BY_ZERO,
@@ -18836,7 +18839,7 @@
opcode_t *
Parrot_div_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_divide_int(interp, PREG(1), cur_opcode[2]);
+ VTABLE_i_divide_int(interp, PREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -18850,7 +18853,7 @@
opcode_t *
Parrot_div_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_divide_float(interp, PREG(1), CONST(2).u.number);
+ VTABLE_i_divide_float(interp, PREG(1), NCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -18876,14 +18879,14 @@
EXCEPTION_DIV_BY_ZERO,
"Divide by zero");return (opcode_t *)handler;
}
- IREG(1) = cur_opcode[2] / den;
+ IREG(1) = ICONST(2) / den;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_div_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- INTVAL den = cur_opcode[3];
+ INTVAL den = ICONST(3);
if (den == 0) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, cur_opcode + 4,
EXCEPTION_DIV_BY_ZERO,
@@ -18896,13 +18899,13 @@
opcode_t *
Parrot_div_i_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- INTVAL den = cur_opcode[3];
+ INTVAL den = ICONST(3);
if (den == 0) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, cur_opcode + 4,
EXCEPTION_DIV_BY_ZERO,
"Divide by zero");return (opcode_t *)handler;
}
- IREG(1) = cur_opcode[2] / den;
+ IREG(1) = ICONST(2) / den;
return (opcode_t *)cur_opcode + 4;}
@@ -18928,14 +18931,14 @@
EXCEPTION_DIV_BY_ZERO,
"Divide by zero");return (opcode_t *)handler;
}
- NREG(1) = CONST(2).u.number / den;
+ NREG(1) = NCONST(2) / den;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_div_n_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- FLOATVAL den = CONST(3).u.number;
+ FLOATVAL den = NCONST(3);
if (FLOAT_IS_ZERO(den)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, cur_opcode + 4,
EXCEPTION_DIV_BY_ZERO,
@@ -18948,13 +18951,13 @@
opcode_t *
Parrot_div_n_nc_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- FLOATVAL den = CONST(3).u.number;
+ FLOATVAL den = NCONST(3);
if (FLOAT_IS_ZERO(den)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, cur_opcode + 4,
EXCEPTION_DIV_BY_ZERO,
"Divide by zero");return (opcode_t *)handler;
}
- NREG(1) = CONST(2).u.number / den;
+ NREG(1) = NCONST(2) / den;
return (opcode_t *)cur_opcode + 4;}
@@ -18975,7 +18978,7 @@
opcode_t *
Parrot_div_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_divide_int(interp, PREG(2), cur_opcode[3], PREG(1));
+ PREG(1) = VTABLE_divide_int(interp, PREG(2), ICONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -18989,7 +18992,7 @@
opcode_t *
Parrot_div_p_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_divide_float(interp, PREG(2), CONST(3).u.number, PREG(1));
+ PREG(1) = VTABLE_divide_float(interp, PREG(2), NCONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -19013,7 +19016,7 @@
opcode_t *
Parrot_fdiv_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- INTVAL den = cur_opcode[2];
+ INTVAL den = ICONST(2);
FLOATVAL f;
if (den == 0) {
@@ -19043,7 +19046,7 @@
opcode_t *
Parrot_fdiv_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- FLOATVAL den = CONST(2).u.number;
+ FLOATVAL den = NCONST(2);
if (FLOAT_IS_ZERO(den)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, cur_opcode + 3,
EXCEPTION_DIV_BY_ZERO,
@@ -19070,7 +19073,7 @@
opcode_t *
Parrot_fdiv_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_floor_divide_int(interp, PREG(1), cur_opcode[2]);
+ VTABLE_i_floor_divide_int(interp, PREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -19084,7 +19087,7 @@
opcode_t *
Parrot_fdiv_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_floor_divide_float(interp, PREG(1), CONST(2).u.number);
+ VTABLE_i_floor_divide_float(interp, PREG(1), NCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -19117,7 +19120,7 @@
"Divide by zero");return (opcode_t *)handler;
}
- f = floor((FLOATVAL)cur_opcode[2] / den);
+ f = floor((FLOATVAL)ICONST(2) / den);
IREG(1) = (INTVAL)f;
return (opcode_t *)cur_opcode + 4;}
@@ -19125,7 +19128,7 @@
opcode_t *
Parrot_fdiv_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- INTVAL den = cur_opcode[3];
+ INTVAL den = ICONST(3);
FLOATVAL f;
if (den == 0) {
@@ -19161,14 +19164,14 @@
EXCEPTION_DIV_BY_ZERO,
"Divide by zero");return (opcode_t *)handler;
}
- NREG(1) = floor(CONST(2).u.number / den);
+ NREG(1) = floor(NCONST(2) / den);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_fdiv_n_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- FLOATVAL den = CONST(3).u.number;
+ FLOATVAL den = NCONST(3);
if (FLOAT_IS_ZERO(den)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, cur_opcode + 4,
EXCEPTION_DIV_BY_ZERO,
@@ -19195,7 +19198,7 @@
opcode_t *
Parrot_fdiv_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_floor_divide_int(interp, PREG(2), cur_opcode[3], PREG(1));
+ PREG(1) = VTABLE_floor_divide_int(interp, PREG(2), ICONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -19209,7 +19212,7 @@
opcode_t *
Parrot_fdiv_p_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_floor_divide_float(interp, PREG(2), CONST(3).u.number, PREG(1));
+ PREG(1) = VTABLE_floor_divide_float(interp, PREG(2), NCONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -19288,7 +19291,7 @@
opcode_t *
Parrot_mod_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = intval_mod(IREG(1), cur_opcode[2]);
+ IREG(1) = intval_mod(IREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -19302,7 +19305,7 @@
opcode_t *
Parrot_mod_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = floatval_mod(NREG(1), CONST(2).u.number);
+ NREG(1) = floatval_mod(NREG(1), NCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -19323,7 +19326,7 @@
opcode_t *
Parrot_mod_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_modulus_int(interp, PREG(1), cur_opcode[2]);
+ VTABLE_i_modulus_int(interp, PREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -19337,7 +19340,7 @@
opcode_t *
Parrot_mod_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_modulus_float(interp, PREG(1), CONST(2).u.number);
+ VTABLE_i_modulus_float(interp, PREG(1), NCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -19351,14 +19354,14 @@
opcode_t *
Parrot_mod_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = intval_mod(cur_opcode[2], IREG(3));
+ IREG(1) = intval_mod(ICONST(2), IREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_mod_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = intval_mod(IREG(2), cur_opcode[3]);
+ IREG(1) = intval_mod(IREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -19372,14 +19375,14 @@
opcode_t *
Parrot_mod_n_nc_n(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = floatval_mod(CONST(2).u.number, NREG(3));
+ NREG(1) = floatval_mod(NCONST(2), NREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_mod_n_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = floatval_mod(NREG(2), CONST(3).u.number);
+ NREG(1) = floatval_mod(NREG(2), NCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -19400,7 +19403,7 @@
opcode_t *
Parrot_mod_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_modulus_int(interp, PREG(2), cur_opcode[3], PREG(1));
+ PREG(1) = VTABLE_modulus_int(interp, PREG(2), ICONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -19414,7 +19417,7 @@
opcode_t *
Parrot_mod_p_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_modulus_float(interp, PREG(2), CONST(3).u.number, PREG(1));
+ PREG(1) = VTABLE_modulus_float(interp, PREG(2), NCONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -19428,7 +19431,7 @@
opcode_t *
Parrot_mul_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) *= cur_opcode[2];
+ IREG(1) *= ICONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -19442,7 +19445,7 @@
opcode_t *
Parrot_mul_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) *= CONST(2).u.number;
+ NREG(1) *= NCONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -19463,7 +19466,7 @@
opcode_t *
Parrot_mul_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_multiply_int(interp, PREG(1), cur_opcode[2]);
+ VTABLE_i_multiply_int(interp, PREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -19477,7 +19480,7 @@
opcode_t *
Parrot_mul_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_multiply_float(interp, PREG(1), CONST(2).u.number);
+ VTABLE_i_multiply_float(interp, PREG(1), NCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -19491,14 +19494,14 @@
opcode_t *
Parrot_mul_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = cur_opcode[2] * IREG(3);
+ IREG(1) = ICONST(2) * IREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_mul_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = IREG(2) * cur_opcode[3];
+ IREG(1) = IREG(2) * ICONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -19512,14 +19515,14 @@
opcode_t *
Parrot_mul_n_nc_n(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = CONST(2).u.number * NREG(3);
+ NREG(1) = NCONST(2) * NREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_mul_n_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = NREG(2) * CONST(3).u.number;
+ NREG(1) = NREG(2) * NCONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -19540,7 +19543,7 @@
opcode_t *
Parrot_mul_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_multiply_int(interp, PREG(2), cur_opcode[3], PREG(1));
+ PREG(1) = VTABLE_multiply_int(interp, PREG(2), ICONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -19554,7 +19557,7 @@
opcode_t *
Parrot_mul_p_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_multiply_float(interp, PREG(2), CONST(3).u.number, PREG(1));
+ PREG(1) = VTABLE_multiply_float(interp, PREG(2), NCONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -19610,7 +19613,7 @@
opcode_t *
Parrot_sub_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) -= cur_opcode[2];
+ IREG(1) -= ICONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -19624,7 +19627,7 @@
opcode_t *
Parrot_sub_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) -= CONST(2).u.number;
+ NREG(1) -= NCONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -19645,7 +19648,7 @@
opcode_t *
Parrot_sub_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_subtract_int(interp, PREG(1), cur_opcode[2]);
+ VTABLE_i_subtract_int(interp, PREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -19659,7 +19662,7 @@
opcode_t *
Parrot_sub_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_subtract_float(interp, PREG(1), CONST(2).u.number);
+ VTABLE_i_subtract_float(interp, PREG(1), NCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -19673,14 +19676,14 @@
opcode_t *
Parrot_sub_i_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = cur_opcode[2] - IREG(3);
+ IREG(1) = ICONST(2) - IREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_sub_i_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = IREG(2) - cur_opcode[3];
+ IREG(1) = IREG(2) - ICONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -19694,14 +19697,14 @@
opcode_t *
Parrot_sub_n_nc_n(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = CONST(2).u.number - NREG(3);
+ NREG(1) = NCONST(2) - NREG(3);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_sub_n_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = NREG(2) - CONST(3).u.number;
+ NREG(1) = NREG(2) - NCONST(3);
return (opcode_t *)cur_opcode + 4;}
@@ -19722,7 +19725,7 @@
opcode_t *
Parrot_sub_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_subtract_int(interp, PREG(2), cur_opcode[3], PREG(1));
+ PREG(1) = VTABLE_subtract_int(interp, PREG(2), ICONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -19736,7 +19739,7 @@
opcode_t *
Parrot_sub_p_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_subtract_float(interp, PREG(2), CONST(3).u.number, PREG(1));
+ PREG(1) = VTABLE_subtract_float(interp, PREG(2), NCONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -19788,7 +19791,7 @@
Parrot_callmethodcc_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const object = PREG(1);
- STRING * const meth = CONST(2).u.string;
+ STRING * const meth = SCONST(2);
opcode_t * const next = cur_opcode + 3;
PMC * const method_pmc = VTABLE_find_method(interp, object, meth);
@@ -19868,7 +19871,7 @@
Parrot_callmethod_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const object = PREG(1);
- STRING * const meth = CONST(2).u.string;
+ STRING * const meth = SCONST(2);
opcode_t * const next = cur_opcode + 4;
PMC * const method_pmc = VTABLE_find_method(interp, object, meth);
@@ -19941,7 +19944,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
opcode_t * const next = cur_opcode + 3;
PMC * const object = PREG(1);
- STRING * const meth = CONST(2).u.string;
+ STRING * const meth = SCONST(2);
PMC * const method_pmc = VTABLE_find_method(interp, object, meth);
opcode_t *dest;
@@ -19991,7 +19994,7 @@
opcode_t *
Parrot_addmethod_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_add_method(interp, PREG(1), CONST(2).u.string, PREG(3));
+ VTABLE_add_method(interp, PREG(1), SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -20005,7 +20008,7 @@
opcode_t *
Parrot_can_i_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = VTABLE_can(interp, PREG(2), CONST(3).u.string);
+ IREG(1) = VTABLE_can(interp, PREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -20019,7 +20022,7 @@
opcode_t *
Parrot_does_i_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = CONST(3).u.string ? VTABLE_does(interp, PREG(2), CONST(3).u.string) : 0;
+ IREG(1) = SCONST(3) ? VTABLE_does(interp, PREG(2), SCONST(3)) : 0;
return (opcode_t *)cur_opcode + 4;}
@@ -20033,7 +20036,7 @@
opcode_t *
Parrot_does_i_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = CONST(3).u.key ? VTABLE_does_pmc(interp, PREG(2), CONST(3).u.key) : 0;
+ IREG(1) = PCONST(3) ? VTABLE_does_pmc(interp, PREG(2), PCONST(3)) : 0;
return (opcode_t *)cur_opcode + 4;}
@@ -20047,7 +20050,7 @@
opcode_t *
Parrot_isa_i_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = CONST(3).u.string ? VTABLE_isa(interp, PREG(2), CONST(3).u.string) : 0;
+ IREG(1) = SCONST(3) ? VTABLE_isa(interp, PREG(2), SCONST(3)) : 0;
return (opcode_t *)cur_opcode + 4;}
@@ -20061,7 +20064,7 @@
opcode_t *
Parrot_isa_i_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = CONST(3).u.key ? VTABLE_isa_pmc(interp, PREG(2), CONST(3).u.key) : 0;
+ IREG(1) = PCONST(3) ? VTABLE_isa_pmc(interp, PREG(2), PCONST(3)) : 0;
return (opcode_t *)cur_opcode + 4;}
@@ -20078,7 +20081,7 @@
Parrot_newclass_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const name = Parrot_pmc_new(interp, enum_class_String);
- VTABLE_set_string_native(interp, name, CONST(2).u.string);
+ VTABLE_set_string_native(interp, name, SCONST(2));
PREG(1) = Parrot_pmc_new_init(interp, enum_class_Class, name);
return (opcode_t *)cur_opcode + 3;}
@@ -20093,7 +20096,7 @@
opcode_t *
Parrot_newclass_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_pmc_new_init(interp, enum_class_Class, CONST(2).u.key);
+ PREG(1) = Parrot_pmc_new_init(interp, enum_class_Class, PCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -20115,13 +20118,13 @@
opcode_t *
Parrot_subclass_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const parent_class = Parrot_oo_get_class(interp, CONST(2).u.key);
+ PMC * const parent_class = Parrot_oo_get_class(interp, PCONST(2));
opcode_t * const next = cur_opcode + 3;
if (PMC_IS_NULL(parent_class)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, next,
EXCEPTION_NO_CLASS,
- "Class '%Ss' doesn't exist", VTABLE_get_string(interp, CONST(2).u.key));return (opcode_t *)handler;
+ "Class '%Ss' doesn't exist", VTABLE_get_string(interp, PCONST(2)));return (opcode_t *)handler;
}
PREG(1) = Parrot_pmc_new(interp, enum_class_Class);
VTABLE_add_parent(interp, PREG(1), parent_class);return (opcode_t *)next;
@@ -20145,13 +20148,13 @@
opcode_t *
Parrot_subclass_p_pc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const parent_class = Parrot_oo_get_class(interp, CONST(2).u.key);
+ PMC * const parent_class = Parrot_oo_get_class(interp, PCONST(2));
opcode_t * const next = cur_opcode + 4;
if (PMC_IS_NULL(parent_class)) {
opcode_t * handler = Parrot_ex_throw_from_op_args(interp, next,
EXCEPTION_NO_CLASS,
- "Class '%Ss' doesn't exist", VTABLE_get_string(interp, CONST(2).u.key));return (opcode_t *)handler;
+ "Class '%Ss' doesn't exist", VTABLE_get_string(interp, PCONST(2)));return (opcode_t *)handler;
}
PREG(1) = Parrot_oo_newclass_from_str(interp, SREG(3));
VTABLE_add_parent(interp, PREG(1), parent_class);return (opcode_t *)next;
@@ -20168,22 +20171,22 @@
EXCEPTION_NO_CLASS,
"Class '%Ss' doesn't exist", VTABLE_get_string(interp, PREG(2)));return (opcode_t *)handler;
}
- PREG(1) = Parrot_oo_newclass_from_str(interp, CONST(3).u.string);
+ PREG(1) = Parrot_oo_newclass_from_str(interp, SCONST(3));
VTABLE_add_parent(interp, PREG(1), parent_class);return (opcode_t *)next;
}
opcode_t *
Parrot_subclass_p_pc_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const parent_class = Parrot_oo_get_class(interp, CONST(2).u.key);
+ PMC * const parent_class = Parrot_oo_get_class(interp, PCONST(2));
opcode_t * const next = cur_opcode + 4;
if (PMC_IS_NULL(parent_class)) {
opcode_t * handler = Parrot_ex_throw_from_op_args(interp, next,
EXCEPTION_NO_CLASS,
- "Class '%Ss' doesn't exist", VTABLE_get_string(interp, CONST(2).u.key));return (opcode_t *)handler;
+ "Class '%Ss' doesn't exist", VTABLE_get_string(interp, PCONST(2)));return (opcode_t *)handler;
}
- PREG(1) = Parrot_oo_newclass_from_str(interp, CONST(3).u.string);
+ PREG(1) = Parrot_oo_newclass_from_str(interp, SCONST(3));
VTABLE_add_parent(interp, PREG(1), parent_class);return (opcode_t *)next;
}
@@ -20205,13 +20208,13 @@
opcode_t *
Parrot_subclass_p_pc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const parent_class = Parrot_oo_get_class(interp, CONST(2).u.key);
+ PMC * const parent_class = Parrot_oo_get_class(interp, PCONST(2));
opcode_t * const next = cur_opcode + 4;
if (PMC_IS_NULL(parent_class)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, next,
EXCEPTION_NO_CLASS,
- "Class '%Ss' doesn't exist", VTABLE_get_string(interp, CONST(2).u.key));return (opcode_t *)handler;
+ "Class '%Ss' doesn't exist", VTABLE_get_string(interp, PCONST(2)));return (opcode_t *)handler;
}
PREG(1) = Parrot_pmc_new_init(interp, enum_class_Class, PREG(3));
VTABLE_add_parent(interp, PREG(1), parent_class);return (opcode_t *)next;
@@ -20228,22 +20231,22 @@
EXCEPTION_NO_CLASS,
"Class '%Ss' doesn't exist", VTABLE_get_string(interp, PREG(2)));return (opcode_t *)handler;
}
- PREG(1) = Parrot_pmc_new_init(interp, enum_class_Class, CONST(3).u.key);
+ PREG(1) = Parrot_pmc_new_init(interp, enum_class_Class, PCONST(3));
VTABLE_add_parent(interp, PREG(1), parent_class);return (opcode_t *)next;
}
opcode_t *
Parrot_subclass_p_pc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const parent_class = Parrot_oo_get_class(interp, CONST(2).u.key);
+ PMC * const parent_class = Parrot_oo_get_class(interp, PCONST(2));
opcode_t * const next = cur_opcode + 4;
if (PMC_IS_NULL(parent_class)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, next,
EXCEPTION_NO_CLASS,
- "Class '%Ss' doesn't exist", VTABLE_get_string(interp, CONST(2).u.key));return (opcode_t *)handler;
+ "Class '%Ss' doesn't exist", VTABLE_get_string(interp, PCONST(2)));return (opcode_t *)handler;
}
- PREG(1) = Parrot_pmc_new_init(interp, enum_class_Class, CONST(3).u.key);
+ PREG(1) = Parrot_pmc_new_init(interp, enum_class_Class, PCONST(3));
VTABLE_add_parent(interp, PREG(1), parent_class);return (opcode_t *)next;
}
@@ -20266,13 +20269,13 @@
opcode_t *
Parrot_subclass_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const parent_class = Parrot_oo_get_class_str(interp, CONST(2).u.string);
+ PMC * const parent_class = Parrot_oo_get_class_str(interp, SCONST(2));
opcode_t * const next = cur_opcode + 3;
if (PMC_IS_NULL(parent_class)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, next,
EXCEPTION_NO_CLASS,
- "Class '%Ss' doesn't exist", CONST(2).u.string);return (opcode_t *)handler;
+ "Class '%Ss' doesn't exist", SCONST(2));return (opcode_t *)handler;
}
PREG(1) = Parrot_pmc_new(interp, enum_class_Class);
@@ -20298,13 +20301,13 @@
opcode_t *
Parrot_subclass_p_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const parent_class = Parrot_oo_get_class_str(interp, CONST(2).u.string);
+ PMC * const parent_class = Parrot_oo_get_class_str(interp, SCONST(2));
opcode_t * const next = cur_opcode + 4;
if (PMC_IS_NULL(parent_class)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, next,
EXCEPTION_NO_CLASS,
- "Class '%Ss' doesn't exist", CONST(2).u.string);return (opcode_t *)handler;
+ "Class '%Ss' doesn't exist", SCONST(2));return (opcode_t *)handler;
}
PREG(1) = Parrot_oo_newclass_from_str(interp, SREG(3));
@@ -20323,23 +20326,23 @@
"Class '%Ss' doesn't exist", SREG(2));return (opcode_t *)handler;
}
- PREG(1) = Parrot_oo_newclass_from_str(interp, CONST(3).u.string);
+ PREG(1) = Parrot_oo_newclass_from_str(interp, SCONST(3));
VTABLE_add_parent(interp, PREG(1), parent_class);return (opcode_t *)next;
}
opcode_t *
Parrot_subclass_p_sc_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const parent_class = Parrot_oo_get_class_str(interp, CONST(2).u.string);
+ PMC * const parent_class = Parrot_oo_get_class_str(interp, SCONST(2));
opcode_t * const next = cur_opcode + 4;
if (PMC_IS_NULL(parent_class)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, next,
EXCEPTION_NO_CLASS,
- "Class '%Ss' doesn't exist", CONST(2).u.string);return (opcode_t *)handler;
+ "Class '%Ss' doesn't exist", SCONST(2));return (opcode_t *)handler;
}
- PREG(1) = Parrot_oo_newclass_from_str(interp, CONST(3).u.string);
+ PREG(1) = Parrot_oo_newclass_from_str(interp, SCONST(3));
VTABLE_add_parent(interp, PREG(1), parent_class);return (opcode_t *)next;
}
@@ -20362,13 +20365,13 @@
opcode_t *
Parrot_subclass_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const parent_class = Parrot_oo_get_class_str(interp, CONST(2).u.string);
+ PMC * const parent_class = Parrot_oo_get_class_str(interp, SCONST(2));
opcode_t * const next = cur_opcode + 4;
if (PMC_IS_NULL(parent_class)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, next,
EXCEPTION_NO_CLASS,
- "Class '%Ss' doesn't exist", CONST(2).u.string);return (opcode_t *)handler;
+ "Class '%Ss' doesn't exist", SCONST(2));return (opcode_t *)handler;
}
PREG(1) = Parrot_pmc_new_init(interp, enum_class_Class, PREG(3));
@@ -20387,23 +20390,23 @@
"Class '%Ss' doesn't exist", SREG(2));return (opcode_t *)handler;
}
- PREG(1) = Parrot_pmc_new_init(interp, enum_class_Class, CONST(3).u.key);
+ PREG(1) = Parrot_pmc_new_init(interp, enum_class_Class, PCONST(3));
VTABLE_add_parent(interp, PREG(1), parent_class);return (opcode_t *)next;
}
opcode_t *
Parrot_subclass_p_sc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const parent_class = Parrot_oo_get_class_str(interp, CONST(2).u.string);
+ PMC * const parent_class = Parrot_oo_get_class_str(interp, SCONST(2));
opcode_t * const next = cur_opcode + 4;
if (PMC_IS_NULL(parent_class)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, next,
EXCEPTION_NO_CLASS,
- "Class '%Ss' doesn't exist", CONST(2).u.string);return (opcode_t *)handler;
+ "Class '%Ss' doesn't exist", SCONST(2));return (opcode_t *)handler;
}
- PREG(1) = Parrot_pmc_new_init(interp, enum_class_Class, CONST(3).u.key);
+ PREG(1) = Parrot_pmc_new_init(interp, enum_class_Class, PCONST(3));
VTABLE_add_parent(interp, PREG(1), parent_class);return (opcode_t *)next;
}
@@ -20417,7 +20420,7 @@
opcode_t *
Parrot_get_class_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_oo_get_class_str(interp, CONST(2).u.string);
+ PREG(1) = Parrot_oo_get_class_str(interp, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -20431,7 +20434,7 @@
opcode_t *
Parrot_get_class_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_oo_get_class(interp, CONST(2).u.key);
+ PREG(1) = Parrot_oo_get_class(interp, PCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -20473,7 +20476,7 @@
opcode_t *
Parrot_addattribute_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_add_attribute(interp, PREG(1), CONST(2).u.string, PMCNULL);
+ VTABLE_add_attribute(interp, PREG(1), SCONST(2), PMCNULL);
return (opcode_t *)cur_opcode + 3;}
@@ -20487,7 +20490,7 @@
opcode_t *
Parrot_removeattribute_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_remove_attribute(interp, PREG(1), CONST(2).u.string);
+ VTABLE_remove_attribute(interp, PREG(1), SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -20501,7 +20504,7 @@
opcode_t *
Parrot_getattribute_p_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_attr_str(interp, PREG(2), CONST(3).u.string);
+ PREG(1) = VTABLE_get_attr_str(interp, PREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -20515,21 +20518,21 @@
opcode_t *
Parrot_getattribute_p_p_pc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_attr_keyed(interp, PREG(2), CONST(3).u.key, SREG(4));
+ PREG(1) = VTABLE_get_attr_keyed(interp, PREG(2), PCONST(3), SREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_getattribute_p_p_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_attr_keyed(interp, PREG(2), PREG(3), CONST(4).u.string);
+ PREG(1) = VTABLE_get_attr_keyed(interp, PREG(2), PREG(3), SCONST(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_getattribute_p_p_pc_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_attr_keyed(interp, PREG(2), CONST(3).u.key, CONST(4).u.string);
+ PREG(1) = VTABLE_get_attr_keyed(interp, PREG(2), PCONST(3), SCONST(4));
return (opcode_t *)cur_opcode + 5;}
@@ -20543,7 +20546,7 @@
opcode_t *
Parrot_setattribute_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_attr_str(interp, PREG(1), CONST(2).u.string, PREG(3));
+ VTABLE_set_attr_str(interp, PREG(1), SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -20557,21 +20560,21 @@
opcode_t *
Parrot_setattribute_p_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_attr_keyed(interp, PREG(1), CONST(2).u.key, SREG(3), PREG(4));
+ VTABLE_set_attr_keyed(interp, PREG(1), PCONST(2), SREG(3), PREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_setattribute_p_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_attr_keyed(interp, PREG(1), PREG(2), CONST(3).u.string, PREG(4));
+ VTABLE_set_attr_keyed(interp, PREG(1), PREG(2), SCONST(3), PREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_setattribute_p_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_attr_keyed(interp, PREG(1), CONST(2).u.key, CONST(3).u.string, PREG(4));
+ VTABLE_set_attr_keyed(interp, PREG(1), PCONST(2), SCONST(3), PREG(4));
return (opcode_t *)cur_opcode + 5;}
@@ -20585,7 +20588,7 @@
opcode_t *
Parrot_inspect_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_inspect(interp, CONST(2).u.key);
+ PREG(1) = VTABLE_inspect(interp, PCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -20599,21 +20602,21 @@
opcode_t *
Parrot_inspect_p_pc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_inspect_str(interp, CONST(2).u.key, SREG(3));
+ PREG(1) = VTABLE_inspect_str(interp, PCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_inspect_p_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_inspect_str(interp, PREG(2), CONST(3).u.string);
+ PREG(1) = VTABLE_inspect_str(interp, PREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_inspect_p_pc_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_inspect_str(interp, CONST(2).u.key, CONST(3).u.string);
+ PREG(1) = VTABLE_inspect_str(interp, PCONST(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -20642,7 +20645,7 @@
opcode_t *
Parrot_new_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const name = CONST(2).u.string;
+ STRING * const name = SCONST(2);
PMC * const _class = Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp))
? Parrot_oo_get_class_str(interp, name)
: PMCNULL;
@@ -20686,7 +20689,7 @@
opcode_t *
Parrot_new_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const name = CONST(2).u.string;
+ STRING * const name = SCONST(2);
PMC * const _class = Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp))
? Parrot_oo_get_class_str(interp, name)
: PMCNULL;
@@ -20714,7 +20717,7 @@
: PMCNULL;
if (!PMC_IS_NULL(_class))
- PREG(1) = VTABLE_instantiate(interp, _class, CONST(3).u.key);
+ PREG(1) = VTABLE_instantiate(interp, _class, PCONST(3));
else {
const INTVAL type = Parrot_pmc_get_type_str(interp, name);
if (type <= 0) {
@@ -20722,7 +20725,7 @@
EXCEPTION_NO_CLASS,
"Class '%Ss' not found", name);return (opcode_t *)dest;
}
- PREG(1) = Parrot_pmc_new_init(interp, type, CONST(3).u.key);
+ PREG(1) = Parrot_pmc_new_init(interp, type, PCONST(3));
}
return (opcode_t *)cur_opcode + 4;}
@@ -20730,13 +20733,13 @@
opcode_t *
Parrot_new_p_sc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const name = CONST(2).u.string;
+ STRING * const name = SCONST(2);
PMC * const _class = Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp))
? Parrot_oo_get_class_str(interp, name)
: PMCNULL;
if (!PMC_IS_NULL(_class))
- PREG(1) = VTABLE_instantiate(interp, _class, CONST(3).u.key);
+ PREG(1) = VTABLE_instantiate(interp, _class, PCONST(3));
else {
const INTVAL type = Parrot_pmc_get_type_str(interp, name);
if (type <= 0) {
@@ -20744,7 +20747,7 @@
EXCEPTION_NO_CLASS,
"Class '%Ss' not found", name);return (opcode_t *)dest;
}
- PREG(1) = Parrot_pmc_new_init(interp, type, CONST(3).u.key);
+ PREG(1) = Parrot_pmc_new_init(interp, type, PCONST(3));
}
return (opcode_t *)cur_opcode + 4;}
@@ -20772,7 +20775,7 @@
opcode_t *
Parrot_new_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const name_key = CONST(2).u.key;
+ PMC * const name_key = PCONST(2);
PMC * const _class = Parrot_oo_get_class(interp, name_key);
if (!PMC_IS_NULL(_class))
@@ -20812,7 +20815,7 @@
opcode_t *
Parrot_new_p_pc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const name_key = CONST(2).u.key;
+ PMC * const name_key = PCONST(2);
PMC * const _class = Parrot_oo_get_class(interp, name_key);
if (!PMC_IS_NULL(_class))
@@ -20836,7 +20839,7 @@
PMC * const _class = Parrot_oo_get_class(interp, name_key);
if (!PMC_IS_NULL(_class))
- PREG(1) = VTABLE_instantiate(interp, _class, CONST(3).u.key);
+ PREG(1) = VTABLE_instantiate(interp, _class, PCONST(3));
else {
const INTVAL type = Parrot_pmc_get_type(interp, name_key);
if (type <= 0) {
@@ -20844,7 +20847,7 @@
EXCEPTION_NO_CLASS,
"Class '%Ss' not found", VTABLE_get_repr(interp, name_key));return (opcode_t *)dest;
}
- PREG(1) = Parrot_pmc_new_init(interp, type, CONST(3).u.key);
+ PREG(1) = Parrot_pmc_new_init(interp, type, PCONST(3));
}
return (opcode_t *)cur_opcode + 4;}
@@ -20852,11 +20855,11 @@
opcode_t *
Parrot_new_p_pc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const name_key = CONST(2).u.key;
+ PMC * const name_key = PCONST(2);
PMC * const _class = Parrot_oo_get_class(interp, name_key);
if (!PMC_IS_NULL(_class))
- PREG(1) = VTABLE_instantiate(interp, _class, CONST(3).u.key);
+ PREG(1) = VTABLE_instantiate(interp, _class, PCONST(3));
else {
const INTVAL type = Parrot_pmc_get_type(interp, name_key);
if (type <= 0) {
@@ -20864,7 +20867,7 @@
EXCEPTION_NO_CLASS,
"Class '%Ss' not found", VTABLE_get_repr(interp, name_key));return (opcode_t *)dest;
}
- PREG(1) = Parrot_pmc_new_init(interp, type, CONST(3).u.key);
+ PREG(1) = Parrot_pmc_new_init(interp, type, PCONST(3));
}
return (opcode_t *)cur_opcode + 4;}
@@ -20892,7 +20895,7 @@
opcode_t *
Parrot_root_new_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const key = CONST(2).u.key;
+ PMC * const key = PCONST(2);
PMC * const root_ns = interp->root_namespace;
PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
@@ -20932,7 +20935,7 @@
opcode_t *
Parrot_root_new_p_pc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const key = CONST(2).u.key;
+ PMC * const key = PCONST(2);
PMC * const root_ns = interp->root_namespace;
PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
@@ -20960,7 +20963,7 @@
if (!PMC_IS_NULL(ns))
classobj = Parrot_oo_get_class(interp, ns);
if (!PMC_IS_NULL(classobj))
- PREG(1) = VTABLE_instantiate(interp, classobj, CONST(3).u.key);
+ PREG(1) = VTABLE_instantiate(interp, classobj, PCONST(3));
else {
opcode_t * const dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 4,
EXCEPTION_NO_CLASS,
@@ -20972,7 +20975,7 @@
opcode_t *
Parrot_root_new_p_pc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const key = CONST(2).u.key;
+ PMC * const key = PCONST(2);
PMC * const root_ns = interp->root_namespace;
PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, key);
PMC * classobj = PMCNULL;
@@ -20980,7 +20983,7 @@
if (!PMC_IS_NULL(ns))
classobj = Parrot_oo_get_class(interp, ns);
if (!PMC_IS_NULL(classobj))
- PREG(1) = VTABLE_instantiate(interp, classobj, CONST(3).u.key);
+ PREG(1) = VTABLE_instantiate(interp, classobj, PCONST(3));
else {
opcode_t * const dest = Parrot_ex_throw_from_op_args(interp, cur_opcode + 4,
EXCEPTION_NO_CLASS,
@@ -21027,11 +21030,11 @@
Parrot_find_method_p_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
opcode_t * const resume = cur_opcode + 4;
- PREG(1) = VTABLE_find_method(interp, PREG(2), CONST(3).u.string);
+ PREG(1) = VTABLE_find_method(interp, PREG(2), SCONST(3));
if (PMC_IS_NULL(PREG(1)) || !VTABLE_defined(interp, PREG(1))) {
opcode_t * const dest = Parrot_ex_throw_from_op_args(interp, resume,
EXCEPTION_METHOD_NOT_FOUND,
- "Method '%Ss' not found for invocant of class '%Ss'", CONST(3).u.string,
+ "Method '%Ss' not found for invocant of class '%Ss'", SCONST(3),
VTABLE_get_string(interp, VTABLE_get_class(interp, PREG(2))));return (opcode_t *)dest;
}return (opcode_t *)resume;
}
@@ -21053,7 +21056,7 @@
opcode_t *
Parrot_defined_i_p_kic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = PMC_IS_NULL(PREG(2)) ? 0 : VTABLE_defined_keyed_int(interp, PREG(2), cur_opcode[3]);
+ IREG(1) = PMC_IS_NULL(PREG(2)) ? 0 : VTABLE_defined_keyed_int(interp, PREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21067,7 +21070,7 @@
opcode_t *
Parrot_defined_i_p_kc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = PMC_IS_NULL(PREG(2)) ? 0 : VTABLE_defined_keyed(interp, PREG(2), CONST(3).u.key);
+ IREG(1) = PMC_IS_NULL(PREG(2)) ? 0 : VTABLE_defined_keyed(interp, PREG(2), PCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21081,7 +21084,7 @@
opcode_t *
Parrot_exists_i_p_kic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = PMC_IS_NULL(PREG(2)) ? 0 : VTABLE_exists_keyed_int(interp, PREG(2), cur_opcode[3]);
+ IREG(1) = PMC_IS_NULL(PREG(2)) ? 0 : VTABLE_exists_keyed_int(interp, PREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21095,7 +21098,7 @@
opcode_t *
Parrot_exists_i_p_kc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = PMC_IS_NULL(PREG(2)) ? 0: VTABLE_exists_keyed(interp, PREG(2), CONST(3).u.key);
+ IREG(1) = PMC_IS_NULL(PREG(2)) ? 0: VTABLE_exists_keyed(interp, PREG(2), PCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21109,7 +21112,7 @@
opcode_t *
Parrot_delete_p_kc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_delete_keyed(interp, PREG(1), CONST(2).u.key);
+ VTABLE_delete_keyed(interp, PREG(1), PCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21123,7 +21126,7 @@
opcode_t *
Parrot_delete_p_kic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_delete_keyed_int(interp, PREG(1), cur_opcode[2]);
+ VTABLE_delete_keyed_int(interp, PREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21144,7 +21147,7 @@
opcode_t *
Parrot_push_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_push_integer(interp, PREG(1), cur_opcode[2]);
+ VTABLE_push_integer(interp, PREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21158,7 +21161,7 @@
opcode_t *
Parrot_push_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_push_float(interp, PREG(1), CONST(2).u.number);
+ VTABLE_push_float(interp, PREG(1), NCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21172,7 +21175,7 @@
opcode_t *
Parrot_push_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_push_string(interp, PREG(1), CONST(2).u.string);
+ VTABLE_push_string(interp, PREG(1), SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21221,7 +21224,7 @@
opcode_t *
Parrot_unshift_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_unshift_integer(interp, PREG(1), cur_opcode[2]);
+ VTABLE_unshift_integer(interp, PREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21235,7 +21238,7 @@
opcode_t *
Parrot_unshift_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_unshift_float(interp, PREG(1), CONST(2).u.number);
+ VTABLE_unshift_float(interp, PREG(1), NCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21249,7 +21252,7 @@
opcode_t *
Parrot_unshift_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_unshift_string(interp, PREG(1), CONST(2).u.string);
+ VTABLE_unshift_string(interp, PREG(1), SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21298,21 +21301,21 @@
opcode_t *
Parrot_splice_p_p_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_splice(interp, PREG(1), PREG(2), cur_opcode[3], IREG(4));
+ VTABLE_splice(interp, PREG(1), PREG(2), ICONST(3), IREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_splice_p_p_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_splice(interp, PREG(1), PREG(2), IREG(3), cur_opcode[4]);
+ VTABLE_splice(interp, PREG(1), PREG(2), IREG(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_splice_p_p_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_splice(interp, PREG(1), PREG(2), cur_opcode[3], cur_opcode[4]);
+ VTABLE_splice(interp, PREG(1), PREG(2), ICONST(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
@@ -21326,7 +21329,7 @@
opcode_t *
Parrot_setprop_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_setprop(interp, PREG(1), CONST(2).u.string, PREG(3));
+ VTABLE_setprop(interp, PREG(1), SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21340,7 +21343,7 @@
opcode_t *
Parrot_getprop_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_getprop(interp, PREG(3), CONST(2).u.string);
+ PREG(1) = VTABLE_getprop(interp, PREG(3), SCONST(2));
return (opcode_t *)cur_opcode + 4;}
@@ -21354,7 +21357,7 @@
opcode_t *
Parrot_delprop_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_delprop(interp, PREG(1), CONST(2).u.string);
+ VTABLE_delprop(interp, PREG(1), SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21382,7 +21385,7 @@
opcode_t *
Parrot_thaw_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_thaw(interp, CONST(2).u.string);
+ PREG(1) = Parrot_thaw(interp, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21396,21 +21399,21 @@
opcode_t *
Parrot_add_multi_sc_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- Parrot_mmd_add_multi_from_long_sig(interp, CONST(1).u.string, SREG(2), PREG(3));
+ Parrot_mmd_add_multi_from_long_sig(interp, SCONST(1), SREG(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_add_multi_s_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- Parrot_mmd_add_multi_from_long_sig(interp, SREG(1), CONST(2).u.string, PREG(3));
+ Parrot_mmd_add_multi_from_long_sig(interp, SREG(1), SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_add_multi_sc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- Parrot_mmd_add_multi_from_long_sig(interp, CONST(1).u.string, CONST(2).u.string, PREG(3));
+ Parrot_mmd_add_multi_from_long_sig(interp, SCONST(1), SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21424,21 +21427,21 @@
opcode_t *
Parrot_find_multi_p_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_mmd_find_multi_from_long_sig(interp, CONST(2).u.string, SREG(3));
+ PREG(1) = Parrot_mmd_find_multi_from_long_sig(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_find_multi_p_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_mmd_find_multi_from_long_sig(interp, SREG(2), CONST(3).u.string);
+ PREG(1) = Parrot_mmd_find_multi_from_long_sig(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_find_multi_p_sc_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_mmd_find_multi_from_long_sig(interp, CONST(2).u.string, CONST(3).u.string);
+ PREG(1) = Parrot_mmd_find_multi_from_long_sig(interp, SCONST(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21468,7 +21471,7 @@
Parrot_box_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PREG(1) = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
- VTABLE_set_integer_native(interp, PREG(1), cur_opcode[2]);
+ VTABLE_set_integer_native(interp, PREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21484,7 +21487,7 @@
Parrot_box_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PREG(1) = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_Float));
- VTABLE_set_number_native(interp, PREG(1), CONST(2).u.number);
+ VTABLE_set_number_native(interp, PREG(1), NCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21500,7 +21503,7 @@
Parrot_box_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PREG(1) = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_String));
- VTABLE_set_string_native(interp, PREG(1), CONST(2).u.string);
+ VTABLE_set_string_native(interp, PREG(1), SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21521,7 +21524,7 @@
opcode_t *
Parrot_morph_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_morph(interp, PREG(1), CONST(2).u.key);
+ VTABLE_morph(interp, PREG(1), PCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21539,9 +21542,9 @@
Parrot_clone_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
/* cloning a NULL STRING produces an empty STRING; TT #964 */
- SREG(1) = STRING_IS_NULL(CONST(2).u.string)
+ SREG(1) = STRING_IS_NULL(SCONST(2))
? Parrot_str_new(interp, NULL, 0)
- : CONST(2).u.string;
+ : SCONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -21555,7 +21558,7 @@
opcode_t *
Parrot_set_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = cur_opcode[2];
+ IREG(1) = ICONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -21569,7 +21572,7 @@
opcode_t *
Parrot_set_i_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (INTVAL)(CONST(2).u.number);
+ IREG(1) = (INTVAL)(NCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21583,7 +21586,7 @@
opcode_t *
Parrot_set_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_to_int(interp, CONST(2).u.string);
+ IREG(1) = Parrot_str_to_int(interp, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21597,7 +21600,7 @@
opcode_t *
Parrot_set_n_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = CONST(2).u.number;
+ NREG(1) = NCONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -21611,7 +21614,7 @@
opcode_t *
Parrot_set_n_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = (FLOATVAL)cur_opcode[2];
+ NREG(1) = (FLOATVAL)ICONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -21625,7 +21628,7 @@
opcode_t *
Parrot_set_n_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = Parrot_str_to_num(interp, CONST(2).u.string);
+ NREG(1) = Parrot_str_to_num(interp, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21653,7 +21656,7 @@
opcode_t *
Parrot_set_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = CONST(2).u.string;
+ SREG(1) = SCONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -21667,7 +21670,7 @@
opcode_t *
Parrot_set_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_from_int(interp, cur_opcode[2]);
+ SREG(1) = Parrot_str_from_int(interp, ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21681,14 +21684,14 @@
opcode_t *
Parrot_set_s_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_from_num(interp, CONST(2).u.number);
+ SREG(1) = Parrot_str_from_num(interp, NCONST(2));
return (opcode_t *)cur_opcode + 3;}
opcode_t *
Parrot_set_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = CONST(2).u.key;
+ PREG(1) = PCONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -21709,7 +21712,7 @@
opcode_t *
Parrot_set_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_integer_native(interp, PREG(1), cur_opcode[2]);
+ VTABLE_set_integer_native(interp, PREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21723,7 +21726,7 @@
opcode_t *
Parrot_set_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_number_native(interp, PREG(1), CONST(2).u.number);
+ VTABLE_set_number_native(interp, PREG(1), NCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21737,7 +21740,7 @@
opcode_t *
Parrot_set_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_string_native(interp, PREG(1), CONST(2).u.string);
+ VTABLE_set_string_native(interp, PREG(1), SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21765,7 +21768,7 @@
opcode_t *
Parrot_assign_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_integer_native(interp, PREG(1), cur_opcode[2]);
+ VTABLE_set_integer_native(interp, PREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21779,7 +21782,7 @@
opcode_t *
Parrot_assign_p_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_number_native(interp, PREG(1), CONST(2).u.number);
+ VTABLE_set_number_native(interp, PREG(1), NCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21793,7 +21796,7 @@
opcode_t *
Parrot_assign_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_assign_string_native(interp, PREG(1), CONST(2).u.string);
+ VTABLE_assign_string_native(interp, PREG(1), SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -21807,7 +21810,7 @@
opcode_t *
Parrot_assign_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = CONST(2).u.string;
+ SREG(1) = SCONST(2);
return (opcode_t *)cur_opcode + 3;}
@@ -21835,21 +21838,21 @@
opcode_t *
Parrot_set_p_kic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_integer_keyed_int(interp, PREG(1), cur_opcode[2], IREG(3));
+ VTABLE_set_integer_keyed_int(interp, PREG(1), ICONST(2), IREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_set_p_ki_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_integer_keyed_int(interp, PREG(1), IREG(2), cur_opcode[3]);
+ VTABLE_set_integer_keyed_int(interp, PREG(1), IREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_set_p_kic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_integer_keyed_int(interp, PREG(1), cur_opcode[2], cur_opcode[3]);
+ VTABLE_set_integer_keyed_int(interp, PREG(1), ICONST(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21863,21 +21866,21 @@
opcode_t *
Parrot_set_p_kic_n(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_number_keyed_int(interp, PREG(1), cur_opcode[2], NREG(3));
+ VTABLE_set_number_keyed_int(interp, PREG(1), ICONST(2), NREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_set_p_ki_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_number_keyed_int(interp, PREG(1), IREG(2), CONST(3).u.number);
+ VTABLE_set_number_keyed_int(interp, PREG(1), IREG(2), NCONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_set_p_kic_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_number_keyed_int(interp, PREG(1), cur_opcode[2], CONST(3).u.number);
+ VTABLE_set_number_keyed_int(interp, PREG(1), ICONST(2), NCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21891,21 +21894,21 @@
opcode_t *
Parrot_set_p_kic_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_string_keyed_int(interp, PREG(1), cur_opcode[2], SREG(3));
+ VTABLE_set_string_keyed_int(interp, PREG(1), ICONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_set_p_ki_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_string_keyed_int(interp, PREG(1), IREG(2), CONST(3).u.string);
+ VTABLE_set_string_keyed_int(interp, PREG(1), IREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_set_p_kic_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_string_keyed_int(interp, PREG(1), cur_opcode[2], CONST(3).u.string);
+ VTABLE_set_string_keyed_int(interp, PREG(1), ICONST(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21919,7 +21922,7 @@
opcode_t *
Parrot_set_p_kic_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_pmc_keyed_int(interp, PREG(1), cur_opcode[2], PREG(3));
+ VTABLE_set_pmc_keyed_int(interp, PREG(1), ICONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21933,7 +21936,7 @@
opcode_t *
Parrot_set_i_p_kic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = VTABLE_get_integer_keyed_int(interp, PREG(2), cur_opcode[3]);
+ IREG(1) = VTABLE_get_integer_keyed_int(interp, PREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21947,7 +21950,7 @@
opcode_t *
Parrot_set_n_p_kic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = VTABLE_get_number_keyed_int(interp, PREG(2), cur_opcode[3]);
+ NREG(1) = VTABLE_get_number_keyed_int(interp, PREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21961,7 +21964,7 @@
opcode_t *
Parrot_set_s_p_kic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = VTABLE_get_string_keyed_int(interp, PREG(2), cur_opcode[3]);
+ SREG(1) = VTABLE_get_string_keyed_int(interp, PREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21975,7 +21978,7 @@
opcode_t *
Parrot_set_p_p_kic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), cur_opcode[3]);
+ PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -21989,21 +21992,21 @@
opcode_t *
Parrot_set_p_kc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_integer_keyed(interp, PREG(1), CONST(2).u.key, IREG(3));
+ VTABLE_set_integer_keyed(interp, PREG(1), PCONST(2), IREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_set_p_k_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_integer_keyed(interp, PREG(1), PREG(2), cur_opcode[3]);
+ VTABLE_set_integer_keyed(interp, PREG(1), PREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_set_p_kc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_integer_keyed(interp, PREG(1), CONST(2).u.key, cur_opcode[3]);
+ VTABLE_set_integer_keyed(interp, PREG(1), PCONST(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22017,21 +22020,21 @@
opcode_t *
Parrot_set_p_kc_n(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_number_keyed(interp, PREG(1), CONST(2).u.key, NREG(3));
+ VTABLE_set_number_keyed(interp, PREG(1), PCONST(2), NREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_set_p_k_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_number_keyed(interp, PREG(1), PREG(2), CONST(3).u.number);
+ VTABLE_set_number_keyed(interp, PREG(1), PREG(2), NCONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_set_p_kc_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_number_keyed(interp, PREG(1), CONST(2).u.key, CONST(3).u.number);
+ VTABLE_set_number_keyed(interp, PREG(1), PCONST(2), NCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22045,21 +22048,21 @@
opcode_t *
Parrot_set_p_kc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_string_keyed(interp, PREG(1), CONST(2).u.key, SREG(3));
+ VTABLE_set_string_keyed(interp, PREG(1), PCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_set_p_k_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_string_keyed(interp, PREG(1), PREG(2), CONST(3).u.string);
+ VTABLE_set_string_keyed(interp, PREG(1), PREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_set_p_kc_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_string_keyed(interp, PREG(1), CONST(2).u.key, CONST(3).u.string);
+ VTABLE_set_string_keyed(interp, PREG(1), PCONST(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22073,7 +22076,7 @@
opcode_t *
Parrot_set_p_kc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_pmc_keyed(interp, PREG(1), CONST(2).u.key, PREG(3));
+ VTABLE_set_pmc_keyed(interp, PREG(1), PCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22087,7 +22090,7 @@
opcode_t *
Parrot_set_i_p_kc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = VTABLE_get_integer_keyed(interp, PREG(2), CONST(3).u.key);
+ IREG(1) = VTABLE_get_integer_keyed(interp, PREG(2), PCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22101,7 +22104,7 @@
opcode_t *
Parrot_set_n_p_kc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- NREG(1) = VTABLE_get_number_keyed(interp, PREG(2), CONST(3).u.key);
+ NREG(1) = VTABLE_get_number_keyed(interp, PREG(2), PCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22115,7 +22118,7 @@
opcode_t *
Parrot_set_s_p_kc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = VTABLE_get_string_keyed(interp, PREG(2), CONST(3).u.key);
+ SREG(1) = VTABLE_get_string_keyed(interp, PREG(2), PCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22129,7 +22132,7 @@
opcode_t *
Parrot_set_p_p_kc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), CONST(3).u.key);
+ PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22150,7 +22153,7 @@
opcode_t *
Parrot_clone_p_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_clone_pmc(interp, PREG(2), CONST(3).u.key);
+ PREG(1) = VTABLE_clone_pmc(interp, PREG(2), PCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22230,7 +22233,7 @@
opcode_t *
Parrot_ord_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = STRING_ord(interp, CONST(2).u.string, 0);
+ IREG(1) = STRING_ord(interp, SCONST(2), 0);
return (opcode_t *)cur_opcode + 3;}
@@ -22244,21 +22247,21 @@
opcode_t *
Parrot_ord_i_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = STRING_ord(interp, CONST(2).u.string, IREG(3));
+ IREG(1) = STRING_ord(interp, SCONST(2), IREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_ord_i_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = STRING_ord(interp, SREG(2), cur_opcode[3]);
+ IREG(1) = STRING_ord(interp, SREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_ord_i_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = STRING_ord(interp, CONST(2).u.string, cur_opcode[3]);
+ IREG(1) = STRING_ord(interp, SCONST(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22273,7 +22276,7 @@
opcode_t *
Parrot_chr_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const s = string_chr(interp, (UINTVAL)cur_opcode[2]);
+ STRING * const s = string_chr(interp, (UINTVAL)ICONST(2));
SREG(1) = s;
return (opcode_t *)cur_opcode + 3;}
@@ -22288,21 +22291,21 @@
opcode_t *
Parrot_chopn_s_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_chopn(interp, CONST(2).u.string, IREG(3));
+ SREG(1) = Parrot_str_chopn(interp, SCONST(2), IREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_chopn_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_chopn(interp, SREG(2), cur_opcode[3]);
+ SREG(1) = Parrot_str_chopn(interp, SREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_chopn_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_chopn(interp, CONST(2).u.string, cur_opcode[3]);
+ SREG(1) = Parrot_str_chopn(interp, SCONST(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22316,7 +22319,7 @@
opcode_t *
Parrot_concat_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_concat(interp, SREG(1), CONST(2).u.string);
+ SREG(1) = Parrot_str_concat(interp, SREG(1), SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -22337,7 +22340,7 @@
opcode_t *
Parrot_concat_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_concatenate_str(interp, PREG(1), CONST(2).u.string);
+ VTABLE_i_concatenate_str(interp, PREG(1), SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -22351,14 +22354,14 @@
opcode_t *
Parrot_concat_s_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_concat(interp, CONST(2).u.string, SREG(3));
+ SREG(1) = Parrot_str_concat(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_concat_s_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_concat(interp, SREG(2), CONST(3).u.string);
+ SREG(1) = Parrot_str_concat(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22372,7 +22375,7 @@
opcode_t *
Parrot_concat_p_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_concatenate_str(interp, PREG(2), CONST(3).u.string, PREG(1));
+ PREG(1) = VTABLE_concatenate_str(interp, PREG(2), SCONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -22403,31 +22406,31 @@
EXCEPTION_NEG_REPEAT,
"Cannot repeat with negative arg");return (opcode_t *)handler;
}
- SREG(1) = Parrot_str_repeat(interp, CONST(2).u.string, (UINTVAL)IREG(3));
+ SREG(1) = Parrot_str_repeat(interp, SCONST(2), (UINTVAL)IREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_repeat_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[3] < 0) {
+ if (ICONST(3) < 0) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, NULL,
EXCEPTION_NEG_REPEAT,
"Cannot repeat with negative arg");return (opcode_t *)handler;
}
- SREG(1) = Parrot_str_repeat(interp, SREG(2), (UINTVAL)cur_opcode[3]);
+ SREG(1) = Parrot_str_repeat(interp, SREG(2), (UINTVAL)ICONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_repeat_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[3] < 0) {
+ if (ICONST(3) < 0) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, NULL,
EXCEPTION_NEG_REPEAT,
"Cannot repeat with negative arg");return (opcode_t *)handler;
}
- SREG(1) = Parrot_str_repeat(interp, CONST(2).u.string, (UINTVAL)cur_opcode[3]);
+ SREG(1) = Parrot_str_repeat(interp, SCONST(2), (UINTVAL)ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22446,12 +22449,12 @@
opcode_t *
Parrot_repeat_p_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (cur_opcode[3] < 0) {
+ if (ICONST(3) < 0) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, NULL,
EXCEPTION_NEG_REPEAT,
"Cannot repeat with negative arg");return (opcode_t *)handler;
}
- PREG(1) = VTABLE_repeat_int(interp, PREG(2), cur_opcode[3], PREG(1));
+ PREG(1) = VTABLE_repeat_int(interp, PREG(2), ICONST(3), PREG(1));
return (opcode_t *)cur_opcode + 4;}
@@ -22477,7 +22480,7 @@
opcode_t *
Parrot_repeat_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_i_repeat_int(interp, PREG(1), cur_opcode[2]);
+ VTABLE_i_repeat_int(interp, PREG(1), ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -22498,7 +22501,7 @@
opcode_t *
Parrot_length_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_length(interp, CONST(2).u.string);
+ IREG(1) = Parrot_str_length(interp, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -22512,7 +22515,7 @@
opcode_t *
Parrot_bytelength_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_byte_length(interp, CONST(2).u.string);
+ IREG(1) = Parrot_str_byte_length(interp, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -22541,8 +22544,8 @@
opcode_t *
Parrot_substr_s_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- const INTVAL len = Parrot_str_byte_length(interp, CONST(2).u.string);
- SREG(1) = STRING_substr(interp, CONST(2).u.string, IREG(3), len);
+ const INTVAL len = Parrot_str_byte_length(interp, SCONST(2));
+ SREG(1) = STRING_substr(interp, SCONST(2), IREG(3), len);
return (opcode_t *)cur_opcode + 4;}
@@ -22550,15 +22553,15 @@
Parrot_substr_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
const INTVAL len = Parrot_str_byte_length(interp, SREG(2));
- SREG(1) = STRING_substr(interp, SREG(2), cur_opcode[3], len);
+ SREG(1) = STRING_substr(interp, SREG(2), ICONST(3), len);
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_substr_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- const INTVAL len = Parrot_str_byte_length(interp, CONST(2).u.string);
- SREG(1) = STRING_substr(interp, CONST(2).u.string, cur_opcode[3], len);
+ const INTVAL len = Parrot_str_byte_length(interp, SCONST(2));
+ SREG(1) = STRING_substr(interp, SCONST(2), ICONST(3), len);
return (opcode_t *)cur_opcode + 4;}
@@ -22572,49 +22575,49 @@
opcode_t *
Parrot_substr_s_sc_i_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = STRING_substr(interp, CONST(2).u.string, IREG(3), IREG(4));
+ SREG(1) = STRING_substr(interp, SCONST(2), IREG(3), IREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_s_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = STRING_substr(interp, SREG(2), cur_opcode[3], IREG(4));
+ SREG(1) = STRING_substr(interp, SREG(2), ICONST(3), IREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_sc_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = STRING_substr(interp, CONST(2).u.string, cur_opcode[3], IREG(4));
+ SREG(1) = STRING_substr(interp, SCONST(2), ICONST(3), IREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_s_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = STRING_substr(interp, SREG(2), IREG(3), cur_opcode[4]);
+ SREG(1) = STRING_substr(interp, SREG(2), IREG(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_sc_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = STRING_substr(interp, CONST(2).u.string, IREG(3), cur_opcode[4]);
+ SREG(1) = STRING_substr(interp, SCONST(2), IREG(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_s_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = STRING_substr(interp, SREG(2), cur_opcode[3], cur_opcode[4]);
+ SREG(1) = STRING_substr(interp, SREG(2), ICONST(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_sc_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = STRING_substr(interp, CONST(2).u.string, cur_opcode[3], cur_opcode[4]);
+ SREG(1) = STRING_substr(interp, SCONST(2), ICONST(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
@@ -22628,21 +22631,21 @@
opcode_t *
Parrot_substr_s_p_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = VTABLE_substr_str(interp, PREG(2), cur_opcode[3], IREG(4));
+ SREG(1) = VTABLE_substr_str(interp, PREG(2), ICONST(3), IREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_p_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = VTABLE_substr_str(interp, PREG(2), IREG(3), cur_opcode[4]);
+ SREG(1) = VTABLE_substr_str(interp, PREG(2), IREG(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_substr_s_p_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = VTABLE_substr_str(interp, PREG(2), cur_opcode[3], cur_opcode[4]);
+ SREG(1) = VTABLE_substr_str(interp, PREG(2), ICONST(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
@@ -22656,105 +22659,105 @@
opcode_t *
Parrot_replace_s_sc_i_i_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, CONST(2).u.string, IREG(3), IREG(4), SREG(5));
+ SREG(1) = Parrot_str_replace(interp, SCONST(2), IREG(3), IREG(4), SREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_s_ic_i_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, SREG(2), cur_opcode[3], IREG(4), SREG(5));
+ SREG(1) = Parrot_str_replace(interp, SREG(2), ICONST(3), IREG(4), SREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_sc_ic_i_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, CONST(2).u.string, cur_opcode[3], IREG(4), SREG(5));
+ SREG(1) = Parrot_str_replace(interp, SCONST(2), ICONST(3), IREG(4), SREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_s_i_ic_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, SREG(2), IREG(3), cur_opcode[4], SREG(5));
+ SREG(1) = Parrot_str_replace(interp, SREG(2), IREG(3), ICONST(4), SREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_sc_i_ic_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, CONST(2).u.string, IREG(3), cur_opcode[4], SREG(5));
+ SREG(1) = Parrot_str_replace(interp, SCONST(2), IREG(3), ICONST(4), SREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_s_ic_ic_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, SREG(2), cur_opcode[3], cur_opcode[4], SREG(5));
+ SREG(1) = Parrot_str_replace(interp, SREG(2), ICONST(3), ICONST(4), SREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_sc_ic_ic_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, CONST(2).u.string, cur_opcode[3], cur_opcode[4], SREG(5));
+ SREG(1) = Parrot_str_replace(interp, SCONST(2), ICONST(3), ICONST(4), SREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_s_i_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, SREG(2), IREG(3), IREG(4), CONST(5).u.string);
+ SREG(1) = Parrot_str_replace(interp, SREG(2), IREG(3), IREG(4), SCONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_sc_i_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, CONST(2).u.string, IREG(3), IREG(4), CONST(5).u.string);
+ SREG(1) = Parrot_str_replace(interp, SCONST(2), IREG(3), IREG(4), SCONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_s_ic_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, SREG(2), cur_opcode[3], IREG(4), CONST(5).u.string);
+ SREG(1) = Parrot_str_replace(interp, SREG(2), ICONST(3), IREG(4), SCONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_sc_ic_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, CONST(2).u.string, cur_opcode[3], IREG(4), CONST(5).u.string);
+ SREG(1) = Parrot_str_replace(interp, SCONST(2), ICONST(3), IREG(4), SCONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_s_i_ic_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, SREG(2), IREG(3), cur_opcode[4], CONST(5).u.string);
+ SREG(1) = Parrot_str_replace(interp, SREG(2), IREG(3), ICONST(4), SCONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_sc_i_ic_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, CONST(2).u.string, IREG(3), cur_opcode[4], CONST(5).u.string);
+ SREG(1) = Parrot_str_replace(interp, SCONST(2), IREG(3), ICONST(4), SCONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_s_ic_ic_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, SREG(2), cur_opcode[3], cur_opcode[4], CONST(5).u.string);
+ SREG(1) = Parrot_str_replace(interp, SREG(2), ICONST(3), ICONST(4), SCONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_replace_s_sc_ic_ic_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_replace(interp, CONST(2).u.string, cur_opcode[3], cur_opcode[4], CONST(5).u.string);
+ SREG(1) = Parrot_str_replace(interp, SCONST(2), ICONST(3), ICONST(4), SCONST(5));
return (opcode_t *)cur_opcode + 6;}
@@ -22768,21 +22771,21 @@
opcode_t *
Parrot_index_i_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (CONST(2).u.string && SREG(3)) ? STRING_index(interp, CONST(2).u.string, SREG(3), 0) : -1;
+ IREG(1) = (SCONST(2) && SREG(3)) ? STRING_index(interp, SCONST(2), SREG(3), 0) : -1;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_index_i_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SREG(2) && CONST(3).u.string) ? STRING_index(interp, SREG(2), CONST(3).u.string, 0) : -1;
+ IREG(1) = (SREG(2) && SCONST(3)) ? STRING_index(interp, SREG(2), SCONST(3), 0) : -1;
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_index_i_sc_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (CONST(2).u.string && CONST(3).u.string) ? STRING_index(interp, CONST(2).u.string, CONST(3).u.string, 0) : -1;
+ IREG(1) = (SCONST(2) && SCONST(3)) ? STRING_index(interp, SCONST(2), SCONST(3), 0) : -1;
return (opcode_t *)cur_opcode + 4;}
@@ -22796,49 +22799,49 @@
opcode_t *
Parrot_index_i_sc_s_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (CONST(2).u.string && SREG(3)) ? STRING_index(interp, CONST(2).u.string, SREG(3), IREG(4)) : -1;
+ IREG(1) = (SCONST(2) && SREG(3)) ? STRING_index(interp, SCONST(2), SREG(3), IREG(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_index_i_s_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SREG(2) && CONST(3).u.string) ? STRING_index(interp, SREG(2), CONST(3).u.string, IREG(4)) : -1;
+ IREG(1) = (SREG(2) && SCONST(3)) ? STRING_index(interp, SREG(2), SCONST(3), IREG(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_index_i_sc_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (CONST(2).u.string && CONST(3).u.string) ? STRING_index(interp, CONST(2).u.string, CONST(3).u.string, IREG(4)) : -1;
+ IREG(1) = (SCONST(2) && SCONST(3)) ? STRING_index(interp, SCONST(2), SCONST(3), IREG(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_index_i_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SREG(2) && SREG(3)) ? STRING_index(interp, SREG(2), SREG(3), cur_opcode[4]) : -1;
+ IREG(1) = (SREG(2) && SREG(3)) ? STRING_index(interp, SREG(2), SREG(3), ICONST(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_index_i_sc_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (CONST(2).u.string && SREG(3)) ? STRING_index(interp, CONST(2).u.string, SREG(3), cur_opcode[4]) : -1;
+ IREG(1) = (SCONST(2) && SREG(3)) ? STRING_index(interp, SCONST(2), SREG(3), ICONST(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_index_i_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (SREG(2) && CONST(3).u.string) ? STRING_index(interp, SREG(2), CONST(3).u.string, cur_opcode[4]) : -1;
+ IREG(1) = (SREG(2) && SCONST(3)) ? STRING_index(interp, SREG(2), SCONST(3), ICONST(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_index_i_sc_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = (CONST(2).u.string && CONST(3).u.string) ? STRING_index(interp, CONST(2).u.string, CONST(3).u.string, cur_opcode[4]) : -1;
+ IREG(1) = (SCONST(2) && SCONST(3)) ? STRING_index(interp, SCONST(2), SCONST(3), ICONST(4)) : -1;
return (opcode_t *)cur_opcode + 5;}
@@ -22852,7 +22855,7 @@
opcode_t *
Parrot_sprintf_s_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1)=Parrot_psprintf(interp, CONST(2).u.string, PREG(3));
+ SREG(1)=Parrot_psprintf(interp, SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -22881,7 +22884,7 @@
opcode_t *
Parrot_new_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_new_noinit(interp, cur_opcode[2]);
+ SREG(1) = Parrot_str_new_noinit(interp, ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -22924,27 +22927,27 @@
opcode_t *
Parrot_stringinfo_i_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (CONST(2).u.string == NULL)
+ if (SCONST(2) == NULL)
IREG(1) = 0;
else {
switch (IREG(3)) {
case STRINGINFO_HEADER:
- IREG(1) = PTR2UINTVAL(CONST(2).u.string);
+ IREG(1) = PTR2UINTVAL(SCONST(2));
break;
case STRINGINFO_STRSTART:
- IREG(1) = PTR2UINTVAL(CONST(2).u.string->strstart);
+ IREG(1) = PTR2UINTVAL(SCONST(2)->strstart);
break;
case STRINGINFO_BUFLEN:
- IREG(1) = Buffer_buflen(CONST(2).u.string);
+ IREG(1) = Buffer_buflen(SCONST(2));
break;
case STRINGINFO_FLAGS:
- IREG(1) = PObj_get_FLAGS(CONST(2).u.string);
+ IREG(1) = PObj_get_FLAGS(SCONST(2));
break;
case STRINGINFO_BUFUSED:
- IREG(1) = CONST(2).u.string->bufused;
+ IREG(1) = SCONST(2)->bufused;
break;
case STRINGINFO_STRLEN:
- IREG(1) = CONST(2).u.string->strlen;
+ IREG(1) = SCONST(2)->strlen;
break;
default:
{
@@ -22963,7 +22966,7 @@
if (SREG(2) == NULL)
IREG(1) = 0;
else {
- switch (cur_opcode[3]) {
+ switch (ICONST(3)) {
case STRINGINFO_HEADER:
IREG(1) = PTR2UINTVAL(SREG(2));
break;
@@ -22986,7 +22989,7 @@
{
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, NULL,
EXCEPTION_INVALID_OPERATION,
- "stringinfo: unknown info type: %d", cur_opcode[3]);return (opcode_t *)handler;
+ "stringinfo: unknown info type: %d", ICONST(3));return (opcode_t *)handler;
}
}
}
@@ -22996,33 +22999,33 @@
opcode_t *
Parrot_stringinfo_i_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (CONST(2).u.string == NULL)
+ if (SCONST(2) == NULL)
IREG(1) = 0;
else {
- switch (cur_opcode[3]) {
+ switch (ICONST(3)) {
case STRINGINFO_HEADER:
- IREG(1) = PTR2UINTVAL(CONST(2).u.string);
+ IREG(1) = PTR2UINTVAL(SCONST(2));
break;
case STRINGINFO_STRSTART:
- IREG(1) = PTR2UINTVAL(CONST(2).u.string->strstart);
+ IREG(1) = PTR2UINTVAL(SCONST(2)->strstart);
break;
case STRINGINFO_BUFLEN:
- IREG(1) = Buffer_buflen(CONST(2).u.string);
+ IREG(1) = Buffer_buflen(SCONST(2));
break;
case STRINGINFO_FLAGS:
- IREG(1) = PObj_get_FLAGS(CONST(2).u.string);
+ IREG(1) = PObj_get_FLAGS(SCONST(2));
break;
case STRINGINFO_BUFUSED:
- IREG(1) = CONST(2).u.string->bufused;
+ IREG(1) = SCONST(2)->bufused;
break;
case STRINGINFO_STRLEN:
- IREG(1) = CONST(2).u.string->strlen;
+ IREG(1) = SCONST(2)->strlen;
break;
default:
{
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, NULL,
EXCEPTION_INVALID_OPERATION,
- "stringinfo: unknown info type: %d", cur_opcode[3]);return (opcode_t *)handler;
+ "stringinfo: unknown info type: %d", ICONST(3));return (opcode_t *)handler;
}
}
}
@@ -23039,7 +23042,7 @@
opcode_t *
Parrot_upcase_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_upcase(interp, CONST(2).u.string);
+ SREG(1) = Parrot_str_upcase(interp, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23053,7 +23056,7 @@
opcode_t *
Parrot_downcase_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_downcase(interp, CONST(2).u.string);
+ SREG(1) = Parrot_str_downcase(interp, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23067,7 +23070,7 @@
opcode_t *
Parrot_titlecase_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_titlecase(interp, CONST(2).u.string);
+ SREG(1) = Parrot_str_titlecase(interp, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23081,7 +23084,7 @@
opcode_t *
Parrot_join_s_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_join(interp, CONST(2).u.string, PREG(3));
+ SREG(1) = Parrot_str_join(interp, SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23095,21 +23098,21 @@
opcode_t *
Parrot_split_p_sc_s(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_str_split(interp, CONST(2).u.string, SREG(3));
+ PREG(1) = Parrot_str_split(interp, SCONST(2), SREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_split_p_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_str_split(interp, SREG(2), CONST(3).u.string);
+ PREG(1) = Parrot_str_split(interp, SREG(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_split_p_sc_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = Parrot_str_split(interp, CONST(2).u.string, CONST(3).u.string);
+ PREG(1) = Parrot_str_split(interp, SCONST(2), SCONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23123,7 +23126,7 @@
opcode_t *
Parrot_charset_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_encoding_number_of_str(interp, CONST(2).u.string);
+ IREG(1) = Parrot_encoding_number_of_str(interp, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23137,7 +23140,7 @@
opcode_t *
Parrot_charsetname_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_encoding_name(interp, cur_opcode[2]);
+ SREG(1) = Parrot_encoding_name(interp, ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23157,11 +23160,11 @@
opcode_t *
Parrot_find_charset_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- const INTVAL n = Parrot_encoding_number(interp, CONST(2).u.string);
+ const INTVAL n = Parrot_encoding_number(interp, SCONST(2));
if (n < 0) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, NULL,
EXCEPTION_INVALID_CHARTYPE,
- "charset '%Ss' not found", CONST(2).u.string);return (opcode_t *)handler;
+ "charset '%Ss' not found", SCONST(2));return (opcode_t *)handler;
}
IREG(1) = n;
@@ -23177,21 +23180,21 @@
opcode_t *
Parrot_trans_charset_s_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_change_charset(interp, CONST(2).u.string, IREG(3));
+ SREG(1) = Parrot_str_change_charset(interp, SCONST(2), IREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_trans_charset_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_change_charset(interp, SREG(2), cur_opcode[3]);
+ SREG(1) = Parrot_str_change_charset(interp, SREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_trans_charset_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_change_charset(interp, CONST(2).u.string, cur_opcode[3]);
+ SREG(1) = Parrot_str_change_charset(interp, SCONST(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23205,7 +23208,7 @@
opcode_t *
Parrot_encoding_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_encoding_number_of_str(interp, CONST(2).u.string);
+ IREG(1) = Parrot_encoding_number_of_str(interp, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23219,7 +23222,7 @@
opcode_t *
Parrot_encodingname_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_encoding_name(interp, cur_opcode[2]);
+ SREG(1) = Parrot_encoding_name(interp, ICONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23239,11 +23242,11 @@
opcode_t *
Parrot_find_encoding_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- const INTVAL n = Parrot_encoding_number(interp, CONST(2).u.string);
+ const INTVAL n = Parrot_encoding_number(interp, SCONST(2));
if (n < 0) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, NULL,
EXCEPTION_INVALID_ENCODING,
- "encoding '%Ss' not found", CONST(2).u.string);return (opcode_t *)handler;
+ "encoding '%Ss' not found", SCONST(2));return (opcode_t *)handler;
}
IREG(1) = n;
@@ -23259,21 +23262,21 @@
opcode_t *
Parrot_trans_encoding_s_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_change_encoding(interp, CONST(2).u.string, IREG(3));
+ SREG(1) = Parrot_str_change_encoding(interp, SCONST(2), IREG(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_trans_encoding_s_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_change_encoding(interp, SREG(2), cur_opcode[3]);
+ SREG(1) = Parrot_str_change_encoding(interp, SREG(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
opcode_t *
Parrot_trans_encoding_s_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_change_encoding(interp, CONST(2).u.string, cur_opcode[3]);
+ SREG(1) = Parrot_str_change_encoding(interp, SCONST(2), ICONST(3));
return (opcode_t *)cur_opcode + 4;}
@@ -23287,49 +23290,49 @@
opcode_t *
Parrot_is_cclass_i_ic_s_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_is_cclass(interp, cur_opcode[2], SREG(3), IREG(4));
+ IREG(1) = Parrot_str_is_cclass(interp, ICONST(2), SREG(3), IREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_is_cclass_i_i_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_is_cclass(interp, IREG(2), CONST(3).u.string, IREG(4));
+ IREG(1) = Parrot_str_is_cclass(interp, IREG(2), SCONST(3), IREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_is_cclass_i_ic_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_is_cclass(interp, cur_opcode[2], CONST(3).u.string, IREG(4));
+ IREG(1) = Parrot_str_is_cclass(interp, ICONST(2), SCONST(3), IREG(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_is_cclass_i_i_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_is_cclass(interp, IREG(2), SREG(3), cur_opcode[4]);
+ IREG(1) = Parrot_str_is_cclass(interp, IREG(2), SREG(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_is_cclass_i_ic_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_is_cclass(interp, cur_opcode[2], SREG(3), cur_opcode[4]);
+ IREG(1) = Parrot_str_is_cclass(interp, ICONST(2), SREG(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_is_cclass_i_i_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_is_cclass(interp, IREG(2), CONST(3).u.string, cur_opcode[4]);
+ IREG(1) = Parrot_str_is_cclass(interp, IREG(2), SCONST(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
opcode_t *
Parrot_is_cclass_i_ic_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_is_cclass(interp, cur_opcode[2], CONST(3).u.string, cur_opcode[4]);
+ IREG(1) = Parrot_str_is_cclass(interp, ICONST(2), SCONST(3), ICONST(4));
return (opcode_t *)cur_opcode + 5;}
@@ -23343,105 +23346,105 @@
opcode_t *
Parrot_find_cclass_i_ic_s_i_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, cur_opcode[2], SREG(3), IREG(4), IREG(5));
+ IREG(1) = Parrot_str_find_cclass(interp, ICONST(2), SREG(3), IREG(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_i_sc_i_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, IREG(2), CONST(3).u.string, IREG(4), IREG(5));
+ IREG(1) = Parrot_str_find_cclass(interp, IREG(2), SCONST(3), IREG(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_ic_sc_i_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, cur_opcode[2], CONST(3).u.string, IREG(4), IREG(5));
+ IREG(1) = Parrot_str_find_cclass(interp, ICONST(2), SCONST(3), IREG(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_i_s_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, IREG(2), SREG(3), cur_opcode[4], IREG(5));
+ IREG(1) = Parrot_str_find_cclass(interp, IREG(2), SREG(3), ICONST(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_ic_s_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, cur_opcode[2], SREG(3), cur_opcode[4], IREG(5));
+ IREG(1) = Parrot_str_find_cclass(interp, ICONST(2), SREG(3), ICONST(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_i_sc_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, IREG(2), CONST(3).u.string, cur_opcode[4], IREG(5));
+ IREG(1) = Parrot_str_find_cclass(interp, IREG(2), SCONST(3), ICONST(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_ic_sc_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, cur_opcode[2], CONST(3).u.string, cur_opcode[4], IREG(5));
+ IREG(1) = Parrot_str_find_cclass(interp, ICONST(2), SCONST(3), ICONST(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_i_s_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, IREG(2), SREG(3), IREG(4), cur_opcode[5]);
+ IREG(1) = Parrot_str_find_cclass(interp, IREG(2), SREG(3), IREG(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_ic_s_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, cur_opcode[2], SREG(3), IREG(4), cur_opcode[5]);
+ IREG(1) = Parrot_str_find_cclass(interp, ICONST(2), SREG(3), IREG(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_i_sc_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, IREG(2), CONST(3).u.string, IREG(4), cur_opcode[5]);
+ IREG(1) = Parrot_str_find_cclass(interp, IREG(2), SCONST(3), IREG(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_ic_sc_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, cur_opcode[2], CONST(3).u.string, IREG(4), cur_opcode[5]);
+ IREG(1) = Parrot_str_find_cclass(interp, ICONST(2), SCONST(3), IREG(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_i_s_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, IREG(2), SREG(3), cur_opcode[4], cur_opcode[5]);
+ IREG(1) = Parrot_str_find_cclass(interp, IREG(2), SREG(3), ICONST(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_ic_s_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, cur_opcode[2], SREG(3), cur_opcode[4], cur_opcode[5]);
+ IREG(1) = Parrot_str_find_cclass(interp, ICONST(2), SREG(3), ICONST(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_i_sc_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, IREG(2), CONST(3).u.string, cur_opcode[4], cur_opcode[5]);
+ IREG(1) = Parrot_str_find_cclass(interp, IREG(2), SCONST(3), ICONST(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_cclass_i_ic_sc_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_cclass(interp, cur_opcode[2], CONST(3).u.string, cur_opcode[4], cur_opcode[5]);
+ IREG(1) = Parrot_str_find_cclass(interp, ICONST(2), SCONST(3), ICONST(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
@@ -23455,105 +23458,105 @@
opcode_t *
Parrot_find_not_cclass_i_ic_s_i_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, cur_opcode[2], SREG(3), IREG(4), IREG(5));
+ IREG(1) = Parrot_str_find_not_cclass(interp, ICONST(2), SREG(3), IREG(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_i_sc_i_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), CONST(3).u.string, IREG(4), IREG(5));
+ IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), SCONST(3), IREG(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_ic_sc_i_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, cur_opcode[2], CONST(3).u.string, IREG(4), IREG(5));
+ IREG(1) = Parrot_str_find_not_cclass(interp, ICONST(2), SCONST(3), IREG(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_i_s_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), SREG(3), cur_opcode[4], IREG(5));
+ IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), SREG(3), ICONST(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_ic_s_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, cur_opcode[2], SREG(3), cur_opcode[4], IREG(5));
+ IREG(1) = Parrot_str_find_not_cclass(interp, ICONST(2), SREG(3), ICONST(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_i_sc_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), CONST(3).u.string, cur_opcode[4], IREG(5));
+ IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), SCONST(3), ICONST(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_ic_sc_ic_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, cur_opcode[2], CONST(3).u.string, cur_opcode[4], IREG(5));
+ IREG(1) = Parrot_str_find_not_cclass(interp, ICONST(2), SCONST(3), ICONST(4), IREG(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_i_s_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), SREG(3), IREG(4), cur_opcode[5]);
+ IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), SREG(3), IREG(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_ic_s_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, cur_opcode[2], SREG(3), IREG(4), cur_opcode[5]);
+ IREG(1) = Parrot_str_find_not_cclass(interp, ICONST(2), SREG(3), IREG(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_i_sc_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), CONST(3).u.string, IREG(4), cur_opcode[5]);
+ IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), SCONST(3), IREG(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_ic_sc_i_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, cur_opcode[2], CONST(3).u.string, IREG(4), cur_opcode[5]);
+ IREG(1) = Parrot_str_find_not_cclass(interp, ICONST(2), SCONST(3), IREG(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_i_s_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), SREG(3), cur_opcode[4], cur_opcode[5]);
+ IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), SREG(3), ICONST(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_ic_s_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, cur_opcode[2], SREG(3), cur_opcode[4], cur_opcode[5]);
+ IREG(1) = Parrot_str_find_not_cclass(interp, ICONST(2), SREG(3), ICONST(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_i_sc_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), CONST(3).u.string, cur_opcode[4], cur_opcode[5]);
+ IREG(1) = Parrot_str_find_not_cclass(interp, IREG(2), SCONST(3), ICONST(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
opcode_t *
Parrot_find_not_cclass_i_ic_sc_ic_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_str_find_not_cclass(interp, cur_opcode[2], CONST(3).u.string, cur_opcode[4], cur_opcode[5]);
+ IREG(1) = Parrot_str_find_not_cclass(interp, ICONST(2), SCONST(3), ICONST(4), ICONST(5));
return (opcode_t *)cur_opcode + 6;}
@@ -23574,7 +23577,7 @@
opcode_t *
Parrot_compose_s_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- SREG(1) = Parrot_str_compose(interp, CONST(2).u.string);
+ SREG(1) = Parrot_str_compose(interp, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23588,7 +23591,7 @@
opcode_t *
Parrot_spawnw_i_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- IREG(1) = Parrot_Run_OS_Command(interp, CONST(2).u.string);
+ IREG(1) = Parrot_Run_OS_Command(interp, SCONST(2));
return (opcode_t *)cur_opcode + 3;}
@@ -23627,7 +23630,7 @@
opcode_t *
Parrot_err_s_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- const char * const tmp = strerror(cur_opcode[2]);
+ const char * const tmp = strerror(ICONST(2));
SREG(1) = Parrot_str_new_init(interp, tmp, strlen(tmp),
Parrot_ascii_encoding_ptr, 0);
@@ -23663,12 +23666,12 @@
Parrot_sleep_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
opcode_t *next = cur_opcode + 2;
- if (cur_opcode[1] < 0) {
+ if (ICONST(1) < 0) {
opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, next,
EXCEPTION_NEG_SLEEP,
"Cannot go back in time");return (opcode_t *)handler;
}
- next = (opcode_t *)Parrot_cx_schedule_sleep(interp, (FLOATVAL) cur_opcode[1], next);return (opcode_t *)next;
+ next = (opcode_t *)Parrot_cx_schedule_sleep(interp, (FLOATVAL) ICONST(1), next);return (opcode_t *)next;
}
opcode_t *
@@ -23687,12 +23690,12 @@
Parrot_sleep_nc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
opcode_t *next = cur_opcode + 2;
- if (CONST(1).u.number < 0.0) {
+ if (NCONST(1) < 0.0) {
opcode_t * const handler = Parrot_ex_throw_from_op_args(interp, next,
EXCEPTION_NEG_SLEEP,
"Cannot go back in time");return (opcode_t *)handler;
}
- next = (opcode_t *)Parrot_cx_schedule_sleep(interp, CONST(1).u.number, next);return (opcode_t *)next;
+ next = (opcode_t *)Parrot_cx_schedule_sleep(interp, NCONST(1), next);return (opcode_t *)next;
}
opcode_t *
@@ -23715,7 +23718,7 @@
Parrot_store_lex_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const ctx = CURRENT_CONTEXT(interp);
- STRING * const lex_name = CONST(1).u.string;
+ STRING * const lex_name = SCONST(1);
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
if (PMC_IS_NULL(lex_pad)) {
@@ -23750,7 +23753,7 @@
opcode_t *
Parrot_store_dynamic_lex_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const lex_name = CONST(1).u.string;
+ STRING * const lex_name = SCONST(1);
PMC * const ctx =
Parrot_pcc_get_caller_ctx(interp, CURRENT_CONTEXT(interp));
PMC * const lex_pad =
@@ -23786,7 +23789,7 @@
Parrot_find_lex_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const ctx = CURRENT_CONTEXT(interp);
- STRING * const lex_name = CONST(2).u.string;
+ STRING * const lex_name = SCONST(2);
PMC * const lex_pad = Parrot_find_pad(interp, lex_name, ctx);
PMC * const result =
@@ -23818,7 +23821,7 @@
opcode_t *
Parrot_find_dynamic_lex_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const lex_name = CONST(2).u.string;
+ STRING * const lex_name = SCONST(2);
PMC * const ctx =
Parrot_pcc_get_caller_ctx(interp, CURRENT_CONTEXT(interp));
PMC * const lex_pad =
@@ -23857,7 +23860,7 @@
opcode_t *
Parrot_find_caller_lex_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const lex_name = CONST(2).u.string;
+ STRING * const lex_name = SCONST(2);
PMC * ctx = CURRENT_CONTEXT(interp);
PMC * result = PMCNULL;
@@ -23897,7 +23900,7 @@
Parrot_get_namespace_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, CONST(2).u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, PCONST(2));
PREG(1) = PMC_IS_NULL(ns) ? PMCNULL : ns;
@@ -23931,7 +23934,7 @@
if (PMC_IS_NULL(hll_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, CONST(2).u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, PCONST(2));
PREG(1) = ns;
}
@@ -23965,7 +23968,7 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, CONST(2).u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, PCONST(2));
PREG(1) = ns;
}
@@ -23983,7 +23986,7 @@
Parrot_get_global_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PREG(1) = Parrot_ns_find_global_from_op(interp, cur_ns, CONST(2).u.string, cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, cur_ns, SCONST(2), cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -24012,7 +24015,7 @@
PREG(1) = PMCNULL;
}
else {
- PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, CONST(2).u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, PCONST(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
@@ -24033,7 +24036,7 @@
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3).u.string, cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SCONST(3), cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -24046,11 +24049,11 @@
PREG(1) = PMCNULL;
}
else {
- PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, CONST(2).u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, cur_ns, PCONST(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3).u.string, cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SCONST(3), cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -24067,7 +24070,7 @@
Parrot_get_hll_global_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PREG(1) = Parrot_ns_find_global_from_op(interp, hll_ns, CONST(2).u.string, cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, hll_ns, SCONST(2), cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -24096,7 +24099,7 @@
PREG(1) = hll_ns;
}
else {
- PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, CONST(2).u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, PCONST(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
@@ -24117,7 +24120,7 @@
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3).u.string, cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SCONST(3), cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -24130,11 +24133,11 @@
PREG(1) = hll_ns;
}
else {
- PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, CONST(2).u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, hll_ns, PCONST(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3).u.string, cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SCONST(3), cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -24151,7 +24154,7 @@
Parrot_get_root_global_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PREG(1) = Parrot_ns_find_global_from_op(interp, root_ns, CONST(2).u.string, cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, root_ns, SCONST(2), cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -24178,7 +24181,7 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, CONST(2).u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, PCONST(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
@@ -24198,7 +24201,7 @@
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3).u.string, cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SCONST(3), cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -24210,11 +24213,11 @@
if (PMC_IS_NULL(root_ns))
PREG(1) = PMCNULL;
else {
- PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, CONST(2).u.key);
+ PMC * const ns = Parrot_ns_get_namespace_keyed(interp, root_ns, PCONST(2));
if (PMC_IS_NULL(ns))
PREG(1) = PMCNULL;
else
- PREG(1) = Parrot_ns_find_global_from_op(interp, ns, CONST(3).u.string, cur_opcode + 4);
+ PREG(1) = Parrot_ns_find_global_from_op(interp, ns, SCONST(3), cur_opcode + 4);
}
return (opcode_t *)cur_opcode + 4;}
@@ -24231,7 +24234,7 @@
Parrot_set_global_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- Parrot_ns_set_global(interp, cur_ns, CONST(1).u.string, PREG(2));
+ Parrot_ns_set_global(interp, cur_ns, SCONST(1), PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -24249,7 +24252,7 @@
Parrot_set_global_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, CONST(1).u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, PCONST(1));
Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
@@ -24261,7 +24264,7 @@
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, PREG(1));
- Parrot_ns_set_global(interp, ns, CONST(2).u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -24269,9 +24272,9 @@
Parrot_set_global_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const cur_ns = Parrot_pcc_get_namespace(interp, CURRENT_CONTEXT(interp));
- PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, CONST(1).u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, cur_ns, PCONST(1));
- Parrot_ns_set_global(interp, ns, CONST(2).u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -24287,7 +24290,7 @@
Parrot_set_hll_global_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- Parrot_ns_set_global(interp, hll_ns, CONST(1).u.string, PREG(2));
+ Parrot_ns_set_global(interp, hll_ns, SCONST(1), PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -24305,7 +24308,7 @@
Parrot_set_hll_global_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, CONST(1).u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, PCONST(1));
Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
@@ -24317,7 +24320,7 @@
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, PREG(1));
- Parrot_ns_set_global(interp, ns, CONST(2).u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -24325,9 +24328,9 @@
Parrot_set_hll_global_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const hll_ns = Parrot_get_ctx_HLL_namespace(interp);
- PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, CONST(1).u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, hll_ns, PCONST(1));
- Parrot_ns_set_global(interp, ns, CONST(2).u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -24343,7 +24346,7 @@
Parrot_set_root_global_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- Parrot_ns_set_global(interp, root_ns, CONST(1).u.string, PREG(2));
+ Parrot_ns_set_global(interp, root_ns, SCONST(1), PREG(2));
return (opcode_t *)cur_opcode + 3;}
@@ -24361,7 +24364,7 @@
Parrot_set_root_global_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, CONST(1).u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, PCONST(1));
Parrot_ns_set_global(interp, ns, SREG(2), PREG(3));
@@ -24373,7 +24376,7 @@
PMC * const root_ns = interp->root_namespace;
PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, PREG(1));
- Parrot_ns_set_global(interp, ns, CONST(2).u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -24381,9 +24384,9 @@
Parrot_set_root_global_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PMC * const root_ns = interp->root_namespace;
- PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, CONST(1).u.key);
+ PMC * const ns = Parrot_ns_make_namespace_keyed(interp, root_ns, PCONST(1));
- Parrot_ns_set_global(interp, ns, CONST(2).u.string, PREG(3));
+ Parrot_ns_set_global(interp, ns, SCONST(2), PREG(3));
return (opcode_t *)cur_opcode + 4;}
@@ -24403,13 +24406,13 @@
opcode_t *
Parrot_find_name_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- if (!CONST(2).u.string) {
+ if (!SCONST(2)) {
opcode_t *handler = Parrot_ex_throw_from_op_args(interp, NULL,
EXCEPTION_INVALID_OPERATION,
"Tried to find null name");return (opcode_t *)handler;
}
- PREG(1) = Parrot_ns_find_named_item(interp, CONST(2).u.string, cur_opcode + 3);
+ PREG(1) = Parrot_ns_find_named_item(interp, SCONST(2), cur_opcode + 3);
return (opcode_t *)cur_opcode + 3;}
@@ -24435,14 +24438,14 @@
Parrot_find_sub_not_null_p_sc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
opcode_t *dest = cur_opcode + 3;
- PMC *sub = Parrot_ns_find_named_item(interp, CONST(2).u.string, dest);
+ PMC *sub = Parrot_ns_find_named_item(interp, SCONST(2), dest);
if (PMC_IS_NULL(sub)) {
opcode_t *handler;
Parrot_pcc_set_pc_func(interp, CURRENT_CONTEXT(interp), dest);
handler = Parrot_ex_throw_from_op_args(interp, dest,
EXCEPTION_GLOBAL_NOT_FOUND,
- "Could not find sub %Ss", CONST(2).u.string);return (opcode_t *)handler;
+ "Could not find sub %Ss", SCONST(2));return (opcode_t *)handler;
}
PREG(1) = sub;
@@ -24464,7 +24467,7 @@
opcode_t *
Parrot_set_label_p_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- VTABLE_set_pointer(interp, PREG(1), (CUR_OPCODE + cur_opcode[2]));
+ VTABLE_set_pointer(interp, PREG(1), (CUR_OPCODE + ICONST(2)));
return (opcode_t *)cur_opcode + 3;}
@@ -24501,7 +24504,7 @@
opcode_t *
Parrot_fetch_p_pc_p_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed(interp, CONST(2).u.key, PREG(3));
+ PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PREG(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
if (!PMC_IS_NULL(classobj))
@@ -24523,7 +24526,7 @@
opcode_t *
Parrot_fetch_p_p_pc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), CONST(3).u.key);
+ PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PCONST(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
if (!PMC_IS_NULL(classobj))
@@ -24545,7 +24548,7 @@
opcode_t *
Parrot_fetch_p_pc_pc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed(interp, CONST(2).u.key, CONST(3).u.key);
+ PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PCONST(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
if (!PMC_IS_NULL(classobj))
@@ -24569,15 +24572,15 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PREG(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -24589,17 +24592,17 @@
opcode_t *
Parrot_fetch_p_pc_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed(interp, CONST(2).u.key, PREG(3));
+ PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PREG(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -24611,17 +24614,17 @@
opcode_t *
Parrot_fetch_p_p_pc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), CONST(3).u.key);
+ PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PCONST(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -24633,17 +24636,17 @@
opcode_t *
Parrot_fetch_p_pc_pc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed(interp, CONST(2).u.key, CONST(3).u.key);
+ PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PCONST(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -24677,7 +24680,7 @@
opcode_t *
Parrot_fetch_p_pc_i_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_int(interp, CONST(2).u.key, IREG(3));
+ PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), IREG(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
if (!PMC_IS_NULL(classobj))
@@ -24699,7 +24702,7 @@
opcode_t *
Parrot_fetch_p_p_ic_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), cur_opcode[3]);
+ PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), ICONST(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
if (!PMC_IS_NULL(classobj))
@@ -24721,7 +24724,7 @@
opcode_t *
Parrot_fetch_p_pc_ic_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_int(interp, CONST(2).u.key, cur_opcode[3]);
+ PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), ICONST(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
if (!PMC_IS_NULL(classobj))
@@ -24745,15 +24748,15 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), IREG(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -24765,17 +24768,17 @@
opcode_t *
Parrot_fetch_p_pc_i_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_int(interp, CONST(2).u.key, IREG(3));
+ PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), IREG(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -24787,17 +24790,17 @@
opcode_t *
Parrot_fetch_p_p_ic_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), cur_opcode[3]);
+ PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), ICONST(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -24809,17 +24812,17 @@
opcode_t *
Parrot_fetch_p_pc_ic_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_int(interp, CONST(2).u.key, cur_opcode[3]);
+ PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), ICONST(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -24853,7 +24856,7 @@
opcode_t *
Parrot_fetch_p_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_str(interp, CONST(2).u.key, SREG(3));
+ PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SREG(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
if (!PMC_IS_NULL(classobj))
@@ -24875,7 +24878,7 @@
opcode_t *
Parrot_fetch_p_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), CONST(3).u.string);
+ PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SCONST(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
if (!PMC_IS_NULL(classobj))
@@ -24897,7 +24900,7 @@
opcode_t *
Parrot_fetch_p_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_str(interp, CONST(2).u.key, CONST(3).u.string);
+ PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SCONST(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
if (!PMC_IS_NULL(classobj))
@@ -24921,15 +24924,15 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SREG(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -24941,17 +24944,17 @@
opcode_t *
Parrot_fetch_p_pc_s_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_str(interp, CONST(2).u.key, SREG(3));
+ PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SREG(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -24963,17 +24966,17 @@
opcode_t *
Parrot_fetch_p_p_sc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), CONST(3).u.string);
+ PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SCONST(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -24985,17 +24988,17 @@
opcode_t *
Parrot_fetch_p_pc_sc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_str(interp, CONST(2).u.key, CONST(3).u.string);
+ PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SCONST(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -25032,7 +25035,7 @@
opcode_t *
Parrot_vivify_p_pc_p_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed(interp, CONST(2).u.key, PREG(3));
+ PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PREG(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
@@ -25049,7 +25052,7 @@
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed(interp, CONST(2).u.key, PREG(3), PREG(1));
+ VTABLE_set_pmc_keyed(interp, PCONST(2), PREG(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25057,7 +25060,7 @@
opcode_t *
Parrot_vivify_p_p_pc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), CONST(3).u.key);
+ PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PCONST(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
@@ -25074,7 +25077,7 @@
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed(interp, PREG(2), CONST(3).u.key, PREG(1));
+ VTABLE_set_pmc_keyed(interp, PREG(2), PCONST(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25082,7 +25085,7 @@
opcode_t *
Parrot_vivify_p_pc_pc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed(interp, CONST(2).u.key, CONST(3).u.key);
+ PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PCONST(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
@@ -25099,7 +25102,7 @@
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed(interp, CONST(2).u.key, CONST(3).u.key, PREG(1));
+ VTABLE_set_pmc_keyed(interp, PCONST(2), PCONST(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25110,16 +25113,16 @@
PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PREG(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -25132,24 +25135,24 @@
opcode_t *
Parrot_vivify_p_pc_p_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed(interp, CONST(2).u.key, PREG(3));
+ PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PREG(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed(interp, CONST(2).u.key, PREG(3), PREG(1));
+ VTABLE_set_pmc_keyed(interp, PCONST(2), PREG(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25157,24 +25160,24 @@
opcode_t *
Parrot_vivify_p_p_pc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), CONST(3).u.key);
+ PREG(1) = VTABLE_get_pmc_keyed(interp, PREG(2), PCONST(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed(interp, PREG(2), CONST(3).u.key, PREG(1));
+ VTABLE_set_pmc_keyed(interp, PREG(2), PCONST(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25182,24 +25185,24 @@
opcode_t *
Parrot_vivify_p_pc_pc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed(interp, CONST(2).u.key, CONST(3).u.key);
+ PREG(1) = VTABLE_get_pmc_keyed(interp, PCONST(2), PCONST(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed(interp, CONST(2).u.key, CONST(3).u.key, PREG(1));
+ VTABLE_set_pmc_keyed(interp, PCONST(2), PCONST(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25232,7 +25235,7 @@
opcode_t *
Parrot_vivify_p_pc_i_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_int(interp, CONST(2).u.key, IREG(3));
+ PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), IREG(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
@@ -25249,7 +25252,7 @@
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed_int(interp, CONST(2).u.key, IREG(3), PREG(1));
+ VTABLE_set_pmc_keyed_int(interp, PCONST(2), IREG(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25257,7 +25260,7 @@
opcode_t *
Parrot_vivify_p_p_ic_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), cur_opcode[3]);
+ PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), ICONST(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
@@ -25274,7 +25277,7 @@
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed_int(interp, PREG(2), cur_opcode[3], PREG(1));
+ VTABLE_set_pmc_keyed_int(interp, PREG(2), ICONST(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25282,7 +25285,7 @@
opcode_t *
Parrot_vivify_p_pc_ic_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_int(interp, CONST(2).u.key, cur_opcode[3]);
+ PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), ICONST(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
@@ -25299,7 +25302,7 @@
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed_int(interp, CONST(2).u.key, cur_opcode[3], PREG(1));
+ VTABLE_set_pmc_keyed_int(interp, PCONST(2), ICONST(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25310,15 +25313,15 @@
PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), IREG(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -25332,24 +25335,24 @@
opcode_t *
Parrot_vivify_p_pc_i_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_int(interp, CONST(2).u.key, IREG(3));
+ PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), IREG(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed_int(interp, CONST(2).u.key, IREG(3), PREG(1));
+ VTABLE_set_pmc_keyed_int(interp, PCONST(2), IREG(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25357,24 +25360,24 @@
opcode_t *
Parrot_vivify_p_p_ic_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), cur_opcode[3]);
+ PREG(1) = VTABLE_get_pmc_keyed_int(interp, PREG(2), ICONST(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed_int(interp, PREG(2), cur_opcode[3], PREG(1));
+ VTABLE_set_pmc_keyed_int(interp, PREG(2), ICONST(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25382,24 +25385,24 @@
opcode_t *
Parrot_vivify_p_pc_ic_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_int(interp, CONST(2).u.key, cur_opcode[3]);
+ PREG(1) = VTABLE_get_pmc_keyed_int(interp, PCONST(2), ICONST(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed_int(interp, CONST(2).u.key, cur_opcode[3], PREG(1));
+ VTABLE_set_pmc_keyed_int(interp, PCONST(2), ICONST(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25432,7 +25435,7 @@
opcode_t *
Parrot_vivify_p_pc_s_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_str(interp, CONST(2).u.key, SREG(3));
+ PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SREG(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
@@ -25449,7 +25452,7 @@
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed_str(interp, CONST(2).u.key, SREG(3), PREG(1));
+ VTABLE_set_pmc_keyed_str(interp, PCONST(2), SREG(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25457,7 +25460,7 @@
opcode_t *
Parrot_vivify_p_p_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), CONST(3).u.string);
+ PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SCONST(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
@@ -25474,7 +25477,7 @@
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed_str(interp, PREG(2), CONST(3).u.string, PREG(1));
+ VTABLE_set_pmc_keyed_str(interp, PREG(2), SCONST(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25482,7 +25485,7 @@
opcode_t *
Parrot_vivify_p_pc_sc_p(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_str(interp, CONST(2).u.key, CONST(3).u.string);
+ PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SCONST(3));
if (PMC_IS_NULL(PREG(1))) {
PMC * const classobj = Parrot_oo_get_class(interp, PREG(4));
@@ -25499,7 +25502,7 @@
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed_str(interp, CONST(2).u.key, CONST(3).u.string, PREG(1));
+ VTABLE_set_pmc_keyed_str(interp, PCONST(2), SCONST(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25510,15 +25513,15 @@
PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SREG(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
@@ -25532,24 +25535,24 @@
opcode_t *
Parrot_vivify_p_pc_s_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_str(interp, CONST(2).u.key, SREG(3));
+ PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SREG(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed_str(interp, CONST(2).u.key, SREG(3), PREG(1));
+ VTABLE_set_pmc_keyed_str(interp, PCONST(2), SREG(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25557,24 +25560,24 @@
opcode_t *
Parrot_vivify_p_p_sc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), CONST(3).u.string);
+ PREG(1) = VTABLE_get_pmc_keyed_str(interp, PREG(2), SCONST(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed_str(interp, PREG(2), CONST(3).u.string, PREG(1));
+ VTABLE_set_pmc_keyed_str(interp, PREG(2), SCONST(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25582,24 +25585,24 @@
opcode_t *
Parrot_vivify_p_pc_sc_pc(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PREG(1) = VTABLE_get_pmc_keyed_str(interp, CONST(2).u.key, CONST(3).u.string);
+ PREG(1) = VTABLE_get_pmc_keyed_str(interp, PCONST(2), SCONST(3));
if (PMC_IS_NULL(PREG(1))) {
- PMC * const classobj = Parrot_oo_get_class(interp, CONST(4).u.key);
+ PMC * const classobj = Parrot_oo_get_class(interp, PCONST(4));
if (!PMC_IS_NULL(classobj))
PREG(1) = VTABLE_instantiate(interp, classobj, PMCNULL);
else {
- const INTVAL type = Parrot_pmc_get_type(interp, CONST(4).u.key);
+ const INTVAL type = Parrot_pmc_get_type(interp, PCONST(4));
if (type <= 0) {
opcode_t *dest = Parrot_ex_throw_from_op_args(
interp, cur_opcode + 5, EXCEPTION_NO_CLASS,
- "Class '%Ss' not found", VTABLE_get_repr(interp, CONST(4).u.key));return (opcode_t *)dest;
+ "Class '%Ss' not found", VTABLE_get_repr(interp, PCONST(4)));return (opcode_t *)dest;
}
PREG(1) = Parrot_pmc_new(interp, type);
}
- VTABLE_set_pmc_keyed_str(interp, CONST(2).u.key, CONST(3).u.string, PREG(1));
+ VTABLE_set_pmc_keyed_str(interp, PCONST(2), SCONST(3), PREG(1));
}
return (opcode_t *)cur_opcode + 5;}
@@ -25632,7 +25635,7 @@
opcode_t *
Parrot_new_p_sc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const name = CONST(2).u.string;
+ STRING * const name = SCONST(2);
PMC * const _class = Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp))
? Parrot_oo_get_class_str(interp, name)
: PMCNULL;
@@ -25664,7 +25667,7 @@
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
- VTABLE_set_integer_native(interp, initial, cur_opcode[3]);
+ VTABLE_set_integer_native(interp, initial, ICONST(3));
PREG(1) = VTABLE_instantiate(interp, _class, initial);
}
else {
@@ -25674,7 +25677,7 @@
EXCEPTION_NO_CLASS,
"Class '%Ss' not found", name);return (opcode_t *)dest;
}
- PREG(1) = Parrot_pmc_new_init_int(interp, type, cur_opcode[3]);
+ PREG(1) = Parrot_pmc_new_init_int(interp, type, ICONST(3));
}
return (opcode_t *)cur_opcode + 4;}
@@ -25682,14 +25685,14 @@
opcode_t *
Parrot_new_p_sc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- STRING * const name = CONST(2).u.string;
+ STRING * const name = SCONST(2);
PMC * const _class = Parrot_pcc_get_HLL(interp, CURRENT_CONTEXT(interp))
? Parrot_oo_get_class_str(interp, name)
: PMCNULL;
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp, Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
- VTABLE_set_integer_native(interp, initial, cur_opcode[3]);
+ VTABLE_set_integer_native(interp, initial, ICONST(3));
PREG(1) = VTABLE_instantiate(interp, _class, initial);
}
else {
@@ -25699,7 +25702,7 @@
EXCEPTION_NO_CLASS,
"Class '%Ss' not found", name);return (opcode_t *)dest;
}
- PREG(1) = Parrot_pmc_new_init_int(interp, type, cur_opcode[3]);
+ PREG(1) = Parrot_pmc_new_init_int(interp, type, ICONST(3));
}
return (opcode_t *)cur_opcode + 4;}
@@ -25739,7 +25742,7 @@
opcode_t *
Parrot_new_p_pc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const name_key = CONST(2).u.key;
+ PMC * const name_key = PCONST(2);
/* get_class() returns a PMCProxy for core types, so check for core PMCs */
const INTVAL type = Parrot_pmc_get_type(interp, name_key);
@@ -25782,14 +25785,14 @@
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
- VTABLE_set_integer_native(interp, initial, cur_opcode[3]);
+ VTABLE_set_integer_native(interp, initial, ICONST(3));
PREG(1) = VTABLE_instantiate(interp, _class, initial);
}
}
/* if it's a core PMC */
else if (type > enum_class_default)
- PREG(1) = Parrot_pmc_new_init_int(interp, type, cur_opcode[3]);
+ PREG(1) = Parrot_pmc_new_init_int(interp, type, ICONST(3));
/* it's a typo */
else {
@@ -25803,7 +25806,7 @@
opcode_t *
Parrot_new_p_pc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const name_key = CONST(2).u.key;
+ PMC * const name_key = PCONST(2);
/* get_class() returns a PMCProxy for core types, so check for core PMCs */
const INTVAL type = Parrot_pmc_get_type(interp, name_key);
@@ -25814,14 +25817,14 @@
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
- VTABLE_set_integer_native(interp, initial, cur_opcode[3]);
+ VTABLE_set_integer_native(interp, initial, ICONST(3));
PREG(1) = VTABLE_instantiate(interp, _class, initial);
}
}
/* if it's a core PMC */
else if (type > enum_class_default)
- PREG(1) = Parrot_pmc_new_init_int(interp, type, cur_opcode[3]);
+ PREG(1) = Parrot_pmc_new_init_int(interp, type, ICONST(3));
/* it's a typo */
else {
@@ -25869,7 +25872,7 @@
opcode_t *
Parrot_root_new_p_pc_i(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const name_key = CONST(2).u.key;
+ PMC * const name_key = PCONST(2);
/* get_class() returns a PMCProxy for core types, so check for core PMCs */
const INTVAL type = Parrot_pmc_get_type(interp, name_key);
@@ -25916,14 +25919,14 @@
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
- VTABLE_set_integer_native(interp, initial, cur_opcode[3]);
+ VTABLE_set_integer_native(interp, initial, ICONST(3));
PREG(1) = VTABLE_instantiate(interp, _class, initial);
}
}
/* if it's a core PMC */
else if (type > enum_class_default)
- PREG(1) = Parrot_pmc_new_init_int(interp, type, cur_opcode[3]);
+ PREG(1) = Parrot_pmc_new_init_int(interp, type, ICONST(3));
/* it's a typo */
else {
@@ -25937,7 +25940,7 @@
opcode_t *
Parrot_root_new_p_pc_ic(opcode_t *cur_opcode, PARROT_INTERP) {
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
- PMC * const name_key = CONST(2).u.key;
+ PMC * const name_key = PCONST(2);
/* get_class() returns a PMCProxy for core types, so check for core PMCs */
const INTVAL type = Parrot_pmc_get_type(interp, name_key);
@@ -25950,14 +25953,14 @@
if (!PMC_IS_NULL(_class)) {
PMC *initial = Parrot_pmc_new(interp,
Parrot_get_ctx_HLL_type(interp, enum_class_Integer));
- VTABLE_set_integer_native(interp, initial, cur_opcode[3]);
+ VTABLE_set_integer_native(interp, initial, ICONST(3));
PREG(1) = VTABLE_instantiate(interp, _class, initial);
}
}
/* if it's a core PMC */
else if (type > enum_class_default)
- PREG(1) = Parrot_pmc_new_init_int(interp, type, cur_opcode[3]);
+ PREG(1) = Parrot_pmc_new_init_int(interp, type, ICONST(3));
/* it's a typo */
else {
@@ -25989,7 +25992,7 @@
const Parrot_Context * const CUR_CTX = Parrot_pcc_get_context_struct(interp, interp->ctx);
#if PARROT_HAS_ICU
UErrorCode err = U_ZERO_ERROR;
- char * const cstr = Parrot_str_to_cstring(interp, CONST(2).u.string);
+ char * const cstr = Parrot_str_to_cstring(interp, SCONST(2));
UChar32 codepoint = u_charFromName(U_EXTENDED_CHAR_NAME, cstr, &err);
Parrot_str_free_cstring(cstr);
IREG(1) = U_SUCCESS(err) ? (INTVAL) codepoint : -1;
@@ -26045,13 +26048,13 @@
/* Go to the next op after loop unrolling */
opcode_t * const dest = cur_opcode + 2;
PMC *eh = PMCNULL;
- if (!PMC_IS_NULL(CONST(1).u.key)) {
+ if (!PMC_IS_NULL(PCONST(1))) {
/* If isa ExceptionHandler, use it. If isa Exception, get its active handler */
- if (VTABLE_isa(interp, CONST(1).u.key, Parrot_str_new_constant(interp, "ExceptionHandler")))
- eh = CONST(1).u.key;
- else if (VTABLE_isa(interp, CONST(1).u.key, Parrot_str_new_constant(interp, "Exception"))) {
+ if (VTABLE_isa(interp, PCONST(1), Parrot_str_new_constant(interp, "ExceptionHandler")))
+ eh = PCONST(1);
+ else if (VTABLE_isa(interp, PCONST(1), Parrot_str_new_constant(interp, "Exception"))) {
PMC *iter = VTABLE_get_attr_str(interp,
- CONST(1).u.key, Parrot_str_new_constant(interp, "handler_iter"));
+ PCONST(1), Parrot_str_new_constant(interp, "handler_iter"));
if (!PMC_IS_NULL(iter))
eh = VTABLE_get_pmc_keyed_int(interp, iter, -1);
}
Modified: branches/string_macros/src/packdump.c
==============================================================================
--- branches/string_macros/src/packdump.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/packdump.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -29,9 +29,16 @@
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-static void PackFile_Constant_dump(PARROT_INTERP,
+static void PackFile_Constant_dump_pmc(PARROT_INTERP,
ARGIN(const PackFile_ConstTable *ct),
- ARGIN(const PackFile_Constant *self))
+ ARGIN(PMC *self))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
+static void PackFile_Constant_dump_str(PARROT_INTERP,
+ ARGIN(const PackFile_ConstTable *ct),
+ ARGIN(const STRING *self))
__attribute__nonnull__(1)
__attribute__nonnull__(2)
__attribute__nonnull__(3);
@@ -39,7 +46,11 @@
static void pobj_flag_dump(PARROT_INTERP, long flags)
__attribute__nonnull__(1);
-#define ASSERT_ARGS_PackFile_Constant_dump __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+#define ASSERT_ARGS_PackFile_Constant_dump_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(ct) \
+ , PARROT_ASSERT_ARG(self))
+#define ASSERT_ARGS_PackFile_Constant_dump_str __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ct) \
, PARROT_ASSERT_ARG(self))
@@ -67,9 +78,19 @@
ASSERT_ARGS(PackFile_ConstTable_dump)
opcode_t i;
- for (i = 0; i < self->const_count; ++i) {
+ for (i = 0; i < self->num.const_count; i++) {
Parrot_io_printf(interp, " # %x:\n", (long)i);
- PackFile_Constant_dump(interp, self, &self->constants[i]);
+ Parrot_io_printf(interp, " [ 'PFC_NUMBER', %g ],\n", self->num.constants[i]);
+ }
+
+ for (i = 0; i < self->str.const_count; i++) {
+ Parrot_io_printf(interp, " # %x:\n", (long)i);
+ PackFile_Constant_dump_str(interp, self, self->str.constants[i]);
+ }
+
+ for (i = 0; i < self->pmc.const_count; i++) {
+ Parrot_io_printf(interp, " # %x:\n", (long)i);
+ PackFile_Constant_dump_pmc(interp, self, self->pmc.constants[i]);
}
}
@@ -152,42 +173,61 @@
Parrot_io_printf(interp, ")\n");
}
+
+/*
+
+=item C<static void PackFile_Constant_dump_str(PARROT_INTERP, const
+PackFile_ConstTable *ct, const STRING *self)>
+
+Print the representation of a string constant.
+
+=cut
+
+*/
+
static void
-PackFile_Constant_dump(PARROT_INTERP, ARGIN(const PackFile_ConstTable *ct),
- ARGIN(const PackFile_Constant *self))
+PackFile_Constant_dump_str(PARROT_INTERP, ARGIN(const PackFile_ConstTable *ct),
+ ARGIN(const STRING *self))
{
- ASSERT_ARGS(PackFile_Constant_dump)
- PMC *key;
- size_t i;
-
- switch (self->type) {
-
- case PFC_NUMBER:
- Parrot_io_printf(interp, " [ 'PFC_NUMBER', %g ],\n", self->u.number);
- break;
-
- case PFC_STRING:
- Parrot_io_printf(interp, " [ 'PFC_STRING', {\n");
- pobj_flag_dump(interp, (long)PObj_get_FLAGS(self->u.string));
- Parrot_io_printf(interp, " ENCODING => %ld,\n",
- self->u.string->encoding);
- i = self->u.string->bufused;
- Parrot_io_printf(interp, " SIZE => %ld,\n",
- (long)i);
+ ASSERT_ARGS(PackFile_Constant_dump_str)
- Parrot_io_printf(interp, " DATA => \"%Ss\"\n",
- Parrot_str_escape(interp, self->u.string));
- Parrot_io_printf(interp, " } ],\n");
- break;
+ Parrot_io_printf(interp, " [ 'PFC_STRING', {\n");
+ pobj_flag_dump(interp, (long)PObj_get_FLAGS(self));
+ Parrot_io_printf(interp, " ENCODING => %ld,\n", self->encoding);
+ Parrot_io_printf(interp, " SIZE => %ld,\n", self->bufused);
+ Parrot_io_printf(interp, " DATA => \"%Ss\"\n",
+ Parrot_str_escape(interp, self));
+ Parrot_io_printf(interp, " } ],\n");
+}
+
+
+/*
- case PFC_KEY:
- for (i = 0, key = self->u.key; key; ++i) {
+=item C<static void PackFile_Constant_dump_pmc(PARROT_INTERP, const
+PackFile_ConstTable *ct, PMC *self)>
+
+Print the representation of a PMC constant.
+
+=cut
+
+*/
+
+static void
+PackFile_Constant_dump_pmc(PARROT_INTERP, ARGIN(const PackFile_ConstTable *ct),
+ ARGIN(PMC *self))
+{
+ ASSERT_ARGS(PackFile_Constant_dump_pmc)
+
+ if (self->vtable->base_type == enum_class_Key) {
+ size_t i;
+ PMC *key;
+ for (i = 0, key = self; key; i++) {
GETATTR_Key_next_key(interp, key, key);
}
/* number of key components */
Parrot_io_printf(interp, " [ 'PFC_KEY' (%ld items)\n", i);
/* and now type / value per component */
- for (key = self->u.key; key;) {
+ for (key = self; key;) {
opcode_t type = PObj_get_FLAGS(key);
Parrot_io_printf(interp, " {\n");
@@ -198,36 +238,37 @@
case KEY_integer_FLAG:
Parrot_io_printf(interp, " TYPE => INTEGER\n");
Parrot_io_printf(interp, " DATA => %ld\n",
- VTABLE_get_integer(interp, key));
+ key_integer(interp, key));
Parrot_io_printf(interp, " },\n");
break;
case KEY_number_FLAG:
{
- const PackFile_Constant *detail;
size_t ct_index;
+ FLOATVAL n = key_number(interp, key);
Parrot_io_printf(interp, " TYPE => NUMBER\n");
- ct_index = PackFile_find_in_const(interp, ct, key, PFC_NUMBER);
+ ct_index = PackFile_ConstTable_rlookup_num(interp, ct, n);
Parrot_io_printf(interp, " PFC_OFFSET => %ld\n", ct_index);
- detail = &ct->constants[ct_index];
- Parrot_io_printf(interp, " DATA => %ld\n", detail->u.number);
+ Parrot_io_printf(interp, " DATA => %ld\n",
+ ct->num.constants[ct_index]);
Parrot_io_printf(interp, " },\n");
}
break;
+
case KEY_string_FLAG:
{
- const PackFile_Constant *detail;
size_t ct_index;
+ STRING *s = key_string(interp, key);
Parrot_io_printf(interp, " TYPE => STRING\n");
- ct_index = PackFile_find_in_const(interp, ct, key, PFC_STRING);
+ ct_index = PackFile_ConstTable_rlookup_str(interp, ct, s);
Parrot_io_printf(interp, " PFC_OFFSET => %ld\n", ct_index);
- detail = &ct->constants[ct_index];
Parrot_io_printf(interp, " DATA => '%Ss'\n",
- detail->u.string);
+ ct->str.constants[ct_index]);
Parrot_io_printf(interp, " },\n");
}
break;
+
case KEY_integer_FLAG | KEY_register_FLAG:
Parrot_io_printf(interp, " TYPE => I REGISTER\n");
Parrot_io_printf(interp, " DATA => %ld\n",
@@ -260,144 +301,102 @@
GETATTR_Key_next_key(interp, key, key);
}
Parrot_io_printf(interp, " ],\n");
- break;
- case PFC_PMC:
+ }
+ else {
+ Parrot_Sub_attributes *sub;
+ STRING * const null = Parrot_str_new_constant(interp, "(null)");
+ STRING *namespace_description;
+
Parrot_io_printf(interp, " [ 'PFC_PMC', {\n");
- {
- PMC * const pmc = self->u.key;
- Parrot_Sub_attributes *sub;
- STRING * const null = Parrot_str_new_constant(interp, "(null)");
- STRING *namespace_description;
-
- pobj_flag_dump(interp, (long)PObj_get_FLAGS(pmc));
- switch (pmc->vtable->base_type) {
- case enum_class_FixedBooleanArray:
- case enum_class_FixedFloatArray:
- case enum_class_FixedPMCArray:
- case enum_class_FixedStringArray:
- case enum_class_ResizableBooleanArray:
- case enum_class_ResizableIntegerArray:
- case enum_class_ResizableFloatArray:
- case enum_class_ResizablePMCArray:
- case enum_class_ResizableStringArray:
+ pobj_flag_dump(interp, (long)PObj_get_FLAGS(self));
+ switch (self->vtable->base_type) {
+ case enum_class_FixedBooleanArray:
+ case enum_class_FixedFloatArray:
+ case enum_class_FixedPMCArray:
+ case enum_class_FixedStringArray:
+ case enum_class_ResizableBooleanArray:
+ case enum_class_ResizableIntegerArray:
+ case enum_class_ResizableFloatArray:
+ case enum_class_ResizablePMCArray:
+ case enum_class_ResizableStringArray:
{
- const int n = VTABLE_get_integer(interp, pmc);
- STRING* const out_buffer = VTABLE_get_repr(interp, pmc);
+ const int n = VTABLE_get_integer(interp, self);
+ STRING* const out_buffer = VTABLE_get_repr(interp, self);
Parrot_io_printf(interp,
"\t\tclass => %Ss,\n"
"\t\telement count => %d,\n"
"\t\telements => %Ss,\n",
- pmc->vtable->whoami,
+ self->vtable->whoami,
n,
out_buffer);
}
break;
- case enum_class_Sub:
- case enum_class_Coroutine:
- PMC_get_sub(interp, pmc, sub);
+ case enum_class_Sub:
+ case enum_class_Coroutine:
+ PMC_get_sub(interp, self, sub);
if (sub->namespace_name) {
switch (sub->namespace_name->vtable->base_type) {
- case enum_class_String:
- namespace_description = Parrot_str_new(interp, "'", 1);
- namespace_description = Parrot_str_concat(interp,
- namespace_description,
- VTABLE_get_string(interp, sub->namespace_name));
- namespace_description = Parrot_str_concat(interp,
- namespace_description,
- Parrot_str_new(interp, "'", 1));
- break;
- case enum_class_Key:
- namespace_description =
- key_set_to_string(interp, sub->namespace_name);
- break;
- default:
- namespace_description = sub->namespace_name->vtable->whoami;
+ case enum_class_String:
+ namespace_description = Parrot_str_new(interp, "'", 1);
+ namespace_description = Parrot_str_concat(interp,
+ namespace_description,
+ VTABLE_get_string(interp, sub->namespace_name));
+ namespace_description = Parrot_str_concat(interp,
+ namespace_description,
+ Parrot_str_new(interp, "'", 1));
+ break;
+ case enum_class_Key:
+ namespace_description =
+ key_set_to_string(interp, sub->namespace_name);
+ break;
+ default:
+ namespace_description = sub->namespace_name->vtable->whoami;
}
}
else {
namespace_description = null;
}
Parrot_io_printf(interp,
- "\t\tclass => %Ss,\n"
- "\t\tstart_offs => %d,\n"
- "\t\tend_offs => %d,\n"
- "\t\tname => '%Ss',\n"
- "\t\tsubid => '%Ss',\n"
- "\t\tmethod => '%Ss',\n"
- "\t\tnsentry => '%Ss',\n"
- "\t\tnamespace => %Ss,\n"
- "\t\tHLL_id => %d,\n"
- "\t\tn_regs_used => [ %d, %d, %d, %d ],\n",
- pmc->vtable->whoami,
- sub->start_offs,
- sub->end_offs,
- sub->name,
- sub->subid,
- sub->method_name,
- sub->ns_entry_name,
- namespace_description,
- sub->HLL_id,
- sub->n_regs_used[0],
- sub->n_regs_used[1],
- sub->n_regs_used[2],
- sub->n_regs_used[3]);
+ "\t\tclass => %Ss,\n"
+ "\t\tstart_offs => %d,\n"
+ "\t\tend_offs => %d,\n"
+ "\t\tname => '%Ss',\n"
+ "\t\tsubid => '%Ss',\n"
+ "\t\tmethod => '%Ss',\n"
+ "\t\tnsentry => '%Ss',\n"
+ "\t\tnamespace => %Ss,\n"
+ "\t\tHLL_id => %d,\n"
+ "\t\tn_regs_used => [ %d, %d, %d, %d ],\n",
+ self->vtable->whoami,
+ sub->start_offs,
+ sub->end_offs,
+ sub->name,
+ sub->subid,
+ sub->method_name,
+ sub->ns_entry_name,
+ namespace_description,
+ sub->HLL_id,
+ sub->n_regs_used[0],
+ sub->n_regs_used[1],
+ sub->n_regs_used[2],
+ sub->n_regs_used[3]);
break;
- case enum_class_FixedIntegerArray:
+ case enum_class_FixedIntegerArray:
Parrot_io_printf(interp,
- "\t\tclass => %Ss,\n"
- "\t\trepr => '%Ss'\n",
- pmc->vtable->whoami,
- VTABLE_get_repr(interp, pmc));
+ "\t\tclass => %Ss,\n"
+ "\t\trepr => '%Ss'\n",
+ self->vtable->whoami,
+ VTABLE_get_repr(interp, self));
break;
- default:
+ default:
Parrot_io_printf(interp, "\t\tno dump info for PMC %ld %Ss\n",
- pmc->vtable->base_type, pmc->vtable->whoami);
- Parrot_io_printf(interp, "\t\tclass => %Ss,\n", pmc->vtable->whoami);
- }
+ self->vtable->base_type, self->vtable->whoami);
+ Parrot_io_printf(interp, "\t\tclass => %Ss,\n", self->vtable->whoami);
}
Parrot_io_printf(interp, " } ],\n");
- break;
- default:
- Parrot_io_printf(interp, " [ 'PFC_\?\?\?', type '0x%x' ],\n",
- self->type);
- break;
}
}
-/*
-
-=item C<void PackFile_Fixup_dump(PARROT_INTERP, const PackFile_FixupTable *ft)>
-
-Dumps the fix-up table C<ft>.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-PackFile_Fixup_dump(PARROT_INTERP, ARGIN(const PackFile_FixupTable *ft))
-{
- ASSERT_ARGS(PackFile_Fixup_dump)
- opcode_t i;
-
- for (i = 0; i < ft->fixup_count; ++i) {
- Parrot_io_printf(interp, "\t#%d\n", (int) i);
- switch (ft->fixups[i].type) {
- case enum_fixup_sub:
- Parrot_io_printf(interp,
- "\ttype => %d offs => %8d name => '%s',\n",
- (int)ft->fixups[i].type,
- (int)ft->fixups[i].offset,
- ft->fixups[i].name);
- break;
- default:
- Parrot_io_printf(interp, "\ttype => %d ???,\n",
- (int) ft->fixups[i].type);
- break;
- }
- }
-}
/*
Modified: branches/string_macros/src/packfile.c
==============================================================================
--- branches/string_macros/src/packfile.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/packfile.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -81,13 +81,9 @@
__attribute__nonnull__(3)
FUNC_MODIFIES(*self);
-static void clone_constant(PARROT_INTERP,
- ARGIN(PackFile_Constant *old_const),
- ARGMOD(PackFile_Constant *new_const))
+static void clone_constant(PARROT_INTERP, ARGIN(PMC **c))
__attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3)
- FUNC_MODIFIES(*new_const);
+ __attribute__nonnull__(2);
static void compile_or_load_file(PARROT_INTERP,
ARGIN(STRING *path),
@@ -215,66 +211,11 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
-static PackFile_Constant * find_constants(PARROT_INTERP,
+static PackFile_ConstTable * find_constants(PARROT_INTERP,
ARGIN(PackFile_ConstTable *ct))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PackFile_FixupEntry * find_fixup(
- ARGMOD(PackFile_FixupTable *ft),
- INTVAL type,
- ARGIN(const char *name))
- __attribute__nonnull__(1)
- __attribute__nonnull__(3)
- FUNC_MODIFIES(*ft);
-
-static INTVAL find_fixup_iter(PARROT_INTERP,
- ARGIN(PackFile_Segment *seg),
- ARGIN(void *user_data))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
-static void fixup_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*self);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static PackFile_Segment * fixup_new(PARROT_INTERP,
- SHIM(PackFile *pf),
- SHIM(STRING *name),
- SHIM(int add))
- __attribute__nonnull__(1);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static opcode_t * fixup_pack(PARROT_INTERP,
- ARGIN(PackFile_Segment *self),
- ARGOUT(opcode_t *cursor))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3)
- FUNC_MODIFIES(*cursor);
-
-static size_t fixup_packed_size(PARROT_INTERP,
- ARGMOD(PackFile_Segment *self))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- FUNC_MODIFIES(*self);
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static const opcode_t * fixup_unpack(PARROT_INTERP,
- ARGIN(PackFile_Segment *seg),
- ARGIN(const opcode_t *cursor))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(3);
-
PARROT_CANNOT_RETURN_NULL
static PMC * make_annotation_value_pmc(PARROT_INTERP,
ARGIN(PackFile_Annotations *self),
@@ -298,6 +239,15 @@
ARGIN_NULLOK(const char *filename))
__attribute__nonnull__(1);
+PARROT_WARN_UNUSED_RESULT
+PARROT_CANNOT_RETURN_NULL
+static PMC * PackFile_Constant_unpack_pmc(PARROT_INTERP,
+ ARGIN(PackFile_ConstTable *constt),
+ ARGIN(const opcode_t **cursor))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ __attribute__nonnull__(3);
+
static void PackFile_set_header(ARGOUT(PackFile_Header *header))
__attribute__nonnull__(1)
FUNC_MODIFIES(*header);
@@ -393,8 +343,7 @@
, PARROT_ASSERT_ARG(cursor))
#define ASSERT_ARGS_clone_constant __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(old_const) \
- , PARROT_ASSERT_ARG(new_const))
+ , PARROT_ASSERT_ARG(c))
#define ASSERT_ARGS_compile_or_load_file __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(path))
@@ -451,29 +400,6 @@
#define ASSERT_ARGS_find_constants __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(ct))
-#define ASSERT_ARGS_find_fixup __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(ft) \
- , PARROT_ASSERT_ARG(name))
-#define ASSERT_ARGS_find_fixup_iter __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(seg) \
- , PARROT_ASSERT_ARG(user_data))
-#define ASSERT_ARGS_fixup_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_fixup_new __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_fixup_pack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(self) \
- , PARROT_ASSERT_ARG(cursor))
-#define ASSERT_ARGS_fixup_packed_size __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_fixup_unpack __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(seg) \
- , PARROT_ASSERT_ARG(cursor))
#define ASSERT_ARGS_make_annotation_value_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(self))
@@ -484,6 +410,10 @@
, PARROT_ASSERT_ARG(ct))
#define ASSERT_ARGS_PackFile_append_pbc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
+#define ASSERT_ARGS_PackFile_Constant_unpack_pmc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+ PARROT_ASSERT_ARG(interp) \
+ , PARROT_ASSERT_ARG(constt) \
+ , PARROT_ASSERT_ARG(cursor))
#define ASSERT_ARGS_PackFile_set_header __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(header))
#define ASSERT_ARGS_pf_debug_destroy __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
@@ -631,12 +561,6 @@
if (!pf->cur_cs)
pf->cur_cs = (PackFile_ByteCode *)seg;
break;
- case PF_FIXUP_SEG:
- if (!pf->cur_cs->fixups) {
- pf->cur_cs->fixups = (PackFile_FixupTable *)seg;
- pf->cur_cs->fixups->code = pf->cur_cs;
- }
- break;
case PF_CONST_SEG:
if (!pf->cur_cs->const_table) {
pf->cur_cs->const_table = (PackFile_ConstTable *)seg;
@@ -736,7 +660,7 @@
PMC *retval = PMCNULL;
Parrot_pcc_set_constants(interp, CURRENT_CONTEXT(interp),
- interp->code->const_table->constants);
+ interp->code->const_table);
Parrot_ext_call(interp, sub_pmc, "->P", &retval);
interp->run_core = old_core;
@@ -855,29 +779,13 @@
mark_1_seg(PARROT_INTERP, ARGMOD(PackFile_ConstTable *ct))
{
ASSERT_ARGS(mark_1_seg)
- PackFile_Constant * const constants = find_constants(interp, ct);
opcode_t i;
- for (i = 0; i < ct->const_count; ++i) {
- switch (constants[i].type) {
- case PFC_PMC:
- case PFC_KEY:
- {
- PMC * const pmc = constants[i].u.key;
- Parrot_gc_mark_PMC_alive(interp, pmc);
- break;
- }
- case PFC_STRING:
- {
- STRING * const string = constants[i].u.string;
- Parrot_gc_mark_STRING_alive(interp, string);
- break;
- }
- default:
- /* Do nothing. */
- break;
- }
- }
+ for (i = 0; i < ct->str.const_count; i++)
+ Parrot_gc_mark_STRING_alive(interp, ct->str.constants[i]);
+
+ for (i = 0; i < ct->pmc.const_count; i++)
+ Parrot_gc_mark_PMC_alive(interp, ct->pmc.constants[i]);
}
@@ -968,46 +876,32 @@
pbc_action_enum_t action, ARGIN_NULLOK(PMC *eval_pmc))
{
ASSERT_ARGS(do_sub_pragmas)
- PackFile_FixupTable * const ft = self->fixups;
PackFile_ConstTable * const ct = self->const_table;
opcode_t i;
TRACE_PRINTF(("PackFile: do_sub_pragmas (action=%d)\n", action));
- for (i = 0; i < ft->fixup_count; ++i) {
- switch (ft->fixups[i].type) {
- case enum_fixup_sub:
- {
- /* offset is an index into const_table holding the Sub PMC */
- PMC *sub_pmc;
- Parrot_Sub_attributes *sub;
- const opcode_t ci = ft->fixups[i].offset;
-
- if (ci < 0 || ci >= ct->const_count)
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
- "Illegal fixup offset (%d) in enum_fixup_sub");
-
- sub_pmc = ct->constants[ci].u.key;
- PMC_get_sub(interp, sub_pmc, sub);
- sub->eval_pmc = eval_pmc;
-
- if (((PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_MASK)
- || (Sub_comp_get_FLAGS(sub) & SUB_COMP_FLAG_MASK))
- && sub_pragma(interp, action, sub_pmc)) {
- PMC * const result = do_1_sub_pragma(interp, sub_pmc,
- action);
-
- /* replace Sub PMC with computation results */
- if (action == PBC_IMMEDIATE && !PMC_IS_NULL(result)) {
- ft->fixups[i].type = enum_fixup_none;
- ct->constants[ci].u.key = result;
- }
+ for (i = 0; i < ct->pmc.const_count; ++i) {
+ STRING * const SUB = CONST_STRING(interp, "Sub");
+ PMC *sub_pmc = ct->pmc.constants[i];
+
+ if (VTABLE_isa(interp, sub_pmc, SUB)) {
+ Parrot_Sub_attributes *sub;
+
+ PMC_get_sub(interp, sub_pmc, sub);
+ sub->eval_pmc = eval_pmc;
+
+ if (((PObj_get_FLAGS(sub_pmc) & SUB_FLAG_PF_MASK)
+ || (Sub_comp_get_FLAGS(sub) & SUB_COMP_FLAG_MASK))
+ && sub_pragma(interp, action, sub_pmc)) {
+ PMC * const result = do_1_sub_pragma(interp, sub_pmc,
+ action);
+
+ /* replace Sub PMC with computation results */
+ if (action == PBC_IMMEDIATE && !PMC_IS_NULL(result)) {
+ ct->pmc.constants[i] = result;
}
-
- break;
}
- default:
- break;
}
}
}
@@ -1683,15 +1577,6 @@
default_dump
};
- static const PackFile_funcs fixupf = {
- fixup_new,
- fixup_destroy,
- fixup_packed_size,
- fixup_pack,
- fixup_unpack,
- default_dump
- };
-
static const PackFile_funcs constf = {
const_new,
const_destroy,
@@ -1730,7 +1615,6 @@
PackFile_funcs_register(interp, pf, PF_DIR_SEG, dirf);
PackFile_funcs_register(interp, pf, PF_UNKNOWN_SEG, defaultf);
- PackFile_funcs_register(interp, pf, PF_FIXUP_SEG, fixupf);
PackFile_funcs_register(interp, pf, PF_CONST_SEG, constf);
PackFile_funcs_register(interp, pf, PF_BYTEC_SEG, bytef);
PackFile_funcs_register(interp, pf, PF_DEBUG_SEG, debugf);
@@ -1807,7 +1691,7 @@
=item C<PackFile_ByteCode * PF_create_default_segs(PARROT_INTERP, STRING
*file_name, int add)>
-Creates the bytecode, constant, and fixup segments for C<file_name>. If C<add>
+Creates the bytecode and constant segments for C<file_name>. If C<add>
is true, the current packfile becomes the owner of these segments by adding the
segments to the directory.
@@ -1827,12 +1711,6 @@
(PackFile_ByteCode *)create_seg(interp, &pf->directory,
PF_BYTEC_SEG, BYTE_CODE_SEGMENT_NAME, file_name, add);
- cur_cs->fixups =
- (PackFile_FixupTable *)create_seg(interp, &pf->directory,
- PF_FIXUP_SEG, FIXUP_TABLE_SEGMENT_NAME, file_name, add);
-
- cur_cs->fixups->code = cur_cs;
-
cur_cs->const_table =
(PackFile_ConstTable *)create_seg(interp, &pf->directory,
PF_CONST_SEG, CONSTANT_SEGMENT_NAME, file_name, add);
@@ -2316,27 +2194,13 @@
}
}
- seg = dir->segments[1];
-
- if (seg->type != PF_FIXUP_SEG) {
- size_t i;
-
- for (i = 2; i < num_segs; ++i) {
- PackFile_Segment * const s2 = dir->segments[i];
- if (s2->type == PF_FIXUP_SEG) {
- dir->segments[1] = s2;
- dir->segments[i] = seg;
- break;
- }
- }
- }
/* XXX
* Temporary? hack to put ConstantTable in front of other segments.
* This is useful for Annotations because we ensure that constants used
* for keys already available during unpack.
*/
- seg = dir->segments[2];
+ seg = dir->segments[1];
if (seg->type != PF_CONST_SEG) {
size_t i;
@@ -2650,7 +2514,6 @@
byte_code->annotations = NULL;
byte_code->const_table = NULL;
byte_code->debugs = NULL;
- byte_code->fixups = NULL;
byte_code->op_func_table = NULL;
byte_code->op_info_table = NULL;
byte_code->op_mapping.libs = NULL;
@@ -3082,7 +2945,7 @@
Parrot_io_printf(interp, " OFFSET => %d,\n",
debug->mappings[i].offset);
Parrot_io_printf(interp, " FILENAME => %Ss\n",
- PF_CONST(debug->code, debug->mappings[i].filename).u.string);
+ debug->code->const_table->str.constants[debug->mappings[i].filename]);
Parrot_io_printf(interp, " ],\n");
}
@@ -3167,9 +3030,9 @@
if (debug->num_mappings) {
prev_filename_n = debug->mappings[debug->num_mappings-1].filename;
filename_pstr = Parrot_str_new(interp, filename, 0);
- if (ct->constants[prev_filename_n].type == PFC_STRING &&
+ if (ct->str.constants[prev_filename_n] &&
STRING_equal(interp, filename_pstr,
- ct->constants[prev_filename_n].u.string)) {
+ ct->str.constants[prev_filename_n])) {
return;
}
}
@@ -3203,15 +3066,14 @@
PackFile_DebugFilenameMapping *mapping = debug->mappings + insert_pos;
STRING *namestr = Parrot_str_new_init(interp, filename, strlen(filename),
Parrot_default_encoding_ptr, 0);
- size_t count = ct->const_count;
+ size_t count = ct->str.const_count;
size_t i;
mapping->offset = offset;
/* Check if there is already a constant with this filename */
for (i= 0; i < count; ++i) {
- if (ct->constants[i].type == PFC_STRING &&
- STRING_equal(interp, namestr, ct->constants[i].u.string))
+ if (STRING_equal(interp, namestr, ct->str.constants[i]))
break;
}
if (i < count) {
@@ -3220,14 +3082,11 @@
}
else {
/* Not found, create a new one */
- PackFile_Constant *fnconst;
- ct->const_count = ct->const_count + 1;
- ct->constants = mem_gc_realloc_n_typed_zeroed(interp, ct->constants,
- ct->const_count, ct->const_count - 1, PackFile_Constant);
-
- fnconst = &ct->constants[ct->const_count - 1];
- fnconst->type = PFC_STRING;
- fnconst->u.string = Parrot_str_new_init(interp, filename, strlen(filename),
+ ct->str.const_count++;
+ ct->str.constants = mem_gc_realloc_n_typed_zeroed(interp, ct->str.constants,
+ ct->str.const_count, ct->str.const_count - 1, STRING *);
+ ct->str.constants[ct->str.const_count - 1] =
+ Parrot_str_new_init(interp, filename, strlen(filename),
Parrot_default_encoding_ptr,
PObj_constant_FLAG);
}
@@ -3268,8 +3127,7 @@
if (i + 1 == debug->num_mappings
|| (debug->mappings[i].offset <= pc
&& debug->mappings[i + 1].offset > pc))
- return PF_CONST(debug->code,
- debug->mappings[i].filename).u.string;
+ return debug->code->const_table->str.constants[debug->mappings[i].filename];
}
/* Otherwise, no mappings == no filename. */
@@ -3349,9 +3207,10 @@
}
interp->code = new_cs;
+
Parrot_pcc_set_constants(interp, CURRENT_CONTEXT(interp), really
? find_constants(interp, new_cs->const_table)
- : new_cs->const_table->constants);
+ : new_cs->const_table);
if (really)
prepare_for_run(interp);
@@ -3362,8 +3221,7 @@
/*
-=item C<static void clone_constant(PARROT_INTERP, PackFile_Constant *old_const,
-PackFile_Constant *new_const)>
+=item C<static void clone_constant(PARROT_INTERP, PMC **c)>
Clones a constant (at least, if it's a Sub PMC), returning the clone.
@@ -3372,20 +3230,16 @@
*/
static void
-clone_constant(PARROT_INTERP, ARGIN(PackFile_Constant *old_const),
-ARGMOD(PackFile_Constant *new_const))
+clone_constant(PARROT_INTERP, ARGIN(PMC **c))
{
ASSERT_ARGS(clone_constant)
STRING * const _sub = CONST_STRING(interp, "Sub");
- memcpy(new_const, old_const, sizeof (PackFile_Constant));
-
- if (old_const->type == PFC_PMC
- && VTABLE_isa(interp, old_const->u.key, _sub)) {
+ if (VTABLE_isa(interp, *c, _sub)) {
PMC *old_sub_pmc, *new_sub_pmc;
Parrot_Sub_attributes *old_sub, *new_sub;
- old_sub_pmc = old_const->u.key;
+ old_sub_pmc = *c;
new_sub_pmc = Parrot_thaw_constants(interp, Parrot_freeze(interp, old_sub_pmc));
PMC_get_sub(interp, new_sub_pmc, new_sub);
@@ -3397,14 +3251,14 @@
&& !(old_sub->comp_flags & SUB_COMP_FLAG_METHOD))
Parrot_ns_store_sub(interp, new_sub_pmc);
- new_const->u.key = new_sub_pmc;
+ *c = new_sub_pmc;
}
}
/*
-=item C<static PackFile_Constant * find_constants(PARROT_INTERP,
+=item C<static PackFile_ConstTable * find_constants(PARROT_INTERP,
PackFile_ConstTable *ct)>
Finds the constant table associated with a thread. For now, we need to copy
@@ -3417,17 +3271,17 @@
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
-static PackFile_Constant *
+static PackFile_ConstTable *
find_constants(PARROT_INTERP, ARGIN(PackFile_ConstTable *ct))
{
ASSERT_ARGS(find_constants)
if (!n_interpreters
|| !interp->thread_data
|| interp->thread_data->tid == 0)
- return ct->constants;
+ return ct;
else {
- Hash *tables;
- PackFile_Constant *new_consts;
+ Hash *tables;
+ PackFile_ConstTable *new_ct;
PARROT_ASSERT(interp->thread_data);
@@ -3435,25 +3289,40 @@
interp->thread_data->const_tables = parrot_new_pointer_hash(interp);
}
- tables = interp->thread_data->const_tables;
- new_consts = (PackFile_Constant *)parrot_hash_get(interp, tables, ct);
+ tables = interp->thread_data->const_tables;
+ new_ct = (PackFile_ConstTable *)parrot_hash_get(interp, tables, ct);
- if (!new_consts) {
+ if (!new_ct) {
/* need to construct it */
- PackFile_Constant * const old_consts = ct->constants;
- INTVAL const num_consts = ct->const_count;
- INTVAL i;
- new_consts = mem_gc_allocate_n_zeroed_typed(interp,
- num_consts, PackFile_Constant);
+ int i;
+
+ new_ct = mem_gc_allocate_zeroed_typed(interp, PackFile_ConstTable);
- for (i = 0; i < num_consts; ++i)
- clone_constant(interp, &old_consts[i], &new_consts[i]);
+ new_ct->num.const_count = ct->num.const_count;
+ new_ct->num.constants = mem_gc_allocate_n_zeroed_typed(interp,
+ ct->num.const_count, FLOATVAL);
+ memcpy(new_ct->num.constants, ct->num.constants,
+ ct->num.const_count * sizeof (FLOATVAL));
+
+ new_ct->str.const_count = ct->str.const_count;
+ new_ct->str.constants = mem_gc_allocate_n_zeroed_typed(interp,
+ ct->str.const_count, STRING *);
+ memcpy(new_ct->str.constants, ct->str.constants,
+ ct->str.const_count * sizeof (STRING *));
+
+ new_ct->pmc.const_count = ct->pmc.const_count;
+ new_ct->pmc.constants = mem_gc_allocate_n_zeroed_typed(interp,
+ ct->pmc.const_count, PMC *);
+ memcpy(new_ct->pmc.constants, ct->pmc.constants,
+ ct->pmc.const_count * sizeof (PMC *));
+ for (i = 0; i < new_ct->pmc.const_count; ++i)
+ clone_constant(interp, &new_ct->pmc.constants[i]);
- parrot_hash_put(interp, tables, ct, new_consts);
+ parrot_hash_put(interp, tables, ct, new_ct);
}
- return new_consts;
+ return new_ct;
}
}
@@ -3476,6 +3345,8 @@
UINTVAL i;
Hash *hash;
+ return;
+
if (!interp->thread_data)
return;
@@ -3486,401 +3357,12 @@
parrot_hash_iterate(hash,
PackFile_ConstTable * const table = (PackFile_ConstTable *)_bucket->key;
- PackFile_Constant * const orig_consts = table->constants;
- PackFile_Constant * const consts = (PackFile_Constant *) _bucket->value;
- mem_gc_free(interp, consts););
+ PackFile_ConstTable * const ct = (PackFile_ConstTable *)_bucket->value;
+ PackFile_ConstTable_clear(interp, ct);
+ mem_gc_free(interp, ct););
parrot_hash_destroy(interp, hash);
}
-
-/*
-
-=back
-
-=head2 PackFile FixupTable Structure Functions
-
-=over 4
-
-=item C<void PackFile_FixupTable_clear(PARROT_INTERP, PackFile_FixupTable
-*self)>
-
-Clears a PackFile FixupTable.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-PackFile_FixupTable_clear(PARROT_INTERP, ARGMOD(PackFile_FixupTable *self))
-{
- ASSERT_ARGS(PackFile_FixupTable_clear)
-
- if (!self) {
- Parrot_io_eprintf(interp, "PackFile_FixupTable_clear: self == NULL!\n");
- return;
- }
-
- if (self->fixup_count) {
- opcode_t i;
- for (i = 0; i < self->fixup_count; ++i) {
- mem_gc_free(interp, self->fixups[i].name);
- self->fixups[i].name = NULL;
- }
- mem_gc_free(interp, self->fixups);
- }
- self->fixups = NULL;
- self->fixup_count = 0;
-
- return;
-}
-
-
-/*
-
-=item C<static void fixup_destroy(PARROT_INTERP, PackFile_Segment *self)>
-
-Calls C<PackFile_FixupTable_clear()> with C<self>.
-
-=cut
-
-*/
-
-static void
-fixup_destroy(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
-{
- ASSERT_ARGS(fixup_destroy)
- PackFile_FixupTable * const ft = (PackFile_FixupTable *)self;
- PackFile_FixupTable_clear(interp, ft);
-}
-
-
-/*
-
-=item C<static size_t fixup_packed_size(PARROT_INTERP, PackFile_Segment *self)>
-
-Calculates the size, in multiples of C<opcode_t>, required to store the
-passed C<PackFile_FixupTable> in bytecode.
-
-=cut
-
-*/
-
-static size_t
-fixup_packed_size(PARROT_INTERP, ARGMOD(PackFile_Segment *self))
-{
- ASSERT_ARGS(fixup_packed_size)
- PackFile_FixupTable * const ft = (PackFile_FixupTable *)self;
- size_t size = 1;
- opcode_t i;
-
- for (i = 0; i < ft->fixup_count; ++i) {
- /* fixup_entry type */
- ++size;
- switch (ft->fixups[i].type) {
- case enum_fixup_sub:
- size += PF_size_cstring(ft->fixups[i].name);
- ++size; /* offset */
- break;
- case enum_fixup_none:
- break;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
- "Unknown fixup type\n");
- }
- }
-
- return size;
-}
-
-
-/*
-
-=item C<static opcode_t * fixup_pack(PARROT_INTERP, PackFile_Segment *self,
-opcode_t *cursor)>
-
-Packs the fixup table for a given packfile.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static opcode_t *
-fixup_pack(PARROT_INTERP, ARGIN(PackFile_Segment *self), ARGOUT(opcode_t *cursor))
-{
- ASSERT_ARGS(fixup_pack)
- PackFile_FixupTable * const ft = (PackFile_FixupTable *)self;
- opcode_t i;
-
- *cursor++ = ft->fixup_count;
-
- for (i = 0; i < ft->fixup_count; ++i) {
- *cursor++ = (opcode_t) ft->fixups[i].type;
- switch (ft->fixups[i].type) {
- case enum_fixup_sub:
- cursor = PF_store_cstring(cursor, ft->fixups[i].name);
- *cursor++ = ft->fixups[i].offset;
- break;
- case enum_fixup_none:
- break;
- default:
- Parrot_ex_throw_from_c_args(interp, NULL, 1,
- "Unknown fixup type\n");
- }
- }
-
- return cursor;
-}
-
-
-/*
-
-=item C<static PackFile_Segment * fixup_new(PARROT_INTERP, PackFile *pf, STRING
-*name, int add)>
-
-Returns a new C<PackFile_FixupTable> segment.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CANNOT_RETURN_NULL
-static PackFile_Segment *
-fixup_new(PARROT_INTERP, SHIM(PackFile *pf), SHIM(STRING *name), SHIM(int add))
-{
- ASSERT_ARGS(fixup_new)
- PackFile_FixupTable * const fixup = mem_gc_allocate_zeroed_typed(interp,
- PackFile_FixupTable);
-
- return (PackFile_Segment *) fixup;
-}
-
-
-/*
-
-=item C<static const opcode_t * fixup_unpack(PARROT_INTERP, PackFile_Segment
-*seg, const opcode_t *cursor)>
-
-Unpacks a PackFile FixupTable from a block of memory, given a cursor.
-
-Returns one (1) if everything is okay, else zero (0).
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static const opcode_t *
-fixup_unpack(PARROT_INTERP, ARGIN(PackFile_Segment *seg), ARGIN(const opcode_t *cursor))
-{
- ASSERT_ARGS(fixup_unpack)
- PackFile_FixupTable * const self = (PackFile_FixupTable *)seg;
- PackFile *pf;
- opcode_t i;
-
- if (!self) {
- Parrot_io_eprintf(interp,
- "PackFile_FixupTable_unpack: self == NULL!\n");
- return NULL;
- }
-
- PackFile_FixupTable_clear(interp, self);
-
- pf = self->base.pf;
- self->fixup_count = PF_fetch_opcode(pf, &cursor);
-
- TRACE_PRINTF(("PackFile_FixupTable_unpack(): %ld entries\n",
- self->fixup_count));
-
- if (self->fixup_count) {
- self->fixups = mem_gc_allocate_n_zeroed_typed(interp,
- self->fixup_count, PackFile_FixupEntry);
-
- if (!self->fixups) {
- Parrot_io_eprintf(interp,
- "PackFile_FixupTable_unpack: Could not allocate "
- "memory for array!\n");
- self->fixup_count = 0;
- return NULL;
- }
- }
-
- for (i = 0; i < self->fixup_count; ++i) {
- PackFile_FixupEntry * const entry = self->fixups + i;
-
- entry->type = PF_fetch_opcode(pf, &cursor);
-
- switch (entry->type) {
- case enum_fixup_sub:
- entry->name = PF_fetch_cstring(interp, pf, &cursor);
- entry->offset = PF_fetch_opcode(pf, &cursor);
- TRACE_PRINTF_VAL(("PackFile_FixupTable_unpack(): type %d, "
- "name %s, offset %ld\n",
- entry->type, entry->name, entry->offset));
- break;
- case enum_fixup_none:
- break;
- default:
- Parrot_io_eprintf(interp,
- "PackFile_FixupTable_unpack: Unknown fixup type %d!\n",
- entry->type);
- return NULL;
- }
- }
-
- return cursor;
-}
-
-
-/*
-
-=item C<void PackFile_FixupTable_new_entry(PARROT_INTERP, const char *label,
-INTVAL type, opcode_t offs)>
-
-Adds a new fix-up entry with label and type. Creates a new PackFile FixupTable
-if none is present.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-void
-PackFile_FixupTable_new_entry(PARROT_INTERP,
- ARGIN(const char *label), INTVAL type, opcode_t offs)
-{
- ASSERT_ARGS(PackFile_FixupTable_new_entry)
- PackFile_FixupTable *self = interp->code->fixups;
- opcode_t i;
-
- if (!self) {
- self = (PackFile_FixupTable *) PackFile_Segment_new_seg(
- interp, interp->code->base.dir, PF_FIXUP_SEG,
- FIXUP_TABLE_SEGMENT_NAME, 1);
-
- interp->code->fixups = self;
- self->code = interp->code;
- }
-
- i = self->fixup_count++;
- self->fixups = mem_gc_realloc_n_typed_zeroed(interp,
- self->fixups, self->fixup_count, i, PackFile_FixupEntry);
-
- self->fixups[i].type = type;
- self->fixups[i].name = mem_sys_strdup(label);
- self->fixups[i].offset = offs;
-}
-
-
-/*
-
-=item C<static PackFile_FixupEntry * find_fixup(PackFile_FixupTable *ft, INTVAL
-type, const char *name)>
-
-Finds the fix-up entry in a given FixupTable C<ft> for C<type> and C<name> and
-returns it.
-
-This ignores directories. For a recursive version see
-C<PackFile_find_fixup_entry()>.
-
-=cut
-
-*/
-
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-static PackFile_FixupEntry *
-find_fixup(ARGMOD(PackFile_FixupTable *ft), INTVAL type, ARGIN(const char *name))
-{
- ASSERT_ARGS(find_fixup)
- opcode_t i;
- for (i = 0; i < ft->fixup_count; ++i) {
- if ((INTVAL)((enum_fixup_t)ft->fixups[i].type) == type
- && STREQ(ft->fixups[i].name, name)) {
- return ft->fixups + i;
- }
- }
-
- return NULL;
-}
-
-
-/*
-
-=item C<static INTVAL find_fixup_iter(PARROT_INTERP, PackFile_Segment *seg, void
-*user_data)>
-
-Internal iterator for C<PackFile_find_fixup_entry>; recurses into directories.
-
-=cut
-
-*/
-
-static INTVAL
-find_fixup_iter(PARROT_INTERP, ARGIN(PackFile_Segment *seg), ARGIN(void *user_data))
-{
- ASSERT_ARGS(find_fixup_iter)
- if (seg->type == PF_DIR_SEG) {
- if (PackFile_map_segments(interp, (PackFile_Directory *)seg,
- find_fixup_iter, user_data))
- return 1;
- }
- else if (seg->type == PF_FIXUP_SEG) {
- PackFile_FixupEntry ** const e = (PackFile_FixupEntry **)user_data;
- PackFile_FixupEntry * const fe = (PackFile_FixupEntry *)find_fixup(
- (PackFile_FixupTable *) seg, (*e)->type, (*e)->name);
-
- if (fe) {
- *e = fe;
- return 1;
- }
- }
-
- return 0;
-}
-
-
-/*
-
-=item C<PackFile_FixupEntry * PackFile_find_fixup_entry(PARROT_INTERP, INTVAL
-type, char *name)>
-
-Searches the whole PackFile recursively for a fix-up entry with the given
-C<type> and C<name>, and returns the found entry or NULL.
-
-This also recurses into directories, compared to the simplier C<find_fixup>
-which just searches one PackFile_FixupTable.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-PackFile_FixupEntry *
-PackFile_find_fixup_entry(PARROT_INTERP, INTVAL type, ARGIN(char *name))
-{
- ASSERT_ARGS(PackFile_find_fixup_entry)
-
- /* TODO make a hash of all fixups */
- PackFile_Directory * const dir = interp->code->base.dir;
- PackFile_FixupEntry * const ep = mem_gc_allocate_zeroed_typed(interp, PackFile_FixupEntry);
-
- ep->type = type;
- ep->name = name;
-
- if (PackFile_map_segments(interp, dir, find_fixup_iter, (void *) ep))
- return ep;
-
- return NULL;
-}
-
-
/*
=back
@@ -3905,12 +3387,20 @@
ASSERT_ARGS(PackFile_ConstTable_clear)
opcode_t i;
- if (self->constants) {
- mem_gc_free(interp, self->constants);
- self->constants = NULL;
+ if (self->num.constants) {
+ mem_gc_free(interp, self->num.constants);
+ self->num.constants = NULL;
}
- self->const_count = 0;
+ if (self->str.constants) {
+ mem_gc_free(interp, self->str.constants);
+ self->str.constants = NULL;
+ }
+
+ if (self->pmc.constants) {
+ mem_gc_free(interp, self->pmc.constants);
+ self->pmc.constants = NULL;
+ }
if (self->string_hash) {
parrot_hash_destroy(interp, self->string_hash);
@@ -3951,33 +3441,47 @@
PackFile_ConstTable_clear(interp, self);
- self->const_count = PF_fetch_opcode(pf, &cursor);
-
- TRACE_PRINTF(("PackFile_ConstTable_unpack: Unpacking %ld constants\n",
- self->const_count));
+ self->num.const_count = PF_fetch_opcode(pf, &cursor);
+ self->str.const_count = PF_fetch_opcode(pf, &cursor);
+ self->pmc.const_count = PF_fetch_opcode(pf, &cursor);
- if (self->const_count == 0)
- return cursor;
+ if (self->num.const_count) {
+ self->num.constants = mem_gc_allocate_n_zeroed_typed(interp,
+ self->num.const_count, FLOATVAL);
+ if (!self->num.constants)
+ goto err;
+ }
- self->constants = mem_gc_allocate_n_zeroed_typed(interp, self->const_count,
- PackFile_Constant);
+ if (self->str.const_count) {
+ self->str.constants = mem_gc_allocate_n_zeroed_typed(interp,
+ self->str.const_count, STRING *);
+ if (!self->str.constants)
+ goto err;
+ }
- if (!self->constants) {
- Parrot_io_eprintf(interp,
- "PackFile_ConstTable_unpack: Could not allocate memory for array!\n");
- self->const_count = 0;
- return NULL;
+ if (self->pmc.const_count) {
+ self->pmc.constants = mem_gc_allocate_n_zeroed_typed(interp,
+ self->pmc.const_count, PMC *);
+ if (!self->pmc.constants)
+ goto err;
}
- for (i = 0; i < self->const_count; ++i) {
- TRACE_PRINTF(("PackFile_ConstTable_unpack(): Unpacking constant %ld/%ld\n",
- i, self->const_count));
+ for (i = 0; i < self->num.const_count; i++)
+ self->num.constants[i] = PF_fetch_number(pf, &cursor);
- cursor = PackFile_Constant_unpack(interp, self, &self->constants[i],
- cursor);
- }
+ for (i = 0; i < self->str.const_count; i++)
+ self->str.constants[i] = PF_fetch_string(interp, pf, &cursor);
+
+ for (i = 0; i < self->pmc.const_count; i++)
+ self->pmc.constants[i] = PackFile_Constant_unpack_pmc(interp, self, &cursor);
return cursor;
+
+ err:
+ Parrot_io_eprintf(interp,
+ "PackFile_ConstTable_unpack: Could not allocate memory for array!\n");
+ PackFile_ConstTable_clear(interp, self);
+ return NULL;
}
@@ -4026,124 +3530,8 @@
/*
-=item C<size_t PackFile_Constant_pack_size(PARROT_INTERP, const
-PackFile_Constant *self, const PackFile_ConstTable *ct)>
-
-Determines the size of the buffer needed in order to pack the PackFile Constant
-into a contiguous region of memory.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-size_t
-PackFile_Constant_pack_size(PARROT_INTERP, ARGIN(const PackFile_Constant *self), ARGIN(const
- PackFile_ConstTable *ct))
-{
- ASSERT_ARGS(PackFile_Constant_pack_size)
- PMC *component;
- size_t packed_size;
-
- switch (self->type) {
- case PFC_NUMBER:
- packed_size = PF_size_number();
- break;
-
- case PFC_STRING:
- packed_size = PF_size_string(self->u.string);
- break;
-
- case PFC_KEY:
- packed_size = 1;
-
- for (component = self->u.key; component;){
- packed_size += 2;
- GETATTR_Key_next_key(interp, component, component);
- }
- break;
-
- case PFC_PMC:
- component = self->u.key; /* the pmc (Sub, ...) */
- packed_size = PF_size_strlen(Parrot_freeze_pbc_size(interp, component, ct)) - 1;
- break;
-
- default:
- Parrot_io_eprintf(NULL,
- "Constant_packed_size: Unrecognized type '%c'!\n",
- (char)self->type);
- return 0;
- }
-
- /* Tack on space for the initial type field */
- return packed_size + 1;
-}
-
-
-/*
-
-=item C<const opcode_t * PackFile_Constant_unpack(PARROT_INTERP,
-PackFile_ConstTable *constt, PackFile_Constant *self, const opcode_t *cursor)>
-
-Unpacks a PackFile Constant from a block of memory. The format is:
-
- opcode_t type
- * data
-
-Returns cursor if everything is okay, else NULL.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-const opcode_t *
-PackFile_Constant_unpack(PARROT_INTERP, ARGIN(PackFile_ConstTable *constt),
- ARGOUT(PackFile_Constant *self), ARGIN(const opcode_t *cursor))
-{
- ASSERT_ARGS(PackFile_Constant_unpack)
- PackFile * const pf = constt->base.pf;
- const opcode_t type = PF_fetch_opcode(pf, &cursor);
-
- TRACE_PRINTF(("PackFile_Constant_unpack(): Type is %ld ('%c')...\n",
- type, (char)type));
-
- switch (type) {
- case PFC_NUMBER:
- self->u.number = PF_fetch_number(pf, &cursor);
- self->type = PFC_NUMBER;
- break;
-
- case PFC_STRING:
- self->u.string = PF_fetch_string(interp, pf, &cursor);
- self->type = PFC_STRING;
- break;
-
- case PFC_KEY:
- cursor = PackFile_Constant_unpack_key(interp, constt, self, cursor);
- break;
-
- case PFC_PMC:
- cursor = PackFile_Constant_unpack_pmc(interp, constt, self, cursor);
- break;
- default:
- Parrot_io_eprintf(NULL,
- "Constant_unpack: Unrecognized type '%c' during unpack!\n",
- (char)type);
- return NULL;
- }
-
- return cursor;
-}
-
-
-/*
-
-=item C<const opcode_t * PackFile_Constant_unpack_pmc(PARROT_INTERP,
-PackFile_ConstTable *constt, PackFile_Constant *self, const opcode_t *cursor)>
+=item C<static PMC * PackFile_Constant_unpack_pmc(PARROT_INTERP,
+PackFile_ConstTable *constt, const opcode_t **cursor)>
Unpacks a constant PMC.
@@ -4151,26 +3539,20 @@
*/
-PARROT_EXPORT
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
-const opcode_t *
+static PMC *
PackFile_Constant_unpack_pmc(PARROT_INTERP, ARGIN(PackFile_ConstTable *constt),
- ARGMOD(PackFile_Constant *self), ARGIN(const opcode_t *cursor))
+ ARGIN(const opcode_t **cursor))
{
ASSERT_ARGS(PackFile_Constant_unpack_pmc)
- PackFile * const pf = constt->base.pf;
- STRING *_sub = CONST_STRING(interp, "Sub");
+ PackFile * const pf = constt->base.pf;
+ STRING *_sub = CONST_STRING(interp, "Sub");
PMC *pmc;
-
/* thawing the PMC needs the real packfile in place */
PackFile_ByteCode * const cs_save = interp->code;
interp->code = pf->cur_cs;
- pmc = Parrot_thaw_pbc(interp, constt, &cursor);
-
- /* place item in const_table */
- self->type = PFC_PMC;
- self->u.key = pmc;
+ pmc = Parrot_thaw_pbc(interp, constt, cursor);
/* finally place the sub into some namespace stash
* XXX place this code in Sub.thaw ? */
@@ -4180,85 +3562,7 @@
/* restore code */
interp->code = cs_save;
- return cursor;
-}
-
-
-/*
-
-=item C<const opcode_t * PackFile_Constant_unpack_key(PARROT_INTERP,
-PackFile_ConstTable *constt, PackFile_Constant *self, const opcode_t *cursor)>
-
-Unpacks a PackFile Constant from a block of memory. The format consists of a
-sequence of key atoms, each with the following format:
-
- opcode_t type
- opcode_t value
-
-Returns cursor if everything is OK, else NULL.
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_WARN_UNUSED_RESULT
-PARROT_CAN_RETURN_NULL
-const opcode_t *
-PackFile_Constant_unpack_key(PARROT_INTERP, ARGIN(PackFile_ConstTable *constt),
- ARGMOD(PackFile_Constant *self), ARGIN(const opcode_t *cursor))
-{
- ASSERT_ARGS(PackFile_Constant_unpack_key)
- PackFile * const pf = constt->base.pf;
- PMC *head = NULL;
- PMC *tail = NULL;
- INTVAL components = (INTVAL)PF_fetch_opcode(pf, &cursor);
- int pmc_enum = enum_class_Key;
-
- while (components-- > 0) {
- opcode_t type = PF_fetch_opcode(pf, &cursor);
- opcode_t op;
-
- if (tail) {
- SETATTR_Key_next_key(interp, tail, Parrot_pmc_new_constant(interp, pmc_enum));
- GETATTR_Key_next_key(interp, tail, tail);
- }
- else
- head = tail = Parrot_pmc_new_constant(interp, pmc_enum);
-
- op = PF_fetch_opcode(pf, &cursor);
-
- switch (type) {
- case PARROT_ARG_IC:
- key_set_integer(interp, tail, op);
- break;
- case PARROT_ARG_NC:
- key_set_number(interp, tail, constt->constants[op].u.number);
- break;
- case PARROT_ARG_SC:
- key_set_string(interp, tail, constt->constants[op].u.string);
- break;
- case PARROT_ARG_I:
- key_set_register(interp, tail, op, KEY_integer_FLAG);
- break;
- case PARROT_ARG_N:
- key_set_register(interp, tail, op, KEY_number_FLAG);
- break;
- case PARROT_ARG_S:
- key_set_register(interp, tail, op, KEY_string_FLAG);
- break;
- case PARROT_ARG_P:
- key_set_register(interp, tail, op, KEY_pmc_FLAG);
- break;
- default:
- return NULL;
- }
- }
-
- self->type = PFC_KEY;
- self->u.key = head;
-
- return cursor;
+ return pmc;
}
@@ -4516,7 +3820,7 @@
const PackFile_Annotations_Key * const key = self->keys + i;
Parrot_io_printf(interp, " #%d\n [\n", i);
Parrot_io_printf(interp, " NAME => %Ss\n",
- PF_CONST(self->code, key->name).u.string);
+ self->code->const_table->str.constants[key->name]);
Parrot_io_printf(interp, " TYPE => %s\n",
key->type == PF_ANNOTATION_KEY_TYPE_INT ? "integer" :
key->type == PF_ANNOTATION_KEY_TYPE_STR ? "string" :
@@ -4621,12 +3925,12 @@
{
ASSERT_ARGS(PackFile_Annotations_add_entry)
/* See if we already have this key. */
- STRING * const key_name = PF_CONST(self->code, key).u.string;
+ STRING * const key_name = self->code->const_table->str.constants[key];
opcode_t key_id = -1;
INTVAL i;
for (i = 0; i < self->num_keys; ++i) {
- STRING * const test_key = PF_CONST(self->code, self->keys[i].name).u.string;
+ STRING * const test_key = self->code->const_table->str.constants[self->keys[i].name];
if (STRING_equal(interp, test_key, key_name)) {
key_id = i;
break;
@@ -4701,12 +4005,12 @@
case PF_ANNOTATION_KEY_TYPE_NUM:
result = Parrot_pmc_new(interp, enum_class_Float);
VTABLE_set_number_native(interp, result,
- PF_CONST(self->code, value).u.number);
+ self->code->const_table->num.constants[value]);
break;
default:
result = Parrot_pmc_new(interp, enum_class_String);
VTABLE_set_string_native(interp, result,
- PF_CONST(self->code, value).u.string);
+ self->code->const_table->str.constants[value]);
}
return result;
@@ -4743,7 +4047,7 @@
if (!STRING_IS_NULL(key)) {
for (i = 0; i < self->num_keys; ++i) {
- STRING * const test_key = PF_CONST(self->code, self->keys[i].name).u.string;
+ STRING * const test_key = self->code->const_table->str.constants[self->keys[i].name];
if (STRING_equal(interp, test_key, key)) {
key_id = i;
break;
@@ -4782,7 +4086,8 @@
for (i = 0; i < self->num_keys; ++i) {
if (have_values[i]) {
- STRING * const key_name = PF_CONST(self->code, self->keys[i].name).u.string;
+ STRING * const key_name =
+ self->code->const_table->str.constants[self->keys[i].name];
VTABLE_set_pmc_keyed_str(interp, result, key_name,
make_annotation_value_pmc(interp, self, self->keys[i].type,
latest_values[i]));
Modified: branches/string_macros/src/packout.c
==============================================================================
--- branches/string_macros/src/packout.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/packout.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -25,6 +25,8 @@
#include "pmc/pmc_key.h"
/* HEADERIZER HFILE: include/parrot/packfile.h */
+/* HEADERIZER BEGIN: static */
+/* HEADERIZER END: static */
/*
@@ -160,16 +162,17 @@
ASSERT_ARGS(PackFile_ConstTable_pack_size)
opcode_t i;
PackFile_ConstTable* const self = (PackFile_ConstTable *) seg;
- const opcode_t n_constants = self->const_count;
- size_t size = 1; /* const_count */
+ size_t size = 3; /* const_counts */
- for (i = 0; i < n_constants; ++i) {
- /* only constants up to the current one will be valid on unpack */
- self->const_count = i;
- size += PackFile_Constant_pack_size(interp, &self->constants[i], self);
- }
+ size += self->num.const_count * PF_size_number();
+
+ for (i = 0; i < self->str.const_count; i++)
+ size += PF_size_string(self->str.constants[i]);
- self->const_count = i;
+ for (i = 0; i < self->pmc.const_count; i++) {
+ PMC *c = self->pmc.constants[i];
+ size += PF_size_strlen(Parrot_freeze_pbc_size(interp, c, self)) - 1;
+ }
return size;
}
@@ -200,29 +203,35 @@
{
ASSERT_ARGS(PackFile_ConstTable_pack)
PackFile_ConstTable * const self = (PackFile_ConstTable *)seg;
- const opcode_t n_constants = self->const_count;
opcode_t i;
- *cursor++ = self->const_count;
-
- for (i = 0; i < n_constants; ++i) {
- /* only constants up to the current one will be valid on unpack */
- self->const_count = i;
- cursor = PackFile_Constant_pack(interp, self, &self->constants[i], cursor);
+ *cursor++ = self->num.const_count;
+ *cursor++ = self->str.const_count;
+ *cursor++ = self->pmc.const_count;
+
+ for (i = 0; i < self->num.const_count; i++)
+ cursor = PF_store_number(cursor, &self->num.constants[i]);
+
+ for (i = 0; i < self->str.const_count; i++)
+ cursor = PF_store_string(cursor, self->str.constants[i]);
+
+ for (i = 0; i < self->pmc.const_count; i++) {
+ PMC *c = self->pmc.constants[i];
+ cursor = Parrot_freeze_pbc(interp, c, self, cursor);
}
- self->const_count = n_constants;
-
return cursor;
}
/*
-=item C<int PackFile_find_in_const(PARROT_INTERP, const PackFile_ConstTable *ct,
-PMC *key, int type)>
+=item C<int PackFile_ConstTable_rlookup_num(PARROT_INTERP, const
+PackFile_ConstTable *ct, FLOATVAL n)>
+
+=item C<int PackFile_ConstTable_rlookup_str(PARROT_INTERP, const
+PackFile_ConstTable *ct, STRING *s)>
-This is really ugly, we don't know where our C<PARROT_ARG_SC> key
-constant is in constant table, so we have to search for it.
+Reverse lookup a constant in the constant table.
=cut
@@ -230,82 +239,43 @@
PARROT_EXPORT
int
-PackFile_find_in_const(PARROT_INTERP,
- ARGIN(const PackFile_ConstTable *ct), ARGIN(PMC *key), int type)
+PackFile_ConstTable_rlookup_num(PARROT_INTERP,
+ ARGIN(const PackFile_ConstTable *ct), FLOATVAL n)
{
- ASSERT_ARGS(PackFile_find_in_const)
- int i = PackFile_ConstTable_rlookup(interp, ct, key, type);
+ ASSERT_ARGS(PackFile_ConstTable_rlookup_num)
+ int i;
- if (i < 0) {
- Parrot_io_eprintf(NULL, "find_in_const: couldn't find const for key\n");
- Parrot_exit(interp, 1);
+ for (i = 0; i < ct->num.const_count; i++) {
+ if (ct->num.constants[i] == n)
+ return i;
}
- return i;
+ /* not found */
+ return -1;
}
-/*
-
-=item C<int PackFile_ConstTable_rlookup(PARROT_INTERP, const PackFile_ConstTable
-*ct, PMC *key, int type)>
-
-Reverse lookup a constant in the constant table.
-
-TODO: use a hash to make these O(1) for strings
-
-=cut
-
-*/
-
PARROT_EXPORT
int
-PackFile_ConstTable_rlookup(PARROT_INTERP,
- ARGIN(const PackFile_ConstTable *ct), ARGIN(PMC *key), int type)
+PackFile_ConstTable_rlookup_str(PARROT_INTERP,
+ ARGIN(const PackFile_ConstTable *ct), ARGIN(STRING *s))
{
- ASSERT_ARGS(PackFile_ConstTable_rlookup)
- int i, strings;
- FLOATVAL key_num;
- STRING *key_str;
- PMC *string_list;
-
- PARROT_ASSERT(type == PFC_STRING || type == PFC_NUMBER);
-
- GETATTR_Key_str_key(interp, key, key_str);
- GETATTR_Key_num_key(interp, key, key_num);
-
- if (type == PFC_STRING && ct->string_hash) {
- HashBucket *bucket = parrot_hash_get_bucket(interp, ct->string_hash,
- key_str);
+ ASSERT_ARGS(PackFile_ConstTable_rlookup_str)
+ int i;
+
+ if (ct->string_hash) {
+ HashBucket *bucket = parrot_hash_get_bucket(interp, ct->string_hash, s);
if (bucket) {
i = (int)PTR2INTVAL(bucket->value);
- if (i < ct->const_count) /* only consider constants that have already occured */
- return i;
+ return i;
}
return -1;
}
- for (i = 0; i < ct->const_count; ++i) {
- PackFile_Constant *constant = &ct->constants[i];
-
- switch (type) {
- case PFC_STRING:
- if (constant->type == PFC_STRING) {
- STRING * const sc = constant->u.string;
- if (STRING_equal(interp, key_str, sc)
- && key_str->encoding == sc->encoding) {
- return i;
- }
- }
- break;
-
- case PFC_NUMBER:
- if (constant->type == PFC_NUMBER)
- if (constant->u.number == key_num)
- return i;
- break;
-
- default:
- PANIC(interp, "Universe imploded. Did you divide by zero?");
+ for (i = 0; i < ct->str.const_count; i++) {
+ STRING *sc = ct->str.constants[i];
+ if (STRING_equal(interp, s, sc)
+ && s->encoding == sc->encoding) {
+ return i;
}
}
@@ -315,116 +285,6 @@
/*
-=item C<opcode_t * PackFile_Constant_pack(PARROT_INTERP, const
-PackFile_ConstTable *const_table, const PackFile_Constant *self, opcode_t
-*cursor)>
-
-Pack a PackFile Constant into a contiguous region of memory.
-
-Note that the memory block had better have at least the amount of memory
-indicated by C<PackFile_pack_size()>.
-
-This means that you MUST call C<PackFile_pack_size()> before
-C<PackFile_Constant_pack()>
-
-The data is zero-padded to an opcode_t-boundary, so pad bytes may be added.
-(Note this padding is not yet implemented for FLOATVALs.)
-
-=cut
-
-*/
-
-PARROT_EXPORT
-PARROT_CANNOT_RETURN_NULL
-PARROT_WARN_UNUSED_RESULT
-opcode_t *
-PackFile_Constant_pack(PARROT_INTERP,
- ARGIN(const PackFile_ConstTable *const_table),
- ARGIN(const PackFile_Constant *self), ARGOUT(opcode_t *cursor))
-{
- ASSERT_ARGS(PackFile_Constant_pack)
- PMC *key;
- size_t i;
-
- *cursor++ = self->type;
-
- switch (self->type) {
-
- case PFC_NUMBER:
- cursor = PF_store_number(cursor, &self->u.number);
- break;
-
- case PFC_STRING:
- cursor = PF_store_string(cursor, self->u.string);
- break;
-
- case PFC_PMC:
- cursor = Parrot_freeze_pbc(interp, self->u.key, const_table, cursor);
- break;
-
- case PFC_KEY:
- for (i = 0, key = self->u.key; key; ++i){
- GETATTR_Key_next_key(interp, key, key);
- }
-
- /* number of key components */
- *cursor++ = i;
- /* and now type / value per component */
- for (key = self->u.key; key;) {
- const opcode_t type = PObj_get_FLAGS(key);
-
- switch (type & KEY_type_FLAGS) {
- case KEY_integer_FLAG:
- *cursor++ = PARROT_ARG_IC;
- GETATTR_Key_int_key(interp, key, *cursor++);
- break;
- case KEY_number_FLAG:
- *cursor++ = PARROT_ARG_NC;
- /* Argh */
- *cursor++ = PackFile_find_in_const(interp, const_table, key, PFC_NUMBER);
- break;
- case KEY_string_FLAG:
- *cursor++ = PARROT_ARG_SC;
- /* Argh */
- *cursor++ = PackFile_find_in_const(interp, const_table, key, PFC_STRING);
- break;
-
- case KEY_integer_FLAG | KEY_register_FLAG:
- *cursor++ = PARROT_ARG_I;
- GETATTR_Key_int_key(interp, key, *cursor++);
- break;
- case KEY_number_FLAG | KEY_register_FLAG:
- *cursor++ = PARROT_ARG_N;
- GETATTR_Key_int_key(interp, key, *cursor++);
- break;
- case KEY_string_FLAG | KEY_register_FLAG:
- *cursor++ = PARROT_ARG_S;
- GETATTR_Key_int_key(interp, key, *cursor++);
- break;
- case KEY_pmc_FLAG | KEY_register_FLAG:
- *cursor++ = PARROT_ARG_P;
- GETATTR_Key_int_key(interp, key, *cursor++);
- break;
- default:
- Parrot_io_eprintf(NULL, "PackFile_Constant_pack: "
- "unsupported constant type\n");
- Parrot_exit(interp, 1);
- }
- GETATTR_Key_next_key(interp, key, key);
- }
-
- break;
-
- default:
- Parrot_io_eprintf(NULL, "PackFile_Constant_pack: unsupported constant\n");
- Parrot_exit(interp, 1);
- break;
- }
- return cursor;
-}
-
-/*
-
=back
=head1 HISTORY
Modified: branches/string_macros/src/pbc_dump.c
==============================================================================
--- branches/string_macros/src/pbc_dump.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/pbc_dump.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -82,25 +82,6 @@
/*
-=item C<static void fixup_dump(PARROT_INTERP, const PackFile_Segment *segp)>
-
-Dump the fixup table.
-
-=cut
-
-*/
-
-static void
-fixup_dump(PARROT_INTERP, const PackFile_Segment *segp)
-{
- Parrot_io_printf(interp, "%Ss => [\n", segp->name);
- PackFile_Fixup_dump(interp, (const PackFile_FixupTable *)segp);
- Parrot_io_printf(interp, "],\n");
-}
-
-
-/*
-
=item C<static void disas_dump(PARROT_INTERP, const PackFile_Segment *self)>
Disassemble and dump.
@@ -432,7 +413,6 @@
/* install a dumper function */
if (!terse) {
pf->PackFuncs[PF_CONST_SEG].dump = const_dump;
- pf->PackFuncs[PF_FIXUP_SEG].dump = fixup_dump;
}
if (disas)
Modified: branches/string_macros/src/pbc_merge.c
==============================================================================
--- branches/string_macros/src/pbc_merge.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/pbc_merge.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -44,17 +44,18 @@
#include "parrot/oplib/core_ops.h"
#include "pmc/pmc_sub.h"
-
/* This struct describes an input file. */
typedef struct pbc_merge_input {
- const char *filename; /* name of the input file */
- PackFile *pf; /* loaded packfile struct */
- opcode_t code_start; /* where the bytecode is located in the merged
- packfile */
- opcode_t const_start;/* where the const table is located within the
- merged table */
- opcode_t *const_map; /* map constants from input files to their location
- in the output file */
+ const char *filename; /* name of the input file */
+ PackFile *pf; /* loaded packfile struct */
+ opcode_t code_start; /* where the bytecode is located in the merged
+ packfile */
+ struct {
+ opcode_t const_start; /* where the const table is located within the
+ merged table */
+ opcode_t *const_map; /* map constants from input files to their location
+ in the output file */
+ } num, str, pmc;
} pbc_merge_input;
/* HEADERIZER HFILE: none */
@@ -125,15 +126,6 @@
FUNC_MODIFIES(*pf)
FUNC_MODIFIES(*bc);
-static void pbc_merge_fixups(PARROT_INTERP,
- ARGIN(pbc_merge_input **inputs),
- int num_inputs,
- ARGMOD(PackFile *pf))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2)
- __attribute__nonnull__(4)
- FUNC_MODIFIES(*pf);
-
PARROT_WARN_UNUSED_RESULT
PARROT_CANNOT_RETURN_NULL
static PackFile* pbc_merge_loadpbc(PARROT_INTERP,
@@ -172,10 +164,6 @@
, PARROT_ASSERT_ARG(inputs) \
, PARROT_ASSERT_ARG(pf) \
, PARROT_ASSERT_ARG(bc))
-#define ASSERT_ARGS_pbc_merge_fixups __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(inputs) \
- , PARROT_ASSERT_ARG(pf))
#define ASSERT_ARGS_pbc_merge_loadpbc __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(fullname))
@@ -376,11 +364,15 @@
ARGMOD(PackFile_ByteCode *bc))
{
ASSERT_ARGS(pbc_merge_constants)
- PackFile_Constant *constants = mem_gc_allocate_typed(interp, PackFile_Constant);
- opcode_t cursor = 0;
- opcode_t output_const_num = 0;
- opcode_t input_const_num = 0;
+ FLOATVAL *num_constants = mem_gc_allocate_typed(interp, FLOATVAL);
+ STRING **str_constants = mem_gc_allocate_typed(interp, STRING *);
+ PMC **pmc_constants = mem_gc_allocate_typed(interp, PMC *);
+
+ opcode_t num_cursor = 0;
+ opcode_t str_cursor = 0;
+ opcode_t pmc_cursor = 0;
+
int i, j;
/* Add a constant table segment. */
@@ -407,138 +399,66 @@
}
/* Store cursor as position where constant table starts. */
- inputs[i]->const_start = cursor;
- input_const_num = 0;
+ inputs[i]->num.const_start = num_cursor;
+ inputs[i]->str.const_start = str_cursor;
+ inputs[i]->pmc.const_start = pmc_cursor;
/* Allocate space for the constant list, provided we have some. */
- if (in_seg->const_count > 0)
- constants = mem_gc_realloc_n_typed(interp, constants,
- cursor + in_seg->const_count, PackFile_Constant);
+ if (in_seg->num.const_count > 0)
+ num_constants = mem_gc_realloc_n_typed(interp, num_constants,
+ num_cursor + in_seg->num.const_count, FLOATVAL);
+ if (in_seg->str.const_count > 0)
+ str_constants = mem_gc_realloc_n_typed(interp, str_constants,
+ str_cursor + in_seg->str.const_count, STRING *);
+ if (in_seg->pmc.const_count > 0)
+ pmc_constants = mem_gc_realloc_n_typed(interp, pmc_constants,
+ pmc_cursor + in_seg->pmc.const_count, PMC *);
/* Loop over the constants and copy them to the output PBC. */
- for (j = 0; j < in_seg->const_count; ++j) {
- /* Get the entry and the copy. */
- PackFile_Constant *cur_entry = &in_seg->constants[j];
- PackFile_Constant *copy = &constants[cursor];
- STRUCT_COPY(copy, cur_entry);
+ for (j = 0; j < in_seg->num.const_count; j++) {
+ num_constants[num_cursor] = in_seg->num.constants[j];
+ inputs[i]->num.const_map[j] = num_cursor;
+ num_cursor++;
+ }
+
+ for (j = 0; j < in_seg->str.const_count; j++) {
+ str_constants[str_cursor] = in_seg->str.constants[j];
+ inputs[i]->str.const_map[j] = str_cursor;
+ str_cursor++;
+ }
+
+ for (j = 0; j < in_seg->pmc.const_count; j++) {
+ PMC *v = pmc_constants[pmc_cursor] = in_seg->pmc.constants[j];
+ inputs[i]->pmc.const_map[j] = pmc_cursor;
+ pmc_cursor++;
/* If it's a sub PMC, need to deal with offsets. */
- if (copy->type == PFC_PMC) {
- switch (copy->u.key->vtable->base_type) {
- case enum_class_Sub:
- case enum_class_Coroutine:
- {
- Parrot_Sub_attributes *sub;
- PMC_get_sub(interp, copy->u.key, sub);
- sub->start_offs += inputs[i]->code_start;
- sub->end_offs += inputs[i]->code_start;
- }
- break;
- default:
- break;
- }
- }
-
- inputs[i]->const_map[input_const_num] = output_const_num;
- ++input_const_num;
- ++output_const_num;
-
- ++cursor;
- }
- }
-
- /* Stash merged constants table and count and return the new segment. */
- const_seg->constants = constants;
- const_seg->const_count = cursor;
- const_seg->code = bc;
- bc->const_table = const_seg;
- return const_seg;
-}
-
-
-/*
-
-=item C<static void pbc_merge_fixups(PARROT_INTERP, pbc_merge_input **inputs,
-int num_inputs, PackFile *pf)>
-
-This function merges the fixups tables from the input PBC files.
-
-=cut
-
-*/
-
-static void
-pbc_merge_fixups(PARROT_INTERP, ARGIN(pbc_merge_input **inputs),
- int num_inputs, ARGMOD(PackFile *pf))
-{
- ASSERT_ARGS(pbc_merge_fixups)
- PackFile_FixupTable *fixup_seg;
- PackFile_FixupEntry *fixups = NULL;
- opcode_t cursor = 0;
- int i;
-
- /* Add a fixup table segment. */
- fixup_seg = (PackFile_FixupTable*)PackFile_Segment_new_seg(
- interp, &pf->directory, PF_FIXUP_SEG, FIXUP_TABLE_SEGMENT_NAME, 1);
- if (fixup_seg == NULL) {
- Parrot_io_eprintf(interp,
- "PBC Merge: Error creating fixup table segment.");
- Parrot_exit(interp, 1);
- }
-
- /* Loop over input files. */
- for (i = 0; i < num_inputs; ++i) {
- /* Get the fixup segment from the input file. */
- PackFile_FixupTable * const in_seg = inputs[i]->pf->cur_cs->fixups;
- int j;
-
- if (in_seg == NULL) {
- Parrot_io_eprintf(interp,
- "PBC Merge: Cannot locate fixup segment in %s",
- inputs[i]->filename);
- Parrot_exit(interp, 1);
- }
-
- /* Allocate space for these fixups, provided we have some. */
- if (in_seg->fixup_count > 0) {
- fixups = mem_gc_realloc_n_typed(interp, fixups,
- cursor + in_seg->fixup_count, PackFile_FixupEntry);
- }
-
- /* Loop over the fixups and copy them to the output PBC, correcting
- the offsets into the bytecode. */
- for (j = 0; j < in_seg->fixup_count; ++j) {
- /* Get the entry and allocate space for copies. */
- const PackFile_FixupEntry * const cur_entry = in_seg->fixups + j;
- PackFile_FixupEntry * const copy =
- mem_gc_allocate_typed(interp, PackFile_FixupEntry);
- char * const name_copy = mem_gc_allocate_n_typed(interp,
- strlen(cur_entry->name) + 1, char);
-
- /* Copy type and name. */
- copy->type = cur_entry->type;
- strcpy(name_copy, cur_entry->name);
- copy->name = name_copy;
-
- /* Set new offset and bytecode pointer. */
- switch (copy->type) {
- case enum_fixup_sub:
- copy->offset = cur_entry->offset + inputs[i]->const_start;
+ switch (v->vtable->base_type) {
+ case enum_class_Sub:
+ case enum_class_Coroutine:
+ {
+ Parrot_Sub_attributes *sub;
+ PMC_get_sub(interp, v, sub);
+ sub->start_offs += inputs[i]->code_start;
+ sub->end_offs += inputs[i]->code_start;
+ }
break;
default:
- Parrot_io_eprintf(interp, "PBC Merge: Unknown fixup type");
- Parrot_exit(interp, 1);
+ break;
}
-
- /* Slot it into the list. */
- fixups[cursor] = *copy;
- ++cursor;
}
}
- /* Stash merged fixup table and count. */
- fixup_seg->fixups = fixups;
- fixup_seg->fixup_count = cursor;
+ /* Stash merged constants table and count and return the new segment. */
+ const_seg->num.const_count = num_cursor;
+ const_seg->num.constants = num_constants;
+ const_seg->str.const_count = str_cursor;
+ const_seg->str.constants = str_constants;
+ const_seg->pmc.const_count = pmc_cursor;
+ const_seg->pmc.constants = pmc_constants;
+ const_seg->code = bc;
+ bc->const_table = const_seg;
+ return const_seg;
}
@@ -593,7 +513,7 @@
STRUCT_COPY_FROM_STRUCT(mapping, in_seg->mappings[j]);
mapping->offset += num_lines;
- mapping->filename += inputs[i]->const_start;
+ mapping->filename += inputs[i]->str.const_start;
}
num_lines += in_seg->base.size - 1;
@@ -724,12 +644,19 @@
/* Pick out any indexes into the constant table and correct them. */
switch (op->types[cur_arg - 1]) {
case PARROT_ARG_NC:
- case PARROT_ARG_PC:
+ ops[cur_op] = inputs[cur_input]->num.const_map[ ops[cur_op] ];
+ break;
+
case PARROT_ARG_SC:
case PARROT_ARG_NAME_SC:
+ ops[cur_op] = inputs[cur_input]->str.const_map[ ops[cur_op] ];
+ break;
+
+ case PARROT_ARG_PC:
case PARROT_ARG_KC:
- ops[cur_op] = inputs[cur_input]->const_map[ ops[cur_op] ];
+ ops[cur_op] = inputs[cur_input]->pmc.const_map[ ops[cur_op] ];
break;
+
default:
break;
}
@@ -745,19 +672,26 @@
op_func == core_ops->op_func_table[PARROT_OP_get_params_pc] ||
op_func == core_ops->op_func_table[PARROT_OP_set_returns_pc]) {
/* Get the signature. */
- PMC * const sig = bc->const_table->constants[op_ptr[1]].u.key;
+ PMC * const sig = bc->const_table->pmc.constants[op_ptr[1]];
/* Loop over the arguments to locate any that need a fixup. */
const int sig_items = VTABLE_elements(interp, sig);
for (cur_arg = 0; cur_arg < sig_items; ++cur_arg) {
switch (VTABLE_get_integer_keyed_int(interp, sig, cur_arg)) {
case PARROT_ARG_NC:
- case PARROT_ARG_PC:
+ ops[cur_op] = inputs[cur_input]->num.const_map[ ops[cur_op] ];
+ break;
+
case PARROT_ARG_SC:
case PARROT_ARG_NAME_SC:
+ ops[cur_op] = inputs[cur_input]->str.const_map[ ops[cur_op] ];
+ break;
+
+ case PARROT_ARG_PC:
case PARROT_ARG_KC:
- ops[cur_op] = inputs[cur_input]->const_map[ ops[cur_op] ];
+ ops[cur_op] = inputs[cur_input]->pmc.const_map[ ops[cur_op] ];
break;
+
default:
break;
}
@@ -802,9 +736,13 @@
for (j = 0; j < pf_dir->num_segments; ++j) {
PackFile_Segment *seg = (PackFile_Segment *)pf_dir->segments[j];
if (seg->type == PF_CONST_SEG) {
- opcode_t const_count = ((PackFile_ConstTable *)seg)->const_count;
- inputs[i]->const_map = mem_gc_allocate_n_typed(interp,
- const_count, opcode_t);
+ PackFile_ConstTable *ct = (PackFile_ConstTable *)seg;
+ inputs[i]->num.const_map = mem_gc_allocate_n_typed(interp, ct->num.const_count,
+ opcode_t);
+ inputs[i]->str.const_map = mem_gc_allocate_n_typed(interp, ct->str.const_count,
+ opcode_t);
+ inputs[i]->pmc.const_map = mem_gc_allocate_n_typed(interp, ct->pmc.const_count,
+ opcode_t);
}
}
}
@@ -814,14 +752,15 @@
ct = pbc_merge_constants(interp, inputs, num_inputs, merged, bc);
UNUSED(ct);
- pbc_merge_fixups(interp, inputs, num_inputs, merged);
pbc_merge_debugs(interp, inputs, num_inputs, merged, bc);
/* Walk bytecode and fix ops that reference the constants table. */
pbc_fixup_bytecode(interp, inputs, num_inputs, bc);
for (i = 0; i < num_inputs; ++i) {
- mem_gc_free(interp, inputs[i]->const_map);
+ mem_gc_free(interp, inputs[i]->num.const_map);
+ mem_gc_free(interp, inputs[i]->str.const_map);
+ mem_gc_free(interp, inputs[i]->pmc.const_map);
}
/* Return merged result. */
Modified: branches/string_macros/src/pmc/callcontext.pmc
==============================================================================
--- branches/string_macros/src/pmc/callcontext.pmc Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/pmc/callcontext.pmc Tue Sep 28 19:35:30 2010 (r49367)
@@ -526,8 +526,10 @@
ATTR opcode_t *current_pc; /* program counter of Sub invocation */
ATTR PMC *current_sig; /* temporary CallContext PMC for active call */
- /* deref the constants - we need it all the time */
- ATTR struct PackFile_Constant *constants;
+ /* deref the constants - we need them all the time */
+ ATTR FLOATVAL *num_constants;
+ ATTR STRING **str_constants;
+ ATTR PMC **pmc_constants;
ATTR INTVAL current_HLL; /* see also src/hll.c */
Modified: branches/string_macros/src/pmc/eval.pmc
==============================================================================
--- branches/string_macros/src/pmc/eval.pmc Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/pmc/eval.pmc Tue Sep 28 19:35:30 2010 (r49367)
@@ -25,28 +25,20 @@
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-static void clear_fixups(PARROT_INTERP,
- ARGIN(const Parrot_Sub_attributes *sub_data))
- __attribute__nonnull__(1)
- __attribute__nonnull__(2);
-
PARROT_WARN_UNUSED_RESULT
PARROT_CAN_RETURN_NULL
static PMC* get_sub(PARROT_INTERP, ARGIN(PMC *self), int idx)
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-static void mark_subs(PARROT_INTERP, ARGIN(PMC *self))
+static void mark_ct(PARROT_INTERP, ARGIN(PMC *self))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-#define ASSERT_ARGS_clear_fixups __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
- PARROT_ASSERT_ARG(interp) \
- , PARROT_ASSERT_ARG(sub_data))
#define ASSERT_ARGS_get_sub __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(self))
-#define ASSERT_ARGS_mark_subs __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+#define ASSERT_ARGS_mark_ct __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp) \
, PARROT_ASSERT_ARG(self))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
@@ -54,43 +46,6 @@
/*
-=item C<static void clear_fixups(PARROT_INTERP, const Parrot_Sub_attributes
-*sub_data)>
-
-=cut
-
-*/
-
-static void
-clear_fixups(PARROT_INTERP, ARGIN(const Parrot_Sub_attributes *sub_data))
-{
- ASSERT_ARGS(clear_fixups)
-
- PackFile_ByteCode * const seg = sub_data->seg;
-
- if (seg) {
- PackFile_FixupTable * const ft = seg->fixups;
- if (ft) {
- PackFile_ConstTable * const ct = seg->const_table;
- if (ct) {
- INTVAL i;
- for (i = 0; i < ft->fixup_count; ++i) {
- PackFile_FixupEntry * const e = ft->fixups + i;
-
- if (e->type == enum_fixup_sub) {
- opcode_t ci = e->offset;
-
- ct->constants[ci].u.key = NULL;
- e->type = 0;
- }
- }
- }
- }
- }
-}
-
-/*
-
=item C<static PMC* get_sub(PARROT_INTERP, PMC *self, int idx)>
=cut
@@ -111,21 +66,15 @@
seg = sub->seg;
if (seg) {
- PackFile_FixupTable * const ft = seg->fixups;
- if (ft) {
- PackFile_ConstTable * const ct = seg->const_table;
- if (ct) {
- INTVAL i, n;
- for (i = n = 0; i < ft->fixup_count; ++i) {
- const PackFile_FixupEntry * const e = ft->fixups + i;
-
- if (e->type == enum_fixup_sub) {
- opcode_t ci = e->offset;
-
- if (n++ == idx)
- return ct->constants[ci].u.key;
- }
- }
+ PackFile_ConstTable * const ct = seg->const_table;
+ if (ct) {
+ INTVAL i, n;
+ for (i = n = 0; i < ct->pmc.const_count; ++i) {
+ STRING * const SUB = CONST_STRING(interp, "Sub");
+ PMC *x = ct->pmc.constants[i];
+ if (VTABLE_isa(interp, x, SUB))
+ if (!idx--)
+ return x;
}
}
}
@@ -135,16 +84,16 @@
/*
-=item C<static void mark_subs(PARROT_INTERP, PMC *self)>
+=item C<static void mark_ct(PARROT_INTERP, PMC *self)>
=cut
*/
static void
-mark_subs(PARROT_INTERP, ARGIN(PMC *self))
+mark_ct(PARROT_INTERP, ARGIN(PMC *self))
{
- ASSERT_ARGS(mark_subs)
+ ASSERT_ARGS(mark_ct)
Parrot_Sub_attributes *sub;
PackFile_ByteCode *seg;
@@ -153,21 +102,12 @@
seg = sub->seg;
if (seg) {
- PackFile_FixupTable * const ft = seg->fixups;
- if (ft) {
- PackFile_ConstTable * const ct = seg->const_table;
- if (ct) {
- INTVAL i;
- for (i = 0; i < ft->fixup_count; ++i) {
- const PackFile_FixupEntry * const e = ft->fixups + i;
-
- if (e->type == enum_fixup_sub) {
- opcode_t ci = e->offset;
- PMC *sub = ct->constants[ci].u.key;
-
- Parrot_gc_mark_PMC_alive(interp, sub);
- }
- }
+ PackFile_ConstTable * const ct = seg->const_table;
+ if (ct) {
+ INTVAL i;
+ for (i = 0; i < ct->pmc.const_count; ++i) {
+ PMC *sub = ct->pmc.constants[i];
+ Parrot_gc_mark_PMC_alive(interp, sub);
}
}
}
@@ -225,7 +165,6 @@
return;
}
- clear_fixups(INTERP, sub_data);
cur_cs = sub_data->seg;
if (!cur_cs) {
@@ -252,12 +191,6 @@
cur_cs->debugs = NULL;
}
- seg = (PackFile_Segment *)cur_cs->fixups;
- if (seg) {
- PackFile_Segment_destroy(INTERP, seg);
- cur_cs->fixups = NULL;
- }
-
seg = (PackFile_Segment *)cur_cs;
if (seg)
PackFile_Segment_destroy(INTERP, seg);
@@ -269,7 +202,7 @@
VTABLE void mark() {
SUPER();
- mark_subs(INTERP, SELF);
+ mark_ct(INTERP, SELF);
}
/*
@@ -303,10 +236,6 @@
PackFile_add_segment(INTERP, &pf->directory,
(PackFile_Segment *)seg->debugs);
- if (seg->fixups)
- PackFile_add_segment(INTERP, &pf->directory,
- (PackFile_Segment *)seg->fixups);
-
size = PackFile_pack_size(INTERP, pf) * sizeof (opcode_t);
/*
@@ -427,13 +356,13 @@
seg = sub->seg;
if (seg) {
- PackFile_FixupTable *const ft = seg->fixups;
- if (ft) {
+ PackFile_ConstTable *const ct = seg->const_table;
+ if (ct) {
INTVAL i;
- for (i = n = 0; i < ft->fixup_count; ++i) {
- const PackFile_FixupEntry * const e = ft->fixups + i;
-
- if (e->type == enum_fixup_sub)
+ STRING * const SUB = CONST_STRING(interp, "Sub");
+ for (i = n = 0; i < ct->pmc.const_count; ++i) {
+ PMC *x = ct->pmc.constants[i];
+ if (VTABLE_isa(interp, x, SUB))
++n;
}
}
Modified: branches/string_macros/src/pmc/exceptionhandler.pmc
==============================================================================
--- branches/string_macros/src/pmc/exceptionhandler.pmc Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/pmc/exceptionhandler.pmc Tue Sep 28 19:35:30 2010 (r49367)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2008, Parrot Foundation.
+Copyright (C) 2001-2010, Parrot Foundation.
$Id$
=head1 NAME
@@ -73,7 +73,7 @@
Parrot_ExceptionHandler_attributes * const attrs = PARROT_EXCEPTIONHANDLER(SELF);
SELF.init();
- attrs->handled_types = Parrot_pmc_new_init_int(INTERP, enum_class_FixedIntegerArray, 1);
+ attrs->handled_types = Parrot_pmc_new_init_int(INTERP, enum_class_FixedIntegerArray, 1);
VTABLE_set_integer_keyed_int(INTERP, attrs->handled_types, 0, handledtype);
}
Modified: branches/string_macros/src/pmc/filehandle.pmc
==============================================================================
--- branches/string_macros/src/pmc/filehandle.pmc Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/pmc/filehandle.pmc Tue Sep 28 19:35:30 2010 (r49367)
@@ -379,11 +379,20 @@
Parrot_str_free_cstring(prompt_cstring);
if (r) {
+ STRING *encoding;
+ const STR_VTABLE *enc = NULL;
+ GET_ATTR_encoding(INTERP, SELF, encoding);
if (*r)
add_history(r);
-
- string_result = Parrot_str_new(INTERP, r, 0);
+ if (!STRING_IS_NULL(encoding))
+ enc = Parrot_get_encoding(INTERP, Parrot_encoding_number(INTERP, encoding));
+ if (enc == NULL)
+ string_result = Parrot_str_new(INTERP, r, 0);
+ else
+ string_result = Parrot_str_new_init(INTERP, r, strlen(r), enc, 0);
free(r);
+ if (enc != NULL)
+ STRING_validate(INTERP, string_result);
}
#else
if (got_prompt) {
Modified: branches/string_macros/src/pmc/imageiofreeze.pmc
==============================================================================
--- branches/string_macros/src/pmc/imageiofreeze.pmc Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/pmc/imageiofreeze.pmc Tue Sep 28 19:35:30 2010 (r49367)
@@ -381,10 +381,9 @@
VTABLE void push_string(STRING *v) {
if (PObj_flag_TEST(private1, SELF)) {
/* store a reference to constant table entry of string */
- PMC * const v_pmc = key_new_string(interp, v);
PackFile_ConstTable * const table = PARROT_IMAGEIOFREEZE(SELF)->pf_ct;
const int idx =
- PackFile_ConstTable_rlookup(INTERP, table, v_pmc, PFC_STRING);
+ PackFile_ConstTable_rlookup_str(INTERP, table, v);
if (idx >= 0) {
STATICSELF.push_integer(idx);
Modified: branches/string_macros/src/pmc/imageiosize.pmc
==============================================================================
--- branches/string_macros/src/pmc/imageiosize.pmc Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/pmc/imageiosize.pmc Tue Sep 28 19:35:30 2010 (r49367)
@@ -204,7 +204,7 @@
/* store a reference to constant table entry of string */
PMC *v_pmc = key_new_string(interp, v);
PackFile_ConstTable *table = PARROT_IMAGEIOSIZE(SELF)->pf_ct;
- int idx = PackFile_ConstTable_rlookup(INTERP, table, v_pmc, PFC_STRING);
+ int idx = PackFile_ConstTable_rlookup_str(INTERP, table, v);
if (idx >= 0) {
STATICSELF.push_integer(idx);
Modified: branches/string_macros/src/pmc/imageiothaw.pmc
==============================================================================
--- branches/string_macros/src/pmc/imageiothaw.pmc Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/pmc/imageiothaw.pmc Tue Sep 28 19:35:30 2010 (r49367)
@@ -261,12 +261,7 @@
if (i >= 0) {
PackFile_ConstTable *table = PARROT_IMAGEIOTHAW(SELF)->pf_ct;
-
- if (!table->constants[i].type)
- Parrot_ex_throw_from_c_args(interp, NULL,
- EXCEPTION_MALFORMED_PACKFILE,
- "Reference to constant not yet unpacked %d", i);
- return table->constants[i].u.string;
+ return table->str.constants[i];
}
/* XXX
Modified: branches/string_macros/src/pmc/key.pmc
==============================================================================
--- branches/string_macros/src/pmc/key.pmc Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/pmc/key.pmc Tue Sep 28 19:35:30 2010 (r49367)
@@ -284,10 +284,6 @@
/*
-=item C<void visit(PMC *info)>
-
-This is used by freeze/thaw to visit the contents of the Key.
-
=item C<void freeze(PMC *info)>
Archives the Key.
@@ -304,67 +300,97 @@
*/
- VTABLE void visit(PMC *info) {
- /* Sometimes visit gets an uninitialized Key. Initialize it. */
- if (!PMC_data(SELF))
- SELF.init();
+ void freeze(PMC *info) {
+ int size;
+ PMC *k;
- VISIT_PMC_ATTR(INTERP, info, SELF, Key, next_key);
- }
+ for (size = 0, k = SELF; k; size++)
+ GET_ATTR_next_key(interp, k, k);
+ VTABLE_push_integer(INTERP, info, size);
+
+ for (k = SELF; k;) {
+ const INTVAL flags = (PObj_get_FLAGS(k) & KEY_type_FLAGS);
+ VTABLE_push_integer(INTERP, info, flags);
+
+ switch (flags) {
+ case KEY_integer_FLAG | KEY_register_FLAG:
+ case KEY_number_FLAG | KEY_register_FLAG:
+ case KEY_string_FLAG | KEY_register_FLAG:
+ case KEY_integer_FLAG:
+ {
+ INTVAL i;
+ GET_ATTR_int_key(INTERP, k, i);
+ VTABLE_push_integer(INTERP, info, i);
+ }
+ break;
- void freeze(PMC *info) {
- /* write flags */
- const INTVAL flags = (PObj_get_FLAGS(SELF) & KEY_type_FLAGS);
+ case KEY_number_FLAG:
+ {
+ FLOATVAL f;
+ GET_ATTR_num_key(INTERP, k, f);
+ VTABLE_push_float(INTERP, info, f);
+ }
+ break;
+
+ case KEY_string_FLAG:
+ {
+ STRING *s;
+ GET_ATTR_str_key(INTERP, k, s);
+ VTABLE_push_string(INTERP, info, s);
+ }
+ break;
+
+ default:
+ Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND,
+ "Unsupported key type in Key.freeze");
+ break;
+ }
- /* write the contents of a register - else thaw can't restore
- * the register state */
- VTABLE_push_integer(INTERP, info, flags & ~KEY_register_FLAG);
-
- /* and contents of this key component */
- switch (flags) {
- case KEY_integer_FLAG:
- case KEY_integer_FLAG | KEY_register_FLAG:
- VTABLE_push_integer(INTERP, info, key_integer(INTERP, SELF));
- break;
- case KEY_number_FLAG:
- case KEY_number_FLAG | KEY_register_FLAG:
- VTABLE_push_float(INTERP, info, key_number(INTERP, SELF));
- break;
- case KEY_string_FLAG:
- case KEY_string_FLAG | KEY_register_FLAG:
- VTABLE_push_string(INTERP, info, key_string(INTERP, SELF));
- break;
- default:
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND,
- "Unsupported key type in Key.freeze");
- break;
+ GET_ATTR_next_key(interp, k, k);
}
}
void thaw(PMC *info) {
- const INTVAL flags = VTABLE_shift_integer(INTERP, info) & KEY_type_FLAGS;
+ int size;
+ PMC *k = SELF;
- PObj_get_FLAGS(SELF) |= flags;
PObj_custom_mark_SET(SELF);
- if (!PMC_data(SELF))
- SELF.init();
+ for (size = VTABLE_shift_integer(INTERP, info); size; size--) {
+ const INTVAL flags = VTABLE_shift_integer(INTERP, info) & KEY_type_FLAGS;
- /* get contents */
- switch (flags) {
- case KEY_integer_FLAG:
- SET_ATTR_int_key(INTERP, SELF, VTABLE_shift_integer(INTERP, info));
- break;
- case KEY_number_FLAG:
- VTABLE_set_number_native(INTERP, SELF, VTABLE_shift_float(INTERP, info));
- break;
- case KEY_string_FLAG:
- VTABLE_set_string_native(INTERP, SELF, VTABLE_shift_string(INTERP, info));
- break;
- default:
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND,
- "Unsupported key type in Key.thaw");
- break;
+ PObj_get_FLAGS(k) |= flags;
+
+ /* get contents */
+ switch (flags) {
+ case KEY_integer_FLAG | KEY_register_FLAG:
+ case KEY_number_FLAG | KEY_register_FLAG:
+ case KEY_string_FLAG | KEY_register_FLAG:
+ case KEY_integer_FLAG:
+ SET_ATTR_int_key(INTERP, k, VTABLE_shift_integer(INTERP, info));
+ break;
+
+ case KEY_number_FLAG:
+ VTABLE_set_number_native(INTERP, k, VTABLE_shift_float(INTERP, info));
+ break;
+
+ case KEY_string_FLAG:
+ VTABLE_set_string_native(INTERP, k, VTABLE_shift_string(INTERP, info));
+ break;
+
+ default:
+ Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_KEY_NOT_FOUND,
+ "Unsupported key type in Key.thaw");
+ break;
+ }
+
+ if (size == 1) {
+ SET_ATTR_next_key(INTERP, k, NULL);
+ }
+ else {
+ SET_ATTR_next_key(INTERP, k, Parrot_pmc_new_constant(INTERP, enum_class_Key));
+ GET_ATTR_next_key(INTERP, k, k);
+ }
}
}
Modified: branches/string_macros/src/pmc/packfileconstanttable.pmc
==============================================================================
--- branches/string_macros/src/pmc/packfileconstanttable.pmc Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/pmc/packfileconstanttable.pmc Tue Sep 28 19:35:30 2010 (r49367)
@@ -29,11 +29,10 @@
/* HEADERIZER END: static */
pmclass PackfileConstantTable auto_attrs extends PackfileSegment {
- /* ResizablePMCArray for storing constants */
- ATTR PMC *constants;
-
- /* ResizableIntegerArray for storing constant types */
- ATTR PMC *types;
+ /* ResizableXArray for storing constants */
+ ATTR PMC *num_constants;
+ ATTR PMC *str_constants;
+ ATTR PMC *pmc_constants;
/*
@@ -49,8 +48,9 @@
Parrot_PackfileConstantTable_attributes * const attrs =
PMC_data_typed(SELF, Parrot_PackfileConstantTable_attributes*);
- attrs->constants = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
- attrs->types = Parrot_pmc_new(INTERP, enum_class_ResizableIntegerArray);
+ attrs->num_constants = Parrot_pmc_new(INTERP, enum_class_ResizableFloatArray);
+ attrs->str_constants = Parrot_pmc_new(INTERP, enum_class_ResizableStringArray);
+ attrs->pmc_constants = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
PObj_custom_mark_SET(SELF);
PMC_data(SELF) = attrs;
@@ -70,8 +70,9 @@
Parrot_PackfileConstantTable_attributes * const attrs =
PARROT_PACKFILECONSTANTTABLE(SELF);
- Parrot_gc_mark_PMC_alive(INTERP, attrs->constants);
- Parrot_gc_mark_PMC_alive(INTERP, attrs->types);
+ Parrot_gc_mark_PMC_alive(INTERP, attrs->num_constants);
+ Parrot_gc_mark_PMC_alive(INTERP, attrs->str_constants);
+ Parrot_gc_mark_PMC_alive(INTERP, attrs->pmc_constants);
SUPER();
}
@@ -95,31 +96,18 @@
opcode_t i;
/* Preallocate required amount of memory */
- VTABLE_set_integer_native(INTERP, attrs->constants, table->const_count);
- VTABLE_set_integer_native(INTERP, attrs->types, table->const_count);
+ VTABLE_set_integer_native(INTERP, attrs->num_constants, table->num.const_count);
+ VTABLE_set_integer_native(INTERP, attrs->str_constants, table->str.const_count);
+ VTABLE_set_integer_native(INTERP, attrs->pmc_constants, table->pmc.const_count);
- for (i = 0; i < table->const_count; ++i) {
- const PackFile_Constant * val = &table->constants[i];
- switch (val->type) {
- case PFC_NONE:
- break;
- case PFC_NUMBER:
- SELF.set_number_keyed_int(i, val->u.number);
- break;
- case PFC_STRING:
- SELF.set_string_keyed_int(i, val->u.string);
- break;
- case PFC_KEY:
- /* fall through */
- case PFC_PMC:
- SELF.set_pmc_keyed_int(i, val->u.key);
- break;
- default:
- Parrot_ex_throw_from_c_args(INTERP, NULL,
- EXCEPTION_MALFORMED_PACKFILE,
- "Unknown PackFile constant type: %d", val->type);
- }
- }
+ for (i = 0; i < table->num.const_count; i++)
+ SELF.set_number_keyed_int(i, table->num.constants[i]);
+
+ for (i = 0; i < table->str.const_count; i++)
+ SELF.set_string_keyed_int(i, table->str.constants[i]);
+
+ for (i = 0; i < table->pmc.const_count; i++)
+ SELF.set_pmc_keyed_int(i, table->pmc.constants[i]);
}
/*
@@ -138,51 +126,62 @@
pftable->base.type = PF_CONST_SEG;
/* Copy all constanst with respect of type */
- pftable->const_count = VTABLE_get_integer(INTERP, attrs->constants);
- pftable->constants = mem_gc_allocate_n_typed(INTERP,
- pftable->const_count, PackFile_Constant);
-
- for (i = 0; i < pftable->const_count; ++i) {
- PackFile_Constant * const value = &pftable->constants[i];
- value->type = VTABLE_get_integer_keyed_int(INTERP, attrs->types, i);
- switch (value->type) {
- case PFC_NONE:
- break;
- case PFC_NUMBER:
- value->u.number = VTABLE_get_number_keyed_int(INTERP,
- attrs->constants, i);
- break;
- case PFC_STRING:
- value->u.string = VTABLE_get_string_keyed_int(INTERP,
- attrs->constants, i);
- break;
- case PFC_KEY:
- case PFC_PMC:
- value->u.key = VTABLE_get_pmc_keyed_int(INTERP,
- attrs->constants, i);
- break;
- default:
- Parrot_ex_throw_from_c_args(INTERP, NULL,
- EXCEPTION_MALFORMED_PACKFILE,
- "Unknown PackFile constant type: %d", value->type);
- }
- }
+ pftable->num.const_count = VTABLE_get_integer(INTERP, attrs->num_constants);
+ pftable->str.const_count = VTABLE_get_integer(INTERP, attrs->str_constants);
+ pftable->pmc.const_count = VTABLE_get_integer(INTERP, attrs->pmc_constants);
+
+ pftable->num.constants = mem_gc_allocate_n_typed(INTERP,
+ pftable->num.const_count, FLOATVAL);
+ pftable->str.constants = mem_gc_allocate_n_typed(INTERP,
+ pftable->str.const_count, STRING *);
+ pftable->pmc.constants = mem_gc_allocate_n_typed(INTERP,
+ pftable->pmc.const_count, PMC *);
+
+ for (i = 0; i < pftable->num.const_count; i++)
+ pftable->num.constants[i] =
+ VTABLE_get_number_keyed_int(INTERP, attrs->num_constants, i);
+
+ for (i = 0; i < pftable->str.const_count; i++)
+ pftable->str.constants[i] =
+ VTABLE_get_string_keyed_int(INTERP, attrs->str_constants, i);
+
+ for (i = 0; i < pftable->pmc.const_count; i++)
+ pftable->pmc.constants[i] =
+ VTABLE_get_pmc_keyed_int(INTERP, attrs->pmc_constants, i);
return pftable;
}
/*
-=item C<INTVAL elements()>
+=item C<INTVAL num_count()>
-Get the number of elements in the array.
+=item C<INTVAL str_count()>
+
+=item C<INTVAL pmc_count()>
+
+Get the number of constants.
=cut
*/
- VTABLE INTVAL elements() {
- return VTABLE_elements(INTERP,
- PARROT_PACKFILECONSTANTTABLE(SELF)->constants);
+
+ METHOD INTVAL num_count() {
+ INTVAL ret = VTABLE_elements(INTERP,
+ PARROT_PACKFILECONSTANTTABLE(SELF)->num_constants);
+ RETURN(INTVAL ret);
+ }
+
+ METHOD INTVAL str_count() {
+ INTVAL ret = VTABLE_elements(INTERP,
+ PARROT_PACKFILECONSTANTTABLE(SELF)->str_constants);
+ RETURN(INTVAL ret);
+ }
+
+ METHOD INTVAL pmc_count() {
+ INTVAL ret = VTABLE_elements(INTERP,
+ PARROT_PACKFILECONSTANTTABLE(SELF)->pmc_constants);
+ RETURN(INTVAL ret);
}
@@ -190,15 +189,14 @@
=item C<FLOATVAL get_number_keyed_int(INTVAL index)>
-Fetch a numeric constant. An exception is thrown if the given constant isn't
-numeric.
+Fetch a numeric constant.
=cut
*/
VTABLE FLOATVAL get_number_keyed_int(INTVAL index) {
return VTABLE_get_number_keyed_int(INTERP,
- PARROT_PACKFILECONSTANTTABLE(SELF)->constants, index);
+ PARROT_PACKFILECONSTANTTABLE(SELF)->num_constants, index);
}
@@ -206,15 +204,14 @@
=item C<STRING *get_string_keyed_int(INTVAL index)>
-Fetch a string constant. An exception is thrown if the given constant isn't
-a string.
+Fetch a string constant.
=cut
*/
VTABLE STRING *get_string_keyed_int(INTVAL index) {
return VTABLE_get_string_keyed_int(INTERP,
- PARROT_PACKFILECONSTANTTABLE(SELF)->constants, index);
+ PARROT_PACKFILECONSTANTTABLE(SELF)->str_constants, index);
}
@@ -222,14 +219,14 @@
=item C<PMC *get_pmc_keyed_int(INTVAL index)>
-Fetch a PMC constant. An exception is thrown if the given constant isn't a PMC.
+Fetch a PMC constant.
=cut
*/
VTABLE PMC *get_pmc_keyed_int(INTVAL index) {
return VTABLE_get_pmc_keyed_int(INTERP,
- PARROT_PACKFILECONSTANTTABLE(SELF)->constants, index);
+ PARROT_PACKFILECONSTANTTABLE(SELF)->pmc_constants, index);
}
@@ -245,9 +242,7 @@
VTABLE void set_number_keyed_int(INTVAL index, FLOATVAL value) {
Parrot_PackfileConstantTable_attributes * const attrs =
PARROT_PACKFILECONSTANTTABLE(SELF);
-
- VTABLE_set_number_keyed_int(INTERP, attrs->constants, index, value);
- VTABLE_set_integer_keyed_int(INTERP, attrs->types, index, PFC_NUMBER);
+ VTABLE_set_number_keyed_int(INTERP, attrs->num_constants, index, value);
}
@@ -264,9 +259,7 @@
VTABLE void set_string_keyed_int(INTVAL index, STRING *value) {
Parrot_PackfileConstantTable_attributes * const attrs =
PARROT_PACKFILECONSTANTTABLE(SELF);
-
- VTABLE_set_string_keyed_int(INTERP, attrs->constants, index, value);
- VTABLE_set_integer_keyed_int(INTERP, attrs->types, index, PFC_STRING);
+ VTABLE_set_string_keyed_int(INTERP, attrs->str_constants, index, value);
}
@@ -282,43 +275,7 @@
VTABLE void set_pmc_keyed_int(INTVAL index, PMC *value) {
Parrot_PackfileConstantTable_attributes * const attrs =
PARROT_PACKFILECONSTANTTABLE(SELF);
- const opcode_t type =
- VTABLE_isa(INTERP, value, Parrot_str_new_constant(INTERP, "Key"))
- ? PFC_KEY
- : PFC_PMC;
-
- VTABLE_set_pmc_keyed_int(INTERP, attrs->constants, index, value);
- VTABLE_set_integer_keyed_int(INTERP, attrs->types, index, type);
- }
-
-
-/*
-
-=item C<INTVAL get_type(INTVAL index)>
-
-Get the type of the specified constant. Possible type IDs:
-
-=over 4
-
-=item 0x00 - No constant
-
-=item 0x6E - Number constant
-
-=item 0x73 - String constant
-
-=item 0x70 - PMC constant
-
-=item 0x6B - Key constant
-
-=back
-
-=cut
-
-*/
- METHOD get_type(INTVAL index) {
- INTVAL rv = VTABLE_get_integer_keyed_int(INTERP,
- PARROT_PACKFILECONSTANTTABLE(SELF)->types, index);
- RETURN(INTVAL rv);
+ VTABLE_set_pmc_keyed_int(INTERP, attrs->pmc_constants, index, value);
}
/*
@@ -356,61 +313,51 @@
MULTI INTVAL get_or_create_constant(STRING *value) {
Parrot_PackfileConstantTable_attributes * const attrs =
PARROT_PACKFILECONSTANTTABLE(SELF);
- const INTVAL num = VTABLE_elements(INTERP, attrs->types);
+ const INTVAL num = VTABLE_elements(INTERP, attrs->str_constants);
INTVAL i;
for (i=0; i < num; ++i) {
- const INTVAL type = VTABLE_get_integer_keyed_int(INTERP, attrs->types, i);
- if (type == PFC_STRING) {
- STRING * const str = VTABLE_get_string_keyed_int(INTERP, attrs->constants, i);
- if (STRING_equal(INTERP, value, str))
- return i;
- }
+ STRING * const str = VTABLE_get_string_keyed_int(INTERP, attrs->str_constants, i);
+ if (STRING_equal(INTERP, value, str))
+ return i;
}
+
/* Constant not found. Add new one */
- VTABLE_set_string_keyed_int(INTERP, SELF, i, value);
+ SELF.set_string_keyed_int(i, value);
return i;
}
MULTI INTVAL get_or_create_constant(FLOATVAL value) {
Parrot_PackfileConstantTable_attributes * const attrs =
PARROT_PACKFILECONSTANTTABLE(SELF);
- const INTVAL num = VTABLE_elements(INTERP, attrs->types);
+ const INTVAL num = VTABLE_elements(INTERP, attrs->num_constants);
INTVAL i;
for (i=0; i < num; ++i) {
- const INTVAL type = VTABLE_get_integer_keyed_int(INTERP, attrs->types, i);
- if (type == PFC_NUMBER) {
- const FLOATVAL val = VTABLE_get_number_keyed_int(INTERP, attrs->constants, i);
- if (FLOAT_IS_ZERO(fabs(val - value)))
- return i;
- }
+ const FLOATVAL val = VTABLE_get_number_keyed_int(INTERP, attrs->num_constants, i);
+ if (FLOAT_IS_ZERO(fabs(val - value)))
+ return i;
}
+
/* Constant not found. Add new one */
- VTABLE_set_number_keyed_int(INTERP, SELF, i, value);
+ SELF.set_number_keyed_int(i, value);
return i;
}
MULTI INTVAL get_or_create_constant(PMC *value) {
Parrot_PackfileConstantTable_attributes * const attrs =
PARROT_PACKFILECONSTANTTABLE(SELF);
- const INTVAL num = VTABLE_elements(INTERP, attrs->types);
+ const INTVAL num = VTABLE_elements(INTERP, attrs->pmc_constants);
INTVAL i;
- const INTVAL val_type =
- value->vtable->base_type == enum_class_Key
- ? PFC_KEY
- : PFC_PMC;
for (i=0; i < num; ++i) {
- const INTVAL type = VTABLE_get_integer_keyed_int(INTERP, attrs->types, i);
- if (type == val_type) {
- PMC * const val = VTABLE_get_pmc_keyed_int(INTERP, attrs->constants, i);
- if (VTABLE_is_equal(INTERP, value, val))
- return i;
- }
+ PMC * const val = VTABLE_get_pmc_keyed_int(INTERP, attrs->pmc_constants, i);
+ if (VTABLE_is_equal(INTERP, value, val))
+ return i;
}
+
/* Constant not found. Add new one */
- VTABLE_set_pmc_keyed_int(INTERP, SELF, i, value);
+ SELF.set_pmc_keyed_int(i, value);
return i;
}
Modified: branches/string_macros/src/pmc/packfiledirectory.pmc
==============================================================================
--- branches/string_macros/src/pmc/packfiledirectory.pmc Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/pmc/packfiledirectory.pmc Tue Sep 28 19:35:30 2010 (r49367)
@@ -97,9 +97,6 @@
case PF_DIR_SEG:
pmc_type = enum_class_PackfileDirectory;
break;
- case PF_FIXUP_SEG:
- pmc_type = enum_class_PackfileFixupTable;
- break;
case PF_CONST_SEG:
pmc_type = enum_class_PackfileConstantTable;
break;
Deleted: branches/string_macros/src/pmc/packfilefixupentry.pmc
==============================================================================
--- branches/string_macros/src/pmc/packfilefixupentry.pmc Tue Sep 28 19:35:30 2010 (r49366)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,224 +0,0 @@
-/*
-Copyright (C) 2001-2010, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/packfilefixupentry.pmc - PackfileFixupEntry PMC
-
-=head1 DESCRIPTION
-
-This class implements a PackfileFixupEntry object. It is an element in the
-PackfileFixupTable segment of the .pbc file. See PDD13 for a design spec.
-
-=head2 Methods
-
-=over 4
-
-=cut
-
-*/
-
-/* HEADERIZER HFILE: none */
-/* HEADERIZER BEGIN: static */
-/* HEADERIZER END: static */
-
-pmclass PackfileFixupEntry auto_attrs {
- ATTR INTVAL type;
- ATTR STRING *name;
- ATTR INTVAL offset;
-
-
-/*
-
-=item C<void init()>
-
-Initialize PackfileFixupEntry.
-
-=cut
-
-*/
- VTABLE void init() {
- Parrot_PackfileFixupEntry_attributes * attrs =
- PMC_data_typed(SELF, Parrot_PackfileFixupEntry_attributes*);
-
- attrs->name = CONST_STRING(INTERP, "");
-
- PObj_custom_mark_SET(SELF);
- }
-
- VTABLE void init_pmc(PMC *init) {
- Parrot_PackfileFixupEntry_attributes * attrs =
- PMC_data_typed(SELF, Parrot_PackfileFixupEntry_attributes*);
- STRING *name = CONST_STRING_GEN(INTERP, "name");
- STRING *type = CONST_STRING_GEN(INTERP, "type");
- STRING *offset = CONST_STRING_GEN(INTERP, "offset");
-
- attrs->name = VTABLE_get_string(INTERP,
- VTABLE_get_pmc_keyed_str(INTERP, init, name));
- attrs->type = VTABLE_get_integer(INTERP,
- VTABLE_get_pmc_keyed_str(INTERP, init, type));
- attrs->offset = VTABLE_get_integer(INTERP,
- VTABLE_get_pmc_keyed_str(INTERP, init, offset));
-
- PObj_custom_mark_SET(SELF);
- }
-
-/*
-
-=item C<void mark()>
-
-Marks the object as live.
-
-=cut
-
-*/
-
- VTABLE void mark() {
- Parrot_PackfileFixupEntry_attributes * const attrs =
- PARROT_PACKFILEFIXUPENTRY(SELF);
-
- Parrot_gc_mark_STRING_alive(INTERP, attrs->name);
- }
-
-/*
-
-=item C<void set_pointer(void *pointer)>
-
-Initialize from PackFile_FixupEntry pointer.
-
-=cut
-
-*/
-
- VTABLE void set_pointer(void * pointer) {
- Parrot_PackfileFixupEntry_attributes * const attrs =
- PARROT_PACKFILEFIXUPENTRY(SELF);
- PackFile_FixupEntry *entry = (PackFile_FixupEntry*)pointer;
-
- attrs->type = entry->type;
- attrs->name = Parrot_str_new_init(INTERP, entry->name,
- strlen(entry->name), Parrot_binary_encoding_ptr, 0);
- attrs->offset = entry->offset;
- }
-
-/*
-
-=item C<void *get_pointer()>
-
-Create PackFile_FixupEntry* from self.
-
-=cut
-
-*/
- VTABLE void *get_pointer() {
- Parrot_PackfileFixupEntry_attributes * const attrs =
- PARROT_PACKFILEFIXUPENTRY(SELF);
- PackFile_FixupEntry * const entry =
- mem_gc_allocate_zeroed_typed(INTERP, PackFile_FixupEntry);
-
- entry->type = attrs->type;
- entry->name = strdup(Parrot_str_cstring(INTERP, attrs->name));
- entry->offset = attrs->offset;
- return entry;
- }
-
-
-/*
-
-=item C<STRING *get_string()>
-
-Fetch the label field of the fixup entry.
-
-=cut
-
-*/
- VTABLE STRING *get_string() {
- return PARROT_PACKFILEFIXUPENTRY(SELF)->name;
- }
-
-/*
-
-=item C<void set_string_native(STRING *value)>
-
-Set the label field of the fixup entry.
-
-=cut
-
-*/
- VTABLE void set_string_native(STRING *value) {
- SETATTR_PackfileFixupEntry_name(INTERP, SELF, value);
- }
-
-
-/*
-
-=item C<INTVAL get_integer()>
-
-Fetch the offset field of the fixup entry.
-
-=cut
-
-*/
- VTABLE INTVAL get_integer() {
- return PARROT_PACKFILEFIXUPENTRY(SELF)->offset;
- }
-
-
-/*
-
-=item C<void set_integer_native(INTVAL offset)>
-
-Set the offset field of the fixup entry.
-
-=cut
-
-*/
- VTABLE void set_integer_native(INTVAL offset) {
- SETATTR_PackfileFixupEntry_offset(INTERP, SELF, offset);
- }
-
-
-/*
-
-=item C<INTVAL get_type()>
-
-Fetch the type field of the fixup entry.
-
-=cut
-
-*/
- METHOD get_type() {
- const INTVAL rv = PARROT_PACKFILEFIXUPENTRY(SELF)->type;
- RETURN(INTVAL rv);
- }
-
-
-/*
-
-=item C<void set_type(INTVAL type)>
-
-Set the type field of the fixup entry.
-
-=cut
-
-*/
- METHOD set_type(INTVAL type) {
- SETATTR_PackfileFixupEntry_type(INTERP, SELF, type);
- }
-
-}
-/*
-
-=back
-
-=cut
-
-*/
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
Deleted: branches/string_macros/src/pmc/packfilefixuptable.pmc
==============================================================================
--- branches/string_macros/src/pmc/packfilefixuptable.pmc Tue Sep 28 19:35:30 2010 (r49366)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,210 +0,0 @@
-/*
-Copyright (C) 2001-2010, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/packfilefixuptable.pmc - PackfileFixupTable PMC
-
-=head1 DESCRIPTION
-
-This class implements a PackfileFixupTable object, a segment of the .pbc
-data file storing an array of PackfileFixupEntry PMCs.
-
-See packfile.pmc for the toplevel Packfile interface, see packfilesegment.pmc
-for the list of common methods every packfile segment pmc must implement; see
-PDD13 for the design spec.
-
-
-=head2 Methods
-
-=over 4
-
-=cut
-
-*/
-
-/* HEADERIZER HFILE: none */
-/* HEADERIZER BEGIN: static */
-/* HEADERIZER END: static */
-
-pmclass PackfileFixupTable auto_attrs extends PackfileSegment {
- /* RPA of entries */
- ATTR PMC *entries;
-
-/*
-
-=item C<init>
-
-Create empty PackfileFixupTable.
-
-=cut
-
-*/
-
- VTABLE void init() {
- Parrot_PackfileFixupTable_attributes * attrs =
- PMC_data_typed(SELF, Parrot_PackfileFixupTable_attributes*);
-
- attrs->entries = Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
-
- PObj_custom_mark_SET(SELF);
- }
-
-/*
-
-=item C<void mark()>
-
-Marks the object as live.
-
-=cut
-
-*/
-
- VTABLE void mark() {
- Parrot_PackfileFixupTable_attributes * attrs =
- PARROT_PACKFILEFIXUPTABLE(SELF);
-
- Parrot_gc_mark_PMC_alive(INTERP, attrs->entries);
-
- SUPER();
- }
-
-/*
-
-=item C<void set_pointer(void *pointer)>
-
-Initialize from PackFile_FixupTable pointer.
-
-=cut
-
-*/
-
- VTABLE void set_pointer(void * pointer) {
- Parrot_PackfileFixupTable_attributes * attrs =
- PARROT_PACKFILEFIXUPTABLE(SELF);
- PackFile_FixupTable * table = (PackFile_FixupTable*)pointer;
-
- PMC *entry;
- PackFile_FixupEntry *val;
- opcode_t i;
-
- VTABLE_set_integer_native(INTERP, attrs->entries, table->fixup_count);
-
- for (i = 0; i < table->fixup_count; ++i) {
- val = table->fixups + i;
- entry = Parrot_pmc_new(INTERP, enum_class_PackfileFixupEntry);
- VTABLE_set_pointer(INTERP, entry, (void*)val);
- VTABLE_set_pmc_keyed_int(INTERP, attrs->entries, i, entry);
- }
- }
-
-/*
-
-=item C<void *get_pointer()>
-
-Create PackFile_FixupTable* from self.
-
-=cut
-
-*/
- VTABLE void *get_pointer() {
- Parrot_PackfileFixupTable_attributes * attrs =
- PARROT_PACKFILEFIXUPTABLE(SELF);
- PackFile_FixupTable * pftable =
- mem_gc_allocate_zeroed_typed(INTERP, PackFile_FixupTable);
- PMC * entry;
- PackFile_FixupEntry * val;
- opcode_t i;
-
- pftable->base.type = PF_FIXUP_SEG;
- pftable->fixup_count = VTABLE_elements(INTERP, attrs->entries);
- pftable->fixups = mem_gc_allocate_n_typed(INTERP,
- pftable->fixup_count, PackFile_FixupEntry);
-
- /* Copy all entries */
- for (i = 0; i < pftable->fixup_count; ++i) {
- entry = VTABLE_get_pmc_keyed_int(INTERP, attrs->entries, i);
- val = (PackFile_FixupEntry*)VTABLE_get_pointer(INTERP, entry);
- pftable->fixups[i] = *val;
- mem_gc_free(INTERP, val);
- }
-
- return pftable;
- }
-
-
-/*
-
-=item C<INTVAL elements()>
-
-Get the number of elements in the array.
-
-=cut
-
-*/
- VTABLE INTVAL elements() {
- return VTABLE_elements(INTERP,
- PARROT_PACKFILEFIXUPTABLE(SELF)->entries);
- }
-
-
-/*
-
-=item C<PMC *get_pmc_keyed_int(INTVAL index)>
-
-Fetch the given PackfileFixupEntry PMC.
-
-=cut
-
-*/
- VTABLE PMC *get_pmc_keyed_int(INTVAL index) {
- return VTABLE_get_pmc_keyed_int(INTERP,
- PARROT_PACKFILEFIXUPTABLE(SELF)->entries, index);
- }
-
-
-/*
-
-=item C<void set_pmc_keyed_int(INTVAL index, PMC *value)>
-
-Store a PackfileFixupEntry PMC to the given slot.
-
-=cut
-
-*/
- VTABLE void set_pmc_keyed_int(INTVAL index, PMC *value) {
- VTABLE_set_pmc_keyed_int(INTERP,
- PARROT_PACKFILEFIXUPTABLE(SELF)->entries, index, value);
- }
-
-
-/*
-
-=item C<METHOD type()>
-
-Set segment type.
-
-=cut
-
-*/
-
- METHOD type() {
- RETURN(INTVAL PF_FIXUP_SEG);
- }
-
-}
-/*
-
-=back
-
-=cut
-
-*/
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
Modified: branches/string_macros/src/pmc/sub.pmc
==============================================================================
--- branches/string_macros/src/pmc/sub.pmc Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/pmc/sub.pmc Tue Sep 28 19:35:30 2010 (r49367)
@@ -435,7 +435,7 @@
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);
+ Parrot_pcc_set_constants(INTERP, context, sub->seg->const_table);
/* check recursion/call depth */
if (Parrot_pcc_inc_recursion_depth(INTERP, context) > INTERP->recursion_limit)
@@ -873,7 +873,7 @@
/* If the first instruction is a get_params... */
if (OPCODE_IS(INTERP, sub->seg, *pc, core_ops, PARROT_OP_get_params_pc)) {
/* Get the signature (the next thing in the bytecode). */
- PMC * const sig = PF_CONST(sub->seg, *(++pc)).u.key;
+ PMC * const sig = sub->seg->const_table->pmc.constants[*(++pc)];
/* Iterate over the signature and compute argument counts. */
const INTVAL sig_length = VTABLE_elements(INTERP, sig);
Modified: branches/string_macros/src/runcore/trace.c
==============================================================================
--- branches/string_macros/src/runcore/trace.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/runcore/trace.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -313,7 +313,7 @@
|| *pc == PARROT_OP_get_results_pc
|| *pc == PARROT_OP_get_params_pc
|| *pc == PARROT_OP_set_returns_pc) {
- sig = interp->code->const_table->constants[pc[1]].u.key;
+ sig = interp->code->const_table->pmc.constants[pc[1]];
if (!sig)
Parrot_ex_throw_from_c_args(interp, NULL, 1,
Modified: branches/string_macros/src/scheduler.c
==============================================================================
--- branches/string_macros/src/scheduler.c Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/src/scheduler.c Tue Sep 28 19:35:30 2010 (r49367)
@@ -859,9 +859,9 @@
static PMC * keep_context = NULL;
PMC *context;
- PMC *iter = PMCNULL;
- STRING * const handled_str = CONST_STRING(interp, "handled");
- STRING * const iter_str = CONST_STRING(interp, "handler_iter");
+ PMC *iter = PMCNULL;
+ STRING * const handled_str = CONST_STRING(interp, "handled");
+ STRING * const handler_iter_str = CONST_STRING(interp, "handler_iter");
if (already_doing) {
Parrot_io_eprintf(interp,
@@ -886,7 +886,7 @@
* tasks don't (though they could). */
if (task->vtable->base_type == enum_class_Exception
&& VTABLE_get_integer_keyed_str(interp, task, handled_str) == -1) {
- iter = VTABLE_get_attr_str(interp, task, iter_str);
+ iter = VTABLE_get_attr_str(interp, task, handler_iter_str);
context = (PMC *)VTABLE_get_pointer(interp, task);
}
else {
@@ -904,17 +904,13 @@
if (!PMC_IS_NULL(handler)) {
INTVAL valid_handler = 0;
- if (handler->vtable->base_type == enum_class_Object)
- Parrot_pcc_invoke_method_from_c_args(interp, handler, CONST_STRING(interp, "can_handle"),
- "P->I", task, &valid_handler);
- else
- Parrot_pcc_invoke_method_from_c_args(interp, handler, CONST_STRING(interp, "can_handle"),
+ Parrot_pcc_invoke_method_from_c_args(interp, handler, CONST_STRING(interp, "can_handle"),
"P->I", task, &valid_handler);
if (valid_handler) {
if (task->vtable->base_type == enum_class_Exception) {
/* Store iterator and context for a later rethrow. */
- VTABLE_set_attr_str(interp, task, CONST_STRING(interp, "handler_iter"), iter);
+ VTABLE_set_attr_str(interp, task, handler_iter_str, iter);
VTABLE_set_pointer(interp, task, context);
}
--already_doing;
Modified: branches/string_macros/t/compilers/imcc/syn/regressions.t
==============================================================================
--- branches/string_macros/t/compilers/imcc/syn/regressions.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/compilers/imcc/syn/regressions.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -242,13 +242,16 @@
CODE
OUT
-pir_error_output_like( <<'CODE', <<'OUT', 'over long keys should not segfault (TT #641)');
+SKIP: {
+ skip("No limit on key size", 1);
+ pir_error_output_like( <<'CODE', <<'OUT', 'over long keys should not segfault (TT #641)');
.sub main
$P0 = new [0;0;0;0;0;0;0;0;0;0;0;0] # more than MAX_KEY_LEN.
.end
CODE
/Key too long/
OUT
+}
# This test probably belongs in subflags.t
# The test inspired by TT #744, even though it presents differently.
Modified: branches/string_macros/t/compilers/opsc/07-emitter.t
==============================================================================
--- branches/string_macros/t/compilers/opsc/07-emitter.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/compilers/opsc/07-emitter.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -61,7 +61,7 @@
my $source := $fh.readall();
ok($source ~~ /DO \s NOT \s EDIT \s THIS \s FILE/, 'Preamble generated');
-ok($source ~~ /Parrot_pcc_get_constants/, 'defines from Trans::C generated');
+ok($source ~~ /Parrot_pcc_get_pmc_constants/, 'defines from Trans::C generated');
ok($source ~~ /io_private.h/, 'Preamble from io.ops preserved');
ok($source ~~ /static \s int \s get_op/, 'Trans::C preamble generated');
Modified: branches/string_macros/t/op/gc-leaky-box.t
==============================================================================
--- branches/string_macros/t/op/gc-leaky-box.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/op/gc-leaky-box.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -25,18 +25,16 @@
.sub _main :main
.include 'test_more.pir'
- plan(3)
$S0 = interpinfo .INTERPINFO_GC_SYS_NAME
- if $S0 == "inf" goto dont_run_hanging_tests
+ if $S0 != "ms" goto dont_run_hanging_tests
+ plan(3)
test_gc_mark_sweep()
goto test_end
dont_run_hanging_tests:
- ok(1, "#TODO - Test disabled on gc_inf")
- ok(1, "#TODO - Test disabled on gc_inf")
- ok(1, "#TODO - Test disabled on gc_inf")
+ skip_all("Not relevant for this GC")
test_end:
.end
Modified: branches/string_macros/t/op/gc-leaky-call.t
==============================================================================
--- branches/string_macros/t/op/gc-leaky-call.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/op/gc-leaky-call.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -22,18 +22,16 @@
.sub _main :main
.include 'test_more.pir'
- plan(3)
$S0 = interpinfo .INTERPINFO_GC_SYS_NAME
- if $S0 == "inf" goto dont_run_hanging_tests
+ if $S0 != "ms" goto dont_run_hanging_tests
+ plan(3)
test_gc_mark_sweep()
goto test_end
dont_run_hanging_tests:
- ok(1, "#TODO - Test disabled on gc_inf")
- ok(1, "#TODO - Test disabled on gc_inf")
- ok(1, "#TODO - Test disabled on gc_inf")
+ skip_all("Not relevant for this GC")
test_end:
.end
Added: branches/string_macros/t/op/gc-non-recursive.t
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/string_macros/t/op/gc-non-recursive.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -0,0 +1,61 @@
+#!./parrot
+# Copyright (C) 2010, Parrot Foundation.
+# $Id$
+
+=head1 NAME
+
+t/op/gc-non-recursive.t - test for marking very large linked-list
+
+=head1 SYNOPSIS
+
+ % prove t/op/gc-non-recursive.t
+
+=head1 DESCRIPTION
+
+See http://trac.parrot.org/parrot/ticket/1723
+
+=cut
+
+
+.sub 'main' :main
+ .include 'test_more.pir'
+
+ .local pmc iterclass, intclass
+
+ iterclass = newclass ['RangeIter']
+ addattribute iterclass, '$!value'
+ addattribute iterclass, '$!nextIter'
+ intclass = subclass ['Integer'], 'Int'
+
+ .local pmc head, next
+ head = new iterclass
+ $P0 = new intclass
+ setattribute head, '$!value', $P0
+
+ next = head
+ loop:
+ ($I0, next) = next.'reify'()
+ if $I1 < 10000000 goto loop
+ sweep 1
+ ok(1, "Marking of large list doesn't exaust C stack")
+ done_testing()
+.end
+
+
+.namespace ['RangeIter']
+
+.sub 'reify' :method
+ .local pmc value, nextiter
+ value = getattribute self, '$!value'
+ nextiter = new ['RangeIter']
+ setattribute self, '$!nextIter', nextiter
+ $P0 = add value, 1.0
+ setattribute nextiter, '$!value', $P0
+ .return ($P0, nextiter)
+.end
+
+# Local Variables:
+# mode: pir
+# fill-column: 100
+# End:
+# vim: expandtab shiftwidth=4 ft=pir:
Modified: branches/string_macros/t/op/string_mem.t
==============================================================================
--- branches/string_macros/t/op/string_mem.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/op/string_mem.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -41,12 +41,11 @@
test_stringinfo()
$S0 = interpinfo .INTERPINFO_GC_SYS_NAME
- if $S0 == "inf" goto dont_run_hanging_tests
+ if $S0 != "ms" goto dont_run_hanging_tests
test_pin_unpin()
goto test_end
dont_run_hanging_tests:
- ok(1, "#TODO - Test disabled on gc_inf")
- ok(1, "#TODO - Test disabled on gc_inf")
+ skip(2, "Test disabled on not GC MS")
test_end:
.end
Modified: branches/string_macros/t/pmc/bytebuffer.t
==============================================================================
--- branches/string_macros/t/pmc/bytebuffer.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/pmc/bytebuffer.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -349,12 +349,14 @@
.end
.sub test_invalid
- .local pmc bb, ex
+ .local pmc bb, eh, ex
.local string s
+ eh = new ['ExceptionHandler'], .EXCEPTION_INVALID_ENCODING
+ set_addr eh, catch_encoding
+ push_eh eh
bb = new ['ByteBuffer']
bb = 'something'
- push_eh catch_encoding
- s = bb.'get_string'('ascii', '???INVALID eNCODING===')
+ s = bb.'get_string'('???INVALID eNCODING===')
pop_eh
ok(0, "get_string with invalid encoding should throw")
goto check_content
@@ -365,8 +367,10 @@
ok(1, "get_string with invalid encoding throws")
check_content:
bb[0] = 128 # Out of ascii range
- push_eh catch_content
- s = bb.'get_string'('ascii', 'fixed_8')
+ eh = new ['ExceptionHandler'], .EXCEPTION_INVALID_STRING_REPRESENTATION
+ set_addr eh, catch_content
+ push_eh eh
+ s = bb.'get_string'('ascii')
pop_eh
ok(0, "get_string with invalid content should throw")
goto end
Modified: branches/string_macros/t/pmc/eval.t
==============================================================================
--- branches/string_macros/t/pmc/eval.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/pmc/eval.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -399,7 +399,7 @@
written
OUTPUT
-pir_output_is( <<"CODE", <<'OUTPUT', "eval.thaw", todo => 'TT #1142' );
+pir_output_is( <<"CODE", <<'OUTPUT', "eval.thaw");
.sub main :main
.local pmc io, e
.local string file
Modified: branches/string_macros/t/pmc/filehandle.t
==============================================================================
--- branches/string_macros/t/pmc/filehandle.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/pmc/filehandle.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -736,6 +736,9 @@
expect 1 exit status: 1
OUTPUT
+SKIP: {
+ skip 'Timely destruction is deprecated. TT#1800' => 1;
+
pir_output_is( sprintf(<<'CODE', $temp_file), <<'OUTPUT', "timely destruction" );
.const string temp_file = '%s'
.sub main :main
@@ -745,16 +748,24 @@
needs_destroy $P0
print $P0, "a line\n"
null $P0 # kill it
+ # Call dummy sub to cleanup CallContext
+ dummy()
sweep 0 # a lazy GC has to close the PIO
$P0 = new ['FileHandle']
$P0.'open'(temp_file, 'r')
$S0 = $P0.'read'(20)
print $S0
.end
+
+.sub dummy
+.end
+
CODE
a line
OUTPUT
+}
+
my (undef, $no_such_file) = create_tempfile( UNLINK => 1, OPEN => 0 );
pir_output_is( sprintf( <<'CODE', $no_such_file, $temp_file ), <<'OUTPUT', "get_bool" );
Modified: branches/string_macros/t/pmc/io.t
==============================================================================
--- branches/string_macros/t/pmc/io.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/pmc/io.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -7,7 +7,7 @@
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 32;
+use Parrot::Test tests => 31;
use Parrot::Test::Util 'create_tempfile';
=head1 NAME
@@ -40,25 +40,6 @@
my (undef, $temp_file) = create_tempfile( UNLINK => 1 );
-pir_output_is( sprintf(<<'CODE', $temp_file), <<'OUTPUT', "timely destruction" );
-.const string temp_file = '%s'
-.sub main :main
- interpinfo $I0, 2 # GC mark runs
- $P0 = new ['FileHandle']
- $P0.'open'(temp_file, 'w')
- needs_destroy $P0
- print $P0, "a line\n"
- null $P0 # kill it
- sweep 0 # a lazy GC has to close the PIO
- $P0 = new ['FileHandle']
- $P0.'open'(temp_file, 'r')
- $S0 = $P0.'read'(20)
- print $S0
-.end
-CODE
-a line
-OUTPUT
-
pir_output_is( <<'CODE', <<'OUTPUT', "read on invalid fh should throw exception" );
.sub main :main
new $P0, ['FileHandle']
Modified: branches/string_macros/t/pmc/key.t
==============================================================================
--- branches/string_macros/t/pmc/key.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/pmc/key.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -19,13 +19,14 @@
.sub main :main
.include 'test_more.pir'
- plan(9)
+ plan(12)
traverse_key_chain()
extract_int_from_string_keys()
extract_string_from_int_keys()
use_number_keys()
do_not_collect_string_keys_early_rt_60128()
+ 'get_repr'()
.end
.sub traverse_key_chain
@@ -175,6 +176,31 @@
set_global 'call_chain', $P1
.end
+.sub 'get_repr'
+ $P0 = new ['Key']
+ $P0 = 42
+ repr_is($P0, '[ 42 ]')
+
+ $P0 = new ['Key']
+ $P0 = "xyzzy"
+ repr_is($P0, "[ 'xyzzy' ]") # nothing happens (hopefully)
+
+ $P0 = new ['Key']
+ $P0.'set_register'(1, 4) # register 1 of set 4 (S1)
+ # XXX PCC treats key arguments as special. Don't pass keys to subroutines.
+ # repr_is($P0, '[ S1 ]')
+ $S0 = get_repr $P0
+ is($S0, '[ S1 ]')
+.end
+
+.sub repr_is
+ .param pmc x
+ .param pmc repr
+ .include 'test_more.pir'
+ $S0 = get_repr x
+ is($S0, repr)
+.end
+
# Local Variables:
# mode: pir
# fill-column: 100
Modified: branches/string_macros/t/pmc/packfile.t
==============================================================================
--- branches/string_macros/t/pmc/packfile.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/pmc/packfile.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -24,7 +24,7 @@
.sub main :main
.include 'test_more.pir'
- plan(47)
+ plan(45)
'test_new'()
'test_set_string_native'()
'test_get_string'()
@@ -354,28 +354,22 @@
.local pmc pf, pfdir
pf = new 'Packfile'
pfdir = pf.'get_directory'()
- #$P0 = new 'PackfileConstantTable'
- #$P0[0] = 42.0
- $P0 = new 'PackfileFixupTable'
- $P1 = new 'PackfileFixupEntry'
- $P1 = 42
- $P1.'set_type'(1)
- $P1 = "The fixup"
- $P0[0] = $P1
- pfdir["FIXUP_t/pmc/packfile.t"] = $P0
$P1 = new 'PackfileRawSegment'
pfdir["BYTECODE_t/pmc/packfile.t"] = $P1
$P2 = new 'PackfileConstantTable'
+ # float constants
$P2[0] = 42.0
- $P2[1] = "42"
+ # string constants
+ $P2[0] = "42"
+ # PMC constants
$P3 = new 'Integer'
$P3 = 42
- $P2[2] = $P3
+ $P2[0] = $P3
$P4 = new 'Key'
$P4 = 42
- $P2[3] = $P4
+ $P2[1] = $P4
pfdir["CONSTANTS_t/pmc/packfile.t"] = $P2
# Set uuid_type
@@ -385,9 +379,10 @@
# Pack it
ok(1, "PackFile packed")
- #$P1 = open "/tmp/1.pbc", "w"
- #$P1.'puts'($S0)
- #close $P1
+ # $P1 = new ['FileHandle']
+ # $P1.'open'("/tmp/1.pbc", "w")
+ # $P1.'puts'($S0)
+ # $P1.'close'()
pf = new 'Packfile'
pf = $S0
@@ -396,32 +391,27 @@
$I0 = pf['uuid_type']
is($I0, 1, "uuid_type preserved")
- # Check that FixupTable contains our Entry.
- $P0 = _get_fixup_table(pf)
- $I1 = elements $P0
- is($I1, 1, "FixupTable contains one element")
- $P1 = $P0[0]
- isa_ok($P1, "PackfileFixupEntry")
- $I0 = $P1
- is($I0, 42, "FixupEntry offset preserved")
- $S0 = $P1
- is($S0, "The fixup", "FixupEntry name preserved")
-
# Check unpacked ConstTable
$P0 = _find_segment_by_type(pf, "PackfileConstantTable")
$I0 = defined $P0
ok($I0, "ConstantTable unpacked")
- $I0 = elements $P0
- is($I0, 4, " and contains 4 elements")
+
+ $I0 = $P0.'num_count'()
+ is($I0, 1, " and contains 1 number constants")
+ $I0 = $P0.'str_count'()
+ is($I0, 1, " and contains 1 string constant")
+ $I0 = $P0.'pmc_count'()
+ is($I0, 2, " and contains 2 pmc constants")
+
$N0 = $P0[0]
- is($N0, 42.0, " first is number")
- $S0 = $P0[1]
- is($S0, "42", " second is string")
- $P1 = $P0[2]
+ is($N0, 42.0, " first number")
+ $S0 = $P0[0]
+ is($S0, "42", " first string")
+ $P1 = $P0[0]
isa_ok($P1, "Integer")
$I0 = $P1
is($I0, 42, " with proper value")
- $P1 = $P0[3]
+ $P1 = $P0[1]
isa_ok($P1, "Key")
.end
Modified: branches/string_macros/t/pmc/packfileannotations.t
==============================================================================
--- branches/string_macros/t/pmc/packfileannotations.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/pmc/packfileannotations.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -66,10 +66,6 @@
.local pmc pf, pfdir
pf = new 'Packfile'
pfdir = pf.'get_directory'()
- #$P0 = new 'PackfileConstantTable'
- #$P0[0] = 42.0
- $P0 = new 'PackfileFixupTable'
- pfdir["FIXUP_t/pmc/packfileannotations.t"] = $P0
$P1 = new 'PackfileRawSegment'
pfdir["BYTECODE_t/pmc/packfileannotations.t"] = $P1
Modified: branches/string_macros/t/pmc/packfileconstanttable.t
==============================================================================
--- branches/string_macros/t/pmc/packfileconstanttable.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/pmc/packfileconstanttable.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -26,11 +26,10 @@
.sub 'main' :main
.include 'test_more.pir'
-.include 'packfile_constants.pasm'
- 'plan'(16)
+ 'plan'(15)
'test_sanity'()
- 'test_elements'()
+ 'test_counts'()
'test_get'()
'test_set'()
'test_get_or_create'()
@@ -56,7 +55,7 @@
# PackfileConstantTable.elements
-.sub 'test_elements'
+.sub 'test_counts'
.local pmc pf, pftable
.local int size
push_eh load_error
@@ -67,8 +66,15 @@
# Make sure the mark vtable is exercised and the content survives
sweep 1
- size = elements pftable
- ok(size, "PackfileConstantTable.elements returns non-zero")
+ size = pftable.'pmc_count'()
+ ok(size, "PackfileConstantTable.pmc_count returns non-zero")
+
+ size = pftable.'str_count'()
+ ok(size, "PackfileConstantTable.str_count returns non-zero")
+
+ size = pftable.'num_count'()
+ ok(size, "PackfileConstantTable.num_count returns non-zero")
+
.return ()
load_error:
.get_results($P0)
@@ -78,53 +84,40 @@
.end
-# PackfileConstantTable.get_type and PackfileConstantTable.get_*_keyed_int
+# PackfileConstantTable.get_*_keyed_int
.sub 'test_get'
.local pmc pf, pftable
- .local int size, this, type
+ .local int size, i
push_eh load_error
pf = _pbc()
pop_eh
pftable = _get_consttable(pf)
- size = elements pftable
- this = 0
- loop:
- type = pftable.'get_type'(this)
- eq type, .PFC_NONE, next
- eq type, .PFC_NUMBER, const_num
- eq type, .PFC_STRING, const_str
- eq type, .PFC_PMC, const_pmc
- eq type, .PFC_KEY, const_key
- goto bad
- const_num:
- $N0 = pftable[this]
- goto next
- const_str:
- $S0 = pftable[this]
- goto next
- const_pmc:
- $P0 = pftable[this]
- goto next
- const_key:
- $P0 = pftable[this]
- $S0 = typeof $P0
- eq $S0, 'Key', next
- $S0 = concat 'constant Key with wrong type: ', $S0
- ok(0, $S0)
- .return()
- next:
- this = this + 1
- ge this, size, done
- goto loop
- gt size, 0, done
+ size = pftable.'num_count'()
+ i = 0
+ num_loop:
+ $N0 = pftable[i]
+ inc i
+ if i < size goto num_loop
+
+ size = pftable.'str_count'()
+ i = 0
+ str_loop:
+ $S0 = pftable[i]
+ inc i
+ if i < size goto str_loop
+
+ size = pftable.'pmc_count'()
+ i = 0
+ pmc_loop:
+ $P0 = pftable[i]
+ inc i
+ if i < size goto pmc_loop
+
done:
ok(1, 'PackfileConstantTable.get_*_int works')
.return()
- bad:
- ok(0, 'Unknown constant type')
- .return()
load_error:
.get_results($P0)
pop_eh
@@ -139,32 +132,26 @@
ct = new ['PackfileConstantTable']
# Initial PackfileConstantTable is empty
- size = elements ct
+ $I0 = ct.'num_count'()
+ $I1 = ct.'str_count'()
+ $I2 = ct.'pmc_count'()
+ size = $I0 + $I1
+ size += $I2
is(size, 0, "Empty PackfileConstantTable created")
- # Set first string
ct[0] = "string"
- $I0 = elements ct
+ $I0 = ct.'str_count'()
is($I0, 1, "String element added")
- ct[1] = 1.0
- $I0 = elements ct
- is($I0, 2, "Number elements added")
+ ct[0] = 1.0
+ $I0 = ct.'num_count'()
+ is($I0, 1, "Number elements added")
$P0 = new 'Integer'
$P0 = 42
- ct[2] = $P0
- $I0 = elements ct
- is($I0, 3, "PMC elements added")
-
- # Check types of created constants
- $I0 = ct.'get_type'(0)
- is($I0, .PFC_STRING, "First element is string")
- $I0 = ct.'get_type'(1)
- is($I0, .PFC_NUMBER, "Second element is number")
- $I0 = ct.'get_type'(2)
- is($I0, .PFC_PMC, "Third element is PMC")
-
+ ct[0] = $P0
+ $I0 = ct.'pmc_count'()
+ is($I0, 1, "PMC elements added")
.end
.sub 'test_get_or_create'
Modified: branches/string_macros/t/pmc/packfiledirectory.t
==============================================================================
--- branches/string_macros/t/pmc/packfiledirectory.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/pmc/packfiledirectory.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -22,7 +22,7 @@
.sub 'main' :main
.include 'test_more.pir'
- plan(20)
+ plan(17)
'test_create'()
'test_typeof'()
@@ -69,7 +69,7 @@
pop_eh
pfdir = pf.'get_directory'()
$I0 = elements pfdir
- is($I0, 4, 'PackfileDirectory.elements')
+ is($I0, 3, 'PackfileDirectory.elements')
.return()
load_error:
.get_results($P0)
Deleted: branches/string_macros/t/pmc/packfilefixupentry.t
==============================================================================
--- branches/string_macros/t/pmc/packfilefixupentry.t Tue Sep 28 19:35:30 2010 (r49366)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,113 +0,0 @@
-#!./parrot
-# Copyright (C) 2009-2010, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/packfilefixupentry.t - test the PackfileFixupEntry PMC
-
-=head1 SYNOPSIS
-
- % make test_prep
- % prove t/pmc/packfilefixupentry.t
-
-=head1 DESCRIPTION
-
-Tests the PackfileFixupEntry PMC.
-
-=cut
-
-# Having some known data would be helpful, here. For now, just make sure
-# the values returned seem sane.
-
-.include 't/pmc/testlib/packfile_common.pir'
-
-.sub 'main' :main
-.include 'test_more.pir'
- plan(3)
- test_sanity()
- test_sanity_entry()
- test_methods()
-.end
-
-
-
-# sanity check we start with a PackfileFixupTable
-.sub 'test_sanity'
- .local pmc pf, pftable
- .local string name
- push_eh load_error
- pf = _pbc()
- pop_eh
- pftable = _get_fixup_table(pf)
- isa_ok(pftable, 'PackfileFixupTable')
- .return()
-load_error:
- .get_results($P0)
- pop_eh
- report_load_error($P0, 'PackfileFixupTable')
- .return()
-.end
-
-
-# sanity check we end up with a PackfileFixupTable
-.sub 'test_sanity_entry'
- .local pmc pf, pftable, pfentry
- .local string name
- push_eh load_error
- pf = _pbc()
- pop_eh
- pftable = _get_fixup_table(pf)
- pfentry = pftable[0]
- isa_ok(pfentry, 'PackfileFixupEntry')
- .return()
-load_error:
- .get_results($P0)
- pop_eh
- report_load_error($P0, 'PackfileFixupEntry')
- .return()
-.end
-
-
-# PackfileFixupEntry methods .get_string(), .get_integer(), .get_type()
-.sub 'test_methods'
- .local pmc pf, pftable, pfentry
- .local int size, this, data
- .local string name, label
- push_eh load_error
- pf = _pbc()
- pop_eh
- pftable = _get_fixup_table(pf)
- size = elements pftable
- this = 0
- loop:
- pfentry = pftable[this]
- name = typeof pfentry
- eq name, "PackfileFixupEntry", next
- $S0 = "PackfileFixupTable["
- $S1 = this
- $S0 = concat $S1
- $S0 = concat "] returned an object of type: "
- $S0 = concat name
- ok(0, $S0)
- .return ()
- next:
- this = this + 1
- ge this, size, done
- goto loop
- gt size, 0, done
- done:
- ok(1, "Got entries")
- .return()
-load_error:
- .get_results($P0)
- pop_eh
- report_load_error($P0, "Got entries")
- .return()
-.end
-
-# Local Variables:
-# mode: pir
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
Deleted: branches/string_macros/t/pmc/packfilefixuptable.t
==============================================================================
--- branches/string_macros/t/pmc/packfilefixuptable.t Tue Sep 28 19:35:30 2010 (r49366)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,91 +0,0 @@
-#!./parrot
-# Copyright (C) 2009-2010, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/packfilefixuptable.t - test the PackfileFixupTable PMC
-
-
-=head1 SYNOPSIS
-
- % make test_prep
- % prove t/pmc/packfilefixuptable.t
-
-=head1 DESCRIPTION
-
-Tests the PackfileFixupTable PMC.
-
-=cut
-
-# Having some known data would be helpful, here. For now, just make sure
-# the values returned have the right types.
-
-.include 't/pmc/testlib/packfile_common.pir'
-.sub 'main' :main
-.include 'test_more.pir'
- plan(3)
-
- test_unpack()
-.end
-
-
-# Report no ok for loading packfile failures
-.sub report_load_error
- .param pmc except
- .param string desc
- .local string msg, aux
- msg = concat desc, ' - error loading packfile: '
- aux = except['message']
- msg = concat msg, aux
- ok(0, msg)
-.end
-
-
-# Check unpackging FixupTable
-.sub 'test_unpack'
- .local pmc pf, pfdir, pftable, pfentry
- .local int size, this, data
- .local string name
- push_eh load_error
- pf = _pbc()
- pop_eh
- pftable = _get_fixup_table(pf)
- isa_ok(pftable, 'PackfileFixupTable')
-
- size = elements pftable
- ok(size, "Got some elements")
-
- this = 0
- loop:
- pfentry = pftable[this]
- name = typeof pfentry
- eq name, "PackfileFixupEntry", next
- $S0 = "PackfileFixupTable["
- $S1 = this
- $S0 = concat $S1
- $S0 = concat "] returned an object of type: "
- $S0 = concat name
- ok(0, $S0)
- .return ()
- next:
- this = this + 1
- ge this, size, done
- goto loop
- gt size, 0, done
- done:
- ok(1, "All elements of Table are Entries")
- .return()
-load_error:
- .get_results($P0)
- pop_eh
- report_load_error($P0, "All elements of Table are Entries")
- skip(2, "All elements of Table are Entries")
- .return()
-.end
-
-# Local Variables:
-# mode: pir
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
Modified: branches/string_macros/t/pmc/packfilerawsegment.t
==============================================================================
--- branches/string_macros/t/pmc/packfilerawsegment.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/pmc/packfilerawsegment.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -114,7 +114,7 @@
done:
$I0 = elements hash
- is($I0, 4, "Got all types of Packfile segments")
+ is($I0, 3, "Got all types of Packfile segments")
# Now create RawSegment and set type.
$P0 = new ['PackfileRawSegment']
Modified: branches/string_macros/t/pmc/testlib/packfile_common.pir
==============================================================================
--- branches/string_macros/t/pmc/testlib/packfile_common.pir Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/pmc/testlib/packfile_common.pir Tue Sep 28 19:35:30 2010 (r49367)
@@ -64,13 +64,6 @@
.return ()
.end
-.sub '_get_fixup_table'
- .param pmc pf
-
- .tailcall '_find_segment_by_type'(pf, "PackfileFixupTable")
-.end
-
-
# Report no ok for loading packfile failures
.sub report_load_error
.param pmc except
Modified: branches/string_macros/t/run/options.t
==============================================================================
--- branches/string_macros/t/run/options.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/run/options.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -20,7 +20,7 @@
use warnings;
use lib qw( lib . ../lib ../../lib );
-use Test::More tests => 28;
+use Test::More tests => 30;
use Parrot::Config;
use File::Temp 0.13 qw/tempfile/;
use File::Spec;
@@ -96,6 +96,13 @@
# Test --runtime-prefix
like( qx{$PARROT --runtime-prefix}, qr/^.+$/, "--runtime-prefix" );
+# TT #1797: check for warning error and mask off "did it crash?" bits
+my $output = qx{$PARROT --gc-threshold 2>&1 };
+my $exit = $? & 127;
+like( $output, qr/--gc-threshold needs an argument/,
+ '--gc-threshold needs argument warning' );
+is( $exit, 0, '... and should not crash' );
+
# clean up temporary files
unlink $first_pir_file;
unlink $second_pir_file;
Modified: branches/string_macros/t/tools/pbc_dump.t
==============================================================================
--- branches/string_macros/t/tools/pbc_dump.t Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/t/tools/pbc_dump.t Tue Sep 28 19:35:30 2010 (r49367)
@@ -45,10 +45,10 @@
plan skip_all => "pbc_dump hasn't been built. Run make parrot_utils";
exit(0);
}
- plan tests => 8;
+ plan tests => 7;
}
-dump_output_like( <<PIR, "pir", [qr/FIXUP_t/, qr/CONSTANT_t/, qr/BYTECODE_t/], 'pbc_dump basic sanity');
+dump_output_like( <<PIR, "pir", [qr/CONSTANT_t/, qr/BYTECODE_t/], 'pbc_dump basic sanity');
.sub main :main
\$I0 = 42
.end
Modified: branches/string_macros/tools/release/release.json
==============================================================================
--- branches/string_macros/tools/release/release.json Tue Sep 28 17:16:52 2010 (r49366)
+++ branches/string_macros/tools/release/release.json Tue Sep 28 19:35:30 2010 (r49367)
@@ -1,9 +1,9 @@
{
- "release.version" : "2.8.0",
- "release.name" : "Tui Parakeet",
+ "release.version" : "2.9.0",
+ "release.name" : "Red-masked",
"release.day" : "Tuesday",
- "release.date" : "21 September 2010",
- "release.nextdate" : "19 October 2010",
+ "release.date" : "19 October 2010",
+ "release.nextdate" : "16 November 2010",
"web.root" : "http://parrot.org/",
"web.source" : "download",
@@ -11,11 +11,11 @@
"web.repository" : "https://svn.parrot.org/parrot/trunk/",
"bugday.day" : "Saturday",
- "bugday.date" : "16 October 2010",
+ "bugday.date" : "13 November 2010",
"wiki.root" : "https://trac.parrot.org/parrot/wiki/",
- "wiki.bugday" : "bug_day_2010_10_16",
+ "wiki.bugday" : "bug_day_2010_11_13",
- "ftp.path" : "ftp://ftp.parrot.org/pub/parrot/releases/devel/2.8.0/",
+ "ftp.path" : "ftp://ftp.parrot.org/pub/parrot/releases/supported/2.9.0/",
"subversion.root" : "http://subversion.apache.org/"
}
More information about the parrot-commits
mailing list