[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-smalltalk] [PATCH 3/4] embedded: Allow to disable the line num
From: |
Paolo Bonzini |
Subject: |
Re: [Help-smalltalk] [PATCH 3/4] embedded: Allow to disable the line number bytecode |
Date: |
Sat, 11 May 2013 19:07:23 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130311 Thunderbird/17.0.4 |
Il 05/05/2013 11:26, Holger Hans Peter Freyther ha scritto:
> This is more noticable on smaller devices. Allow to disable the
> line number bytecode. This changes the runtime of Bench.st for
> 4 iterations from 26s to 19s.
Please use gst_get_var/gst_set_var, otherwise ok.
Paolo
> ---
> gst-tool.c | 7 ++++++-
> libgst/byte.c | 8 ++++++--
> libgst/gstpriv.h | 3 +++
> libgst/gstpub.c | 5 +++++
> libgst/gstpub.h | 2 ++
> main.c | 6 ++++++
> 6 files changed, 28 insertions(+), 3 deletions(-)
>
> diff --git a/gst-tool.c b/gst-tool.c
> index 9cbadce..3f777b4 100644
> --- a/gst-tool.c
> +++ b/gst-tool.c
> @@ -138,7 +138,7 @@ const struct tool tools[] = {
> "gst-remote", "scripts/Remote.st",
> "-h|--help --version --daemon --server -p|--port: -f|--file: -e|--eval: \
> -l|--login: --package: --start: --stop: --pid --kill --snapshot:: \
> - -I|--image-file: --kernel-directory: -v|-V|--verbose",
> + -I|--image-file: --kernel-directory: -v|-V|--verbose --no-line-numbers",
> NULL, true
> },
> {
> @@ -293,6 +293,11 @@ parse_option (int short_opt, const char *long_opt, const
> char *arg)
> #endif
> }
>
> + if (long_opt && !strcmp (long_opt, "no-line-numbers"))
> + {
> + gst_omit_line_numbers(true);
> + }
> +
> if (long_opt && !strcmp (long_opt, "version"))
> usage = 1;
>
> diff --git a/libgst/byte.c b/libgst/byte.c
> index 6eed361..50ff07c 100644
> --- a/libgst/byte.c
> +++ b/libgst/byte.c
> @@ -59,6 +59,8 @@
> /* Where the compiled bytecodes go. */
> bc_vector _gst_cur_bytecodes;
>
> +mst_Boolean _gst_omit_line_numbers = 0;
> +
> /* Reallocate an array of bytecodes, leaving space for DELTA more
> bytes. */
> static void realloc_bytecodes (bc_vector bytecodes,
> @@ -127,7 +129,8 @@ _gst_line_number (int n, int flags)
> assert (n > 0);
> if (flags & LN_ABSOLUTE)
> {
> - compile_byte (LINE_NUMBER_BYTECODE, n);
> + if (!_gst_omit_line_numbers)
> + compile_byte (LINE_NUMBER_BYTECODE, n);
> _gst_compiler_state->prev_line = n;
> }
> _gst_compiler_state->line_offset = n - 1;
> @@ -158,7 +161,8 @@ _gst_compile_byte (gst_uchar byte, int arg)
> {
> if (next_line_number != -1)
> {
> - compile_byte (LINE_NUMBER_BYTECODE, next_line_number);
> + if (!_gst_omit_line_numbers)
> + compile_byte (LINE_NUMBER_BYTECODE, next_line_number);
> next_line_number = -1;
> }
>
> diff --git a/libgst/gstpriv.h b/libgst/gstpriv.h
> index b3d100f..7e9dcf7 100644
> --- a/libgst/gstpriv.h
> +++ b/libgst/gstpriv.h
> @@ -552,6 +552,9 @@ extern OOP _gst_nil_oop
> #define MIN(x, y) ( ((x) > (y)) ? (y) : (x) )
> #endif
>
> +/* helpers */
> +extern mst_Boolean _gst_omit_line_numbers;
> +
> #include "ansidecl.h"
> #include "mathl.h"
> #include "socketx.h"
> diff --git a/libgst/gstpub.c b/libgst/gstpub.c
> index 2ebdfe2..c1a17ea 100644
> --- a/libgst/gstpub.c
> +++ b/libgst/gstpub.c
> @@ -609,3 +609,8 @@ gst_set_event_loop_handlers(mst_Boolean (*poll) (int ms),
> {
> return _gst_set_event_loop_handlers(poll, dispatch);
> }
> +
> +void gst_omit_line_numbers(mst_Boolean omit)
> +{
> + _gst_omit_line_numbers = omit;
> +}
> diff --git a/libgst/gstpub.h b/libgst/gstpub.h
> index cec9fc3..bc45bd9 100644
> --- a/libgst/gstpub.h
> +++ b/libgst/gstpub.h
> @@ -342,6 +342,8 @@ extern wchar_t *gst_oop_to_wstring (OOP oop);
> extern mst_Boolean gst_set_event_loop_handlers(mst_Boolean (*poll) (int ms),
> void (*dispatch) (void));
>
> +extern void gst_omit_line_numbers(mst_Boolean omit);
> +
> /* This is exclusively for programs who link with libgst.a; plugins
> should not use this VMProxy but rather the one they receive in
> gst_initModule. */
> diff --git a/main.c b/main.c
> index 9c6bc60..7c050d7 100644
> --- a/main.c
> +++ b/main.c
> @@ -92,6 +92,7 @@ static const char help_text[] =
> "\n --kernel-directory DIR\t Look for kernel files in directory DIR."
> "\n --no-user-files\t\t Don't read user customization files.\n"
> "\n -\t\t\t\t Read input from standard input explicitly."
> + "\n --no-line-numbers\t\t Do not generate line numbers in the
> bytecode."
> "\n"
> "\nFiles are loaded one after the other. After the last one is loaded,"
> "\nSmalltalk will exit. If no files are specified, Smalltalk reads from"
> @@ -122,6 +123,7 @@ static const char copyright_and_legal_stuff_text[] =
> #define OPT_NO_USER 3
> #define OPT_EMACS_MODE 4
> #define OPT_MAYBE_REBUILD 5
> +#define OPT_NO_LINE_NUMBERS 6
>
> #define OPTIONS "-acDEf:ghiI:K:lL:QqrSvV"
>
> @@ -147,6 +149,7 @@ static const struct option long_options[] = {
> {"snapshot", 0, 0, 'S'},
> {"version", 0, 0, 'v'},
> {"verbose", 0, 0, 'V'},
> + {"no-line-numbers", 0, 0, OPT_NO_LINE_NUMBERS},
> {NULL, 0, 0, 0}
> };
>
> @@ -299,6 +302,9 @@ parse_args (int argc,
> loaded_files[n_loaded_files].kernel_path = false;
> loaded_files[n_loaded_files++].file_name = optarg;
> break;
> + case OPT_NO_LINE_NUMBERS:
> + gst_omit_line_numbers(true);
> + break;
>
> default:
> /* Fall through and show help message */
>
[Help-smalltalk] [PATCH 4/4] embedded: Allow to disable the profiling support in the interpreter, Holger Hans Peter Freyther, 2013/05/05
Re: [Help-smalltalk] [PATCH 1/4] embedded: Use more registers on ARM as there are plenty and reduce the alignment, Paolo Bonzini, 2013/05/11