当前位置: 首页 > news >正文

如何具备阅读JAVA JDK虚拟机源码能力

源码位置https://github.com/openjdk/jdk

核心实现源码[部分截图]

图片

/* * Copyright (c) 1995, 2024, 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.  Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * 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. *//* * This file contains the main entry point into the launcher code * this is the only file which will be repeatedly compiled by other * tools. The rest of the files will be linked in. */
#include "defines.h"#include "jli_util.h"#include "jni.h"
/* * Entry point. */#ifdef JAVAW
char **__initenv;
int WINAPIWinMain(HINSTANCE inst, HINSTANCE previnst, LPSTR cmdline, int cmdshow){    int margc;    char** margv;    int jargc;    char** jargv;    const jboolean const_javaw = JNI_TRUE;
    __initenv = _environ;
#else /* JAVAW */JNIEXPORT intmain(int argc, char **argv){    int margc;    char** margv;    int jargc;    char** jargv;    const jboolean const_javaw = JNI_FALSE;#endif /* JAVAW */    {        int i, main_jargc, extra_jargc;        JLI_List list;
        main_jargc = (sizeof(const_jargs) / sizeof(char *)) > 1            ? sizeof(const_jargs) / sizeof(char *)            : 0; // ignore the null terminator index
        extra_jargc = (sizeof(const_extra_jargs) / sizeof(char *)) > 1            ? sizeof(const_extra_jargs) / sizeof(char *)            : 0; // ignore the null terminator index
        if (main_jargc > 0 && extra_jargc > 0) { // combine extra java args            jargc = main_jargc + extra_jargc;            list = JLI_List_new(jargc + 1);
            for (i = 0 ; i < extra_jargc; i++) {                JLI_List_add(list, JLI_StringDup(const_extra_jargs[i]));            }
            for (i = 0 ; i < main_jargc ; i++) {                JLI_List_add(list, JLI_StringDup(const_jargs[i]));            }
            // terminate the list            JLI_List_add(list, NULL);            jargv = list->elements;         } else if (extra_jargc > 0) { // should never happen            fprintf(stderr, "EXTRA_JAVA_ARGS defined without JAVA_ARGS");            abort();         } else { // no extra args, business as usual            jargc = main_jargc;            jargv = (char **) const_jargs;         }    }
    JLI_InitArgProcessing(jargc > 0, const_disable_argfile);
#ifdef _WIN32    {        int i = 0;        if (getenv(JLDEBUG_ENV_ENTRY) != NULL) {            printf("Windows original main args:\n");            for (i = 0 ; i < __argc ; i++) {                printf("wwwd_args[%d] = %s\n", i, __argv[i]);            }        }    }
    // Obtain the command line in UTF-16, then convert it to ANSI code page    // without the "best-fit" option    LPWSTR wcCmdline = GetCommandLineW();    int mbSize = WideCharToMultiByte(CP_ACP,        WC_NO_BEST_FIT_CHARS | WC_COMPOSITECHECK | WC_DEFAULTCHAR,        wcCmdline, -1, NULL, 0, NULL, NULL);    // If the call to WideCharToMultiByte() fails, it returns 0, which    // will then make the following JLI_MemAlloc() to issue exit(1)    LPSTR mbCmdline = JLI_MemAlloc(mbSize);    if (WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS | WC_COMPOSITECHECK | WC_DEFAULTCHAR,        wcCmdline, -1, mbCmdline, mbSize, NULL, NULL) == 0) {        perror("command line encoding conversion failure");        exit(1);    }
    JLI_CmdToArgs(mbCmdline);    JLI_MemFree(mbCmdline);
    margc = JLI_GetStdArgc();    // add one more to mark the end    margv = (char **)JLI_MemAlloc((margc + 1) * (sizeof(char *)));    {        int i = 0;        StdArg *stdargs = JLI_GetStdArgs();        for (i = 0 ; i < margc ; i++) {            margv[i] = stdargs[i].arg;        }        margv[i] = NULL;    }#else /* *NIXES */    {        // accommodate the NULL at the end        JLI_List args = JLI_List_new(argc + 1);        int i = 0;
        // Add first arg, which is the app name        JLI_List_add(args, JLI_StringDup(argv[0]));        // Append JDK_JAVA_OPTIONS        if (JLI_AddArgsFromEnvVar(args, JDK_JAVA_OPTIONS)) {            // JLI_SetTraceLauncher is not called yet            // Show _JAVA_OPTIONS content along with JDK_JAVA_OPTIONS to aid diagnosis            if (getenv(JLDEBUG_ENV_ENTRY)) {                char *tmp = getenv("_JAVA_OPTIONS");                if (NULL != tmp) {                    JLI_ReportMessage(ARG_INFO_ENVVAR, "_JAVA_OPTIONS", tmp);                }            }        }        // Iterate the rest of command line        for (i = 1; i < argc; i++) {            JLI_List argsInFile = JLI_PreprocessArg(argv[i], JNI_TRUE);            if (NULL == argsInFile) {                JLI_List_add(args, JLI_StringDup(argv[i]));            } else {                int cnt, idx;                cnt = argsInFile->size;                for (idx = 0; idx < cnt; idx++) {                    JLI_List_add(args, argsInFile->elements[idx]);                }                // Shallow free, we reuse the string to avoid copy                JLI_MemFree(argsInFile->elements);                JLI_MemFree(argsInFile);            }        }        margc = args->size;        // add the NULL pointer at argv[argc]        JLI_List_add(args, NULL);        margv = args->elements;    }#endif /* WIN32 */    return JLI_Launch(margc, margv,                   jargc, (const char**) jargv,                   0, NULL,                   VERSION_STRING,                   DOT_VERSION,                   (const_progname != NULL) ? const_progname : *margv,                   (const_launcher != NULL) ? const_launcher : *margv,                   jargc > 0,                   const_cpwildcard, const_javaw, 0);}

图片

intCallJavaMainInNewThread(jlong stack_size, void* args) {    int rslt;    pthread_t tid;    pthread_attr_t attr;    pthread_attr_init(&attr);    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);    size_t adjusted_stack_size;
    if (stack_size > 0) {        if (pthread_attr_setstacksize(&attr, stack_size) == EINVAL) {            // System may require stack size to be multiple of page size            // Retry with adjusted value            adjusted_stack_size = adjustStackSize(stack_size);            if (adjusted_stack_size != (size_t) stack_size) {                pthread_attr_setstacksize(&attr, adjusted_stack_size);            }        }    }    pthread_attr_setguardsize(&attr, 0); // no pthread guard page on java threads
    if (pthread_create(&tid, &attr, ThreadJavaMain, args) == 0) {        void* tmp;        pthread_join(tid, &tmp);        rslt = (int)(intptr_t)tmp;    } else {       /*        * Continue execution in current thread if for some reason (e.g. out of        * memory/LWP)  a new thread can't be created. This will likely fail        * later in JavaMain as JNI_CreateJavaVM needs to create quite a        * few new threads, anyway, just give it a try..        */        rslt = JavaMain(args);    }
    pthread_attr_destroy(&attr);    return rslt;}
## Copyright (c) 2004, 2024, 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 "defs.S.inc"
        # NOTE WELL!  The _Copy functions are called directly        # from server-compiler-generated code via CallLeafNoFP,        # which means that they *must* either not use floating        # point or use it in the same manner as does the server        # compiler.
        .text
        .align 16DECLARE_FUNC(SpinPause):        rep        nop        movq   $1, %rax        ret
        # Support for void Copy::arrayof_conjoint_bytes(void* from,        #                                               void* to,        #                                               size_t count)        # rdi - from        # rsi - to        # rdx - count, treated as ssize_t        #        .p2align 4,,15DECLARE_FUNC(_Copy_arrayof_conjoint_bytes):        movq     %rdx,%r8             # byte count        shrq     $3,%rdx              # qword count        cmpq     %rdi,%rsi        leaq     -1(%rdi,%r8,1),%rax  # from + bcount*1 - 1        jbe      acb_CopyRight        cmpq     %rax,%rsi        jbe      acb_CopyLeftacb_CopyRight:        leaq     -8(%rdi,%rdx,8),%rax # from + qcount*8 - 8        leaq     -8(%rsi,%rdx,8),%rcx # to + qcount*8 - 8        negq     %rdx        jmp      7f        .p2align 4,,151:      movq     8(%rax,%rdx,8),%rsi        movq     %rsi,8(%rcx,%rdx,8)        addq     $1,%rdx        jnz      1b2:      testq    $4,%r8               # check for trailing dword        jz       3f        movl     8(%rax),%esi         # copy trailing dword        movl     %esi,8(%rcx)        addq     $4,%rax        addq     $4,%rcx              # original %rsi is trashed, so we                                      #  can't use it as a base register3:      testq    $2,%r8               # check for trailing word        jz       4f        movw     8(%rax),%si          # copy trailing word        movw     %si,8(%rcx)        addq     $2,%rcx4:      testq    $1,%r8               # check for trailing byte        jz       5f        movb     -1(%rdi,%r8,1),%al   # copy trailing byte        movb     %al,8(%rcx)5:      ret        .p2align 4,,156:      movq     -24(%rax,%rdx,8),%rsi        movq     %rsi,-24(%rcx,%rdx,8)        movq     -16(%rax,%rdx,8),%rsi        movq     %rsi,-16(%rcx,%rdx,8)        movq     -8(%rax,%rdx,8),%rsi        movq     %rsi,-8(%rcx,%rdx,8)        movq     (%rax,%rdx,8),%rsi        movq     %rsi,(%rcx,%rdx,8)7:      addq     $4,%rdx        jle      6b        subq     $4,%rdx        jl       1b        jmp      2bacb_CopyLeft:        testq    $1,%r8               # check for trailing byte        jz       1f        movb     -1(%rdi,%r8,1),%cl   # copy trailing byte        movb     %cl,-1(%rsi,%r8,1)        subq     $1,%r8               # adjust for possible trailing word1:      testq    $2,%r8               # check for trailing word        jz       2f        movw     -2(%rdi,%r8,1),%cx   # copy trailing word        movw     %cx,-2(%rsi,%r8,1)2:      testq    $4,%r8               # check for trailing dword        jz       5f        movl     (%rdi,%rdx,8),%ecx   # copy trailing dword        movl     %ecx,(%rsi,%rdx,8)        jmp      5f        .p2align 4,,153:      movq     -8(%rdi,%rdx,8),%rcx        movq     %rcx,-8(%rsi,%rdx,8)        subq     $1,%rdx        jnz      3b        ret        .p2align 4,,154:      movq     24(%rdi,%rdx,8),%rcx        movq     %rcx,24(%rsi,%rdx,8)        movq     16(%rdi,%rdx,8),%rcx        movq     %rcx,16(%rsi,%rdx,8)        movq     8(%rdi,%rdx,8),%rcx        movq     %rcx,8(%rsi,%rdx,8)        movq     (%rdi,%rdx,8),%rcx        movq     %rcx,(%rsi,%rdx,8)5:      subq     $4,%rdx        jge      4b        addq     $4,%rdx        jg       3b        ret
        # Support for void Copy::arrayof_conjoint_jshorts(void* from,        #                                                 void* to,        #                                                 size_t count)        # Equivalent to        #   conjoint_jshorts_atomic        #        # If 'from' and/or 'to' are aligned on 4- or 2-byte boundaries, we        # let the hardware handle it.  The tow or four words within dwords        # or qwords that span cache line boundaries will still be loaded        # and stored atomically.        #        # rdi - from        # rsi - to        # rdx - count, treated as ssize_t        #        .p2align 4,,15DECLARE_FUNC(_Copy_arrayof_conjoint_jshorts):DECLARE_FUNC(_Copy_conjoint_jshorts_atomic):        movq     %rdx,%r8             # word count        shrq     $2,%rdx              # qword count        cmpq     %rdi,%rsi        leaq     -2(%rdi,%r8,2),%rax  # from + wcount*2 - 2        jbe      acs_CopyRight        cmpq     %rax,%rsi        jbe      acs_CopyLeftacs_CopyRight:        leaq     -8(%rdi,%rdx,8),%rax # from + qcount*8 - 8        leaq     -8(%rsi,%rdx,8),%rcx # to + qcount*8 - 8        negq     %rdx        jmp      6f1:      movq     8(%rax,%rdx,8),%rsi        movq     %rsi,8(%rcx,%rdx,8)        addq     $1,%rdx        jnz      1b2:      testq    $2,%r8               # check for trailing dword        jz       3f        movl     8(%rax),%esi         # copy trailing dword        movl     %esi,8(%rcx)        addq     $4,%rcx              # original %rsi is trashed, so we                                      #  can't use it as a base register3:      testq    $1,%r8               # check for trailing word        jz       4f        movw     -2(%rdi,%r8,2),%si   # copy trailing word        movw     %si,8(%rcx)4:      ret        .p2align 4,,155:      movq     -24(%rax,%rdx,8),%rsi        movq     %rsi,-24(%rcx,%rdx,8)        movq     -16(%rax,%rdx,8),%rsi        movq     %rsi,-16(%rcx,%rdx,8)        movq     -8(%rax,%rdx,8),%rsi        movq     %rsi,-8(%rcx,%rdx,8)        movq     (%rax,%rdx,8),%rsi        movq     %rsi,(%rcx,%rdx,8)6:      addq     $4,%rdx        jle      5b        subq     $4,%rdx        jl       1b        jmp      2bacs_CopyLeft:        testq    $1,%r8               # check for trailing word        jz       1f        movw     -2(%rdi,%r8,2),%cx   # copy trailing word        movw     %cx,-2(%rsi,%r8,2)1:      testq    $2,%r8               # check for trailing dword        jz       4f        movl     (%rdi,%rdx,8),%ecx   # copy trailing dword        movl     %ecx,(%rsi,%rdx,8)        jmp      4f2:      movq     -8(%rdi,%rdx,8),%rcx        movq     %rcx,-8(%rsi,%rdx,8)        subq     $1,%rdx        jnz      2b        ret        .p2align 4,,153:      movq     24(%rdi,%rdx,8),%rcx        movq     %rcx,24(%rsi,%rdx,8)        movq     16(%rdi,%rdx,8),%rcx        movq     %rcx,16(%rsi,%rdx,8)        movq     8(%rdi,%rdx,8),%rcx        movq     %rcx,8(%rsi,%rdx,8)        movq     (%rdi,%rdx,8),%rcx        movq     %rcx,(%rsi,%rdx,8)4:      subq     $4,%rdx        jge      3b        addq     $4,%rdx        jg       2b        ret
        # Support for void Copy::arrayof_conjoint_jints(jint* from,        #                                               jint* to,        #                                               size_t count)        # Equivalent to        #   conjoint_jints_atomic        #        # If 'from' and/or 'to' are aligned on 4-byte boundaries, we let        # the hardware handle it.  The two dwords within qwords that span        # cache line boundaries will still be loaded and stored atomically.        #        # rdi - from        # rsi - to        # rdx - count, treated as ssize_t        #        .p2align 4,,15DECLARE_FUNC(_Copy_arrayof_conjoint_jints):DECLARE_FUNC(_Copy_conjoint_jints_atomic):        movq     %rdx,%r8             # dword count        shrq     %rdx                 # qword count        cmpq     %rdi,%rsi        leaq     -4(%rdi,%r8,4),%rax  # from + dcount*4 - 4        jbe      aci_CopyRight        cmpq     %rax,%rsi        jbe      aci_CopyLeftaci_CopyRight:        leaq     -8(%rdi,%rdx,8),%rax # from + qcount*8 - 8        leaq     -8(%rsi,%rdx,8),%rcx # to + qcount*8 - 8        negq     %rdx        jmp      5f        .p2align 4,,151:      movq     8(%rax,%rdx,8),%rsi        movq     %rsi,8(%rcx,%rdx,8)        addq     $1,%rdx        jnz       1b2:      testq    $1,%r8               # check for trailing dword        jz       3f        movl     8(%rax),%esi         # copy trailing dword        movl     %esi,8(%rcx)3:      ret        .p2align 4,,154:      movq     -24(%rax,%rdx,8),%rsi        movq     %rsi,-24(%rcx,%rdx,8)        movq     -16(%rax,%rdx,8),%rsi        movq     %rsi,-16(%rcx,%rdx,8)        movq     -8(%rax,%rdx,8),%rsi        movq     %rsi,-8(%rcx,%rdx,8)        movq     (%rax,%rdx,8),%rsi        movq     %rsi,(%rcx,%rdx,8)5:      addq     $4,%rdx        jle      4b        subq     $4,%rdx        jl       1b        jmp      2baci_CopyLeft:        testq    $1,%r8               # check for trailing dword        jz       3f        movl     -4(%rdi,%r8,4),%ecx  # copy trailing dword        movl     %ecx,-4(%rsi,%r8,4)        jmp      3f1:      movq     -8(%rdi,%rdx,8),%rcx        movq     %rcx,-8(%rsi,%rdx,8)        subq     $1,%rdx        jnz      1b        ret        .p2align 4,,152:      movq     24(%rdi,%rdx,8),%rcx        movq     %rcx,24(%rsi,%rdx,8)        movq     16(%rdi,%rdx,8),%rcx        movq     %rcx,16(%rsi,%rdx,8)        movq     8(%rdi,%rdx,8),%rcx        movq     %rcx,8(%rsi,%rdx,8)        movq     (%rdi,%rdx,8),%rcx        movq     %rcx,(%rsi,%rdx,8)3:      subq     $4,%rdx        jge      2b        addq     $4,%rdx        jg       1b        ret
        # Support for void Copy::arrayof_conjoint_jlongs(jlong* from,        #                                                jlong* to,        #                                                size_t count)        # Equivalent to        #   conjoint_jlongs_atomic        #   arrayof_conjoint_oops        #   conjoint_oops_atomic        #        # rdi - from        # rsi - to        # rdx - count, treated as ssize_t        #        .p2align 4,,15DECLARE_FUNC(_Copy_arrayof_conjoint_jlongs):DECLARE_FUNC(_Copy_conjoint_jlongs_atomic):        cmpq     %rdi,%rsi        leaq     -8(%rdi,%rdx,8),%rax # from + count*8 - 8        jbe      acl_CopyRight        cmpq     %rax,%rsi        jbe      acl_CopyLeftacl_CopyRight:        leaq     -8(%rsi,%rdx,8),%rcx # to + count*8 - 8        negq     %rdx        jmp      3f1:      movq     8(%rax,%rdx,8),%rsi        movq     %rsi,8(%rcx,%rdx,8)        addq     $1,%rdx        jnz      1b        ret        .p2align 4,,152:      movq     -24(%rax,%rdx,8),%rsi        movq     %rsi,-24(%rcx,%rdx,8)        movq     -16(%rax,%rdx,8),%rsi        movq     %rsi,-16(%rcx,%rdx,8)        movq     -8(%rax,%rdx,8),%rsi        movq     %rsi,-8(%rcx,%rdx,8)        movq     (%rax,%rdx,8),%rsi        movq     %rsi,(%rcx,%rdx,8)3:      addq     $4,%rdx        jle      2b        subq     $4,%rdx        jl       1b        ret4:      movq     -8(%rdi,%rdx,8),%rcx        movq     %rcx,-8(%rsi,%rdx,8)        subq     $1,%rdx        jnz      4b        ret        .p2align 4,,155:      movq     24(%rdi,%rdx,8),%rcx        movq     %rcx,24(%rsi,%rdx,8)        movq     16(%rdi,%rdx,8),%rcx        movq     %rcx,16(%rsi,%rdx,8)        movq     8(%rdi,%rdx,8),%rcx        movq     %rcx,8(%rsi,%rdx,8)        movq     (%rdi,%rdx,8),%rcx        movq     %rcx,(%rsi,%rdx,8)acl_CopyLeft:        subq     $4,%rdx        jge      5b        addq     $4,%rdx        jg       4b        ret

图片

图片

JAVA JDK的源码是C,C++,ASM实现,其中编译原理,算法,数据结构,JIT等技术点知识已经融入到代码里。

图片

图片

图片

图片

通过学习《程序员内功修炼》《编译器实现》《github c语言大型开源项目源码吸收转化实践》这3门课程足以。

图片

图片

https://beifengisnil.github.io/

talk is cheap, show me the code

这个code里面欧美程序员已经将编译原理,算法,数据结构,操作系统,数学,工程,AI等不计其数的知识体系已经融入实现到代码里,并且持续用了几十年,这些code是面向全球用户市场的,且具有强大的技术经济价值,创新能力,市场开发能力,这几十年的编译原理,算法,数学,工程,AI等知识早就code等着你去吸收转化。

code已经给你show了,就看你有没有一套系统的方法去吸收,这3门课程主要传授的是一套系统的方法去获取和运用各种技术知识,而不是教你一门技术,技术是会过时的。

相关文章:

如何具备阅读JAVA JDK虚拟机源码能力

源码位置https://github.com/openjdk/jdk 核心实现源码[部分截图] /* * Copyright (c) 1995, 2024, 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 redistr…...

Python | Leetcode Python题解之第514题自由之路

题目&#xff1a; 题解&#xff1a; Test "godding" target "d"i 0left i lc 0 right i rc 0while Test[left] ! target:left - 1lc 1if left -1:left len(Test) - 1while Test[right] ! target:right 1rc 1if right len(Test):right 0prin…...

Docker 镜像下载问题及解决办法

Docker 镜像下载问题及解决办法 我在杂乱的、破旧的村庄寂寞地走过漫长的雨季&#xff0c;将我年少的眼光从晦暗的日子里打捞出来的是一棵棵开花的树&#xff0c;它们以一串串卓然不俗的花擦明了我的眼睛&#xff0c;也洗净了我的灵魂。 引言 在使用 Docker 时&#xff0c;用户…...

2分钟搞定 HarmonyOs Next创建模拟器

官方文档参考链接&#xff1a; 创建模拟器-管理模拟器-使用模拟器运行应用/服务-应用/服务运行-DevEco Studio - 华为HarmonyOS开发者https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/ide-emulator-create-V5 1. 首先打开Device Manager 2. 进入这个界面后…...

方形件排样优化与订单组批问题探析

方形件排样优化与订单组批问题是计算复杂度很高的组合优化问题&#xff0c;在工业工程中有很广泛的应用背景。为实现个性化定制生产模式&#xff0c;企业会选择订单组批的方式&#xff0c;继而通过排样优化实现批量切割&#xff0c;加工完成后再按照不同客户需求进行分拣&#…...

vue3组件通信--自定义事件

自定义事件是典型的子传父的方法。 为什么叫自定义事件呢&#xff1f;是因为我们用sendToy"getToy"这种格式写&#xff0c;很显然&#xff0c;在DOM中&#xff0c;没有叫sendToy的事件。 父组件FatherComponent.vue: <script setup> import ChildComponent fr…...

ubuntu 安装k3s

配置hostname的方法为 hostnamectl set-hostname k3sserver hostnamectlsudo apt-get update && sudo apt-get upgrade -y sudo apt-get install -y curl#手动下载v1.31.1k3s1 https://github.com/k3s-io/k3s/releases/tag/v1.31.1%2Bk3s1 #将k3s-airgap-images-amd64…...

SQL CHECK 约束:确保数据完整性的关键

SQL CHECK 约束:确保数据完整性的关键 在数据库管理中,确保数据的完整性和准确性是至关重要的。SQL(Structured Query Language)提供了多种约束条件来帮助实现这一目标,其中之一就是 CHECK 约束。本文将深入探讨 SQL CHECK 约束的概念、用法和优势,并展示如何在不同的数…...

C++ | Leetcode C++题解之第502题IPO

题目&#xff1a; 题解&#xff1a; typedef pair<int,int> pii;class Solution { public:int findMaximizedCapital(int k, int w, vector<int>& profits, vector<int>& capital) {int n profits.size();int curr 0;priority_queue<int, vect…...

《虚拟现实的边界:探索虚拟世界的未来可能》

内容概要 在虚拟现实&#xff08;VR&#xff09;技术的浪潮中&#xff0c;我们见证了其从实验室的奇想逐渐走向日常生活的非凡旅程。技术发展的背后是不断突破的创新&#xff0c;早期的设备虽然笨重&#xff0c;但如今却趋向精致、轻巧&#xff0c;用户体验显著提升。想象一下…...

Rust教程

2024 Rust现代实用教程&#xff1a;1.1Rust简介与安装更新––2024 Rust现代实用教程&#xff1a;1.2编译器与包管理工具以及开发环境–––––––––––...

测试代理IP的有效性和可用性

使用代理IP的有效性和可用性直接关系到用户的工作效率&#xff0c;尤其是在进行数据抓取、网络爬虫和保护个人隐私等场景中。 一、测试代理IP的必要性 代理IP的可用性测试是确保代理服务正常运行的重要步骤。测试代理IP的必要性主要体现在以下几个方面&#xff1a; 提升工作…...

散列表:为什么经常把散列表和链表放在一起使用?

散列表:为什么经常把散列表和链表放在一起使用? 在计算机科学中,散列表(哈希表)和链表是两种常见的数据结构。你可能会好奇,为什么它们经常被放在一起使用呢?让我们一起来深入探讨这个问题。 一、散列表的特点 散列表是一种根据关键码值(Key value)而直接进行访问的…...

计算机网络:网络层 —— IPv4 地址与 MAC 地址 | ARP 协议

文章目录 IPv4地址与MAC地址的封装位置IPv4地址与MAC地址的关系地址解析协议ARP工作原理ARP高速缓存表 IPv4地址与MAC地址的封装位置 在数据传输过程中&#xff0c;每一层都会添加自己的头部信息&#xff0c;最终形成完整的数据包。具体来说&#xff1a; 应用层生成的应用程序…...

PMP--一、二、三模、冲刺、必刷--分类--10.沟通管理--技巧--文化意识

文章目录 技巧一模10.沟通管理--1.规划沟通管理--文化意识--军事背景和非军事背景人员有文化差异文化意识&#xff1a;题干关键词 “两拨人的背景不同、文化差异、风格差异”。5、 [单选] 项目团队由前军事和非军事小组成员组成。没有军事背景的团队成员认为前军事团队成员在他…...

FileReader和FileWriter

FileReader 使用read()方法读取单个字符&#xff0c;下面是如何修改使程序性能更好的过程。 第一种&#xff1a;处理异常方式为throws Testpublic void test() throws IOException {//读取hello.txt&#xff0c;并显示内容// 创建文件对象File file new File("hello.txt…...

【UE5】将2D切片图渲染为体积纹理,最终实现使用RT实时绘制体积纹理【第六篇-阶段总结篇】

因为马上就要进入下一个阶段&#xff0c;制作动态编辑体积纹理的模块。 但在这之前&#xff0c;要在这一章做最后一些整理。 首先&#xff0c;我们完成没完成的部分。其次&#xff0c;最后整理一下图表。最后&#xff0c;本文附上正在用的贴图 完善Shader 还记得我们之前注…...

地球村上一些可能有助于赚钱的20个思维方式

地球村上一些可能有助于赚钱的20个思维方式&#xff1a; 1. 目标导向思维&#xff1a;明确自己的财务目标&#xff0c;并制定详细、可执行的计划来逐步实现。 2. 创新思维&#xff1a;不断寻求新的商业机会和独特的解决方案&#xff0c;以在竞争激烈的市场中脱颖而出。 3. 价值…...

0基础入门matlab

目录 一、命令 二、变量命名 三、数据类型 数字 字符和字符串 矩阵 rand、randi和randn的区别&#xff1f; 元胞数组和结构体 MAGIC 结构体 四、矩阵构造、四则运算、矩阵下标 五、MATLAB逻辑与流程控制 六、MATLAB绘图 二维平面绘图 三维平面绘图 导出图片 内…...

【前端】实操tips集合

1. 关闭vue中组件名字的多词校验 (1) package.json文件中修改eslint配置 "eslintConfig": {"rules": {"vue/multi-word-component-names":"off" }}, &#xff08;2&#xff09;.eslintrc.js或者.eslintrc配置文件中进行配置 modu…...

React hook之useRef

React useRef 详解 useRef 是 React 提供的一个 Hook&#xff0c;用于在函数组件中创建可变的引用对象。它在 React 开发中有多种重要用途&#xff0c;下面我将全面详细地介绍它的特性和用法。 基本概念 1. 创建 ref const refContainer useRef(initialValue);initialValu…...

MySQL 隔离级别:脏读、幻读及不可重复读的原理与示例

一、MySQL 隔离级别 MySQL 提供了四种隔离级别,用于控制事务之间的并发访问以及数据的可见性,不同隔离级别对脏读、幻读、不可重复读这几种并发数据问题有着不同的处理方式,具体如下: 隔离级别脏读不可重复读幻读性能特点及锁机制读未提交(READ UNCOMMITTED)允许出现允许…...

《从零掌握MIPI CSI-2: 协议精解与FPGA摄像头开发实战》-- CSI-2 协议详细解析 (一)

CSI-2 协议详细解析 (一&#xff09; 1. CSI-2层定义&#xff08;CSI-2 Layer Definitions&#xff09; 分层结构 &#xff1a;CSI-2协议分为6层&#xff1a; 物理层&#xff08;PHY Layer&#xff09; &#xff1a; 定义电气特性、时钟机制和传输介质&#xff08;导线&#…...

《Playwright:微软的自动化测试工具详解》

Playwright 简介:声明内容来自网络&#xff0c;将内容拼接整理出来的文档 Playwright 是微软开发的自动化测试工具&#xff0c;支持 Chrome、Firefox、Safari 等主流浏览器&#xff0c;提供多语言 API&#xff08;Python、JavaScript、Java、.NET&#xff09;。它的特点包括&a…...

Java多线程实现之Callable接口深度解析

Java多线程实现之Callable接口深度解析 一、Callable接口概述1.1 接口定义1.2 与Runnable接口的对比1.3 Future接口与FutureTask类 二、Callable接口的基本使用方法2.1 传统方式实现Callable接口2.2 使用Lambda表达式简化Callable实现2.3 使用FutureTask类执行Callable任务 三、…...

sqlserver 根据指定字符 解析拼接字符串

DECLARE LotNo NVARCHAR(50)A,B,C DECLARE xml XML ( SELECT <x> REPLACE(LotNo, ,, </x><x>) </x> ) DECLARE ErrorCode NVARCHAR(50) -- 提取 XML 中的值 SELECT value x.value(., VARCHAR(MAX))…...

【Web 进阶篇】优雅的接口设计:统一响应、全局异常处理与参数校验

系列回顾&#xff1a; 在上一篇中&#xff0c;我们成功地为应用集成了数据库&#xff0c;并使用 Spring Data JPA 实现了基本的 CRUD API。我们的应用现在能“记忆”数据了&#xff01;但是&#xff0c;如果你仔细审视那些 API&#xff0c;会发现它们还很“粗糙”&#xff1a;有…...

Pinocchio 库详解及其在足式机器人上的应用

Pinocchio 库详解及其在足式机器人上的应用 Pinocchio (Pinocchio is not only a nose) 是一个开源的 C 库&#xff0c;专门用于快速计算机器人模型的正向运动学、逆向运动学、雅可比矩阵、动力学和动力学导数。它主要关注效率和准确性&#xff0c;并提供了一个通用的框架&…...

视觉slam十四讲实践部分记录——ch2、ch3

ch2 一、使用g++编译.cpp为可执行文件并运行(P30) g++ helloSLAM.cpp ./a.out运行 二、使用cmake编译 mkdir build cd build cmake .. makeCMakeCache.txt 文件仍然指向旧的目录。这表明在源代码目录中可能还存在旧的 CMakeCache.txt 文件,或者在构建过程中仍然引用了旧的路…...

七、数据库的完整性

七、数据库的完整性 主要内容 7.1 数据库的完整性概述 7.2 实体完整性 7.3 参照完整性 7.4 用户定义的完整性 7.5 触发器 7.6 SQL Server中数据库完整性的实现 7.7 小结 7.1 数据库的完整性概述 数据库完整性的含义 正确性 指数据的合法性 有效性 指数据是否属于所定…...