• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2019 Google LLC
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package io.perfmark.java9;
18 
19 import io.perfmark.impl.Generator;
20 import io.perfmark.impl.MarkHolder;
21 import io.perfmark.impl.MarkHolderProvider;
22 
23 final class SecretVarHandleMarkHolderProvider {
24 
25   public static final class VarHandleMarkHolderProvider extends MarkHolderProvider {
26 
VarHandleMarkHolderProvider()27     public VarHandleMarkHolderProvider() {
28       // Do some basic operations to see if it works.
29       MarkHolder holder = create(12345);
30       holder.start(1 << Generator.GEN_OFFSET, "bogus", 0);
31       holder.stop(1 << Generator.GEN_OFFSET, "bogus", 0);
32       int size = holder.read(false).size();
33       if (size != 2) {
34         throw new AssertionError("Wrong size " + size);
35       }
36     }
37 
38     @Override
39     @SuppressWarnings("deprecation")
create()40     public MarkHolder create() {
41       return new VarHandleMarkHolder();
42     }
43 
44     @Override
create(long markHolderId)45     public MarkHolder create(long markHolderId) {
46       return new VarHandleMarkHolder();
47     }
48   }
49 
SecretVarHandleMarkHolderProvider()50   private SecretVarHandleMarkHolderProvider() {
51     throw new AssertionError("nope");
52   }
53 }
54