Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Renaming functions of src/global_setup.c #8

Closed
wants to merge 7 commits into from

2 participants

@fernandobrito

Renaming functions of src/global_setup.c to include Parrot_gbl_*

Please do not accept the commit that changes de README file extension. It make it look pretty nice on GitHub but $ perl Configure.pl will complain about not founding the README file.

Also sorry about the last commit where I renamed 2 functions in just one commit. :)

And to prove that everything went fine:

Test results before my changes:
All tests successful.
Files=360, Tests=12452, 252 wallclock secs ( 5.94 usr 1.35 sys + 161.09 cusr 37.22 csys = 205.60 CPU)
Result: PASS

Tests results after my changes:
All tests successful.
Files=360, Tests=12452, 246 wallclock secs ( 4.54 usr 1.21 sys + 156.12 cusr 28.29 csys = 190.16 CPU)
Result: PASS

@Whiteknight

I have pushed these changes to the global_setup_func_rename branch in the parrot repo for testing, evaluation, and integration. Thanks!

@rurban rurban referenced this pull request from a commit
@rurban rurban Fix a threads race condition with Task_nci_send/Task_invoke
Postpone TASK_recv_block_CLEAR(partner) when another task wants to check
!TASK_in_preempt_TEST(_self)

$ tsan ./parrot t/pmc/task.t
==6406== ThreadSanitizer, a data race detector
1..8
ok 1 - initialized
ok 2 task1 ran
ok 3 task2 ran
ok 4 sub1 ran
==6406== INFO: T2 has been created by T0. Use --announce-threads to see the creation stack.
==6406== INFO: T0 is program's main thread
==6406== WARNING: Possible data race during write of size 8 at 0x43A6218: {{{
==6406==    T0 (L{L31}):
==6406==     #0  Parrot_Task_nci_send /usr/src/parrot/master/src/pmc/task.c:316
==6406==     #1  Parrot_NativePCCMethod_invoke /usr/src/parrot/master/src/pmc/nativepccmethod.c:122
==6406==     #2  Parrot_callmethodcc_p_sc /usr/src/parrot/master/src/ops/core_ops.c:18300
==6406==     #3  runops_fast_core /usr/src/parrot/master/src/runcore/cores.c:499
==6406==     #4  runops_int /usr/src/parrot/master/src/runcore/main.c:220
==6406==     #5  runops /usr/src/parrot/master/src/call/ops.c:123
==6406==     #6  Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:338
==6406==     #7  Parrot_ext_call /usr/src/parrot/master/src/extend.c:158
==6406==     #8  Parrot_Task_invoke /usr/src/parrot/master/src/pmc/task.c:168
==6406==     #9  Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:330
==6406==     #10 Parrot_ext_call /usr/src/parrot/master/src/extend.c:158
==6406==     #11 Parrot_cx_next_task /usr/src/parrot/master/src/scheduler.c:231
==6406==   Concurrent read(s) happened at (OR AFTER) these points:
==6406==    T2 (L{}):
==6406==     #0  Parrot_Task_invoke /usr/src/parrot/master/src/pmc/task.c:175
==6406==     #1  Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:330
==6406==     #2  Parrot_ext_call /usr/src/parrot/master/src/extend.c:158
==6406==     #3  Parrot_cx_next_task /usr/src/parrot/master/src/scheduler.c:231
==6406==     #4  Parrot_thread_outer_runloop /usr/src/parrot/master/src/thread.c:322
==6406==   Location 0x43A6218 is 1544 bytes inside a block starting at 0x43A5C10 of size 4096 allocated by T0 from heap:
==6406==     #0  calloc /mnt/data/build/slave/full_linux_build/build/tsan/ts_valgrind_intercepts.c:444
==6406==     #1  mem_sys_allocate_zeroed /usr/src/parrot/master/src/gc/alloc_memory.c:97
==6406==     #2  allocate_new_pool_arena /usr/src/parrot/master/src/gc/fixed_allocator.c:547
==6406==     #3  pool_allocate /usr/src/parrot/master/src/gc/fixed_allocator.c:448
==6406==     #4  Parrot_gc_pool_allocate /usr/src/parrot/master/src/gc/fixed_allocator.c:344
==6406==     #5  gc_gms_allocate_pmc_header /usr/src/parrot/master/src/gc/gc_gms.c:1490
==6406==     #6  Parrot_gc_new_pmc_header /usr/src/parrot/master/src/gc/api.c:312
==6406==     #7  get_new_pmc_header /usr/src/parrot/master/src/pmc.c:571
==6406==     #8  Parrot_pmc_new_init /usr/src/parrot/master/src/pmc.c:630
==6406==     #9  Parrot_thread_create_proxy /usr/src/parrot/master/src/thread.c:156
==6406==   Locks involved in this report (reporting last lock sites): {L31}
==6406==    L31 (0x42F02A8)
==6406==     #0  pthread_mutex_lock /mnt/data/build/slave/full_linux_build/build/tsan/ts_valgrind_intercepts.c:935
==6406==     #1  Parrot_Task_nci_send /usr/src/parrot/master/src/pmc/task.c:312
==6406==     #2  Parrot_NativePCCMethod_invoke /usr/src/parrot/master/src/pmc/nativepccmethod.c:122
==6406==     #3  Parrot_callmethodcc_p_sc /usr/src/parrot/master/src/ops/core_ops.c:18300
==6406==     #4  runops_fast_core /usr/src/parrot/master/src/runcore/cores.c:499
==6406==     #5  runops_int /usr/src/parrot/master/src/runcore/main.c:220
==6406==     #6  runops /usr/src/parrot/master/src/call/ops.c:123
==6406==     #7  Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:338
==6406==     #8  Parrot_ext_call /usr/src/parrot/master/src/extend.c:158
==6406==     #9  Parrot_Task_invoke /usr/src/parrot/master/src/pmc/task.c:168
==6406==     #10 Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:330
==6406==     #11 Parrot_ext_call /usr/src/parrot/master/src/extend.c:158
==6406==    Race verifier data: 0x5168EC1,0x516785D
==6406== }}}
ok 5 Got message after block
ok 6 Got existing message
ok 7 task_to_kill running
ok 8 task_to_kill killed
==6406==
==6406== ThreadSanitizer summary: reported 1 warning(s) (1 race(s))
792763b
@rurban rurban referenced this pull request from a commit
@rurban rurban Fix a thread race condition in Parrot_alarm_runloop
Racy write with read in Parrot_alarm_check, lock alarm_serial += 1;

$ tsan ./parrot t/pmc/task.t
ok 9 pre-empt and exit
==18766== INFO: T0 is program's main thread
==18766== INFO: T1 has been created by T0. Use --announce-threads to see the creation stack.
==18766== WARNING: Possible data race during write of size 8 at 0x5322580: {{{
==18766==    T1 (L{}):
==18766==     #0  Parrot_alarm_runloop /usr/src/parrot/master/src/alarm.c:129
==18766==   Concurrent read(s) happened at (OR AFTER) these points:
==18766==    T0 (L{}):
==18766==     #0  Parrot_alarm_check /usr/src/parrot/master/src/alarm.c:154
==18766==     #1  Parrot_cx_check_scheduler /usr/src/parrot/master/src/scheduler.c:253
==18766==     #2  Parrot_branch_ic /usr/src/parrot/master/src/ops/core_ops.c:13735
==18766==     #3  runops_fast_core /usr/src/parrot/master/src/runcore/cores.c:499
==18766==     #4  runops_int /usr/src/parrot/master/src/runcore/main.c:220
==18766==     #5  runops /usr/src/parrot/master/src/call/ops.c:123
==18766==     #6  Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:338
==18766==     #7  Parrot_ext_call /usr/src/parrot/master/src/extend.c:158
==18766==     #8  Parrot_Task_invoke /usr/src/parrot/master/src/pmc/task.c:168
==18766==     #9  Parrot_pcc_invoke_from_sig_object /usr/src/parrot/master/src/call/pcc.c:330
==18766==   Address 0x5322580 is 0 bytes inside data symbol "alarm_serial"
==18766==    Race verifier data: 0x4FEC3AE,0x4FEC3FB
==18766== }}}
79e84c9
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
0  README → README.markdown
File renamed without changes
View
4 config/gen/core_pmcs.pm
@@ -111,7 +111,7 @@ END_C
print {$OUT} <<'END_C';
-void Parrot_initialize_core_pmcs(PARROT_INTERP, int pass)
+void Parrot_gbl_initialize_core_pmcs(PARROT_INTERP, int pass)
{
/* first the PMC with the highest enum
* this reduces MMD table resize action */
@@ -131,7 +131,7 @@ static void register_pmc(PARROT_INTERP, ARGIN(PMC *registry), int pmc_id)
}
void
-Parrot_register_core_pmcs(PARROT_INTERP, ARGIN(PMC *registry))
+Parrot_gbl_register_core_pmcs(PARROT_INTERP, ARGIN(PMC *registry))
{
END_C
View
2  docs/embed.pod
@@ -1380,7 +1380,7 @@ The list may also be augmented if additional functionality is required.
=item C<Parrot_secret_snprintf>
-=item C<Parrot_set_config_hash_internal>
+=item C<Parrot_gbl_set_config_hash_internal>
=item C<Parrot_set_context_threshold>
View
12 include/parrot/global_setup.h
@@ -15,18 +15,18 @@
#include "parrot/config.h"
#include "parrot/interpreter.h"
-void Parrot_register_core_pmcs(PARROT_INTERP, ARGIN(PMC *registry))
+void Parrot_gbl_register_core_pmcs(PARROT_INTERP, ARGIN(PMC *registry))
__attribute__nonnull__(1)
__attribute__nonnull__(2);
-void Parrot_initialize_core_pmcs(PARROT_INTERP, int pass)
+void Parrot_gbl_initialize_core_pmcs(PARROT_INTERP, int pass)
__attribute__nonnull__(1);
/* HEADERIZER BEGIN: src/global_setup.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
PARROT_EXPORT
-void Parrot_set_config_hash_internal(
+void Parrot_gbl_set_config_hash_internal(
ARGIN(const unsigned char* parrot_config),
unsigned int parrot_config_size)
__attribute__nonnull__(1);
@@ -34,15 +34,15 @@ void Parrot_set_config_hash_internal(
void init_world(PARROT_INTERP)
__attribute__nonnull__(1);
-void init_world_once(PARROT_INTERP)
+void Parrot_gbl_init_world_once(PARROT_INTERP)
__attribute__nonnull__(1);
-#define ASSERT_ARGS_Parrot_set_config_hash_internal \
+#define ASSERT_ARGS_Parrot_gbl_set_config_hash_internal \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(parrot_config))
#define ASSERT_ARGS_init_world __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_init_world_once __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+#define ASSERT_ARGS_Parrot_gbl_init_world_once __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/global_setup.c */
View
2  src/embed.c
@@ -115,7 +115,7 @@ Parrot_init_stacktop(PARROT_INTERP, ARGIN(void *stack_top))
{
ASSERT_ARGS(Parrot_init_stacktop)
interp->lo_var_ptr = stack_top;
- init_world_once(interp);
+ Parrot_gbl_init_world_once(interp);
}
View
46 src/global_setup.c
@@ -27,8 +27,8 @@ I<What are these global variables?>
/* These functions are defined in the auto-generated file core_pmcs.c */
/* XXX Get it into some public place */
-extern void Parrot_initialize_core_pmcs(PARROT_INTERP, int pass);
-void Parrot_register_core_pmcs(PARROT_INTERP, PMC* registry);
+extern void Parrot_gbl_initialize_core_pmcs(PARROT_INTERP, int pass);
+void Parrot_gbl_register_core_pmcs(PARROT_INTERP, PMC* registry);
static const unsigned char* parrot_config_stored = NULL;
static unsigned int parrot_config_size_stored = 0;
@@ -38,15 +38,15 @@ static unsigned int parrot_config_size_stored = 0;
/* HEADERIZER BEGIN: static */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
-static void parrot_global_setup_2(PARROT_INTERP)
+static void Parrot_gbl_setup_2(PARROT_INTERP)
__attribute__nonnull__(1);
-static void parrot_set_config_hash_interpreter(PARROT_INTERP)
+static void Parrot_gbl_set_config_hash_interpreter(PARROT_INTERP)
__attribute__nonnull__(1);
-#define ASSERT_ARGS_parrot_global_setup_2 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
+#define ASSERT_ARGS_Parrot_gbl_setup_2 __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
-#define ASSERT_ARGS_parrot_set_config_hash_interpreter \
+#define ASSERT_ARGS_Parrot_gbl_set_config_hash_interpreter \
__attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
@@ -55,7 +55,7 @@ static void parrot_set_config_hash_interpreter(PARROT_INTERP)
/*
-=item C<void Parrot_set_config_hash_internal(const unsigned char* parrot_config,
+=item C<void Parrot_gbl_set_config_hash_internal(const unsigned char* parrot_config,
unsigned int parrot_config_size)>
Called by Parrot_set_config_hash with the serialised hash which
@@ -67,17 +67,17 @@ will be used in subsequently created Interpreters.
PARROT_EXPORT
void
-Parrot_set_config_hash_internal(ARGIN(const unsigned char* parrot_config),
+Parrot_gbl_set_config_hash_internal(ARGIN(const unsigned char* parrot_config),
unsigned int parrot_config_size)
{
- ASSERT_ARGS(Parrot_set_config_hash_internal)
+ ASSERT_ARGS(Parrot_gbl_set_config_hash_internal)
parrot_config_stored = parrot_config;
parrot_config_size_stored = parrot_config_size;
}
/*
-=item C<static void parrot_set_config_hash_interpreter(PARROT_INTERP)>
+=item C<static void Parrot_gbl_set_config_hash_interpreter(PARROT_INTERP)>
Used internally to associate the config hash with an Interpreter
using the last registered config data.
@@ -87,9 +87,9 @@ using the last registered config data.
*/
static void
-parrot_set_config_hash_interpreter(PARROT_INTERP)
+Parrot_gbl_set_config_hash_interpreter(PARROT_INTERP)
{
- ASSERT_ARGS(parrot_set_config_hash_interpreter)
+ ASSERT_ARGS(Parrot_gbl_set_config_hash_interpreter)
PMC *iglobals = interp->iglobals;
PMC *config_hash = NULL;
@@ -113,7 +113,7 @@ parrot_set_config_hash_interpreter(PARROT_INTERP)
/*
-=item C<void init_world_once(PARROT_INTERP)>
+=item C<void Parrot_gbl_init_world_once(PARROT_INTERP)>
Call init_world() if it hasn't been called before.
@@ -124,9 +124,9 @@ C<interp> should be the root interpreter created in C<Parrot_new(NULL)>.
*/
void
-init_world_once(PARROT_INTERP)
+Parrot_gbl_init_world_once(PARROT_INTERP)
{
- ASSERT_ARGS(init_world_once)
+ ASSERT_ARGS(Parrot_gbl_init_world_once)
if (!interp->world_inited) {
/* init_world() sets up some vtable stuff.
* It must only be called once.
@@ -142,7 +142,7 @@ init_world_once(PARROT_INTERP)
=item C<void init_world(PARROT_INTERP)>
-This is the actual initialization code called by C<init_world_once()>.
+This is the actual initialization code called by C<Parrot_gbl_init_world_once()>.
It sets up the Parrot system, running any platform-specific init code if
necessary, then initializing the string subsystem, and setting up the
@@ -165,8 +165,8 @@ init_world(PARROT_INTERP)
#endif
/* Call base vtable class constructor methods */
- parrot_global_setup_2(interp);
- Parrot_initialize_core_pmcs(interp, 1);
+ Parrot_gbl_setup_2(interp);
+ Parrot_gbl_initialize_core_pmcs(interp, 1);
iglobals = interp->iglobals;
VTABLE_set_pmc_keyed_int(interp, iglobals,
@@ -179,7 +179,7 @@ init_world(PARROT_INTERP)
VTABLE_set_pmc_keyed_int(interp, iglobals,
(INTVAL)IGLOBALS_INTERPRETER, self);
- parrot_set_config_hash_interpreter(interp);
+ Parrot_gbl_set_config_hash_interpreter(interp);
/* lib search paths */
parrot_init_library_paths(interp);
@@ -206,7 +206,7 @@ init_world(PARROT_INTERP)
/*
-=item C<static void parrot_global_setup_2(PARROT_INTERP)>
+=item C<static void Parrot_gbl_setup_2(PARROT_INTERP)>
called from inmidst of PMC bootstrapping between pass 0 and 1
@@ -215,9 +215,9 @@ called from inmidst of PMC bootstrapping between pass 0 and 1
*/
static void
-parrot_global_setup_2(PARROT_INTERP)
+Parrot_gbl_setup_2(PARROT_INTERP)
{
- ASSERT_ARGS(parrot_global_setup_2)
+ ASSERT_ARGS(Parrot_gbl_setup_2)
PMC *classname_hash;
create_initial_context(interp);
@@ -242,7 +242,7 @@ parrot_global_setup_2(PARROT_INTERP)
/* We need a class hash */
interp->class_hash = classname_hash = Parrot_pmc_new(interp, enum_class_NameSpace);
- Parrot_register_core_pmcs(interp, classname_hash);
+ Parrot_gbl_register_core_pmcs(interp, classname_hash);
/* init the interpreter globals array */
interp->iglobals = Parrot_pmc_new_init_int(interp,
View
2  src/interp/inter_create.c
@@ -221,7 +221,7 @@ initialize_interpreter(PARROT_INTERP, ARGIN(void *stacktop))
/* create the root set registry */
interp->gc_registry = Parrot_pmc_new(interp, enum_class_AddrRegistry);
- init_world_once(interp);
+ Parrot_gbl_init_world_once(interp);
/* context data */
if (is_env_var_set(interp, CONST_STRING(interp, "PARROT_GC_DEBUG"))) {
View
4 src/vtables.c
@@ -21,7 +21,7 @@ Functions to build and manipulate vtables
/* This function is defined in the auto-generated file core_pmcs.c */
/* XXX Get it into some public place */
-extern void Parrot_initialize_core_pmcs(PARROT_INTERP, int pass);
+extern void Parrot_gbl_initialize_core_pmcs(PARROT_INTERP, int pass);
/* HEADERIZER HFILE: include/parrot/vtables.h */
@@ -239,7 +239,7 @@ Parrot_vtbl_initialize_core_vtables(PARROT_INTERP)
if (! interp->vtables) {
Parrot_vtbl_alloc_vtables(interp);
- Parrot_initialize_core_pmcs(interp, 0);
+ Parrot_gbl_initialize_core_pmcs(interp, 0);
}
}
View
4 tools/build/parrot_config_c.pl
@@ -49,7 +49,7 @@ =head1 DESCRIPTION
void Parrot_set_config_hash(void);
void
-Parrot_set_config_hash_internal (const unsigned char* parrot_config,
+Parrot_gbl_set_config_hash_internal (const unsigned char* parrot_config,
unsigned int parrot_config_size);
@@ -89,7 +89,7 @@ =head1 DESCRIPTION
void
Parrot_set_config_hash(void)
{
- Parrot_set_config_hash_internal(parrot_config, sizeof(parrot_config));
+ Parrot_gbl_set_config_hash_internal(parrot_config, sizeof(parrot_config));
}
EOF
Something went wrong with that request. Please try again.