source: rtems/cpukit/score/src/objectgetnoprotection.c @ 1c2d178

5
Last change on this file since 1c2d178 was 3899bc1a, checked in by Sebastian Huber <sebastian.huber@…>, on 11/24/18 at 10:51:28

score: Optimize object lookup

Use the maximum ID for the ID to object translation. Using the maximum
ID gets rid of an additional load from the object information in
_Objects_Get(). In addition, object lookups fail for every ID in case
the object information is cleared to zero. This makes it a bit more
robust during system startup (see new tests in spconfig02).

The local table no longer needs a NULL pointer entry at array index
zero. Adjust all the object iteration loops accordingly.

Remove Objects_Information::minimum_id since it contains only redundant
information. Add _Objects_Get_minimum_id() to get the minimum ID.

Update #3621.

  • Property mode set to 100644
File size: 995 bytes
Line 
1/**
2 *  @file
3 *
4 *  @brief  Get Object without Dispatching Protection
5 *  @ingroup ScoreObject
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2002.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  The license and distribution terms for this file may be
13 *  found in the file LICENSE in this distribution or at
14 *  http://www.rtems.org/license/LICENSE.
15 */
16
17#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/objectimpl.h>
22
23Objects_Control *_Objects_Get_no_protection(
24  Objects_Id                 id,
25  const Objects_Information *information
26)
27{
28  Objects_Id delta;
29  Objects_Id maximum_id;
30  Objects_Id end;
31
32  maximum_id = information->maximum_id;
33  delta = maximum_id - id;
34  end = _Objects_Get_index( maximum_id );
35
36  if ( RTEMS_PREDICT_TRUE( delta < end ) ) {
37    return information->local_table[ end - OBJECTS_INDEX_MINIMUM - delta ];
38  }
39
40  /*
41   *  This isn't supported or required yet for Global objects so
42   *  if it isn't local, we don't find it.
43   */
44  return NULL;
45}
Note: See TracBrowser for help on using the repository browser.