help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] [PATCH] libgst: Add built-in for Behavior>>#new and


From: Holger Hans Peter Freyther
Subject: Re: [Help-smalltalk] [PATCH] libgst: Add built-in for Behavior>>#new and >>#new:
Date: Sat, 2 Aug 2014 21:01:36 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

On Sat, Aug 02, 2014 at 08:42:45PM +0200, Holger Hans Peter Freyther wrote:

> -/* Behavior new:; Behavior basicNew: */
> +/* Behavior Behavior new; */
> +primitive VMpr_Behavior_newInitialize [succeed,fail]
> +{
> +  OOP oop1;
> +  _gst_primitives_executed++;
> +
> +  oop1 = STACKTOP ();
> +  if COMMON (RECEIVER_IS_OOP (oop1))
> +    {
> +      if COMMON (!CLASS_IS_INDEXABLE (oop1))
> +     {
> +       /* Note: you cannot pass &STACKTOP() because if the stack
> +          moves it ain't valid anymore by the time it is set!!! */
> +       OOP result;
> +       instantiate (oop1, &result);
> +       SET_STACKTOP (result);
> +       _gst_send_message_internal(_gst_initialize_symbol, 0, result, oop1);
> +       PRIM_SUCCEEDED_RELOAD_IP;
> +     }
> +    }
> +  PRIM_FAILED;


This does break the jit in the processor scheduler.

Program received signal SIGSEGV, Segmentation fault.
next_scheduled_process () at interp.c:1972
1972      if (is_process_ready (get_scheduled_process ()))
(gdb) bt
#0  next_scheduled_process () at interp.c:1972
#1  0xb7f69025 in suspend_process (processOOP=0xb3bb2800) at interp.c:1456
#2  0xb7f69e0f in _gst_terminate_process (processOOP=<optimized out>) at 
interp.c:1466
#3  _gst_interpret (processOOP=0xb3c16f28) at interp-jit.inl:405
#4  0xb7f6b121 in _gst_nvmsg_send (receiver=0xb3bb2800, 
sendSelector=0xb3c16f00, args=0x0, 
    sendArgs=0) at interp.c:2318
#5  0xb7f14952 in _gst_execute_statements (receiverOOP=0xb3bb2800, 
method=0xb3c16f00, 
    undeclared=true, quiet=true) at comp.c:586
#6  0xb7f06140 in execute_doit (p=0xbffff574, temps=0x0, stmts=0x81a883c, 
    receiverOOP=0xb3bb2800, undeclared=true, quiet=false) at gst-parse.c:592
#7  0xb7f07234 in parse_eval_definition (p=0xb3bb2800) at gst-parse.c:756
#8  0xb7f086f7 in parse_scoped_definition (first_stmt=<optimized out>, 
p=<optimized out>)
    at gst-parse.c:668
#9  parse_doit (p=0xbffff574, fail_at_eof=(true | unknown: 3086476424)) at 
gst-parse.c:624
#10 0xb7f08d8c in parse_chunks (address@hidden) at gst-parse.c:475
#11 0xb7f091af in _gst_parse_chunks (currentNamespace=0x0) at gst-parse.c:449
#12 0xb7f0ad92 in _gst_parse_stream (currentNamespace=0x0) at lex.c:1209
#13 0xb7f35b2e in _gst_process_file (
    fileName=0xb7f7e01d <standard_files+1053> "ObjMemory.st", 
dir=GST_DIR_KERNEL)
    at input.c:855


I wonder if the SET_STACKTOP is correct before calling the internal
method?

> +/* Symbols inside the builtin selectors */
> +OOP _gst_initialize_symbol = NULL;
> +
>  OOP temporaries_dictionary = NULL;
>  
>  /* The list of selectors for the send immediate bytecode.  */
> @@ -1571,6 +1574,8 @@ _gst_init_symbols_pass1 (void)
>        {
>       const char *name = bs->offset + _gst_builtin_selectors_names;
>       bs->symbol = alloc_symbol_oop (name, strlen (name));
> +        if (strcmp(name, "initialize") == 0)
> +          _gst_initialize_symbol = bs->symbol;
>          _gst_builtin_selectors[bs->bytecode] = *bs;
>        }
>  }
> @@ -1634,6 +1639,8 @@ _gst_restore_symbols (void)
>        {
>       const char *name = bs->offset + _gst_builtin_selectors_names;
>       bs->symbol = intern_string_fast (name, &currentOOP);
> +        if (strcmp(name, "initialize") == 0)
> +          _gst_initialize_symbol = bs->symbol;
>          _gst_builtin_selectors[bs->bytecode] = *bs;

I can't use _gst_intern_string() until a lot later in the setup. I wondered
if we should change the builtin.perf file add a INITIALIZE_SPECIAL as well
(and while we are at it, I find it strange that do: didn't show up in there
at all.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]