typedef unsigned long uint32_t;

/* memory and peripheral start addresses */
#define FLASH_BASE      0x08000000
#define SRAM_BASE       0x20000000
#define PERIPH_BASE     0x40000000

/* Work out end of RAM address as initial stack pointer */
#define SRAM_SIZE       16*1024     // STM32F072RB has 16 KB of RAM
#define SRAM_END        (SRAM_BASE + SRAM_SIZE)

/* RCC peripheral addresses applicable to GPIOA */
#define RCC_BASE        (PERIPH_BASE + 0x21000)
#define RCC_AHBENR      ((uint32_t*)(RCC_BASE + (0x14)))

/* GPIOA peripheral addresses */
#define GPIOA_BASE      (PERIPH_BASE + 0x8000000)
#define GPIOA_MODER     ((uint32_t*)(GPIOA_BASE + 0x00))
#define GPIOA_ODR       ((uint32_t*)(GPIOA_BASE + 0x14))

/* User functions */
void _start (void);
int main(void);
void delay(uint32_t count);

/* Minimal vector table */
uint32_t *vector_table[] __attribute__((section(".isr_vector"))) = {
    (uint32_t *)SRAM_END,   // initial stack pointer
    (uint32_t *)_start        // main as Reset_Handler
};

// Begin address for the initialisation values of the .data section.
// defined in linker script
extern uint32_t _sidata;
// Begin address for the .data section; defined in linker script
extern uint32_t _sdata;
// End address for the .data section; defined in linker script
extern uint32_t _edata;

volatile uint32_t dataVar = 0x3f;

inline void
__attribute__((always_inline))
__initialize_data (uint32_t* from, uint32_t* region_begin, uint32_t* region_end)
{
  // Iterate and copy word by word.
  // It is assumed that the pointers are word aligned.
  uint32_t*p = region_begin;
  while (p < region_end)
    *p++ = *from++;
}

void __attribute__ ((noreturn,weak))
_start (void)
{
	__initialize_data(&_sidata, &_sdata, &_edata);
	main();

	for(;;);
}

int main() {
  /* enable clock on GPIOA peripheral */
  *RCC_AHBENR |= 0x1 << 17;
  *GPIOA_MODER |= 0x400; // Sets MODER[27:26] = 0x1

  while(dataVar == 0x3f) {
    *GPIOA_ODR = 0x20;
    delay(1000000);
    *GPIOA_ODR = 0x0;
    delay(1000000);
  }
}

void delay(unsigned long count) {
    while(count--);
}

{'repo_name': 'cnoviello/mastering-stm32', 'stars': '216', 'repo_language': 'C', 'file_name': '_reset_hardware.c', 'mime_type': 'text/x-c', 'hash': -5947578280038463533, 'source_dataset': 'data'}


package fredboat.testutil.util

import com.sedmelluq.discord.lavaplayer.player.AudioLoadResultHandler
import com.sedmelluq.discord.lavaplayer.tools.FriendlyException
import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist
import com.sedmelluq.discord.lavaplayer.track.AudioTrack
import fredboat.audio.player.GuildPlayer
import fredboat.audio.queue.AudioTrackContext
import fredboat.main.Launcher
import fredboat.sentinel.Guild
import fredboat.sentinel.InternalVoiceChannel
import fredboat.sentinel.Member
import fredboat.testutil.sentinel.Raws
import fredboat.testutil.sentinel.SentinelState
import fredboat.testutil.sentinel.guildCache
import java.time.Duration
import java.util.concurrent.TimeUnit

private val loadedTracks = mutableMapOf<String, AudioTrack>()

fun Guild.queue(
        identifier: String,
        member: Member = getMember(Raws.owner.id)!!
): GuildPlayer {
    val player = Launcher.botController.playerRegistry.getOrCreate(this)
    val track = loadedTracks.getOrPut(identifier) {
        val loader = TestAudioLoader()
        Launcher.botController.playerRegistry.audioPlayerManager.loadItem(identifier, loader)
                .get(10, TimeUnit.SECONDS)
        loader.loaded
    }.makeClone()

    if (member.voiceChannel == null) {
        (getVoiceChannel(Raws.musicChannel.id)!! as InternalVoiceChannel).handleVoiceJoin(member)
        SentinelState.joinChannel(Raws.owner)
    }

    player.queue(AudioTrackContext(track, member))
    return player
}

private class TestAudioLoader : AudioLoadResultHandler {
    lateinit var loaded: AudioTrack

    override fun loadFailed(exception: FriendlyException) = throw exception
    override fun trackLoaded(track: AudioTrack) {loaded = track}
    override fun noMatches() = throw IllegalStateException("No matches")
    override fun playlistLoaded(playlist: AudioPlaylist) {TODO()}
}

val cachedGuild get() = guildCache.get(Raws.guild.id).block(Duration.ofSeconds(5))!!

{'repo_name': 'Frederikam/FredBoat', 'stars': '435', 'repo_language': 'Kotlin', 'file_name': 'dbl.html', 'mime_type': 'text/html', 'hash': -1375814040752687678, 'source_dataset': 'data'}


/*
 * Copyright (c) 2020 Huawei Technologies Co.,Ltd.
 *
 * openGauss is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 *
 *          http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 * -------------------------------------------------------------------------
 *
 * bbox_lib.h
 *
 * IDENTIFICATION
 *    src/gausskernel/cbb/bbox/bbox_lib.h
 *
 * -------------------------------------------------------------------------
 */

#ifndef __BBOX_LIB_H_
#define __BBOX_LIB_H_

#include "bbox_types.h"

#define BBOX_PATH_LEN 256

extern s32 bbox_get_exec_path(pid_t pid, char* buff, int buff_len);

extern s32 bbox_skip_atoi(const char* pszString);

extern char* bbox_strncat(char* pszDest, const char* pszSrc, s32 count);

extern s32 bbox_strlen(const char* pszString);

extern s32 bbox_strnlen(const char* pszString, s32 count);

extern s32 bbox_strncmp(const char* pszSrc, const char* pszTarget, s32 count);

extern s32 bbox_strcmp(const char* pszSrc, const char* pszTarget);

extern s32 bbox_memcmp(const void* cs, const void* ct, s32 count);

extern char* bbox_strstr(const char* s1, const char* s2);

extern s32 bbox_atoi(const char* pszString);

extern s32 sys_popen(char* command, const char* mode);

extern s32 sys_pclose(s32 fd);

extern s32 bbox_mkdir(const char* pszDir);

extern long bbox_pread(s32 fd, void* buf, unsigned long count, unsigned long offset);

typedef s32 (*BBOX_LIST_DIR_CALLBACK)(const char* pszPath, const char* pszName, void* pArgs);
extern s32 bbox_listdir(const char* pstPath, BBOX_LIST_DIR_CALLBACK callback, void* pArgs);

#endif

{'repo_name': 'opengauss-mirror/openGauss-server', 'stars': '130', 'repo_language': 'C++', 'file_name': 'cluster_1m0s_config.xml', 'mime_type': 'text/xml', 'hash': 8618480500801873240, 'source_dataset': 'data'}


Vue.component('camera-ir-mlx90640', {
    template: '#tmpl-camera-ir-mlx90640',
    mixins: [cameraMixin],

    methods: {
        startStreaming: function() {
            this._startStreaming('ir.mlx90640');
        },

        capture: function() {
            this._capture('ir.mlx90640');
        },
    },

    mounted: function() {
        this.attrs.resolution = [32, 24];
    }
});

{'repo_name': 'BlackLight/platypush', 'stars': '109', 'repo_language': 'Python', 'file_name': 'scheduler.py', 'mime_type': 'text/x-python', 'hash': -1204987262574472026, 'source_dataset': 'data'}


TIMESTAMP = 1588440071
SHA256 (lxqt/qterminal-0.15.0.tar.xz) = 557f74a946d009bb6e598c5d0c6de9356cda325f674876a457874c7525affd64
SIZE (lxqt/qterminal-0.15.0.tar.xz) = 179608

{'repo_name': 'pfsense/FreeBSD-ports', 'stars': '255', 'repo_language': 'None', 'file_name': 'distinfo', 'mime_type': 'text/plain', 'hash': -1107125970948703791, 'source_dataset': 'data'}


/*
 * This file is part of OpenCorsairLink.
 * Copyright (C) 2017-2020  Sean Nelson <audiohacked@gmail.com>

 * OpenCorsairLink is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * any later version.

 * OpenCorsairLink is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with OpenCorsairLink.  If not, see <http://www.gnu.org/licenses/>.
 */

#include "lowlevel/commanderpro.h"

#include <libusb.h>
#include <stdio.h>

#define TIMEOUT_DEFAULT 1000 /*!< TIMEOUT_DEFAULT */

int
corsairlink_commanderpro_init( struct libusb_device_handle* dev_handle, uint8_t endpoint )
{
    return 0;
}

int
corsairlink_commanderpro_deinit( struct libusb_device_handle* dev_handle, uint8_t endpoint )
{
    return 0;
}

int
corsairlink_commanderpro_write(
    struct libusb_device_handle* dev_handle, uint8_t endpoint, uint8_t* data, int length )
{
    int bytes_transferred;
    int rr;

    rr = libusb_interrupt_transfer(
        dev_handle, endpoint, data, length, &bytes_transferred, TIMEOUT_DEFAULT );

    return rr;
}

int
corsairlink_commanderpro_read(
    struct libusb_device_handle* dev_handle, uint8_t endpoint, uint8_t* data, int length )
{
    int bytes_transferred;
    int rr;

    rr = libusb_interrupt_transfer(
        dev_handle, endpoint, data, length, &bytes_transferred, TIMEOUT_DEFAULT );

    return rr;
}

{'repo_name': 'audiohacked/OpenCorsairLink', 'stars': '613', 'repo_language': 'C', 'file_name': 'DefineCMakeDefaults.cmake', 'mime_type': 'text/plain', 'hash': 4212410752640783330, 'source_dataset': 'data'}


# *****************************************************************
#
#               The Compcert verified compiler
#
#           Xavier Leroy, INRIA Paris-Rocquencourt
#
# Copyright (c) 2013 Institut National de Recherche en Informatique et
#  en Automatique.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#     * Redistributions of source code must retain the above copyright
#       notice, this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above copyright
#       notice, this list of conditions and the following disclaimer in the
#       documentation and/or other materials provided with the distribution.
#     * Neither the name of the <organization> nor the
#       names of its contributors may be used to endorse or promote products
#       derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT
# HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# *********************************************************************

# Helper functions for 64-bit integer arithmetic.  PowerPC version.

        .text

### Unsigned modulus

        .balign 16
        .globl __compcert_i64_umod
__compcert_i64_umod:
        b __compcert_i64_udivmod
        .type __compcert_i64_umod, @function
        .size __compcert_i64_umod, .-__compcert_i64_umod

{'repo_name': 'princeton-vl/CoqGym', 'stars': '160', 'repo_language': 'Coq', 'file_name': 'term.html', 'mime_type': 'text/html', 'hash': -7490086177417554784, 'source_dataset': 'data'}


/*
 *
 * Copyright 2016 gRPC authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */

//go:generate protoc --go_out=plugins=grpc:. grpc_testing/test.proto

// Package stats is for collecting and reporting various network and RPC stats.
// This package is for monitoring purpose only. All fields are read-only.
// All APIs are experimental.
package stats // import "google.golang.org/grpc/stats"

import (
	"net"
	"time"

	"golang.org/x/net/context"
)

// RPCStats contains stats information about RPCs.
type RPCStats interface {
	isRPCStats()
	// IsClient returns true if this RPCStats is from client side.
	IsClient() bool
}

// Begin contains stats when an RPC begins.
// FailFast is only valid if this Begin is from client side.
type Begin struct {
	// Client is true if this Begin is from client side.
	Client bool
	// BeginTime is the time when the RPC begins.
	BeginTime time.Time
	// FailFast indicates if this RPC is failfast.
	FailFast bool
}

// IsClient indicates if the stats information is from client side.
func (s *Begin) IsClient() bool { return s.Client }

func (s *Begin) isRPCStats() {}

// InPayload contains the information for an incoming payload.
type InPayload struct {
	// Client is true if this InPayload is from client side.
	Client bool
	// Payload is the payload with original type.
	Payload interface{}
	// Data is the serialized message payload.
	Data []byte
	// Length is the length of uncompressed data.
	Length int
	// WireLength is the length of data on wire (compressed, signed, encrypted).
	WireLength int
	// RecvTime is the time when the payload is received.
	RecvTime time.Time
}

// IsClient indicates if the stats information is from client side.
func (s *InPayload) IsClient() bool { return s.Client }

func (s *InPayload) isRPCStats() {}

// InHeader contains stats when a header is received.
type InHeader struct {
	// Client is true if this InHeader is from client side.
	Client bool
	// WireLength is the wire length of header.
	WireLength int

	// The following fields are valid only if Client is false.
	// FullMethod is the full RPC method string, i.e., /package.service/method.
	FullMethod string
	// RemoteAddr is the remote address of the corresponding connection.
	RemoteAddr net.Addr
	// LocalAddr is the local address of the corresponding connection.
	LocalAddr net.Addr
	// Compression is the compression algorithm used for the RPC.
	Compression string
}

// IsClient indicates if the stats information is from client side.
func (s *InHeader) IsClient() bool { return s.Client }

func (s *InHeader) isRPCStats() {}

// InTrailer contains stats when a trailer is received.
type InTrailer struct {
	// Client is true if this InTrailer is from client side.
	Client bool
	// WireLength is the wire length of trailer.
	WireLength int
}

// IsClient indicates if the stats information is from client side.
func (s *InTrailer) IsClient() bool { return s.Client }

func (s *InTrailer) isRPCStats() {}

// OutPayload contains the information for an outgoing payload.
type OutPayload struct {
	// Client is true if this OutPayload is from client side.
	Client bool
	// Payload is the payload with original type.
	Payload interface{}
	// Data is the serialized message payload.
	Data []byte
	// Length is the length of uncompressed data.
	Length int
	// WireLength is the length of data on wire (compressed, signed, encrypted).
	WireLength int
	// SentTime is the time when the payload is sent.
	SentTime time.Time
}

// IsClient indicates if this stats information is from client side.
func (s *OutPayload) IsClient() bool { return s.Client }

func (s *OutPayload) isRPCStats() {}

// OutHeader contains stats when a header is sent.
type OutHeader struct {
	// Client is true if this OutHeader is from client side.
	Client bool

	// The following fields are valid only if Client is true.
	// FullMethod is the full RPC method string, i.e., /package.service/method.
	FullMethod string
	// RemoteAddr is the remote address of the corresponding connection.
	RemoteAddr net.Addr
	// LocalAddr is the local address of the corresponding connection.
	LocalAddr net.Addr
	// Compression is the compression algorithm used for the RPC.
	Compression string
}

// IsClient indicates if this stats information is from client side.
func (s *OutHeader) IsClient() bool { return s.Client }

func (s *OutHeader) isRPCStats() {}

// OutTrailer contains stats when a trailer is sent.
type OutTrailer struct {
	// Client is true if this OutTrailer is from client side.
	Client bool
	// WireLength is the wire length of trailer.
	WireLength int
}

// IsClient indicates if this stats information is from client side.
func (s *OutTrailer) IsClient() bool { return s.Client }

func (s *OutTrailer) isRPCStats() {}

// End contains stats when an RPC ends.
type End struct {
	// Client is true if this End is from client side.
	Client bool
	// EndTime is the time when the RPC ends.
	EndTime time.Time
	// Error is the error the RPC ended with. It is an error generated from
	// status.Status and can be converted back to status.Status using
	// status.FromError if non-nil.
	Error error
}

// IsClient indicates if this is from client side.
func (s *End) IsClient() bool { return s.Client }

func (s *End) isRPCStats() {}

// ConnStats contains stats information about connections.
type ConnStats interface {
	isConnStats()
	// IsClient returns true if this ConnStats is from client side.
	IsClient() bool
}

// ConnBegin contains the stats of a connection when it is established.
type ConnBegin struct {
	// Client is true if this ConnBegin is from client side.
	Client bool
}

// IsClient indicates if this is from client side.
func (s *ConnBegin) IsClient() bool { return s.Client }

func (s *ConnBegin) isConnStats() {}

// ConnEnd contains the stats of a connection when it ends.
type ConnEnd struct {
	// Client is true if this ConnEnd is from client side.
	Client bool
}

// IsClient indicates if this is from client side.
func (s *ConnEnd) IsClient() bool { return s.Client }

func (s *ConnEnd) isConnStats() {}

type incomingTagsKey struct{}
type outgoingTagsKey struct{}

// SetTags attaches stats tagging data to the context, which will be sent in
// the outgoing RPC with the header grpc-tags-bin.  Subsequent calls to
// SetTags will overwrite the values from earlier calls.
//
// NOTE: this is provided only for backward compatibility with existing clients
// and will likely be removed in an upcoming release.  New uses should transmit
// this type of data using metadata with a different, non-reserved (i.e. does
// not begin with "grpc-") header name.
func SetTags(ctx context.Context, b []byte) context.Context {
	return context.WithValue(ctx, outgoingTagsKey{}, b)
}

// Tags returns the tags from the context for the inbound RPC.
//
// NOTE: this is provided only for backward compatibility with existing clients
// and will likely be removed in an upcoming release.  New uses should transmit
// this type of data using metadata with a different, non-reserved (i.e. does
// not begin with "grpc-") header name.
func Tags(ctx context.Context) []byte {
	b, _ := ctx.Value(incomingTagsKey{}).([]byte)
	return b
}

// SetIncomingTags attaches stats tagging data to the context, to be read by
// the application (not sent in outgoing RPCs).
//
// This is intended for gRPC-internal use ONLY.
func SetIncomingTags(ctx context.Context, b []byte) context.Context {
	return context.WithValue(ctx, incomingTagsKey{}, b)
}

// OutgoingTags returns the tags from the context for the outbound RPC.
//
// This is intended for gRPC-internal use ONLY.
func OutgoingTags(ctx context.Context) []byte {
	b, _ := ctx.Value(outgoingTagsKey{}).([]byte)
	return b
}

type incomingTraceKey struct{}
type outgoingTraceKey struct{}

// SetTrace attaches stats tagging data to the context, which will be sent in
// the outgoing RPC with the header grpc-trace-bin.  Subsequent calls to
// SetTrace will overwrite the values from earlier calls.
//
// NOTE: this is provided only for backward compatibility with existing clients
// and will likely be removed in an upcoming release.  New uses should transmit
// this type of data using metadata with a different, non-reserved (i.e. does
// not begin with "grpc-") header name.
func SetTrace(ctx context.Context, b []byte) context.Context {
	return context.WithValue(ctx, outgoingTraceKey{}, b)
}

// Trace returns the trace from the context for the inbound RPC.
//
// NOTE: this is provided only for backward compatibility with existing clients
// and will likely be removed in an upcoming release.  New uses should transmit
// this type of data using metadata with a different, non-reserved (i.e. does
// not begin with "grpc-") header name.
func Trace(ctx context.Context) []byte {
	b, _ := ctx.Value(incomingTraceKey{}).([]byte)
	return b
}

// SetIncomingTrace attaches stats tagging data to the context, to be read by
// the application (not sent in outgoing RPCs).  It is intended for
// gRPC-internal use.
func SetIncomingTrace(ctx context.Context, b []byte) context.Context {
	return context.WithValue(ctx, incomingTraceKey{}, b)
}

// OutgoingTrace returns the trace from the context for the outbound RPC.  It is
// intended for gRPC-internal use.
func OutgoingTrace(ctx context.Context) []byte {
	b, _ := ctx.Value(outgoingTraceKey{}).([]byte)
	return b
}

{'repo_name': 'oracle/speedle', 'stars': '148', 'repo_language': 'Go', 'file_name': 'main.go', 'mime_type': 'text/x-c', 'hash': 770307353897149644, 'source_dataset': 'data'}


RoleBinding references a role, but does not contain it.  It can reference a Role in the same namespace or a ClusterRole in the global namespace. It adds who information via Subjects and namespace information by which namespace it exists in.  RoleBindings in a given namespace only have effect in that namespace.

APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources

Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds

Standard object's metadata.

RoleRef can reference a Role in the current namespace or a ClusterRole in the global namespace. If the RoleRef cannot be resolved, the Authorizer must return an error.

Subjects holds references to the objects the role applies to.

{'repo_name': 'garethr/kubernetes-json-schema', 'stars': '219', 'repo_language': 'None', 'file_name': 'statefulset.json', 'mime_type': 'text/plain', 'hash': -2517983219212793179, 'source_dataset': 'data'}


..
   ============================================================
   Command line tools
   ============================================================

.. |ext_lnk_tool_angular_cli| raw:: html

     Angular CLI

.. |ext_lnk_tool_ansible| raw:: html

     Ansible

.. |ext_lnk_tool_awesome_ci| raw:: html

     awesome-ci

.. |ext_lnk_tool_linuxbrew| raw:: html

     Linux brew

.. |ext_lnk_tool_codecept| raw:: html

     Codeception

.. |ext_lnk_tool_composer| raw:: html

     Composer

.. |ext_lnk_tool_dep| raw:: html

     Deployer

.. |ext_lnk_tool_drush| raw:: html

     Drush

.. |ext_lnk_tool_drupal_console| raw:: html

     Drupal Console

.. |ext_lnk_tool_eslint| raw:: html

     ESLint

.. |ext_lnk_tool_git| raw:: html

     Git

.. |ext_lnk_tool_git_flow| raw:: html

     Git flow

.. |ext_lnk_tool_gulp| raw:: html

     Gulp

.. |ext_lnk_tool_grunt| raw:: html

     Grunt

.. |ext_lnk_tool_jsonlint| raw:: html

     JSON lint

.. |ext_lnk_tool_laravel| raw:: html

     Laravel installer

.. |ext_lnk_tool_linkcheck| raw:: html

     linkcheck

.. |ext_lnk_tool_lumen| raw:: html

     Laravel Lumen

.. |ext_lnk_tool_mdl| raw:: html

     Markdown lint

.. |ext_lnk_tool_mdlint| raw:: html

     MD linter

.. |ext_lnk_tool_mongodump| raw:: html

     mongodump

.. |ext_lnk_tool_mongorestore| raw:: html

     mongorestore

.. |ext_lnk_tool_mysqldump| raw:: html

     mysqldump

.. |ext_lnk_tool_mysqldump_secure| raw:: html

     mysqldump-secure

.. |ext_lnk_tool_node| raw:: html

     Node

.. |ext_lnk_tool_npm| raw:: html

     NPM

.. |ext_lnk_tool_phalcon| raw:: html

     Phalcon DevTools

.. |ext_lnk_tool_phpcs| raw:: html

     PHP CodeSniffer

.. |ext_lnk_tool_php_cs_fixer| raw:: html

     PHP-CS-Fixer

.. |ext_lnk_tool_phpcbf| raw:: html

     PHP Code Beautifier and Fixer

.. |ext_lnk_tool_phpmd| raw:: html

     PHP Mess Detector

.. |ext_lnk_tool_phpunit| raw:: html

     PHPUnit

.. |ext_lnk_tool_pg_dump| raw:: html

     pg_dump

.. |ext_lnk_tool_pgsql_restore| raw:: html

     pgsql

.. |ext_lnk_tool_photon| raw:: html

     Photon CMS cli

.. |ext_lnk_tool_pm2| raw:: html

     pm2

.. |ext_lnk_tool_sass| raw:: html

     Sass

.. |ext_lnk_tool_scss_lint| raw:: html

     SCSS Lint

.. |ext_lnk_tool_ssh| raw:: html

     OpenSSH

.. |ext_lnk_tool_symfony| raw:: html

     Symfony installer

.. |ext_lnk_tool_tig| raw:: html

     Text-mode Interface for Git

.. |ext_lnk_tool_vue| raw:: html

     Standard Tooling for Vue.js Development

.. |ext_lnk_tool_webpack| raw:: html

     Webpack

.. |ext_lnk_tool_wp| raw:: html

     Wordpress CLI

.. |ext_lnk_tool_yamllint| raw:: html

     Yamllint

.. |ext_lnk_tool_yarn| raw:: html

     Yarn

.. |ext_lnk_tool_yq| raw:: html

     yq

.. |ext_lnk_tool_github_issues| raw:: html

     Github

..
   ============================================================
   Web tools
   ============================================================

.. |ext_lnk_tool_adminer| raw:: html

     Adminer

.. |ext_lnk_tool_phpmyadmin| raw:: html

     phpMyAdmin

.. |ext_lnk_tool_phppgadmin| raw:: html

     phpPgAdmin

.. |ext_lnk_tool_phpredmin| raw:: html

     phpRedMin

.. |ext_lnk_tool_phpmemcachedadmin| raw:: html

     PHPMemcachedAdmin

.. |ext_lnk_tool_opcachegui| raw:: html

     OpcacheGui

..
   ============================================================
   Projects
   ============================================================

.. |ext_lnk_project_vhost_gen| raw:: html

     vhost-gen

.. |ext_lnk_project_watcherd| raw:: html

     watcherd

.. |ext_lnk_project_watcherp| raw:: html

     watcherp

{'repo_name': 'cytopia/devilbox', 'stars': '2963', 'repo_language': 'PHP', 'file_name': 'devilbox-fpm.conf-pm_dynamic', 'mime_type': 'text/plain', 'hash': -3908775854093874562, 'source_dataset': 'data'}


/* The contents of this file are subject to the Netscape Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/NPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is Mozilla Communicator client code, released March
 * 31, 1998.
 *
 * The Initial Developer of the Original Code is Netscape Communications
 * Corporation. Portions created by Netscape are
 * Copyright (C) 1998 Netscape Communications Corporation. All
 * Rights Reserved.
 *
 * Contributor(s):
 *
 */

    var testcases = new Array();
    var SECTION = "15.9.4.3";
    var TITLE = "Date.UTC( year, month, date, hours, minutes, seconds, ms )";

    getTestCases();
    test();

function MyDate() {
    this.year = 0;
    this.month = 0;
    this.date = 0;
    this.hours = 0;
    this.minutes = 0;
    this.seconds = 0;
    this.ms = 0;
}

function utc( year, month, date, hours, minutes, seconds, ms ) {
    d = new MyDate();
    d.year      = Number(year);

    if (month)
        d.month     = Number(month);
    if (date)
        d.date      = Number(date);
    if (hours)
        d.hours     = Number(hours);
    if (minutes)
        d.minutes   = Number(minutes);
    if (seconds)
        d.seconds   = Number(seconds);
    if (ms)
        d.ms        = Number(ms);

    if ( isNaN(d.year) && 0 <= ToInteger(d.year) && d.year <= 99 ) {
        d.year = 1900 + ToInteger(d.year);
    }

    if (isNaN(month) || isNaN(year) || isNaN(date) || isNaN(hours) ||
        isNaN(minutes) || isNaN(seconds) || isNaN(ms) ) {
            d.year = Number.NaN;
            d.month = Number.NaN;
            d.date = Number.NaN;
            d.hours = Number.NaN;
            d.minutes = Number.NaN;
            d.seconds = Number.NaN;
            d.ms = Number.NaN;
            d.value = Number.NaN;
            d.time = Number.NaN;
            d.day =Number.NaN;
            return d;
        }

    d.day = MakeDay( d.year, d.month, d.date );
    d.time = MakeTime( d.hours, d.minutes, d.seconds, d.ms );
    d.value = (TimeClip( MakeDate(d.day,d.time)));

    return d;
}

function UTCTime( t ) {
    sign = ( t < 0 ) ? -1 : 1;
    return ( (t +(TZ_DIFF*msPerHour)) );
}

function getTestCases() {

    // Dates around 1970

    addNewTestCase( Date.UTC( 1970,0,1,0,0,0,0),
                    "Date.UTC( 1970,0,1,0,0,0,0)",
                    utc(1970,0,1,0,0,0,0) );

    addNewTestCase( Date.UTC( 1969,11,31,23,59,59,999),
                    "Date.UTC( 1969,11,31,23,59,59,999)",
                    utc(1969,11,31,23,59,59,999) );
    addNewTestCase( Date.UTC( 1972,1,29,23,59,59,999),
                    "Date.UTC( 1972,1,29,23,59,59,999)",
                    utc(1972,1,29,23,59,59,999) );
    addNewTestCase( Date.UTC( 1972,2,1,23,59,59,999),
                    "Date.UTC( 1972,2,1,23,59,59,999)",
                    utc(1972,2,1,23,59,59,999) );
    addNewTestCase( Date.UTC( 1968,1,29,23,59,59,999),
                    "Date.UTC( 1968,1,29,23,59,59,999)",
                    utc(1968,1,29,23,59,59,999) );
    addNewTestCase( Date.UTC( 1968,2,1,23,59,59,999),
                    "Date.UTC( 1968,2,1,23,59,59,999)",
                    utc(1968,2,1,23,59,59,999) );
    addNewTestCase( Date.UTC( 1969,0,1,0,0,0,0),
                    "Date.UTC( 1969,0,1,0,0,0,0)",
                    utc(1969,0,1,0,0,0,0) );
    addNewTestCase( Date.UTC( 1969,11,31,23,59,59,1000),
                    "Date.UTC( 1969,11,31,23,59,59,1000)",
                    utc(1970,0,1,0,0,0,0) );
    addNewTestCase( Date.UTC( 1969,Number.NaN,31,23,59,59,999),
                    "Date.UTC( 1969,Number.NaN,31,23,59,59,999)",
                    utc(1969,Number.NaN,31,23,59,59,999) );

    // Dates around 2000

    addNewTestCase( Date.UTC( 1999,11,31,23,59,59,999),
                    "Date.UTC( 1999,11,31,23,59,59,999)",
                    utc(1999,11,31,23,59,59,999) );
    addNewTestCase( Date.UTC( 2000,0,1,0,0,0,0),
                    "Date.UTC( 2000,0,1,0,0,0,0)",
                    utc(2000,0,1,0,0,0,0) );

    // Dates around 1900
    addNewTestCase( Date.UTC( 1899,11,31,23,59,59,999),
                    "Date.UTC( 1899,11,31,23,59,59,999)",
                    utc(1899,11,31,23,59,59,999) );
    addNewTestCase( Date.UTC( 1900,0,1,0,0,0,0),
                    "Date.UTC( 1900,0,1,0,0,0,0)",
                    utc(1900,0,1,0,0,0,0) );
    addNewTestCase( Date.UTC( 1973,0,1,0,0,0,0),
                    "Date.UTC( 1973,0,1,0,0,0,0)",
                    utc(1973,0,1,0,0,0,0) );
    addNewTestCase( Date.UTC( 1776,6,4,12,36,13,111),
                    "Date.UTC( 1776,6,4,12,36,13,111)",
                    utc(1776,6,4,12,36,13,111) );
    addNewTestCase( Date.UTC( 2525,9,18,15,30,1,123),
                    "Date.UTC( 2525,9,18,15,30,1,123)",
                    utc(2525,9,18,15,30,1,123) );

    // Dates around 29 Feb 2000

    addNewTestCase( Date.UTC( 2000,1,29,0,0,0,0 ),
                    "Date.UTC( 2000,1,29,0,0,0,0 )",
                    utc(2000,1,29,0,0,0,0) );
    addNewTestCase( Date.UTC( 2000,1,29,8,0,0,0 ),
                    "Date.UTC( 2000,1,29,8,0,0,0 )",
                    utc(2000,1,29,8,0,0,0) );

    // Dates around 1 Jan 2005

    addNewTestCase( Date.UTC( 2005,0,1,0,0,0,0 ),
                    "Date.UTC( 2005,0,1,0,0,0,0 )",
                    utc(2005,0,1,0,0,0,0) );
    addNewTestCase( Date.UTC( 2004,11,31,16,0,0,0 ),
                    "Date.UTC( 2004,11,31,16,0,0,0 )",
                    utc(2004,11,31,16,0,0,0) );
}

function addNewTestCase( DateCase, DateString, ExpectDate) {
    DateCase = DateCase;

    item = testcases.length;

//    fixed_year = ( ExpectDate.year >=1900 || ExpectDate.year < 2000 ) ? ExpectDate.year - 1900 : ExpectDate.year;

    testcases[item++] = new TestCase( SECTION, DateString,         ExpectDate.value,       DateCase );
    testcases[item++] = new TestCase( SECTION, DateString,         ExpectDate.value,       DateCase );
/*

    testcases[item++] = new TestCase( SECTION, DateString+".getUTCFullYear()",        ExpectDate.year,   DateCase.getUTCFullYear() );
    testcases[item++] = new TestCase( SECTION, DateString+".getUTCMonth()",         ExpectDate.month,  DateCase.getUTCMonth() );
    testcases[item++] = new TestCase( SECTION, DateString+".getUTCDate()",          ExpectDate.date,   DateCase.getUTCDate() );
    testcases[item++] = new TestCase( SECTION, DateString+".getUTCDay()",           ExpectDate.day,    DateCase.getUTCDay() );
    testcases[item++] = new TestCase( SECTION, DateString+".getUTCHours()",         ExpectDate.hours,  DateCase.getUTCHours() );
    testcases[item++] = new TestCase( SECTION, DateString+".getUTCMinutes()",       ExpectDate.minutes,DateCase.getUTCMinutes() );
    testcases[item++] = new TestCase( SECTION, DateString+".getUTCSeconds()",       ExpectDate.seconds,DateCase.getUTCSeconds() );
    testcases[item++] = new TestCase( SECTION, DateString+".getUTCMilliseconds()",  ExpectDate.ms,     DateCase.getUTCMilliseconds() );

    testcases[item++] = new TestCase( SECTION, DateString+".getFullYear()",             ExpectDate.year,            DateCase.getFullYear() );
    testcases[item++] = new TestCase( SECTION, DateString+".getMonth()",            ExpectDate.month,      DateCase.getMonth() );
    testcases[item++] = new TestCase( SECTION, DateString+".getDate()",             ExpectDate.date,       DateCase.getDate() );
//    testcases[item++] = new TestCase( SECTION, DateString+".getDay()",              ExpectDate.day,        DateCase.getDay() );
    testcases[item++] = new TestCase( SECTION, DateString+".getHours()",            ExpectDate.hours,      DateCase.getHours() );
    testcases[item++] = new TestCase( SECTION, DateString+".getMinutes()",          ExpectDate.minutes,    DateCase.getMinutes() );
    testcases[item++] = new TestCase( SECTION, DateString+".getSeconds()",          ExpectDate.seconds,    DateCase.getSeconds() );
    testcases[item++] = new TestCase( SECTION, DateString+".getMilliseconds()",     ExpectDate.ms,         DateCase.getMilliseconds() );
*/
}
function test() {
    for( tc=0; tc < testcases.length; tc++ ) {

        testcases[tc].passed = writeTestCaseResult(
                                testcases[tc].expect,
                                testcases[tc].actual,
                                testcases[tc].description +" = " +
                                testcases[tc].actual );
    }

    stopTest();
    return testcases;
}

{'repo_name': 'trevorlinton/webkit.js', 'stars': '1804', 'repo_language': 'None', 'file_name': 'ProgramBinary.cpp', 'mime_type': 'text/x-c++', 'hash': 24887028915495111, 'source_dataset': 'data'}


{'repo_name': 'kiwibrowser/src', 'stars': '728', 'repo_language': 'None', 'file_name': '3db76d1dd7d3a759dccc3f8fa7f68675c080cb095e4881063a6b850fdd68b8bc.pem', 'mime_type': 'text/plain', 'hash': 8953834754721062716, 'source_dataset': 'data'}


/* deflate.h -- internal compression state
 * Copyright (C) 1995-2016 Jean-loup Gailly
 * For conditions of distribution and use, see copyright notice in zlib.h
 */

/* WARNING: this file should *not* be used by applications. It is
   part of the implementation of the compression library and is
   subject to change. Applications should only use zlib.h.
 */

/* @(#) $Id$ */

#ifndef DEFLATE_H
#define DEFLATE_H

#include "zutil.h"

/* define NO_GZIP when compiling if you want to disable gzip header and
   trailer creation by deflate().  NO_GZIP would be used to avoid linking in
   the crc code when it is not needed.  For shared libraries, gzip encoding
   should be left enabled. */
#ifndef NO_GZIP
#  define GZIP
#endif

/* ===========================================================================
 * Internal compression state.
 */

#define LENGTH_CODES 29
/* number of length codes, not counting the special END_BLOCK code */

#define LITERALS  256
/* number of literal bytes 0..255 */

#define L_CODES (LITERALS+1+LENGTH_CODES)
/* number of Literal or Length codes, including the END_BLOCK code */

#define D_CODES   30
/* number of distance codes */

#define BL_CODES  19
/* number of codes used to transfer the bit lengths */

#define HEAP_SIZE (2*L_CODES+1)
/* maximum heap size */

#define MAX_BITS 15
/* All codes must not exceed MAX_BITS bits */

#define Buf_size 16
/* size of bit buffer in bi_buf */

#define INIT_STATE    42    /* zlib header -> BUSY_STATE */
#ifdef GZIP
#  define GZIP_STATE  57    /* gzip header -> BUSY_STATE | EXTRA_STATE */
#endif
#define EXTRA_STATE   69    /* gzip extra block -> NAME_STATE */
#define NAME_STATE    73    /* gzip file name -> COMMENT_STATE */
#define COMMENT_STATE 91    /* gzip comment -> HCRC_STATE */
#define HCRC_STATE   103    /* gzip header CRC -> BUSY_STATE */
#define BUSY_STATE   113    /* deflate -> FINISH_STATE */
#define FINISH_STATE 666    /* stream complete */
/* Stream status */

/* Data structure describing a single value and its code string. */
typedef struct ct_data_s {
    union {
        ush  freq;       /* frequency count */
        ush  code;       /* bit string */
    } fc;
    union {
        ush  dad;        /* father node in Huffman tree */
        ush  len;        /* length of bit string */
    } dl;
} FAR ct_data;

#define Freq fc.freq
#define Code fc.code
#define Dad  dl.dad
#define Len  dl.len

typedef struct static_tree_desc_s  static_tree_desc;

typedef struct tree_desc_s {
    ct_data *dyn_tree;           /* the dynamic tree */
    int     max_code;            /* largest code with non zero frequency */
    const static_tree_desc *stat_desc;  /* the corresponding static tree */
} FAR tree_desc;

typedef ush Pos;
typedef Pos FAR Posf;
typedef unsigned IPos;

/* A Pos is an index in the character window. We use short instead of int to
 * save space in the various tables. IPos is used only for parameter passing.
 */

typedef struct internal_state {
    z_streamp strm;      /* pointer back to this zlib stream */
    int   status;        /* as the name implies */
    Bytef *pending_buf;  /* output still pending */
    ulg   pending_buf_size; /* size of pending_buf */
    Bytef *pending_out;  /* next pending byte to output to the stream */
    ulg   pending;       /* nb of bytes in the pending buffer */
    int   wrap;          /* bit 0 true for zlib, bit 1 true for gzip */
    gz_headerp  gzhead;  /* gzip header information to write */
    ulg   gzindex;       /* where in extra, name, or comment */
    Byte  method;        /* can only be DEFLATED */
    int   last_flush;    /* value of flush param for previous deflate call */

                /* used by deflate.c: */

    uInt  w_size;        /* LZ77 window size (32K by default) */
    uInt  w_bits;        /* log2(w_size)  (8..16) */
    uInt  w_mask;        /* w_size - 1 */

    Bytef *window;
    /* Sliding window. Input bytes are read into the second half of the window,
     * and move to the first half later to keep a dictionary of at least wSize
     * bytes. With this organization, matches are limited to a distance of
     * wSize-MAX_MATCH bytes, but this ensures that IO is always
     * performed with a length multiple of the block size. Also, it limits
     * the window size to 64K, which is quite useful on MSDOS.
     * To do: use the user input buffer as sliding window.
     */

    ulg window_size;
    /* Actual size of window: 2*wSize, except when the user input buffer
     * is directly used as sliding window.
     */

    Posf *prev;
    /* Link to older string with same hash index. To limit the size of this
     * array to 64K, this link is maintained only for the last 32K strings.
     * An index in this array is thus a window index modulo 32K.
     */

    Posf *head; /* Heads of the hash chains or NIL. */

    uInt  ins_h;          /* hash index of string to be inserted */
    uInt  hash_size;      /* number of elements in hash table */
    uInt  hash_bits;      /* log2(hash_size) */
    uInt  hash_mask;      /* hash_size-1 */

    uInt  hash_shift;
    /* Number of bits by which ins_h must be shifted at each input
     * step. It must be such that after MIN_MATCH steps, the oldest
     * byte no longer takes part in the hash key, that is:
     *   hash_shift * MIN_MATCH >= hash_bits
     */

    long block_start;
    /* Window position at the beginning of the current output block. Gets
     * negative when the window is moved backwards.
     */

    uInt match_length;           /* length of best match */
    IPos prev_match;             /* previous match */
    int match_available;         /* set if previous match exists */
    uInt strstart;               /* start of string to insert */
    uInt match_start;            /* start of matching string */
    uInt lookahead;              /* number of valid bytes ahead in window */

    uInt prev_length;
    /* Length of the best match at previous step. Matches not greater than this
     * are discarded. This is used in the lazy match evaluation.
     */

    uInt max_chain_length;
    /* To speed up deflation, hash chains are never searched beyond this
     * length.  A higher limit improves compression ratio but degrades the
     * speed.
     */

    uInt max_lazy_match;
    /* Attempt to find a better match only when the current match is strictly
     * smaller than this value. This mechanism is used only for compression
     * levels >= 4.
     */
#   define max_insert_length  max_lazy_match
    /* Insert new strings in the hash table only if the match length is not
     * greater than this length. This saves time but degrades compression.
     * max_insert_length is used only for compression levels <= 3.
     */

    int level;    /* compression level (1..9) */
    int strategy; /* favor or force Huffman coding*/

    uInt good_match;
    /* Use a faster search when the previous match is longer than this */

    int nice_match; /* Stop searching when current match exceeds this */

                /* used by trees.c: */
    /* Didn't use ct_data typedef below to suppress compiler warning */
    struct ct_data_s dyn_ltree[HEAP_SIZE];   /* literal and length tree */
    struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
    struct ct_data_s bl_tree[2*BL_CODES+1];  /* Huffman tree for bit lengths */

    struct tree_desc_s l_desc;               /* desc. for literal tree */
    struct tree_desc_s d_desc;               /* desc. for distance tree */
    struct tree_desc_s bl_desc;              /* desc. for bit length tree */

    ush bl_count[MAX_BITS+1];
    /* number of codes at each bit length for an optimal tree */

    int heap[2*L_CODES+1];      /* heap used to build the Huffman trees */
    int heap_len;               /* number of elements in the heap */
    int heap_max;               /* element of largest frequency */
    /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
     * The same heap array is used to build all trees.
     */

    uch depth[2*L_CODES+1];
    /* Depth of each subtree used as tie breaker for trees of equal frequency
     */

    uchf *l_buf;          /* buffer for literals or lengths */

    uInt  lit_bufsize;
    /* Size of match buffer for literals/lengths.  There are 4 reasons for
     * limiting lit_bufsize to 64K:
     *   - frequencies can be kept in 16 bit counters
     *   - if compression is not successful for the first block, all input
     *     data is still in the window so we can still emit a stored block even
     *     when input comes from standard input.  (This can also be done for
     *     all blocks if lit_bufsize is not greater than 32K.)
     *   - if compression is not successful for a file smaller than 64K, we can
     *     even emit a stored file instead of a stored block (saving 5 bytes).
     *     This is applicable only for zip (not gzip or zlib).
     *   - creating new Huffman trees less frequently may not provide fast
     *     adaptation to changes in the input data statistics. (Take for
     *     example a binary file with poorly compressible code followed by
     *     a highly compressible string table.) Smaller buffer sizes give
     *     fast adaptation but have of course the overhead of transmitting
     *     trees more frequently.
     *   - I can't count above 4
     */

    uInt last_lit;      /* running index in l_buf */

    ushf *d_buf;
    /* Buffer for distances. To simplify the code, d_buf and l_buf have
     * the same number of elements. To use different lengths, an extra flag
     * array would be necessary.
     */

    ulg opt_len;        /* bit length of current block with optimal trees */
    ulg static_len;     /* bit length of current block with static trees */
    uInt matches;       /* number of string matches in current block */
    uInt insert;        /* bytes at end of window left to insert */

#ifdef ZLIB_DEBUG
    ulg compressed_len; /* total bit length of compressed file mod 2^32 */
    ulg bits_sent;      /* bit length of compressed data sent mod 2^32 */
#endif

    ush bi_buf;
    /* Output buffer. bits are inserted starting at the bottom (least
     * significant bits).
     */
    int bi_valid;
    /* Number of valid bits in bi_buf.  All bits above the last valid bit
     * are always zero.
     */

    ulg high_water;
    /* High water mark offset in window for initialized bytes -- bytes above
     * this are set to zero in order to avoid memory check warnings when
     * longest match routines access bytes past the input.  This is then
     * updated to the new high water mark.
     */

} FAR deflate_state;

/* Output a byte on the stream.
 * IN assertion: there is enough room in pending_buf.
 */
#define put_byte(s, c) {s->pending_buf[s->pending++] = (Bytef)(c);}

#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
/* Minimum amount of lookahead, except at the end of the input file.
 * See deflate.c for comments about the MIN_MATCH+1.
 */

#define MAX_DIST(s)  ((s)->w_size-MIN_LOOKAHEAD)
/* In order to simplify the code, particularly on 16 bit machines, match
 * distances are limited to MAX_DIST instead of WSIZE.
 */

#define WIN_INIT MAX_MATCH
/* Number of bytes after end of data in window to initialize in order to avoid
   memory checker errors from longest match routines */

        /* in trees.c */
void ZLIB_INTERNAL _tr_init OF((deflate_state *s));
int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf,
                        ulg stored_len, int last));
void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
                        ulg stored_len, int last));

#define d_code(dist) \
   ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
/* Mapping from a distance to a distance code. dist is the distance - 1 and
 * must not have side effects. _dist_code[256] and _dist_code[257] are never
 * used.
 */

#ifndef ZLIB_DEBUG
/* Inline versions of _tr_tally for speed: */

#if defined(GEN_TREES_H) || !defined(STDC)
  extern uch ZLIB_INTERNAL _length_code[];
  extern uch ZLIB_INTERNAL _dist_code[];
#else
  extern const uch ZLIB_INTERNAL _length_code[];
  extern const uch ZLIB_INTERNAL _dist_code[];
#endif

# define _tr_tally_lit(s, c, flush) \
  { uch cc = (c); \
    s->d_buf[s->last_lit] = 0; \
    s->l_buf[s->last_lit++] = cc; \
    s->dyn_ltree[cc].Freq++; \
    flush = (s->last_lit == s->lit_bufsize-1); \
   }
# define _tr_tally_dist(s, distance, length, flush) \
  { uch len = (uch)(length); \
    ush dist = (ush)(distance); \
    s->d_buf[s->last_lit] = dist; \
    s->l_buf[s->last_lit++] = len; \
    dist--; \
    s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
    s->dyn_dtree[d_code(dist)].Freq++; \
    flush = (s->last_lit == s->lit_bufsize-1); \
  }
#else
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
# define _tr_tally_dist(s, distance, length, flush) \
              flush = _tr_tally(s, distance, length)
#endif

#endif /* DEFLATE_H */

{'repo_name': 'team-eternity/eternity', 'stars': '123', 'repo_language': 'C++', 'file_name': 'midiproc.sln', 'mime_type': 'text/plain', 'hash': 206376819489405804, 'source_dataset': 'data'}


/*
 * Created by SharpDevelop.
 * User: Bogdan
 * Date: 02.03.2011
 * Time: 00:20
 *
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.IO;
using System.Reflection;

namespace Mega_Dumper
{
	/// <summary>
	/// Description of ViewWindowsHoocks.
	/// </summary>
	public partial class ViewWindowsHoocks : Form
	{
		public ViewWindowsHoocks()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();

			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
		}

[DllImport("kernel32.dll", CharSet=CharSet.Auto)]
public static extern uint GetModuleHandleW(string libname);

[DllImport("kernel32.dll", CharSet=CharSet.Ansi)]
unsafe static extern byte* GetProcAddress(uint hModule, string procName);

[DllImport("ntdll.dll")]
public static extern uint NtCurrentTeb();

public enum HookType : uint
{
     WH_JOURNALRECORD = 0,
     WH_JOURNALPLAYBACK = 1,
     WH_KEYBOARD = 2,
     WH_GETMESSAGE = 3,
     WH_CALLWNDPROC = 4,
     WH_CBT = 5,
     WH_SYSMSGFILTER = 6,
     WH_MOUSE = 7,
     WH_HARDWARE = 8,
     WH_DEBUG = 9,
     WH_SHELL = 10,
     WH_FOREGROUNDIDLE = 11,
     WH_CALLWNDPROCRET = 12,
     WH_KEYBOARD_LL = 13,
     WH_MOUSE_LL = 14
}

/*
typedef struct _HOOK
{
    // 0x00  ULONG Handle;
    // 0x04  ULONG LockObj;
	// 0x08  PVOID ThreadInfo;
	// 0x0C  PVOID Desktop1;
	// 0x10  PVOID Self;
    // 0x14  PVOID NextHook;
    // 0x18  LONG HookType;
    // 0x1C  PVOID FunctionAddress;
    // 0x20  ULONG Flags;
    // 0x24  ULONG ModuleHandle;
    // 0x28  PVOID Hooked;
    // 0x2C  PVOID Desktop2;
    // 0x30
}
or

typedef struct _HOOK {
ULONG hHook;
ULONG cLockObj;
PTHREADINFO pti;
ULONG rpdesk;
ULONG pSelf;
struct _HOOK *phkNext;
int iHook;
ULONG offPfn;
unsigned int flags;
int ihmod;
PTHREADINFO ptiHooked;
PDESKTOP rpdesk;
} HOOK, *PHOOK;

Fields:
- hHook
Handle to the hook procedure, it’s the value returned by SetWindowsHookEx and it comes from HMAllocObject
- clockObj
  unknown !!!
- pti
Pointer to THREADINFO structure of the process which sets the hook
- rpdesk
  unknown !!!
- pSelf
Pointer to this HOOK structure
- phkNext
Next structure in the hook chain
- iHook
Hook type (i.e. WH_MOUSE or WH_KEYBOARD). This is the first parameter
passed to SetWindowsHookEx
- offPfn
Offset of the filter procedure, it is obtained by a simple substration
between the address of the hook procedure and the initial address of the dll
- flags
HF_xxx flags (HF_GLOBALS, HF_LOCAL, HF_DESTROYED…)
- ihmod
Number of hooks set into the module
- ptiHooked
Pointer to THREADINFO structure of the hooked thread. If HF_GLOBAL
is setted the pointer is setted to NULL because the hook works for
every running thread

 */

unsafe void LogAllHooks()
{

/* at the end of USER32!UserRegisterWowHandlers:
7e4537f5 b8a010477e mov     eax,offset USER32!gSharedInfo (7e4710a0)
7e4537fa 5d         pop     ebp
7e4537fb c20800     ret     8
*/
string hoocktext = "";
hoocktext = hoocktext+"Init variables:"+"\r\n";
uint pgSharedInfo = 0x77D700A0;
uint* pointer = null;
byte* UserRegisterWowHandlers = GetProcAddress(GetModuleHandleW("user32.dll"), "UserRegisterWowHandlers");

hoocktext = hoocktext+"user32.UserRegisterWowHandlers: "+
 ((uint)UserRegisterWowHandlers).ToString("X8")+"\r\n";

uint i=0;
do
{
if (UserRegisterWowHandlers[i]==0x0B8)
{
pointer = (uint*)(UserRegisterWowHandlers+i+1);
pgSharedInfo = pointer[0]; // get SharedInfo
break;
}
i++;
} while (i<0x256);

hoocktext = hoocktext+"USER32!gSharedInfo: "+pgSharedInfo.ToString("X8")+"\r\n";

uint ptrSharedDelta = NtCurrentTeb()+0x6CC;  // 0x7FFDF000
hoocktext = hoocktext+"ptrSharedDelta: "+ptrSharedDelta.ToString("X8")+"\r\n";
uint SharedDelta = ((uint*)(ptrSharedDelta))[7];
hoocktext = hoocktext+"SharedDelta: "+SharedDelta.ToString("X8")+"\r\n";
pointer = (uint*)(((uint*)(pgSharedInfo))[0]);
uint HandleEntries = pointer[2];
hoocktext = hoocktext+"HandleEntries: "+HandleEntries.ToString("X8")+"\r\n";
uint UserHandleTable = ((uint*)(pgSharedInfo))[1];
hoocktext = hoocktext+"UserHandleTable: "+UserHandleTable.ToString("X8")+"\r\n";
hoocktext = hoocktext+"\r\n";
hoocktext = hoocktext+"Start login hooks..."+"\r\n";

for(i=0; i<HandleEntries; i++)
{

//i*12
byte* hook = (byte*)(i*12+UserHandleTable);
// _HANDLE_ENTRY
if (hook[8]==5) // if _HANDLE_ENTRY.Type is TYPE_HOOK
{
try
{

hoocktext = hoocktext+"\r\n";
hoocktext = hoocktext+"HOOK: "+((uint)hook).ToString("X8")+"\r\n";
uint HookInfo = ((uint*)(hook))[0] - SharedDelta;
hoocktext = hoocktext+"HookInfo: "+HookInfo.ToString("X8")+"\r\n";
uint hookhandle = ((uint*)(HookInfo))[0];
hoocktext = hoocktext+"HookHadle: "+hookhandle.ToString("X8")+"\r\n";
// ---------------------------------------------------
uint LockObj = ((uint*)(HookInfo))[1];
hoocktext = hoocktext+"LockObj: "+LockObj.ToString("X8")+"\r\n";;
uint threadinfov = ((uint*)(HookInfo))[2];
hoocktext = hoocktext+"ThreadInfo: "+threadinfov.ToString("X8")+"\r\n";
uint desktop1 = ((uint*)(HookInfo))[3];
hoocktext = hoocktext+"Desktop1: "+desktop1.ToString("X8")+"\r\n";
uint selfv = ((uint*)(HookInfo))[4];
hoocktext = hoocktext+"Self: "+selfv.ToString("X8")+"\r\n";
uint nexthookv = ((uint*)(HookInfo))[5];
hoocktext = hoocktext+"NextHook: "+nexthookv.ToString("X8")+"\r\n";
// Important values comes here:
// WH_CBT = 5 - are global hooks
uint hooktype = ((uint*)(HookInfo))[6];
if (hooktype<=14)
hoocktext = hoocktext+"HookType: "+((HookType)hooktype).ToString()+
             " - "+hooktype.ToString("X8")+"\r\n";
else
hoocktext = hoocktext+"HookType: "+((HookType)hooktype).ToString()+"\r\n";

uint functionrva = ((uint*)(HookInfo))[7];
hoocktext = hoocktext+"FunctionRVA: "+functionrva.ToString("X8")+"\r\n";
uint flagsv = ((uint*)(HookInfo))[8];

string flagsstring = "";
if ((flagsv&1)!=0)  // G_HOOK_FLAG_ACTIVE = 1
{
flagsstring = "G_HOOK_FLAG_ACTIVE";
}

if ((flagsv&2)!=0)  // G_HOOK_FLAG_IN_CALL = 2
{
if (flagsstring!="") flagsstring=flagsstring+",";
flagsstring = flagsstring+"G_HOOK_FLAG_IN_CALL";
}
/*
#define HF_GLOBAL 0x0001
#define HF_ANSI 0x0002
#define HF_NEEDHC_SKIP 0x0004
#define HF_HUNG 0x0008
#define HF_HOOKFAULTED 0x0010
#define HF_NOPLAYBACKDELAY 0x0020
#define HF_WX86KNOWINDOWLL 0x0040
#define HF_DESTROYED 0x0080
 */

hoocktext = hoocktext+"Flags: "+flagsstring+" - "+flagsv.ToString("X8")+"\r\n";
uint ihmod = ((uint*)(HookInfo))[9];
hoocktext = hoocktext+"ModuleHooksCount: "+ihmod.ToString("X8")+"\r\n";
uint hookedp = ((uint*)(HookInfo))[10];
hoocktext = hoocktext+"ptiHooked: "+hookedp.ToString("X8")+"\r\n";
uint desktop2v = ((uint*)(HookInfo))[11];
hoocktext = hoocktext+"Desktop2: "+desktop2v.ToString("X8")+"\r\n";

}
catch
{

}

}
}
textBox1.Text = hoocktext;
}

void ViewWindowsHoocksShown(object sender, EventArgs e)
{
LogAllHooks();
}

}
}

{'repo_name': 'CodeCracker-Tools/MegaDumper', 'stars': '155', 'repo_language': 'C#', 'file_name': 'AssemblyInfo.cs', 'mime_type': 'text/plain', 'hash': 6585126967532897676, 'source_dataset': 'data'}


################################################################################
#
# toolchain-external-synopsys-arc
#
################################################################################

TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_VERSION = 2018.03
TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_SITE = https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases/download/arc-$(TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_VERSION)-release

ifeq ($(BR2_arc750d)$(BR2_arc770d),y)
TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_CORE = arc700
else
TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_CORE = archs
endif

ifeq ($(BR2_arcle),y)
TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_ENDIANESS = le
else
TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_ENDIANESS = be
endif

TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_SOURCE = arc_gnu_$(TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_VERSION)_prebuilt_uclibc_$(TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_ENDIANESS)_$(TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_CORE)_linux_install.tar.gz

$(eval $(toolchain-external-package))

{'repo_name': 'maxnet/berryboot', 'stars': '584', 'repo_language': 'Makefile', 'file_name': 'config.txt', 'mime_type': 'text/plain', 'hash': -5160877257513887020, 'source_dataset': 'data'}


fs2-rabbit
==========

[![CI Status](https://github.com/profunktor/fs2-rabbit/workflows/Build/badge.svg)](https://github.com/profunktor/fs2-rabbit/actions)
[![Gitter Chat](https://badges.gitter.im/profunktor-dev/fs2-rabbit.svg)](https://gitter.im/profunktor-dev/fs2-rabbit)
[![Maven Central](https://img.shields.io/maven-central/v/dev.profunktor/fs2-rabbit_2.12.svg)](http://search.maven.org/#search%7Cga%7C1%7Cfs2-rabbit)
[![MergifyStatus](https://img.shields.io/endpoint.svg?url=https://gh.mergify.io/badges/profunktor/fs2-rabbit&style=flat)](https://mergify.io)
[![Scala Steward badge](https://img.shields.io/badge/Scala_Steward-helping-brightgreen.svg?style=flat&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAQCAMAAAARSr4IAAAAVFBMVEUAAACHjojlOy5NWlrKzcYRKjGFjIbp293YycuLa3pYY2LSqql4f3pCUFTgSjNodYRmcXUsPD/NTTbjRS+2jomhgnzNc223cGvZS0HaSD0XLjbaSjElhIr+AAAAAXRSTlMAQObYZgAAAHlJREFUCNdNyosOwyAIhWHAQS1Vt7a77/3fcxxdmv0xwmckutAR1nkm4ggbyEcg/wWmlGLDAA3oL50xi6fk5ffZ3E2E3QfZDCcCN2YtbEWZt+Drc6u6rlqv7Uk0LdKqqr5rk2UCRXOk0vmQKGfc94nOJyQjouF9H/wCc9gECEYfONoAAAAASUVORK5CYII=)](https://scala-steward.org)

Stream-based library for [RabbitMQ](https://www.rabbitmq.com/) built-in on top of [Fs2](http://fs2.io/) and the [RabbitMq Java Client](https://github.com/rabbitmq/rabbitmq-java-client).

## Dependencies

Add this to your build.sbt:

```scala
libraryDependencies += "dev.profunktor" %% "fs2-rabbit" % Version
```

And this one if you would like to have Json support:

```scala
libraryDependencies += "dev.profunktor" %% "fs2-rabbit-circe" % Version
```

Note: previous artifacts `<= 2.0.0-RC1` were published using the `com.github.gvolpe` group id (see [migration
guide](https://github.com/profunktor/fs2-rabbit/wiki/Migration-guide-(Vim)))

## Usage Guide

Check the [official guide](https://fs2-rabbit.profunktor.dev/guide.html) for updated compiling examples.

## Adopters

| Company | Description |
| ------- | ----------- |
| [Cognotekt](http://www.cognotekt.com/en) | Microservice workflow management in Insuretech AI applications. |
| [ITV](https://www.itv.com/) | Internal microservices interaction. |
| [Klarna](https://www.klarna.com/us/) | Microservice for Fintech services. |
| [Philips Lighting](http://www.lighting.philips.com/main/home) | Internal microservices interaction. |
| [Free2Move](https://free2move.com) | Microservice communication. |

## Running tests locally

Start a `RabbitMQ` instance using `docker-compose` (recommended):

```bash
> docker-compose up
> sbt +test
```

## Code of Conduct

See the [Code of Conduct](https://fs2-rabbit.profunktor.dev/CODE_OF_CONDUCT)

## LICENSE

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project except in compliance with
the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific
language governing permissions and limitations under the License.

{'repo_name': 'profunktor/fs2-rabbit', 'stars': '107', 'repo_language': 'Scala', 'file_name': 'package.scala', 'mime_type': 'text/plain', 'hash': 3527586951700963352, 'source_dataset': 'data'}


/*
 * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 only, as
 * published by the Free Software Foundation.
 *
 * This code is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * version 2 for more details (a copy is included in the LICENSE file that
 * accompanied this code).
 *
 * You should have received a copy of the GNU General Public License version
 * 2 along with this work; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
 * or visit www.oracle.com if you need additional information or have any
 * questions.
 *
 */

#include "precompiled.hpp"
#include "classfile/javaClasses.hpp"
#include "gc/g1/c2/g1BarrierSetC2.hpp"
#include "gc/g1/g1BarrierSet.hpp"
#include "gc/g1/g1BarrierSetRuntime.hpp"
#include "gc/g1/g1CardTable.hpp"
#include "gc/g1/g1ThreadLocalData.hpp"
#include "gc/g1/heapRegion.hpp"
#include "opto/arraycopynode.hpp"
#include "opto/compile.hpp"
#include "opto/escape.hpp"
#include "opto/graphKit.hpp"
#include "opto/idealKit.hpp"
#include "opto/macro.hpp"
#include "opto/rootnode.hpp"
#include "opto/type.hpp"
#include "utilities/macros.hpp"

const TypeFunc *G1BarrierSetC2::write_ref_field_pre_entry_Type() {
  const Type **fields = TypeTuple::fields(2);
  fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value
  fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL; // thread
  const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);

  // create result type (range)
  fields = TypeTuple::fields(0);
  const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);

  return TypeFunc::make(domain, range);
}

const TypeFunc *G1BarrierSetC2::write_ref_field_post_entry_Type() {
  const Type **fields = TypeTuple::fields(2);
  fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL;  // Card addr
  fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL;  // thread
  const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);

  // create result type (range)
  fields = TypeTuple::fields(0);
  const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields);

  return TypeFunc::make(domain, range);
}

#define __ ideal.
/*
 * Determine if the G1 pre-barrier can be removed. The pre-barrier is
 * required by SATB to make sure all objects live at the start of the
 * marking are kept alive, all reference updates need to any previous
 * reference stored before writing.
 *
 * If the previous value is NULL there is no need to save the old value.
 * References that are NULL are filtered during runtime by the barrier
 * code to avoid unnecessary queuing.
 *
 * However in the case of newly allocated objects it might be possible to
 * prove that the reference about to be overwritten is NULL during compile
 * time and avoid adding the barrier code completely.
 *
 * The compiler needs to determine that the object in which a field is about
 * to be written is newly allocated, and that no prior store to the same field
 * has happened since the allocation.
 *
 * Returns true if the pre-barrier can be removed
 */
bool G1BarrierSetC2::g1_can_remove_pre_barrier(GraphKit* kit,
                                               PhaseTransform* phase,
                                               Node* adr,
                                               BasicType bt,
                                               uint adr_idx) const {
  intptr_t offset = 0;
  Node* base = AddPNode::Ideal_base_and_offset(adr, phase, offset);
  AllocateNode* alloc = AllocateNode::Ideal_allocation(base, phase);

  if (offset == Type::OffsetBot) {
    return false; // cannot unalias unless there are precise offsets
  }

  if (alloc == NULL) {
    return false; // No allocation found
  }

  intptr_t size_in_bytes = type2aelembytes(bt);

  Node* mem = kit->memory(adr_idx); // start searching here...

  for (int cnt = 0; cnt < 50; cnt++) {

    if (mem->is_Store()) {

      Node* st_adr = mem->in(MemNode::Address);
      intptr_t st_offset = 0;
      Node* st_base = AddPNode::Ideal_base_and_offset(st_adr, phase, st_offset);

      if (st_base == NULL) {
        break; // inscrutable pointer
      }

      // Break we have found a store with same base and offset as ours so break
      if (st_base == base && st_offset == offset) {
        break;
      }

      if (st_offset != offset && st_offset != Type::OffsetBot) {
        const int MAX_STORE = BytesPerLong;
        if (st_offset >= offset + size_in_bytes ||
            st_offset <= offset - MAX_STORE ||
            st_offset <= offset - mem->as_Store()->memory_size()) {
          // Success:  The offsets are provably independent.
          // (You may ask, why not just test st_offset != offset and be done?
          // The answer is that stores of different sizes can co-exist
          // in the same sequence of RawMem effects.  We sometimes initialize
          // a whole 'tile' of array elements with a single jint or jlong.)
          mem = mem->in(MemNode::Memory);
          continue; // advance through independent store memory
        }
      }

      if (st_base != base
          && MemNode::detect_ptr_independence(base, alloc, st_base,
                                              AllocateNode::Ideal_allocation(st_base, phase),
                                              phase)) {
        // Success:  The bases are provably independent.
        mem = mem->in(MemNode::Memory);
        continue; // advance through independent store memory
      }
    } else if (mem->is_Proj() && mem->in(0)->is_Initialize()) {

      InitializeNode* st_init = mem->in(0)->as_Initialize();
      AllocateNode* st_alloc = st_init->allocation();

      // Make sure that we are looking at the same allocation site.
      // The alloc variable is guaranteed to not be null here from earlier check.
      if (alloc == st_alloc) {
        // Check that the initialization is storing NULL so that no previous store
        // has been moved up and directly write a reference
        Node* captured_store = st_init->find_captured_store(offset,
                                                            type2aelembytes(T_OBJECT),
                                                            phase);
        if (captured_store == NULL || captured_store == st_init->zero_memory()) {
          return true;
        }
      }
    }

    // Unless there is an explicit 'continue', we must bail out here,
    // because 'mem' is an inscrutable memory state (e.g., a call).
    break;
  }

  return false;
}

// G1 pre/post barriers
void G1BarrierSetC2::pre_barrier(GraphKit* kit,
                                 bool do_load,
                                 Node* ctl,
                                 Node* obj,
                                 Node* adr,
                                 uint alias_idx,
                                 Node* val,
                                 const TypeOopPtr* val_type,
                                 Node* pre_val,
                                 BasicType bt) const {
  // Some sanity checks
  // Note: val is unused in this routine.

  if (do_load) {
    // We need to generate the load of the previous value
    assert(obj != NULL, "must have a base");
    assert(adr != NULL, "where are loading from?");
    assert(pre_val == NULL, "loaded already?");
    assert(val_type != NULL, "need a type");

    if (use_ReduceInitialCardMarks()
        && g1_can_remove_pre_barrier(kit, &kit->gvn(), adr, bt, alias_idx)) {
      return;
    }

  } else {
    // In this case both val_type and alias_idx are unused.
    assert(pre_val != NULL, "must be loaded already");
    // Nothing to be done if pre_val is null.
    if (pre_val->bottom_type() == TypePtr::NULL_PTR) return;
    assert(pre_val->bottom_type()->basic_type() == T_OBJECT, "or we shouldn't be here");
  }
  assert(bt == T_OBJECT, "or we shouldn't be here");

  IdealKit ideal(kit, true);

  Node* tls = __ thread(); // ThreadLocalStorage

  Node* no_base = __ top();
  Node* zero  = __ ConI(0);
  Node* zeroX = __ ConX(0);

  float likely  = PROB_LIKELY(0.999);
  float unlikely  = PROB_UNLIKELY(0.999);

  BasicType active_type = in_bytes(SATBMarkQueue::byte_width_of_active()) == 4 ? T_INT : T_BYTE;
  assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 4 || in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "flag width");

  // Offsets into the thread
  const int marking_offset = in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset());
  const int index_offset   = in_bytes(G1ThreadLocalData::satb_mark_queue_index_offset());
  const int buffer_offset  = in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset());

  // Now the actual pointers into the thread
  Node* marking_adr = __ AddP(no_base, tls, __ ConX(marking_offset));
  Node* buffer_adr  = __ AddP(no_base, tls, __ ConX(buffer_offset));
  Node* index_adr   = __ AddP(no_base, tls, __ ConX(index_offset));

  // Now some of the values
  Node* marking = __ load(__ ctrl(), marking_adr, TypeInt::INT, active_type, Compile::AliasIdxRaw);

  // if (!marking)
  __ if_then(marking, BoolTest::ne, zero, unlikely); {
    BasicType index_bt = TypeX_X->basic_type();
    assert(sizeof(size_t) == type2aelembytes(index_bt), "Loading G1 SATBMarkQueue::_index with wrong size.");
    Node* index   = __ load(__ ctrl(), index_adr, TypeX_X, index_bt, Compile::AliasIdxRaw);

    if (do_load) {
      // load original value
      // alias_idx correct??
      pre_val = __ load(__ ctrl(), adr, val_type, bt, alias_idx);
    }

    // if (pre_val != NULL)
    __ if_then(pre_val, BoolTest::ne, kit->null()); {
      Node* buffer  = __ load(__ ctrl(), buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw);

      // is the queue for this thread full?
      __ if_then(index, BoolTest::ne, zeroX, likely); {

        // decrement the index
        Node* next_index = kit->gvn().transform(new SubXNode(index, __ ConX(sizeof(intptr_t))));

        // Now get the buffer location we will log the previous value into and store it
        Node *log_addr = __ AddP(no_base, buffer, next_index);
        __ store(__ ctrl(), log_addr, pre_val, T_OBJECT, Compile::AliasIdxRaw, MemNode::unordered);
        // update the index
        __ store(__ ctrl(), index_adr, next_index, index_bt, Compile::AliasIdxRaw, MemNode::unordered);

      } __ else_(); {

        // logging buffer is full, call the runtime
        const TypeFunc *tf = write_ref_field_pre_entry_Type();
        __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), "write_ref_field_pre_entry", pre_val, tls);
      } __ end_if();  // (!index)
    } __ end_if();  // (pre_val != NULL)
  } __ end_if();  // (!marking)

  // Final sync IdealKit and GraphKit.
  kit->final_sync(ideal);
}

/*
 * G1 similar to any GC with a Young Generation requires a way to keep track of
 * references from Old Generation to Young Generation to make sure all live
 * objects are found. G1 also requires to keep track of object references
 * between different regions to enable evacuation of old regions, which is done
 * as part of mixed collections. References are tracked in remembered sets and
 * is continuously updated as reference are written to with the help of the
 * post-barrier.
 *
 * To reduce the number of updates to the remembered set the post-barrier
 * filters updates to fields in objects located in the Young Generation,
 * the same region as the reference, when the NULL is being written or
 * if the card is already marked as dirty by an earlier write.
 *
 * Under certain circumstances it is possible to avoid generating the
 * post-barrier completely if it is possible during compile time to prove
 * the object is newly allocated and that no safepoint exists between the
 * allocation and the store.
 *
 * In the case of slow allocation the allocation code must handle the barrier
 * as part of the allocation in the case the allocated object is not located
 * in the nursery; this would happen for humongous objects.
 *
 * Returns true if the post barrier can be removed
 */
bool G1BarrierSetC2::g1_can_remove_post_barrier(GraphKit* kit,
                                                PhaseTransform* phase, Node* store,
                                                Node* adr) const {
  intptr_t      offset = 0;
  Node*         base   = AddPNode::Ideal_base_and_offset(adr, phase, offset);
  AllocateNode* alloc  = AllocateNode::Ideal_allocation(base, phase);

  if (offset == Type::OffsetBot) {
    return false; // cannot unalias unless there are precise offsets
  }

  if (alloc == NULL) {
     return false; // No allocation found
  }

  // Start search from Store node
  Node* mem = store->in(MemNode::Control);
  if (mem->is_Proj() && mem->in(0)->is_Initialize()) {

    InitializeNode* st_init = mem->in(0)->as_Initialize();
    AllocateNode*  st_alloc = st_init->allocation();

    // Make sure we are looking at the same allocation
    if (alloc == st_alloc) {
      return true;
    }
  }

  return false;
}

//
// Update the card table and add card address to the queue
//
void G1BarrierSetC2::g1_mark_card(GraphKit* kit,
                                  IdealKit& ideal,
                                  Node* card_adr,
                                  Node* oop_store,
                                  uint oop_alias_idx,
                                  Node* index,
                                  Node* index_adr,
                                  Node* buffer,
                                  const TypeFunc* tf) const {
  Node* zero  = __ ConI(0);
  Node* zeroX = __ ConX(0);
  Node* no_base = __ top();
  BasicType card_bt = T_BYTE;
  // Smash zero into card. MUST BE ORDERED WRT TO STORE
  __ storeCM(__ ctrl(), card_adr, zero, oop_store, oop_alias_idx, card_bt, Compile::AliasIdxRaw);

  //  Now do the queue work
  __ if_then(index, BoolTest::ne, zeroX); {

    Node* next_index = kit->gvn().transform(new SubXNode(index, __ ConX(sizeof(intptr_t))));
    Node* log_addr = __ AddP(no_base, buffer, next_index);

    // Order, see storeCM.
    __ store(__ ctrl(), log_addr, card_adr, T_ADDRESS, Compile::AliasIdxRaw, MemNode::unordered);
    __ store(__ ctrl(), index_adr, next_index, TypeX_X->basic_type(), Compile::AliasIdxRaw, MemNode::unordered);

  } __ else_(); {
    __ make_leaf_call(tf, CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), "write_ref_field_post_entry", card_adr, __ thread());
  } __ end_if();

}

void G1BarrierSetC2::post_barrier(GraphKit* kit,
                                  Node* ctl,
                                  Node* oop_store,
                                  Node* obj,
                                  Node* adr,
                                  uint alias_idx,
                                  Node* val,
                                  BasicType bt,
                                  bool use_precise) const {
  // If we are writing a NULL then we need no post barrier

  if (val != NULL && val->is_Con() && val->bottom_type() == TypePtr::NULL_PTR) {
    // Must be NULL
    const Type* t = val->bottom_type();
    assert(t == Type::TOP || t == TypePtr::NULL_PTR, "must be NULL");
    // No post barrier if writing NULLx
    return;
  }

  if (use_ReduceInitialCardMarks() && obj == kit->just_allocated_object(kit->control())) {
    // We can skip marks on a freshly-allocated object in Eden.
    // Keep this code in sync with new_deferred_store_barrier() in runtime.cpp.
    // That routine informs GC to take appropriate compensating steps,
    // upon a slow-path allocation, so as to make this card-mark
    // elision safe.
    return;
  }

  if (use_ReduceInitialCardMarks()
      && g1_can_remove_post_barrier(kit, &kit->gvn(), oop_store, adr)) {
    return;
  }

  if (!use_precise) {
    // All card marks for a (non-array) instance are in one place:
    adr = obj;
  }
  // (Else it's an array (or unknown), and we want more precise card marks.)
  assert(adr != NULL, "");

  IdealKit ideal(kit, true);

  Node* tls = __ thread(); // ThreadLocalStorage

  Node* no_base = __ top();
  float likely = PROB_LIKELY_MAG(3);
  float unlikely = PROB_UNLIKELY_MAG(3);
  Node* young_card = __ ConI((jint)G1CardTable::g1_young_card_val());
  Node* dirty_card = __ ConI((jint)G1CardTable::dirty_card_val());
  Node* zeroX = __ ConX(0);

  const TypeFunc *tf = write_ref_field_post_entry_Type();

  // Offsets into the thread
  const int index_offset  = in_bytes(G1ThreadLocalData::dirty_card_queue_index_offset());
  const int buffer_offset = in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset());

  // Pointers into the thread

  Node* buffer_adr = __ AddP(no_base, tls, __ ConX(buffer_offset));
  Node* index_adr =  __ AddP(no_base, tls, __ ConX(index_offset));

  // Now some values
  // Use ctrl to avoid hoisting these values past a safepoint, which could
  // potentially reset these fields in the JavaThread.
  Node* index  = __ load(__ ctrl(), index_adr, TypeX_X, TypeX_X->basic_type(), Compile::AliasIdxRaw);
  Node* buffer = __ load(__ ctrl(), buffer_adr, TypeRawPtr::NOTNULL, T_ADDRESS, Compile::AliasIdxRaw);

  // Convert the store obj pointer to an int prior to doing math on it
  // Must use ctrl to prevent "integerized oop" existing across safepoint
  Node* cast =  __ CastPX(__ ctrl(), adr);

  // Divide pointer by card size
  Node* card_offset = __ URShiftX( cast, __ ConI(CardTable::card_shift) );

  // Combine card table base and card offset
  Node* card_adr = __ AddP(no_base, byte_map_base_node(kit), card_offset );

  // If we know the value being stored does it cross regions?

  if (val != NULL) {
    // Does the store cause us to cross regions?

    // Should be able to do an unsigned compare of region_size instead of
    // and extra shift. Do we have an unsigned compare??
    // Node* region_size = __ ConI(1 << HeapRegion::LogOfHRGrainBytes);
    Node* xor_res =  __ URShiftX ( __ XorX( cast,  __ CastPX(__ ctrl(), val)), __ ConI(HeapRegion::LogOfHRGrainBytes));

    // if (xor_res == 0) same region so skip
    __ if_then(xor_res, BoolTest::ne, zeroX, likely); {

      // No barrier if we are storing a NULL
      __ if_then(val, BoolTest::ne, kit->null(), likely); {

        // Ok must mark the card if not already dirty

        // load the original value of the card
        Node* card_val = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);

        __ if_then(card_val, BoolTest::ne, young_card, unlikely); {
          kit->sync_kit(ideal);
          kit->insert_mem_bar(Op_MemBarVolatile, oop_store);
          __ sync_kit(kit);

          Node* card_val_reload = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
          __ if_then(card_val_reload, BoolTest::ne, dirty_card); {
            g1_mark_card(kit, ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
          } __ end_if();
        } __ end_if();
      } __ end_if();
    } __ end_if();
  } else {
    // The Object.clone() intrinsic uses this path if !ReduceInitialCardMarks.
    // We don't need a barrier here if the destination is a newly allocated object
    // in Eden. Otherwise, GC verification breaks because we assume that cards in Eden
    // are set to 'g1_young_gen' (see G1CardTable::verify_g1_young_region()).
    assert(!use_ReduceInitialCardMarks(), "can only happen with card marking");
    Node* card_val = __ load(__ ctrl(), card_adr, TypeInt::INT, T_BYTE, Compile::AliasIdxRaw);
    __ if_then(card_val, BoolTest::ne, young_card); {
      g1_mark_card(kit, ideal, card_adr, oop_store, alias_idx, index, index_adr, buffer, tf);
    } __ end_if();
  }

  // Final sync IdealKit and GraphKit.
  kit->final_sync(ideal);
}

// Helper that guards and inserts a pre-barrier.
void G1BarrierSetC2::insert_pre_barrier(GraphKit* kit, Node* base_oop, Node* offset,
                                        Node* pre_val, bool need_mem_bar) const {
  // We could be accessing the referent field of a reference object. If so, when G1
  // is enabled, we need to log the value in the referent field in an SATB buffer.
  // This routine performs some compile time filters and generates suitable
  // runtime filters that guard the pre-barrier code.
  // Also add memory barrier for non volatile load from the referent field
  // to prevent commoning of loads across safepoint.

  // Some compile time checks.

  // If offset is a constant, is it java_lang_ref_Reference::_reference_offset?
  const TypeX* otype = offset->find_intptr_t_type();
  if (otype != NULL && otype->is_con() &&
      otype->get_con() != java_lang_ref_Reference::referent_offset()) {
    // Constant offset but not the reference_offset so just return
    return;
  }

  // We only need to generate the runtime guards for instances.
  const TypeOopPtr* btype = base_oop->bottom_type()->isa_oopptr();
  if (btype != NULL) {
    if (btype->isa_aryptr()) {
      // Array type so nothing to do
      return;
    }

    const TypeInstPtr* itype = btype->isa_instptr();
    if (itype != NULL) {
      // Can the klass of base_oop be statically determined to be
      // _not_ a sub-class of Reference and _not_ Object?
      ciKlass* klass = itype->klass();
      if ( klass->is_loaded() &&
          !klass->is_subtype_of(kit->env()->Reference_klass()) &&
          !kit->env()->Object_klass()->is_subtype_of(klass)) {
        return;
      }
    }
  }

  // The compile time filters did not reject base_oop/offset so
  // we need to generate the following runtime filters
  //
  // if (offset == java_lang_ref_Reference::_reference_offset) {
  //   if (instance_of(base, java.lang.ref.Reference)) {
  //     pre_barrier(_, pre_val, ...);
  //   }
  // }

  float likely   = PROB_LIKELY(  0.999);
  float unlikely = PROB_UNLIKELY(0.999);

  IdealKit ideal(kit);

  Node* referent_off = __ ConX(java_lang_ref_Reference::referent_offset());

  __ if_then(offset, BoolTest::eq, referent_off, unlikely); {
      // Update graphKit memory and control from IdealKit.
      kit->sync_kit(ideal);

      Node* ref_klass_con = kit->makecon(TypeKlassPtr::make(kit->env()->Reference_klass()));
      Node* is_instof = kit->gen_instanceof(base_oop, ref_klass_con);

      // Update IdealKit memory and control from graphKit.
      __ sync_kit(kit);

      Node* one = __ ConI(1);
      // is_instof == 0 if base_oop == NULL
      __ if_then(is_instof, BoolTest::eq, one, unlikely); {

        // Update graphKit from IdeakKit.
        kit->sync_kit(ideal);

        // Use the pre-barrier to record the value in the referent field
        pre_barrier(kit, false /* do_load */,
                    __ ctrl(),
                    NULL /* obj */, NULL /* adr */, max_juint /* alias_idx */, NULL /* val */, NULL /* val_type */,
                    pre_val /* pre_val */,
                    T_OBJECT);
        if (need_mem_bar) {
          // Add memory barrier to prevent commoning reads from this field
          // across safepoint since GC can change its value.
          kit->insert_mem_bar(Op_MemBarCPUOrder);
        }
        // Update IdealKit from graphKit.
        __ sync_kit(kit);

      } __ end_if(); // _ref_type != ref_none
  } __ end_if(); // offset == referent_offset

  // Final sync IdealKit and GraphKit.
  kit->final_sync(ideal);
}

#undef __

Node* G1BarrierSetC2::load_at_resolved(C2Access& access, const Type* val_type) const {
  DecoratorSet decorators = access.decorators();
  Node* adr = access.addr().node();
  Node* obj = access.base();

  bool anonymous = (decorators & C2_UNSAFE_ACCESS) != 0;
  bool mismatched = (decorators & C2_MISMATCHED) != 0;
  bool unknown = (decorators & ON_UNKNOWN_OOP_REF) != 0;
  bool in_heap = (decorators & IN_HEAP) != 0;
  bool in_native = (decorators & IN_NATIVE) != 0;
  bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0;
  bool is_unordered = (decorators & MO_UNORDERED) != 0;
  bool is_mixed = !in_heap && !in_native;
  bool need_cpu_mem_bar = !is_unordered || mismatched || is_mixed;

  Node* top = Compile::current()->top();
  Node* offset = adr->is_AddP() ? adr->in(AddPNode::Offset) : top;
  Node* load = CardTableBarrierSetC2::load_at_resolved(access, val_type);

  // If we are reading the value of the referent field of a Reference
  // object (either by using Unsafe directly or through reflection)
  // then, if G1 is enabled, we need to record the referent in an
  // SATB log buffer using the pre-barrier mechanism.
  // Also we need to add memory barrier to prevent commoning reads
  // from this field across safepoint since GC can change its value.
  bool need_read_barrier = in_heap && (on_weak ||
                                       (unknown && offset != top && obj != top));

  if (!access.is_oop() || !need_read_barrier) {
    return load;
  }

  assert(access.is_parse_access(), "entry not supported at optimization time");
  C2ParseAccess& parse_access = static_cast<C2ParseAccess&>(access);
  GraphKit* kit = parse_access.kit();

  if (on_weak) {
    // Use the pre-barrier to record the value in the referent field
    pre_barrier(kit, false /* do_load */,
                kit->control(),
                NULL /* obj */, NULL /* adr */, max_juint /* alias_idx */, NULL /* val */, NULL /* val_type */,
                load /* pre_val */, T_OBJECT);
    // Add memory barrier to prevent commoning reads from this field
    // across safepoint since GC can change its value.
    kit->insert_mem_bar(Op_MemBarCPUOrder);
  } else if (unknown) {
    // We do not require a mem bar inside pre_barrier if need_mem_bar
    // is set: the barriers would be emitted by us.
    insert_pre_barrier(kit, obj, offset, load, !need_cpu_mem_bar);
  }

  return load;
}

bool G1BarrierSetC2::is_gc_barrier_node(Node* node) const {
  if (CardTableBarrierSetC2::is_gc_barrier_node(node)) {
    return true;
  }
  if (node->Opcode() != Op_CallLeaf) {
    return false;
  }
  CallLeafNode *call = node->as_CallLeaf();
  if (call->_name == NULL) {
    return false;
  }

  return strcmp(call->_name, "write_ref_field_pre_entry") == 0 || strcmp(call->_name, "write_ref_field_post_entry") == 0;
}

void G1BarrierSetC2::eliminate_gc_barrier(PhaseMacroExpand* macro, Node* node) const {
  assert(node->Opcode() == Op_CastP2X, "ConvP2XNode required");
  assert(node->outcnt() <= 2, "expects 1 or 2 users: Xor and URShift nodes");
  // It could be only one user, URShift node, in Object.clone() intrinsic
  // but the new allocation is passed to arraycopy stub and it could not
  // be scalar replaced. So we don't check the case.

  // An other case of only one user (Xor) is when the value check for NULL
  // in G1 post barrier is folded after CCP so the code which used URShift
  // is removed.

  // Take Region node before eliminating post barrier since it also
  // eliminates CastP2X node when it has only one user.
  Node* this_region = node->in(0);
  assert(this_region != NULL, "");

  // Remove G1 post barrier.

  // Search for CastP2X->Xor->URShift->Cmp path which
  // checks if the store done to a different from the value's region.
  // And replace Cmp with #0 (false) to collapse G1 post barrier.
  Node* xorx = node->find_out_with(Op_XorX);
  if (xorx != NULL) {
    Node* shift = xorx->unique_out();
    Node* cmpx = shift->unique_out();
    assert(cmpx->is_Cmp() && cmpx->unique_out()->is_Bool() &&
    cmpx->unique_out()->as_Bool()->_test._test == BoolTest::ne,
    "missing region check in G1 post barrier");
    macro->replace_node(cmpx, macro->makecon(TypeInt::CC_EQ));

    // Remove G1 pre barrier.

    // Search "if (marking != 0)" check and set it to "false".
    // There is no G1 pre barrier if previous stored value is NULL
    // (for example, after initialization).
    if (this_region->is_Region() && this_region->req() == 3) {
      int ind = 1;
      if (!this_region->in(ind)->is_IfFalse()) {
        ind = 2;
      }
      if (this_region->in(ind)->is_IfFalse() &&
          this_region->in(ind)->in(0)->Opcode() == Op_If) {
        Node* bol = this_region->in(ind)->in(0)->in(1);
        assert(bol->is_Bool(), "");
        cmpx = bol->in(1);
        if (bol->as_Bool()->_test._test == BoolTest::ne &&
            cmpx->is_Cmp() && cmpx->in(2) == macro->intcon(0) &&
            cmpx->in(1)->is_Load()) {
          Node* adr = cmpx->in(1)->as_Load()->in(MemNode::Address);
          const int marking_offset = in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset());
          if (adr->is_AddP() && adr->in(AddPNode::Base) == macro->top() &&
              adr->in(AddPNode::Address)->Opcode() == Op_ThreadLocal &&
              adr->in(AddPNode::Offset) == macro->MakeConX(marking_offset)) {
            macro->replace_node(cmpx, macro->makecon(TypeInt::CC_EQ));
          }
        }
      }
    }
  } else {
    assert(!use_ReduceInitialCardMarks(), "can only happen with card marking");
    // This is a G1 post barrier emitted by the Object.clone() intrinsic.
    // Search for the CastP2X->URShiftX->AddP->LoadB->Cmp path which checks if the card
    // is marked as young_gen and replace the Cmp with 0 (false) to collapse the barrier.
    Node* shift = node->find_out_with(Op_URShiftX);
    assert(shift != NULL, "missing G1 post barrier");
    Node* addp = shift->unique_out();
    Node* load = addp->find_out_with(Op_LoadB);
    assert(load != NULL, "missing G1 post barrier");
    Node* cmpx = load->unique_out();
    assert(cmpx->is_Cmp() && cmpx->unique_out()->is_Bool() &&
           cmpx->unique_out()->as_Bool()->_test._test == BoolTest::ne,
           "missing card value check in G1 post barrier");
    macro->replace_node(cmpx, macro->makecon(TypeInt::CC_EQ));
    // There is no G1 pre barrier in this case
  }
  // Now CastP2X can be removed since it is used only on dead path
  // which currently still alive until igvn optimize it.
  assert(node->outcnt() == 0 || node->unique_out()->Opcode() == Op_URShiftX, "");
  macro->replace_node(node, macro->top());
}

Node* G1BarrierSetC2::step_over_gc_barrier(Node* c) const {
  if (!use_ReduceInitialCardMarks() &&
      c != NULL && c->is_Region() && c->req() == 3) {
    for (uint i = 1; i < c->req(); i++) {
      if (c->in(i) != NULL && c->in(i)->is_Region() &&
          c->in(i)->req() == 3) {
        Node* r = c->in(i);
        for (uint j = 1; j < r->req(); j++) {
          if (r->in(j) != NULL && r->in(j)->is_Proj() &&
              r->in(j)->in(0) != NULL &&
              r->in(j)->in(0)->Opcode() == Op_CallLeaf &&
              r->in(j)->in(0)->as_Call()->entry_point() == CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry)) {
            Node* call = r->in(j)->in(0);
            c = c->in(i == 1 ? 2 : 1);
            if (c != NULL) {
              c = c->in(0);
              if (c != NULL) {
                c = c->in(0);
                assert(call->in(0) == NULL ||
                       call->in(0)->in(0) == NULL ||
                       call->in(0)->in(0)->in(0) == NULL ||
                       call->in(0)->in(0)->in(0)->in(0) == NULL ||
                       call->in(0)->in(0)->in(0)->in(0)->in(0) == NULL ||
                       c == call->in(0)->in(0)->in(0)->in(0)->in(0), "bad barrier shape");
                return c;
              }
            }
          }
        }
      }
    }
  }
  return c;
}

#ifdef ASSERT
void G1BarrierSetC2::verify_gc_barriers(Compile* compile, CompilePhase phase) const {
  if (phase != BarrierSetC2::BeforeCodeGen) {
    return;
  }
  // Verify G1 pre-barriers
  const int marking_offset = in_bytes(G1ThreadLocalData::satb_mark_queue_active_offset());

  Unique_Node_List visited;
  Node_List worklist;
  // We're going to walk control flow backwards starting from the Root
  worklist.push(compile->root());
  while (worklist.size() > 0) {
    Node* x = worklist.pop();
    if (x == NULL || x == compile->top()) continue;
    if (visited.member(x)) {
      continue;
    } else {
      visited.push(x);
    }

    if (x->is_Region()) {
      for (uint i = 1; i < x->req(); i++) {
        worklist.push(x->in(i));
      }
    } else {
      worklist.push(x->in(0));
      // We are looking for the pattern:
      //                            /->ThreadLocal
      // If->Bool->CmpI->LoadB->AddP->ConL(marking_offset)
      //              \->ConI(0)
      // We want to verify that the If and the LoadB have the same control
      // See GraphKit::g1_write_barrier_pre()
      if (x->is_If()) {
        IfNode *iff = x->as_If();
        if (iff->in(1)->is_Bool() && iff->in(1)->in(1)->is_Cmp()) {
          CmpNode *cmp = iff->in(1)->in(1)->as_Cmp();
          if (cmp->Opcode() == Op_CmpI && cmp->in(2)->is_Con() && cmp->in(2)->bottom_type()->is_int()->get_con() == 0
              && cmp->in(1)->is_Load()) {
            LoadNode* load = cmp->in(1)->as_Load();
            if (load->Opcode() == Op_LoadB && load->in(2)->is_AddP() && load->in(2)->in(2)->Opcode() == Op_ThreadLocal
                && load->in(2)->in(3)->is_Con()
                && load->in(2)->in(3)->bottom_type()->is_intptr_t()->get_con() == marking_offset) {

              Node* if_ctrl = iff->in(0);
              Node* load_ctrl = load->in(0);

              if (if_ctrl != load_ctrl) {
                // Skip possible CProj->NeverBranch in infinite loops
                if ((if_ctrl->is_Proj() && if_ctrl->Opcode() == Op_CProj)
                    && (if_ctrl->in(0)->is_MultiBranch() && if_ctrl->in(0)->Opcode() == Op_NeverBranch)) {
                  if_ctrl = if_ctrl->in(0)->in(0);
                }
              }
              assert(load_ctrl != NULL && if_ctrl == load_ctrl, "controls must match");
            }
          }
        }
      }
    }
  }
}
#endif

bool G1BarrierSetC2::escape_add_to_con_graph(ConnectionGraph* conn_graph, PhaseGVN* gvn, Unique_Node_List* delayed_worklist, Node* n, uint opcode) const {
  if (opcode == Op_StoreP) {
    Node* adr = n->in(MemNode::Address);
    const Type* adr_type = gvn->type(adr);
    // Pointer stores in G1 barriers looks like unsafe access.
    // Ignore such stores to be able scalar replace non-escaping
    // allocations.
    if (adr_type->isa_rawptr() && adr->is_AddP()) {
      Node* base = conn_graph->get_addp_base(adr);
      if (base->Opcode() == Op_LoadP &&
          base->in(MemNode::Address)->is_AddP()) {
        adr = base->in(MemNode::Address);
        Node* tls = conn_graph->get_addp_base(adr);
        if (tls->Opcode() == Op_ThreadLocal) {
          int offs = (int) gvn->find_intptr_t_con(adr->in(AddPNode::Offset), Type::OffsetBot);
          const int buf_offset = in_bytes(G1ThreadLocalData::satb_mark_queue_buffer_offset());
          if (offs == buf_offset) {
            return true; // G1 pre barrier previous oop value store.
          }
          if (offs == in_bytes(G1ThreadLocalData::dirty_card_queue_buffer_offset())) {
            return true; // G1 post barrier card address store.
          }
        }
      }
    }
  }
  return false;
}

{'repo_name': 'openjdk/loom', 'stars': '487', 'repo_language': 'Java', 'file_name': 'properties.html', 'mime_type': 'text/html', 'hash': 7533342490051134776, 'source_dataset': 'data'}


/*
 * Copyright (c) 2013 Eugene Krasnikov <k.eugene.e@gmail.com>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef _WCN36XX_DEBUG_H_
#define _WCN36XX_DEBUG_H_

#include <linux/kernel.h>

#define WCN36xx_MAX_DUMP_ARGS	5

#ifdef CONFIG_WCN36XX_DEBUGFS
struct wcn36xx_dfs_file {
	struct dentry *dentry;
	u32 value;
};

struct wcn36xx_dfs_entry {
	struct dentry *rootdir;
	struct wcn36xx_dfs_file file_bmps_switcher;
	struct wcn36xx_dfs_file file_dump;
};

void wcn36xx_debugfs_init(struct wcn36xx *wcn);
void wcn36xx_debugfs_exit(struct wcn36xx *wcn);

#else
static inline void wcn36xx_debugfs_init(struct wcn36xx *wcn)
{
}
static inline void wcn36xx_debugfs_exit(struct wcn36xx *wcn)
{
}

#endif /* CONFIG_WCN36XX_DEBUGFS */

#endif	/* _WCN36XX_DEBUG_H_ */

{'repo_name': 'figozhang/runninglinuxkernel_4.0', 'stars': '310', 'repo_language': 'C', 'file_name': 'op-reset.c', 'mime_type': 'text/x-c', 'hash': 2224518188137093139, 'source_dataset': 'data'}