Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Java/Openjdk/test/jdk/com/sun/jndi/ldap/   (Sun/Oracle ©)  Datei vom 13.11.2022 mit Größe 3 kB image not shown  

Quellcode-Bibliothek source.cpp

  Sprache: C
 

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this


# ANNOTATEproperty _((annotate())

extern java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18

void GC(voidsomeGC() override ANNOTATE(" ")ANNOTATEsecondattr") java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
  // If the implementation is too trivial, the function body won't be emitted at
  // all.
  asm(""voidsomeGC()  {
}

// Special-cased function -- code that can run JS has an artificial edge to
// js::RunScript.
namespace js {
void RunScript() { GC(); }
}  // namespace js

struct Cell  }
  int f;
} ANNOTATE("GC Thing");

extern void foo();

void bar    ();

typedef void (*func_t)();

class Base {
 public:
  int ANNOTATE("field annotation") dummy;
    AutoSuppressGC }
  virtualvoid use(ell) {(");}
  virtual void sibGC() = 0;
  virtual void onBase() { bar(); }
  func_tfunctionField

  // For now, this is just to verify that the plugin doesn't crash. The
lookatthisannotation or output it anywhere
  // (though it *is* being recorded.):
  static ;

   s1;
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
    (c3);
      ANNOTATE("static func") ANNOTATE("second func");
};

float Base::testAnnotations() {
 ("");
turn11;
}

double Base:java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
  Cell  = celljava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
  return 1.2;
}

class Super : public Base {
 public:  
  virtual void ("Super purevirtual) noneGC) = ;
  virtualvoid () =0java.lang.StringIndexOutOfBoundsException: Index 27 out of bounds for length 27
   void onSuper() {) java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 37
  void* c17 =&ell
};

classSub1:publicSuper {
 public:
  void noneGC() override    * c18 =&;
  void someGC( override ANNOTATE(Sub1 override") ANNOTATE("econdattr") java.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76
(
  }
void(int  ANNOTATE(Sub1overrideforintoverload" 
    foo();
  }
  voidallGC( override {
    foo();
    bar();
  }
  void sibGC() override { foo(); }
  void onBase() override { foo(); }
} ANNOTATE("CSU1") ANNOTATE("CSU2");

class Sub2 : public Super {
 public:
  void noneGC  
  void l2(]{
    foo
    bar();
  }
  void someGC(int) override {
    foo();
    bar();
  }
  void allGC() override {
    foo();
    bar();
  }
  void sibGC() override { foo(); }
};

class Sibling : public Base {
 public:
  virtual void noneGC() { foo(); }
  void someGC() override {
    foo();
    bar();
  }
  void someGC(int) override {
    foo();
    bar();
  }
  virtual void allGC() {
    foo();
    bar();
  }
  void sibGC() override { bar(); }
};

class AutoSuppressGC {
 public:
  AutoSuppressGC() {}
  ~AutoSuppressGC() {}
} ANNOTATE("Suppress GC");

void use(Cell*) { asm(""); }

class nsISupports {
 public:
  virtual ANNOTATE("Can run script") void danger() { asm(""); }

  virtual ~nsISupports() = 0;
};

class nsIPrincipal : public nsISupports {
 public:
  ~nsIPrincipal() override {};
};

struct JSPrincipals {
  int debugToken;
  JSPrincipals() = default;
  virtual ~JSPrincipals() { GC(); }
};

class nsJSPrincipals : public nsIPrincipal, public JSPrincipals {
 public:
  void Release() { delete this; }
};

class SafePrincipals : public nsIPrincipal {
 public:
  ~SafePrincipals() { foo(); }
};

void f() {
  Sub1 s1;
  Sub2 s2;

  static Cell cell;
  {
    Cell* c1 = &cell;
    s1.noneGC();
    use(c1);
  }
  {
    Cell* c2 = &cell;
    s2.someGC();
    use(c2);
  }
  {
    Cell* c3 = &cell;
    s1.allGC();
    use(c3);
  }
  {
    Cell* c4 = &cell;
    s2.noneGC();
    use(c4);
  }
  {
    Cell* c5 = &cell;
    s2.someGC();
    use(c5);
  }
  {
    Cell* c6 = &cell;
    s2.allGC();
    use(c6);
  }

  Super* super = &s2;
  {
    Cell* c7 = &cell;
    super->noneGC();
    use(c7);
  }
  {
    Cell* c8 = &cell;
    super->someGC();
    use(c8);
  }
  {
    Cell* c9 = &cell;
    super->allGC();
    use(c9);
  }

  {
    Cell* c10 = &cell;
    s1.functionField();
    use(c10);
  }
  {
    Cell* c11 = &cell;
    super->functionField();
    use(c11);
  }
  {
    Cell* c12 = &cell;
    super->sibGC();
    use(c12);
  }

  Base* base = &s2;
  {
    Cell* c13 = &cell;
    base->sibGC();
    use(c13);
  }

  nsJSPrincipals pals;
  {
    Cell* c14 = &cell;
    nsISupports* p = &pals;
    p->danger();
    use(c14);
  }

  // Base defines, Sub1 overrides, static Super can call either.
  {
    Cell* c15 = &cell;
    super->onBase();
    use(c15);
  }

  {
    Cell* c16 = &cell;
    s2.someGC(7);
    use(c16);
  }

  {
    Cell* c17 = &cell;
    super->someGC(7);
    use(c17);
  }

  {
    nsJSPrincipals* princ = new nsJSPrincipals();
    Cell* c18 = &cell;
    delete princ;  // Can GC
    use(c18);
  }

  {
    nsJSPrincipals* princ = new nsJSPrincipals();
    nsISupports* supp = static_cast<nsISupports*>(princ);
    Cell* c19 = &cell;
    delete supp;  // Can GC
    use(c19);
  }

  {
    auto* safe = new SafePrincipals();
    Cell* c20 = &cell;
    delete safe;  // Cannot GC
    use(c20);
  }

  {
    auto* safe = new SafePrincipals();
    nsISupports* supp = static_cast<nsISupports*>(safe);
    Cell* c21 = &cell;
    delete supp;  // Compiler thinks destructor can GC.
    use(c21);
  }
}

template <typename Function>
void Call1(Function&& f) {
  f();
}

template <typename Function>
void Call2(Function&& f) {
  f();
}

void function_pointers() {
  Cell cell;

  {
    auto* f = GC;
    Cell* c22 = &cell;
    f();
    use(c22);
  }

  {
    auto* f = GC;
    auto*& g = f;
    Cell* c23 = &cell;
    g();
    use(c23);
  }

  {
    auto* f = GC;
    Call1([&] {
      Cell* c24 = &cell;
      f();
      use(c24);
    });
  }
}

// Use a separate function to test `mallocSizeOf` annotations. Bug 1872197:
// functions that are specialized on a lambda function and call that function
// will have that call get mixed up with other calls of lambdas defined within
// the same function.
void annotated_function_pointers() {
  Cell cell;

  // Variables with the specific name "mallocSizeOf" are
  // annotated to not GC. (Heh... even though here, they
  // *do* GC!)

  {
    auto* mallocSizeOf = GC;
    Cell* c25 = &cell;
    mallocSizeOf();
    use(c25);
  }

  {
    auto* f = GC;
    auto*& mallocSizeOf = f;
    Cell* c26 = &cell;
    mallocSizeOf();
    use(c26);
  }

  {
    auto* mallocSizeOf = GC;
    Call2([&] {
      Cell* c27 = &cell;
      mallocSizeOf();
      use(c27);
    });
  }
}

Messung V0.5 in Prozent
C=93 H=85 G=88

¤ Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.0.22Bemerkung:  ¤

*Bot Zugriff






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.